Merge branch 'master' into exp
[libpwmd.git] / configure.ac
bloba707873795115b79202eaec9470fc78bc7a0c25b
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(libpwmd, 5.0.7, [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([libpwmd.c])
11 AM_CONFIG_HEADER([config.h])
12 AM_GNU_GETTEXT([external])
13 AM_GNU_GETTEXT_VERSION([0.16.1])
15 case "$target_os" in
16     darwin*)
17         LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
18         CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
19         ;;
20     *)
21         ;;
22 esac
24 CFLAGS="$CFLAGS -D_GNU_SOURCE"
26 dnl Checks for programs.
27 AC_PROG_CC
29 dnl Checks for header files.
30 AC_HEADER_STDC
31 AC_HEADER_SYS_WAIT
32 AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h sys/socket.h \
33                   assuan.h])
35 dnl Checks for typedefs, structures, and compiler characteristics.
36 AC_C_CONST
37 AC_TYPE_SIZE_T
38 AC_STRUCT_TM
39 AC_TYPE_SSIZE_T
40 AC_TYPE_PID_T
42 AM_PATH_LIBASSUAN(1.0.4,, AC_MSG_ERROR([Missing or incomplete libassuan installation.]))
43 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([Missing or incomplete libgpg-error installation.]))
44 AC_CHECK_PTH(, yes, yes, no, have_libpth=yes, have_libpth=no)
45 AM_CONDITIONAL([WITH_LIBPTH], [test "x$have_libpth" = "xyes"])
47 if test "x$have_libpth" = "xyes"; then
48     AM_PATH_LIBASSUAN_PTH(1.0.4,, AC_MSG_ERROR([libassuan-pth not found]))
51 AC_ARG_ENABLE(tcp, AC_HELP_STRING([--disable-tcp],
52               [Disable TCP (GnuTLS) support.]), WITH_TCP=no,
53               WITH_TCP=$enableval)
55 if test "x$WITH_TCP" != "xno"; then
56     AM_PATH_LIBGNUTLS(, AC_DEFINE(HAVE_LIBGNUTLS, 1,
57                       [Define if you want TCP (GnuTLS) support.]),
58                       AC_MSG_ERROR([Missing or incomplete libgnutls installation.]))
59     AC_CHECK_LIB(event, evdns_resolve_ipv4, ,
60                  AC_MSG_ERROR([Missing or incomplete libevent installation.]))
61     LIBEVENT_LIBS="-levent"
62     AC_SUBST(LIBEVENT_LIBS)
65 dnl Checks for library functions.
66 AC_FUNC_MALLOC
67 AC_FUNC_REALLOC
68 AC_FUNC_STRFTIME
69 AC_FUNC_SELECT_ARGTYPES
70 AC_CHECK_FUNCS([memmove select socket strdup strerror setlocale getcwd \
71                 memset stpcpy strchr strrchr strtok_r])
73 AC_DEFUN([AC_MEM_DEBUG],
75     if test "$1"; then
76         ac_cv_sys_mem_debug=$1
77     fi
79     AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
80         [ac_cv_sys_mem_debug=no])
81     AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
84 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug],
85               [Enable memory debugging.]), AC_MEM_DEBUG([$enableval]),
86               AC_MEM_DEBUG)
88 AM_CONDITIONAL(MEM_DEBUG, test "x${ac_cv_sys_mem_debug}" != "xno")
90 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry],
91               [Disable local pinentry(1) support.]), WITH_PINENTRY=no,
92               WITH_PINENTRY=$enableval)
94 if test "x$WITH_PINENTRY" != "xno"; then
95     AC_CHECK_HEADERS([locale.h])
96     AC_DEFINE(WITH_PINENTRY, 1, [Define if you want local pinentry(1) support.])
99 pinentry="/usr/bin/pinentry"
101 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
102               [Default location of the pinentry binary (/usr/bin/pinentry)]),
103               pinentry="$withval")
105 AC_SUBST(pinentry)
106 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"],
107                    [Default location of the pinentry binary.])
109 AC_CONFIG_FILES([Makefile libpwmd.pc libpwmd.3 pwmc.1 po/Makefile.in])
110 AC_OUTPUT