dnl $Id: configure.in,v 1.13 2005/11/16 03:52:58 Mysid Exp $ dnl Copyright 1996, 1997 by Michael Graff dnl 1997-2005 James Hess 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 1. Redistributions of source code must retain the above copyright dnl notice, this list of conditions and the following disclaimer. dnl 2. Redistributions in binary form must reproduce the above copyright dnl notice, this list of conditions and the following disclaimer in the dnl documentation and/or other materials provided with the distribution. dnl 3. All advertising materials mentioning features or use of this software dnl must display the following acknowledgement: dnl This product includes software developed by dnl Michael Graff dnl 4. Neither the name of the Author nor the names of its contributors dnl may be used to endorse or promote products derived from this software dnl without specific prior written permission. dnl dnl THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND dnl ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE dnl ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS dnl OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT dnl LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF dnl SUCH DAMAGE. AC_INIT(configure.in) AM_INIT_AUTOMAKE(services, 1.4.10) AC_REVISION($Id: configure.in,v 1.13 2005/11/16 03:52:58 Mysid Exp $)dnl AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL AC_PROG_MAKE_SET NS_CHECK_SYS_ERRLIST if test -r options.h.in -a ! -r options.h ; then AC_MSG_CHECKING([Creating options.h...]) cp options.h.in options.h if test ! -r options.h ; then AC_MSG_ERROR([unable to copy options.h.in to options.h]) fi AC_MSG_RESULT([ok]) fi #if test -d /usr/local/include ; then # CFLAGS="$CFLAGS -I/usr/local/include" # LIBS="$LIBS -L/usr/local/lib" #fi #if test -d /usr/include ; then # CFLAGS="$CFLAGS -I/usr/include" # LIBS="$LIBS -L/usr/lib" #fi if test -d /usr/pkg/include ; then CFLAGS="$CFLAGS -I/usr/pgsql/include" LIBS="$LIBS -I/usr/pkg/lib" fi if test -d /usr/local/pgsql/include ; then CFLAGS="$CFLAGS -I/usr/local/pgsql/include" LIBS="$LIBS -L/usr/local/pgsql/lib" fi dnl Checks for --enable and --disable AC_ARG_ENABLE(grpops, [ --enable-grpops[=ARG] Enable GRPops?], [if test "$enableval" = "yes" ; then svc_cv_grpops="yes" AC_DEFINE(ENABLE_GRPOPS, 1) else svc_cv_grpops="no" fi ], [ AC_MSG_CHECKING([GRPop preference]) AC_CACHE_VAL(svc_cv_grpops, [ true ]) if test -z "$svc_cv_grpops" -o "$svc_cv_grpops" = "no" ; then AC_MSG_WARN([GRPop flag not enabled.]) else AC_MSG_RESULT([GRPop flag enabled.]) AC_DEFINE(ENABLE_GRPOPS, 1) fi ]) dnl Checks for --with and --without flags AC_ARG_WITH(warnings, [ --with-warnings[=ARG] Enable lots of warning messages for compile], [if test "$withval" = "yes" ; then WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes" else WARNINGS="$withval" fi CFLAGS="$CFLAGS $WARNINGS"], [WARNINGS=""]) AC_ARG_WITH(klinemail, [ --with-klinemail[=ARG] Mail logs of set akills to specified address], [if test "$withval" = "yes" -o -z "$withval" ; then AC_MSG_ERROR([--with-klinemail requires a valid e-mail address]) elif test "$withval" = "kline@example.net" ; then AC_MSG_ERROR([--with-klinemail requires an e-mail address other than kline@example.net]) elif test "$withval" = "no" ; then AC_CACHE_VAL(svc_cv_akillmailto, [ true ]) svc_cv_akillmailto="no" AC_MSG_WARN([Not using akill log mailing.]) else AC_CACHE_VAL(svc_cv_akillmailto, [ true ]) svc_cv_akillmailto="$withval" AC_DEFINE_UNQUOTED(AKILLMAILTO, "$withval") fi ], [ AC_CACHE_CHECK([Checking for AKILLMAILTO], svc_cv_akillmailto, [svc_cv_akillmailto='']) if test -z "$svc_cv_akillmailto" ; then AC_MSG_ERROR([No value for AKILLMAILTO you need to use \`--with-klinemail' to cache a value.]) elif test "$svc_cv_akillmailto" = "no" ; then AC_MSG_WARN([Not using akill log mailing.]) else AC_DEFINE_UNQUOTED(AKILLMAILTO, "$svc_cv_akillmailto") fi ]) AC_ARG_WITH(opsemail, [ --with-opsemail[=ARG] Mail logs of set akills to specified ops address], [if test "$withval" = "yes" -o -z "$withval" ; then AC_MSG_ERROR([--with-opsemail requires a valid e-mail address]) elif test "$withval" = "kline@example.net" ; then AC_MSG_ERROR([--with-opsemail requires an e-mail address other than kline@example.net]) elif test "$withval" = "ops@example.net" ; then AC_MSG_ERROR([--with-opsemail requires an e-mail address other than ops@example.net]) elif test "$withval" = "no" ; then AC_CACHE_VAL(svc_cv_opsmailto, [ true ]) svc_cv_opsmailto="no" AC_MSG_WARN([Not using ops akill mailing.]) else AC_CACHE_VAL(svc_cv_opsmailto, [ true ]) svc_cv_opsmailto="$withval" AC_DEFINE_UNQUOTED(OPSMAILTO, "$withval", "Second e-mail address for akill logs ie an ops mailing list") fi ], [ AC_CACHE_CHECK([Checking for OPSMAILTO], svc_cv_opsmailto, [svc_cv_opsmailto='']) if test -z "$svc_cv_opsmailto" ; then AC_MSG_ERROR([No value for OPSMAILTO you need to use \`--with-opsemail' to cache a value.]) elif test "$svc_cv_opsmailto" = "no" ; then AC_MSG_WARN([Not using ops log mailing.]) else AC_DEFINE_UNQUOTED(OPSMAILTO, "$svc_cv_opsmailto") fi ]) AC_ARG_WITH(network, [ --with-network[=ARG] Domain name of the IRC network], [if test "$withval" = "yes" -o -z "$withval" ; then AC_MSG_ERROR([--with-network requires a network name]) else AC_CACHE_VAL(svc_cv_network, [ true ]) svc_cv_network="$withval" AC_DEFINE_UNQUOTED(NETWORK, "$withval") fi ], [ AC_CACHE_CHECK([Checking for NETWORK], svc_cv_network, [svc_cv_network='']) if test -z "$svc_cv_network" ; then AC_MSG_ERROR([No value for NETWORK you need to use \`--with-network' to cache a value for the network domain.]) fi AC_DEFINE_UNQUOTED(NETWORK, "$svc_cv_network") ]) AC_ARG_WITH(md5, [ --with-md5 Enable md5 identification ], [ if test "$withval" = "yes" -o -z "$withval" ; then MD5_LIB="hash/libmd5.a" MD5_DEF="-DMD5_AUTH" elif test "$withval" = "no" ; then MD5_LIB="" MD5_DEF="" else MD5_LIB="$withval/libmd5.a" MD5_DEF="-DMD5_AUTH" fi ], [ if test -d "hash" ; then MD5_LIB="hash/libmd5.a" MD5_DEF="-DMD5_AUTH" else MD5_LIB="" MD5_DEF="" fi ]) AC_SUBST(MD5_LIB) AC_SUBST(MD5_DEF) AC_ARG_WITH(cfgpath, [ --with-cfgpath=ARG Specify the default base path for services info], [if test "$withval" = "yes" ; then AC_MSG_ERROR([Must specify a path for --with-cfgpath]) else CFGPATH="$withval" fi ], [CFGPATH=""]) AC_ARG_WITH(cppunit-dir, [ --with-cppunit-prefix=ARG Specify the prefix where CPPunit is installed] , [if test "$withval" = "yes" ; then AC_MSG_ERROR([Must specify a path for --with-cppunit-dir]) else cppunit_prefix="$withval" fi ], [CPPUNIT_PREFIX="/home/mysidia/sorcery/libs"]) AC_SUBST(CPPUNIT_PREFIX) if test -z "$CFGPATH" ; then CFGPATH="." AC_MSG_WARN([no --with-cfgpath=path, you must start the program in the data directory]) else AC_MSG_RESULT([Base path for services data: $CFGPATH]) fi AC_DEFINE_UNQUOTED(CFGPATH, "$CFGPATH") AC_SUBST(CFGPATH) AC_ARG_WITH(help, [ --with-help=ARG Specify the default base path for services info], [if test "$withval" = "yes" ; then AC_MSG_ERROR([Must specify a path for --with-help]) else HELP_PATH="$withval" fi ], [HELP_PATH="./help/"]) if test -z "$HELP_PATH" ; then CFGPATH="." AC_MSG_WARN([no --with-help=path, help directory must be beneath startup directory]) else AC_MSG_RESULT([Base path for services helpfiles: $HELP_PATH]) fi AC_SUBST(HELP_PATH) AC_DEFINE_UNQUOTED(HELP_PATH, "$HELP_PATH") AC_ARG_WITH(sendmail, [ --with-sendmail=ARG Set the program to send mail (from stdin)], [if test "$withval" = "yes" ; then AC_MSG_ERROR([Must specify a path for --with-sendmail]) else SENDMAIL="$withval" fi ], [SENDMAIL=""]) if test -z "$SENDMAIL" ; then if test -x /var/qmail/bin/sendmail ; then SENDMAIL="/var/qmail/bin/sendmail -t" elif test -x /usr/sbin/sendmail ; then SENDMAIL="/usr/sbin/sendmail -t" fi fi AC_MSG_RESULT([Mail sent using: $SENDMAIL]) AC_DEFINE_UNQUOTED(SENDMAIL, "$SENDMAIL") AC_ARG_WITH(ar, [ --with-ar=ARG Set the path of the ar program ], [if test "$withval" = "yes" ; then AC_MSG_ERROR([Must specify a path for --with-ar]) else AR="$withval" fi ], [AR=""]) if test -z "$AR" ; then if test -x /bin/ar ; then AR="/bin/ar" elif test -x /usr/bin/ar ; then AR="/usr/bin/ar" elif test -x /usr/local/bin/ar ; then AR="/usr/local/bin/ar" fi fi AC_MSG_RESULT([Path to ar: $AR]) AC_SUBST(AR) AC_ARG_WITH(ld, [ --with-ld=ARG Set the path of ld ], [if test "$withval" = "yes" ; then AC_MSG_ERROR([Must specify a path for --with-ld]) else LD="$withval" fi ], [LD=""]) if test -z "$LD" ; then if test -x /bin/ld ; then LD="/bin/ld" elif test -x /usr/bin/ld ; then LD="/usr/bin/ld" elif test -x /usr/local/bin/ld ; then LD="/usr/local/bin/ld" fi fi AC_MSG_RESULT([Path to ld: $LD]) AC_SUBST(LD) AC_ARG_WITH(ranlib, [ --with-ranlib=ARG Set the path of ranlib ], [if test "$withval" = "yes" ; then AC_MSG_ERROR([Must specify a path for --with-ranlib]) else RANLIB="$withval" fi ], [RANLIB=""]) if test -z "$RANLIB" ; then if test -x /bin/ranlib ; then RANLIB="/bin/ranlib" elif test -x /usr/bin/ranlib ; then RANLIB="/usr/bin/ranlib" elif test -x /usr/local/bin/ranlib ; then RANLIB="/usr/local/bin/ranlib" fi fi AC_MSG_RESULT([Path to ranlib: $RANLIB]) AC_SUBST(RANLIB) dnl Checks for header files AC_C_CONST AC_HEADER_STDC AC_HEADER_TIME AC_CHECK_HEADERS(stdarg.h fcntl.h memory.h unistd.h stdlib.h sys/time.h sys/resource.h sys/types.h netinet/in.h) AC_CHECK_HEADERS(libpq-fe.h getopt.h) AC_CHECK_LIB(dl, dlopen, []) #AC_CHECK_LIB(pq, PQexec, AC_MSG_ERROR([Services depends on libpq: the PostgreSQL API.])) #AC_DEFINE(USE_SQL) dnl Checks for typedefs AC_TYPE_SIZE_T AC_TYPE_OFF_T AC_TYPE_SIGNAL AC_CHECK_TYPE(u_int32_t) AC_CHECK_TYPE(int32_t) AC_CHECK_TYPE(u_int16_t) AC_CHECK_TYPE(int16_t) AC_CHECK_TYPE(u_int8_t) AC_CHECK_TYPE(int8_t) #AC_CHECK_TYPE(u_int32_t, [AC_DEFINE([u_int32_t], [UINT32_T])]) #AC_CHECK_TYPE(int32_t, [AC_DEFINE([int32_t], [INT32_T])]) #AC_CHECK_TYPE(u_int16_t, [AC_DEFINE([u_int16_t], [UINT16_T])]) #AC_CHECK_TYPE(int16_t, [AC_DEFINE([int16_t], [INT16_T])]) #AC_CHECK_TYPE(u_int8_t, [AC_DEFINE([u_int32_t], [UINT8_T])]) #AC_CHECK_TYPE(int8_t, [AC_DEFINE([int32_t], [INT8_T])]) AC_CHECK_FUNCS(strdup strchr getrusage) AC_REPLACE_FUNCS(strdup strerror) AC_FUNC_VPRINTF AC_OUTPUT(Makefile hash/Makefile tests/Makefile) #