-
Notifications
You must be signed in to change notification settings - Fork 23
/
configure.common.ac
520 lines (461 loc) · 21.1 KB
/
configure.common.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
#Configure operations that are common between the Spindle and Spindle-client configurations
#Network port and local storage location
DEFAULT_PORT=21940
DEFAULT_LOC='$TMPDIR'
DEFAULT_NUM_COBO_PORTS=25
AM_MAINTAINER_MODE([disable])
AC_SUBST([AR_FLAGS], [cr])
AC_ARG_WITH(default-port,
[AS_HELP_STRING([--with-default-port=NUM],[TCP/IP Port for Spindle server communication])],
[SPINDLE_PORT=${withval}],
[SPINDLE_PORT=$DEFAULT_PORT])
AC_ARG_WITH(default-num-ports,
[AS_HELP_STRING([--with-default-numports=NUM],[Number of TCP/IP ports to scan for Spindle server communication])],
[NUM_COBO_PORTS=${withval}],
[NUM_COBO_PORTS=$DEFAULT_NUM_COBO_PORTS])
AC_ARG_WITH(localstorage,
[AS_HELP_STRING([--with-localstorage=DIR],[Directory on back-ends for storing relocated files])],
[SPINDLE_LOC=${withval}],
[SPINDLE_LOC=$DEFAULT_LOC])
AC_DEFINE_UNQUOTED([SPINDLE_PORT],[$SPINDLE_PORT],[The default port for Spindle])
AC_DEFINE_UNQUOTED([NUM_COBO_PORTS],[$NUM_COBO_PORTS],[Number of ports for COBO to search for an open port])
AC_DEFINE_UNQUOTED([SPINDLE_MAX_PORT],[$(($SPINDLE_PORT + $NUM_COBO_PORTS - 1))],[The maximum port value])
AC_DEFINE_UNQUOTED([SPINDLE_LOC],"[$SPINDLE_LOC]",[The default local directory for Spindle])
TESTRM=unknown
AC_ARG_WITH(testrm,
[AS_HELP_STRING([--with-testrm=ARG],[])],
[TESTRM=${withval}],
[])
AC_ARG_WITH(rm,
[AS_HELP_STRING([--with-rm=ARG],[Default resource manager (valid options are 'slurm', 'lrun', 'jsrun', and 'flux')])],
[TESTRM=${withval}],
[])
if test "x$TESTRM" == "xunknown"; then
AC_MSG_WARN(["--with-rm not specified. Tests will not work"])
fi
AC_SUBST(TESTRM)
AC_DEFINE_UNQUOTED([TESTRM], "[$TESTRM]", [Default recource manager])
#OS Detection
AC_ARG_ENABLE(bluegene,
[AS_HELP_STRING([--enable-bluegene],[Build Spindle for BlueGene/Q])],
[OS_BUILD=bluegene],)
if test "x$OS_BUILD" == "x"; then
OS_BUILD=linux
fi
#Startup type
AC_ARG_WITH(hostbin,
[AS_HELP_STRING([--with-hostbin=EXE],[Executable for returning host lists for jobs])],
[AC_DEFINE_UNQUOTED([HOSTBIN_PATH],"[${withval}]",[Hostbin executable])],)
#RSH mode settings
AC_ARG_WITH(rsh-launch,
[AS_HELP_STRING([--with-rsh-launch],[Enable rsh launch mode by default for startup modes that support it])],
[ENABLE_RSH_LAUNCH=1],)
AC_ARG_WITH(rsh-cmd,
[AS_HELP_STRING([--with-rsh-cmd=EXE],[Executable to use for rsh/ssh when running in rsh launch mode])],
[AC_DEFINE_UNQUOTED([RSHLAUNCH_CMD],"[${withval}]",[RSH command])],)
AC_ARG_WITH(slurm-launch,
[AS_HELP_STRING([--with-slurm-launch],[Enable using slurm to launch spindle daemons])],
[ENABLE_SLURM_LAUNCH=1],)
AS_CASE([$sysconfdir],
[*/spindle],[PKGSYSCONF_DIR=$sysconfdir],
[*/spindle/],[PKGSYSCONF_DIR=$sysconfdir],
[PKGSYSCONF_DIR=$sysconfdir/spindle])
BROKEN_SRUN=0
bad_srun_major=20
bad_srun_minor=11
good_srun_major=0
good_srun_minor=0
if test "x$TESTRM" == "xslurm"; then
AC_PATH_PROG(SRUN_PATH, "srun", "none")
if test "x$SRUN_PATH" == "xnone"; then
AC_MSG_ERROR([Slurm support was requested but could not find srun in PATH])
fi
AC_MSG_CHECKING([slurm version for compatibility])
srun_version=`${SRUN_PATH} --version | cut -d ' ' -f 2`
srun_major=`echo $srun_version | cut -d . -f 1`
srun_minor=`echo $srun_version | cut -d . -f 2`
srun_point=`echo $srun_version | cut -d . -f 3`
if ( [[ "$srun_major" == "$bad_srun_major" ]] && [[ $srun_minor -ge $bad_srun_minor ]] ) || [[ $srun_major -gt $bad_srun_major ]] ; then BROKEN_SRUN=1; fi
if test "x$good_srun_major" != "x0"; then
if ( [[ "$srun_major" == "$good_srun_major" ]] && [[ $srun_minor -ge $good_srun_minor ]] ) || [[ $srun_major -gt $good_srun_major ]] ; then BROKEN_SRUN=0; fi
fi
if test "x$BROKEN_SRUN" == "x1"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
if [[ "x$ENABLE_SLURM_LAUNCH" == "x1" ]] && [[ "x$BROKEN_SRUN" == "x1" ]] ; then
AC_MSG_WARN([Slurm launching was explicitly requested, but slurm $srun_version, which is later than $bad_srun_major.$bad_srun_minor, was detected. This version of slurm breaks spindle daemon launch. You might still be able to get spindle to work by running jobs with srun's --overlap option. Or you could switch to having spindle launch daemons with rsh/ssh by passing the --with-rsh-launch option, and ensuring that rsh/ssh to nodes works on your cluster.])
fi
if [[ "x$ENABLE_RSH_LAUNCH" != "x1" ]] && [[ "x$ENABLE_SLURM_LAUNCH" != "x1" ]] ; then
if test "x$BROKEN_SRUN" == "x1"; then
AC_MSG_ERROR([Slurm support was requested, but slurm $srun_version, which is later than $bad_srun_major.$bad_srun_minor, was detected. This version of slurm breaks spindle daemon launch. You can disable this error message and build spindle with slurm-based daemon launching anyways by explicitly passing the --with-slurm-launch option (you might still be able to get spindle to work by running jobs with srun's --overlap option). Or you could switch to having spindle launch daemons with rsh/ssh by passing the --with-rsh-launch option, and ensuring that rsh/ssh to nodes works on your cluster.])
else
ENABLE_SLURM_LAUNCH=1
fi
fi
fi
if test "x$ENABLE_SLURM_LAUNCH" == "x1"; then
AC_DEFINE_UNQUOTED([SLURMLAUNCH_ENABLED],[1],[Default mode for slurm launch])
fi
if test "x$ENABLE_RSH_LAUNCH" == "x1"; then
AC_DEFINE_UNQUOTED([RSHLAUNCH_ENABLED],[1],[Default mode for rsh launch])
fi
AC_DEFINE_UNQUOTED([BROKEN_SRUN],[1],[Whether we are using a broken srun])
#Runmode detection (pipe/socket or cobo/msocket communications)
if test "x$OS_BUILD" == "xlinux"; then
CLIENT_SERVER_COM=pipes
fi
if test "x$OS_BUILD" == "xbluegene"; then
CLIENT_SERVER_COM=biter
fi
SERVER_SERVER_COM=cobo
AC_ARG_ENABLE(pipes,
[AS_HELP_STRING([--enable-pipes],[Use pipes for server/client communication])],
[CLIENT_SERVER_COM=pipes;],)
AC_ARG_ENABLE(socket,
[AS_HELP_STRING([--enable-socket],[Use sockets for server/client communication])],
[CLIENT_SERVER_COM=sockets;],)
AC_ARG_ENABLE(shmem,
[AS_HELP_STRING([--enable-shmem],[Use shared memory for server/client communication])],
[CLIENT_SERVER_COM=shmem;],)
AC_ARG_ENABLE(biter,
[AS_HELP_STRING([--enable-biter],[Use biter for server/client communication])],
[CLIENT_SERVER_COM=biter;],)
AC_ARG_ENABLE(msocket,
[AS_HELP_STRING([--enable-msocket],[Use msocket for inter-server communication])],
[SERVER_SERVER_COM=msocket;],)
AC_ARG_ENABLE(cobo,
[AS_HELP_STRING([--enable-cobo],[Use msocket for inter-server communication])],
[SERVER_SERVER_COM=cobo;],)
AM_CONDITIONAL([PIPES], [test x$CLIENT_SERVER_COM == xpipes])
AM_CONDITIONAL([SOCKETS], [test x$CLIENT_SERVER_COM == xsocket])
AM_CONDITIONAL([SHMEM], [test x$CLIENT_SERVER_COM == xshmem])
AM_CONDITIONAL([BITER], [test x$CLIENT_SERVER_COM == xbiter])
AM_CONDITIONAL([MSOCKET], [test x$SERVER_SERVER_COM == xmsocket])
AM_CONDITIONAL([COBO], [test x$SERVER_SERVER_COM == xcobo])
if test "x$CLIENT_SERVER_COM" == "xpipes"; then
AC_DEFINE([COMM_PIPES],[1],[Define if were using pipes for client/server communication])
fi
if test "x$CLIENT_SERVER_COM" == "xsocket"; then
AC_DEFINE([COMM_SOCKET],[1],[Define if were using sockets for client/server communication])
fi
if test "x$CLIENT_SERVER_COM" == "xbiter"; then
AC_DEFINE([COMM_BITER],[1],[Define if were using biter for client/server communication])
fi
if test "x$SERVER_SERVER_COM" == "xmsocket"; then
AC_DEFINE([COMM_MSOCKET],[1],[Define if were using msocket for server/server communication])
fi
if test "x$SERVER_SERVER_COM" == "xcobo"; then
AC_DEFINE([COMM_COBO],[1],[Define if were using cobo for server/server communication])
fi
AC_MSG_NOTICE([Communication is $CLIENT_SERVER_COM/$SERVER_SERVER_COM])
#Architecture detection
if test "x$target_cpu" == "xx86_64"; then
AC_DEFINE([arch_x86_64],[1],[Define if we're compiling for an x86_64 target])
ARCH_BUILD=x86_64
fi
if test "x$target_cpu" == "xppc64le"; then
AC_DEFINE([arch_ppc64le],[1],[Define if we're compiling for a ppc64le target])
ARCH_BUILD=ppc64le
fi
if test "x$target_cpu" == "xpowerpc64le"; then
AC_DEFINE([arch_ppc64le],[1],[Define if we're compiling for a ppc64le target])
ARCH_BUILD=ppc64le
fi
if test "x$target_cpu" == "xppc64"; then
AC_DEFINE([arch_ppc64],[1],[Define if we're compiling for a ppc64 target])
ARCH_BUILD=ppc64
fi
if test "x$target_cpu" == "xpowerpc64"; then
AC_DEFINE([arch_ppc64],[1],[Define if we're compiling for a ppc64 target])
ARCH_BUILD=ppc64
fi
if test "x$target_cpu" == "xppc32"; then
AC_DEFINE([arch_ppc32],[1],[Define if we're compiling for a ppc64 target])
ARCH_BUILD=ppc64
fi
if test "x$target_cpu" == "xpowerpc32"; then
AC_DEFINE([arch_ppc32],[1],[Define if we're compiling for a ppc64 target])
ARCH_BUILD=ppc64
fi
if test "x$target_cpu" == "xaarch64"; then
AC_DEFINE([arch_aarch64],[1],[Define if we're compiling for an aarch64 target])
ARCH_BUILD=aarch64
fi
#OS defines
AM_CONDITIONAL([BGQ_BLD], [test "x$OS_BUILD" == "xbluegene"])
AM_CONDITIONAL([LINUX_BLD], [test "x$OS_BUILD" == "xlinux"])
AM_CONDITIONAL([X86_64_BLD], [test "x$ARCH_BUILD" == "xx86_64"])
AM_CONDITIONAL([PPC64_BLD], [test "x$ARCH_BUILD" == "xppc64"])
AM_CONDITIONAL([PPC64LE_BLD], [test "x$ARCH_BUILD" == "xppc64le"])
AM_CONDITIONAL([AARCH64_BLD], [test "x$ARCH_BUILD" == "xaarch64"])
if test "x$OS_BUILD" == "xlinux"; then
AC_DEFINE([os_linux],[1],[Define if we're compiling for a linux target])
fi
if test "x$OS_BUILD" == "xbluegene"; then
AC_DEFINE([os_bluegene],[1],[Define if we're compiling for a BlueGene target])
fi
#Python prefix
AC_ARG_WITH(python-prefix,
[AS_HELP_STRING([--with-python-prefix=STR],[List of directories containing python installs])],
[PYTHON_INST_PREFIX=${withval}],
[PYTHON_INST_PREFIX=/usr/lib/python:/usr/lib64/python])
AC_DEFINE_UNQUOTED([PYTHON_INST_PREFIX],"[$PYTHON_INST_PREFIX]",[Python installation prefixes])
#NUMA configuration
AC_ARG_ENABLE(numa,
[AS_HELP_STRING([--enable-numa],[Use libnuma to enable numa optimizations])],
[REQUIRE_NUMA="true"])
AC_ARG_WITH(numa-excludes,
[AS_HELP_STRING([--with-numa-excludes],[Do not numa optimize files matching the given substrings])],
[NUMA_EXCLUDES_VAL=${withval}],
[NUMA_EXCLUDES_VAL=""])
AC_MSG_CHECKING([whether we have libnuma])
ORIG_LIBS=$LIBS
LIBS="$LIBS -lnuma"
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <numa.h>],[numa_available();])],
[HAVE_NUMA="true";AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
LIBS=$ORIG_LIBS
if test "x$REQUIRE_NUMA" == "xtrue"; then
if test "x$HAVE_NUMA" != "xtrue"; then
AC_MSG_ERROR([Could not link with libnuma, but numa required])
fi
fi
if test "x$HAVE_NUMA" == "xtrue"; then
AC_DEFINE([LIBNUMA], [1], [Use libnuma for numa optimizations])
AC_DEFINE_UNQUOTED([NUMA_EXCLUDES], "[$NUMA_EXCLUDES_VAL]", [Exclusions for numa optimization])
fi
#Usage logging
AC_ARG_WITH(usage-logging,
[AS_HELP_STRING([--with-usage-logging=FILE],[File for writing usage logs])],
[USAGE_LOGS=${withval}])
if test "x$USAGE_LOGS" != "x"; then
AC_DEFINE_UNQUOTED([USAGE_LOGGING_FILE],"[$USAGE_LOGS]",[The file for storing usage logs])
fi
#Dedicated cleanup process
AC_ARG_ENABLE(cleanup-process,
[AS_HELP_STRING([--enable-cleanup-process],[Default to using a dedicated process to clean relocated files])],
[CLEANUP_PROC="true"],)
if test "x$OS_BUILD" == "xbluegene"; then
CLEANUP_PROC="true"
fi
#Audit options
AC_ARG_ENABLE(subaudit-as-default,
[AS_HELP_STRING([--enable-subaudit-as-default],[Enable subaudit option as defaulted to on])],
[USE_SUBAUDIT_BY_DEFAULT="true"])
#Slurm plugin and location detection
AC_ARG_ENABLE(slurm-plugin,
[AS_HELP_STRING([--enable-slurm-plugin],[Build a spindle plugin for slurm])],
[ENABLE_SLURM_PLUGIN="true"],
[ENABLE_SLURM_PLUGIN="false"])
AC_ARG_WITH(slurm-dir,
[AS_HELP_STRING([--with-slurm-dir=DIR],[Look in in DIR for root of a slurm installation])]
[SLURM_DIR=${withval}])
AC_ARG_ENABLE(flux-plugin,
[AS_HELP_STRING([--enable-flux-plugin],[Build a spindle plugin for flux])],
[ENABLE_FLUX_PLUGIN="true"],
[ENABLE_FLUX_PLUGIN="false"])
if test "x$ENABLE_FLUX_PLUGIN" = "xtrue"; then
# Check for whether to build Flux shell plugin
PKG_CHECK_MODULES([FLUX_CORE], [flux-core > 0.40.0], [], [ENABLE_FLUX_PLUGIN=false])
PKG_CHECK_MODULES([FLUX_HOSTLIST], [flux-hostlist], [], [])
if test "x$ENABLE_FLUX_PLUGIN" = "xtrue"; then
AS_VAR_SET(shell_plugindir, $libdir)
AC_SUBST(shell_plugindir)
fluxplugin_ldflags="-export-symbols-regex '^flux_plugin_init\$\$' --disable-static -shared -export-dynamic"
AC_SUBST(fluxplugin_ldflags)
fi
fi
if test "x$GLIBC_BE_DIR" = "x"; then
# Get glibc location on front-end
CAT=`which cat`
LIBC_FILE=`ldd $CAT | grep libc | awk -F ' ' '{print $3}'`
GLIBC_BE_DIR=`dirname $LIBC_FILE`
fi
AC_MSG_NOTICE([glibc backend location set to $GLIBC_BE_DIR])
#Security options
AC_DEFINE([KEY_SIZE_BYTES], [32], [Number of bytes in keys for gcrypt])
AC_ARG_ENABLE(sec-munge,
[AS_HELP_STRING([--enable-sec-munge],[Enable munge for connection authentication])],
[WANT_MUNGE="true"; EXPLICIT_SEC="true"],)
AC_ARG_ENABLE(sec-keydir,
[AS_HELP_STRING([--enable-sec-keydir=keydir],[Enable filesystem directory 'keydir' to propagate authentication key for connections])],
[WANT_KEYFILE="true";SEC_KEYDIR=$enableval;EXPLICIT_SEC="true"],)
AC_ARG_ENABLE(sec-launchmon,
[AS_HELP_STRING([--enable-sec-launchmon],[Enable LaunchmMON to propagate authentication key for connections])],
[WANT_SECLMON="true";EXPLICIT_SEC="true"],)
AC_ARG_ENABLE(sec-none,
[AS_HELP_STRING([--enable-sec-none],[Disable security authentication of connections])],
[WANT_NOSEC="true";EXPLICIT_SEC="true"],)
AC_ARG_WITH(gcrypt-dir,
[AS_HELP_STRING([--with-gcrypt-dir=DIR],[Look in DIR for gcrypt installation])],
[GCRYPT_CFLAGS="-I${withval}/include";GCRYPT_LIBS="-L${withval}/lib"],)
AC_ARG_WITH(munge-dir,
[AS_HELP_STRING([--with-munge-dir=DIR],[Look in DIR for munge installation])],
[MUNGE_DIR=${withval}])
AC_ARG_WITH(glibc-be-dir,
[AS_HELP_STRING([--with-glibc-be-dir=DIR],[If glibc on compute nodes is installed in a non-standard location, then DIR is the directory containing libc.so.6])],
[GLIBC_BE_DIR=${withval}])
AC_ARG_ENABLE(remap-pageone,
[AS_HELP_STRING([--enable-remap-pageone],[Controls mmap behavior when replacing executables. Should be false on older linux systems])],
[SET_REMAP_FIRST_PAGE=$enableval],)
AC_DEFUN([CHOOSE_DEF_AUDIT],[
AC_LANG_PUSH(C)
AC_MSG_CHECKING([set subaudit as defaulted to on...])
if test "x$USE_SUBAUDIT_BY_DEFAULT" != "x"; then
AC_MSG_NOTICE([yes])
AC_DEFINE([USE_SUBAUDIT_BY_DEFAULT], [1], [Use subaudit by default])
else
AC_MSG_NOTICE([no])
fi
])
AC_DEFUN([CHECK_MMAP],[
AC_MSG_CHECKING([whether to remap first pages])
if test "x$SET_REMAP_FIRST_PAGE" != "x"; then
REMAP_FIRST_PAGE=$SET_REMAP_FIRST_PAGE;
else
AC_LANG_PUSH(C)
REMAP_FIRST_PAGE=unknown
OLD_CFLAGS=$CFLAGS
tmp=.
if test -d ${srcdir}/scripts; then auxdir=${srcdir}/scripts; else auxdir=${srcdir}/../../scripts; fi
CFLAGS="$CFLAGS -I${srcdir} -L${tmp}"
if test "x$REMAP_FIRST_PAGE" == "xunknown"; then
${auxdir}/remap.sh ${tmp} ${auxdir}/.. "$CC $CFLAGS $LDFLAGS" $1
if test "x$?" == "x0"; then
REMAP_FIRST_PAGE=true
fi
fi
if test "x$REMAP_FIRST_PAGE" == "xunknown"; then
${auxdir}/remap.sh ${tmp} ${auxdir}/.. "$CC -DREMAP_LEAVE_FIRST_PAGE $CFLAGS $LDFLAGS" x$1
if test "x$?" == "x0"; then
REMAP_FIRST_PAGE=false
fi
fi
if test "x$REMAP_FIRST_PAGE" == "xunknown"; then
uname_result=`uname -r`
if [[ "${uname_result:0:1}" == "2" ]]; then REMAP_FIRST_PAGE=false; else REMAP_FIRST_PAGE=true; fi
fi
CFLAGS=$OLD_CFLAGS
AC_LANG_POP
fi
if test "x$REMAP_FIRST_PAGE" == "xtrue"; then
AC_MSG_RESULT([yes])
elif test "x$REMAP_FIRST_PAGE" == "xfalse"; then
AC_MSG_RESULT([no])
else
AC_MSG_ERROR([Could not determine whether to leave or remap the first page when replacing executables])
fi])
AC_DEFUN([CHOOSE_SEC],[
AC_LANG_PUSH(C)
CFLAGS_HOLD=$CFLAGS
LIBS_HOLD=$LIBS
#Check for munge availability
if test "x$MUNGE_DIR" != "x"; then
MUNGE_CFLAGS=-I$MUNGE_DIR
MUNGE_LIBS="-L$MUNGE_DIR/lib -lmunge"
else
MUNGE_LIBS=-lmunge
fi
CFLAGS="$CFLAGS $MUNGE_CFLAGS"
AC_CHECK_HEADER([munge.h], [HAVE_MUNGE="true"], [HAVE_MUNGE="false"])
if test "x$HAVE_MUNGE" == "xtrue"; then
HAVE_MUNGE="false"
LIBS="$LIBS $MUNGE_LIBS"
AC_MSG_CHECKING([whether we have dynamic libmunge])
AC_LINK_IFELSE([AC_LANG_PROGRAM([extern void munge_encode();],[munge_encode();])],
[HAVE_MUNGE="true";MUNGE_DYN_LIB=$MUNGE_LIBS;AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
AC_MSG_CHECKING([wheter we have a static libmunge])
MUNGE_STATIC_LIB=`$CC $MUNGE_LIBS --print-file-name=libmunge.a`
if test -f $MUNGE_STATIC_LIB; then
LIBS="$LIBS_HOLD $MUNGE_STATIC_LIB"
AC_LINK_IFELSE([AC_LANG_PROGRAM([extern int munge_encode();],[return munge_encode();])],
[AC_MSG_RESULT([yes]); MUNGE_LIBS=$MUNGE_STATIC_LIB;HAVE_MUNGE="true"],
[AC_MSG_RESULT([no])])
else
MUNGE_STATIC_LIB=""
AC_MSG_RESULT([no])
fi
fi
CFLAGS=$CFLAGS_HOLD
LIBS=$LIBS_HOLD
#Check for libgcrypt availability
GCRYPT_LIBS="$GCRYPT_LIBS -lgcrypt -lgpg-error"
CFLAGS="$CFLAGS $GCRYPT_CFLAGS"
LIBS="$LIBS $GCRYPT_LIBS"
HAVE_GCRYPT="true"
AC_CHECK_HEADER([gcrypt.h], , [HAVE_GCRYPT="false"])
AC_CHECK_LIB(gcrypt, gcry_md_open, , [HAVE_GCRYPT="false"])
CFLAGS=$CFLAGS_HOLD
LIBS=$LIBS_HOLD
#If the user didn't specify security options, then make some choices based on what we have
if test "x$EXPLICIT_SEC" != "xtrue"; then
if test "x$HAVE_MUNGE" == "xtrue"; then
MUNGE="true"
fi
if test "x$HAVE_GCRYPT" == "xtrue"; then
GCRYPT="true"
SECLMON="true"
fi
fi
if test "x$WANT_MUNGE" == "xtrue"; then
if test "x$HAVE_MUNGE" == "xtrue"; then
MUNGE="true"
else
AC_MSG_ERROR([Could not find munge])
fi
fi
if test "x$WANT_KEYFILE" == "xtrue"; then
if test "x$HAVE_GCRYPT" == "xtrue"; then
KEYFILE="true"
GCRYPT="true"
else
AC_MSG_ERROR([Could not find gcrypt for keyfile authentication])
fi
fi
if test "x$WANT_SECLMON" == "xtrue"; then
if test "x$HAVE_GCRYPT" == "xtrue"; then
SECLMON="true"
GCRYPT="true"
else
AC_MSG_ERROR([Could not find gcrypt for lmon authentication])
fi
fi
if test "x$WANT_NOSEC" == "xtrue"; then
ENABLE_NULL_ENCRYPTION="true"
fi
if test "x$MUNGE" != "xtrue"; then
MUNGE_CFLAGS=""
MUNGE_LIBS=""
fi
if test "x$KEYFILE x$SECLMON" == "x x"; then
GCRYPT_CFLAGS=""
GCRYPT_LIBS=""
GCRYPT="false"
fi
AC_LANG_POP
AC_DEFINE_UNQUOTED([SEC_KEYDIR], "[$SEC_KEYDIR]",[Directory to store key files in])
AC_SUBST(GCRYPT_CFLAGS)
AC_SUBST(GCRYPT_LIBS)
AC_SUBST(MUNGE_CFLAGS)
AC_SUBST(MUNGE_LIBS)
AC_SUBST(MUNGE_DYN_LIB)
if test "x$MUNGE" == "xtrue"; then
AC_MSG_NOTICE([Enabling munge for security authentication])
AC_DEFINE([MUNGE], [1], [Use munge for authentication])
fi
if test "x$GCRYPT" == "xtrue"; then
AC_DEFINE([GCRYPT], [1], [Enable gcrypt for authentication])
fi
if test "x$KEYFILE" == "xtrue"; then
AC_MSG_NOTICE([Enabling keyfile for security authentication])
AC_DEFINE([KEYFILE], [1], [Use keyfile for authentication])
fi
if test "x$SECLMON" == "xtrue"; then
AC_MSG_NOTICE([Enabling LaunchMON key for security authentication])
AC_DEFINE([SECLMON], [1], [Use LaunchMON for authentication"])
fi
if test "x$ENABLE_NULL_ENCRYPTION" == "xtrue"; then
AC_MSG_NOTICE([Enabling NULL encryption]);
AC_DEFINE([ENABLE_NULL_ENCRYPTION], [1], [Allow NULL encryption])
fi])