In do_pwmd_save(), check for the user supplied password function first
[libpwmd.git] / configure.ac
bloba11eaceee1770a73cb0b5333b3674e21b61472e8
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(libpwmd, 5.0.8, [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 VER_MAJOR="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`"
16 VER_MINOR="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`"
17 VER_PATCH="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`"
18 VER_COMPAT=0
19 AC_SUBST(VER_MAJOR)
20 AC_SUBST(VER_MINOR)
21 AC_SUBST(VER_PATCH)
22 AC_SUBST(VER_COMPAT)
24 case "$target_os" in
25     darwin*)
26         LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
27         CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
28         ;;
29     *)
30         ;;
31 esac
33 CFLAGS="$CFLAGS -D_GNU_SOURCE"
35 dnl Checks for programs.
36 AC_PROG_CC
38 dnl Checks for header files.
39 AC_HEADER_STDC
40 AC_HEADER_SYS_WAIT
41 AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h sys/socket.h \
42                   assuan.h])
44 dnl Checks for typedefs, structures, and compiler characteristics.
45 AC_C_CONST
46 AC_TYPE_SIZE_T
47 AC_STRUCT_TM
48 AC_TYPE_SSIZE_T
49 AC_TYPE_PID_T
51 AM_PATH_LIBASSUAN(1.0.4,, AC_MSG_ERROR([libassuan not found]))
52 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([libgpg-error not found]))
53 AC_CHECK_PTH(, yes, yes, no, have_libpth=yes, have_libpth=no)
54 AM_CONDITIONAL([WITH_LIBPTH], [test "x$have_libpth" = "xyes"])
56 if test "x$have_libpth" = "xyes"; then
57     AM_PATH_LIBASSUAN_PTH(1.0.4,, AC_MSG_ERROR([libassuan-pth not found]))
60 ACX_PTHREAD(, [Missing or incomplete pthread installation])
61 AC_SUBST(PTHREAD_LIBS)
62 AC_SUBST(PTHREAD_CFLAGS)
63 AC_SUBST(PTHREAD_CC)
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])
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], [Enable memory debugging.]),
85     AC_MEM_DEBUG([$enableval]), AC_MEM_DEBUG)
87 AM_CONDITIONAL(MEM_DEBUG, test x"${ac_cv_sys_mem_debug}" != xno)
89 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry], 
90               [Disable pinentry(1) support.]), USE_PINENTRY=no,
91               USE_PINENTRY=$enableval)
93 if test $USE_PINENTRY = "yes"; then
94     AC_CHECK_HEADERS([locale.h])
95     AC_DEFINE(USE_PINENTRY, 1, [Define if you want pinentry(1) support.])
98 AM_CONDITIONAL(USE_PINENTRY, [test $USE_PINENTRY = "yes"])
100 pinentry="/usr/bin/pinentry"
102 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
103               [Default location of the pinentry binary (/usr/bin/pinentry)]),
104               pinentry="$withval")
106 AC_SUBST(pinentry)
107 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"], [Default location of the pinentry binary.])
109 AC_CONFIG_FILES([Makefile libpwmd.h libpwmd.pc libpwmd-pth.pc libpwmd.3 \
110                  pwmc.1 po/Makefile.in])
111 AC_OUTPUT