4a2815ebb8a3297518df94bb7c121a21eaa70c90
[platform/upstream/cryptsetup.git] / configure.in
1 AC_PREREQ(2.57)
2 AC_INIT(cryptsetup,1.0.7)
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 (from e2fsprogs)')])
30
31 saved_LIBS="$LIBS"
32 AC_CHECK_LIB(uuid, uuid_clear, ,[AC_MSG_ERROR('You need the uuid library (from e2fsprogs)')])
33 UUID_LIBS="$LIBS"
34 LIBS="$saved_LIBS"
35 AC_SUBST(UUID_LIBS)
36
37 AC_CHECK_FUNCS(setlocale)
38
39
40 AC_C_CONST
41 AC_C_BIGENDIAN
42 AC_TYPE_OFF_T
43 AC_STRUCT_ST_RDEV
44 AC_SYS_LARGEFILE
45
46 AC_PROG_GCC_TRADITIONAL
47
48 dnl ==========================================================================
49
50 AM_GNU_GETTEXT([external],[need-ngettext])
51 AM_GNU_GETTEXT_VERSION([0.15])
52
53 dnl ==========================================================================
54
55 saved_LIBS="$LIBS"
56 AC_CHECK_LIB(popt, poptConfigFileToString,,
57         AC_MSG_ERROR([You need popt 1.7 or newer to compile.]))
58 POPT_LIBS="$LIBS"
59 LIBS="$saved_LIBS"
60 AC_SUBST(POPT_LIBS)
61
62 dnl ==========================================================================
63
64 AC_ARG_ENABLE(shared-library,
65 [  --disable-shared-library
66                           disable building of shared cryptsetup library],,
67 enable_shared_library=yes)
68 AM_CONDITIONAL(STATIC_LIBRARY, test x$enable_shared_library = xno)
69
70 AC_ARG_ENABLE(plugins,
71 [  --enable-plugins        disable shared library plugins],,enable_plugins=no)
72 if test "x$enable_plugins" = xyes; then
73         AC_DEFINE(USE_PLUGINS, 1, [Define if you wish to use the plugin loader])
74 fi
75
76 AC_ARG_ENABLE(, [
77 Modules:
78   --with-MODULE[[=shared]]  builds the module MODULE as a shared library plugin
79 ],,)
80
81 AC_ARG_ENABLE(all,
82 [  --disable-all           disable all modules built by default],,enable_all=default)
83
84 MODULE_HELPER(libgcrypt,
85 [  --enable-libgcrypt      enable libgcrypt crypto functions [[default=auto]]],auto,[
86         AM_PATH_LIBGCRYPT(1.1.42,have_module=yes)
87 ])
88 AM_CONDITIONAL(BUILD_LIBGCRYPT, test x$build_static = xyes)
89 AM_CONDITIONAL(SHARED_LIBGCRYPT, test x$build_shared = xyes)
90
91 AC_ARG_ENABLE(selinux,
92 [  --disable-selinux       disable selinux support [[default=auto]]],[], [])
93
94 MODULE_HELPER(libdevmapper,
95 [  --enable-libdevmapper   enable dm-crypt backend through libdevmapper
96                           [[default=auto]]],auto,[
97         have_module=yes
98         saved_LIBS="$LIBS"
99         if test "x$enable_selinux" != xno; then
100                 AC_CHECK_LIB(sepol, sepol_bool_set)
101                 AC_CHECK_LIB(selinux, is_selinux_enabled)
102                 # Check if we need -pthread with --enable-static and selinux
103                 if test x$build_static = xyes; then
104                         saved_LIBS2="$LIBS"
105                         LIBS="$LIBS -static"
106                         AC_SEARCH_LIBS([pthread_mutex_lock], [pthread],
107                                 [test "$ac_cv_search_pthread_mutex_lock" = "none required" || LIB_PTHREAD=-lpthread])
108                         LIBS="$saved_LIBS2"
109                 fi
110         fi
111         AC_CHECK_LIB(devmapper, dm_task_set_name,,unset have_module)
112         AC_CHECK_HEADER(libdevmapper.h,,unset have_module)
113         LIBDEVMAPPER_LIBS="$LIBS $LIB_PTHREAD"
114         LIBS="$saved_LIBS"
115         AC_SUBST(LIBDEVMAPPER_LIBS)
116         AC_SUBST(LIBDEVMAPPER_CFLAGS)
117 ])
118 AM_CONDITIONAL(BUILD_LIBDEVMAPPER, test x$build_static = xyes)
119 AM_CONDITIONAL(SHARED_LIBDEVMAPPER, test x$build_shared = xyes)
120
121 AC_CHECK_FUNCS([posix_memalign])
122 dnl ==========================================================================
123
124 AM_CONDITIONAL(STATIC_CRYPTSETUP, test x$enable_static = xyes)
125 AM_CONDITIONAL(DYNAMIC_CRYPTSETUP, test x$enable_static = xno)
126
127 dnl ==========================================================================
128
129 AC_OUTPUT([ Makefile
130 lib/Makefile
131 src/Makefile
132 po/Makefile.in
133 luks/Makefile
134 man/Makefile
135 tests/Makefile
136 ])