forked from apptainer/singularity
-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
346 lines (305 loc) · 10.9 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
AC_PREREQ(2.59)
AC_INIT([singularity],[2.2],[gmkurtzer@lbl.gov])
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/debian-bugs-dist@lists.debian.org/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_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"]
)
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
AC_SUBST(OVERLAY_FS)
AC_SUBST(SINGULARITY_DEFINES)
AC_MSG_CHECKING([if slurm integration should be built])
AC_ARG_WITH([slurm],
AS_HELP_STRING([--with-slurm], [Enable build of slurm integration]),
)
AS_IF([test "x$with_slurm" != "xno"],
[
AC_CHECK_HEADER([slurm/spank.h],
[AC_MSG_RESULT([yes])
with_slurm="yes"
],
[AS_IF([test "$with_slurm" = "yes"],
[AC_MSG_ERROR([SLURM support requested, but slurm/spank.h header not found.])],
[ AC_MSG_RESULT([no])
with_slurm="no"
]
])
)
],
[
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="sexec-suid"
], [
AC_MSG_RESULT([no])
BUILD_SUID=""
])
AC_SUBST(BUILD_SUID)
#AC_CHECK_DECLS([MS_PRIVATE,MS_REC], [],
# [AC_MSG_ERROR([Required mount(2) flags not available])],
# [[#include <sys/mount.h>]])
AC_CONFIG_FILES([
Makefile
singularity.spec
test.sh
src/Makefile
src/lib/Makefile
src/lib/ns/Makefile
src/lib/ns/ipc/Makefile
src/lib/ns/mnt/Makefile
src/lib/ns/pid/Makefile
src/lib/ns/user/Makefile
src/lib/rootfs/Makefile
src/lib/rootfs/image/Makefile
src/lib/rootfs/dir/Makefile
src/lib/rootfs/squashfs/Makefile
src/lib/action/Makefile
src/lib/action/exec/Makefile
src/lib/action/shell/Makefile
src/lib/action/start/Makefile
src/lib/action/stop/Makefile
src/lib/action/test/Makefile
src/lib/action/run/Makefile
src/lib/file/Makefile
src/lib/file/group/Makefile
src/lib/file/passwd/Makefile
src/lib/file/resolvconf/Makefile
src/lib/mount/Makefile
src/lib/mount/cwd/Makefile
src/lib/mount/dev/Makefile
src/lib/mount/binds/Makefile
src/lib/mount/home/Makefile
src/lib/mount/hostfs/Makefile
src/lib/mount/kernelfs/Makefile
src/lib/mount/tmp/Makefile
src/lib/mount/userbinds/Makefile
src/lib/mount/scratch/Makefile
src/util/Makefile
src/slurm/Makefile
etc/Makefile
bin/Makefile
bin/singularity
man/Makefile
libexec/Makefile
libexec/bootstrap/Makefile
libexec/bootstrap/modules-v1/Makefile
libexec/bootstrap/modules-v2/Makefile
libexec/cli/Makefile
libexec/helpers/Makefile
libexec/python/Makefile
libexec/python/docker/Makefile
])
AC_OUTPUT