Move default cipher paramaters to config.h and allow change through
[platform/upstream/cryptsetup.git] / configure.in
1 AC_PREREQ(2.57)
2 AC_INIT(cryptsetup,1.1.0-rc3)
3 AC_CONFIG_SRCDIR(src/cryptsetup.c)
4 AC_CONFIG_MACRO_DIR([m4])
5
6 AM_CONFIG_HEADER([config.h:config.h.in])
7 AM_INIT_AUTOMAKE(dist-bzip2)
8
9 if test "x$prefix" = "xNONE"; then
10         sysconfdir=/etc
11 fi
12 AC_PREFIX_DEFAULT(/usr)
13
14 AC_CANONICAL_HOST
15 AC_GNU_SOURCE
16 AC_PROG_CC
17 AM_PROG_CC_C_O
18 AC_PROG_CPP
19 AC_PROG_INSTALL
20 AC_PROG_MAKE_SET
21 AC_ENABLE_STATIC(no)
22 AM_PROG_LIBTOOL
23
24 AC_HEADER_DIRENT
25 AC_HEADER_STDC
26 AC_CHECK_HEADERS(fcntl.h malloc.h inttypes.h sys/ioctl.h sys/mman.h \
27         ctype.h unistd.h locale.h)
28
29 AC_CHECK_HEADERS(uuid/uuid.h,,[AC_MSG_ERROR('You need the uuid library')])
30 AC_CHECK_HEADER(libdevmapper.h,,[AC_MSG_ERROR('You need the device-mapper library')])
31
32 saved_LIBS=$LIBS
33 AC_CHECK_LIB(uuid, uuid_clear, ,[AC_MSG_ERROR('You need the uuid library')])
34 AC_SUBST(UUID_LIBS, $LIBS)
35 LIBS=$saved_LIBS
36
37
38 AM_PATH_LIBGCRYPT(1.1.42,,[AC_MSG_ERROR('You need the gcrypt library')])
39
40 AC_CHECK_FUNCS([setlocale, posix_memalign])
41
42 AC_C_CONST
43 AC_C_BIGENDIAN
44 AC_TYPE_OFF_T
45 AC_STRUCT_ST_RDEV
46 AC_SYS_LARGEFILE
47
48 AC_PROG_GCC_TRADITIONAL
49
50 dnl ==========================================================================
51
52 AM_GNU_GETTEXT([external],[need-ngettext])
53 AM_GNU_GETTEXT_VERSION([0.15])
54
55 dnl ==========================================================================
56
57 saved_LIBS=$LIBS
58 AC_CHECK_LIB(popt, poptConfigFileToString,,
59         [AC_MSG_ERROR([You need popt 1.7 or newer to compile.])])
60 AC_SUBST(POPT_LIBS, $LIBS)
61 LIBS=$saved_LIBS
62
63 dnl ==========================================================================
64
65 AC_ARG_ENABLE(shared-library,
66 [  --disable-shared-library
67                           disable building of shared cryptsetup library],,
68 enable_shared_library=yes)
69 AM_CONDITIONAL(STATIC_LIBRARY, test x$enable_shared_library = xno)
70
71 AC_ARG_ENABLE(selinux,
72 [  --disable-selinux       disable selinux support [[default=auto]]],[], [])
73
74 saved_LIBS=$LIBS
75 AC_CHECK_LIB(devmapper, dm_task_set_name,,[AC_MSG_ERROR('You need the device-mapper library')])
76 DEVMAPPER_LIBS=$LIBS
77 LIBS=$saved_LIBS
78 if test "x$enable_selinux" != xno; then
79         AC_CHECK_LIB(sepol, sepol_bool_set)
80         AC_CHECK_LIB(selinux, is_selinux_enabled)
81         if test x$enable_static = xyes; then
82                 SELINUX_STATIC_LIBS=$LIBS
83                 # Check if we need -pthread with --enable-static and selinux
84                 saved_LIBS2=$LIBS
85                 LIBS="$LIBS -static"
86                 AC_SEARCH_LIBS([pthread_mutex_lock], [pthread],
87                         [test "$ac_cv_search_pthread_mutex_lock" = "none required" || LIB_PTHREAD=-lpthread])
88                 LIBS=$saved_LIBS2
89         fi
90 fi
91
92 if test x$enable_static = xyes; then
93         saved_LIBS2=$LIBS
94         LIBS="$LIBS -static"
95         # Check if it there is still not some missing dependency like static selinux libs
96         AC_SEARCH_LIBS([dm_set_selinux_context], [devmapper],,
97                 [AC_MSG_ERROR([Your system requires SElinux libraries for static compilation.])])
98         LIBS=$saved_LIBS2
99 fi
100
101 LIBS=$saved_LIBS
102
103 DEVMAPPER_LIBS="$DEVMAPPER_LIBS $LIB_PTHREAD"
104 AC_SUBST(DEVMAPPER_LIBS)
105 AC_SUBST(SELINUX_STATIC_LIBS)
106
107 dnl ==========================================================================
108 AC_DEFUN([CS_DEFINE],
109         [AC_DEFINE_UNQUOTED(DEFAULT_[]m4_translit([$1], [-a-z], [_A-Z]), [$2], [$3])
110 ])
111
112 AC_DEFUN([CS_STR_WITH], [AC_ARG_WITH([$1],
113         [AS_HELP_STRING(--with-[$1], [default $2 [$3]])],
114         [CS_DEFINE([$1], ["$withval"], [$2])],
115         [CS_DEFINE([$1], ["$3"], [$2])]
116 )])
117
118 AC_DEFUN([CS_NUM_WITH], [AC_ARG_WITH([$1],
119         [AS_HELP_STRING(--with-[$1], [default $2 [$3]])],
120         [CS_DEFINE([$1], [$withval], [$2])],
121         [CS_DEFINE([$1], [$3], [$2])]
122 )])
123
124 CS_STR_WITH([plain-hash],   [password hashing function for plain mode], [ripemd160])
125 CS_STR_WITH([plain-cipher], [cipher for plain mode], [aes])
126 CS_STR_WITH([plain-mode],   [cipher mode for plain mode], [cbc-essiv:sha256])
127 CS_NUM_WITH([plain-keybits],[key length in bits for plain mode], [256])
128
129 CS_STR_WITH([luks1-hash],   [hash function for LUKS1 header], [sha1])
130 CS_STR_WITH([luks1-cipher], [cipher for LUKS1], [aes])
131 CS_STR_WITH([luks1-mode],   [cipher mode for LUKS1], [cbc-essiv:sha256])
132 CS_NUM_WITH([luks1-keybits],[key length in bits for LUKS1], [256])
133
134 dnl ==========================================================================
135
136 AM_CONDITIONAL(STATIC_CRYPTSETUP, test x$enable_static = xyes)
137 AM_CONDITIONAL(DYNAMIC_CRYPTSETUP, test x$enable_static = xno)
138
139 dnl ==========================================================================
140
141 AC_OUTPUT([ Makefile
142 lib/Makefile
143 lib/libcryptsetup.pc
144 src/Makefile
145 po/Makefile.in
146 luks/Makefile
147 man/Makefile
148 tests/Makefile
149 ])