pwmc: added --interactive.
[libpwmd.git] / configure.ac
blobcd3d2205313600ea060e0dbfe61e02ab67657188
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.60)
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)
6 AC_CANONICAL_TARGET
7 AM_INIT_AUTOMAKE([foreign])
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])
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/'`"
21 AC_SUBST(VER_MAJOR)
22 AC_SUBST(VER_MINOR)
23 AC_SUBST(VER_PATCH)
24 VER_STRING="\"$VERSION\""
25 AC_SUBST(VER_STRING)
27 case "$target_os" in
28     darwin*)
29         LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
30         CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
31         ;;
32     linux*)
33         case "$target_cpu" in
34             x86_64*)
35                 LDFLAGS="$LDFLAGS -lrt"
36                 ;;
37             *)
38                 ;;
39         esac
40         ;;
41     *)
42         ;;
43 esac
45 dnl Checks for programs.
46 AC_PROG_CC_C99
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.
57 dnl
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
63   no)
64        AC_MSG_RESULT(no)
65        ;;
66   *)
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
70            AC_MSG_RESULT(yes)
71            AC_DEFINE(LIBPWMD_API, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
72            CFLAGS="$CFLAGS -fvisibility=hidden"
73          else
74             AC_MSG_RESULT(no)
75           fi
77        else
78          dnl Test for SunPro cc
79          if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
80            AC_MSG_RESULT(yes)
81            AC_DEFINE(LIBPWMD_API, [__global], [to make a symbol visible])
82            CFLAGS="$CFLAGS -xldscope=hidden"
83          else
84            AC_MSG_RESULT(no)
85          fi
86        fi
87        ;;
88   esac ],
89        AC_MSG_RESULT(no)
92 dnl Checks for header files.
93 AC_HEADER_STDC
94 AC_HEADER_SYS_WAIT
95 AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h sys/socket.h \
96                   getopt.h])
98 dnl Checks for typedefs, structures, and compiler characteristics.
99 AC_C_CONST
100 AC_TYPE_SIZE_T
101 AC_STRUCT_TM
102 AC_TYPE_SSIZE_T
103 AC_TYPE_PID_T
105 AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([Missing or incomplete libgpg-error installation.]))
106 AC_CHECK_PTH(, no, yes, no, have_libpth=yes, have_libpth=no)
107 AM_CONDITIONAL([WITH_LIBPTH], [test "x$have_libpth" = "xyes"])
109 AC_ARG_ENABLE(ssh, AC_HELP_STRING([--enable-ssh], [Enable SSH support.]),
110                 WITH_TCP=yes, WITH_TCP=no)
112 if test "x$WITH_TCP" = "xyes"; then
113     PKG_CHECK_EXISTS([libssh2], have_libssh2=1,
114                     AC_MSG_ERROR([Could not find libssh2 pkg-config module.]))
115     PKG_CHECK_MODULES([libssh2], [libssh2 >= 1.2.6])
116     PKG_CHECK_MODULES(libcares, libcares,,
117                       AC_MSG_ERROR([Missing or incomplete libcares installation.]))
118     AC_DEFINE(WITH_TCP, 1, [Define if you want TCP support.])
121 AM_CONDITIONAL([WITH_TCP], [test "x$WITH_TCP" = "xyes"])
123 ACX_PTHREAD(, AC_MSG_ERROR([Missing or incomplete pthread installation]))
124 AC_SUBST(PTHREAD_LIBS)
125 AC_SUBST(PTHREAD_CFLAGS)
126 AC_SUBST(PTHREAD_CC)
128 VL_LIB_READLINE()
130 dnl Checks for library functions.
131 AC_FUNC_MALLOC
132 AC_FUNC_REALLOC
133 AC_FUNC_STRFTIME
134 AC_FUNC_SELECT_ARGTYPES
135 AC_CHECK_FUNCS([memmove select socket strdup strerror setlocale getcwd \
136                 memset stpcpy strchr strrchr strtok_r getopt_long])
137 AM_CONDITIONAL([NEED_GETOPT_LONG], [test "$ac_cv_func_getopt_long" != "yes"])
139 AC_DEFUN([AC_MEM_DEBUG],
141     if test "$1"; then
142         ac_cv_sys_mem_debug=$1
143     fi
145     AC_CACHE_CHECK([if memory debugging is wanted], [ac_cv_sys_mem_debug],
146         [ac_cv_sys_mem_debug=no])
147     AM_CONDITIONAL([WITH_MEM_DEBUG], [test "$ac_cv_sys_mem_debug" = "yes"])
150 AC_ARG_ENABLE(mem_debug, AC_HELP_STRING([--enable-mem-debug],
151               [Enable memory debugging.]), AC_MEM_DEBUG([$enableval]),
152               AC_MEM_DEBUG)
154 AM_CONDITIONAL(MEM_DEBUG, test "x${ac_cv_sys_mem_debug}" != "xno")
156 AC_ARG_ENABLE(pinentry, AC_HELP_STRING([--disable-pinentry], 
157               [Disable pinentry(1) support (not pwmd).]), WITH_PINENTRY=no,
158               WITH_PINENTRY=yes)
160 if test "x$WITH_PINENTRY" != "xno"; then
161     AC_CHECK_HEADERS([locale.h])
162     AC_DEFINE(WITH_PINENTRY, 1, [Define if you want local pinentry(1) support.])
165 AM_CONDITIONAL([WITH_PINENTRY], [test "x$WITH_PINENTRY" = "xyes"])
166 pinentry="/usr/bin/pinentry"
168 AC_ARG_WITH(pinentry, AC_HELP_STRING([--with-pinentry=PATH],
169               [Default location of the pinentry binary (/usr/bin/pinentry)]),
170               pinentry="$withval")
172 AC_SUBST(pinentry)
173 AC_DEFINE_UNQUOTED(PINENTRY_PATH, ["$pinentry"],
174                    [Default location of the pinentry binary.])
176 # Cracklib support (requires pinentry support).
177 AC_ARG_ENABLE(quality, AC_HELP_STRING([--enable-quality], 
178               [Enable password quality checking with cracklib.]),
179               WITH_QUALITY=$enableval, WITH_QUALITY=no)
180 if test "x$WITH_QUALITY" = "xyes"; then
181     if test "x$WITH_PINENTRY" != "xyes"; then
182         AC_MSG_ERROR([--enable-quality needs --enable-pinentry])
183     fi
185     AC_CHECK_HEADER([crack.h],, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
186     AC_CHECK_LIB([crack], FascistCheck,, AC_MSG_ERROR([Missing or invalid cracklib installation.]))
187     AC_DEFINE(WITH_QUALITY, 1, [Define if you want password quality checking.])
189 AM_CONDITIONAL(WITH_QUALITY, [test "x$WITH_QUALITY" = "xyes"])
191 crackdict="/var/cache/cracklib/cracklib_dict"
192 AC_ARG_WITH(crackdict, AC_HELP_STRING([--with-crack-dict=PATH],
193               [Location of the cracklib dictionary (/var/cache/cracklib/cracklib_dict).]),
194               crackdict="$withval")
195 AC_SUBST(crackdict)
196 AC_DEFINE_UNQUOTED(CRACKLIB_DICT, ["$crackdict"], [The location of the cracklib dictionary.])
198 AC_CONFIG_FILES([Makefile libpwmd.pc libpwmd-pth.pc doc/Makefile \
199                  doc/doxygen.conf.in doc/pwmc.1 src/Makefile \
200                  src/libpwmd.h po/Makefile.in])
201 AC_OUTPUT
202 echo
203 echo "Features:"
204 echo "    Memory debug: ${ac_cv_sys_mem_debug}"
205 echo "    Pinentry: $WITH_PINENTRY"
206 echo "    Pinentry location: $pinentry"
207 echo "    Cracklib: $WITH_QUALITY"
208 echo "    Cracklib dictionary: $crackdict"
209 echo "    Ssh support: $WITH_TCP"
210 echo "    libpth support: $have_libpth"