1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(pwmd, 1.1, [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])
20 mmap_anonymous_shared=no
23 mmap_anonymous_shared=yes
28 mmap_anonymous_shared=yes
32 if test "$mmap_anonymous_shared" = "yes"; then
33 AC_DEFINE([MMAP_ANONYMOUS_SHARED], 1, \
34 [Define if your mmap() supports MAP_ANONYMOUS with MAP_SHARED.])
37 CFLAGS="$CFLAGS -D_GNU_SOURCE"
39 dnl Checks for programs.
45 dnl Checks for library functions.
46 AM_PATH_GLIB_2_0(,, AC_MSG_ERROR([glib2 not found]))
47 AM_PATH_LIBGCRYPT(,, AC_MSG_ERROR([libgcrypt not found]))
48 AM_PATH_XML2(,, AC_MSG_ERROR([libxml2 not found]))
49 AM_PATH_LIBASSUAN(,, AC_MSG_ERROR([libassuan not found]))
50 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([libgpg-error not found]))
52 AC_CHECK_LIB(z, deflate,,
53 AC_MSG_ERROR([Version 1.2.2.1 or later of zlib is required]))
61 if (ZLIB_VERNUM < 0x1221)
66 AC_MSG_ERROR([Version 1.2.2.1 or later of zlib is required]))
68 dnl Checks for header files.
71 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h \
74 dnl Checks for typedefs, structures, and compiler characteristics.
82 dnl Checks for library functions.
90 AC_FUNC_SELECT_ARGTYPES
91 AC_CHECK_FUNCS([mkdir strerror memset select socket strcasecmp strdup \
92 strncasecmp strchr setrlimit mlock mlockall ftruncate \
93 getcwd memmove munmap strrchr strtol strstr alarm])
97 #include <sys/mman.h>], [
100 void *p = mmap(NULL, 1024, PROT_READ,
101 MAP_SHARED|MAP_ANONYMOUS, 0, 0);
104 [have_mmap_anonymous=yes], [have_mmap_anonymous=no])
106 if test "$have_mmap_anonymous" = "yes"; then
107 AC_DEFINE([MMAP_ANONYMOUS], 1, \
108 [Define if your mmap() supports the MAP_ANONYMOUS flag.])
117 AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
118 [ac_cv_sys_debug=no])
119 AM_CONDITIONAL([WITH_DEBUG], [test "$ac_cv_sys_debug" = "yes"])
122 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
123 AC_DEBUG([$enableval]), AC_DEBUG)
125 AC_DEFUN([AC_MEM_DEBUG],
128 ac_cv_sys_mem_debug=$1
131 AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
132 [ac_cv_sys_mem_debug=no])
133 AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
136 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug], [Enable memory debugging.]),
137 AC_MEM_DEBUG([$enableval]), AC_MEM_DEBUG)
139 AC_DEFINE([DEFAULT_RECURSION_DEPTH], 20, \
140 [Default number of target recursions before returning an error.])
142 AC_DEFINE([DEFAULT_ZLIB_BUFSIZE], 4096, \
143 [Default input and output buffer chunk sizes. Affects status messages.])
145 AM_CONDITIONAL(MEM_DEBUG, test x"${ac_cv_sys_mem_debug}" != xno)
147 LIBS="$PTHREAD_LIBS $LIBS"
148 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
151 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile po/Makefile.in])