1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(libpwmd, 6.0.3-git, [Ben Kibbey bjk@luxsci.net])
4 AC_CONFIG_MACRO_DIR([m4])
5 AC_CONFIG_AUX_DIR(build)
7 AM_INIT_AUTOMAKE([foreign])
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])
16 AC_CONFIG_SUBDIRS([assuan])
18 VER_MAJOR="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`"
19 VER_MINOR="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`"
20 VER_PATCH="`echo "$VERSION" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`"
24 VER_STRING="\"$VERSION\""
29 LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
30 CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
35 LDFLAGS="$LDFLAGS -lrt"
45 dnl Checks for programs.
48 if test "$ac_cv_prog_cc_c99" = "no"; then
49 AC_MSG_ERROR("Unable to find a C99 compatible compiler.")
52 dnl Borrowed from libssh2!
53 dnl ************************************************************
54 dnl Enable hiding of internal symbols in library to reduce its size and
55 dnl speed dynamic linking of applications. This currently is only supported
56 dnl on gcc >= 4.0 and SunPro C.
58 AC_MSG_CHECKING([whether to enable hidden symbols in the library])
59 AC_ARG_ENABLE(hidden-symbols,
60 AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
61 AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
62 [ case "$enableval" in
67 AC_MSG_CHECKING([whether $CC supports it])
68 if test "$GCC" = yes ; then
69 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
71 AC_DEFINE(LIBPWMD_API, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
72 CFLAGS="$CFLAGS -fvisibility=hidden"
78 dnl Test for SunPro cc
79 if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
81 AC_DEFINE(LIBPWMD_API, [__global], [to make a symbol visible])
82 CFLAGS="$CFLAGS -xldscope=hidden"
92 dnl Checks for header files.
95 AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h sys/socket.h \
98 dnl Checks for typedefs, structures, and compiler characteristics.
105 ACX_PTHREAD(, AC_MSG_ERROR([Missing or incomplete pthread installation]))
108 if test "x$vl_cv_lib_readline" != "xno"; then
109 READLINE_LIBS="$vl_cv_lib_readline"
110 AC_SUBST(READLINE_LIBS)
112 AM_CONDITIONAL([WITH_READLINE], [test "x$vl_cv_lib_readline" != "xno"])
114 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([Missing or incomplete libgpg-error installation.]))
115 AC_CHECK_PTH(, no, yes, no, have_libpth=yes, have_libpth=no)
116 AM_CONDITIONAL([WITH_LIBPTH], [test "x$have_libpth" = "xyes"])
118 AC_ARG_ENABLE(ssh, AC_HELP_STRING([--disable-ssh], [Disable SSH support.]),
119 WITH_TCP=no, WITH_TCP=yes)
121 AC_MSG_CHECKING([for ssh support])
122 if test "x$WITH_TCP" = "xyes"; then
123 PKG_CHECK_EXISTS([libssh2], have_libssh2=1)
125 if test $have_libssh2 -eq 1; then
126 PKG_CHECK_MODULES([libssh2], [libssh2 >= 1.2.7])
127 PKG_CHECK_MODULES(libcares, libcares)
128 AC_DEFINE(WITH_TCP, 1, [Define if you want TCP support.])
135 AM_CONDITIONAL([WITH_TCP], [test "x$WITH_TCP" = "xyes"])
137 dnl Checks for library functions.
141 AC_FUNC_SELECT_ARGTYPES
142 AC_CHECK_FUNCS([memmove select socket strdup strerror setlocale getcwd \
143 memset stpcpy strchr strrchr strtok_r getopt_long])
144 AM_CONDITIONAL([NEED_GETOPT_LONG], [test "$ac_cv_func_getopt_long" != "yes"])
146 AC_DEFUN([AC_MEM_DEBUG],
149 ac_cv_sys_mem_debug=$1
152 AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
153 [ac_cv_sys_mem_debug=no])
154 AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
157 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug],
158 [Enable memory debugging.]), AC_MEM_DEBUG([$enableval]),
161 AM_CONDITIONAL(MEM_DEBUG, test "x${ac_cv_sys_mem_debug}" != "xno")
163 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry],
164 [Disable pinentry(1) support (not pwmd).]), WITH_PINENTRY=no,
167 if test "x$WITH_PINENTRY" != "xno"; then
168 AC_CHECK_HEADERS([locale.h])
169 AC_DEFINE(WITH_PINENTRY, 1, [Define if you want local pinentry(1) support.])
172 AM_CONDITIONAL([WITH_PINENTRY], [test "x$WITH_PINENTRY" = "xyes"])
173 pinentry="/usr/bin/pinentry"
175 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
176 [Default location of the pinentry binary (/usr/bin/pinentry)]),
180 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"],
181 [Default location of the pinentry binary.])
183 # Cracklib support (requires pinentry support).
184 AC_ARG_ENABLE(quality, AC_HELP_STRING([--enable-quality],
185 [Enable password quality checking with cracklib.]),
186 WITH_QUALITY=$enableval, WITH_QUALITY=no)
187 if test "x$WITH_QUALITY" = "xyes"; then
188 if test "x$WITH_PINENTRY" != "xyes"; then
189 AC_MSG_ERROR([--enable-quality needs --enable-pinentry])
192 AC_CHECK_HEADER([crack.h],, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
193 AC_CHECK_LIB([crack], FascistCheck,, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
194 AC_DEFINE(WITH_QUALITY, 1, [Define if you want password quality checking.])
196 AM_CONDITIONAL(WITH_QUALITY, [test "x$WITH_QUALITY" = "xyes"])
198 crackdict="/var/cache/cracklib/cracklib_dict"
199 AC_ARG_WITH(crackdict, AC_HELP_STRING([--with-crack-dict=PATH],
200 [Location of the cracklib dictionary (/var/cache/cracklib/cracklib_dict).]),
201 crackdict="$withval")
203 AC_DEFINE_UNQUOTED(CRACKLIB_DICT, ["$crackdict"], [The location of the cracklib dictionary.])
205 AC_CONFIG_FILES([Makefile libpwmd.pc libpwmd-pth.pc doc/Makefile \
206 doc/doxygen.conf.in doc/pwmc.1 src/Makefile \
207 src/libpwmd.h po/Makefile.in])
211 echo " Memory debug: ${ac_cv_sys_mem_debug}"
212 echo " Pinentry: $WITH_PINENTRY"
213 echo " Pinentry location: $pinentry"
214 echo " Cracklib: $WITH_QUALITY"
215 echo " Cracklib dictionary: $crackdict"
216 echo " Ssh support: $WITH_TCP"
217 echo " libpth support: $have_libpth"
218 echo " Interactive pwmc: ${vl_cv_lib_readline}"