Utilize SSH server keepalive responses.
[libpwmd.git] / configure.ac
blob20c637e2714f184dbcf99a1864e9203f78ce5779
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.60)
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)
6 AC_CANONICAL_TARGET
7 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
8 AC_PROG_MAKE_SET
9 #AC_DISABLE_SHARED
10 AC_USE_SYSTEM_EXTENSIONS
11 AC_PROG_LIBTOOL
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/'`"
20 AC_SUBST(VER_MAJOR)
21 AC_SUBST(VER_MINOR)
22 AC_SUBST(VER_PATCH)
23 VER_STRING="\"$VERSION\""
24 AC_SUBST(VER_STRING)
26 case "$target_os" in
27     darwin*)
28         LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
29         CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
30         ;;
31     linux*)
32         case "$target_cpu" in
33             x86_64*)
34                 LDFLAGS="$LDFLAGS -lrt"
35                 ;;
36             *)
37                 ;;
38         esac
39         ;;
40     *)
41         ;;
42 esac
44 dnl Checks for programs.
45 AC_PROG_CC_C99
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.
56 dnl
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
62   no)
63        AC_MSG_RESULT(no)
64        ;;
65   *)
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
69            AC_MSG_RESULT(yes)
70            AC_DEFINE(LIBPWMD_API, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
71            CFLAGS="$CFLAGS -fvisibility=hidden"
72          else
73             AC_MSG_RESULT(no)
74           fi
76        else
77          dnl Test for SunPro cc
78          if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
79            AC_MSG_RESULT(yes)
80            AC_DEFINE(LIBPWMD_API, [__global], [to make a symbol visible])
81            CFLAGS="$CFLAGS -xldscope=hidden"
82          else
83            AC_MSG_RESULT(no)
84          fi
85        fi
86        ;;
87   esac ],
88        AC_MSG_RESULT(no)
91 dnl Checks for header files.
92 AC_HEADER_STDC
93 AC_HEADER_SYS_WAIT
94 AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h sys/socket.h \
95                   getopt.h])
97 dnl Checks for typedefs, structures, and compiler characteristics.
98 AC_C_CONST
99 AC_TYPE_SIZE_T
100 AC_STRUCT_TM
101 AC_TYPE_SSIZE_T
102 AC_TYPE_PID_T
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
111     AX_LIB_READLINE
113     if test "x$ax_cv_lib_readline" != "xno"; then
114         READLINE_LIBS="$ax_cv_lib_readline"
115         AC_SUBST(READLINE_LIBS)
116     else
117         WITH_INTERACTIVE="no"
118     fi
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)
134     WITH_TCP=no
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.])
139         WITH_TCP=yes
140     fi
142 AM_CONDITIONAL([WITH_TCP], [test "x$WITH_TCP" = "xyes"])
144 dnl Checks for library functions.
145 AC_FUNC_MALLOC
146 AC_FUNC_REALLOC
147 AC_FUNC_STRFTIME
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],
155     if test "$1"; then
156         ac_cv_sys_mem_debug=$1
157     fi
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]),
166               AC_MEM_DEBUG)
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,
172               WITH_PINENTRY=yes)
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)]),
184               pinentry="$withval")
186 AC_SUBST(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])
197     fi
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")
209 AC_SUBST(crackdict)
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])
214 AC_OUTPUT
215 echo
216 echo "Features:"
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"