1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(libpwmd, 7.0.0-dev, [Ben Kibbey bjk@luxsci.net])
4 AC_CONFIG_MACRO_DIR([m4])
5 AC_CONFIG_AUX_DIR(build)
7 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
10 AC_USE_SYSTEM_EXTENSIONS
12 AC_CONFIG_SRCDIR([src/libpwmd.c])
13 AM_CONFIG_HEADER([config.h])
14 AM_GNU_GETTEXT([external])
15 AM_GNU_GETTEXT_VERSION([0.16.1])
17 VER_MAJOR="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`"
18 VER_MINOR="`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_MAJOR_HEX=`printf "%02X" $VER_MAJOR`
24 VER_MINOR_HEX=`printf "%02X" $VER_MINOR`
25 VER_PATCH_HEX=`printf "%02X" $VER_PATCH`
26 AC_SUBST(VER_MAJOR_HEX)
27 AC_SUBST(VER_MINOR_HEX)
28 AC_SUBST(VER_PATCH_HEX)
29 VER_STRING="\"$VERSION\""
34 LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
35 CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
40 LDFLAGS="$LDFLAGS -lrt"
50 dnl Checks for programs.
53 if test "$ac_cv_prog_cc_c99" = "no"; then
54 AC_MSG_ERROR("Unable to find a C99 compatible compiler.")
57 dnl Borrowed from libssh2!
58 dnl ************************************************************
59 dnl Enable hiding of internal symbols in library to reduce its size and
60 dnl speed dynamic linking of applications. This currently is only supported
61 dnl on gcc >= 4.0 and SunPro C.
63 AC_MSG_CHECKING([whether to enable hidden symbols in the library])
64 AC_ARG_ENABLE(hidden-symbols,
65 AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
66 AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
67 [ case "$enableval" in
72 AC_MSG_CHECKING([whether $CC supports it])
73 if test "$GCC" = yes ; then
74 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
76 AC_DEFINE(LIBPWMD_API, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
77 CFLAGS="$CFLAGS -fvisibility=hidden"
83 dnl Test for SunPro cc
84 if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
86 AC_DEFINE(LIBPWMD_API, [__global], [to make a symbol visible])
87 CFLAGS="$CFLAGS -xldscope=hidden"
97 dnl Checks for header files.
100 AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h sys/socket.h \
103 dnl Checks for typedefs, structures, and compiler characteristics.
110 ACX_PTHREAD(, AC_MSG_ERROR([Missing or incomplete pthread installation]))
113 AC_ARG_ENABLE(interactive, AC_HELP_STRING([--disable-interactive], [Disable interactive mode in pwmc.]),
114 WITH_INTERACTIVE=no, WITH_INTERACTIVE=yes)
115 AC_MSG_CHECKING([if interactive mode is wanted])
116 AC_MSG_RESULT($WITH_INTERACTIVE)
117 if test "x$WITH_INTERACTIVE" = "xyes"; then
120 if test "x$vl_cv_lib_readline" != "xno"; then
121 READLINE_LIBS="$vl_cv_lib_readline"
122 AC_SUBST(READLINE_LIBS)
124 AC_MSG_ERROR([Missing or incomplete readline installation.])
125 WITH_INTERACTIVE="no"
128 AM_CONDITIONAL([WITH_READLINE], [test x"$vl_cv_lib_readline" != "x"])
130 AM_PATH_LIBASSUAN([2.0.1],, AC_MSG_ERROR([libassuan not found]))
131 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([Missing or incomplete libgpg-error installation.]))
133 AC_ARG_ENABLE(ssh, AC_HELP_STRING([--enable-ssh], [Enable SSH support.]),
134 WITH_SSH=$enableval, WITH_SSH=no)
135 AC_MSG_CHECKING([if ssh support is wanted])
136 AC_MSG_RESULT($WITH_SSH)
137 if test "x$WITH_SSH" = "xyes"; then
138 AC_MSG_CHECKING([for libssh2 availability])
139 PKG_CHECK_EXISTS([libssh2], have_libssh2=1)
142 if test $have_libssh2; then
143 PKG_CHECK_MODULES([libssh2], [libssh2 >= 1.2.8])
144 AC_DEFINE(WITH_SSH, 1, [Define if you want SSH support.])
147 AC_MSG_ERROR([Missing or incomplete libssh2 installation.])
150 AM_CONDITIONAL([WITH_SSH], [test "x$WITH_SSH" = "xyes"])
152 AC_ARG_ENABLE(gnutls, AC_HELP_STRING([--enable-gnutls],
153 [Enable GnuTLS client support.]), WITH_GNUTLS=$enableval,
155 AC_MSG_CHECKING([if gnutls support is wanted])
156 AC_MSG_RESULT($WITH_GNUTLS)
157 if test "x$WITH_GNUTLS" = "xyes"; then
158 AC_MSG_CHECKING([for libgnutls availability])
159 PKG_CHECK_EXISTS(gnutls, have_libgnutls=1, AC_MSG_ERROR([gnutls pkg-config module not found]))
162 if test $have_libgnutls; then
163 PKG_CHECK_MODULES([GNUTLS], [gnutls])
164 AC_DEFINE(WITH_GNUTLS, 1, [Define if you want GnuTLS support.])
167 AC_MSG_ERROR([Missing or incomplete gnutls installation.])
170 AM_CONDITIONAL(WITH_GNUTLS, [test "x$WITH_GNUTLS" = "xyes"])
172 dnl Checks for library functions.
176 AC_FUNC_SELECT_ARGTYPES
177 AC_CHECK_FUNCS([memmove select socket strdup strerror setlocale getcwd \
178 memset stpcpy strchr strrchr strtok_r getopt_long getpwuid_r])
179 AM_CONDITIONAL([NEED_GETOPT_LONG], [test "$ac_cv_func_getopt_long" != "yes"])
181 AC_DEFUN([AC_MEM_DEBUG],
184 ac_cv_sys_mem_debug=$1
187 AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
188 [ac_cv_sys_mem_debug=no])
189 AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
192 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug],
193 [Enable memory debugging.]), AC_MEM_DEBUG([$enableval]),
196 AM_CONDITIONAL(MEM_DEBUG, test "x${ac_cv_sys_mem_debug}" != "xno")
198 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry],
199 [Disable pinentry(1) support (not pwmd).]), WITH_PINENTRY=no,
202 if test "x$WITH_PINENTRY" != "xno"; then
203 AC_CHECK_HEADERS([locale.h])
204 AC_DEFINE(WITH_PINENTRY, 1, [Define if you want local pinentry(1) support.])
207 AM_CONDITIONAL([WITH_PINENTRY], [test "x$WITH_PINENTRY" = "xyes"])
208 pinentry="/usr/bin/pinentry"
210 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
211 [Default location of the pinentry binary (/usr/bin/pinentry)]),
215 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"],
216 [Default location of the pinentry binary.])
218 # Cracklib support (requires pinentry support).
219 AC_ARG_ENABLE(quality, AC_HELP_STRING([--enable-quality],
220 [Enable password quality checking with cracklib.]),
221 WITH_QUALITY=$enableval, WITH_QUALITY=no)
222 if test "x$WITH_QUALITY" = "xyes"; then
223 if test "x$WITH_PINENTRY" != "xyes"; then
224 AC_MSG_ERROR([--enable-quality needs --enable-pinentry])
227 AC_CHECK_HEADER([crack.h],, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
228 AC_CHECK_LIB([crack], FascistCheck,, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
229 AC_DEFINE(WITH_QUALITY, 1, [Define if you want password quality checking.])
231 AM_CONDITIONAL(WITH_QUALITY, [test "x$WITH_QUALITY" = "xyes"])
233 crackdict="/var/cache/cracklib/cracklib_dict"
234 AC_ARG_WITH(crackdict, AC_HELP_STRING([--with-crack-dict=PATH],
235 [Location of the cracklib dictionary (/var/cache/cracklib/cracklib_dict).]),
236 crackdict="$withval")
238 AC_DEFINE_UNQUOTED(CRACKLIB_DICT, ["$crackdict"], [The location of the cracklib dictionary.])
240 AC_CONFIG_FILES([Makefile libpwmd-7.0.pc doc/Makefile doc/doxygen.conf.in \
241 doc/pwmc.1 src/Makefile src/libpwmd.h po/Makefile.in])
245 echo " Interactive pwmc: $WITH_INTERACTIVE"
246 echo " Ssh: $WITH_SSH"
247 echo " GnuTLS: $WITH_GNUTLS"
248 echo " Local pinentry: $WITH_PINENTRY"
249 echo " Pinentry location: $pinentry"
250 echo " Local passphrase quality checking: $WITH_QUALITY"
251 echo " Crack dictionary: $crackdict"
252 echo " Memory debug: ${ac_cv_sys_mem_debug}"