dnl dnl configure.ac dnl dnl This file is part of GNU Anubis. dnl Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The Anubis Team. dnl dnl GNU Anubis is free software; you can redistribute it and/or modify it dnl under the terms of the GNU General Public License as published by the dnl Free Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl GNU Anubis 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 along dnl with GNU Anubis. If not, see . dnl dnl Process this file with autoconf to produce a configure script. AC_INIT([GNU Anubis], [4.1], [bug-anubis@gnu.org]) AC_PREREQ([2.59]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([build]) AC_CONFIG_SRCDIR([src/main.c]) AM_INIT_AUTOMAKE AC_GNU_SOURCE if test "$CFLAGS"; then CFLAGS_CUSTOM=yes fi dnl Checks for programs. AC_PROG_CC gl_EARLY AC_PROG_YACC AM_PROG_LEX AC_PATH_PROG(idecrypt_path,idecrypt,/usr/sbin/idecrypt, $PATH:/sbin:/usr/sbin:/usr/local/sbin) AC_DEFINE_UNQUOTED(IDECRYPT_PATH,"${idecrypt_path}", [Define if IDECRYPT_PATH is present.]) dnl Checks for header files. AC_HEADER_STDC AC_TYPE_SIZE_T AC_TYPE_PID_T AC_TYPE_SIGNAL AC_CHECK_TYPE(u_char, unsigned char) AC_CHECK_HEADERS(arpa/inet.h syslog.h regex.h \ sys/types.h sys/socket.h socket.h sysexits.h locale.h) AC_CHECK_TYPE(socklen_t, , AC_DEFINE(socklen_t, int, [Define to int if does not define]), [ #if HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_SOCKET_H # include #endif ]) dnl Checks for library functions. gl_INIT AC_CHECK_FUNCS(syslog getrlimit setrlimit socketpair strdup) AC_CHECK_FUNCS(setegid setregid setresgid seteuid setreuid) AC_CHECK_FUNCS(regcomp daemon putenv) AC_FUNC_SETVBUF_REVERSED AH_BOTTOM([ #if defined (SETVBUF_REVERSED) # define SETVBUF(str,buf,mode,size) setvbuf(str,mode,buf,size) #else # define SETVBUF(str,buf,mode,size) setvbuf(str,buf,mode,size) #endif ]) AC_CHECK_LIB(socket, socket) AC_CHECK_LIB(nsl, gethostbyaddr) AC_SUBST(INCLUDES) case $build in *-apple-darwin*) INCLUDES="$INCLUDES -I/usr/include" ;; esac dnl Internationalization macros. AM_GNU_GETTEXT([external], [need-formatstring-macros]) AM_GNU_GETTEXT_VERSION([0.16]) dnl Use option --without-guile to NOT compile Guile support. AC_ARG_WITH([guile], AC_HELP_STRING([--without-guile], [without Guile support]), [ case "${withval}" in yes) useguile=yes ;; no) useguile=no ;; *) AC_MSG_ERROR(bad value ${withval} for --without-guile) ;; esac],[useguile=yes]) AC_SUBST(M4_DEFS) AC_SUBST(GUILE_INCLUDES) AC_SUBST(GUILE_LIBS) AC_SUBST(GUILE_BINDIR) AC_SUBST(GUILE_SNARF_VERSION) AC_SUBST(GUILE_SCRIPTS) if test x"$useguile" = x"yes"; then MU_CHECK_GUILE(,[ AC_DEFINE(WITH_GUILE,1,[Enable Guile support]) GUILE_INCLUDES=`guile-config compile` GUILE_LIBS=`guile-config link` GUILE_BINDIR=`guile-config info bindir` GUILE_SCRIPTS='$(GUILE_SCM)' M4_DEFS="$M4_DEFS -DWITH_GUILE" case "$GUILE_VERSION" in 16|17) GUILE_SNARF_VERSION="1.6";; *) GUILE_SNARF_VERSION="1.6";; esac ],[useguile=no]) fi if test x"$useguile" = x"no"; then AC_MSG_RESULT([Disabling GUILE support...]) fi dnl Use option --without-gpgme to NOT compile GnuPG (GPGME library) support. AC_SUBST(ANUBIS_GPGFILES) AC_ARG_WITH(gpgme, AC_HELP_STRING([--without-gpgme], [without GnuPG (GPGME library) support]), [with_gpgme=${withval}], [with_gpgme=yes]) if test "$with_gpgme" = "no"; then AC_DEFINE(NOGPG, 1, [Define to 1 if NOGPG is requested.]) else AM_PATH_GPGME([1.0.0], with_gpgme=yes, with_gpgme=no) AC_CHECK_LIB(gpgme, main,, with_gpgme=no) fi if test "$with_gpgme" = "no"; then AC_MSG_RESULT([Disabling GPGME support...]) else AC_PATH_PROG(GPG, gpg) findgpgmedir() { : if test -f "$1/include/gpgme.h"; then gpgmedir=1 INCLUDES="$INCLUDES -I$1/include" AC_MSG_CHECKING(for $1/include/gpgme.h) AC_MSG_RESULT([yes]) return 0 fi return 1 } for maindir in /usr/pkg /opt /sw; do findgpgmedir $maindir && break 2 done if test $gpgmedir; then AC_DEFINE(HAVE_GPGME_H, 1, [Define to 1 if HAVE_GPGME_H is requested.]) else AC_CHECK_HEADERS(gpgme.h) fi ANUBIS_GPGFILES='$(GPGFILES)' M4_DEFS="$M4_DEFS -DWITH_GPG" fi AC_SUBST(GSASL_LIBS) AC_CHECK_LIB(resolv, res_query) # Needed for GpgME AC_SYS_LARGEFILE AC_SUBST(ANUBIS_DEFINES) AC_SUBST(ANUBIS_SBIN_ADM) AC_SUBST(ANUBIS_BIN_ADM) dnl Use option --enable-gcc-debug to enable GCC debug code. AC_ARG_ENABLE(gcc-debug, AC_HELP_STRING([--enable-gcc-debug], [enable GCC DEBUG code]), [enable_gcc_debug=yes], [enable_gcc_debug=no]) if test "$enable_gcc_debug" = "yes" && (test "$GCC" = "yes"); then if test -z "$CFLAGS_CUSTOM"; then CFLAGS="-Wall -ggdb" else CFLAGS="$CFLAGS -ggdb" fi AC_MSG_RESULT([Enabling GCC DEBUG support...]) else if test -z "$CFLAGS_CUSTOM" && (test "$GCC" = "yes"); then CFLAGS="-Wall -O2" fi fi WITH_SQL=no WITH_MYSQL=no WITH_POSTGRES=no WITH_GDBM=no dnl Use option --with-gsasl to compile GSASL library support. MU_CHECK_GSASL(0.2.3, [ WITH_GSASL=yes AC_DEFINE(WITH_GSASL,1,[Define if Anubis is using GNU SASL]) AC_MSG_RESULT([Enabling GSASL support...]) ANUBIS_SBIN_ADM='$(adm_sbin_programs)' ANUBIS_BIN_ADM='$(adm_bin_programs)' M4_DEFS="$M4_DEFS -DWITH_GSASL" if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wno-deprecated-declarations" fi AC_CHECK_LIB(gdbm, gdbm_open, [WITH_GDBM=yes LIBS="$LIBS -lgdbm" AC_DEFINE(HAVE_LIBGDBM,1,[Define if you have libgdbm])], [AC_MSG_RESULT([Disabling GDBM support...])]) AC_ARG_WITH(mysql, AC_HELP_STRING([--with-mysql], [Configure to work with MySQL]), [case $withval in yes) USE_SQL=0 ANUBIS_CHECK_LIB(mysqlclient, mysql_real_connect, [-lm], [ USE_SQL=1 AC_DEFINE(WITH_MYSQL,1, [Define to 1 to enable MySQL interface]) AC_DEFINE(HAVE_LIBMYSQL,1, [Define if you have libmysqlclient]) ], [AC_MSG_FAILURE([The requested library libmysqlclient is not found or is unusable])], [/usr/local/lib/mysql /usr/lib/mysql]) if test "$USE_SQL" = "1" ;then WITH_SQL=yes LIBS="$LIBS $anubis_cv_lib_mysqlclient" AC_MSG_RESULT([Enabling MySQL support...]) WITH_MYSQL=yes else AC_MSG_FAILURE([Required MySQL libraries not found]) fi ;; no) ;; *) AC_MSG_FAILURE([Unexpected option argument $withval. Please use either --with-mysql or --without-mysql]);; esac]) AC_ARG_WITH(postgres, AC_HELP_STRING([--with-postgres], [Configure to work with Postgres]), [case $withval in yes) USE_SQL=0 ANUBIS_CHECK_LIB(pq, PQconnectStart, [], [ USE_SQL=1 AC_DEFINE(WITH_PGSQL,1, [Define to 1 to enable PostgreSQL interface]) ], [AC_MSG_FAILURE([The requested library libpq is not found or is unusable])], [/usr/local/pgsql/lib /usr/pgsql/lib]) if test "$USE_SQL" = "1" ;then WITH_SQL=yes LIBS="$LIBS $anubis_cv_lib_pq" AC_MSG_RESULT([Enabling PostgreSQL support...]) WITH_POSTGRES=yes else AC_MSG_FAILURE([Required PostgreSQL libraries not found]) fi ;; no) ;; *) AC_MSG_FAILURE([Unexpected option argument $withval. Please use either --with-postgres or --without-postgres]);; esac]) if test "$WITH_SQL" = "yes"; then AC_DEFINE(WITH_SQL, 1, [Define this if you use an SQL interface]) fi AC_LIBOBJ(lbuf)]) dnl Use option --without-gnutls to NOT compile GnuTLS library support. AC_ARG_WITH(gnutls, AC_HELP_STRING([--without-gnutls], [without GnuTLS library support]), [with_gnutls=${withval}], [with_gnutls=yes]) if test $with_gnutls = yes; then AC_CHECK_HEADERS(gnutls/gnutls.h) if test $ac_cv_header_gnutls_gnutls_h != no; then AM_PATH_LIBGNUTLS("1.0.0", [M4_DEFS="$M4_DEFS -DWITH_SSL -DWITH_GNUTLS" AC_DEFINE(USE_GNUTLS, 1, [Define to 1 if USE_GNUTLS is requested.])], [with_gnutls = no AC_MSG_RESULT([Disabling GnuTLS support...])]) if test $with_gnutls = yes; then # Accomodate for incompatibilities of gnults 1.0.16 (and, # eventually, newer versions) AC_CHECK_FUNC(gnutls_x509_fingerprint,: [AH_BOTTOM([ #define gnutls_x509_fingerprint gnutls_fingerprint ])]) fi fi fi dnl Use option --with-socks-proxy to compile SOCKS v4/5 proxy support. AC_ARG_WITH(socks-proxy, AC_HELP_STRING([--with-socks-proxy], [with SOCKS v4/5 proxy support]), [with_socks_proxy=${withval}], [with_socks_proxy=no]) if test "$with_socks_proxy" = "yes"; then AC_DEFINE(USE_SOCKS_PROXY, 1, [Define to 1 if USE_SOCKS_PROXY is requested.]) AC_MSG_RESULT([Enabling SOCKS v4/5 proxy support...]) fi dnl Use option --with-pcre to compile PCRE library support. AC_ARG_WITH(pcre, AC_HELP_STRING([--with-pcre], [with PCRE library support]), [with_pcre=${withval}], [with_pcre=no]) if test "$with_pcre" = "yes"; then AC_CHECK_LIB(pcre, main,, with_pcre=no) AC_CHECK_HEADERS(pcre.h pcre/pcre.h) fi if test "$with_pcre" = "yes"; then AC_MSG_RESULT([Enabling PCRE support...]) fi dnl Use option --with-pam to compile PAM support. AC_ARG_WITH(pam, AC_HELP_STRING([--with-pam], [with Pluggable Authentication Modules support]), [with_pam=${withval}], [with_pam=no]) if test "$with_pam" = "yes"; then AC_CHECK_LIB(pam, main,, with_pam=no) AC_CHECK_LIB(pam_misc, main,, with_pam=no) AC_CHECK_HEADERS(security/pam_appl.h security/pam_misc.h,, with_pam=no) fi if test "$with_pam" = "yes"; then AC_MSG_RESULT([Enabling PAM support...]) fi dnl Use option --with-tcp-wrappers to compile libwrap library support. AC_ARG_WITH(tcp-wrappers, AC_HELP_STRING([--with-tcp-wrappers], [with libwrap (TCP wrappers) support]), [with_tcp_wrappers=${withval}], [with_tcp_wrappers=no]) if test "$with_tcp_wrappers" = "yes"; then AC_CHECK_LIB(wrap, main,, with_tcp_wrappers=no) AC_CHECK_LIB(nsl, main,, with_tcp_wrappers=no) AC_CHECK_HEADERS(tcpd.h,, with_tcp_wrappers=no) fi if test "$with_tcp_wrappers" = "yes"; then AC_MSG_RESULT([Enabling libwrap (TCP wrappers) support...]) fi dnl Use option --with-unprivileged-user AC_ARG_WITH(unprivileged-user, AC_HELP_STRING([--with-unprivileged-user=USER], [set an unprivileged user (default is "nobody")])) if test -z "$with_unprivileged_user"; then with_unprivileged_user="nobody" fi AC_DEFINE_UNQUOTED(DEFAULT_UNPRIVILEGED_USER, "$with_unprivileged_user", [Define the default unprivileged user.]) dnl Check for Emacs site-lisp directory AM_PATH_LISPDIR if test "$EMACS" != "no"; then lisp_LISP='$(LISPSRC)' fi AC_SUBST(lisp_LISP) AC_CONFIG_COMMANDS([status],[ cat <