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]))
106 AC_ARG_ENABLE(interactive, AC_HELP_STRING([--disable-interactive], [Disable interactive mode in pwmc.]),
107 WITH_INTERACTIVE=no, WITH_INTERACTIVE=yes)
108 AC_MSG_CHECKING([if interactive mode is wanted])
109 AC_MSG_RESULT($WITH_INTERACTIVE)
110 if test "x$WITH_INTERACTIVE" = "xyes"; then
113 if test "x$ax_cv_lib_readline" != "xno"; then
114 READLINE_LIBS="$ax_cv_lib_readline"
115 AC_SUBST(READLINE_LIBS)
117 WITH_INTERACTIVE="no"
120 AM_CONDITIONAL([WITH_READLINE], [test "x$ax_cv_lib_readline" != "xno"])
122 AM_PATH_LIBASSUAN([2.0.0],, AC_MSG_ERROR([libassuan not found]))
123 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([Missing or incomplete libgpg-error installation.]))
125 AC_ARG_ENABLE(ssh, AC_HELP_STRING([--disable-ssh], [Disable SSH support.]),
126 WITH_TCP=no, WITH_TCP=yes)
128 AC_MSG_CHECKING([if ssh support is wanted])
129 AC_MSG_RESULT($WITH_TCP)
131 if test "x$WITH_TCP" = "xyes"; then
132 AC_MSG_CHECKING([for libssh2 availability])
133 PKG_CHECK_EXISTS([libssh2], have_libssh2=1)
136 if test $have_libssh2; then
137 PKG_CHECK_MODULES([libssh2], [libssh2 >= 1.2.8])
138 AC_DEFINE(WITH_TCP, 1, [Define if you want TCP support.])
142 AM_CONDITIONAL([WITH_TCP], [test "x$WITH_TCP" = "xyes"])
144 dnl Checks for library functions.
148 AC_FUNC_SELECT_ARGTYPES
149 AC_CHECK_FUNCS([memmove select socket strdup strerror setlocale getcwd \
150 memset stpcpy strchr strrchr strtok_r getopt_long getpwuid_r])
151 AM_CONDITIONAL([NEED_GETOPT_LONG], [test "$ac_cv_func_getopt_long" != "yes"])
153 AC_DEFUN([AC_MEM_DEBUG],
156 ac_cv_sys_mem_debug=$1
159 AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
160 [ac_cv_sys_mem_debug=no])
161 AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
164 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug],
165 [Enable memory debugging.]), AC_MEM_DEBUG([$enableval]),
168 AM_CONDITIONAL(MEM_DEBUG, test "x${ac_cv_sys_mem_debug}" != "xno")
170 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry],
171 [Disable pinentry(1) support (not pwmd).]), WITH_PINENTRY=no,
174 if test "x$WITH_PINENTRY" != "xno"; then
175 AC_CHECK_HEADERS([locale.h])
176 AC_DEFINE(WITH_PINENTRY, 1, [Define if you want local pinentry(1) support.])
179 AM_CONDITIONAL([WITH_PINENTRY], [test "x$WITH_PINENTRY" = "xyes"])
180 pinentry="/usr/bin/pinentry"
182 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
183 [Default location of the pinentry binary (/usr/bin/pinentry)]),
187 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"],
188 [Default location of the pinentry binary.])
190 # Cracklib support (requires pinentry support).
191 AC_ARG_ENABLE(quality, AC_HELP_STRING([--enable-quality],
192 [Enable password quality checking with cracklib.]),
193 WITH_QUALITY=$enableval, WITH_QUALITY=no)
194 if test "x$WITH_QUALITY" = "xyes"; then
195 if test "x$WITH_PINENTRY" != "xyes"; then
196 AC_MSG_ERROR([--enable-quality needs --enable-pinentry])
199 AC_CHECK_HEADER([crack.h],, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
200 AC_CHECK_LIB([crack], FascistCheck,, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
201 AC_DEFINE(WITH_QUALITY, 1, [Define if you want password quality checking.])
203 AM_CONDITIONAL(WITH_QUALITY, [test "x$WITH_QUALITY" = "xyes"])
205 crackdict="/var/cache/cracklib/cracklib_dict"
206 AC_ARG_WITH(crackdict, AC_HELP_STRING([--with-crack-dict=PATH],
207 [Location of the cracklib dictionary (/var/cache/cracklib/cracklib_dict).]),
208 crackdict="$withval")
210 AC_DEFINE_UNQUOTED(CRACKLIB_DICT, ["$crackdict"], [The location of the cracklib dictionary.])
212 AC_CONFIG_FILES([Makefile libpwmd-7.0.pc doc/Makefile doc/doxygen.conf.in \
213 doc/pwmc.1 src/Makefile src/libpwmd.h po/Makefile.in])
217 echo " Memory debug: ${ac_cv_sys_mem_debug}"
218 echo " Pinentry: $WITH_PINENTRY"
219 echo " Pinentry location: $pinentry"
220 echo " Cracklib: $WITH_QUALITY"
221 echo " Cracklib dictionary: $crackdict"
222 echo " Ssh support: $WITH_TCP"
223 echo " Interactive pwmc: $WITH_INTERACTIVE"