-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
306 lines (251 loc) · 9.22 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
dnl autoconf script for cryptmount
dnl (C)Copyright 2005-2024, RW Penney
dnl run 'autoreconf -v -i -s; ./configure; make'
AC_INIT(cryptmount, 6.3.0, cryptmount@rwpenney.uk)
AC_PREREQ(2.59)
test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
SYSPATH="/sbin:/bin:/usr/sbin:/usr/bin"
CM_SYSCONF_DIR="${sysconfdir}/cryptmount"
CM_DEFAULT_SUPATH=${SYSPATH}
CM_DEFAULT_CIPHER="aes-cbc-plain"
LIBS_GCRY=""
LIBS_LUKS=""
AM_INIT_AUTOMAKE([foreign no-dependencies])
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_SYS_LARGEFILE
AC_SEARCH_LIBS(nanosleep, posix,
[AC_DEFINE(HAVE_NANOSLEEP,[1],[Define to 1 if you have nanosleep()])],
[AC_DEFINE(HAVE_NANOSLEEP,[0],[Define to 1 if you have nanosleep()])])
AC_SEARCH_LIBS(tcgetattr, termios,
[AC_DEFINE(HAVE_TERMIOS,[1],[Define to 1 if you have tcgetattr()])],
[AC_DEFINE(HAVE_TERMIOS,[0],[Define to 1 if you have tcgetattr()])])
AC_CHECK_HEADERS([errno.h getopt.h mntent.h \
linux/fs.h linux/loop.h sys/sysmacros.h])
AC_CHECK_FUNCS([ioctl memset mknod open strncpy syncfs syslog])
AC_SEARCH_LIBS(log, m)
AC_C_CONST
dnl --------
dnl allow customization of /run or /var/run
dnl - this will eventually be superseded by $runstatedir in autoconf-2.70
dnl
if test -d /run; then default_sysrundir="/run";
else default_sysrundir="/var/run"; fi
AC_ARG_WITH([sysrundir],
AS_HELP_STRING([--with-sysrundir=DIR], [directory for run-time state]),
[CM_SYSRUN_DIR="${withval}"], [CM_SYSRUN_DIR="${default_sysrundir}"])
dnl --------
dnl check for (essential) presence of libdevmapper
dnl
AC_CHECK_HEADER([libdevmapper.h],
[AC_DEFINE(HAVE_LIBDEVMAP,[1],
[Define to 1 if you have libdevmapper header files])],
[AC_MSG_ERROR([libdevmapper-devel package is needed to build cryptmount])])
AC_SEARCH_LIBS(dm_task_create, devmapper, [],
[AC_MSG_ERROR([libdevmapper package is needed to build cryptmount])])
AC_CHECK_DECLS([dm_task_secure_data],
[], [], [#include <libdevmapper.h>])
dnl --------
dnl libgcrypt key-manager
dnl
AC_CHECK_HEADER([gcrypt.h], [dfltGCRY="yes"], [dfltGCRY="no"])
AC_ARG_WITH([libgcrypt],
AS_HELP_STRING([--with-libgcrypt],
[support libgcrypt-encryption of keys]),
[libgcrypt="${withval}"], [libgcrypt="${dfltGCRY}"])
if test "x${libgcrypt}" = "xyes"; then
AC_SEARCH_LIBS(gcry_cipher_open, gcrypt,
[AC_DEFINE(HAVE_LIBGCRYPT, [1],
[Define to 1 if you have libgcrypt header files])],
[AC_MSG_ERROR([cannot find libgcrypt libraries])])
else
AC_DEFINE(HAVE_LIBGCRYPT, [0],
[Define to 1 to enable libgcrypt support])
fi
dnl --------
dnl OpenSSL emulation with libgcrypt
dnl
AC_ARG_ENABLE([openssl-compat],
AS_HELP_STRING([--enable-openssl-compat],
[enable libgcrypt-based OpenSSL compatible key-files (default is YES)]),
[sslcompat="${enableval}"], [sslcompat="yes"])
if test "x${sslcompat}" = "xyes"; then
AC_DEFINE(USE_GCRYOSSL, [1],
[Define to 1 to enable OpenSSL-compatible keys via libgcrypt])
else
AC_DEFINE(USE_GCRYOSSL, [0])
fi
dnl --------
dnl libcryptsetup libraries (needed for LUKS/cryptsetup key-manager)
dnl
PKG_CHECK_MODULES([libcryptsetup], [libcryptsetup >= 1.4],
[libcs="yes"], [libcs="no"])
if test "x${libcs}" = "xyes"; then
AC_DEFINE(HAVE_LIBCRYPTSETUP, [1],
[Define to 1 if you have the libcryptsetup header files])
fi
dnl --------
dnl LUKS key-management (implicitly dependent on libgcrypt)
dnl
AC_ARG_ENABLE([luks],
AS_HELP_STRING([--enable-luks],
[enable key-management via Linux Unified Key Setup (default is YES)]),
[use_lukscompat="${enableval}"], [use_lukscompat="${libgcrypt}"])
if test "x${use_lukscompat}" = "xyes" \
-a \( "x${libgcrypt}" != "xyes" -o "x${libcs}" != "xyes" \); then
AC_MSG_WARN([LUKS support requires libcryptsetup and libgcrypt libraries])
use_lukscompat="no"
fi
if test "x${use_lukscompat}" = "xyes"; then
AC_DEFINE(USE_LUKSCOMPAT, [1],
[Define to 1 to enable LUKS compatbility layer])
LIBS="${LIBS} ${libcryptsetup_LIBS}"
CPPFLAGS="${CPPFLAGS} ${libcryptsetup_CFLAGS}"
AC_SEARCH_LIBS(crypt_keyslot_change_by_passphrase, libcryptsetup,
[AC_DEFINE(HAVE_LIBCRYPTSETUP_1_6, [1],
[Is libcryptsetup >= 1.6.0 available?])],
[AC_DEFINE(HAVE_LIBCRYPTSETUP_1_6, [0])])
else
AC_DEFINE(USE_LUKSCOMPAT, [0])
fi
AM_CONDITIONAL(BUILD_LUKSCOMPAT, test "x$use_lukscompat" = "xyes")
dnl --------
dnl delegation of mount/umount functionality
dnl
AC_ARG_ENABLE([delegation],
AS_HELP_STRING([--enable-delegation],
[delegate (un)mounting to /bin/(u)mount (default is YES)]),
[delegation="${enableval}"], [delegation="yes"])
if test "x${delegation}" = "xyes"; then
dfltERSATZ=0;
else
dlftERSATZ=1;
fi
AC_CHECK_PROG([ERSATZ_MOUNT], [mount], [${dfltERSATZ}], [1], ${SYSPATH})
AC_PATH_PROG([PATH_MOUNT], [mount], [NOTHING], ${SYSPATH})
AC_CHECK_PROG([ERSATZ_UMOUNT], [umount], [${dfltERSATZ}], [1], ${SYSPATH})
AC_PATH_PROG([PATH_UMOUNT], [umount], [NOTHING], ${SYSPATH})
dnl --------
dnl crypt-swap support
dnl
AC_ARG_ENABLE([cswap],
AS_HELP_STRING([--enable-cswap],
[enable crypto-swap support (default is YES)]),
[use_cswap="${enableval}"], [use_cswap="yes"])
if test "x${use_cswap}" = "xyes"; then
dfltSWAP=1;
AC_SEARCH_LIBS(swapon, c, [],
[AC_MSG_ERROR([swapon() system-call is needed for crypto-swap])])
else
dfltSWAP=0;
fi
AC_CHECK_PROG([WITH_CSWAP], [mkswap], [${dfltSWAP}], [0], ${SYSPATH})
AC_PATH_PROG([PATH_MKSWAP], [mkswap], [NOTHING], ${SYSPATH})
dnl --------
dnl automatic filesystem checking
dnl
AC_ARG_ENABLE([fsck],
AS_HELP_STRING([--enable-fsck],
[check filesystems before mounting (default is YES)]),
[fsck="${enableval}"], [fsck="yes"])
if test "x${fsck}" = "xyes"; then
dfltFSCK=1;
else
dfltFSCK=0;
fi
AC_CHECK_PROG([WITH_FSCK], [fsck], [${dfltFSCK}], [0], ${SYSPATH})
AC_PATH_PROG([PATH_FSCK], [fsck], [NOTHING], ${SYSPATH})
dnl --------
dnl internationalization
dnl
AM_GNU_GETTEXT_VERSION([0.16.1])
AM_GNU_GETTEXT([external])
dnl --------
dnl argv[0] switches of default mode
dnl
AC_ARG_ENABLE([argv0switch],
AS_HELP_STRING([--enable-argv0switch],
[default action given by progname (default is NO)]),
[argv0switch="${enableval}"], [argv0switch="no"])
if test "x${argv0switch}" = "xyes"; then
AC_DEFINE(WITH_ARGV0, 1, [use program-name to alter default action])
fi
dnl --------
dnl Doxygen documentation
dnl
AC_CHECK_PROG([use_doxygen], [doxygen], [yes], [no], ${SYSPATH})
AC_ARG_WITH([docdir],
AS_HELP_STRING([--with-docdir],
[directory for assembling source-code documentation]),
[], [with_docdir=./DoxyDocs])
if test "x${with_docdir}" != "xno"; then
DOXYGEN_DOCDIR="${with_docdir}"
fi
AM_CONDITIONAL(HAVE_DOXYGEN, test "x$use_doxygen" = "xyes")
AC_SUBST(DOXYGEN_DOCDIR)
dnl --------
dnl systemd vs sysv boot support
dnl
if test -d "/lib/systemd/system"; then default_sysd_unitdir="/lib/systemd/system";
else default_sysd_unitdir="/usr/lib/systemd/system"; fi
AC_ARG_WITH([systemd-unit-dir],
AS_HELP_STRING([--with-systemd-unit-dir], [directory for systemd unit files]),
[CM_SYSD_UNITDIR="${withval}"],
[CM_SYSD_UNITDIR="${default_sysd_unitdir}"])
AC_ARG_WITH([systemd],
AS_HELP_STRING([--with-systemd],
[whether boot-up support should be via systemd or sysvinit (default is NO)]))
AM_CONDITIONAL(USE_SYSTEMD, test "x$with_systemd" = "xyes")
dnl --------
dnl substitute variables for location of configuration files etc
dnl
AC_SUBST(CM_SYSCONF_DIR)
AC_SUBST(CM_SYSRUN_DIR)
AC_SUBST(CM_SYSD_UNITDIR)
AC_SUBST(LIBS_GCRY)
AC_SUBST(LIBS_LUKS)
AC_SUBST(CM_DEFAULT_CIPHER)
AC_SUBST(CM_DEFAULT_SUPATH)
AC_DEFINE(CM_DEFAULT_CIPHER, [], [Default filesystem encryption algorithm])
AC_DEFINE_UNQUOTED(CM_DEFAULT_CIPHER, ["${CM_DEFAULT_CIPHER}"])
AC_CONFIG_FILES([
Makefile
delegates.h
man/Makefile
man/fr/Makefile
po/Makefile.in
sysinit/Makefile
testing/Makefile
doxygen.conf
])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT
dnl --------
dnl configuration-summary messages
dnl
eval msg_conf="${CM_SYSCONF_DIR}"
if test "${ERSATZ_MOUNT}" -ne 0; then msg_mount="(internal)"; else msg_mount="${PATH_MOUNT}"; fi
if test "${ERSATZ_UMOUNT}" -ne 0; then msg_umount="(internal)"; else msg_umount="${PATH_UMOUNT}"; fi
if test "${WITH_FSCK}" -ne 0; then msg_fsck="${PATH_FSCK}"; else msg_fsck="(disabled)"; fi
msg_gcry="${libgcrypt}"
if test "x${libgcrypt}" = "xyes"; then
if test "x${sslcompat}" = "xyes"; then msg_gcry="${msg_gcry} (with OpenSSL emulator)"; else msg_gcry="${msg_gcry} (without OpenSSL emulator)"; fi
fi
msg_luks="${use_lukscompat}"
AC_MSG_NOTICE([
cryptmount-${PACKAGE_VERSION} is now configured with:
Source location: $srcdir
Installation prefix: $prefix
Configuration directory: $msg_conf
Run-state directory: ${CM_SYSRUN_DIR}
Filesystem mounting: $msg_mount
Filesystem unmounting: $msg_umount
Filesystem checking: $msg_fsck
Crypto-swap support: $use_cswap
libgcrypt support: $msg_gcry
LUKS support: $msg_luks
])
dnl vim: set ts=4 sw=4 et: