Added RESET command handling. It'll free all the resources of the
[pwmd.git] / configure.ac
blob26d943e001348f1fc6f76a1b6901a133ff0f275c
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(pwmd, 1.3, [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])
13 CFLAGS="$CFLAGS -D_GNU_SOURCE"
15 dnl Checks for programs.
16 AC_PROG_AWK
17 AC_PROG_LN_S
18 AC_PROG_CC
19 AC_PROG_INSTALL
21 dnl Checks for library functions.
22 AM_PATH_GLIB_2_0(,, AC_MSG_ERROR([glib2 not found]))
23 AM_PATH_LIBGCRYPT(,, AC_MSG_ERROR([libgcrypt not found]))
24 AM_PATH_XML2(,, AC_MSG_ERROR([libxml2 not found]))
25 AM_PATH_LIBASSUAN_PTH(1.0.4,, AC_MSG_ERROR([libassuan-pth not found]))
26 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([libgpg-error not found]))
27 AC_CHECK_PTH(,,,,, AC_MSG_ERROR([libpth not found]))
28 AC_CHECK_LIB(z, deflate,,
29             AC_MSG_ERROR([Version 1.2.2.1 or later of zlib is required]))
31 AC_MSG_CHECKING([if zlib is >= 1.2.2.1])
32 AC_TRY_RUN([
33             #include <stdio.h>
34             #include <zlib.h>
36             int main()
37             {
38                 if (ZLIB_VERNUM < 0x1221)
39                     exit(1);
41                 exit(0);
42             }], AC_MSG_RESULT([yes]),
43             AC_MSG_ERROR([Version 1.2.2.1 or later of zlib is required]))
45 dnl Checks for header files.
46 AC_HEADER_STDC
47 AC_HEADER_SYS_WAIT
48 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/time.h unistd.h libintl.h \
49                   locale.h syslog.h termios.h zlib.h])
51 dnl Checks for typedefs, structures, and compiler characteristics.
52 AC_C_CONST
53 AC_C_INLINE
54 AC_TYPE_MODE_T
55 AC_TYPE_SIZE_T
56 AC_STRUCT_TM
58 dnl Checks for library functions.
59 AM_GNU_GETTEXT
60 AC_FUNC_STAT
61 AC_FUNC_FORK
62 AC_FUNC_MALLOC
63 AC_FUNC_MEMCMP
64 AC_FUNC_MMAP
65 AC_FUNC_STRFTIME
66 AC_CHECK_FUNCS([memset mkdir munmap setlocale socket strchr strerror strrchr \
67                 strstr strtol])
69 AC_TRY_COMPILE([
70                 #include <stdio.h>
71                 #include <sys/mman.h>], [
72                 int main()
73                 {
74                     void *p = mmap(NULL, 1024, PROT_READ,
75                                    MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
76                     exit(0);
77                 }],
78                 [have_mmap_anonymous=yes], [have_mmap_anonymous=no])
80 if test "$have_mmap_anonymous" = "yes"; then
81     AC_DEFINE([MMAP_ANONYMOUS], 1, \
82               [Define if your mmap() supports the MAP_ANONYMOUS flag.])
85 AC_DEFUN([AC_DEBUG],
87     if test "$1"; then
88         ac_cv_sys_debug=$1
89     fi
91     AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
92         [ac_cv_sys_debug=no])
93     AM_CONDITIONAL([WITH_DEBUG], [test "$ac_cv_sys_debug" = "yes"])
96 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
97     AC_DEBUG([$enableval]), AC_DEBUG)
99 AC_DEFUN([AC_MEM_DEBUG],
101     if test "$1"; then
102         ac_cv_sys_mem_debug=$1
103     fi
105     AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
106         [ac_cv_sys_mem_debug=no])
107     AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
110 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug], [Enable memory debugging.]),
111     AC_MEM_DEBUG([$enableval]), AC_MEM_DEBUG)
113 AC_DEFINE([DEFAULT_RECURSION_DEPTH], 20, \
114           [Default number of target recursions before returning an error.])
116 AC_DEFINE([DEFAULT_ZLIB_BUFSIZE], 4096, \
117           [Default input and output buffer chunk sizes. Affects status messages.])
119 AM_CONDITIONAL(MEM_DEBUG, test x"${ac_cv_sys_mem_debug}" != xno)
120 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile po/Makefile.in])
121 AC_OUTPUT