forked from hpc/Spindle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.common.ac
409 lines (365 loc) · 15.8 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
#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
AC_MSG_CHECKING([for -Wall])
OCFLAGS=$CFLAGS
OCXXFLAGS=$CXXFLAGS
CFLAGS="$CFLAGS -Wall"
CXXFLAGS="$CXXLAGS -Wall"
AC_TRY_COMPILE([], [], AC_MSG_RESULT(yes), [AC_MSG_RESULT(no); CFLAGS=$OCFLAGS; CXXFLAGS=$OCXXFLAGS])
AC_MSG_CHECKING([for -Wno-unused-result])
OCFLAGS=$CFLAGS
OCXXFLAGS=$CXXFLAGS
CFLAGS="$CFLAGS -Wunused-result"
CXXFLAGS="$CXXFLAGS -Wunused-result"
AC_TRY_COMPILE([], [],
[AC_MSG_RESULT(yes); CFLAGS="$OCFLAGS -Wno-unused-result"; CXXFLAGS="$OCXXFLAGS -Wno-unused-result"],
[AC_MSG_RESULT(no); CFLAGS=$OCFLAGS; CXXFLAGS=$OCXXFLAGS])
AC_MSG_CHECKING([for -Wno-portability])
OCFLAGS=$CFLAGS
OCXXFLAGS=$CXXFLAGS
CFLAGS="$CFLAGS -Wportability"
CXXFLAGS="$CXXFLAGS -Wportability"
AC_TRY_COMPILE([], [],
[AC_MSG_RESULT(yes); CFLAGS="$OCFLAGS -Wno-portability"; CXXFLAGS="$OCXXFLAGS -Wno-portability"],
[AC_MSG_RESULT(no); CFLAGS=$OCFLAGS; CXXFLAGS=$OCXXFLAGS])
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=ARM],[])],
[TESTRM=${withval}],
[])
AC_ARG_WITH(rm,
[AS_HELP_STRING([--with-rm=ARG],[Default resource manager (valid options are 'slurm' and 'flux')])],
[TESTRM=${withval}],
[])
if test "x$TESTRM" == "xunknown"; then
AC_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])],)
#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
#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"])
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])
#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],[Use 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"])
#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_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])