734aa28446733a234ed4c21606b5d7e678731bf1
[platform/upstream/cryptsetup.git] / configure.in
1 AC_PREREQ(2.57)
2 AC_INIT(cryptsetup,1.0.7-rc1)
3 AC_CONFIG_SRCDIR(src/cryptsetup.c)
4
5 AM_CONFIG_HEADER([config.h:config.h.in])
6 AM_INIT_AUTOMAKE(dist-bzip2)
7
8 if test "x$prefix" = "xNONE"; then
9         sysconfdir=/etc
10 fi
11 AC_PREFIX_DEFAULT(/usr)
12
13 AC_CANONICAL_HOST
14 AC_GNU_SOURCE
15 AC_PROG_CC
16 AM_PROG_CC_C_O
17 AC_PROG_CPP
18 AC_PROG_INSTALL
19 AC_PROG_MAKE_SET
20 AC_ENABLE_STATIC(no)
21 AM_PROG_LIBTOOL
22
23 AC_HEADER_DIRENT
24 AC_HEADER_STDC
25 AC_CHECK_HEADERS(fcntl.h malloc.h inttypes.h sys/ioctl.h sys/mman.h \
26         ctype.h unistd.h locale.h)
27
28 AC_CHECK_HEADERS(uuid/uuid.h,,[AC_MSG_ERROR('You need the uuid library (from e2fsprogs)')])
29
30 saved_LIBS="$LIBS"
31 AC_CHECK_LIB(uuid, uuid_clear, ,[AC_MSG_ERROR('You need the uuid library (from e2fsprogs)')])
32 UUID_LIBS="$LIBS"
33 LIBS="$saved_LIBS"
34 AC_SUBST(UUID_LIBS)
35
36 AC_CHECK_FUNCS(setlocale)
37
38
39 AC_C_CONST
40 AC_C_BIGENDIAN
41 AC_TYPE_OFF_T
42 AC_STRUCT_ST_RDEV
43 AC_SYS_LARGEFILE
44
45 AC_PROG_GCC_TRADITIONAL
46
47 dnl ==========================================================================
48
49 AM_GNU_GETTEXT([external],[need-ngettext])
50 AM_GNU_GETTEXT_VERSION([0.15])
51
52 dnl ==========================================================================
53
54 saved_LIBS="$LIBS"
55 AC_CHECK_LIB(popt, poptConfigFileToString,,
56         AC_MSG_ERROR([You need popt 1.7 or newer to compile.]))
57 POPT_LIBS="$LIBS"
58 LIBS="$saved_LIBS"
59 AC_SUBST(POPT_LIBS)
60
61 dnl ==========================================================================
62
63 AC_ARG_ENABLE(shared-library,
64 [  --disable-shared-library
65                           disable building of shared cryptsetup library],,
66 enable_shared_library=yes)
67 AM_CONDITIONAL(STATIC_LIBRARY, test x$enable_shared_library = xno)
68
69 AC_ARG_ENABLE(plugins,
70 [  --enable-plugins        disable shared library plugins],,enable_plugins=no)
71 if test "x$enable_plugins" = xyes; then
72         AC_DEFINE(USE_PLUGINS, 1, [Define if you wish to use the plugin loader])
73 fi
74
75 AC_ARG_ENABLE(, [
76 Modules:
77   --with-MODULE[[=shared]]  builds the module MODULE as a shared library plugin
78 ],,)
79
80 AC_ARG_ENABLE(all,
81 [  --disable-all           disable all modules built by default],,enable_all=default)
82
83 MODULE_HELPER(libgcrypt,
84 [  --enable-libgcrypt      enable libgcrypt crypto functions [[default=auto]]],auto,[
85         AM_PATH_LIBGCRYPT(1.1.42,have_module=yes)
86 ])
87 AM_CONDITIONAL(BUILD_LIBGCRYPT, test x$build_static = xyes)
88 AM_CONDITIONAL(SHARED_LIBGCRYPT, test x$build_shared = xyes)
89
90 AC_ARG_ENABLE(selinux,
91 [  --disable-selinux       disable selinux support [[default=auto]]],[], [])
92
93 MODULE_HELPER(libdevmapper,
94 [  --enable-libdevmapper   enable dm-crypt backend through libdevmapper
95                           [[default=auto]]],auto,[
96         have_module=yes
97         saved_LIBS="$LIBS"
98         if test "x$enable_selinux" != xno; then
99                 AC_CHECK_LIB(sepol, sepol_bool_set)
100                 AC_CHECK_LIB(selinux, is_selinux_enabled)
101                 # Check if we need -pthread with --enable-static and selinux
102                 if test x$build_static = xyes; then
103                         saved_LIBS2="$LIBS"
104                         LIBS="$LIBS -static"
105                         AC_SEARCH_LIBS([pthread_mutex_lock], [pthread],
106                                 [test "$ac_cv_search_pthread_mutex_lock" = "none required" || LIB_PTHREAD=-lpthread])
107                         LIBS="$saved_LIBS2"
108                 fi
109         fi
110         AC_CHECK_LIB(devmapper, dm_task_set_name,,unset have_module)
111         AC_CHECK_HEADER(libdevmapper.h,,unset have_module)
112         LIBDEVMAPPER_LIBS="$LIBS $LIB_PTHREAD"
113         LIBS="$saved_LIBS"
114         AC_SUBST(LIBDEVMAPPER_LIBS)
115         AC_SUBST(LIBDEVMAPPER_CFLAGS)
116 ])
117 AM_CONDITIONAL(BUILD_LIBDEVMAPPER, test x$build_static = xyes)
118 AM_CONDITIONAL(SHARED_LIBDEVMAPPER, test x$build_shared = xyes)
119
120 dnl ==========================================================================
121
122 AM_CONDITIONAL(STATIC_CRYPTSETUP, test x$enable_static = xyes)
123 AM_CONDITIONAL(DYNAMIC_CRYPTSETUP, test x$enable_static = xno)
124
125 dnl ==========================================================================
126
127 AC_OUTPUT([ Makefile
128 lib/Makefile
129 src/Makefile
130 po/Makefile.in
131 luks/Makefile
132 man/Makefile
133 ])