forked from apptainer/singularity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
395 lines (349 loc) · 12.6 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
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
AC_PREREQ(2.59)
AC_INIT([singularity],[2.3.1],[[email protected]])
if test -z "$prefix" -o "$prefix" = "NONE" ; then
prefix=${ac_default_prefix}
fi
AC_SUBST(PREFIX, $prefix)
AC_CANONICAL_TARGET
case $target_cpu in
x86_64)
SINGULARITY_ARCH=x86_64
;;
i?86)
SINGULARITY_ARCH=i386
;;
athlon)
SINGULARITY_ARCH=i386
;;
*)
SINGULARITY_ARCH="$target_cpu"
;;
esac
AC_SUBST(SINGULARITY_ARCH)
# This should be used per autogen.sh output, but we hit this automake bug:
# https://www.mail-archive.com/[email protected]/msg1232579.html
#AM_INIT_AUTOMAKE([foreign subdir-objects])
AM_INIT_AUTOMAKE([foreign subdir-objects]) ## SEE ABOVE BEFORE CHANGING
AC_CONFIG_SRCDIR([src])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_GNU_SOURCE
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_CC
AM_INIT_AUTOMAKE
AM_PROG_CC_C_O
AC_ENABLE_SHARED
AC_PROG_LIBTOOL(libtool)
# Setting rpath if necessary
if test "$libdir" = "\${exec_prefix}/lib"; then
LDFLAGS="$LDFLAGS -Wl,-rpath -Wl,\$(libdir)"
fi
AC_MSG_CHECKING([for namespace: CLONE_NEWPID])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE
#include <sched.h>
]],
[[unshare(CLONE_NEWPID);]])],
[
AC_MSG_RESULT([yes])
SINGULARITY_DEFINES="$SINGULARITY_DEFINES -DNS_CLONE_NEWPID"
], [
AC_MSG_RESULT([no])
]
)
AC_MSG_CHECKING([for namespace: CLONE_PID])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE
#include <sched.h>
]],
[[unshare(CLONE_PID);]])],
[
AC_MSG_RESULT([yes])
SINGULARITY_DEFINES="$SINGULARITY_DEFINES -DNS_CLONE_PID"
], [
AC_MSG_RESULT([no])
]
)
AC_MSG_CHECKING([for namespace: CLONE_FS])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE
#include <sched.h>
]],
[[unshare(CLONE_FS);]])],
[
AC_MSG_RESULT([yes])
SINGULARITY_DEFINES="$SINGULARITY_DEFINES -DNS_CLONE_FS"
], [
AC_MSG_RESULT([no])
]
)
AC_MSG_CHECKING([for namespace: CLONE_NEWNS])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE
#include <sched.h>
]],
[[unshare(CLONE_NEWNS);]])],
[
AC_MSG_RESULT([yes])
SINGULARITY_DEFINES="$SINGULARITY_DEFINES -DNS_CLONE_NEWNS"
], [
AC_MSG_RESULT([no])
echo
echo "ERROR!!!!!!"
echo
echo "This host does not support the CLONE_NEWNS (mount) namespace flag! You"
echo "really really really don't want to run Singularity containers without a"
echo "Separate mount name namespace!"
echo
exit 255
]
)
AC_MSG_CHECKING([for namespace: CLONE_NEWUSER])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE
#include <sched.h>
]],
[[unshare(CLONE_NEWUSER);]])],
[
AC_MSG_RESULT([yes])
SINGULARITY_DEFINES="$SINGULARITY_DEFINES -DNS_CLONE_NEWUSER"
], [
AC_MSG_RESULT([no])
]
)
AC_MSG_CHECKING([for namespace: CLONE_NEWIPC])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE
#include <sched.h>
]],
[[unshare(CLONE_NEWIPC);]])],
[
AC_MSG_RESULT([yes])
SINGULARITY_DEFINES="$SINGULARITY_DEFINES -DNS_CLONE_NEWIPC"
], [
AC_MSG_RESULT([no])
]
)
AC_MSG_CHECKING([for feature: NO_NEW_PRIVS])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/prctl.h>
]],
[[prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0);]])],
[
AC_MSG_RESULT([yes])
SINGULARITY_DEFINES="$SINGULARITY_DEFINES -DSINGULARITY_NO_NEW_PRIVS"
], [
AC_MSG_RESULT([no])
]
)
AC_MSG_CHECKING([for feature: MS_SLAVE])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/mount.h>
]],
[[#ifndef MS_SLAVE
#error failed
#endif
]])],
[
AC_MSG_RESULT([yes])
SINGULARITY_DEFINES="$SINGULARITY_DEFINES -DSINGULARITY_MS_SLAVE"
], [
AC_MSG_RESULT([no])
]
)
AC_MSG_CHECKING([for feature: MS_REC])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/mount.h>
]],
[[#ifndef MS_REC
#error failed
#endif
]])],
[
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
echo
echo "ERROR!!!!!!"
echo
echo "This host does not support the MS_REC mount option!"
echo
exit 255
]
)
AC_MSG_CHECKING([for feature: MS_PRIVATE])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/mount.h>
]],
[[#ifndef MS_PRIVATE
#error failed
#endif
]])],
[
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
echo
echo "ERROR!!!!!!"
echo
echo "This host does not support the MS_PRIVATE mount option!"
echo
exit 255
]
)
AC_ARG_WITH([userns],
AS_HELP_STRING([--with-userns], [Enable use of user namespaces]),
[
SINGULARITY_DEFINES="$SINGULARITY_DEFINES -DSINGULARITY_USERNS"
USER_NS=1
]
)
AC_SUBST(USER_NS)
AC_CHECK_FUNCS(setns, [
], [
NO_SETNS="-DNO_SETNS"
]
)
AC_SUBST(NO_SETNS)
AC_MSG_CHECKING([for overlayfs])
KVERS=`uname -r`
if test -f "/lib/modules/$KVERS/modules.dep"; then
if grep -q 'overlay.ko' "/lib/modules/$KVERS/modules.dep"; then
AC_MSG_RESULT([yes])
SINGULARITY_DEFINES="$SINGULARITY_DEFINES -DSINGULARITY_OVERLAYFS"
OVERLAY_FS=1
else
AC_MSG_RESULT([no])
fi
else
AC_MSG_RESULT([maybe])
SINGULARITY_DEFINES="$SINGULARITY_DEFINES -DSINGULARITY_OVERLAYFS"
fi
# ---------------------------------------------------------------------
# PYTHON
# ---------------------------------------------------------------------
AC_CHECK_PROG(PYTHON_CHECK,python,yes)
if test x"$PYTHON_CHECK" != x"yes" ; then
AC_MSG_ERROR([Please install python before installing.])
else
PYTHON_MODULES="base64 datetime glob hashlib io itertools json math multiprocessing pickle pwd re shutil signal subprocess stat sys tarfile tempfile time"
for PYTHON_MODULE in $PYTHON_MODULES; do
AC_MSG_CHECKING([for the $PYTHON_MODULE python module])
python_module_result=`python -c "import $PYTHON_MODULE" 2>&1`
if test -z "$python_module_result"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([cannot import Python module $PYTHON_MODULE.
Please check your Python installation. The error was:
$python_module_result])
fi
done
fi
AC_SUBST(OVERLAY_FS)
AC_SUBST(SINGULARITY_DEFINES)
AC_MSG_CHECKING([--with-slurm])
AC_ARG_WITH([slurm],
AS_HELP_STRING([--with-slurm], [Enable build of slurm integration]),
)
AS_IF([test "x$with_slurm" == "xyes"],
[
AC_MSG_RESULT([yes])
AC_CHECK_HEADER([slurm/spank.h],
[AC_MSG_RESULT([yes])
with_slurm="yes"
],
[
AC_MSG_ERROR([SLURM support requested, but slurm/spank.h header not found.])
])
],
[
AC_MSG_RESULT([no])
with_slurm="no"
]
)
AM_CONDITIONAL([WITH_SLURM], [test "$with_slurm" = "yes"])
AC_SUBST(with_slurm)
AC_MSG_CHECKING([if suid should be enabled])
AC_ARG_ENABLE([suid],
AS_HELP_STRING([--disable-suid], [Disable build for SUID (only works for new kernels)]))
AS_IF([test "x$enable_suid" != "xno"], [
AC_MSG_RESULT([yes])
BUILD_SUID="action-suid create-suid expand-suid export-suid import-suid mount-suid"
], [
AC_MSG_RESULT([no])
BUILD_SUID=""
])
AC_SUBST(BUILD_SUID)
AC_MSG_CHECKING([for git version])
if BRANCH=`git rev-parse --abbrev-ref HEAD 2>/dev/null`; then
if HASH=`git rev-parse --short HEAD 2>/dev/null`; then
GIT_VERSION="-$BRANCH.g$HASH"
else
GIT_VERSION="-$BRANCH"
fi
else
GIT_VERSION="-dist"
fi
AC_MSG_RESULT([$GIT_VERSION])
AC_SUBST(GIT_VERSION)
AC_CONFIG_FILES([
Makefile
singularity.spec
test.sh
src/slurm/Makefile
src/Makefile
src/lib/Makefile
src/lib/runtime/Makefile
src/lib/runtime/ns/Makefile
src/lib/runtime/ns/ipc/Makefile
src/lib/runtime/ns/mnt/Makefile
src/lib/runtime/ns/pid/Makefile
src/lib/runtime/files/Makefile
src/lib/runtime/files/group/Makefile
src/lib/runtime/files/passwd/Makefile
src/lib/runtime/files/resolvconf/Makefile
src/lib/runtime/files/libs/Makefile
src/lib/runtime/mounts/Makefile
src/lib/runtime/mounts/cwd/Makefile
src/lib/runtime/mounts/dev/Makefile
src/lib/runtime/mounts/binds/Makefile
src/lib/runtime/mounts/home/Makefile
src/lib/runtime/mounts/hostfs/Makefile
src/lib/runtime/mounts/kernelfs/Makefile
src/lib/runtime/mounts/tmp/Makefile
src/lib/runtime/mounts/userbinds/Makefile
src/lib/runtime/mounts/scratch/Makefile
src/lib/runtime/enter/Makefile
src/lib/runtime/enter/chroot/Makefile
src/lib/runtime/environment/Makefile
src/lib/runtime/overlayfs/Makefile
src/lib/image/Makefile
src/lib/image/bind/Makefile
src/lib/image/check/Makefile
src/lib/image/check/image/Makefile
src/lib/image/check/squashfs/Makefile
src/lib/image/check/dir/Makefile
src/lib/image/create/Makefile
src/lib/image/expand/Makefile
src/lib/image/mount/Makefile
src/lib/image/mount/dir/Makefile
src/lib/image/mount/image/Makefile
src/lib/image/mount/squashfs/Makefile
src/lib/image/offset/Makefile
src/lib/image/open/Makefile
src/action-lib/Makefile
src/bootstrap-lib/Makefile
src/util/Makefile
etc/Makefile
bin/Makefile
bin/singularity
man/Makefile
libexec/Makefile
libexec/bootstrap-scripts/Makefile
libexec/bootstrap-scripts/environment/Makefile
libexec/cli/Makefile
libexec/helpers/Makefile
libexec/python/Makefile
libexec/python/docker/Makefile
libexec/python/shub/Makefile
libexec/python/helpers/Makefile
libexec/python/helpers/json/Makefile
])
AC_OUTPUT