1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(pwmd, 2.3, [Ben Kibbey bjk@luxsci.net])
4 AC_CONFIG_AUX_DIR(build)
6 AM_INIT_AUTOMAKE([foreign])
8 AC_USE_SYSTEM_EXTENSIONS()
9 AC_CONFIG_SRCDIR([src/pwmd.c])
10 AM_CONFIG_HEADER([config.h])
11 AM_GNU_GETTEXT([external])
12 AM_GNU_GETTEXT_VERSION([0.16.1])
14 dnl Checks for programs.
17 if test "$ac_cv_prog_cc_c99" = "no"; then
18 AC_MSG_ERROR("Unable to find a C99 compatible compiler.")
29 dnl Checks for library functions.
30 AM_PATH_LIBASSUAN(2.0.0,, AC_MSG_ERROR([Missing or incomplete libassuan installation]))
31 AM_PATH_GLIB_2_0(,, AC_MSG_ERROR([glib2 not found]))
32 AM_PATH_LIBGCRYPT([1.3.1],, AC_MSG_ERROR([libgcrypt not found]))
33 AM_PATH_XML2(,, AC_MSG_ERROR([libxml2 not found]))
34 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([libgpg-error not found]))
35 AC_CHECK_LIB(z, deflate,,
36 AC_MSG_ERROR([Version 1.2.2.1 or later of zlib is required]))
37 AC_CHECK_PTH(, yes, yes, no, ,
38 AC_MSG_ERROR([Missing or incomplete libpth installation]))
40 AC_MSG_CHECKING([if zlib is >= 1.2.2.1])
47 if (ZLIB_VERNUM < 0x1221)
51 }], AC_MSG_RESULT([yes]),
52 AC_MSG_ERROR([Version 1.2.2.1 or later of zlib is required]))
54 dnl Checks for header files.
57 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/time.h unistd.h libintl.h \
58 locale.h syslog.h termios.h zlib.h getopt.h])
60 dnl Checks for typedefs, structures, and compiler characteristics.
69 dnl Checks for library functions.
76 AC_CHECK_FUNCS([memset mkdir munmap setlocale socket strchr strerror strrchr \
77 strstr strtol setrlimit mlockall getopt_long])
78 AM_CONDITIONAL([NEED_GETOPT_LONG], [test "$ac_cv_func_getopt_long" != "yes"])
82 #include <sys/mman.h>], [
85 void *p = mmap(NULL, 1024, PROT_READ,
86 MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
89 [have_mmap_anonymous=yes], [have_mmap_anonymous=no])
91 if test "$have_mmap_anonymous" = "yes"; then
92 AC_DEFINE([MMAP_ANONYMOUS], 1, \
93 [Define if your mmap() supports the MAP_ANONYMOUS flag.])
102 AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
103 [ac_cv_sys_debug=no])
104 AM_CONDITIONAL([WITH_DEBUG], [test "$ac_cv_sys_debug" = "yes"])
107 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
108 AC_DEBUG([$enableval]), AC_DEBUG)
110 AC_DEFUN([AC_MEM_DEBUG],
113 ac_cv_sys_mem_debug=$1
116 AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
117 [ac_cv_sys_mem_debug=no])
118 AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
122 AC_ARG_ENABLE(acl, AC_HELP_STRING([--enable-acl],
123 [Enable Access Control List support]), USE_LIBACL=yes,
125 if test "x$USE_LIBACL" = "xyes"; then
126 AC_CHECK_LIB(acl, acl_get_file,,
127 AC_MSG_ERROR([Missing or incomplete libacl installation.]))
128 AC_CHECK_HEADER([sys/acl.h],,
129 AC_MSG_ERROR([Missing or incomplete libacl installation.]))
130 AC_DEFINE(WITH_LIBACL, 1, [Define if you want libacl support.])
132 AM_CONDITIONAL(WITH_LIBACL, [test "x$USE_LIBACL" = "xyes"])
135 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug], [Enable memory debugging.]),
136 AC_MEM_DEBUG([$enableval]), AC_MEM_DEBUG)
137 AM_CONDITIONAL(MEM_DEBUG, test x"${ac_cv_sys_mem_debug}" != xno)
139 AC_DEFINE([DEFAULT_RECURSION_DEPTH], 20, \
140 [Default number of target recursions before returning an error.])
142 AC_DEFINE([DEFAULT_ZLIB_BUFSIZE], 65536, \
143 [Default input and output buffer chunk sizes. Affects status messages.])
146 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry],
147 [Disable pinentry(1) support.]), USE_PINENTRY=$enableval,
149 if test "x$USE_PINENTRY" = "xyes"; then
150 AC_DEFINE(WITH_PINENTRY, 1, [Define if you want pinentry(1) support.])
152 AM_CONDITIONAL(WITH_PINENTRY, [test "x$USE_PINENTRY" = "xyes"])
154 pinentry="/usr/bin/pinentry"
155 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
156 [Default location of the pinentry binary (/usr/bin/pinentry)]),
159 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"], [Default location of the pinentry binary.])
161 # Cracklib support (requires pinentry support).
162 AC_ARG_ENABLE(quality, AC_HELP_STRING([--enable-quality],
163 [Enable password quality checking with cracklib.]),
164 CRACKLIB=$enableval, CRACKLIB=no)
165 if test "x$CRACKLIB" = "xyes"; then
166 if test "x$USE_PINENTRY" != "xyes"; then
167 AC_MSG_ERROR([--enable-quality needs --enable-pinentry])
170 AC_CHECK_HEADER([crack.h],, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
171 AC_CHECK_LIB([crack], FascistCheck,, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
172 AC_DEFINE(WITH_QUALITY, 1, [Define if you want password quality checking.])
174 AM_CONDITIONAL(WITH_QUALITY, [test "x$USE_CRACKLIB" = "xyes"])
176 crackdict="/var/cache/cracklib/cracklib_dict"
177 AC_ARG_WITH(crackdict, AC_HELP_STRING([--with-crack-dict=PATH],
178 [Location of the cracklib dictionary (/var/cache/cracklib/cracklib_dict).]),
179 crackdict="$withval")
181 AC_DEFINE_UNQUOTED(CRACKLIB_DICT, ["$crackdict"], [The location of the cracklib dictionary.])
183 VER_MAJOR="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`"
184 VER_MINOR="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`"
185 AC_DEFINE_UNQUOTED(VERSION_HEX, 0x${VER_MAJOR}${VER_MINOR}, [For the file header.])
187 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile doc/pwmd.1 po/Makefile.in])
191 echo " Debug: ${ac_cv_sys_debug}"
192 echo " Memory debug: ${ac_cv_sys_mem_debug}"
193 echo " Pinentry: $USE_PINENTRY"
194 echo " Pinentry location: $pinentry"
195 echo " Cracklib: $CRACKLIB"
196 echo " Cracklib dictionary: $crackdict"
197 echo " ACL: $USE_LIBACL"