When a new file was opened then the client quit without saving, a
[pwmd.git] / configure.ac
blob9d3629508135e21fed658550f7a92f85b3eac88e
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(pwmd, 0.10, [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])
11 case "$target_os" in
12     *linux*)
13         kver=`uname -r 2>&1`
15         case "$kver" in
16             2.[[0-3]]* | 1.*)
17                 LIBS="$LIBS -lrt"
18                 mmap_anonymous_shared=no
19                 ;;
20             *)
21                 mmap_anonymous_shared=yes
22                 ;;
23         esac
24         ;;
25     *)
26         mmap_anonymous_shared=yes
27         ;;
28 esac
30 if test "$mmap_anonymous_shared" = "yes"; then
31     AC_DEFINE([MMAP_ANONYMOUS_SHARED], 1, \
32               [Define if your mmap() supports MAP_ANONYMOUS with MAP_SHARED.])
35 CFLAGS="$CFLAGS -D_GNU_SOURCE"
37 dnl Checks for programs.
38 AC_PROG_AWK
39 AC_PROG_LN_S
40 AC_PROG_CC
41 AC_PROG_INSTALL
43 dnl Checks for library functions.
44 AM_PATH_GLIB_2_0(,, AC_MSG_ERROR([glib2 not found]))
45 AM_PATH_LIBGCRYPT(,, AC_MSG_ERROR([libgcrypt not found]))
46 AM_PATH_XML2(,, AC_MSG_ERROR([libxml2 not found]))
47 AM_PATH_LIBASSUAN(,, AC_MSG_ERROR([libassuan not found]))
48 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([libgpg-error not found]))
50 dnl Checks for header files.
51 AC_HEADER_STDC
52 AC_HEADER_SYS_WAIT
53 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h \
54                   termios.h])
56 dnl Checks for typedefs, structures, and compiler characteristics.
57 AC_C_CONST
58 AC_TYPE_SSIZE_T
59 AC_HEADER_TIME
60 AC_TYPE_SIZE_T
61 AC_TYPE_SIGNAL
62 AC_STRUCT_TM
64 dnl Checks for library functions.
65 AC_FUNC_STAT
66 AC_FUNC_FORK
67 AC_FUNC_MALLOC
68 AC_FUNC_REALLOC
69 AC_FUNC_MEMCMP
70 AC_FUNC_MMAP
71 AC_FUNC_STRFTIME
72 AC_FUNC_SELECT_ARGTYPES
73 AC_CHECK_FUNCS([mkdir strerror memset select socket strcasecmp strdup \
74                 strncasecmp strchr setrlimit mlock mlockall ftruncate \
75                 getcwd memmove munmap strrchr strtol strstr alarm])
77 AC_TRY_COMPILE([
78                 #include <stdio.h>
79                 #include <sys/mman.h>], [
80                 int main()
81                 {
82                     void *p = mmap(NULL, 1024, PROT_READ,
83                                    MAP_SHARED|MAP_ANONYMOUS, 0, 0);
84                     exit(0);
85                 }],
86                 [have_mmap_anonymous=yes], [have_mmap_anonymous=no])
88 if test "$have_mmap_anonymous" = "yes"; then
89     AC_DEFINE([MMAP_ANONYMOUS], 1, \
90               [Define if your mmap() supports the MAP_ANONYMOUS flag.])
93 AC_DEFUN([AC_DEBUG],
95     if test "$1"; then
96         ac_cv_sys_debug=$1
97     fi
99     AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
100         [ac_cv_sys_debug=no])
101     AM_CONDITIONAL([WITH_DEBUG], [test "$ac_cv_sys_debug" = "yes"])
104 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
105     AC_DEBUG([$enableval]), AC_DEBUG)
107 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
108 AC_OUTPUT