dnl Process this file with autoconf to produce a configure script. dnl rewritten for my own personal sanity, and for more extensive dnl checks - feb04 -epi AC_INIT AC_CONFIG_HEADER(include/setup.h) PACKAGE=bahamut-release VERSION=1.8 AC_SUBST(PACKAGE) AC_SUBST(VERSION) # autoheader templates AH_TEMPLATE([BROKEN_FD_SETSIZE],[If on a system with a broken FD_SETSIZE]) AH_TEMPLATE([HAVE_ENCRYPTION_ON],[If we support encryption]) AH_TEMPLATE([HAVE_MINMAX],[If we have the MIN and MAX macros]) AH_TEMPLATE([OS_SOLARIS2],[If we're running on Solaris]) AH_TEMPLATE([OS_SOLARIS],[Not quite sure why we have two of these]) AH_TEMPLATE([SYS_ERRLIST_DECLARED],[If the sys_errlist array is defined]) AH_TEMPLATE([USE_HOOKMODULES],[Do we support loadable modules]) AH_TEMPLATE([MAXCONNECTIONS],[Maximum Connections we allow]) AH_TEMPLATE([NEED_EPOLL_DEFS],[epoll behavior]) AH_TEMPLATE([AIX],[AIX support]) AH_TEMPLATE([WRITEV_IOV],[Maxmimum number of iovecs supported by writev()]) dnl Put our options of here for ease of reading. AC_ARG_ENABLE(hookmodules, [ --disable-hookmodules disable support for loadable hook modules],, [ check_hmodules="yes" ]) AC_ARG_ENABLE(openssl, [ --enable-openssl[=DIR] Enable OpenSSL support (DIR optional). --disable-openssl Disable OpenSSL support. ], [ cf_enable_openssl=$enableval ], [ cf_enable_openssl="auto" ]) AC_ARG_WITH(socketengine, [ --with-socketengine=TYPE Set the socketengine type. Choices are: kqueue poll select ], [ check_sengine=$withval ], [ check_sengine="yes" ]) AC_ARG_WITH(maxconnections, [ --with-maxconnections=NUMBER Set the maximum number of sockets.], [ check_maxconnections=$withval ], [ check_maxconnections="auto" ]) dnl ------------------------------------------------------------------- # =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html # =========================================================================== # # SYNOPSIS # # AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] # # DESCRIPTION # # Try to find a compiler option that enables most reasonable warnings. # # For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The # result is added to the shellvar being CFLAGS by default. # # Currently this macro knows about GCC, Solaris C compiler, Digital Unix C # compiler, C for AIX Compiler, HP-UX C compiler, IRIX C compiler, NEC # SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos 10.0.0.8) C # compiler. # # - $1 shell-variable-to-add-to : CFLAGS # - $2 add-value-if-not-found : nothing # - $3 action-if-found : add value to shellvariable # - $4 action-if-not-found : nothing # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], VAR,[VAR="no, unknown" AC_LANG_PUSH([C]) ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl in "-pedantic % -Wall" dnl GCC "-xstrconst % -v" dnl Solaris C "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX "-ansi -ansiE % -fullwarn" dnl IRIX "+ESlit % +w1" dnl HP-UX C "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) "-h conform % -h msglevel 2" dnl Cray C (Unicos) # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break],[]) done FLAGS="$ac_save_[]FLAGS" AC_LANG_POP([]) ]) case ".$VAR" in .ok|.ok,*) m4_ifvaln($3,$3) ;; .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; *) m4_ifvaln($3,$3,[ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" fi ]) ;; esac AS_VAR_POPDEF([VAR])dnl AS_VAR_POPDEF([FLAGS])dnl ]) dnl the only difference - the LANG selection... and the default FLAGS AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl AS_VAR_PUSHDEF([VAR],[ax_cv_cxxflags_warn_all])dnl AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], VAR,[VAR="no, unknown" AC_LANG_PUSH([C++]) ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl in "-pedantic % -Wall" dnl GCC "-xstrconst % -v" dnl Solaris C "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX "-ansi -ansiE % -fullwarn" dnl IRIX "+ESlit % +w1" dnl HP-UX C "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) "-h conform % -h msglevel 2" dnl Cray C (Unicos) # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break],[]) done FLAGS="$ac_save_[]FLAGS" AC_LANG_POP([]) ]) case ".$VAR" in .ok|.ok,*) m4_ifvaln($3,$3) ;; .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; *) m4_ifvaln($3,$3,[ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" fi ]) ;; esac AS_VAR_POPDEF([VAR])dnl AS_VAR_POPDEF([FLAGS])dnl ]) dnl implementation tactics: dnl the for-argument contains a list of options. The first part of dnl these does only exist to detect the compiler - usually it is dnl a global option to enable -ansi or -extrawarnings. All other dnl compilers will fail about it. That was needed since a lot of dnl compilers will give false positives for some option-syntax dnl like -Woption or -Xoption as they think of it is a pass-through dnl to later compile stages or something. The "%" is used as a dnl delimimiter. A non-option comment can be given after "%%" marks dnl which will be shown but not added to the respective C/CXXFLAGS. dnl ------------------------------------------------------------------- # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's compiler # or gives an error. (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # INPUT gives an alternative input source to AC_COMPILE_IFELSE. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_VAR_IF(CACHEVAR,yes, [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS dnl ------------------------------------------------------------------- # =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_have_epoll.html # =========================================================================== # # SYNOPSIS # # AX_HAVE_EPOLL([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # AX_HAVE_EPOLL_PWAIT([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # DESCRIPTION # # This macro determines whether the system supports the epoll I/O event # interface. A neat usage example would be: # # AX_HAVE_EPOLL( # [AX_CONFIG_FEATURE_ENABLE(epoll)], # [AX_CONFIG_FEATURE_DISABLE(epoll)]) # AX_CONFIG_FEATURE( # [epoll], [This platform supports epoll(7)], # [HAVE_EPOLL], [This platform supports epoll(7).]) # # The epoll interface was added to the Linux kernel in version 2.5.45, and # the macro verifies that a kernel newer than this is installed. This # check is somewhat unreliable if doesn't match the # running kernel, but it is necessary regardless, because glibc comes with # stubs for the epoll_create(), epoll_wait(), etc. that allow programs to # compile and link even if the kernel is too old; the problem would then # be detected only at runtime. # # Linux kernel version 2.6.19 adds the epoll_pwait() call in addition to # epoll_wait(). The availability of that function can be tested with the # second macro. Generally speaking, it is safe to assume that # AX_HAVE_EPOLL would succeed if AX_HAVE_EPOLL_PWAIT has, but not the # other way round. # # LICENSE # # Copyright (c) 2008 Peter Simons # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. AC_DEFUN([AX_HAVE_EPOLL], [dnl ax_have_epoll_cppflags="${CPPFLAGS}" AC_CHECK_HEADER([linux/version.h], [CPPFLAGS="${CPPFLAGS} -DHAVE_LINUX_VERSION_H"]) AC_MSG_CHECKING([for Linux epoll(7) interface]) AC_CACHE_VAL([ax_cv_have_epoll], [dnl AC_LINK_IFELSE([dnl AC_LANG_PROGRAM([dnl #include #ifdef HAVE_LINUX_VERSION_H # include # if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,45) # error linux kernel version is too old to have epoll # endif #endif ], [dnl int fd, rc; struct epoll_event ev; fd = epoll_create(128); rc = epoll_wait(fd, &ev, 1, 0);])], [ax_cv_have_epoll=yes], [ax_cv_have_epoll=no])]) CPPFLAGS="${ax_have_epoll_cppflags}" AS_IF([test "${ax_cv_have_epoll}" = "yes"], [AC_MSG_RESULT([yes]) $1],[AC_MSG_RESULT([no]) $2]) ])dnl AC_DEFUN([AX_HAVE_EPOLL_PWAIT], [dnl ax_have_epoll_cppflags="${CPPFLAGS}" AC_CHECK_HEADER([linux/version.h], [CPPFLAGS="${CPPFLAGS} -DHAVE_LINUX_VERSION_H"]) AC_MSG_CHECKING([for Linux epoll(7) interface with signals extension]) AC_CACHE_VAL([ax_cv_have_epoll_pwait], [dnl AC_LINK_IFELSE([dnl AC_LANG_PROGRAM([dnl #ifdef HAVE_LINUX_VERSION_H # include # if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) # error linux kernel version is too old to have epoll_pwait # endif #endif #include #include ], [dnl int fd, rc; struct epoll_event ev; fd = epoll_create(128); rc = epoll_wait(fd, &ev, 1, 0); rc = epoll_pwait(fd, &ev, 1, 0, (sigset_t const *)(0));])], [ax_cv_have_epoll_pwait=yes], [ax_cv_have_epoll_pwait=no])]) CPPFLAGS="${ax_have_epoll_cppflags}" AS_IF([test "${ax_cv_have_epoll_pwait}" = "yes"], [AC_MSG_RESULT([yes]) $1],[AC_MSG_RESULT([no]) $2]) ])dnl dnl ------------------------------------------------- dnl Checks for programs. AC_PROG_CC AX_CFLAGS_WARN_ALL AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"]) AX_CHECK_COMPILE_FLAG([-fgnu89-inline], [CFLAGS="$CFLAGS -fgnu89-inline"]) AC_CANONICAL_TARGET AC_SEARCH_LIBS([strerror],[cposix]) AC_PROG_MAKE_SET AC_PATH_PROG(RM, rm) AC_PATH_PROG(CP, cp) AC_PATH_PROG(MV, mv) AC_PATH_PROG(SED, sed) AC_PROG_INSTALL AC_C_INLINE dnl Checks for libraries. dnl Replace `main' with a function in -lnsl: AC_CHECK_LIB(nsl, gethostbyname) AC_CHECK_FUNC(res_mkquery,, AC_CHECK_LIB(resolv, res_mkquery)) AC_CHECK_FUNC(__res_mkquery,, AC_CHECK_LIB(resolv, __res_mkquery)) AC_CHECK_LIB(socket, socket, zlib) AC_CHECK_FUNC(crypt,, AC_CHECK_LIB(descrypt, crypt,,AC_CHECK_LIB(crypt, crypt,,))) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h limits.h malloc.h netdb.h netinet/in.h stddef.h]) AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/file.h sys/ioctl.h]) AC_CHECK_HEADERS([sys/param.h sys/socket.h sys/time.h syslog.h unistd.h]) AC_CHECK_HEADERS([zlib.h]) AC_CHECK_HEADERS(inttypes.h sys/resource.h errno.h stdlib.h stddef.h getopt.h) AC_MSG_CHECKING(MIN and MAX definition) AC_EGREP_CPP(yes, [ #if defined( HAVE_SYS_PARAM_H ) #include #ifdef MIN yes #endif #endif ], AC_DEFINE(HAVE_MINMAX) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_CHECK_FUNCS([alarm dup2 gethostbyname gethostname getpass gettimeofday]) AC_CHECK_FUNCS([inet_ntoa isascii memmove memset munmap setenv socket]) AC_CHECK_FUNCS([strcasecmp strchr strdup strerror strncasecmp strrchr strtol]) AC_CHECK_FUNCS([strtoul index strerror strtoken strtok inet_addr inet_netof]) AC_CHECK_FUNCS([inet_aton gettimeofday lrand48 sigaction bzero bcmp bcopy]) AC_CHECK_FUNCS([dn_skipname __dn_skipname getrusage times break]) dnl check for various OSes case "$target" in *-solaris2*) solaris2="yes" AC_DEFINE(OS_SOLARIS2) AC_DEFINE(OS_SOLARIS) AC_DEFINE_UNQUOTED(WRITEV_IOV, 16) ;; *-freebsd*) freebsd="yes" AC_DEFINE_UNQUOTED(WRITEV_IOV, 32) ;; *-netbsd*) AC_DEFINE_UNQUOTED(WRITEV_IOV, 32) ;; *-openbsd*) AC_DEFINE_UNQUOTED(WRITEV_IOV, 32) ;; *-linux*) linux="yes" AC_DEFINE_UNQUOTED(WRITEV_IOV, 32) ;; *aix*) aix="yes" AC_DEFINE(AIX) ;; *-darwin*) check_hmodules="no" AC_DEFINE_UNQUOTED(WRITEV_IOV, 32) ;; esac dnl Checks for loadable hook module support set_hmodules="disabled" if test "$check_hmodules" = "yes"; then AC_CHECK_LIB(dl, dlopen) AC_CHECK_HEADER(dlfcn.h) AC_CHECK_FUNCS(dlopen dlsym, [set_hmodules="enabled"]) if test "$set_hmodules" = "enabled"; then AC_DEFINE(USE_HOOKMODULES) MOD_LDFLAGS="-Wl,-export-dynamic" fi fi dnl Check for sys_errlist dnl Stolen from BitchX AC_MSG_CHECKING(for sys_errlist declaration) AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include #include main() { char *s = sys_errlist[0]; exit(0); } ]])],[AC_MSG_RESULT(yes) AC_DEFINE(SYS_ERRLIST_DECLARED)],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(cross compiling)]) dnl Openssl checks - combination of our old way and the hybrid7 method save_LIBS="$LIBS" AC_MSG_CHECKING(for OpenSSL) if test "X$cf_enable_openssl" != "Xno" ; then cf_openssl_basedir="" if test "X$cf_enable_openssl" != "Xauto" && test "X$cf_enable_openssl" != "Xyes"; then dnl Support for --enable-openssl=/some/place cf_openssl_basedir="${cf_enable_openssl}" else dnl Do the auto-probe here. Check some common directory paths. for dirs in $HOME/openssl /usr/local/ssl /usr/pkg /usr/local /usr/lib /usr/lib/ssl\ /opt /opt/openssl /usr/local/openssl ; do if test -f "${dirs}/include/openssl/opensslv.h" ; then cf_openssl_basedir="${dirs}" break fi done unset dirs fi dnl Now check cf_openssl_found to see if we found anything. if test "X$cf_openssl_basedir" != "X" ; then if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then SSL_INCLUDES="-I${cf_openssl_basedir}/include" SSL_LDFLAGS="-L${cf_openssl_basedir}/lib" if test "$cf_openssl_basedir" = "$HOME/openssl"; then SSL_LDFLAGS="-L${cf_openssl_basedir}/lib -Wl,-rpath,${cf_openssl_basedir}/lib" fi else dnl OpenSSL wasn't found in the directory specified. Naughty dnl administrator... cf_openssl_basedir="" fi else dnl Check for stock FreeBSD 4.x and 5.x systems, since their files dnl are in /usr/include and /usr/lib. In this case, we don't want to dnl change INCLUDES or LIBS, but still want to enable OpenSSL. dnl We can't do this check above, because some people want two versions dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl) dnl and they want /usr/local/ssl to have preference. if test -f "/usr/include/openssl/opensslv.h" ; then cf_openssl_basedir="/usr" fi fi dnl If we have a basedir defined, then everything is okay. Otherwise, dnl we have a problem. if test "X$cf_openssl_basedir" != "X" ; then CPPFLAGS="$CPPFLAGS $SSL_INCLUDES" LDFLAGS="$LDFLAGS $SSL_LDFLAGS" LIBS="-lssl -lcrypto $save_LIBS" AC_MSG_RESULT($cf_openssl_basedir) cf_enable_openssl="yes" encryption="enabled" AC_DEFINE(HAVE_ENCRYPTION_ON) ENCRYPT_SRC="rc4.c dh.c libcrypto-compat.c" AC_SUBST(ENCRYPT_SRC) else AC_MSG_RESULT(not found. Please check your path.) cf_enable_openssl="no" encryption="disabled" fi unset cf_openssl_basedir else dnl If --disable-openssl was specified encryption="disabled" AC_MSG_RESULT(disabled) fi unset save_LIBS dnl end of openssl library test dnl select a socket engine if test "$check_sengine" = "yes"; then engine="select" if test "$freebsd" = "yes"; then AC_CHECK_FUNC(kevent, [ engine="kqueue" ], ) elif test "$solaris2" = "yes"; then engine="poll" AC_CHECK_HEADER(sys/devpoll.h, engine="devpoll", ) elif test "$linux" = "yes"; then AC_CHECK_FUNC(poll, [ engine="poll" ], ) AX_HAVE_EPOLL([ engine="epoll" ], ) AC_CHECK_HEADER(sys/epoll.h, HAVE_EPOLL_H=yes, HAVE_EPOLL_H=no) # AC_CHECK_LIB(epoll, epoll_create, # [LIBS="$LIBS -lepoll"; have_epoll_lib="yes"; engine="epoll"], # have_epoll_lib="no") # if test "$HAVE_EPOLL_H $have_epoll_lib" = "yes no"; then # AC_MSG_CHECKING(for epoll_create [without -lepoll]) # AC_RUN_IFELSE([AC_LANG_SOURCE([[ # #include # #include # #include # # #include # # _syscall1(int, epoll_create, int, size) # # int main(int argc, char **argv) { return epoll_create(5) < 1; } # ]])],[have_epoll_lib="yes"],[have_epoll_lib="no"],[]) # AC_MSG_RESULT($have_epoll_lib) # if test "$have_epoll_lib" = "yes"; then # AC_DEFINE(NEED_EPOLL_DEFS) # fi # fi # if test "$HAVE_EPOLL_H $have_epoll_lib" = "yes yes"; then # engine="epoll"; # fi else AC_CHECK_FUNC(poll, [ engine="poll"], ) fi elif test "$check_sengine" = "kqueue"; then AC_CHECK_FUNC(kevent, [ engine="kqueue" ], ) if test "X$engine" = "X"; then AC_MSG_NOTICE() AC_MSG_NOTICE(kqueue not supported on this platform!) AC_MSG_ERROR() fi AC_MSG_NOTICE(setting socketengine type to kqueue) elif test "$check_sengine" = "poll"; then AC_CHECK_FUNC(poll, [ engine="poll" ], ) if test "X$engine" = "X"; then AC_MSG_NOTICE() AC_MSG_NOTICE(poll not supported on this platform!) AC_MSG_ERROR() fi AC_MSG_NOTICE(setting socketengine type to poll) elif test "$check_sengine" = "devpoll"; then AC_CHECK_HEADER(sys/devpoll.h, engine="devpoll", ) if test "X$engine" = "X"; then AC_MSG_NOTICE() AC_MSG_NOTICE(/dev/poll not supported on this system) AC_MSG_ERROR() fi AC_MSG_NOTICE(setting socketengine to devpoll) elif test "$check_sengine" = "epoll"; then AC_CHECK_HEADER(sys/epoll.h, HAVE_EPOLL_H=yes, HAVE_EPOLL_H=no) AC_CHECK_LIB(epoll, epoll_create, [LIBS="$LIBS -lepoll"; have_epoll_lib="yes"; engine="epoll"], have_epoll_lib="no") if test "$HAVE_EPOLL_H $have_epoll_lib" = "yes no"; then AC_MSG_CHECKING(for epoll_create [without -lepoll]) AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include #include #include _syscall1(int, epoll_create, int, size) int main(int argc, char **argv) { return epoll_create(5) < 1; } ]])],[have_epoll_lib="yes"],[have_epoll_lib="no"],[]) AC_MSG_RESULT($have_epoll_lib) if test "$have_epoll_lib" = "yes"; then AC_DEFINE(NEED_EPOLL_DEFS) fi fi if test "$HAVE_EPOLL_H $have_epoll_lib" != "yes yes"; then AC_MSG_NOTICE() AC_MSG_ERROR(epoll is not supported on this machine) AC_MSG_ERROR() fi AC_MSG_NOTICE(setting socketengine type to epoll) engine="epoll"; elif test "$check_sengine" = "select"; then AC_MSG_NOTICE(setting socketengine type to select.. for some stupid reason) engine="select" else AC_MSG_NOTICE() AC_MSG_NOTICE(socket engine type incorrect!) AC_MSG_ERROR() fi SENGINE="socketengine_$engine.c" dnl Check to see if we have a broken FD_SETSIZE if test $engine = "select"; then AC_MSG_CHECKING(to see if FD_SETSIZE is broken) AC_RUN_IFELSE([AC_LANG_SOURCE([[ #define FD_SETSIZE 666 #include #include int main() { if(FD_SETSIZE != 666) exit(1); exit(0); } ]])],[AC_MSG_RESULT(no)],[ AC_MSG_RESULT(YES) AC_MSG_WARN(FD_SETSIZE is hard set by your operating system) AC_MSG_WARN(MAXCONNECTIONS must be no higher than the hardwired FD_SETSIZE) AC_DEFINE(BROKEN_FD_SETSIZE) broken_fd_setsize="yes" ],[AC_MSG_RESULT(can't tell)]) fi if test "$solaris2" != "yes" && test "$aix" != "yes" && test "$set_hmodules" = "enabled"; then LDFLAGS="$LDFLAGS $MOD_LDFLAGS" fi if test "$check_maxconnections" = "auto"; then AC_MSG_CHECKING(Maximum file descriptors); AC_CACHE_VAL(bh_cv_maxconnections, [ AC_LANG_CONFTEST( [AC_LANG_SOURCE([[ #include #include #include #include #ifdef RLIMIT_FDMAX #define RLIMIT_FD_MAX RLIMIT_FDMAX #else #ifdef RLIMIT_NOFILE #define RLIMIT_FD_MAX RLIMIT_NOFILE #else #ifdef RLIMIT_OPEN_MAX #define RLIMIT_FD_MAX RLIMIT_OPEN_MAX #else #undef RLIMIT_FD_MAX #endif #endif #endif int main() { #ifndef BROKEN_FD_SETSIZE #ifdef RLIMIT_FD_MAX struct rlimit limit; if(!getrlimit(RLIMIT_FD_MAX, &limit)) { if(limit.rlim_max > 32768) printf("32768"); else printf("%ld", (long) limit.rlim_max); } else #endif printf("256"); #else printf("%d", FD_SETSIZE); #endif return 0; } ]]) ]) $CC -o conftest conftest.c >/dev/null 2>&1 maxconnections=`./conftest` AC_MSG_RESULT($maxconnections) $RM -f conftest conftest.c ]) AC_DEFINE_UNQUOTED(MAXCONNECTIONS, ${maxconnections}) else maxconnections=$check_maxconnections AC_DEFINE_UNQUOTED(MAXCONNECTIONS, ${maxconnections}) fi # zlib test # ripped from http://autoconf-archive.cryp.to/check_zlib.html # ZLIB_HOME=/usr/local if test ! -f "${ZLIB_HOME}/include/zlib.h" then ZLIB_HOME=/usr fi if test -n "${ZLIB_HOME}" then ZLIB_OLD_CPPFLAGS="$CPPFLAGS" ZLIB_OLD_LDFLAGS="$LDFLAGS" if test "x$ZLIB_HOME" = "x/usr"; then : else CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include" LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" fi AC_LANG_PUSH([C]) AC_CHECK_LIB(z, inflateEnd, [zlib_cv_libz=yes], [zlib_cv_libz=no]) AC_CHECK_HEADER(zlib.h, [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no]) AC_LANG_POP([]) if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes" then # # If both library and header were found, use them # AC_CHECK_LIB(z, inflateEnd) AC_MSG_CHECKING(zlib in ${ZLIB_HOME}) AC_MSG_RESULT(ok) else # # If either header or library was not found, revert and bomb # AC_MSG_CHECKING(zlib in ${ZLIB_HOME}) CPPFLAGS="$ZLIB_OLD_CPPFLAGS" LDFLAGS="$ZLIB_OLD_LDFLAGS" AC_MSG_RESULT(failed) AC_MSG_ERROR(either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib) fi fi if test "$engine" = "select" && test "$broken_fd_setsize" != "yes"; then CFLAGS="$CFLAGS -DFD_SETSIZE=$maxconnections" fi if test $prefix = NONE; then prefix=${HOME}/ircd if test -f "${HOME}/bahamut/ircd" ; then prefix=${HOME}/bahamut fi if test -f "${HOME}/dalnet/ircd" ; then prefix=${HOME}/dalnet fi fi INSTALL_DIR="${prefix}" AC_SUBST(LIBS) AC_SUBST(SENGINE) AC_SUBST(INSTALL_DIR) AC_CONFIG_FILES([Makefile src/Makefile tools/Makefile doc/Makefile]) AC_OUTPUT echo "" echo " ******* Bahamut Configuration Settings *******" echo " System Build Type: $target" echo " Socket Engine Type: $engine" echo " Encryption: $encryption" echo " Loadable Modules: $set_hmodules" echo " Maximum Connections: $maxconnections" echo " Install Directory: $prefix" echo ""