Imported Upstream version 0.66.1
[hcoop/debian/courier-authlib.git] / configure.ac
similarity index 89%
rename from configure.in
rename to configure.ac
index 5ff71cd..4e46866 100644 (file)
@@ -1,18 +1,16 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl
-dnl $Id: configure.in,v 1.177 2009/12/25 21:53:37 mrsam Exp $
 dnl
-dnl Copyright 1998 - 2009 Double Precision, Inc.  See COPYING for
+dnl Copyright 1998 - 2013 Double Precision, Inc.  See COPYING for
 dnl distribution information.
 
 AC_PREREQ(2.63)
-AC_INIT([courier-authlib],[0.63.0],[courier-users@lists.sourceforge.net])
+AC_INIT([courier-authlib],[0.66.1],[courier-users@lists.sourceforge.net])
 
 AC_CONFIG_SRCDIR([courierauth.h])
-AC_CONFIG_HEADERS([courier_auth_config.h])
-AC_CONFIG_MACRO_DIR([libltdl/m4])
 
 AM_INIT_AUTOMAKE
+AM_CONFIG_HEADER([courier_auth_config.h])
 >confdefs.h  # Kill PACKAGE_ macros
 
 LPATH="$PATH:/usr/local/bin"
@@ -24,7 +22,6 @@ AC_PROG_CPP
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_SYSCONFTOOL
-LT_CONFIG_LTDL_DIR([libltdl])
 LT_INIT(dlopen)
 LTDL_INIT
 AC_SUBST(LTDLINCL)
@@ -32,6 +29,9 @@ AC_SUBST(LIBLTDL)
 AC_PATH_PROGS(PERL, perl5 perl, perl, $LPATH)
 AC_PATH_PROGS(COURIERCONFIG, courier-config, courier-config, $LPATH)
 
+AC_CHECK_HEADER(ltdl.h, [ : ],
+                       AC_MSG_ERROR([Unable to find ltdl.h. Please install Libtool's ltdl library]))
+
 if test "$PERL" = "perl"
 then
        AC_MSG_ERROR(Perl is required)
@@ -46,43 +46,9 @@ eval "bindir=$bindir"
 eval "sbindir=$sbindir"
 eval "localstatedir=$localstatedir"
 eval "libexecdir=$libexecdir"
+eval "datarootdir=$datarootdir"
+eval "datedir=$datadir"
 
-AC_ARG_WITH(redhat, [], [ redhat=$withval ], [redhat=no])
-
-if test "$srcdir" = "."
-then
-       case `./config.guess` in
-       *-redhat-*)
-               if test "$redhat" = "no"
-               then
-                       hash='#'
-                       AC_MSG_WARN(=== I think you are trying to run this configure script)
-                       AC_MSG_WARN([=== on Red Hat/Fedora.  You're doing too much work!])
-                       AC_MSG_WARN([=== It's much faster to create installable binary RPMs])
-                       AC_MSG_WARN([=== like this: http://www.courier-mta.org/FAQ.html${hash}rpm])
-                       AC_MSG_WARN(=== When you do this you may find that RPM will tell you)
-                       AC_MSG_WARN([=== to install some other software first, before trying to])
-                       AC_MSG_WARN([=== build this one, and even tell you the name of RPMs you])
-                       AC_MSG_WARN([=== need to install from the distribution CD.  That's much])
-                       AC_MSG_WARN([=== easier than trying to figure out the same from some])
-                       AC_MSG_WARN([=== cryptic error message.])
-                       AC_MSG_WARN([])
-                       AC_MSG_WARN([=== Even if you don't intend to use everything you need to])
-                       AC_MSG_WARN([=== have in order to build via RPM, you should still do as])
-                       AC_MSG_WARN([=== you're told.  All the extra stuff (LDAP, SQL, etc...)])
-                       AC_MSG_WARN([=== goes into RPM sub-packages, which do not need to be])
-                       AC_MSG_WARN([=== installed.])
-                       AC_MSG_WARN([=== But, if you insist, you can simply add '--with-redhat'])
-                       AC_MSG_WARN(=== parameter to this configure script and not see this)
-                       AC_MSG_WARN(=== error message.  You should also do this when upgrading)
-                       AC_MSG_WARN([=== and you didn't use RPM with the older version.])
-                       AC_MSG_ERROR(... in either case you better know what you're doing!)
-               fi
-               ;;
-       *)
-               ;;
-       esac
-fi
 AC_PATH_PROGS(EXPECT, expect, expect, $LPATH)
 
 if test "$EXPECT" = "expect"
@@ -104,7 +70,7 @@ then
        CFLAGS="$CFLAGS -Wall"
 fi
 
-CFLAGS="$CFLAGS -I.. -I${srcdir}/.."
+CFLAGS="$CFLAGS -Ilibs -I${srcdir}/libs"
 
 AC_MSG_CHECKING(whether -lm is needed for floor)
 AC_TRY_LINK_FUNC(floor,
@@ -222,7 +188,7 @@ then
        then
                ac_configure_args="$ac_configure_args --with-db=gdbm"
        fi
-       dblibrary=gdbmobj/libgdbmobj.la
+       dblibrary=libs/gdbmobj/libgdbmobj.la
 else
        LIBGDBM=""
        USE_DB=1
@@ -230,7 +196,7 @@ else
        then
                ac_configure_args="$ac_configure_args --with-db=db"
        fi
-       dblibrary=bdbobj/libbdbobj.la
+       dblibrary=libs/bdbobj/libbdbobj.la
 fi
 
 AC_SUBST(USE_GDBM)
@@ -358,7 +324,7 @@ else
        LDAPLIBS=""
 
         AC_MSG_CHECKING(whether -lresolv is needed for res_query)
-       AC_LINK_IFELSE(AC_LANG_PROGRAM([
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([
 #include <sys/types.h>
 #if HAVE_NETINET_IN_H
 #include <netinet/in.h>
@@ -367,12 +333,12 @@ else
 
 void (*func)()= (void (*)())res_query;
 ],
-                       [  (*func)(); ]),
+                       [  (*func)(); ])],
                AC_MSG_RESULT(no),
                [
                LIBS="-lresolv $LIBS"
 
-               AC_LINK_IFELSE(AC_LANG_PROGRAM([
+               AC_LINK_IFELSE([AC_LANG_PROGRAM([
 #include <sys/types.h>
 #if HAVE_NETINET_IN_H
 #include <netinet/in.h>
@@ -381,7 +347,7 @@ void (*func)()= (void (*)())res_query;
 
 void (*func)()= (void (*)())res_query;
 ],
-                       [  (*func)(); ]), [
+                       [  (*func)(); ])], [
                        LDAPLIBS="-lresolv $LDAPLIBS"
                        HAVE_LDAP=1
                        AC_MSG_RESULT(yes)
@@ -631,6 +597,66 @@ AC_SUBST(LIBAUTHMYSQL)
 AC_SUBST(MYSQL_LIBS)
 AM_CONDITIONAL(HAVE_AUTHMYSQL, test "$HAVE_AUTHMYSQL" = 1)
 
+dnl #########################################################################
+
+dnl Prepare authsqlite module
+
+dnl #########################################################################
+
+AC_ARG_WITH(authsqliterc,
+[ --with-authsqliterc=filename        Expect to find authmysql here ],
+       authsqliterc="$withval",
+       authsqliterc="$pkgconfdir/authsqliterc")
+AC_SUBST(authsqliterc)
+
+AC_ARG_WITH(authsqlite,
+[ --without-authsqlite               Do not include the authsqlite module ],
+        doauthsqlite="$withval")
+
+AC_ARG_WITH(sqlite-libs,
+[ --with-sqlite-libs=DIR               Look for sqlite libs in this dir ],
+        
+       SQLITE_LIBS="-lsqlite3"
+)
+AC_ARG_WITH(sqlite-includes,
+[ --with-sqlite-includes=DIR   Look for sqlite includes in this dir ],
+       SQLITE_CFLAGS="-I$withval"
+)
+
+if test "$doauthsqlite" = ""
+then
+       SQLITE_CFLAGS="`pkg-config --cflags sqlite3 2>/dev/null`"
+       SQLITE_LIBS="`pkg-config --libs sqlite3 2>/dev/null`"
+        saveLIBS="$LIBS"
+       LIBS="$SQLITE_LIBS $LIBS"
+       AC_CHECK_FUNC(sqlite3_version,
+               doauthsqlite="yes"
+               )
+       LIBS="$saveLIBS"
+fi
+
+if test "$doauthsqlite" != "yes"
+then
+       SQLITE_LIBS=""
+       SQLITE_CFLAGS=""
+       HAVE_AUTHSQLITE=0
+       LIBAUTHSQLITE=""
+else
+       saveLIBS="$LIBS"
+       LIBS="$SQLITE_LIBS $LIBS"
+       AC_CHECK_FUNC(sqlite3_version,
+               [ : ],
+               [ AC_MSG_ERROR([Cannot link with $SQLITE_LIBS]) ]
+               )
+       LIBS="$saveLIBS"
+       HAVE_AUTHSQLITE=1
+       CFLAGS="$SQLITE_CFLAGS $CFLAGS"
+       LIBAUTHSQLITE="libauthsqlite.la"
+
+fi
+AC_SUBST(SQLITE_LIBS)
+AC_SUBST(LIBAUTHSQLITE)
+AM_CONDITIONAL(HAVE_AUTHSQLITE, test "$HAVE_AUTHSQLITE" = 1)
 
 dnl #########################################################################
 
@@ -884,7 +910,7 @@ AC_ARG_WITH(stdheaderdir,
 AC_CACHE_CHECK([for socklen_t],
        authlib_cv_hassocklen_t,
  
-AC_COMPILE_IFELSE(
+AC_COMPILE_IFELSE([
 AC_LANG_SOURCE( [
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -892,7 +918,7 @@ AC_LANG_SOURCE( [
 socklen_t sl_t;
 ],[
        accept(0, 0, &sl_t);
-]),
+])],
        authlib_cv_hassocklen_t=yes,
        authlib_cv_hassocklen_t=no)
 )
@@ -909,9 +935,9 @@ fi
 AC_ARG_WITH(repository, [], REPOSITORY="$withval")
 AC_SUBST(REPOSITORY)
 
-AM_CONDITIONAL(HAVE_SGML, test -d ${srcdir}/docbook)
-AC_CONFIG_SUBDIRS(bdbobj gdbmobj md5 sha1 libhmac numlib makedat userdb unicode rfc822 random128 liblock liblog)
+AM_CONDITIONAL(HAVE_SGML, test -d ${srcdir}/libs/docbook)
+AC_CONFIG_SUBDIRS(libs/bdbobj libs/gdbmobj libs/md5 libs/sha1 libs/libhmac libs/numlib libs/makedat userdb libs/unicode libs/rfc822 libs/random128 libs/liblock liblog)
 
-AC_CONFIG_FILES(Makefile authdaemond authdaemonrc authsystem.passwd README.authdebug.html dbobj.config dbobj.h authmigrate courier-authlib.spec courier-authlib.lpspec courier-authlib.sysvinit userdb-test-cram-md5.pl)
+AC_CONFIG_FILES(Makefile authdaemond authdaemonrc authsystem.passwd README.authdebug.html dbobj.config dbobj.h authmigrate courier-authlib.spec courier-authlib.lpspec courier-authlib.sysvinit courier-authlib.service userdb-test-cram-md5.pl)
 AC_OUTPUT