2009-05-16 Moritz <moritz@gnu.org>
[poldi.git] / configure.ac
index 8222f2a..3f3b384 100644 (file)
@@ -1,5 +1,5 @@
-# configure.ac - for the GSCUTILSGnuPG 1.9
-# Copyright (C) 2004 g10 Code GmbH
+# configure.ac - Configure script for Poldi
+# Copyright (C) 2004, 2005, 2007, 2008 g10 Code GmbH
 # 
 # This file is part of Poldi.
 #
@@ -24,13 +24,17 @@ min_automake_version="1.7.9"
 
 # Version number: Remember to change it immediately *after* a release.
 #                 Add a "-cvs" prefix for non-released code.
-AC_INIT(poldi, 0.2-cvs1, gnupg-devel@gnupg.org)
+AC_INIT(poldi, 0.4.2-cvs, gnupg-devel@gnupg.org)
 
 PACKAGE=$PACKAGE_NAME
 VERSION=$PACKAGE_VERSION
 
 NEED_LIBGCRYPT_VERSION=0
 NEED_GPG_ERROR_VERSION=0.7
+
+NEED_KSBA_API=1
+NEED_KSBA_VERSION=1.0.2
+
        
 AC_CONFIG_SRCDIR(src/pam/pam_poldi.c)
 AM_CONFIG_HEADER(config.h)
@@ -40,26 +44,43 @@ AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
 POLDI_CONF_DIRECTORY="${sysconfdir}/poldi"
 AC_SUBST(POLDI_CONF_DIRECTORY)
 
-PAM_MODULE_DIRECTORY="/lib/security"
+# Implementation of the --with-pam-module-directory switch.
+DEFAULT_PAM_MODULE_DIRECTORY="${libdir}/security"
+AC_ARG_WITH(pam-module-directory,
+           [  --with-pam-module-directory=NAME
+                          Use NAME as installation directory for PAM modules ],
+           PAM_MODULE_DIRECTORY="$withval",
+           PAM_MODULE_DIRECTORY="$DEFAULT_PAM_MODULE_DIRECTORY")
 AC_SUBST(PAM_MODULE_DIRECTORY)
 
 AC_GNU_SOURCE
 
-# Some status variables to give feedback at the end of a configure run
-#have_gpg_error=no
-#have_libgcrypt=no 
+have_gpg_error=no
+have_libgcrypt=no 
+have_ksba=no
 
+POLDI_ENABLE_FEATURE(enable_auth_x509, yes, x509-auth, support for X509 authentication)
+POLDI_ENABLE_FEATURE(enable_auth_localdb, yes, localdb-auth, support for local-db authentication)
 AC_SUBST(PACKAGE)
 AC_SUBST(VERSION)
 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
                                         [Bug report address])
+AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
+                                       [Required version of Libgcrypt])
+AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
+                                       [Required version of Libksba])
+
 
 AH_BOTTOM([
-/* Tell the sources taken from GnuPG's SCD what header file they
-   should use. */
-#define GNUPG_SCD_MAIN_HEADER "scd.h"
+/* Setup the hardwired names of modules. */
+#ifndef GNUPG_DEFAULT_SCD
+#define GNUPG_DEFAULT_SCD    ( GNUPG_BINDIR "/scdaemon" )
+#endif
+#ifndef GNUPG_DEFAULT_DIRMNGR
+#define GNUPG_DEFAULT_DIRMNGR    ( GNUPG_BINDIR "/dirmngr" )
+#endif
 ])
 
 AM_MAINTAINER_MODE
@@ -75,6 +96,7 @@ AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
 AC_PROG_AWK
 AC_PROG_CC
+AM_PROG_CC_C_O
 AC_PROG_CPP
 AC_PROG_RANLIB
 AC_PROG_INSTALL
@@ -85,26 +107,14 @@ AC_SYS_LARGEFILE
 # Checks for libraries.
 #
 
-have_libgcrypt=no
 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_VERSION",
                   have_libgcrypt=yes,have_libgcrypt=no)
-
-have_gpg_error=no
 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
                   have_gpg_error=yes,have_gpg_error=no)
+AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
 
-
-#
-# libusb allows us to use the integrated CCID smartcard reader driver.
-#
-LIBUSB_LIBS=""
-AC_CHECK_LIB(usb, usb_bulk_write,
-             [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
-               AC_DEFINE(HAVE_LIBUSB,1,
-               [defined if libusb is available])
-             ])
-AC_SUBST(LIBUSB_LIBS)
-AC_CHECK_FUNCS(usb_get_busses memicmp stpcpy strlwr strtoul memmove stricmp)
+AC_CHECK_FUNCS(stpcpy strtoul)
+AC_CHECK_FUNCS(fopencookie funopen nanosleep)
 
 # Checks for header files.
 AC_HEADER_STDC
@@ -114,37 +124,13 @@ AC_C_CONST
 AC_C_INLINE
 AC_TYPE_SIZE_T
 
-# Necessary for libscd.
-GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
-GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
-GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
-GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
-GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
-
 AC_CHECK_SIZEOF(unsigned short)
 AC_CHECK_SIZEOF(unsigned int)
 AC_CHECK_SIZEOF(unsigned long)
 
 # Checks for library functions.
 
-#
-# See whether we have dlopen available, so that PC/SC can be loaded on
-# demand.
-#
-_dl_save_libs=$LIBS
-LIBS=""
-AC_SEARCH_LIBS(dlopen,dl,found_dlopen=yes)
-if test x"$found_dlopen" = "xyes" ; then
-   AC_DEFINE(HAVE_DL_DLOPEN,1,
-             [Defined when the dlopen function family is available])
-   DLLIBS=$LIBS
-else
-   DLLIBS=""
-   LIBS=$_dl_save_libs
-fi
-AC_SUBST(DLLIBS)
-
+# FIXME: what is this for?? -moritz
 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
 
 if test "$GCC" = yes; then
@@ -156,9 +142,50 @@ if test "$GCC" = yes; then
     fi
 fi
 
-# We use jnlib, so tell other modules about it
-AC_DEFINE(HAVE_JNLIB_LOGGING, 1,
-         [Defined if jnlib style logging fucntions are available])
+#
+# Taken from libassuan source package
+#
+
+AC_CHECK_HEADERS([string.h locale.h sys/uio.h])
+AC_TYPE_SIGNAL
+#AC_DEFINE(USE_DESCRIPTOR_PASSING, 0, [We do not need this feature])
+AC_REPLACE_FUNCS(setenv)
+# Check for funopen
+AC_CHECK_FUNCS(funopen)
+if test $ac_cv_func_funopen != yes; then
+    # No funopen but we can implement that in terms of fopencookie.
+    AC_CHECK_FUNCS(fopencookie)
+    if test $ac_cv_func_fopencookie = yes; then
+        AC_LIBOBJ([funopen])
+    else
+        AC_MSG_WARN([
+***
+*** No implementation of fopencookie or funopen available.
+*** The assuan_get_data_fp feature won't work.
+***])
+    fi
+fi
+
+# Native language support:
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION(0.17)
+
+#
+# Decide what to build
+#
+
+if test $have_ksba = no; then
+  enable_auth_x509=no
+fi
+AM_CONDITIONAL(AUTH_METHOD_X509, test "$enable_auth_x509" = "yes")
+AM_CONDITIONAL(AUTH_METHOD_LOCALDB, test "$enable_auth_localdb" = "yes")
+
+if test "$enable_auth_x509" = "yes"; then
+   AC_DEFINE(ENABLE_AUTH_METHOD_X509, 1, [Enable X509 authentication method])
+fi
+if test "$enable_auth_localdb" = "yes"; then
+   AC_DEFINE(ENABLE_AUTH_METHOD_LOCALDB, 1, [Enable local-db authentication method])
+fi
 
 #
 # Print errors here so that they are visible all
@@ -185,6 +212,15 @@ if test "$have_libgcrypt" = "no"; then
 *** (at least version $NEED_LIBGCRYPT_VERSION is required.)
 ***]])
 fi
+if test "$have_ksba" = "no"; then
+   AC_MSG_NOTICE([[
+***
+*** libksba not found, building with X.509 authentication support.
+*** libksba can be retrieved from:
+***   URL FIXME
+*** (at least version $NEED_KSBA_VERSION (API $NEED_KSBA_API) is required).
+***]])
+fi
 if test "$die" = "yes"; then
     AC_MSG_ERROR([[
 ***
@@ -194,11 +230,47 @@ if test "$die" = "yes"; then
 fi
 
 AC_CONFIG_FILES([Makefile
-                doc/Makefile
+                po/Makefile.in
+                m4/Makefile
+                am/Makefile
                 src/Makefile
-                src/jnlib/Makefile
-                src/libscd/Makefile
-                src/common/Makefile
+                src/assuan/Makefile
+                src/util/Makefile
+                src/scd/Makefile
+                src/ctrl/Makefile
                 src/pam/Makefile
-                src/ctrl/Makefile])
+                src/pam/auth-support/Makefile
+                src/pam/auth-method-localdb/Makefile
+                src/pam/auth-method-x509/Makefile
+                doc/Makefile
+                tests/Makefile
+                tools/Makefile
+                conf/Makefile])
 AC_OUTPUT
+
+if test "$PAM_MODULE_DIRECTORY" = "$DEFAULT_PAM_MODULE_DIRECTORY"; then
+   AC_MSG_WARN([
+**
+** Warning: using default value ($DEFAULT_PAM_MODULE_DIRECTORY) as
+**          installation directory for PAM module; this is probably not
+**          what you want. Either use the configure flag
+**
+**                      --with-pam-module-directory=DIRECTORY
+**
+**          or copy the newly built pam_poldi.so into the correct directory
+**          manually. Usually PAM modules are located in /lib/security.
+**])
+else
+  AC_MSG_NOTICE([PAM module installation directory: $PAM_MODULE_DIRECTORY])
+fi
+
+echo "
+        Poldi v${VERSION} has been configured as follows:
+
+        installation directory for PAM module: $PAM_MODULE_DIRECTORY
+       configuration directory:               $POLDI_CONF_DIRECTORY
+        
+             X509 authentication: $enable_auth_x509
+         local-db authentication: $enable_auth_localdb
+
+"