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_STRING="\"$VERSION\""
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 ACX_PTHREAD(, AC_MSG_ERROR([Missing or incomplete pthread installation]))
107 if test "x$vl_cv_lib_readline" != "xno"; then
108 READLINE_LIBS="$vl_cv_lib_readline"
109 AC_SUBST(READLINE_LIBS)
111 AM_CONDITIONAL([WITH_READLINE], [test "x$vl_cv_lib_readline" != "xno"])
113 AM_PATH_LIBASSUAN([2.0.0],, AC_MSG_ERROR([libassuan not found]))
114 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([Missing or incomplete libgpg-error installation.]))
116 AC_ARG_ENABLE(ssh, AC_HELP_STRING([--disable-ssh], [Disable SSH support.]),
117 WITH_TCP=no, WITH_TCP=yes)
119 AC_MSG_CHECKING([if ssh support is wanted])
120 AC_MSG_RESULT($WITH_TCP)
122 if test "x$WITH_TCP" = "xyes"; then
123 AC_MSG_CHECKING([for libssh2 availability])
124 PKG_CHECK_EXISTS([libssh2], have_libssh2=1)
127 if test $have_libssh2; then
128 PKG_CHECK_MODULES([libssh2], [libssh2 >= 1.2.8])
129 AC_DEFINE(WITH_TCP, 1, [Define if you want TCP support.])
133 AM_CONDITIONAL([WITH_TCP], [test "x$WITH_TCP" = "xyes"])
135 dnl Checks for library functions.
139 AC_FUNC_SELECT_ARGTYPES
140 AC_CHECK_FUNCS([memmove select socket strdup strerror setlocale getcwd \
141 memset stpcpy strchr strrchr strtok_r getopt_long])
142 AM_CONDITIONAL([NEED_GETOPT_LONG], [test "$ac_cv_func_getopt_long" != "yes"])
144 AC_DEFUN([AC_MEM_DEBUG],
147 ac_cv_sys_mem_debug=$1
150 AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
151 [ac_cv_sys_mem_debug=no])
152 AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
155 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug],
156 [Enable memory debugging.]), AC_MEM_DEBUG([$enableval]),
159 AM_CONDITIONAL(MEM_DEBUG, test "x${ac_cv_sys_mem_debug}" != "xno")
161 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry],
162 [Disable pinentry(1) support (not pwmd).]), WITH_PINENTRY=no,
165 if test "x$WITH_PINENTRY" != "xno"; then
166 AC_CHECK_HEADERS([locale.h])
167 AC_DEFINE(WITH_PINENTRY, 1, [Define if you want local pinentry(1) support.])
170 AM_CONDITIONAL([WITH_PINENTRY], [test "x$WITH_PINENTRY" = "xyes"])
171 pinentry="/usr/bin/pinentry"
173 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
174 [Default location of the pinentry binary (/usr/bin/pinentry)]),
178 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"],
179 [Default location of the pinentry binary.])
181 # Cracklib support (requires pinentry support).
182 AC_ARG_ENABLE(quality, AC_HELP_STRING([--enable-quality],
183 [Enable password quality checking with cracklib.]),
184 WITH_QUALITY=$enableval, WITH_QUALITY=no)
185 if test "x$WITH_QUALITY" = "xyes"; then
186 if test "x$WITH_PINENTRY" != "xyes"; then
187 AC_MSG_ERROR([--enable-quality needs --enable-pinentry])
190 AC_CHECK_HEADER([crack.h],, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
191 AC_CHECK_LIB([crack], FascistCheck,, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
192 AC_DEFINE(WITH_QUALITY, 1, [Define if you want password quality checking.])
194 AM_CONDITIONAL(WITH_QUALITY, [test "x$WITH_QUALITY" = "xyes"])
196 crackdict="/var/cache/cracklib/cracklib_dict"
197 AC_ARG_WITH(crackdict, AC_HELP_STRING([--with-crack-dict=PATH],
198 [Location of the cracklib dictionary (/var/cache/cracklib/cracklib_dict).]),
199 crackdict="$withval")
201 AC_DEFINE_UNQUOTED(CRACKLIB_DICT, ["$crackdict"], [The location of the cracklib dictionary.])
203 AC_CONFIG_FILES([Makefile libpwmd-7.0.pc doc/Makefile doc/doxygen.conf.in \
204 doc/pwmc.1 src/Makefile src/libpwmd.h po/Makefile.in])
208 echo " Memory debug: ${ac_cv_sys_mem_debug}"
209 echo " Pinentry: $WITH_PINENTRY"
210 echo " Pinentry location: $pinentry"
211 echo " Cracklib: $WITH_QUALITY"
212 echo " Cracklib dictionary: $crackdict"
213 echo " Ssh support: $WITH_TCP"
214 echo " Interactive pwmc: ${vl_cv_lib_readline}"