1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(libpwmd, 5.0.9, [Ben Kibbey bjk@luxsci.net])
4 AC_CONFIG_AUX_DIR(build)
6 AM_INIT_AUTOMAKE([foreign])
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/'`"
26 LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
27 CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
33 CFLAGS="$CFLAGS -D_GNU_SOURCE"
35 dnl Checks for programs.
38 dnl Checks for header files.
41 AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h sys/socket.h \
44 dnl Checks for typedefs, structures, and compiler characteristics.
51 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([Missing or incomplete libgpg-error installation.]))
52 AC_CHECK_PTH(, yes, yes, no, have_libpth=yes, have_libpth=no)
53 AM_CONDITIONAL([WITH_LIBPTH], [test "x$have_libpth" = "xyes"])
55 AC_ARG_ENABLE(ssh, AC_HELP_STRING([--disable-ssh],
56 [Disable SSH support.]), WITH_TCP=no,
59 if test "x$WITH_TCP" = "xyes"; then
60 AC_CHECK_LIB(ssh2, libssh2_session_init_ex,,
61 AC_MSG_ERROR([Missing or incomplete libssh2 installation.]))
62 PKG_CHECK_MODULES(libcares, libcares,,
63 AC_MSG_ERROR([Missing or incomplete libcares installation.]))
64 AC_DEFINE(WITH_TCP, 1, [Define if you want TCP support.])
66 AM_CONDITIONAL([WITH_TCP], [test "x$WITH_TCP" = "xyes"])
68 ACX_PTHREAD(, [Missing or incomplete pthread installation])
69 AC_SUBST(PTHREAD_LIBS)
70 AC_SUBST(PTHREAD_CFLAGS)
73 dnl Checks for library functions.
77 AC_FUNC_SELECT_ARGTYPES
78 AC_CHECK_FUNCS([memmove select socket strdup strerror setlocale getcwd \
79 memset stpcpy strchr strrchr strtok_r getopt_long])
80 AM_CONDITIONAL([NEED_GETOPT_LONG], [test "$ac_cv_func_getopt_long" != "yes"])
82 AC_DEFUN([AC_MEM_DEBUG],
85 ac_cv_sys_mem_debug=$1
88 AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
89 [ac_cv_sys_mem_debug=no])
90 AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
93 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug],
94 [Enable memory debugging.]), AC_MEM_DEBUG([$enableval]),
97 AM_CONDITIONAL(MEM_DEBUG, test "x${ac_cv_sys_mem_debug}" != "xno")
99 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry],
100 [Disable pinentry(1) support (not pwmd).]), USE_PINENTRY=no,
101 USE_PINENTRY=$enableval)
103 if test "x$WITH_PINENTRY" != "xno"; then
104 AC_CHECK_HEADERS([locale.h])
105 AC_DEFINE(WITH_PINENTRY, 1, [Define if you want local pinentry(1) support.])
108 pinentry="/usr/bin/pinentry"
110 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
111 [Default location of the pinentry binary (/usr/bin/pinentry)]),
115 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"],
116 [Default location of the pinentry binary.])
118 AC_CONFIG_FILES([Makefile libpwmd.pc libpwmd-pth.pc doc/Makefile \
119 doc/libpwmd.3 doc/pwmc.1 src/Makefile src/libpwmd.h \