Version 0.12.
[pwmd.git] / configure.ac
bloba5a6deb1824bc0363715e2ee7fc7eb179e427f6d
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(pwmd, 0.12, [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 case "$target_os" in
14     *linux*)
15         kver=`uname -r 2>&1`
17         case "$kver" in
18             2.[[0-3]]* | 1.*)
19                 LIBS="$LIBS -lrt"
20                 mmap_anonymous_shared=no
21                 ;;
22             *)
23                 mmap_anonymous_shared=yes
24                 ;;
25         esac
26         ;;
27     *)
28         mmap_anonymous_shared=yes
29         ;;
30 esac
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.
40 AC_PROG_AWK
41 AC_PROG_LN_S
42 AC_PROG_CC
43 AC_PROG_INSTALL
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]))
51 AC_CHECK_LIB(z, deflate)
53 dnl Checks for header files.
54 AC_HEADER_STDC
55 AC_HEADER_SYS_WAIT
56 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h \
57                   termios.h zlib.h])
59 dnl Checks for typedefs, structures, and compiler characteristics.
60 AC_C_CONST
61 AC_TYPE_SSIZE_T
62 AC_HEADER_TIME
63 AC_TYPE_SIZE_T
64 AC_TYPE_SIGNAL
65 AC_STRUCT_TM
67 dnl Checks for library functions.
68 AC_FUNC_STAT
69 AC_FUNC_FORK
70 AC_FUNC_MALLOC
71 AC_FUNC_REALLOC
72 AC_FUNC_MEMCMP
73 AC_FUNC_MMAP
74 AC_FUNC_STRFTIME
75 AC_FUNC_SELECT_ARGTYPES
76 AC_CHECK_FUNCS([mkdir strerror memset select socket strcasecmp strdup \
77                 strncasecmp strchr setrlimit mlock mlockall ftruncate \
78                 getcwd memmove munmap strrchr strtol strstr alarm])
80 AC_TRY_COMPILE([
81                 #include <stdio.h>
82                 #include <sys/mman.h>], [
83                 int main()
84                 {
85                     void *p = mmap(NULL, 1024, PROT_READ,
86                                    MAP_SHARED|MAP_ANONYMOUS, 0, 0);
87                     exit(0);
88                 }],
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.])
96 AC_DEFUN([AC_DEBUG],
98     if test "$1"; then
99         ac_cv_sys_debug=$1
100     fi
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],
112     if test "$1"; then
113         ac_cv_sys_mem_debug=$1
114     fi
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"])
121 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug], [Enable memory debugging.]),
122     AC_MEM_DEBUG([$enableval]), AC_MEM_DEBUG)
124 AM_CONDITIONAL(MEM_DEBUG, test x"${ac_cv_sys_mem_debug}" != xno)
125 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile po/Makefile.in])
126 AC_OUTPUT