-
Notifications
You must be signed in to change notification settings - Fork 556
/
configure.ac
355 lines (299 loc) · 10.1 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
#
# Note:
#
# If for any reason autoconf fails, run "autoreconf -i --install " and try again.
# This is how the error looks like on Arch Linux:
# ./configure: line 3064: syntax error near unexpected token `newline'
# ./configure: line 3064: `AX_CHECK_COMPILE_FLAG('
#
# We rely solely on autoconf, without automake. Apparently, in this case
# the macros from m4 directory are not picked up by default by automake.
# "autoreconf -i --install" seems to fix the problem.
#
AC_PREREQ([2.68])
AC_INIT(firejail, 0.9.65, [email protected], , https://firejail.wordpress.com)
AC_CONFIG_SRCDIR([src/firejail/main.c])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
HAVE_SPECTRE="no"
AX_CHECK_COMPILE_FLAG(
[-mindirect-branch=thunk],
[HAVE_SPECTRE="yes" && EXTRA_CFLAGS+=" -mindirect-branch=thunk"]
)
AX_CHECK_COMPILE_FLAG(
[-mretpoline],
[HAVE_SPECTRE="yes" && EXTRA_CFLAGS+=" -mretpoline"]
)
AX_CHECK_COMPILE_FLAG(
[-fstack-clash-protection],
[HAVE_SPECTRE="yes" && EXTRA_CFLAGS+=" -fstack-clash-protection"]
)
AX_CHECK_COMPILE_FLAG(
[-fstack-protector-strong],
[HAVE_SPECTRE="yes" && EXTRA_CFLAGS+=" -fstack-protector-strong"]
)
AC_ARG_ENABLE([analyzer],
AS_HELP_STRING([--enable-analyzer], [enable GCC 10 static analyzer]))
AS_IF([test "x$enable_analyzer" = "xyes"], [
EXTRA_CFLAGS+=" -fanalyzer"
])
HAVE_APPARMOR=""
AC_ARG_ENABLE([apparmor],
AS_HELP_STRING([--enable-apparmor], [enable apparmor]))
AS_IF([test "x$enable_apparmor" = "xyes"], [
HAVE_APPARMOR="-DHAVE_APPARMOR"
PKG_CHECK_MODULES([AA], libapparmor, [EXTRA_CFLAGS+=" $AA_CFLAGS" && EXTRA_LDFLAGS+=" $AA_LIBS"])
AC_SUBST(HAVE_APPARMOR)
])
HAVE_SELINUX=""
AC_ARG_ENABLE([selinux],
AS_HELP_STRING([--enable-selinux], [SELinux labeling support]))
AS_IF([test "x$enable_selinux" = "xyes"], [
HAVE_SELINUX="-DHAVE_SELINUX"
EXTRA_LDFLAGS+=" -lselinux "
AC_SUBST(HAVE_SELINUX)
])
AC_SUBST([EXTRA_CFLAGS])
AC_SUBST([EXTRA_LDFLAGS])
HAVE_DBUSPROXY=""
AC_ARG_ENABLE([dbusproxy],
AS_HELP_STRING([--disable-dbusproxy], [disable dbus proxy]))
AS_IF([test "x$enable_dbusproxy" != "xno"], [
HAVE_DBUSPROXY="-DHAVE_DBUSPROXY"
AC_SUBST(HAVE_DBUSPROXY)
])
# overlayfs features temporarely disabled pending fixes
HAVE_OVERLAYFS=""
AC_SUBST(HAVE_OVERLAYFS)
#
#AC_ARG_ENABLE([overlayfs],
# AS_HELP_STRING([--disable-overlayfs], [disable overlayfs]))
#AS_IF([test "x$enable_overlayfs" != "xno"], [
# HAVE_OVERLAYFS="-DHAVE_OVERLAYFS"
# AC_SUBST(HAVE_OVERLAYFS)
#])
HAVE_OUTPUT=""
AC_ARG_ENABLE([output],
AS_HELP_STRING([--disable-output], [disable --output logging]))
AS_IF([test "x$enable_output" != "xno"], [
HAVE_OUTPUT="-DHAVE_OUTPUT"
AC_SUBST(HAVE_OUTPUT)
])
HAVE_USERTMPFS=""
AC_ARG_ENABLE([usertmpfs],
AS_HELP_STRING([--disable-usertmpfs], [disable tmpfs as regular user]))
AS_IF([test "x$enable_usertmpfs" != "xno"], [
HAVE_USERTMPFS="-DHAVE_USERTMPFS"
AC_SUBST(HAVE_USERTMPFS)
])
HAVE_MAN="no"
AC_ARG_ENABLE([man],
AS_HELP_STRING([--disable-man], [disable man pages]))
AS_IF([test "x$enable_man" != "xno"], [
HAVE_MAN="-DHAVE_MAN"
AC_SUBST(HAVE_MAN)
AC_CHECK_PROG([HAVE_GAWK], [gawk], [yes], [no])
AS_IF([test "x$HAVE_GAWK" != "xyes"], [AC_MSG_ERROR("*** gawk not found ***")])
])
HAVE_FIRETUNNEL=""
AC_ARG_ENABLE([firetunnel],
AS_HELP_STRING([--disable-firetunnel], [disable firetunnel]))
AS_IF([test "x$enable_firetunnel" != "xno"], [
HAVE_FIRETUNNEL="-DHAVE_FIRETUNNEL"
AC_SUBST(HAVE_FIRETUNNEL)
])
HAVE_PRIVATEHOME=""
AC_ARG_ENABLE([private-home],
AS_HELP_STRING([--disable-private-home], [disable private home feature]))
AS_IF([test "x$enable_private_home" != "xno"], [
HAVE_PRIVATE_HOME="-DHAVE_PRIVATE_HOME"
AC_SUBST(HAVE_PRIVATE_HOME)
])
HAVE_CHROOT=""
AC_ARG_ENABLE([chroot],
AS_HELP_STRING([--disable-chroot], [disable chroot]))
AS_IF([test "x$enable_chroot" != "xno"], [
HAVE_CHROOT="-DHAVE_CHROOT"
AC_SUBST(HAVE_CHROOT)
])
HAVE_GLOBALCFG=""
AC_ARG_ENABLE([globalcfg],
AS_HELP_STRING([--disable-globalcfg], [if the global config file firejail.cfg is not present, continue the program using defaults]))
AS_IF([test "x$enable_globalcfg" != "xno"], [
HAVE_GLOBALCFG="-DHAVE_GLOBALCFG"
AC_SUBST(HAVE_GLOBALCFG)
])
HAVE_NETWORK=""
AC_ARG_ENABLE([network],
AS_HELP_STRING([--disable-network], [disable network]))
AS_IF([test "x$enable_network" != "xno"], [
HAVE_NETWORK="-DHAVE_NETWORK"
AC_SUBST(HAVE_NETWORK)
])
HAVE_USERNS=""
AC_ARG_ENABLE([userns],
AS_HELP_STRING([--disable-userns], [disable user namespace]))
AS_IF([test "x$enable_userns" != "xno"], [
HAVE_USERNS="-DHAVE_USERNS"
AC_SUBST(HAVE_USERNS)
])
HAVE_X11=""
AC_ARG_ENABLE([x11],
AS_HELP_STRING([--disable-x11], [disable X11 sandboxing support]))
AS_IF([test "x$enable_x11" != "xno"], [
HAVE_X11="-DHAVE_X11"
AC_SUBST(HAVE_X11)
])
HAVE_FILE_TRANSFER=""
AC_ARG_ENABLE([file-transfer],
AS_HELP_STRING([--disable-file-transfer], [disable file transfer]))
AS_IF([test "x$enable_file_transfer" != "xno"], [
HAVE_FILE_TRANSFER="-DHAVE_FILE_TRANSFER"
AC_SUBST(HAVE_FILE_TRANSFER)
])
HAVE_WHITELIST=""
AC_ARG_ENABLE([whitelist],
AS_HELP_STRING([--disable-whitelist], [disable whitelist]))
AS_IF([test "x$enable_whitelist" != "xno"], [
HAVE_WHITELIST="-DHAVE_WHITELIST"
AC_SUBST(HAVE_WHITELIST)
])
HAVE_SUID=""
AC_ARG_ENABLE([suid],
AS_HELP_STRING([--disable-suid], [install as a non-SUID executable]))
AS_IF([test "x$enable_suid" = "xno"],
[HAVE_SUID="no"],
[HAVE_SUID="yes"]
)
AC_SUBST(HAVE_SUID)
HAVE_FATAL_WARNINGS=""
AC_ARG_ENABLE([fatal_warnings],
AS_HELP_STRING([--enable-fatal-warnings], [-W -Wall -Werror]))
AS_IF([test "x$enable_fatal_warnings" = "xyes"], [
HAVE_FATAL_WARNINGS="-W -Wall -Werror"
AC_SUBST(HAVE_FATAL_WARNINGS)
])
BUSYBOX_WORKAROUND="no"
AC_ARG_ENABLE([busybox-workaround],
AS_HELP_STRING([--enable-busybox-workaround], [enable busybox workaround]))
AS_IF([test "x$enable_busybox_workaround" = "xyes"], [
BUSYBOX_WORKAROUND="yes"
AC_SUBST(BUSYBOX_WORKAROUND)
])
HAVE_GCOV=""
AC_ARG_ENABLE([gcov],
AS_HELP_STRING([--enable-gcov], [Gcov instrumentation]))
AS_IF([test "x$enable_gcov" = "xyes"], [
HAVE_GCOV="--coverage -DHAVE_GCOV "
EXTRA_LDFLAGS+=" -lgcov --coverage "
AC_SUBST(HAVE_GCOV)
])
HAVE_CONTRIB_INSTALL="yes"
AC_ARG_ENABLE([contrib-install],
AS_HELP_STRING([--enable-contrib-install], [install contrib scripts]))
AS_IF([test "x$enable_contrib_install" = "xno"],
[HAVE_CONTRIB_INSTALL="no"],
[HAVE_CONTRIB_INSTALL="yes"]
)
AC_SUBST(HAVE_CONTRIB_INSTALL)
HAVE_FORCE_NONEWPRIVS=""
AC_ARG_ENABLE([force-nonewprivs],
AS_HELP_STRING([--enable-force-nonewprivs], [enable force nonewprivs]))
AS_IF([test "x$enable_force_nonewprivs" = "xyes"], [
HAVE_FORCE_NONEWPRIVS="-DHAVE_FORCE_NONEWPRIVS"
AC_SUBST(HAVE_FORCE_NONEWPRIVS)
])
HAVE_LTS=""
AC_ARG_ENABLE([lts],
AS_HELP_STRING([--enable-lts], [enable long-term support software version (LTS)]))
AS_IF([test "x$enable_lts" = "xyes"], [
HAVE_LTS="-DHAVE_LTS"
AC_SUBST(HAVE_LTS)
HAVE_DBUSPROXY=""
AC_SUBST(HAVE_DBUSPROXY)
HAVE_OVERLAYFS=""
AC_SUBST(HAVE_OVERLAYFS)
HAVE_OUTPUT=""
AC_SUBST(HAVE_OUTPUT)
HAVE_USERTMPFS=""
AC_SUBST(HAVE_USERTMPFS)
HAVE_MAN="-DHAVE_MAN"
AC_SUBST(HAVE_MAN)
HAVE_FIRETUNNEL=""
AC_SUBST(HAVE_FIRETUNNEL)
HAVE_PRIVATEHOME=""
AC_SUBST(HAVE_PRIVATE_HOME)
HAVE_CHROOT=""
AC_SUBST(HAVE_CHROOT)
HAVE_GLOBALCFG=""
AC_SUBST(HAVE_GLOBALCFG)
HAVE_USERNS=""
AC_SUBST(HAVE_USERNS)
HAVE_X11=""
AC_SUBST(HAVE_X11)
HAVE_FILE_TRANSFER=""
AC_SUBST(HAVE_FILE_TRANSFER)
HAVE_SUID="yes"
AC_SUBST(HAVE_SUID)
BUSYBOX_WORKAROUND="no"
AC_SUBST(BUSYBOX_WORKAROUND)
HAVE_CONTRIB_INSTALL="no",
AC_SUBST(HAVE_CONTRIB_INSTALL)
])
# checking pthread library
AC_CHECK_LIB([pthread], [main], [], AC_MSG_ERROR([*** POSIX thread support not installed ***]))
AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed ***]))
AC_CHECK_HEADER([linux/seccomp.h],,AC_MSG_ERROR([*** SECCOMP support is not installed (/usr/include/linux/seccomp.h missing) ***]))
# set sysconfdir
if test "$prefix" = /usr; then
test "$sysconfdir" = '${prefix}/etc' && sysconfdir="/etc"
fi
AC_CONFIG_FILES([mkdeb.sh], [chmod +x mkdeb.sh])
AC_OUTPUT(Makefile src/common.mk src/lib/Makefile src/fcopy/Makefile src/fnet/Makefile src/firejail/Makefile src/fnetfilter/Makefile \
src/firemon/Makefile src/libtrace/Makefile src/libtracelog/Makefile src/firecfg/Makefile src/fbuilder/Makefile src/fsec-print/Makefile \
src/ftee/Makefile src/fseccomp/Makefile src/fldd/Makefile src/libpostexecseccomp/Makefile src/fsec-optimize/Makefile \
src/profstats/Makefile src/man/Makefile src/zsh_completion/Makefile src/bash_completion/Makefile test/Makefile \
src/jailtest/Makefile)
echo
echo "Configuration options:"
echo " prefix: $prefix"
echo " sysconfdir: $sysconfdir"
echo " apparmor: $HAVE_APPARMOR"
echo " SELinux labeling support: $HAVE_SELINUX"
echo " global config: $HAVE_GLOBALCFG"
echo " chroot: $HAVE_CHROOT"
echo " network: $HAVE_NETWORK"
echo " user namespace: $HAVE_USERNS"
echo " X11 sandboxing support: $HAVE_X11"
echo " whitelisting: $HAVE_WHITELIST"
echo " private home support: $HAVE_PRIVATE_HOME"
echo " file transfer support: $HAVE_FILE_TRANSFER"
echo " overlayfs support: $HAVE_OVERLAYFS"
echo " DBUS proxy support: $HAVE_DBUSPROXY"
echo " allow tmpfs as regular user: $HAVE_USERTMPFS"
echo " enable --ouput logging: $HAVE_OUTPUT"
echo " Manpage support: $HAVE_MAN"
echo " firetunnel support: $HAVE_FIRETUNNEL"
echo " busybox workaround: $BUSYBOX_WORKAROUND"
echo " Spectre compiler patch: $HAVE_SPECTRE"
echo " EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
echo " EXTRA_CFLAGS: $EXTRA_CFLAGS"
echo " fatal warnings: $HAVE_FATAL_WARNINGS"
echo " Gcov instrumentation: $HAVE_GCOV"
echo " Install contrib scripts: $HAVE_CONTRIB_INSTALL"
echo " Install as a SUID executable: $HAVE_SUID"
echo " LTS: $HAVE_LTS"
echo " Always enforce filters: $HAVE_FORCE_NONEWPRIVS"
echo
if test "$HAVE_LTS" = -DHAVE_LTS; then
echo
echo
echo "*********************************************************"
echo "* Warning: Long-term support (LTS) was enabled! *"
echo "* Most compile-time options have bean rewritten! *"
echo "*********************************************************"
echo
echo
fi