Set the file descriptor to non-blocking in pwmd when debugging async
[libpwmd.git] / configure.ac
blobcaef82dda756e5cff29306658d3722cc4e324abd
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(libpwmd, 6.0.0-dev, [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_DISABLE_SHARED
9 AC_PROG_LIBTOOL
10 AC_CONFIG_SRCDIR([src/libpwmd.c])
11 AM_CONFIG_HEADER([config.h])
12 AM_GNU_GETTEXT([external])
13 AM_GNU_GETTEXT_VERSION([0.16.1])
14 AC_CONFIG_SUBDIRS([assuan])
16 VER_MAJOR="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`"
17 VER_COMPAT="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`"
18 VER_PATCH="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`"
19 AC_SUBST(VER_MAJOR)
20 AC_SUBST(VER_COMPAT)
21 AC_SUBST(VER_PATCH)
23 case "$target_os" in
24     darwin*)
25         LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
26         CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
27         ;;
28     linux*)
29         case "$target_cpu" in
30             x86_64*)
31                 LDFLAGS="$LD_FLAGS -lrt"
32                 ;;
33             *)
34                 ;;
35         esac
36         ;;
37     *)
38         ;;
39 esac
41 CFLAGS="$CFLAGS -D_GNU_SOURCE"
43 dnl Checks for programs.
44 AC_PROG_CC
46 dnl Checks for header files.
47 AC_HEADER_STDC
48 AC_HEADER_SYS_WAIT
49 AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h sys/socket.h \
50                   getopt.h])
52 dnl Checks for typedefs, structures, and compiler characteristics.
53 AC_C_CONST
54 AC_TYPE_SIZE_T
55 AC_STRUCT_TM
56 AC_TYPE_SSIZE_T
57 AC_TYPE_PID_T
59 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([Missing or incomplete libgpg-error installation.]))
60 AC_CHECK_PTH(, yes, yes, no, have_libpth=yes, have_libpth=no)
61 AM_CONDITIONAL([WITH_LIBPTH], [test "x$have_libpth" = "xyes"])
63 AC_ARG_ENABLE(ssh, AC_HELP_STRING([--disable-ssh], [Disable SSH support.]),
64                 WITH_TCP=no, WITH_TCP=yes)
66 if test "x$WITH_TCP" = "xyes"; then
67     AC_CHECK_LIB(ssh2, libssh2_session_init_ex,,
68                       AC_MSG_ERROR([Missing or incomplete libssh2 installation.]))
69     PKG_CHECK_MODULES(libcares, libcares,,
70                       AC_MSG_ERROR([Missing or incomplete libcares installation.]))
71     AC_DEFINE(WITH_TCP, 1, [Define if you want TCP support.])
73 AM_CONDITIONAL([WITH_TCP], [test "x$WITH_TCP" = "xyes"])
75 ACX_PTHREAD(, [Missing or incomplete pthread installation])
76 AC_SUBST(PTHREAD_LIBS)
77 AC_SUBST(PTHREAD_CFLAGS)
78 AC_SUBST(PTHREAD_CC)
80 dnl Checks for library functions.
81 AC_FUNC_MALLOC
82 AC_FUNC_REALLOC
83 AC_FUNC_STRFTIME
84 AC_FUNC_SELECT_ARGTYPES
85 AC_CHECK_FUNCS([memmove select socket strdup strerror setlocale getcwd \
86                 memset stpcpy strchr strrchr strtok_r getopt_long])
87 AM_CONDITIONAL([NEED_GETOPT_LONG], [test "$ac_cv_func_getopt_long" != "yes"])
89 AC_DEFUN([AC_MEM_DEBUG],
91     if test "$1"; then
92         ac_cv_sys_mem_debug=$1
93     fi
95     AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
96         [ac_cv_sys_mem_debug=no])
97     AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
100 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug],
101               [Enable memory debugging.]), AC_MEM_DEBUG([$enableval]),
102               AC_MEM_DEBUG)
104 AM_CONDITIONAL(MEM_DEBUG, test "x${ac_cv_sys_mem_debug}" != "xno")
106 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry], 
107               [Disable pinentry(1) support (not pwmd).]), WITH_PINENTRY=no,
108               WITH_PINENTRY=yes)
110 if test "x$WITH_PINENTRY" != "xno"; then
111     AC_CHECK_HEADERS([locale.h])
112     AC_DEFINE(WITH_PINENTRY, 1, [Define if you want local pinentry(1) support.])
115 pinentry="/usr/bin/pinentry"
117 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
118               [Default location of the pinentry binary (/usr/bin/pinentry)]),
119               pinentry="$withval")
121 AC_SUBST(pinentry)
122 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"],
123                    [Default location of the pinentry binary.])
125 AC_CONFIG_FILES([Makefile libpwmd.pc libpwmd-pth.pc doc/Makefile \
126                  doc/doxygen.conf.in doc/pwmc.1 src/Makefile \
127                  src/libpwmd.h po/Makefile.in])
128 AC_OUTPUT
129 echo
130 echo "Features:"
131 echo "    Memory debug: ${ac_cv_sys_mem_debug}"
132 echo "    Pinentry: $WITH_PINENTRY"
133 echo "    Pinentry location: $pinentry"
134 echo "    Ssh support: $WITH_TCP"
135 echo "    libpth support: $have_libpth"