1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(pwmd, 1.3, [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])
13 AC_ARG_ENABLE(locking, AC_HELP_STRING([--disable-locking],
14 [Disable cache mutex locking support.]), locking=no, locking=yes)
22 if test "$locking" = "yes"; then
23 AC_MSG_ERROR([pthread_mutex_t must be a complete type for
24 cache locking to work properly. I've only
25 tested Linux v2.6. Please read README for
32 mmap_anonymous_shared=no
35 mmap_anonymous_shared=yes
40 AC_DEFINE([WORKING_PTHREADS], 1,
41 [Define if your pthreads implementation has a complete pthread_mutex_t data type.])
42 mmap_anonymous_shared=yes
47 if test "$locking" = "yes"; then
48 AC_MSG_ERROR([pthread_mutex_t must be a complete type for
49 cache locking to work properly. I've only
50 tested Linux v2.6. Please read README for
56 if test "$mmap_anonymous_shared" = "yes"; then
57 AC_DEFINE([MMAP_ANONYMOUS_SHARED], 1, \
58 [Define if your mmap() supports MAP_ANONYMOUS with MAP_SHARED.])
61 CFLAGS="$CFLAGS -D_GNU_SOURCE"
63 dnl Checks for programs.
69 dnl Checks for library functions.
70 AM_PATH_GLIB_2_0(,, AC_MSG_ERROR([glib2 not found]))
71 AM_PATH_LIBGCRYPT(,, AC_MSG_ERROR([libgcrypt not found]))
72 AM_PATH_XML2(,, AC_MSG_ERROR([libxml2 not found]))
73 AM_PATH_LIBASSUAN(,, AC_MSG_ERROR([libassuan not found]))
74 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([libgpg-error not found]))
75 ACX_PTHREAD(, AC_MSG_ERROR([pthreads not found]))
76 AC_CHECK_LIB(z, deflate,,
77 AC_MSG_ERROR([Version 1.2.2.1 or later of zlib is required]))
85 if (ZLIB_VERNUM < 0x1221)
90 AC_MSG_ERROR([Version 1.2.2.1 or later of zlib is required]))
92 dnl Checks for header files.
95 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h \
98 dnl Checks for typedefs, structures, and compiler characteristics.
106 dnl Checks for library functions.
114 AC_FUNC_SELECT_ARGTYPES
115 AC_CHECK_FUNCS([mkdir strerror memset select socket strcasecmp strdup \
116 strncasecmp strchr setrlimit mlock mlockall ftruncate \
117 getcwd memmove munmap strrchr strtol strstr alarm])
121 #include <sys/mman.h>], [
124 void *p = mmap(NULL, 1024, PROT_READ,
125 MAP_SHARED|MAP_ANONYMOUS, 0, 0);
128 [have_mmap_anonymous=yes], [have_mmap_anonymous=no])
130 if test "$have_mmap_anonymous" = "yes"; then
131 AC_DEFINE([MMAP_ANONYMOUS], 1, \
132 [Define if your mmap() supports the MAP_ANONYMOUS flag.])
141 AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
142 [ac_cv_sys_debug=no])
143 AM_CONDITIONAL([WITH_DEBUG], [test "$ac_cv_sys_debug" = "yes"])
146 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
147 AC_DEBUG([$enableval]), AC_DEBUG)
149 AC_DEFUN([AC_MEM_DEBUG],
152 ac_cv_sys_mem_debug=$1
155 AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
156 [ac_cv_sys_mem_debug=no])
157 AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
160 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug], [Enable memory debugging.]),
161 AC_MEM_DEBUG([$enableval]), AC_MEM_DEBUG)
163 AC_DEFINE([DEFAULT_RECURSION_DEPTH], 20, \
164 [Default number of target recursions before returning an error.])
166 AC_DEFINE([DEFAULT_ZLIB_BUFSIZE], 4096, \
167 [Default input and output buffer chunk sizes. Affects status messages.])
169 AM_CONDITIONAL(MEM_DEBUG, test x"${ac_cv_sys_mem_debug}" != xno)
171 LIBS="$PTHREAD_LIBS $LIBS"
172 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
175 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile po/Makefile.in])