1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(libpwmd, 6.0.2, [Ben Kibbey bjk@luxsci.net])
4 AC_CONFIG_AUX_DIR(build)
6 AM_INIT_AUTOMAKE([foreign])
9 AC_USE_SYSTEM_EXTENSIONS
11 AC_CONFIG_SRCDIR([src/libpwmd.c])
12 AM_CONFIG_HEADER([config.h])
13 AM_GNU_GETTEXT([external])
14 AM_GNU_GETTEXT_VERSION([0.16.1])
15 AC_CONFIG_SUBDIRS([assuan])
17 VER_MAJOR="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`"
18 VER_COMPAT="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`"
19 VER_PATCH="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`"
23 VER_STRING="\"$VER_MAJOR.$VER_COMPAT.$VER_PATCH\""
28 LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
29 CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
34 LDFLAGS="$LDFLAGS -lrt"
44 dnl Checks for programs.
47 if test "$ac_cv_prog_cc_c99" = "no"; then
48 AC_MSG_ERROR("Unable to find a C99 compatible compiler.")
51 dnl Borrowed from libssh2!
52 dnl ************************************************************
53 dnl Enable hiding of internal symbols in library to reduce its size and
54 dnl speed dynamic linking of applications. This currently is only supported
55 dnl on gcc >= 4.0 and SunPro C.
57 AC_MSG_CHECKING([whether to enable hidden symbols in the library])
58 AC_ARG_ENABLE(hidden-symbols,
59 AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
60 AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
61 [ case "$enableval" in
66 AC_MSG_CHECKING([whether $CC supports it])
67 if test "$GCC" = yes ; then
68 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
70 AC_DEFINE(LIBPWMD_API, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
71 CFLAGS="$CFLAGS -fvisibility=hidden"
77 dnl Test for SunPro cc
78 if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
80 AC_DEFINE(LIBPWMD_API, [__global], [to make a symbol visible])
81 CFLAGS="$CFLAGS -xldscope=hidden"
91 dnl Checks for header files.
94 AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h sys/socket.h \
97 dnl Checks for typedefs, structures, and compiler characteristics.
104 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([Missing or incomplete libgpg-error installation.]))
105 AC_CHECK_PTH(, no, yes, no, have_libpth=yes, have_libpth=no)
106 AM_CONDITIONAL([WITH_LIBPTH], [test "x$have_libpth" = "xyes"])
108 AC_ARG_ENABLE(ssh, AC_HELP_STRING([--disable-ssh], [Disable SSH support.]),
109 WITH_TCP=no, WITH_TCP=yes)
111 if test "x$WITH_TCP" = "xyes"; then
112 AC_CHECK_LIB(ssh2, libssh2_session_init_ex,,
113 AC_MSG_ERROR([Missing or incomplete libssh2 installation.]))
114 AC_CHECK_HEADER([libssh2.h],,
115 AC_MSG_ERROR([Missing or incomplete libssh2 installation.]))
116 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
117 #include <libssh2.h>]], [[
118 if (LIBSSH2_VERSION_NUM < 0x010205)
120 ]])],, AC_MSG_ERROR([Need libssh2 version 1.2.5 or later.]))
121 PKG_CHECK_MODULES(libcares, libcares,,
122 AC_MSG_ERROR([Missing or incomplete libcares installation.]))
123 AC_DEFINE(WITH_TCP, 1, [Define if you want TCP support.])
125 AM_CONDITIONAL([WITH_TCP], [test "x$WITH_TCP" = "xyes"])
127 ACX_PTHREAD(, AC_MSG_ERROR([Missing or incomplete pthread installation]))
128 AC_SUBST(PTHREAD_LIBS)
129 AC_SUBST(PTHREAD_CFLAGS)
132 dnl Checks for library functions.
136 AC_FUNC_SELECT_ARGTYPES
137 AC_CHECK_FUNCS([memmove select socket strdup strerror setlocale getcwd \
138 memset stpcpy strchr strrchr strtok_r getopt_long])
139 AM_CONDITIONAL([NEED_GETOPT_LONG], [test "$ac_cv_func_getopt_long" != "yes"])
141 AC_DEFUN([AC_MEM_DEBUG],
144 ac_cv_sys_mem_debug=$1
147 AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
148 [ac_cv_sys_mem_debug=no])
149 AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
152 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug],
153 [Enable memory debugging.]), AC_MEM_DEBUG([$enableval]),
156 AM_CONDITIONAL(MEM_DEBUG, test "x${ac_cv_sys_mem_debug}" != "xno")
158 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry],
159 [Disable pinentry(1) support (not pwmd).]), WITH_PINENTRY=no,
162 if test "x$WITH_PINENTRY" != "xno"; then
163 AC_CHECK_HEADERS([locale.h])
164 AC_DEFINE(WITH_PINENTRY, 1, [Define if you want local pinentry(1) support.])
167 AM_CONDITIONAL([WITH_PINENTRY], [test "x$WITH_PINENTRY" = "xyes"])
168 pinentry="/usr/bin/pinentry"
170 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
171 [Default location of the pinentry binary (/usr/bin/pinentry)]),
175 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"],
176 [Default location of the pinentry binary.])
178 # Cracklib support (requires pinentry support).
179 AC_ARG_ENABLE(quality, AC_HELP_STRING([--enable-quality],
180 [Enable password quality checking with cracklib.]),
181 WITH_QUALITY=$enableval, WITH_QUALITY=no)
182 if test "x$WITH_QUALITY" = "xyes"; then
183 if test "x$WITH_PINENTRY" != "xyes"; then
184 AC_MSG_ERROR([--enable-quality needs --enable-pinentry])
187 AC_CHECK_HEADER([crack.h],, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
188 AC_CHECK_LIB([crack], FascistCheck,, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
189 AC_DEFINE(WITH_QUALITY, 1, [Define if you want password quality checking.])
191 AM_CONDITIONAL(WITH_QUALITY, [test "x$WITH_QUALITY" = "xyes"])
193 crackdict="/var/cache/cracklib/cracklib_dict"
194 AC_ARG_WITH(crackdict, AC_HELP_STRING([--with-crack-dict=PATH],
195 [Location of the cracklib dictionary (/var/cache/cracklib/cracklib_dict).]),
196 crackdict="$withval")
198 AC_DEFINE_UNQUOTED(CRACKLIB_DICT, ["$crackdict"], [The location of the cracklib dictionary.])
200 AC_CONFIG_FILES([Makefile libpwmd.pc libpwmd-pth.pc doc/Makefile \
201 doc/doxygen.conf.in doc/pwmc.1 src/Makefile \
202 src/libpwmd.h po/Makefile.in])
206 echo " Memory debug: ${ac_cv_sys_mem_debug}"
207 echo " Pinentry: $WITH_PINENTRY"
208 echo " Pinentry location: $pinentry"
209 echo " Cracklib: $WITH_QUALITY"
210 echo " Cracklib dictionary: $crackdict"
211 echo " Ssh support: $WITH_TCP"
212 echo " libpth support: $have_libpth"