dnl dnl Copyright (c) 2004, Nate Nielsen dnl All rights reserved. dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions dnl are met: dnl dnl * Redistributions of source code must retain the above dnl copyright notice, this list of conditions and the dnl following disclaimer. dnl * Redistributions in binary form must reproduce the dnl above copyright notice, this list of conditions and dnl the following disclaimer in the documentation and/or dnl other materials provided with the distribution. dnl * The names of contributors to this software may not be dnl used to endorse or promote products derived from this dnl software without specific prior written permission. dnl dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS dnl FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE dnl COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, dnl INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, dnl BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS dnl OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED dnl AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, dnl OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF dnl THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH dnl DAMAGE. dnl dnl dnl CONTRIBUTORS dnl Nate Nielsen dnl dnl Process this file with autoconf to produce a configure script. AC_INIT(httpauth, 0.6, nielsen@memberwebs.com) AM_INIT_AUTOMAKE(httpauth, 0.6) LDFLAGS="$LDFLAGS -L/usr/local/lib" CFLAGS="$CFLAGS -I/usr/local/include -g -O0" AC_CONFIG_SRCDIR([daemon/httpauthd.c]) AM_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET # Debug mode AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Compile binaries in debug mode])) if test "$enable_debug" = "yes"; then CFLAGS="$CFLAGS -g -O0" AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode]) echo "enabling debug compile mode" fi # Check for the various options AC_ARG_WITH(ldap, [ --with-ldap with LDAP support]) AC_ARG_WITH(pgsql, [ --with-pgsql with Postgres support]) AC_ARG_WITH(ldap, [ --with-mysql with MYSQL support]) AC_ARG_ENABLE(ntlm, [ --enable-ntlm enable NTLM support]) # TODO: Figure out why we need this wierd hack ACX_PTHREAD( , [echo "ERROR: Pthread support not found."; exit 1] ) LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" AC_CHECK_LIB([crypt_r], [crypt], , [ AC_CHECK_LIB([crypt], [crypt], , [ echo "ERROR: Crypt library required."; exit 1] ) ]) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([unistd.h stdio.h stddef.h fcntl.h stdlib.h assert.h errno.h stdarg.h err.h string.h], , [echo "ERROR: Required C header missing"; exit 1]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_CHECK_DECL(PTHREAD_MUTEX_ERRORCHECK_NP, [AC_DEFINE(HAVE_ERR_MUTEX, 1, "Error Mutex Type")], [AC_CHECK_DECL(PTHREAD_MUTEX_ERRORCHECK, [AC_DEFINE(HAVE_ERR_MUTEX, 2)], [echo "ERROR: Missing error checking mutex functionality in pthread.h"], [ #include ])], [ #include ]) # Required Functions AC_CHECK_FUNCS([memset strerror malloc realloc getopt strchr tolower getaddrinfo], , [echo "ERROR: Required function missing"; exit 1]) AC_CHECK_FUNCS([strlwr]) # LDAP support AM_CONDITIONAL(WITH_LDAP, test -n "$with_ldap") if test -n "$with_ldap"; then echo "enabling LDAP support" if test "$with_ldap" != "yes"; then LDFLAGS="$LDFLAGS -L$with_ldap/lib" CFLAGS="$CFLAGS -I$with_ldap/include" fi AC_CHECK_LIB([ldap], [ldap_init], , [ echo "ERROR: Open LDAP 2.x library required."; exit 1] ) AC_CHECK_HEADERS(ldap.h) AC_DEFINE_UNQUOTED(WITH_LDAP, 1, [With LDAP Support] ) fi # PGSQL support AM_CONDITIONAL(WITH_PGSQL, test -n "$with_pgsql") if test -n "$with_pgsql"; then echo "enabling PGSQL support" if test "$with_pgsql" != "yes"; then LDFLAGS="$LDFLAGS -L$with_pgsql/lib" CFLAGS="$CFLAGS -I$with_pgsql/include" fi AC_CHECK_LIB([pq], [PQexec], , [ echo "ERROR: Postgres libpq library required."; exit 1] ) AC_CHECK_HEADERS(libpq-fe.h) AC_DEFINE_UNQUOTED(WITH_PGSQL, 1, [With PGSQL Support] ) fi # MYSQL support AM_CONDITIONAL(WITH_MYSQL, test -n "$with_mysql") if test -n "$with_mysql"; then echo "enabling MYSQL support" if test "$with_mysql" != "yes"; then MYSQL_LIBS="-L$with_mysql/lib -L$with_mysql/lib/mysql -lz" MYSQL_CFLAGS="-I$with_mysql/include -I$with_mysql/include/mysql" else AC_CHECK_MYSQL fi # MYSQL really sucks when it comes to all of this LDFLAGS="$LDFLAGS `echo $MYSQL_LIBS | sed -e "s/'//g"`" CFLAGS="$CFLAGS `echo $MYSQL_CFLAGS | sed -e "s/'//g"`" AC_CHECK_LIB([mysqlclient], [mysql_init], , [ echo "ERROR: MYSQL mysqlclient library required."; exit 1] ) AC_CHECK_HEADERS(mysql.h) AC_DEFINE_UNQUOTED(WITH_MYSQL, 1, [With MYSQL Support] ) fi # NTLM Support AM_CONDITIONAL(WITH_NTLM, test -n "$enable_ntlm") if test -n "$enable_ntlm"; then echo "enabling NTLM support" AC_DEFINE_UNQUOTED(WITH_NTLM, 1, [With NTLM Support] ) fi # Have to resolve this for the path below if test "${prefix}" = "NONE"; then prefix=$ac_default_prefix fi # APACHE Build stuff AC_PATH_PROG(APXS, apxs, "failed") if test "$APXS" = "failed"; then AC_PATH_PROG(APXS2, apxs2, "failed") if test "$APXS2" = "failed"; then APXS="apxs" else APXS=$APXS2 fi fi AC_SUBST(APXS) AC_PATH_PROG(APACHECTL, apachectl, "failed") if test "$APACHECTL" = "failed"; then AC_PATH_PROG(APACHE2CTL, apache2ctl, "failed") if test "$APACHE2CTL" = "failed"; then APACHECTL="apachectl" else APACHECTL=$APACHE2CTL fi fi AC_SUBST(APACHECTL) AC_DEFINE_UNQUOTED(CONF_PREFIX, "`eval echo ${sysconfdir}`", [Installation Prefix] ) AC_CONFIG_FILES([Makefile daemon/Makefile doc/Makefile tools/Makefile apache1x/Makefile apache2x/Makefile java/Makefile]) AC_OUTPUT