1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(pwmd, 1.14, [Ben Kibbey bjk@luxsci.net])
4 AC_CONFIG_AUX_DIR(build)
6 AM_INIT_AUTOMAKE([foreign])
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])
14 dnl Checks for programs.
24 dnl Checks for library functions.
25 AM_PATH_GLIB_2_0(,, AC_MSG_ERROR([glib2 not found]))
26 AM_PATH_LIBGCRYPT(,, AC_MSG_ERROR([libgcrypt not found]))
27 AM_PATH_LIBGNUTLS(,, AC_MSG_ERROR([libgnutls not found]))
28 AM_PATH_XML2(,, AC_MSG_ERROR([libxml2 not found]))
29 AM_PATH_LIBASSUAN_PTH(1.0.4,, AC_MSG_ERROR([libassuan-pth not found]))
30 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([libgpg-error not found]))
31 AC_CHECK_PTH(2.0.0,,,,, AC_MSG_ERROR([libpth not found]))
32 AC_CHECK_LIB(z, deflate,,
33 AC_MSG_ERROR([Version 1.2.2.1 or later of zlib is required]))
35 AC_MSG_CHECKING([if zlib is >= 1.2.2.1])
42 if (ZLIB_VERNUM < 0x1221)
46 }], AC_MSG_RESULT([yes]),
47 AC_MSG_ERROR([Version 1.2.2.1 or later of zlib is required]))
49 dnl Checks for header files.
52 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/time.h unistd.h libintl.h \
53 locale.h syslog.h termios.h zlib.h])
55 dnl Checks for typedefs, structures, and compiler characteristics.
64 dnl Checks for library functions.
72 AC_CHECK_FUNCS([memset mkdir munmap setlocale socket strchr strerror strrchr \
73 strstr strtol setrlimit mlockall])
77 #include <sys/mman.h>], [
80 void *p = mmap(NULL, 1024, PROT_READ,
81 MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
84 [have_mmap_anonymous=yes], [have_mmap_anonymous=no])
86 if test "$have_mmap_anonymous" = "yes"; then
87 AC_DEFINE([MMAP_ANONYMOUS], 1, \
88 [Define if your mmap() supports the MAP_ANONYMOUS flag.])
97 AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
99 AM_CONDITIONAL([WITH_DEBUG], [test "$ac_cv_sys_debug" = "yes"])
102 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
103 AC_DEBUG([$enableval]), AC_DEBUG)
105 AC_DEFUN([AC_MEM_DEBUG],
108 ac_cv_sys_mem_debug=$1
111 AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
112 [ac_cv_sys_mem_debug=no])
113 AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
116 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug], [Enable memory debugging.]),
117 AC_MEM_DEBUG([$enableval]), AC_MEM_DEBUG)
118 AM_CONDITIONAL(MEM_DEBUG, test x"${ac_cv_sys_mem_debug}" != xno)
120 AC_DEFINE([DEFAULT_RECURSION_DEPTH], 20, \
121 [Default number of target recursions before returning an error.])
123 AC_DEFINE([DEFAULT_ZLIB_BUFSIZE], 65536, \
124 [Default input and output buffer chunk sizes. Affects status messages.])
127 AC_ARG_ENABLE(tcp, AC_HELP_STRING([--enable-tcp],
128 [Enable TCP (GnuTLS) server support.]), USE_GNUTLS=yes,
130 if test "x$USE_GNUTLS" = "xyes"; then
131 AC_DEFINE(WITH_GNUTLS, 1, [Define if you want TCP (GnuTLS) support.])
133 AM_CONDITIONAL(WITH_GNUTLS, [test "x$USE_GNUTLS" = "xyes"])
136 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry],
137 [Disable pinentry(1) support.]), USE_PINENTRY=no,
139 if test "x$USE_PINENTRY" = "xyes"; then
140 AC_DEFINE(WITH_PINENTRY, 1, [Define if you want pinentry(1) support.])
142 AM_CONDITIONAL(WITH_PINENTRY, [test "x$USE_PINENTRY" = "xyes"])
144 pinentry="/usr/bin/pinentry"
145 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
146 [Default location of the pinentry binary (/usr/bin/pinentry)]),
149 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"], [Default location of the pinentry binary.])
151 # Cracklib support (requires pinentry support).
152 AC_ARG_ENABLE(quality, AC_HELP_STRING([--enable-quality],
153 [Enable password quality checking with cracklib.]), CRACKLIB=yes,
155 if test "x$CRACKLIB" = "xyes"; then
156 if test "x$USE_PINENTRY" != "xyes"; then
157 AC_MSG_ERROR([--enable-quality needs --enable-pinentry])
160 AC_CHECK_HEADER([crack.h],, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
161 AC_CHECK_LIB([crack], FascistCheck,, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
162 AC_DEFINE(WITH_QUALITY, 1, [Define if you want password quality checking.])
164 AM_CONDITIONAL(WITH_QUALITY, [test "x$CRACKLIB" = "xyes"])
166 crackdict="/var/cache/cracklib/cracklib_dict"
167 AC_ARG_WITH(crackdict, AC_HELP_STRING([--with-crack-dict=PATH],
168 [Location of the cracklib dictionary (/var/cache/cracklib/cracklib_dict).]),
169 crackdict="$withval")
171 AC_DEFINE_UNQUOTED(CRACKLIB_DICT, ["$crackdict"], [The location of the cracklib dictionary.])
173 VER_MAJOR="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`"
174 VER_MINOR="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`"
175 AC_DEFINE_UNQUOTED(VERSION_HEX, 0x${VER_MAJOR}${VER_MINOR}, [For the file header.])
177 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile doc/pwmd.1 po/Makefile.in])
181 echo " Debug: ${ac_cv_sys_debug}"
182 echo " Memory debug: ${ac_cv_sys_mem_debug}"
183 echo " GnuTLS: $USE_GNUTLS"
184 echo " Pinentry: $USE_PINENTRY"
185 echo " Pinentry location: $pinentry"
186 echo " Cracklib: $CRACKLIB"
187 echo " Cracklib dictionary: $crackdict"