dnl Prefered emacs editing mode: -*- shell-script -*- dnl dnl Process this file with autoconf to produce a configure script. dnl dnl Copyright (c) 1997, by Carlo Wood dnl Copyright (C) 2001 Kevin L. Mitchell dnl dnl This program 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 3, or (at your option) dnl any later version. dnl dnl This program 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., 675 Mass Ave, Cambridge, MA 02139, USA. dnl dnl $Id: configure.in 2756 2009-12-30 22:34:02Z sirvulcan $ dnl Make sure we are in the correct directory (someone could have run dnl 'configure' with a wrong '--srcdir'). AC_INIT(Nefarious IRCu, 1.3.0, evilnet-devel@lists.sourceforge.net) AC_CONFIG_SRCDIR([ircd/ircd.c]) dnl Set the default prefix AC_PREFIX_DEFAULT([$HOME]) AC_MSG_CHECKING([for installation prefix]) AC_CACHE_VAL(unet_cv_prefix, [unet_cv_prefix=$HOME]) if test x"$prefix" != xNONE; then unet_cv_prefix=$prefix fi AC_MSG_RESULT([$unet_cv_prefix]) dnl HACK WARNING: We are referencing an autoconf internal variable. This is dnl the only way to force the prefix to be retrieved from the config.cache dnl file! ac_default_prefix=$unet_cv_prefix dnl Define the input and output configuration header file. AC_CONFIG_HEADER([config.h]) dnl Demand at least version 2.57 of autoconf AC_PREREQ(2.57) dnl Find out what type of system we are AC_CANONICAL_HOST dnl This should be done early. AC_PROG_CC dnl ANSIfy the C compiler whenever possible. AM_PROG_CC_STDC dnl Allow specification of optimization level. AC_ARG_WITH([optimization], AS_HELP_STRING([--with-optimization=[-O2]], [Explicitly set the compiler optimization flags (default: -O3)]), [unet_cv_optimization=$withval], [unet_cv_optimization="-O3"]) AC_CACHE_CHECK([optimization level], [unet_cv_optimization], [unet_cv_optimization="-O3"]) if test "x$unet_cv_optimization" = "xno" ; then unet_cv_optimization="" fi if test x"$CFLAGS" != x; then CFLAGS=`echo "$CFLAGS" | sed -e s/-O2/$unet_cv_optimization/` fi dnl Remove -pipe during configure if test x"$CFLAGS" != x; then CFLAGS=`echo "$CFLAGS" | sed -e 's/-pipe//g'` fi dnl Notice the -g flag and deal accordingly if test x"$CFLAGS" != x; then unet_old_cflags=$CFLAGS CFLAGS=`echo "$CFLAGS" | sed -e 's/-g//g'` fi if test x"$CFLAGS" != x"$unet_old_cflags"; then # If -g was already there, force symbols to be enabled unet_cv_enable_symbols=yes fi dnl Notice the -pg flag and deal accordingly if test x"$CFLAGS" != x; then unet_old_cflags=$CFLAGS CFLAGS=`echo "$CFLAGS" | sed -e 's/-pg//g'` fi if test x"$CFLAGS" != x"$unet_old_cflags"; then # If -pg was already there, force profiling to be enabled unet_cv_enable_profile=yes fi dnl Notice the -Wall flag and deal accordingly if test x"$CFLAGS" != x; then unet_old_cflags=$CFLAGS CFLAGS=`echo "$CFLAGS" | sed -e 's/-Wall//g'` fi if test x"$CFLAGS" != x"$unet_old_cflags"; then # If -Wall was already there, force warnings to be enabled unet_cv_enable_warnings=yes fi dnl Notice the -pedantic flag and deal accordingly if test x"$CFLAGS" != x; then unet_old_cflags=$CFLAGS CFLAGS=`echo "$CFLAGS" | sed -e 's/-pedantic//g'` fi if test x"$CFLAGS" != x"$unet_old_cflags"; then # If -pedantic was already there, force pedatic to be enabled unet_cv_enable_pedantic=yes fi dnl Checks for libraries. dnl Locate the library containing crypt AC_SEARCH_LIBS(crypt, descrypt crypt, , [AC_MSG_ERROR([Unable to find library containing crypt()])]) dnl Do all the checks necessary to figure out -lnsl / -lsocket stuff AC_LIBRARY_NET dnl Look for res_mkquery. Done after AC_LIBRARY_NET in case res_mkquery dnl is in one of those libraries somewhere. dnl if no res_mkquery, try __res_mkquery as this is all there is on ia64 (ubuntu linux anyway) AC_SEARCH_LIBS(res_mkquery, resolv, , [ AC_SEARCH_LIBS(__res_mkquery, resolv, AC_DEFINE_UNQUOTED(RES_PREFIX, "TRUE", [__res_mkquery instead of res_mkquery]), [AC_MSG_ERROR([Unable to find library containing res_mkquery() or __res_mkquery(). Please install resolv library. (comes with libc6)])] ) ] ) dnl Checks for header files. AC_FUNC_ALLOCA AC_HEADER_RESOLV AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([arpa/inet.h crypt.h fcntl.h getopt.h inttypes.h limits.h netdb.h netinet/in.h poll.h stddef.h stdlib.h string.h sys/devpoll.h sys/event.h sys/epoll.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h libintl.h malloc.h]) dnl Checks for typedefs, structures, and compiler characteristics AC_C_CONST AC_C_INLINE AC_TYPE_INT16_T AC_TYPE_INT32_T AC_TYPE_INT64_T AC_TYPE_INT8_T AC_C_BIGENDIAN AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM AC_TYPE_UID_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_UINT8_T unet_CHECK_TYPE_SIZES AC_CHECK_TYPES([ptrdiff_t]) dnl Checks for library functions. AC_FUNC_FORK AC_PROG_GCC_TRADITIONAL AC_FUNC_MALLOC AC_FUNC_MEMCMP AC_FUNC_REALLOC AC_FUNC_SELECT_ARGTYPES AC_FUNC_STAT AC_FUNC_VPRINTF AC_CHECK_FUNCS([alarm dup2 getpass gettimeofday memmove memset regcomp select socket strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strstr strtol strtoul strspn kqueue setrlimit getrusage times]) dnl Do we have restarting syscalls ? AC_SYS_RESTARTABLE_SYSCALLS dnl Check for required features for admins? AC_MSG_CHECKING([for donuts]) AC_MSG_RESULT([yes]) dnl Test for programs AC_PROG_AWK AC_PROG_MAKE_SET AC_PROG_INSTALL AC_PROG_LN_S AC_PATH_PROGS(RMPROG, rm, /bin/rm) AC_PATH_PROGS(SHPROG, sh, /bin/sh) AC_PATH_PROGS(BASH, bash, /bin/bash, [/bin/bash:/usr/bin/bash:/usr/local/bin/bash:$PATH]) AC_CACHE_CHECK(if we can set the core size to unlimited, ac_cv_force_core,[ AC_TRY_RUN([ #include #include #include int main() { struct rlimit corelim; corelim.rlim_cur = corelim.rlim_max = RLIM_INFINITY; if (setrlimit(RLIMIT_CORE, &corelim)) exit(1); exit(0); } ],ac_cv_force_core=yes,ac_cv_force_core=no) ]) if test "$ac_cv_force_core" = "yes"; then AC_DEFINE([FORCE_CORE], [], [Specify whether we can enable core files or not]) fi dnl (F)LEX - needed for the new conf file parser AC_PROG_LEX dnl The autoconf docs say $LEX defaults to 'lex'. They lie. if test "$LEX" = ":" ; then AC_MSG_ERROR([Cannot find flex.]) elif echo "" | $LEX -V -v --version > /dev/null 2>&1 ; then : else AC_MSG_ERROR([Cannot use $LEX as flex.]) fi dnl YACC - ditto AC_PROG_YACC dnl The autoconf docs say $YACC defaults to 'yacc'. This seems to be true, dnl but judging from AC_PROG_LEX, it may not stay true. if test "$YACC" = ":" ; then AC_MSG_ERROR([Cannot find yacc.]) elif echo "" | $YACC -V -v --version > /dev/null 2>&1 ; then : else dnl byacc does not seem to have any way to test for workingness, so only warn. AC_MSG_WARN([$YACC may not work as yacc.]) fi unet_NONBLOCKING unet_SIGNALS dnl Add -pipe when possible unet_PIPE_CFLAGS dnl Check OS for os_dep files. AC_MSG_CHECKING(for OS-dependent information) case "$host" in *-linux*) AC_MSG_RESULT([Linux ($host) found.]) unet_poll_syscall=yes OSDEP_C=os_linux.c ;; *-solaris*) AC_MSG_RESULT([Solaris ($host) found.]) if test x"$ac_cv_header_poll_h" = xyes; then unet_poll_syscall=yes else unet_poll_syscall=no fi OSDEP_C=os_solaris.c ;; *-sunos*) AC_MSG_RESULT([Solaris ($host) found.]) unet_poll_syscall=no OSDEP_C=os_solaris.c ;; *-openbsd*) AC_MSG_RESULT([OpenBSD ($host) found.]) if test x"$ac_cv_header_poll_h" = xyes; then unet_poll_syscall=yes else unet_poll_syscall=no fi OSDEP_C=os_openbsd.c ;; *-*bsd*) AC_MSG_RESULT([Generic BSD ($host) found.]) CFLAGS="-Wno-long-long $CFLAGS" if test x"$ac_cv_header_poll_h" = xyes; then unet_poll_syscall=yes else unet_poll_syscall=no fi OSDEP_C=os_bsd.c ;; *-darwin*) AC_MSG_RESULT([Darwin (Mac OS X) ($host) found.]) unet_poll_syscall=no OSDEP_C=os_bsd.c ;; *) AC_MSG_RESULT([Unknown system type $host found.]) AC_MSG_WARN([Unknown OS type; using generic routines.]) unet_poll_syscall=no OSDEP_C=os_generic.c ;; esac AC_SUBST(OSDEP_C) dnl Check user configuration options dnl Start with --enable-poll AC_MSG_CHECKING([whether to enable use of poll()]) AC_ARG_ENABLE([poll], [ --enable-poll Force poll to be used regardless of whether or not it is a system call], [unet_cv_enable_poll=$enable_poll], [AC_CACHE_VAL(unet_cv_enable_poll, [unet_cv_enable_poll=$unet_poll_syscall])]) # Force poll to be disabled if there is no poll.h if test x"$ac_cv_header_poll_h" != xyes; then unet_cv_enable_poll=no fi AC_MSG_RESULT([$unet_cv_enable_poll]) if test x"$unet_cv_enable_poll" = xyes; then AC_DEFINE([USE_POLL], , [Specify whether or not to use poll()]) ENGINE_C=engine_poll.c else ENGINE_C=engine_select.c fi AC_SUBST(ENGINE_C) dnl Now look for --enable-debug AC_MSG_CHECKING([whether to enable debug mode]) AC_ARG_ENABLE([debug], [ --enable-debug Turn on debugging mode], [unet_cv_enable_debug=$enable_debug], [AC_CACHE_VAL(unet_cv_enable_debug, [unet_cv_enable_debug=no])]) AC_MSG_RESULT([$unet_cv_enable_debug]) if test x"$unet_cv_enable_debug" = xyes; then AC_DEFINE([DEBUGMODE], , [Enable debugging code]) fi dnl And now for --disable-asserts AC_MSG_CHECKING([whether to enable asserts]) AC_ARG_ENABLE([asserts], [ --disable-asserts Disable assertion checking], [unet_cv_enable_asserts=$enable_asserts], [AC_CACHE_VAL(unet_cv_enable_asserts, [unet_cv_enable_asserts=yes])]) AC_MSG_RESULT([$unet_cv_enable_asserts]) if test x"$unet_cv_enable_asserts" = xno; then AC_DEFINE([NDEBUG], , [Disable assertions]) fi dnl Check for --enable-symbols AC_MSG_CHECKING([whether to enable debugging symbols]) AC_ARG_ENABLE([symbols], [ --disable-symbols Disable debugging symbols (remove -g from CFLAGS)], [unet_cv_enable_symbols=$enable_symbols], [AC_CACHE_VAL(unet_cv_enable_symbols, [unet_cv_enable_symbols=yes])]) AC_MSG_RESULT([$unet_cv_enable_symbols]) if test x"$unet_cv_enable_symbols" = xyes; then CFLAGS="-g $CFLAGS" fi dnl Now check for --enable-profile AC_MSG_CHECKING([whether to enable profiling support (gprof)]) AC_ARG_ENABLE([profile], [ --enable-profile Enable profiling support (add -pg to CFLAGS)], [unet_cv_enable_profile=$enable_profile], [AC_CACHE_VAL(unet_cv_enable_profile, [unet_cv_enable_profile=no])]) AC_MSG_RESULT([$unet_cv_enable_profile]) if test x"$unet_cv_enable_profile" = xyes; then CFLAGS="-pg $CFLAGS" fi dnl Now check for --enable-pedantic AC_MSG_CHECKING([whether to enable pedantic compiler warnings]) AC_ARG_ENABLE([pedantic], [ --enable-pedantic Enable pedantic warnings (add -pedantic to CFLAGS)], [unet_cv_enable_pedantic=$enable_pedantic], [AC_CACHE_VAL(unet_cv_enable_pedantic, [unet_cv_enable_pedantic=no])]) AC_MSG_RESULT([$unet_cv_enable_pedantic]) if test x"$unet_cv_enable_pedantic" = xyes; then CFLAGS="-pedantic $CFLAGS" fi dnl Now check for --enable-warnings AC_MSG_CHECKING([whether to enable compiler warnings]) AC_ARG_ENABLE([warnings], [ --enable-warnings Enable warnings (add -Wall to CFLAGS)], [unet_cv_enable_warnings=$enable_warnings], [AC_CACHE_VAL(unet_cv_enable_warnings, [unet_cv_enable_warnings=no])]) AC_MSG_RESULT([$unet_cv_enable_warnings]) AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing) ac_save_cc="$CC" CC="$CC -fno-strict-aliasing" AC_TRY_RUN([int main() { return 0; }], ac_cv_no_strict_aliasing_ok=yes, ac_cv_no_strict_aliasing_ok=no, ac_cv_no_strict_aliasing_ok=no) CC="$ac_save_cc" AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok) if test $ac_cv_no_strict_aliasing_ok = yes then CFLAGS="-fno-strict-aliasing $CFLAGS" fi dnl --disable-inlines check... AC_MSG_CHECKING([whether to enable inlining for a few critical functions]) AC_ARG_ENABLE([inlines], [ --disable-inlines Disable inlining for a few critical functions], [unet_cv_enable_inlines=$enable_inlines], [AC_CACHE_VAL(unet_cv_enable_inlines, [unet_cv_enable_inlines=yes])]) AC_MSG_RESULT([$unet_cv_enable_inlines]) if test x"$unet_cv_enable_inlines" = xyes; then AC_DEFINE([FORCEINLINE], , [Force inlining for a few critical functions]) fi dnl check for /dev/null so we can use it to hold evil fd's AC_MSG_CHECKING([for /dev/null]) if test -c /dev/null ; then AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null]) AC_MSG_RESULT(yes) else AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null]) AC_MSG_RESULT(no - using devnull.log) fi dnl ** dnl ** SSL Library checks (OpenSSL) dnl ** AC_MSG_CHECKING([whether to enable OpenSSL support]) AC_ARG_ENABLE([ssl], [ --disable-ssl Disable Secure Sockets Layer support], [unet_cv_enable_ssl=$enable_ssl], [AC_CACHE_VAL(unet_cv_enable_ssl, [unet_cv_enable_ssl=yes])]) AC_MSG_RESULT([$unet_cv_enable_ssl]) if test x"$unet_cv_enable_ssl" = xyes; then AC_MSG_CHECKING([for OpenSSL includes]) AC_ARG_WITH([openssl-includes], AS_HELP_STRING([--with-openssl-includes=dir], [Specify location of OpenSSL header files (default: /usr/include)]), [base_ssl_inc=$withval], [base_ssl_inc=/usr/include]) [unet_cv_with_openssl_inc_prefix=$base_ssl_inc] AC_MSG_RESULT([$unet_cv_with_openssl_inc_prefix]) AC_DEFINE_UNQUOTED(SSL_INCLUDES_PATH, "$base_ssl_inc", [Path name used as a base for the ssl include files.]) AC_MSG_CHECKING([for OpenSSL libraries]) AC_ARG_WITH([openssl-libs], AS_HELP_STRING([--with-openssl-libs=dir], [Specify location of OpenSSL libs (default: /usr/lib)]), [unet_cv_with_openssl_prefix=$withval], [unet_cv_with_openssl_prefix=/usr/lib]) AC_MSG_RESULT([$unet_cv_with_openssl_prefix]) AC_DEFINE_UNQUOTED(SSL_LIBS_PATH, "$unet_cv_with_openssl_prefix", [Path name used as a base for the ssl lib files.]) AC_MSG_CHECKING([for Kerberos includes]) AC_ARG_WITH([kerberos-includes], AS_HELP_STRING([--with-kerb-includes=dir], [Specify location of Kerberos includes (default: /usr/kerberos/include)]), [unet_cv_with_kerberos_prefix=$withval], [unet_cv_with_kerberos_prefix=/usr/kerberos/include]) AC_MSG_RESULT([$unet_cv_with_kerberos_prefix]) save_CFLAGS=$CFLAGS save_LIBS=$LIBS CFLAGS="-I$unet_cv_with_openssl_inc_prefix -lcrypto" LIBS="-L$unet_cv_with_openssl_prefix -lssl -lcrypto" unet_cv_enable_ssl="no"; OPENSSL_LDFLAGS=""; AC_CHECK_LIB(ssl, SSL_read, [ AC_CHECK_LIB(crypto, EVP_sha256, [ AC_CHECK_HEADERS($base_ssl_inc/openssl/ssl.h $base_ssl_inc/openssl/err.h, [ unet_cv_enable_ssl="yes"; OPENSSL_LDFLAGS="-lssl -lcrypto" SSL_C=ssl.c AC_SUBST(SSL_C) ]) ]) ]) LIBS=$save_LIBS CFLAGS=$save_CFLAGS if test "x$unet_cv_enable_ssl" = xyes; then AC_DEFINE([USE_SSL], , [Define if you are using OpenSSL]) LIBS="$LIBS -L$unet_cv_with_openssl_prefix $OPENSSL_LDFLAGS" CFLAGS="$CFLAGS -I$unet_cv_with_openssl_inc_prefix -I$unet_cv_with_kerberos_prefix" else AC_MSG_ERROR([Unable to find OpenSSL with sha256 support, Maybe you need to install the openssl and libssl-dev package, or use --with-openssl-includes and --with-openssl-libs if you have openssl installed in an odd location]) fi fi dnl dnl SSL/TLS Library checks (GNU TLS) dnl if test x"$unet_cv_enable_ssl" = xyes; then dnl unet_cv_enable_ssl="no"; dnl AC_CHECK_HEADER(gnutls/gnutls.h, dnl dnl Save the current libraries so the crypto stuff isn't always dnl dnl included... dnl save_LIBS="$LIBS" dnl TEST_GNUTLS_LIBS=`libgnutls-config --libs` dnl AC_CHECK_LIB(gnutls, gnutls_init, dnl [SSLLIBS=$TEST_GNUTLS_LIBS dnl unet_cv_enable_ssl="yes"],, dnl $TEST_GNUTLS_LIBS) dnl dnl LIBS=$save_LIBS) dnl fi dnl if test "x$unet_cv_enable_ssl" = xyes; then dnl AC_DEFINE([USE_SSL], , [Define if you are using SSL/TLS]) dnl SSL_C=ssl.c dnl AC_SUBST(SSL_C) dnl LIBS="$LIBS $SSLLIBS" dnl fi AC_CHECK_HEADERS(pcreposix.h, [ ac_cv_header_pcreposix_h="yes" ] , [ ac_cv_header_pcreposix_h="no" ]) if test x"$ac_cv_header_pcreposix_h" = xyes; then TRELIBS="-lpcreposix -lpcre" AC_SUBST(TRELIBS) AC_DEFINE([PCRE_SYSTEM], , [Define if PCRE is installed in /usr]) else ac_cv_header_pcreposix_h=no AC_CHECK_HEADERS(/usr/local/include/pcreposix.h, [ ac_cv_header_pcreposix_h="yes" ] , [ ac_cv_header_pcreposix_h="no" ]) if test x"$ac_cv_header_pcreposix_h" = xyes; then CPPFLAGS="$CPPFLAGS -I/usr/local/include" TRELIBS="-L/usr/local/lib -lpcreposix -lpcre" AC_DEFINE([PCRE_SYSTEM], , [Define if PCRE is installed in /usr]) else ac_cv_header_pcreposix_h=no AC_CHECK_HEADERS(/usr/include/pcre/pcreposix.h, [ ac_cv_header_pcreposix_h="yes" ] , [ ac_cv_header_pcreposix_h="no" ]) if test x"$ac_cv_header_pcreposix_h" = xyes; then CPPFLAGS="$CPPFLAGS -I/usr/include/pcre" TRELIBS="-L/usr/lib/pcre -lpcreposix -lpcre" AC_SUBST(TRELIBS) else ac_cv_header_pcreposix_h=no AC_CHECK_HEADERS($HOME/include/pcreposix.h, [ ac_cv_header_pcreposix_h="yes" ] , [ ac_cv_header_pcreposix_h="no" ]) if test x"$ac_cv_header_pcreposix_h" = xyes; then CPPFLAGS="$CPPFLAGS -I$HOME/include" TRELIBS="-L$HOME/lib -lpcreposix -lpcre" AC_SUBST(TRELIBS) else AC_MSG_ERROR([PCRE regex library not found. To install PCRE just type 'tools/pcre_install.sh' now, to install PCRE in your home directory.]) fi fi fi fi AC_MSG_CHECKING([weather to enable subversion updating support]) AC_ARG_ENABLE([subversion], [ --enable-subversion Enable subversion will check /usr/bin and /usr/local/bin for subversion], [unet_cv_enable_svn=$enable_svn], [AC_CACHE_VAL(unet_cv_enable_svn, [unet_cv_enable_svn=yes])]) found_svn=disabled if test "x$unet_cv_enable_svn" = "xyes" ; then found_svn=no for dir in $enableval /usr/bin /usr/local/bin; do svndir="$dir" if test -f "$svndir/svn"; then found_svn=yes SVNDIR=$svndir SVNUPDATE="svnupdate" AC_SUBST(SVNDIR) AC_SUBST(SVNUPDATE) break; fi done fi AC_MSG_RESULT([$found_svn]) if test "x$found_svn" = "xno" ; then SVNUPDATE=" " AC_SUBST(SVNUPDATE) echo "" echo "Apparently you do not have subversion installed. If you want the" echo "latest updates to Nefarious IRCu then you should install this and" echo "run configure again." echo "" fi dnl --disable-devpoll check... AC_MSG_CHECKING([whether to enable the /dev/poll event engine]) AC_ARG_ENABLE([devpoll], [ --disable-devpoll Disable the /dev/poll-based engine], [unet_cv_enable_devpoll=$enable_devpoll], [AC_CACHE_VAL(unet_cv_enable_devpoll, [unet_cv_enable_devpoll=yes])]) if test x"$ac_cv_header_sys_devpoll_h" = xno; then unet_cv_enable_devpoll=no fi AC_MSG_RESULT([$unet_cv_enable_devpoll]) if test x"$unet_cv_enable_devpoll" != xno; then AC_DEFINE([USE_DEVPOLL], , [Define to enable the /dev/poll engine]) ENGINE_C="engine_devpoll.c $ENGINE_C" fi dnl --disable-kqueue check... AC_MSG_CHECKING([whether to enable the kqueue event engine]) AC_ARG_ENABLE([kqueue], [ --disable-kqueue Disable the kqueue-based engine], [unet_cv_enable_kqueue=$enable_kqueue], [AC_CACHE_VAL(unet_cv_enable_kqueue, [unet_cv_enable_kqueue=yes])]) if test x"$ac_cv_header_sys_event_h" = xno -o x"$ac_cv_func_kqueue" = xno; then unet_cv_enable_kqueue=no fi dnl ** dnl ** FIXME: KQUEUE + OpenSSL does not work with *BSD at present dnl ** if test x"$unet_cv_enable_ssl" = xyes -a x"$OSDEP_C" = xos_bsd.c; then unet_cv_enable_kqueue=no fi AC_MSG_RESULT([$unet_cv_enable_kqueue]) if test x"$unet_cv_enable_kqueue" != xno; then AC_DEFINE([USE_KQUEUE], , [Define to enable the kqueue engine]) ENGINE_C="engine_kqueue.c $ENGINE_C" fi dnl --disable-epoll check AC_CHECK_LIB(epoll, epoll_create, [have_epoll_lib=yes], have_epoll_lib=no) AC_MSG_CHECKING([whether to enable the epoll event engine]) AC_ARG_ENABLE([epoll], [ --disable-epoll Disable the epoll-based engine], [unet_cv_enable_epoll=$enable_epoll], [AC_CACHE_VAL(unet_cv_enable_epoll, [unet_cv_enable_epoll=yes])]) if test x"$ac_cv_header_sys_epoll_h" = xno -o x"$ac_cv_func_epoll" = xno -o x"$have_epoll_lib" = xno; then unet_cv_enable_epoll=no fi AC_MSG_RESULT([$unet_cv_enable_epoll]) dnl If we have the header and user has not refused epoll, we still need dnl to check whether the functions are properly defined. if test x"$unet_cv_enable_epoll" != xno; then AC_MSG_CHECKING([whether epoll functions are properly defined]) AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [epoll_create(10);])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) AC_DEFINE([EPOLL_NEED_BODY],,[Define to implement epoll system calls])]) AC_DEFINE([USE_EPOLL], , [Define to enable the epoll engine]) ENGINE_C="engine_epoll.c $ENGINE_C" fi dnl How to copy one va_list to another? AC_CACHE_CHECK([for va_copy], unet_cv_c_va_copy, [AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include ], [va_list ap1, ap2; va_copy(ap1, ap2);])], [unet_cv_c_va_copy="yes"], [unet_cv_c_va_copy="no"] )]) if test "$unet_cv_c_va_copy" = "yes" ; then AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy]) fi AC_CACHE_CHECK([for __va_copy], unet_cv_c___va_copy, [AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include ], [va_list ap1, ap2; __va_copy(ap1, ap2);])], [unet_cv_c___va_copy="yes"], [unet_cv_c___va_copy="no"] )]) if test "$unet_cv_c___va_copy" = "yes" ; then AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy]) fi dnl --with-symlink lets us set the name of the symlink; defaults to "ircd" AC_MSG_CHECKING([what name to give the symlink]) AC_ARG_WITH([symlink], [ --with-symlink=name Name to give the symlink; if name is "no," no symlink will be created.], [unet_cv_with_symlink=$with_symlink], [AC_CACHE_VAL(unet_cv_with_symlink, [unet_cv_with_symlink="ircd"])]) if test x"$unet_cv_with_symlink" = xyes; then unet_cv_with_symlink="ircd" fi AC_MSG_RESULT([$unet_cv_with_symlink]) if test x"$unet_cv_with_symlink" = xno; then INSTALL_RULE=install-no-symlink SYMLINK= else INSTALL_RULE=install-with-symlink SYMLINK=$unet_cv_with_symlink fi AC_SUBST(INSTALL_RULE) AC_SUBST(SYMLINK) dnl --with-mode lets us set the permissions on the binary AC_MSG_CHECKING([what permissions to set on the installed binary]) AC_ARG_WITH([mode], [ --with-mode=mode Permissions (in octal) to give the binary], [unet_cv_with_mode=$with_mode], [AC_CACHE_VAL(unet_cv_with_mode, [unet_cv_with_mode=711])]) if test x"$unet_cv_with_mode" = xyes -o x"$unet_cv_with_mode" = xno; then unet_cv_with_mode=711 fi AC_MSG_RESULT([$unet_cv_with_mode]) IRCDMODE=$unet_cv_with_mode AC_SUBST(IRCDMODE) dnl --with-owner lets us set the owner of the binary changequote(,)dnl unet_uid=`id | sed -e 's/.*uid=[0-9]*(//' -e 's/).*//' 2> /dev/null` changequote([,])dnl AC_MSG_CHECKING([which user should own the installed binary]) AC_ARG_WITH([owner], [ --with-owner=owner Specify owner of the installed binary], [unet_cv_with_owner=$with_owner], [AC_CACHE_VAL(unet_cv_with_owner, [unet_cv_with_owner=$unet_uid])]) if test x"$unet_cv_with_owner" = xyes -o x"$unet_cv_with_owner" = xno; then unet_cv_with_owner=$unet_uid fi AC_MSG_RESULT([$unet_cv_with_owner]) IRCDOWN=$unet_cv_with_owner AC_SUBST(IRCDOWN) dnl --with-group lets us set the group owner of the binary changequote(,)dnl unet_gid=`id | sed -e 's/.*gid=[0-9]*(//' -e 's/).*//' 2> /dev/null` changequote([,])dnl AC_MSG_CHECKING([which group should own the installed binary]) AC_ARG_WITH([group], [ --with-group=group Specify group owner of the installed binary], [unet_cv_with_group=$with_group], [AC_CACHE_VAL(unet_cv_with_group, [unet_cv_with_group=$unet_gid])]) if test x"$unet_cv_with_group" = xyes -o x"$unet_cv_with_group" = xno; then unet_cv_with_group=$unet_gid fi AC_MSG_RESULT([$unet_cv_with_group]) IRCDGRP=$unet_cv_with_group AC_SUBST(IRCDGRP) dnl --with-domain lets us set the domain name for some statistics-gathering unet_domain= if test -f /etc/resolv.conf; then unet_domain=`awk '/^domain/ { print $2; exit }' /etc/resolv.conf` if test x"$unet_domain" = x; then unet_domain=`awk '/^search/ { print $2; exit }' /etc/resolv.conf` fi fi AC_MSG_CHECKING([for site domain name]) AC_ARG_WITH([domain], [ --with-domain=domain Domain name to use in local statistics gathering], [unet_cv_with_domain=$with_domain], [AC_CACHE_VAL(unet_cv_with_domain, [unet_cv_with_domain=$unet_domain])]) if test x"$unet_cv_with_domain" = xyes -o x"$unet_cv_with_domain" = xno; then unet_cv_with_domain=$unet_domain fi if test x"$unet_cv_with_domain" = xno; then AC_MSG_ERROR([Unable to determine server DNS domain; use --with-domain to set it]) fi AC_MSG_RESULT([$unet_cv_with_domain]) AC_DEFINE_UNQUOTED(DOMAINNAME, "*$unet_cv_with_domain", [Domain name to be used for some statistics gathering]) dnl --with-chroot lets us define a directory that we are going to be using dnl as the root of our filesystem AC_MSG_CHECKING([if chroot operation is desired]) AC_ARG_WITH([chroot], [ --with-chroot=dir Specify that the server will be operated under a different root directory given by dir. See doc/readme.chroot for more information.], [unet_cv_with_chroot=$with_chroot], [AC_CACHE_VAL(unet_cv_with_chroot, [unet_cv_with_chroot=no])]) if test x"$unet_cv_with_chroot" = xyes; then AC_MSG_ERROR([--with-chroot given with no directory. See doc/readme.chroot.]) fi # Ensure there are no trailing /'s to mess us up unet_cv_with_chroot=`echo "$unet_cv_with_chroot" | sed 's%/*$%%'` AC_MSG_RESULT([$unet_cv_with_chroot]) dnl Determine some default directory names dnl dnl HACK WARNING: We are referencing an autoconf internal variable. This is dnl the only way to figure out what value $prefix will have when we go to do dnl the install--and the only way we can stick that value in our definitions dnl of SPATH, etc. # Deal with the annoying value "NONE" here unet_save_prefix=$prefix if test x"$prefix" = xNONE; then prefix=$ac_default_prefix else prefix=$prefix fi unet_save_exec_prefix=$exec_prefix if test x"$exec_prefix" = xNONE; then exec_prefix=$prefix else exec_prefix=$exec_prefix fi # Obtain the actual interesting directories unet_bindir=`eval echo "$bindir"` unet_libdir=`eval echo "$libdir"` # Restore the original settings of $prefix and $exec_prefix prefix=$unet_save_prefix exec_prefix=$unet_save_exec_prefix dnl Now compute the name of the binary and verify that it will work under dnl chroot operation AC_MSG_CHECKING([where the binary will be for /restart]) if test x"$unet_cv_with_symlink" = xno; then unet_spath="$unet_bindir/ircd" else unet_spath="$unet_bindir/$unet_cv_with_symlink" fi AC_MSG_RESULT([$unet_spath]) if test x"$unet_cv_with_chroot" != xno; then if echo "$unet_spath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then unet_spath=`echo "$unet_spath" | sed "s%^$unet_cv_with_chroot%%"` else AC_MSG_WARN([Binary $unet_spath not relative to root directory $unet_cv_with_chroot; restarts will probably fail]) fi fi AC_DEFINE_UNQUOTED(SPATH, "$unet_spath", [Path to executable for restarts]) dnl --with-dpath sets the all-important DPATH AC_MSG_CHECKING([what the data directory should be]) AC_ARG_WITH([dpath], [ --with-dpath=dir Directory for all server data files], [unet_cv_with_dpath=$with_dpath], [AC_CACHE_VAL(unet_cv_with_dpath, [unet_cv_with_dpath=$unet_libdir])]) if test x"$unet_cv_with_dpath" = xyes -o x"$unet_cv_with_dpath" = xno; then unet_cv_with_dpath=$unet_libdir fi # Ensure there are no trailing /'s to mess us up unet_cv_with_dpath=`echo "$unet_cv_with_dpath" | sed 's%/*$%%'` AC_MSG_RESULT([$unet_cv_with_dpath]) if test x"$unet_cv_with_chroot" != xno; then if echo "$unet_cv_with_dpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then unet_dpath=`echo "$unet_cv_with_dpath" | sed "s%^$unet_cv_with_chroot%%"` else AC_MSG_ERROR([Data directory $unet_cv_with_dpath not relative to root directory $unet_cv_with_chroot]) fi else unet_dpath=$unet_cv_with_dpath fi AC_DEFINE_UNQUOTED(DPATH, "$unet_dpath", [Path to data directory]) DPATH=$unet_cv_with_dpath AC_SUBST(DPATH) dnl --with-cpath allows us to specify the configuration file AC_MSG_CHECKING([where the default configuration file resides]) AC_ARG_WITH([cpath], [ --with-cpath=file Set server configuration file], [unet_cv_with_cpath=$with_cpath], [AC_CACHE_VAL(unet_cv_with_cpath, [unet_cv_with_cpath="ircd.conf"])]) if test x"$unet_cv_with_cpath" = xyes -o x"$unet_cv_with_cpath" = xno; then unet_cv_with_cpath="ircd.conf" fi AC_MSG_RESULT([$unet_cv_with_cpath]) if echo "$unet_cv_with_cpath" | grep '^/' > /dev/null 2>&1; then # Absolute path; check against chroot stuff if test x"$unet_cv_with_chroot" != xno; then if echo "$unet_cv_with_cpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then unet_cpath=`echo "$unet_cv_with_cpath" | sed "s%^$unet_cv_with_chroot%%"` else AC_MSG_ERROR([Configuration file $unet_cv_with_cpath not relative to root directory $unet_cv_with_chroot]) fi else unet_cpath=$unet_cv_with_cpath fi else unet_cpath=$unet_cv_with_cpath fi AC_DEFINE_UNQUOTED(CPATH, "$unet_cpath", [Configuration file name]) dnl --with-lpath allows us to specify the default debugging log file AC_MSG_CHECKING([where to put the debugging log if debugging enabled]) AC_ARG_WITH([lpath], [ --with-lpath=file Set the debugging log file], [unet_cv_with_lpath=$with_lpath], [AC_CACHE_VAL(unet_cv_with_lpath, [unet_cv_with_lpath="ircd.log"])]) if test x"$unet_cv_with_lpath" = xyes -o x"$unet_cv_with_lpath" = xno; then unet_cv_with_lpath="ircd.log" fi AC_MSG_RESULT([$unet_cv_with_lpath]) if echo "$unet_cv_with_lpath" | grep '^/' > /dev/null 2>&1; then # Absolute path; check against chroot stuff if test x"$unet_cv_with_chroot" != xno; then if echo "$unet_cv_with_lpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then unet_lpath=`echo "$unet_cv_with_lpath" | sed "s%^$unet_cv_with_chroot%%"` else AC_MSG_WARN([Log file $unet_cv_with_lpath not relative to root directory $unet_cv_with_chroot; using default ircd.log instead]) unet_cv_with_lpath="ircd.log" unet_lpath="ircd.log" fi else unet_lpath=$unet_cv_with_lpath fi else unet_lpath=$unet_cv_with_lpath fi AC_DEFINE_UNQUOTED(LPATH, "$unet_lpath", [Path to debugging log file]) dnl --with-maxcon allows us to set the maximum connections unet_maxcon=`ulimit -Hn` if test x"$unet_maxcon" = xunlimited; then unet_maxcon=`ulimit -Sn` fi unet_maxcon=`expr $unet_maxcon - 4` AC_MSG_CHECKING([max connections]) AC_ARG_WITH([maxcon], [ --with-maxcon=maxcon Maximum number of connections server will accept], [unet_cv_with_maxcon=$with_maxcon], [AC_CACHE_VAL(unet_cv_with_maxcon, [unet_cv_with_maxcon=$unet_maxcon])]) if test x"$unet_cv_with_maxcon" = xyes -o x"$unet_cv_with_maxcon" = xno; then unet_cv_with_maxcon=$unet_maxcon fi AC_MSG_RESULT([$unet_cv_with_maxcon]) AC_DEFINE_UNQUOTED(MAXCONNECTIONS, $unet_cv_with_maxcon, [Maximum number of network connections]) dnl Enable humor AC_MSG_CHECKING([sense of humor]) AC_ARG_WITH([sense-of-humor], [ --with-sense-of-humor Specify this if you have a sense of humor], [unet_cv_with_sense_of_humor=$with_sense_of_humor], [AC_CACHE_VAL(unet_cv_with_sense_of_humor, [unet_cv_with_sense_of_humor=no])]) AC_MSG_RESULT([$unet_cv_with_sense_of_humor]) if test x"$unet_cv_with_sense_of_humor" = xyes; then AC_CHECK_LIB(Fridge,mass_quantities_of_beer) AC_CHECK_LIB(Fridge,mass_quantities_of_any_alcohol, , [ echo "Warning: No alcohol was found in your refrigerator." echo " We highly suggest that you rectify this situation immediately." ]) AC_CHECK_LIB(Kenny, life_signs, , [ echo " Oh my god, they killed Kenny! You bastards!" AC_DEFINE([HAVE_HUMOR], , [Does user have a sense of humor?]) ]) fi if test "$host_os" = "cygwin"; then LDFLAGS="-Wl,--enable-auto-import" fi dnl Finally really generate all output files: AC_CONFIG_FILES([Makefile help/Makefile ircd/Makefile doc/Makefile]) AC_CONFIG_COMMANDS([default],[[echo timestamp > stamp-h]],[[]]) AC_OUTPUT