1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(libpwmd, 7.3.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\""
40 LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
41 CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
46 LDFLAGS="$LDFLAGS -lrt"
56 dnl Checks for programs.
59 if test "$ac_cv_prog_cc_c99" = "no"; then
60 AC_MSG_ERROR("Unable to find a C99 compatible compiler.")
63 dnl Borrowed from libssh2!
64 dnl ************************************************************
65 dnl Enable hiding of internal symbols in library to reduce its size and
66 dnl speed dynamic linking of applications. This currently is only supported
67 dnl on gcc >= 4.0 and SunPro C.
69 AC_MSG_CHECKING([whether to enable hidden symbols in the library])
70 AC_ARG_ENABLE(hidden-symbols,
71 AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
72 AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
73 [ case "$enableval" in
78 AC_MSG_CHECKING([whether $CC supports it])
79 if test "$GCC" = yes ; then
80 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
82 AC_DEFINE(LIBPWMD_API, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
83 CFLAGS="$CFLAGS -fvisibility=hidden"
89 dnl Test for SunPro cc
90 if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
92 AC_DEFINE(LIBPWMD_API, [__global], [to make a symbol visible])
93 CFLAGS="$CFLAGS -xldscope=hidden"
103 dnl Checks for header files.
106 AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h sys/socket.h \
109 dnl Checks for typedefs, structures, and compiler characteristics.
116 AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2],
117 [CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"])
118 ACX_PTHREAD(, AC_MSG_ERROR([Missing or incomplete pthread installation]))
119 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
120 LIBS="$PTHREAD_LIBS $LIBS"
123 acx_pthread_cancel_ok=no
124 AC_MSG_CHECKING([for pthread_cancel()])
125 AC_TRY_LINK_FUNC(pthread_cancel, acx_pthread_cancel_ok=yes)
126 AC_MSG_RESULT($acx_pthread_cancel_ok)
127 if test x"$acx_pthread_cancel_ok" = "xyes"; then
128 AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if your OS has pthread_cancel().])
131 AC_ARG_ENABLE(interactive, AC_HELP_STRING([--disable-interactive], [Disable interactive mode in pwmc.]),
132 WITH_INTERACTIVE=no, WITH_INTERACTIVE=yes)
133 AC_MSG_CHECKING([if interactive mode is wanted])
134 AC_MSG_RESULT($WITH_INTERACTIVE)
135 if test "x$WITH_INTERACTIVE" = "xyes"; then
138 if test "x$vl_cv_lib_readline" != "xno"; then
139 READLINE_LIBS="$vl_cv_lib_readline"
140 AC_SUBST(READLINE_LIBS)
142 AC_MSG_ERROR([Missing or incomplete readline installation.])
143 WITH_INTERACTIVE="no"
146 AM_CONDITIONAL([WITH_READLINE], [test x"$vl_cv_lib_readline" != "x"])
148 AM_PATH_LIBASSUAN([2.1.0], have_libassuan_2_1_0=yes)
149 if test x"$have_libassuan_2_1_0" != x"yes";then
150 AM_PATH_LIBASSUAN([2.0.3],, AC_MSG_ERROR([libassuan 2.0.3 or later required.]))
152 AC_DEFINE(LIBASSUAN_2_1_0, 1, [Define if you have libassuan 2.1.0 or later.])
155 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([Missing or incomplete libgpg-error installation.]))
157 AC_ARG_ENABLE(ssh, AC_HELP_STRING([--enable-ssh], [Enable SSH support.]),
158 WITH_SSH=$enableval, WITH_SSH=no)
159 AC_MSG_CHECKING([if ssh support is wanted])
160 AC_MSG_RESULT($WITH_SSH)
161 if test "x$WITH_SSH" = "xyes"; then
162 AC_MSG_CHECKING([for libssh2 availability])
163 PKG_CHECK_EXISTS([libssh2], have_libssh2=1)
166 if test $have_libssh2; then
167 PKG_CHECK_MODULES([libssh2], [libssh2 >= 1.2.9])
168 AC_DEFINE(WITH_SSH, 1, [Define if you want SSH support.])
171 AC_MSG_ERROR([Missing or incomplete libssh2 installation.])
174 AM_CONDITIONAL([WITH_SSH], [test "x$WITH_SSH" = "xyes"])
176 AC_ARG_ENABLE(gnutls, AC_HELP_STRING([--enable-gnutls],
177 [Enable GnuTLS client support.]), WITH_GNUTLS=$enableval,
179 AC_MSG_CHECKING([if gnutls support is wanted])
180 AC_MSG_RESULT($WITH_GNUTLS)
181 if test "x$WITH_GNUTLS" = "xyes"; then
182 AC_MSG_CHECKING([for libgnutls availability])
183 PKG_CHECK_EXISTS(gnutls, have_libgnutls=1, AC_MSG_ERROR([gnutls pkg-config module not found]))
186 if test $have_libgnutls; then
187 PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3.0])
188 AC_DEFINE(WITH_GNUTLS, 1, [Define if you want GnuTLS support.])
191 AC_MSG_ERROR([Missing or incomplete gnutls installation.])
194 AM_CONDITIONAL(WITH_GNUTLS, [test "x$WITH_GNUTLS" = "xyes"])
196 # Default pwmd socket.
197 AC_ARG_WITH(pwmd_socket, AC_HELP_STRING([--with-pwmd-socket=PATH],
198 [Default pwmd socket (~/.pwmd/socket)]),
199 pwmd_socket="$withval", pwmd_socket=)
200 if test x"$pwmd_socket" != "x"; then
201 AC_DEFINE_UNQUOTED(DEFAULT_PWMD_SOCKET, ["$pwmd_socket"],
202 [Default pwmd socket (~/.pwmd/socket).])
204 pwmd_socket="~/.pwmd/socket"
206 AC_SUBST(pwmd_socket)
208 dnl Checks for library functions.
212 AC_FUNC_SELECT_ARGTYPES
213 AC_CHECK_FUNCS([memmove select socket strdup strerror setlocale getcwd \
214 memset stpcpy strchr strrchr strtok_r getopt_long getpwuid_r])
215 AM_CONDITIONAL([NEED_GETOPT_LONG], [test "$ac_cv_func_getopt_long" != "yes"])
217 AC_DEFUN([AC_MEM_DEBUG],
220 ac_cv_sys_mem_debug=$1
223 AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
224 [ac_cv_sys_mem_debug=no])
225 AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
228 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug],
229 [Enable memory debugging.]), AC_MEM_DEBUG([$enableval]),
232 AM_CONDITIONAL(MEM_DEBUG, test "x${ac_cv_sys_mem_debug}" != "xno")
234 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry],
235 [Disable pinentry(1) support (not pwmd).]), WITH_PINENTRY=no,
238 if test "x$WITH_PINENTRY" != "xno"; then
239 AC_CHECK_HEADERS([locale.h])
240 AC_DEFINE(WITH_PINENTRY, 1, [Define if you want local pinentry(1) support.])
243 AM_CONDITIONAL([WITH_PINENTRY], [test "x$WITH_PINENTRY" = "xyes"])
244 pinentry="/usr/bin/pinentry"
246 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
247 [Default location of the pinentry binary (/usr/bin/pinentry)]),
251 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"],
252 [Default location of the pinentry binary.])
254 # Cracklib support (requires pinentry support).
255 AC_ARG_ENABLE(quality, AC_HELP_STRING([--enable-quality],
256 [Enable password quality checking with cracklib.]),
257 WITH_QUALITY=$enableval, WITH_QUALITY=no)
258 if test "x$WITH_QUALITY" = "xyes"; then
259 if test "x$WITH_PINENTRY" != "xyes"; then
260 AC_MSG_ERROR([--enable-quality needs --enable-pinentry])
263 AC_CHECK_HEADER([crack.h],, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
264 AC_CHECK_LIB([crack], FascistCheck,, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
265 AC_DEFINE(WITH_QUALITY, 1, [Define if you want password quality checking.])
267 AM_CONDITIONAL(WITH_QUALITY, [test "x$WITH_QUALITY" = "xyes"])
269 crackdict="/var/cache/cracklib/cracklib_dict"
270 AC_ARG_WITH(crackdict, AC_HELP_STRING([--with-crack-dict=PATH],
271 [Location of the cracklib dictionary (/var/cache/cracklib/cracklib_dict).]),
272 crackdict="$withval")
274 AC_DEFINE_UNQUOTED(CRACKLIB_DICT, ["$crackdict"], [The location of the cracklib dictionary.])
276 dnl Disable optimizing of memset(). GCC and CLang (and others?) accept
277 dnl multiple optimization flags and use the last one specified. The
278 dnl non-optimized memset() may still use any CPU features found in the
279 dnl user specified CFLAGS (-mtune) and libc.
280 CFLAGS_ORIG="$CFLAGS"
281 CFLAGS_MEMZERO="$CFLAGS -O0"
283 AC_SUBST(CFLAGS_ORIG)
284 AC_SUBST(CFLAGS_MEMZERO)
286 AC_CONFIG_FILES([Makefile libpwmd-7.0.pc doc/Makefile doc/doxygen.conf.in \
287 doc/pwmc.1 src/Makefile src/libpwmd.h po/Makefile.in])
291 echo " Interactive pwmc: $WITH_INTERACTIVE"
292 echo " Ssh: $WITH_SSH"
293 echo " GnuTLS: $WITH_GNUTLS"
294 echo " Local pinentry: $WITH_PINENTRY"
295 echo " Pinentry location: $pinentry"
297 if test x"$pwmd_socket" != "x"; then
298 echo " Default pwmd socket: $pwmd_socket"
300 echo " Default pwmd socket: ~/.pwmd/socket"
303 echo " Local passphrase quality checking: $WITH_QUALITY"
304 echo " Crack dictionary: $crackdict"
305 echo " Memory debug: ${ac_cv_sys_mem_debug}"