forked from apptainer/singularity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
159 lines (134 loc) · 5.03 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
AC_PREREQ(2.59)
AC_INIT([singularity],[2.2],[[email protected]])
if test -z "$prefix" -o "$prefix" = "NONE" ; then
prefix=${ac_default_prefix}
fi
AC_SUBST(PREFIX, $prefix)
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([.])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([.])
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_CC
AM_INIT_AUTOMAKE
AM_PROG_CC_C_O
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 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 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"
else
AC_MSG_RESULT([no])
fi
else
AC_MSG_RESULT([no])
fi
AC_SUBST(SINGULARITY_DEFINES)
AC_CHECK_FUNCS(setns, [
], [
NO_SETNS="-DNO_SETNS"
]
)
AC_SUBST(NO_SETNS)
#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
src/Makefile
etc/Makefile
bin/Makefile
bin/singularity
man/Makefile
libexec/Makefile
libexec/mods/Makefile
libexec/cli/Makefile
])
AC_OUTPUT