forked from TACC/Lmod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
317 lines (270 loc) · 9.07 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
dnl Process this file with autoconf to produce a configure script.
dnl This is for lmod
AC_INIT(Makefile.in)
AC_PREFIX_DEFAULT(/usr/local)
AC_SUBST(MODULEPATH_ROOT)dnl
AC_ARG_WITH(module-root-path,
AC_HELP_STRING([--with-module-root-path=<path>],[use module root path=<path> [[PREFIX/modulefiles]]]),
MODULEPATH_ROOT="$withval"
AC_MSG_RESULT([MODULEPATH_ROOT=$with_module_root_path])
AC_DEFINE_UNQUOTED(MODULEPATH_ROOT, "$with_module_root_path")dnl
,
withval="$prefix/modulefiles"
AC_MSG_RESULT([MODULEPATH_ROOT=$withval])
MODULEPATH_ROOT="$withval"
AC_DEFINE_UNQUOTED(MODULEPATH_ROOT, "$withval"))dnl
AC_SUBST(ANCIENT)
AC_ARG_WITH(ancient,
AC_HELP_STRING([--with-ancient=num_secs],[How long to wait before rebuilding spider cache file=num_secs [[86400]]]),
ANCIENT="$withval"
AC_MSG_RESULT([ANCIENT=$with_ancient])
AC_DEFINE_UNQUOTED(ANCIENT, "$with_ancient")dnl
,
withval="86400"
AC_MSG_RESULT([ANCIENT=$withval])
ANCIENT="$withval"
AC_DEFINE_UNQUOTED(ANCIENT, "$withval"))dnl
AC_SUBST(SHORT_TIME)
AC_ARG_WITH(shortTime,
AC_HELP_STRING([--with-shortTime=seconds],[if spider build time < shortTime then no spider cache file [[2]]]),
SHORT_TIME="$withval"
AC_MSG_RESULT([SHORT_TIME=$with_shortTime])
AC_DEFINE_UNQUOTED(SHORT_TIME, "$with_shortTime")dnl
,
withval="2"
AC_MSG_RESULT([SHORT_TIME=$withval])
SHORT_TIME="$withval"
AC_DEFINE_UNQUOTED(SHORT_TIME, "$withval"))dnl
AC_SUBST(USE_DOT_FILES)
AC_ARG_WITH(useDotFiles,
AC_HELP_STRING([--with-useDotFiles=yes/no],[If yes use ~/.lmod.d/.cache, if no use ~/.lmod.d/__cache__]),
USE_DOT_FILES="$withval"
AC_MSG_RESULT([USE_DOT_FILES=$with_useDotFiles])
AC_DEFINE_UNQUOTED(USE_DOT_FILES, "$with_useDotFiles")dnl
,
withval="yes"
AC_MSG_RESULT([USE_DOT_FILES=$withval])
USE_DOT_FILES="$withval"
AC_DEFINE_UNQUOTED(USE_DOT_FILES, "$withval"))dnl
AC_SUBST(SPIDER_CACHE_DIRS)
AC_ARG_WITH(spiderCacheDir,
AC_HELP_STRING([--with-spiderCacheDir=dir1:dir2],[use these directories to hold a spider cache file [[]]]),
SPIDER_CACHE_DIRS="$withval"
AC_MSG_RESULT([SPIDER_CACHE_DIRS=$with_spiderCacheDir])
AC_DEFINE_UNQUOTED(SPIDER_CACHE_DIRS, "$with_spiderCacheDir")dnl
,
withval=""
AC_MSG_RESULT([SPIDER_CACHE_DIRS=$withval])
SPIDER_CACHE_DIRS="$withval"
AC_DEFINE_UNQUOTED(SPIDER_CACHE_DIRS, "$withval"))dnl
AC_SUBST(SPIDER_CACHE_DESCRIPT_FN)
AC_ARG_WITH(spiderCacheDescript,
AC_HELP_STRING([--with-spiderCacheDescript=fn],[Use specified file to describe cache directory and timestamp files [[]]]),
SPIDER_CACHE_DESCRIPT_FN="$withval"
AC_MSG_RESULT([SPIDER_CACHE_DESCRIPT_FN=$with_spiderCacheDescript])
AC_DEFINE_UNQUOTED(SHORT_TIME, "$with_spiderCacheDescript")dnl
,
withval=""
AC_MSG_RESULT([SPIDER_CACHE_DESCRIPT_FN=$withval])
SPIDER_CACHE_DESCRIPT_FN="$withval"
AC_DEFINE_UNQUOTED(SPIDER_CACHE_DESCRIPT_FN, "$withval"))dnl
AC_SUBST(UPDATE_SYSTEM_FN)
AC_ARG_WITH(updateSystemFn,
AC_HELP_STRING([--with-updateSystemFn=file],[This file is touched when the system has been updated [[]]]),
UPDATE_SYSTEM_FN="$withval"
AC_MSG_RESULT([UPDATE_SYSTEM_FN=$with_updateSystemFn])
AC_DEFINE_UNQUOTED(SHORT_TIME, "$with_updateSystemFn")dnl
,
withval=""
AC_MSG_RESULT([UPDATE_SYSTEM_FN=$withval])
UPDATE_SYSTEM_FN="$withval"
AC_DEFINE_UNQUOTED(UPDATE_SYSTEM_FN, "$withval"))dnl
AC_SUBST(PREPEND_BLOCK)
AC_ARG_WITH(prependBlock,
AC_HELP_STRING([--with-prependBlock=ans],[Treat multiple directories passed to prepend in normal order/ not reversed [[NORMAL]]]),
PREPEND_BLOCK="$withval"
AC_MSG_RESULT([PREPEND_BLOCK=$with_prependBlock])
AC_DEFINE_UNQUOTED(PREPEND_BLOCK, "$with_prependBlock")dnl
,
withval="NORMAL"
AC_MSG_RESULT([PREPEND_BLOCK=$withval])
PREPEND_BLOCK="$withval"
AC_DEFINE_UNQUOTED(PREPEND_BLOCK, "$withval"))dnl
AC_SUBST(DUPLICATE_PATHS)
AC_ARG_WITH(duplicatePaths,
AC_HELP_STRING([--with-duplicatePaths=ans],[Allow multiple directories in path like variables [[NO]]]),
DUPLICATE_PATHS="$withval"
AC_MSG_RESULT([DUPLICATE_PATHS=$with_duplicatePaths])
AC_DEFINE_UNQUOTED(DUPLICATE_PATHS,"$with_duplicatePaths")dnl
,
withval="NO"
AC_MSG_RESULT([DUPLICATE_PATHS=$withval])
DUPLICATE_PATHS="$withval"
AC_DEFINE_UNQUOTED(DUPLICATE_PATHS, "$withval"))dnl
AC_SUBST(COLORIZE)
AC_ARG_WITH(colorize,
AC_HELP_STRING([--with-colorize=ans],[allow for colorized output [[YES]]]),
COLORIZE="$withval"
AC_MSG_RESULT([COLORIZE=$with_colorize])
AC_DEFINE_UNQUOTED(COLORIZE, "$with_colorize")dnl
,
withval="YES"
AC_MSG_RESULT([COLORIZE=$withval])
COLORIZE="$withval"
AC_DEFINE_UNQUOTED(COLORIZE, "$withval"))dnl
AC_SUBST(ALLOW_TCL_MFILES)
AC_ARG_WITH(tcl,
AC_HELP_STRING([--with-tcl=ans],[Allow TCL modulefiles [[YES]]]),
ALLOW_TCL_MFILES="$withval"
AC_MSG_RESULT([ALLOW_TCL_MFILES==$withval])
AC_DEFINE_UNQUOTED(ALLOW_TCL_MFILES, "$withval")dnl
,
withval="yes"
AC_MSG_RESULT([ALLOW_TCL_MFILES=$withval])
ALLOW_TCL_MFILES="$withval"
AC_DEFINE_UNQUOTED(ALLOW_TCL_MFILES, "$withval"))dnl
AC_SUBST(MPATH_AVAIL)
AC_ARG_WITH(mpathSearch,
AC_HELP_STRING([--with-mpathSearch=ans],[include modulepath directory name in avail searching [[NO]]]),
MPATH_AVAIL="$withval"
AC_MSG_RESULT([MPATH_AVAIL==$withval])
AC_DEFINE_UNQUOTED(MPATH_AVAIL, "$withval")dnl
,
withval="no"
AC_MSG_RESULT([MPATH_AVAIL=$withval])
MPATH_AVAIL="$withval"
AC_DEFINE_UNQUOTED(MPATH_AVAIL, "$withval"))dnl
AC_SUBST(SETTARG)
AC_ARG_WITH(settarg,
AC_HELP_STRING([--with-settarg=ans],[startup files fully support settarg [[NO]]]),
SETTARG="$withval"
AC_MSG_RESULT([SETTARG=$with_settarg])
AC_DEFINE_UNQUOTED(SETTARG, "$with_settarg")dnl
,
withval="NO"
AC_MSG_RESULT([SETTARG=$withval])
SETTARG="$withval"
AC_DEFINE_UNQUOTED(SETTARG, "$withval"))dnl
AC_SUBST(PATH_TO_PAGER)
AC_SUBST(PATH_TO_LUA)
AC_SUBST(PATH_TO_GIT)
AC_SUBST(PATH_TO_HASHSUM)
AC_PATH_PROG(PATH_TO_GIT, git, "")
AC_PATH_PROGS(PATH_TO_HASHSUM, [sha1sum] [md5sum], "")
AC_PATH_PROG(pager,[more], "")
PATH_TO_PAGER=$pager
AC_PATH_PROG(luaprog, lua, "")
if test x$luaprog = "x"; then
echo The program "lua" must be in your path
exit
fi
oldprog=$luaprog
while test -L $luaprog; do
luaprog=$(readlink $luaprog)
if test ${luaprog:0:1} != '/' ; then
d=`dirname $oldprog`
luaprog="$d/$luaprog"
CWD=`pwd`
d=`dirname $luaprog`
b=`basename $luaprog`
cd $d
d=`pwd`
luaprog="$d/$b"
cd $CWD
fi
oldprog=$luaprog
done
printf "checking for valid Lua version"
LuaV=$( $luaprog -e 'print(_VERSION)' | sed -e 's/Lua //' )
LmodV=$( $luaprog -e 'v=require("src/Version"); s=v.name():gsub(" .*","");print(s)')
if test -n $PATH_TO_GIT -a -d .git ; then
lmodV=$($PATH_TO_GIT describe)
else
lmodV=$($luaprog -e 'v=require("src/Version"); s=v.git():gsub(" .*","");print(s)')
fi
IntLuaV=$( $luaprog -e "_,_,M,m=_VERSION:gsub('Lua%s+',''):find('(%d+)%.(%d)'); print(M*1000+m)")
if test $IntLuaV -lt 5001 -o $IntLuaV -gt 5002; then
echo "Error: Lmod requires versions 5.1 or 5.2, You have: $LuaV"
exit 1
fi
echo "... $LuaV"
PATH_TO_LUA=$(dirname $luaprog)
WD=`pwd`
PATH_TO_LUA_DIR=${PATH_TO_LUA}/..
cd $PATH_TO_LUA_DIR
PATH_TO_LUA_DIR=`pwd`
cd $WD
cat > luaModuleAvailable << 'EOF'
function main()
for i = 1, #arg do
require(arg[[i]])
if (not package.loaded[[arg[i]]]) then
print (arg[[i]], "not available")
end
end
end
main()
EOF
printf "checking for lua modules: posix lfs"
missingModules=""
for i in posix lfs; do
$luaprog luaModuleAvailable $i 2> /dev/null
if test "$?" != 0 ; then
missingModules="$missingModules $i"
fi
done
rm luaModuleAvailable
if test -n "$missingModules" ; then
echo ""
echo ""
echo "Error: The follow lua module(s) are missing: $missingModules"
echo ""
echo "You can not run Lmod without: $missingModules"
exit 1
fi
echo "... yes"
AC_SUBST(LUA_INCLUDE)
LUA_INCLUDE=$PATH_TO_LUA_DIR/include
AC_ARG_WITH([lua-include],
[AS_HELP_STRING([--with-lua-include=@<:@path@:>@],
[specify path the lua header files])
])
if ! test -f $LUA_INCLUDE/lua.h; then
AC_PATH_PROG(pkgConfig, pkg-config, "")
if ! test x$pkgConfig = "x"; then
for i in lua$LuaV lua; do
$pkgConfig --exists $i
if test $? = 0; then
LUA_INCLUDE=`$pkgConfig --cflags $i | sed -e 's/^-I//' -e 's/ //g'`
break
fi
done
fi
fi
if ! test -f $LUA_INCLUDE/lua.h; then
for i in /usr/include/lua$LuaV /usr/include/lua /usr/include; do
if test -f $i/lua.h ; then
LUA_INCLUDE=$i
break
fi
done
fi
AC_SUBST(ZSH_SITE_FUNCTIONS_DIR)
AC_PATH_PROG(ZSH, zsh)
PATH_TO_ZSH=$ZSH
if test -n "$PATH_TO_ZSH" ; then
cat > conftest.zsh << 'EOF'
for dir in $fpath ; do
case $dir in
*/site-functions)
echo $dir >&2
;;
esac
done
EOF
chmod +x conftest.zsh
ZSH_SITE_FUNCTIONS_DIR=`$PATH_TO_ZSH -f ./conftest.zsh 2>&1 >/dev/null`
rm conftest.zsh
fi
AC_OUTPUT(makefile:Makefile.in)
AX_SUMMARIZE_CONFIG