Version 1.13.
[pwmd.git] / configure.ac
blob02ee1ca09fd15913b02381159c8d0ebe48fb9227
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(pwmd, 1.13, [Ben Kibbey bjk@luxsci.net])
4 AC_CONFIG_AUX_DIR(build)
5 AC_CANONICAL_TARGET
6 AM_INIT_AUTOMAKE([foreign])
7 AC_PROG_MAKE_SET
8 AC_CONFIG_SRCDIR([src/pwmd.c])
9 AM_CONFIG_HEADER([config.h])
10 AM_GNU_GETTEXT([external])
11 AM_GNU_GETTEXT_VERSION([0.16.1])
12 AC_GNU_SOURCE
14 dnl Checks for programs.
15 AC_PROG_AWK
16 AC_PROG_LN_S
17 AC_PROG_CC
18 AC_PROG_INSTALL
20 dnl Checks for library functions.
21 AM_PATH_GLIB_2_0(,, AC_MSG_ERROR([glib2 not found]))
22 AM_PATH_LIBGCRYPT(,, AC_MSG_ERROR([libgcrypt not found]))
23 AM_PATH_XML2(,, AC_MSG_ERROR([libxml2 not found]))
24 AM_PATH_LIBASSUAN_PTH(1.0.4,, AC_MSG_ERROR([libassuan-pth not found]))
25 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([libgpg-error not found]))
26 AC_CHECK_PTH(2.0.0,,,,, AC_MSG_ERROR([libpth not found]))
27 AC_CHECK_LIB(z, deflate,,
28             AC_MSG_ERROR([Version 1.2.2.1 or later of zlib is required]))
30 AC_MSG_CHECKING([if zlib is >= 1.2.2.1])
31 AC_TRY_RUN([
32             #include <stdio.h>
33             #include <zlib.h>
35             int main()
36             {
37                 if (ZLIB_VERNUM < 0x1221)
38                     exit(1);
40                 exit(0);
41             }], AC_MSG_RESULT([yes]),
42             AC_MSG_ERROR([Version 1.2.2.1 or later of zlib is required]))
44 dnl Checks for header files.
45 AC_HEADER_STDC
46 AC_HEADER_SYS_WAIT
47 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/time.h unistd.h libintl.h \
48                   locale.h syslog.h termios.h zlib.h])
50 dnl Checks for typedefs, structures, and compiler characteristics.
51 AC_C_CONST
52 AC_C_INLINE
53 AC_TYPE_MODE_T
54 AC_TYPE_SIZE_T
55 AC_STRUCT_TM
57 dnl Checks for library functions.
58 AM_GNU_GETTEXT
59 AC_FUNC_STAT
60 AC_FUNC_FORK
61 AC_FUNC_MALLOC
62 AC_FUNC_MEMCMP
63 AC_FUNC_MMAP
64 AC_FUNC_STRFTIME
65 AC_CHECK_FUNCS([memset mkdir munmap setlocale socket strchr strerror strrchr \
66                 strstr strtol setrlimit mlockall])
68 AC_TRY_COMPILE([
69                 #include <stdio.h>
70                 #include <sys/mman.h>], [
71                 int main()
72                 {
73                     void *p = mmap(NULL, 1024, PROT_READ,
74                                    MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
75                     exit(0);
76                 }],
77                 [have_mmap_anonymous=yes], [have_mmap_anonymous=no])
79 if test "$have_mmap_anonymous" = "yes"; then
80     AC_DEFINE([MMAP_ANONYMOUS], 1, \
81               [Define if your mmap() supports the MAP_ANONYMOUS flag.])
84 AC_DEFUN([AC_DEBUG],
86     if test "$1"; then
87         ac_cv_sys_debug=$1
88     fi
90     AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
91         [ac_cv_sys_debug=no])
92     AM_CONDITIONAL([WITH_DEBUG], [test "$ac_cv_sys_debug" = "yes"])
95 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
96     AC_DEBUG([$enableval]), AC_DEBUG)
98 AC_DEFUN([AC_MEM_DEBUG],
100     if test "$1"; then
101         ac_cv_sys_mem_debug=$1
102     fi
104     AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
105         [ac_cv_sys_mem_debug=no])
106     AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
109 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug], [Enable memory debugging.]),
110     AC_MEM_DEBUG([$enableval]), AC_MEM_DEBUG)
111 AM_CONDITIONAL(MEM_DEBUG, test x"${ac_cv_sys_mem_debug}" != xno)
113 AC_DEFINE([DEFAULT_RECURSION_DEPTH], 20, \
114           [Default number of target recursions before returning an error.])
116 AC_DEFINE([DEFAULT_ZLIB_BUFSIZE], 65536, \
117           [Default input and output buffer chunk sizes. Affects status messages.])
119 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry], 
120               [Disable pinentry(1) support.]), USE_PINENTRY=no,
121               USE_PINENTRY=yes)
122 if test "x$USE_PINENTRY" = "xyes"; then
123     AC_DEFINE(WITH_PINENTRY, 1, [Define if you want pinentry(1) support.])
125 AM_CONDITIONAL(WITH_PINENTRY, [test "x$USE_PINENTRY" = "xyes"])
127 pinentry="/usr/bin/pinentry"
128 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
129               [Default location of the pinentry binary (/usr/bin/pinentry)]),
130               pinentry="$withval")
131 AC_SUBST(pinentry)
132 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"], [Default location of the pinentry binary.])
134 AC_ARG_ENABLE(quality, AC_HELP_STRING([--enable-quality], 
135               [Enable password quality checking with cracklib.]), CRACKLIB=yes,
136               CRACKLIB=no)
137 if test "x$CRACKLIB" = "xyes"; then
138     AC_CHECK_HEADER([crack.h],, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
139     AC_CHECK_LIB([crack], FascistCheck,, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
140     AC_DEFINE(WITH_QUALITY, 1, [Define if you want password quality checking.])
142 AM_CONDITIONAL(WITH_QUALITY, [test "x$CRACKLIB" = "xyes"])
144 crackdict="/var/cache/cracklib/cracklib_dict"
145 AC_ARG_WITH(crackdict, AC_HELP_STRING([--with-crack-dict=PATH],
146               [Location of the cracklib dictionary (/var/cache/cracklib/cracklib_dict).]),
147               crackdict="$withval")
148 AC_SUBST(crackdict)
149 AC_DEFINE_UNQUOTED(CRACKLIB_DICT, ["$crackdict"], [The location of the cracklib dictionary.])
151 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile doc/pwmd.1 po/Makefile.in])
152 AC_OUTPUT