dnl ------------------------------------------------------- dnl - configure.ac for POP3Lite dnl - Copyright (C) 2000, 2001 Gergely Nagy <8@free.bsd.hu> dnl - $Id: configure.ac,v 1.6.2.12 2001/08/24 13:09:31 algernon Exp $ dnl ------------------------------------------------------- dnl Process this file with autoconf to produce a configure script. dnl dnl This file is part of POP3Lite. dnl dnl POP3Lite is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl POP3Lite is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA dnl ********************** dnl * Boilerplate dnl ********************** AC_PREREQ(2.49d) AC_REVISION($Revision: 1.6.2.12 $) AC_INIT([pop3lite], [0.2.4a], [pop3lite-devel@lists.sourceforge.net]) AC_CONFIG_SRCDIR(src/main.c) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST AC_SUBST(host_os) VERSION="$PACKAGE_VERSION" AM_INIT_AUTOMAKE(pop3lite,$VERSION) AC_MSG_CHECKING(distribution version) if test "x`echo $VERSION | sed -e 's/^[[0-9]]*\.\([[0-9]]*\)\..*/\1/' -e 's/.*[[13579]]$//'`" = "x" then EXTRA_VERSION="-devel" else EXTRA_VERSION="-stable" fi CVS_REVISION="`grep '\$''Revision: ' ${srcdir}/ChangeLog | sed -e 's%.*\$''Revision: \([[^ ]]*\) \\\$.*%(\1)%g'`" AC_DEFINE_UNQUOTED(EXTRA_VERSION,"$EXTRA_VERSION $CVS_REVISION", extra version information) AC_DEFINE_UNQUOTED(__MACHINE__,"$host", machine which POP3Lite was compiled for) AC_SUBST(EXTRA_VERSION) AC_SUBST(CVS_REVISION) AC_MSG_RESULT($VERSION$EXTRA_VERSION $CVS_REVISION [[[$host]]]) AM_ACLOCAL_INCLUDE(macros) AM_MAINTAINER_MODE dnl ********************** dnl * Command-line dnl ********************** dnl ------------------- dnl - Layout dnl ------------------- AC_MSG_CHECKING(which layout to use) AC_ARG_WITH(layout, [ --with-layout=[LAYOUT] use a different layout for installation], [layout="$withval"],[layout=default]) case "$layout" in yes|no|default) elayout=default ;; *) if test -f $srcdir/layouts/$layout; then elayout=$layout . $srcdir/layouts/$layout else elayout=unknown fi ;; esac AC_MSG_RESULT($elayout) if test "x$elayout" = "xunknown" then AC_MSG_ERROR(*** Unknown layout: $layout) fi dnl ------------------- dnl - Debugging dnl ------------------- AC_MSG_CHECKING(whether to enable debugging) AC_ARG_ENABLE(debugging, [ --enable-debugging build with extra debugging messages], [if test "x$enableval" != "xno"; then AC_DEFINE_UNQUOTED(DEBUG, 1, Define this to enable debugging messages) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi],[AC_MSG_RESULT(no)]) dnl ------------------- dnl - Features dnl ------------------- AC_ARG_ENABLE(standalone, [ --disable-standalone disable standalone mode], [standalone="$enableval"],[standalone="yes"]) if test "x$standalone" != "xno" then AC_DEFINE_UNQUOTED(WITH_STANDALONE_SUPPORT, 1, Define this to have support for inetd-less mode) fi AC_ARG_WITH(service-name, [ --with-service-name new service name for PAM/SASL (default: pop3lite)], [service_name="$withval"],[service_name='"pop3lite"']) AC_DEFINE_UNQUOTED(SERVICE_NAME, $service_name, Define this to the PAM/SASL service name to use) AC_MSG_CHECKING(whether to enable loglevel checking) AC_ARG_ENABLE(loglevel-check, [ --disable-loglevel-check build without support for checking loglevel], [logcheck="$withval"],[logcheck="yes"]) if test "x$logcheck" != "xno"; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(WITH_LOGLEVEL_CHECK, 1, Define this to enable loglevel checking) else AC_MSG_RESULT(no) fi AC_ARG_ENABLE(static-daemon, [ --enable-static-daemon build a static-only daemon], [static_daemon="$enableval"],[static_daemon="no"]) AM_CONDITIONAL(STATIC_DAEMON, test "x$static_daemon" != "xno") dnl ------------------- dnl - Directories dnl ------------------- AC_ARG_WITH(docdir, [ --with-docdir=[DIR] install documentation to [DIR]], [docdir="$withval"],[ if test "x$docdir" = "x"; then docdir="$datadir/doc/$PACKAGE" fi]) AC_SUBST(docdir) if test "x$moddocdir" = "x"; then moddocdir="$docdir/modules" fi AC_SUBST(moddocdir) dnl ------------------- dnl - Library paths dnl ------------------- dnl -- PostgreSQL disabled dnl AC_ARG_WITH(pgsql-headers, dnl [ --with-pgsql-headers location of libpq-fe.h], dnl [SQL_CFLAGS="$SQL_CFLAGS -I$withval"]) dnl AC_ARG_WITH(pgsql-libs, dnl [ --with-pgsql-libs location of libpg], dnl [SQL_LIBS="$SQL_LIBS -L$withval"]) dnl ------------------- dnl - Normal modules dnl ------------------- AC_ARG_WITH(modules, [ --with-modules=[list] coma separated list of modules to build], [normal_mods="$withval"],[ normal_mods="alias,apop,capa,connectlog,disable,expire" normal_mods="$normal_mods,filelog,homebox,iplog,mailbox,pam" normal_mods="$normal_mods,sabotage,userconf,vhost"]) if test "x$normal_mods" != "x" && test "x$normal_mods" != "xno" then P3L_MODULES=`echo " $normal_mods " | sed -e "s/,/ /g"` fi AC_ARG_WITH(disabled-modules, [ --with-disabled-modules coma separated list of disabled modules], [disabled_mods="$withval"],[disabled_mods=""]) for m in `echo " $disabled_mods " | sed -e "s/,/ /g"` do P3L_MODULES=`echo "$P3L_MODULES" | sed -e "s, $m , ,"` done AC_ARG_WITH(module-support, [ --without-module-support build the daemon without module support], [module_support="$withval"],[module_support="yes"]) if test "x$module_support" != "xno" then AC_DEFINE_UNQUOTED(WITH_MODULE_SUPPORT, 1, Define this to have module support) else P3L_MODULES= normal_mods= fi dnl ------------------- dnl - Builtin modules dnl ------------------- AC_ARG_WITH(builtin-modules, [ --with-builtin-modules coma separated list of builtin modules], [builtin_mods="$withval"],[builtin_mods="mailbox"]) if test "x$builtin_mods" != "x" && test "x$builtin_mods" != "xno" then P3L_BUILTIN_LIST=`echo " $builtin_mods " | sed -e "s/,/ /g"` fi dnl ------------------- dnl - Test modules dnl ------------------- AC_ARG_ENABLE(test-modules, [ --enable-test-modules build the various test modules], [mod_tests="$enableval"],[mod_tests="no"]) dnl ********************** dnl * Programs dnl ********************** AC_CHECK_TOOL(CC, gcc) AC_PROG_CC AC_PROG_CC_C_O AC_C_INLINE AC_PROG_INSTALL AC_PROG_MAKE_SET P3L_COMPILE_WARNINGS P3L_CXX_WARNINGS dnl ------------------- dnl - Libtool dnl ------------------- AC_LIBTOOL_DLOPEN AC_LIBLTDL_CONVENIENCE(gnu/libltdl) AC_SUBST(LIBLTDL) AC_SUBST(INCLTDL) AC_PROG_LIBTOOL dnl ********************** dnl * Libraries dnl ********************** dnl ------------------- dnl - GLib dnl ------------------- AM_PATH_GLIB(1.2.0,[glib_found=yes],[glib_found=no]) if test "x$glib_found" != "xyes" then AC_MSG_ERROR(*** GLIB 1.2.0 or later is required to build this package.) fi AC_CHECK_LIB(lockfile, lockfile_create, [ AC_CHECK_HEADER(lockfile.h,[ AC_DEFINE_UNQUOTED(HAVE_LOCKFILE, 1, Define this if you have libLockfile) EXTRA_LIBS="$EXTRA_LIBS -llockfile"])]) AC_CHECK_LIB(nsl, t_accept, EXTRA_LIBS="$EXTRA_LIBS -lnsl") AC_CHECK_LIB(socket, socket, EXTRA_LIBS="$EXTRA_LIBS -lsocket") dnl ********************** dnl * Headers dnl ********************** AC_HEADER_STDC AC_HEADER_TIME AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h syslog.h unistd.h grp.h shadow.h sys/time.h crypt.h) dnl ********************** dnl * Typedefs & co dnl ********************** AC_C_CONST AC_TYPE_SIZE_T AC_TYPE_OFF_T AC_TYPE_UID_T AC_TYPE_PID_T AC_TYPE_SIGNAL AC_SYS_LARGEFILE AC_C_BIGENDIAN dnl ********************** dnl * Functions dnl ********************** AC_CHECK_FUNCS(strchr memcpy setgroups flock setfsuid strtoul) AC_CHECK_FUNC(gethostname,[ AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1, Define this if you have the gethostname function)]) dnl ------------------- dnl - getopt_long dnl ------------------- AC_CHECK_FUNC(getopt_long,[AC_CHECK_HEADER(getopt.h, [ AC_DEFINE_UNQUOTED(HAVE_GETOPT_H, 1, Define this if you have the header file)])],[ AC_DEFINE_UNQUOTED(HAVE_GETOPT_H, 1, Define this if you have the header file) getopt_conv="libgetopt.la" AC_SUBST(getopt_conv) GETOPT_LIB="\$(top_builddir)/gnu/getopt/libgetopt.la" AC_SUBST(GETOPT_LIB) GETOPT_INC="-I\$(top_srcdir)/gnu/getopt" AC_SUBST(GETOPT_INC)]) dnl ------------------- dnl - socklen_t dnl ------------------- AC_MSG_CHECKING(for socklen_t) AC_TRY_COMPILE( [ #include #include ], [ socklen_t tmp;],[ AC_MSG_RESULT(yes)], [ AC_DEFINE_UNQUOTED(socklen_t, int, Define to int if doesn't define it) AC_MSG_RESULT(no)]) dnl Simple AC_CHECK_TYPE doesn't work. dnl ------------------- dnl - MD5* dnl ------------------- AC_CHECK_HEADER(md5.h, [ AC_CHECK_LIB(md, MD5Init, [AC_DEFINE_UNQUOTED(HAVE_MD5_H, 1, Define this if you have the header file) have_md5_lib=yes])]) AM_CONDITIONAL(HAVE_MD5_LIB, test x$have_md5_lib = xyes) dnl ------------------- dnl - Checks for auth methods dnl ------------------- AUTH_LIBS="" case "$host" in *-*-sunos*) os_sunos=yes ;; *-sgi-irix5*|*-sgi-irix6*) no_libsun=yes ;; *-*-linux*) AC_CHECK_FUNC(getspnam, [getspnam_found=yes]) if test "x$getspnam_found" = "x"; then AC_CHECK_LIB(shadow, getspnam, [ getspnam_found=yes AUTH_LIBS="$AUTH_LIBS -lshadow"] ) fi ;; *) ;; esac dnl ------------------- dnl - Auth funcs dnl ------------------- AC_CHECK_FUNC(crypt, [crypt_found=yes]) if test "x$crypt_found" = "x"; then AC_CHECK_LIB(crypt, crypt, [AUTH_LIBS="$AUTH_LIBS -lcrypt" crypt_found=yes]) fi if test "x$getspnam_found" = "x"; then AC_CHECK_FUNC(getspnam, [getspnam_found=yes] ) if test "x$getspnam_found" = "x"; then AC_CHECK_LIB(sec, getspnam, [AUTH_LIBS="$AUTH_LIBS -lsec" getspnam_found=yes]) fi fi AC_CHECK_FUNC(getpwnam, [getpwnam_found=yes]) if test "x$no_libsun" = "x"; then if test "x$getpwnam_found" = "x"; then AC_CHECK_LIB(sun, getpwnam, [getpwnam_found=yes AUTH_LIBS="$AUTH_LIBS -lsun"] ) fi fi AC_SUBST(AUTH_LIBS) dnl ********************** dnl * Modules dnl ********************** dnl ------------------- dnl - Modules & co dnl ------------------- DLOPEN_MODULES="" P3L_MODS(alias apop capa connectlog disable expire filelog homebox iplog mailbox nullauth) P3L_MOD(pam, [pam_headers="no" pam_libs="no" PAMLIBS="-lpam" AC_CHECK_HEADER(security/pam_appl.h,[pam_headers="yes"]) if test "x$pam_headers" != "xno" then AC_CHECK_LIB(pam, pam_start, [pam_libs="yes"]) if test "x$pam_libs" != "xno" then p3l_mod_t="$p3l_mod_t" AC_SUBST(PAMLIBS) else echo "*** PAM libraries not found. PAM module won't be built." p3l_mod_t="no" fi else echo "*** PAM headers not found. PAM module won't be built." p3l_mod_t="no" fi],[EXTRA_LIBS="$EXTRA_LIBS $PAMLIBS"]) P3L_MOD(sabotage) dnl -- PostgreSQL support disabled dnl P3L_MOD(sqlconf, dnl [sql_header_found=no dnl sql_lib_found=no dnl SQL_LIBS="$SQL_LIBS -lpq" dnl CPPLAGS_SAVE="$CPPLAGS" dnl CPPFLAGS="$CPPLAGS $SQL_CFLAGS" dnl AC_CHECK_HEADER(libpq-fe.h, dnl [if test "x$sql_header_found" = "xno"; then sql_header_found=""; fi],) dnl CPPLAGS="$CPPLAGS_SAVE" dnl dnl if test "x$sql_header_found" = "xno" dnl then dnl AC_CHECK_HEADER(postgresql/libpq-fe.h, dnl [if test "x$sql_header_found" = "xno"; then sql_header_found="-I/usr/include/postgresql"; fi]) dnl fi dnl dnl if test "x$sql_header_found" != "xno" dnl then dnl SQL_CFLAGS="$SQL_CFLAGS $sql_header_found" dnl LDFLAGS_SAVE="$LDFLAGS" dnl LDFLAGS="$LDFLAGS $SQL_LIBS" dnl AC_CHECK_LIB(pq, PQconnectdb, [ dnl sql_lib_found="yes" dnl AC_SUBST(SQL_LIBS) dnl AC_SUBST(SQL_CFLAGS)]) dnl LDFLAGS="$LDFLAGS_SAVE" dnl if test "x$sql_lib_found" = "xno" dnl then dnl echo "*** PostgreSQL libraries not found, SQL module won't be built." dnl p3l_mod_t="no" dnl fi dnl else dnl echo "*** PostgreSQL headers not found, SQL module won't be built." dnl p3l_mod_t="no" dnl fi],[EXTRA_LIBS="$EXTRA_LIBS $SQL_LIBS" dnl EXTRA_CFLAGS="$EXTRA_CFLAGS $SQL_CFLAGS"]) P3L_MODS(userconf vhost) AC_SUBST(MOD_ALIAS_LIBS) AC_SUBST(MOD_ALIAS_NOINST_LIBS) AC_SUBST(MOD_APOP_LIBS) AC_SUBST(MOD_APOP_NOINST_LIBS) AC_SUBST(MOD_CAPA_LIBS) AC_SUBST(MOD_CAPA_NOINST_LIBS) AC_SUBST(MOD_CONNECTLOG_LIBS) AC_SUBST(MOD_CONNECTLOG_NOINST_LIBS) AC_SUBST(MOD_DISABLE_LIBS) AC_SUBST(MOD_DISABLE_NOINST_LIBS) AC_SUBST(MOD_EXPIRE_LIBS) AC_SUBST(MOD_EXPIRE_NOINST_LIBS) AC_SUBST(MOD_FILELOG_LIBS) AC_SUBST(MOD_FILELOG_NOINST_LIBS) AC_SUBST(MOD_HOMEBOX_LIBS) AC_SUBST(MOD_HOMEBOX_NOINST_LIBS) AC_SUBST(MOD_IPLOG_LIBS) AC_SUBST(MOD_IPLOG_NOINST_LIBS) AC_SUBST(MOD_MAILBOX_LIBS) AC_SUBST(MOD_MAILBOX_NOINST_LIBS) AC_SUBST(MOD_NULLAUTH_LIBS) AC_SUBST(MOD_NULLAUTH_NOINST_LIBS) AC_SUBST(MOD_PAM_LIBS) AC_SUBST(MOD_PAM_NOINST_LIBS) AC_SUBST(MOD_SABOTAGE_LIBS) AC_SUBST(MOD_SABOTAGE_NOINST_LIBS) dnl AC_SUBST(MOD_SQLCONF_LIBS) dnl AC_SUBST(MOD_SQLCONF_NOINST_LIBS) AC_SUBST(MOD_USERCONF_LIBS) AC_SUBST(MOD_USERCONF_NOINST_LIBS) AC_SUBST(MOD_VHOST_LIBS) AC_SUBST(MOD_VHOST_NOINST_LIBS) if test "x$mod_tests" != "xno" then AC_CHECK_TOOL(CXX, g++) AC_LANG(C++) AC_PROG_CXX AC_LANG(C) TEST_MODULES="mod-cpp-test" P3L_MODULES="$P3L_MODULES [[Test modules]]" fi AC_SUBST(TEST_MODULES) AM_CONDITIONAL(TEST_MODULES, test "x$mod_tests" != "xno") if echo "$P3L_BUILTIN_LIST" | grep " test-modules " 2>&1 >/dev/null then P3L_BUILTIN_LIST=`echo "$P3L_BUILTIN_LIST" | sed -e "s% test-modules % %g"` fi dnl ********************** dnl * Libltdl dnl ********************** AC_CONFIG_SUBDIRS(gnu/libltdl) dnl ********************** dnl * Static handling dnl ********************** if test "x$static_daemon" != "xno" then for m in $P3L_BUILTIN_LIST do DLOPEN_MODULES=`echo "$DLOPEN_MODULES" | sed -e "s%\\$(top_builddir)/modules/$m/$m.la%%"` done fi if test "x$enable_shared" = "xyes" && test "x$static_daemon" = "xno" then DLOPEN_MODULES="" fi AC_SUBST(DLOPEN_MODULES) DLOPEN_LDADD=`echo "$DLOPEN_MODULES" | sed -e "s,\(\\$(top_builddir)/\),\"-dlopen\" \1,g"` AC_SUBST(DLOPEN_LDADD) P3L_BUILTIN_LIST=`echo " $P3L_BUILTIN_LIST " | sed -e "s%^ *%%" -e "s% *$% %"` if test "x$P3L_BUILTIN_LIST" != "x" && test "x$P3L_BUILTIN_LIST" != "x " then P3L_BUILTIN_LIBS=`echo "$P3L_BUILTIN_LIST" | sed -e "s%\([[^ ]]*\) %\\$(top_builddir)/modules/\1/\1.la %g"` P3L_BUILTIN_DIRS=`echo "$P3L_BUILTIN_LIST" | sed -e "s%\([[^ ]]*\) %modules/\1 %g"` fi AC_SUBST(P3L_BUILTIN_LIST) AC_SUBST(P3L_BUILTIN_LIBS) AC_SUBST(P3L_BUILTIN_DIRS) for m in $P3L_BUILTIN_LIST do P3L_MODULES=`echo "$P3L_MODULES" | sed -e "s% $m % %g"` done P3L_MODULES=`echo " $P3L_MODULES " | sed -e "s%^ *%%" -e "s% *$% %"` AC_SUBST(EXTRA_LIBS) AC_SUBST(EXTRA_CFLAGS) AC_SUBST(P3L_MODULES) if test "x$static_daemon" != "xno"; then STATIC_ADD="-all-static \$(shell echo \"\\$(GLIB_LIBS) \\$(AUTH_LIBS) \\$(EXTRA_LIBS)\" | sed -e 's/\-l/\-Wl,\-l/g')" fi AC_SUBST(STATIC_ADD) dnl ********************** dnl * Output dnl ********************** CONFIG_CFLAGS="$CFLAGS" AC_SUBST(CONFIG_CFLAGS) CFLAGS="" AC_CONFIG_FILES([ dist/Makefile doc/Makefile gnu/Makefile gnu/getopt/Makefile gnu/md5/Makefile includes/Makefile includes/pop3lite.h layouts/Makefile macros/Makefile man/Makefile modules/Makefile modules/alias/Makefile modules/apop/Makefile modules/capa/Makefile modules/connectlog/Makefile modules/disable/Makefile modules/expire/Makefile modules/filelog/Makefile modules/homebox/Makefile modules/iplog/Makefile modules/mailbox/Makefile modules/nullauth/Makefile modules/pam/Makefile modules/sabotage/Makefile modules/userconf/Makefile modules/vhost/Makefile src/Makefile test-modules/Makefile test-modules/cpp-test/Makefile testsuite/Makefile Makefile ]) AC_CONFIG_COMMANDS(default, [[touch src/stamp-builtin]]) AC_OUTPUT dnl ********************** dnl * Prettyprint dnl ********************** banner="$PACKAGE $VERSION$EXTRA_VERSION $CVS_REVISION" dashes=`echo "$banner" | sed -e "s/./=/g"` echo echo "$dashes" echo "$banner" echo "$dashes" echo echo "Prefix: $prefix" echo "Documentation: $docdir" echo "Modules: $P3L_MODULES" echo "Builtin modules: $P3L_BUILTIN_LIST" echo