2 AC_INIT([cryptsetup],[1.2.0])
4 dnl library version from <major>.<minor>.<release>[-<suffix>]
5 LIBCRYPTSETUP_VERSION=$(echo $PACKAGE_VERSION | cut -f1 -d-)
6 LIBCRYPTSETUP_VERSION_INFO=1:0:0
8 AC_CONFIG_SRCDIR(src/cryptsetup.c)
9 AC_CONFIG_MACRO_DIR([m4])
11 AC_CONFIG_HEADERS([config.h:config.h.in])
12 AM_INIT_AUTOMAKE(dist-bzip2)
14 if test "x$prefix" = "xNONE"; then
17 AC_PREFIX_DEFAULT(/usr)
20 AC_USE_SYSTEM_EXTENSIONS
31 AC_CHECK_HEADERS(fcntl.h malloc.h inttypes.h sys/ioctl.h sys/mman.h \
32 ctype.h unistd.h locale.h)
34 AC_CHECK_HEADERS(uuid/uuid.h,,[AC_MSG_ERROR('You need the uuid library')])
35 AC_CHECK_HEADER(libdevmapper.h,,[AC_MSG_ERROR('You need the device-mapper library')])
38 AC_CHECK_LIB(uuid, uuid_clear, ,[AC_MSG_ERROR('You need the uuid library')])
39 AC_SUBST(UUID_LIBS, $LIBS)
43 AM_PATH_LIBGCRYPT(1.1.42,,[AC_MSG_ERROR('You need the gcrypt library')])
45 AC_CHECK_FUNCS([posix_memalign])
52 AC_PROG_GCC_TRADITIONAL
54 dnl ==========================================================================
56 AM_GNU_GETTEXT([external],[need-ngettext])
57 AM_GNU_GETTEXT_VERSION([0.15])
59 dnl ==========================================================================
62 AC_CHECK_LIB(popt, poptConfigFileToString,,
63 [AC_MSG_ERROR([You need popt 1.7 or newer to compile.])])
64 AC_SUBST(POPT_LIBS, $LIBS)
67 dnl ==========================================================================
70 AC_ARG_ENABLE([static-cryptsetup],
71 AS_HELP_STRING([--enable-static-cryptsetup],
72 [enable build of static cryptsetup binary]), [
73 if test x$enable_static = xno; then
74 AC_MSG_WARN([Requested static cryptsetup build, enabling static library.])
77 enable_static_cryptsetup=yes])
78 AM_CONDITIONAL(STATIC_CRYPTSETUP, test x$enable_static_cryptsetup = xyes)
80 AC_ARG_ENABLE(selinux,
81 AS_HELP_STRING([--disable-selinux],
82 [disable selinux support [default=auto]]),[], [])
85 AS_HELP_STRING([--disable-udev],
86 [disable udev support]),[], enable_udev=yes)
88 dnl Try to use pkg-config for devmapper, but fallback to old detection
89 PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= 1.02.03],, [
90 AC_CHECK_LIB(devmapper, dm_task_set_name,,
91 [AC_MSG_ERROR([You need the device-mapper library.])])
92 AC_CHECK_LIB(devmapper, dm_task_set_message,,
93 [AC_MSG_ERROR([The device-mapper library on your system is too old.])])
98 LIBS="$LIBS $DEVMAPPER_LIBS"
99 AC_CHECK_DECLS([DM_UDEV_DISABLE_DISK_RULES_FLAG], [have_cookie=yes], [have_cookie=no], [#include <libdevmapper.h>])
100 if test "x$enable_udev" = xyes; then
101 if test "x$have_cookie" = xno; then
102 AC_MSG_WARN([The device-mapper library on your system has no udev support, udev support disabled.])
104 AC_DEFINE(USE_UDEV, 1, [Try to use udev synchronisation?])
109 dnl Magic for cryptsetup.static build.
110 if test x$enable_static_cryptsetup = xyes; then
111 saved_PKG_CONFIG=$PKG_CONFIG
112 PKG_CONFIG="$PKG_CONFIG --static"
114 LIBS="$saved_LIBS $LIBGCRYPT_LIBS -static"
115 AC_CHECK_LIB(gcrypt, gcry_check_version,,
116 AC_MSG_ERROR([Cannot find static gcrypt library.]),
118 LIBGCRYPT_STATIC_LIBS="$LIBGCRYPT_LIBS -lgpg-error"
120 LIBS="$saved_LIBS -static"
121 AC_CHECK_LIB(popt, poptGetContext,,
122 AC_MSG_ERROR([Cannot find static popt library.]))
124 dnl Try to detect needed device-mapper static libraries, try pkg-config first.
125 LIBS="$saved_LIBS -static"
126 PKG_CHECK_MODULES([DEVMAPPER_STATIC], [devmapper >= 1.02.27],,[
127 DEVMAPPER_STATIC_LIBS=$DEVMAPPER_LIBS
128 if test "x$enable_selinux" != xno; then
129 AC_CHECK_LIB(sepol, sepol_bool_set)
130 AC_CHECK_LIB(selinux, is_selinux_enabled)
131 DEVMAPPER_STATIC_LIBS="$DEVMAPPER_STATIC_LIBS $LIBS"
134 LIBS="$saved_LIBS $DEVMAPPER_STATIC_LIBS"
135 AC_CHECK_LIB(devmapper, dm_task_set_uuid,,
136 AC_MSG_ERROR([Cannot link with static device-mapper library.]))
139 PKG_CONFIG=$saved_PKG_CONFIG
142 AC_SUBST([DEVMAPPER_LIBS])
143 AC_SUBST([DEVMAPPER_STATIC_LIBS])
144 AC_SUBST([LIBGCRYPT_STATIC_LIBS])
145 AC_SUBST([LIBCRYPTSETUP_VERSION])
146 AC_SUBST([LIBCRYPTSETUP_VERSION_INFO])
148 dnl ==========================================================================
149 AC_ARG_ENABLE([dev-random], AS_HELP_STRING([--enable-dev-random],
150 [use blocking /dev/random by default for key generator (otherwise use /dev/urandom)]),
151 [default_rng=/dev/random], [default_rng=/dev/urandom])
152 AC_DEFINE_UNQUOTED(DEFAULT_RNG, ["$default_rng"], [default RNG type for key generator])
154 dnl ==========================================================================
155 AC_DEFUN([CS_DEFINE],
156 [AC_DEFINE_UNQUOTED(DEFAULT_[]m4_translit([$1], [-a-z], [_A-Z]), [$2], [$3])
159 AC_DEFUN([CS_STR_WITH], [AC_ARG_WITH([$1],
160 [AS_HELP_STRING(--with-[$1], [default $2 [$3]])],
161 [CS_DEFINE([$1], ["$withval"], [$2])],
162 [CS_DEFINE([$1], ["$3"], [$2])]
165 AC_DEFUN([CS_NUM_WITH], [AC_ARG_WITH([$1],
166 [AS_HELP_STRING(--with-[$1], [default $2 [$3]])],
167 [CS_DEFINE([$1], [$withval], [$2])],
168 [CS_DEFINE([$1], [$3], [$2])]
171 CS_STR_WITH([plain-hash], [password hashing function for plain mode], [ripemd160])
172 CS_STR_WITH([plain-cipher], [cipher for plain mode], [aes])
173 CS_STR_WITH([plain-mode], [cipher mode for plain mode], [cbc-essiv:sha256])
174 CS_NUM_WITH([plain-keybits],[key length in bits for plain mode], [256])
176 CS_STR_WITH([luks1-hash], [hash function for LUKS1 header], [sha1])
177 CS_STR_WITH([luks1-cipher], [cipher for LUKS1], [aes])
178 CS_STR_WITH([luks1-mode], [cipher mode for LUKS1], [cbc-essiv:sha256])
179 CS_NUM_WITH([luks1-keybits],[key length in bits for LUKS1], [256])
182 dnl ==========================================================================
184 AC_CONFIG_FILES([ Makefile