forked from TempleHPC/maui-scheduler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
334 lines (277 loc) · 8.66 KB
/
configure.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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
AC_INIT(Maui Cluster Scheduler, 3.5-TempleHPC, [email protected], maui-scheduler, https://github.com/TempleHPC/maui-scheduler)
AC_CONFIG_SRCDIR([src/MConst.c])
#AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
#AC_PROG_INSTALL
AC_PROG_LN_S
# Assign desired prefix default
AC_PREFIX_DEFAULT([/usr/local])
# Handle spooldir (homedir)
AC_ARG_WITH(spooldir,
[ --with-spooldir=DIR where config files, log and stat directories are maintained [[/var/spool/maui]]],
SPOOLDIR=$withval, SPOOLDIR=/var/spool/maui)
AC_SUBST(SPOOLDIR)
# Machine Name
AC_ARG_WITH(machine,
[ --with-machine=NAME system name (defaults to LOCALHOST)],
MACHINE=$withval, MACHINE=LOCALHOST)
AC_SUBST(MACHINE)
# Handle Checksum seed
AC_ARG_WITH(key,
[ --with-key=SEED security checksum key (defaults to a random integer)], SEED=$withval, SEED=$RANDOM)
AC_SUBST(SEED)
# Determine OPSYS
OS=`uname`
if test "$OS" = "AIX"; then
OPSYS=__AIX43
elif test "$OS" = "Linux"; then
OPSYS="__LINUX"
elif test "$OS" = "HP-UX"; then
OPSYS="__HPUX"
elif test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
OPSYS="__IRIX"
OS="IRIX"
else
OPSYS="__LINUX"
AC_MSG_WARN([Unsupported OS: $OS, attempting build with OPSYS=$OPSYS])
OS="LINUX"
fi
AC_SUBST(OPSYS)
AC_SUBST(OS)
# Make generic variable Substitutions
AC_SUBST([PACKAGE_NAME])
AC_SUBST([PACKAGE_VERSION])
AC_SUBST([PACKAGE_TARNAME])
AC_SUBST([HOSTNAME], ${ac_hostname})
AC_SUBST([USER], `whoami`)
AC_SUBST([BUILDDATE], `date`)
AC_SUBST([BUILDDIR], `pwd`)
# PBS
AC_ARG_WITH(pbs,
[ --with-pbs[[=DIR]] use PBS/Torque Resource Manager (target directory (location of pbs lib dir) [[/usr/local]])],
[PBSTARGETDIR=$withval],
[PBSTARGETDIR='FALSE'])
if test "$PBSTARGETDIR" != 'FALSE'; then
if test "$PBSTARGETDIR" = 'yes'; then
if pbs-config --prefix 1>/dev/null 2>&1;then
PBSTARGETDIR=`pbs-config --prefix`
else
PBSTARGETDIR='/usr/local'
fi
elif test -f "$PBSTARGETDIR/bin/pbs-config"; then
PBSTARGETDIR=`$PBSTARGETDIR/bin/pbs-config --prefix`
elif test -f "$PBSTARGETDIR/../bin/pbs-config"; then
PBSTARGETDIR=`$PBSTARGETDIR/../bin/pbs-config --prefix`
elif test -f "$PBSTARGETDIR/pbs-config"; then
PBSTARGETDIR=`$PBSTARGETDIR/pbs-config --prefix`
elif test -f "$PBSTARGETDIR"; then
PBSTARGETDIR=`$PBSTARGETDIR --prefix`
fi
if test "$RMTYPE" = ''; then
RMTYPE=PBS
AC_SUBST(RMTYPE)
AC_SUBST_FILE(rm_config)
rm_config=include/maui.cfg.dist.inc.rm
else
AC_MSG_ERROR([Only one Resource Manager can be specified (PBS, $RMTYPE)])
fi
AC_SUBST(PBSTARGETDIR)
AC_SUBST_FILE(pbs_definitions)
pbs_definitions=include/Makefile.inc.pbs
fi
# Wiki
AC_ARG_WITH(wiki,
[ --with-wiki use Wiki Resource Manager],
[USEWIKI='TRUE'],
[USEWIKI='FALSE'])
if test "$USEWIKI" != 'FALSE'; then
if test "$RMTYPE" != ''; then
AC_MSG_ERROR([Only one Resource Manager can be specified (WIKI, $RMTYPE)])
fi
RMTYPE=WIKI
fi
if test "$RMTYPE" = ''; then
AC_MSG_WARN([Resource Manager not specified - attempting build with pbs])
RMTYPE=PBS
AC_SUBST(RMTYPE)
AC_SUBST_FILE(rm_config)
rm_config=include/maui.cfg.dist.inc.rm
if pbs-config --prefix 1>/dev/null 2>&1;then
PBSTARGETDIR=`pbs-config --prefix`
else
PBSTARGETDIR='/usr/local';
fi
fi
if test "$RMTYPE" = "PBS" ;then
if $PBSTARGETDIR/bin/pbs-config --cflags 1>/dev/null 2>&1;then
PBSCFLAGS=`$PBSTARGETDIR/bin/pbs-config --cflags`
else
PBSCFLAGS=-I$PBSTARGETDIR/include
fi
if $PBSTARGETDIR/bin/pbs-config --libs 1>/dev/null 2>&1;then
PBSLDFLAGS=`$PBSTARGETDIR/bin/pbs-config --libs`
elif test -f $PBSTARGETDIR/lib/libpbs.a ;then
if test "$OS" = "OSF"; then
PBSLDFLAGS="$PBSTARGETDIR/ilib/libnet.a -L$PBSTARGETDIR/lib -lpbs"
else
PBSLDFLAGS="-L$PBSTARGETDIR/lib -lnet -lpbs"
fi
else
AC_MSG_ERROR([can't find pbs-config or libpbs.a])
fi
AC_SUBST(PBSCFLAGS)
AC_SUBST(PBSLDFLAGS)
AC_SUBST_FILE(pbs_definitions)
pbs_definitions=include/Makefile.inc.pbs
fi
# Warehouse Node Monitor
AC_ARG_WITH(warehouse,
[ --with-warehouse use Warehouse System Monitor],
[USEWAREHOUSE='TRUE'],
[USEWAREHOUSE='FALSE'])
if test "$USEWAREHOUSE" != 'FALSE'; then
if test "$NMTYPE" = ''; then
RMNMPORT=" NMPORT=12321"
RMNMHOST=" NMHOST=$HOSTNAME"
fi
fi
AC_SUBST(RMTYPE)
AC_SUBST(RMPORT)
AC_SUBST(RMHOST)
AC_SUBST(RMSOCKETPROTOCOL)
AC_SUBST(RMWIREPROTOCOL)
AC_SUBST(RMVERSION)
AC_SUBST(RMNMPORT)
AC_SUBST(RMNMHOST)
# END RM CONFIG --------------------------------------
# START AM CONFIG ------------------------------------
# QBank
AC_ARG_WITH(qbank,
[ --with-qbank use QBank Allocation Manager],
[USEQBANK='TRUE'],
[USEQBANK='FALSE'])
if test "$USEQBANK" != 'FALSE'; then
if test "$AMTYPE" != ''; then
AC_MSG_ERROR([Only one Allocation Manager can be specified (QBANK, $AMTYPE)])
fi
AMTYPE=QBANK
AMHOST=" HOST=$HOSTNAME"
AMPORT=" PORT=7111"
AMOTHER=" CHARGEPOLICY=DEBITALLWC JOBFAILUREACTION=NONE TIMEOUT=15"
fi
# Gold
AC_ARG_WITH(gold,
[ --with-gold use Gold Allocation Manager],
[USEGOLD='TRUE'],
[USEGOLD='FALSE'])
if test "$USEGOLD" != 'FALSE'; then
if test "$AMTYPE" != ''; then
AC_MSG_ERROR([Only one Allocation Manager can be specified (GOLD, $AMTYPE)])
fi
AMTYPE=GOLD
AMHOST=" HOST=$HOSTNAME"
AMPORT=" PORT=7112"
AMSOCKETPROTOCOL=" SOCKETPROTOCOL=HTTP"
AMWIREPROTOCOL=" WIREPROTOCOL=XML"
AMOTHER=" CHARGEPOLICY=DEBITALLWC JOBFAILUREACTION=NONE TIMEOUT=15"
fi
# Other SSS Allocation Manager
AC_ARG_WITH(sss-am,
[ --with-sss-am[[=PORT]] use SSS Allocation Manager (default port [[8865]])],
[SSSAMPORT=$withval],
[SSSAMPORT='FALSE'])
if test "$SSSAMPORT" != 'FALSE'; then
if test "$SSSAMPORT" = 'yes'; then
SSSAMPORT='8865';
fi
if test "$AMTYPE" != ''; then
AC_MSG_ERROR([Only one Allocation Manager can be specified (SSS-AM, $AMTYPE)])
fi
AMTYPE=SSS
AMHOST=" HOST=$HOSTNAME"
AMPORT=" PORT=$SSSAMPORT"
AMOTHER=" CHARGEPOLICY=DEBITALLWC JOBFAILUREACTION=NONE TIMEOUT=15"
fi
if test "$AMTYPE" = ''; then
AMTYPE=NONE
fi
AC_SUBST(AMTYPE)
AC_SUBST(AMHOST)
AC_SUBST(AMPORT)
AC_SUBST(AMSOCKETPROTOCOL)
AC_SUBST(AMWIREPROTOCOL)
AC_SUBST(AMOTHER)
# END AM CONFIG ---------------------------------
# PCRE
pcre_definitions=""
AC_ARG_WITH(pcre,
[ --with-pcre[[=DIR]] use PCRE (pcre dir (location of PCRE include and lib directories) [[/path/to/pcre]]],
[PCREDIR=$withval],
[PCREDIR='FALSE'])
if test "$PCREDIR" != 'FALSE'; then
if test "$PCREDIR" = 'yes'; then
PCREDIR='/path/to/pcre';
fi
AC_SUBST(PCREDIR)
pcre_definitions=include/Makefile.inc.pcre
fi
AC_SUBST_FILE(pcre_definitions)
# Make sure one RM was specified
if test "$RMTYPE" = ''; then
AC_MSG_ERROR([At least one Resource Manager must be specified])
fi
# Checks for libraries.
AC_CHECK_LIB([m], [sqrt])
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h fcntl.h locale.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h syslog.h unistd.h stdbool.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STAT
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_HEADER_TIME
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_SETPGRP
AC_FUNC_SETVBUF_REVERSED
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([gethostbyaddr gethostbyname gethostname gettimeofday inet_ntoa memchr memset pow putenv regcmp regcomp select setlocale socket strchr strdup strerror strrchr strstr strtol strtoul])
# Configure the output files, and generate them.
AC_CONFIG_FILES([include/Makefile.inc.pbs
include/Makefile.inc.pcre])
AC_CONFIG_FILES([Makefile], [chmod 700 Makefile])
AC_CONFIG_FILES([include/maui.cfg.dist.inc.rm
maui.cfg.dist
maui-private.cfg.dist])
AC_CONFIG_FILES([etc/maui.sh etc/maui.csh])
AC_CONFIG_FILES([include/moab-local.h], [chmod 600 include/moab-local.h])
AC_CONFIG_FILES([include/msched-version.h], [chmod 600 include/msched-version.h])
AC_CONFIG_FILES([docs/Doxyfile])
AC_CONFIG_FILES([maui-scheduler.service])
AC_OUTPUT
# Do miscellaneous configure steps
touch maui.ck
touch maui-private.cfg
test -d bin || mkdir bin
test -d lib || mkdir lib
# Display final messages
if test -z "`echo $PATH | grep \"$prefix\" 2>/dev/null`"; then
AC_MSG_NOTICE([
Remember to add $prefix/bin to your PATH])
fi