"Fossies" - the Fresh Open Source Software Archive

Member "bahamut-2.1.5/configure.in" (28 May 2020, 26016 Bytes) of package /linux/privat/bahamut-2.1.5.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure.in": 2.1.4_vs_2.1.5.

    1 dnl Process this file with autoconf to produce a configure script.
    2 dnl rewritten for my own personal sanity, and for more extensive
    3 dnl checks - feb04 -epi
    4 
    5 AC_INIT
    6 
    7 AC_CONFIG_HEADER(include/setup.h)
    8 
    9 PACKAGE=bahamut-release
   10 VERSION=1.8
   11 AC_SUBST(PACKAGE)
   12 AC_SUBST(VERSION)
   13 
   14 # autoheader templates
   15 
   16 AH_TEMPLATE([BROKEN_FD_SETSIZE],[If on a system with a broken FD_SETSIZE])
   17 AH_TEMPLATE([HAVE_ENCRYPTION_ON],[If we support encryption])
   18 AH_TEMPLATE([HAVE_MINMAX],[If we have the MIN and MAX macros])
   19 AH_TEMPLATE([OS_SOLARIS2],[If we're running on Solaris])
   20 AH_TEMPLATE([OS_SOLARIS],[Not quite sure why we have two of these])
   21 AH_TEMPLATE([SYS_ERRLIST_DECLARED],[If the sys_errlist array is defined])
   22 AH_TEMPLATE([USE_HOOKMODULES],[Do we support loadable modules])
   23 AH_TEMPLATE([MAXCONNECTIONS],[Maximum Connections we allow])
   24 AH_TEMPLATE([NEED_EPOLL_DEFS],[epoll behavior])
   25 AH_TEMPLATE([AIX],[AIX support])
   26 AH_TEMPLATE([WRITEV_IOV],[Maxmimum number of iovecs supported by writev()])
   27 
   28 dnl Put our options of here for ease of reading.
   29 
   30 AC_ARG_ENABLE(hookmodules,
   31 [  --disable-hookmodules   disable support for loadable hook modules],,
   32 [ check_hmodules="yes" ])
   33 
   34 AC_ARG_ENABLE(openssl,
   35 [  --enable-openssl[=DIR]       Enable OpenSSL support (DIR optional).
   36   --disable-openssl            Disable OpenSSL support. ],
   37 [ cf_enable_openssl=$enableval ],
   38 [ cf_enable_openssl="auto" ])
   39 
   40 AC_ARG_WITH(socketengine,
   41 [  --with-socketengine=TYPE       Set the socketengine type.  Choices are:
   42                                 kqueue poll select ],
   43 [ check_sengine=$withval ],
   44 [ check_sengine="yes" ])
   45 AC_ARG_WITH(maxconnections,
   46 [  --with-maxconnections=NUMBER   Set the maximum number of sockets.],
   47 [ check_maxconnections=$withval ],
   48 [ check_maxconnections="auto" ])
   49 
   50 dnl -------------------------------------------------------------------
   51 # ===========================================================================
   52 #    http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html
   53 # ===========================================================================
   54 #
   55 # SYNOPSIS
   56 #
   57 #   AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
   58 #
   59 # DESCRIPTION
   60 #
   61 #   Try to find a compiler option that enables most reasonable warnings.
   62 #
   63 #   For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
   64 #   result is added to the shellvar being CFLAGS by default.
   65 #
   66 #   Currently this macro knows about GCC, Solaris C compiler, Digital Unix C
   67 #   compiler, C for AIX Compiler, HP-UX C compiler, IRIX C compiler, NEC
   68 #   SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos 10.0.0.8) C
   69 #   compiler.
   70 #
   71 #    - $1 shell-variable-to-add-to : CFLAGS
   72 #    - $2 add-value-if-not-found : nothing
   73 #    - $3 action-if-found : add value to shellvariable
   74 #    - $4 action-if-not-found : nothing
   75 #
   76 # LICENSE
   77 #
   78 #   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
   79 #
   80 #   This program is free software; you can redistribute it and/or modify it
   81 #   under the terms of the GNU General Public License as published by the
   82 #   Free Software Foundation; either version 2 of the License, or (at your
   83 #   option) any later version.
   84 #
   85 #   This program is distributed in the hope that it will be useful, but
   86 #   WITHOUT ANY WARRANTY; without even the implied warranty of
   87 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
   88 #   Public License for more details.
   89 #
   90 #   You should have received a copy of the GNU General Public License along
   91 #   with this program. If not, see <http://www.gnu.org/licenses/>.
   92 #
   93 #   As a special exception, the respective Autoconf Macro's copyright owner
   94 #   gives unlimited permission to copy, distribute and modify the configure
   95 #   scripts that are the output of Autoconf when processing the Macro. You
   96 #   need not follow the terms of the GNU General Public License when using
   97 #   or distributing such scripts, even though portions of the text of the
   98 #   Macro appear in them. The GNU General Public License (GPL) does govern
   99 #   all other use of the material that constitutes the Autoconf Macro.
  100 #
  101 #   This special exception to the GPL applies to versions of the Autoconf
  102 #   Macro released by the Autoconf Archive. When you make and distribute a
  103 #   modified version of the Autoconf Macro, you may extend this special
  104 #   exception to the GPL to apply to your modified version as well.
  105 
  106 AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
  107 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
  108 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl
  109 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
  110 VAR,[VAR="no, unknown"
  111  AC_LANG_PUSH([C])
  112  ac_save_[]FLAGS="$[]FLAGS"
  113 for ac_arg dnl
  114 in "-pedantic  % -Wall"       dnl   GCC
  115    "-xstrconst % -v"          dnl Solaris C
  116    "-std1      % -verbose -w0 -warnprotos" dnl Digital Unix
  117    "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
  118    "-ansi -ansiE % -fullwarn" dnl IRIX
  119    "+ESlit     % +w1"         dnl HP-UX C
  120    "-Xc        % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
  121    "-h conform % -h msglevel 2" dnl Cray C (Unicos)
  122    #
  123 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
  124    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break],[])
  125 done
  126  FLAGS="$ac_save_[]FLAGS"
  127  AC_LANG_POP([])
  128 ])
  129 case ".$VAR" in
  130      .ok|.ok,*) m4_ifvaln($3,$3) ;;
  131    .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
  132         AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
  133                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
  134    *) m4_ifvaln($3,$3,[
  135    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
  136    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
  137    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
  138                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
  139    fi ]) ;;
  140 esac
  141 AS_VAR_POPDEF([VAR])dnl
  142 AS_VAR_POPDEF([FLAGS])dnl
  143 ])
  144 
  145 dnl the only difference - the LANG selection... and the default FLAGS
  146 
  147 AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
  148 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
  149 AS_VAR_PUSHDEF([VAR],[ax_cv_cxxflags_warn_all])dnl
  150 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
  151 VAR,[VAR="no, unknown"
  152  AC_LANG_PUSH([C++])
  153  ac_save_[]FLAGS="$[]FLAGS"
  154 for ac_arg dnl
  155 in "-pedantic  % -Wall"       dnl   GCC
  156    "-xstrconst % -v"          dnl Solaris C
  157    "-std1      % -verbose -w0 -warnprotos" dnl Digital Unix
  158    "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
  159    "-ansi -ansiE % -fullwarn" dnl IRIX
  160    "+ESlit     % +w1"         dnl HP-UX C
  161    "-Xc        % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
  162    "-h conform % -h msglevel 2" dnl Cray C (Unicos)
  163    #
  164 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
  165    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break],[])
  166 done
  167  FLAGS="$ac_save_[]FLAGS"
  168  AC_LANG_POP([])
  169 ])
  170 case ".$VAR" in
  171      .ok|.ok,*) m4_ifvaln($3,$3) ;;
  172    .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
  173         AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
  174                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
  175    *) m4_ifvaln($3,$3,[
  176    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
  177    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
  178    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
  179                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
  180    fi ]) ;;
  181 esac
  182 AS_VAR_POPDEF([VAR])dnl
  183 AS_VAR_POPDEF([FLAGS])dnl
  184 ])
  185 
  186 dnl  implementation tactics:
  187 dnl   the for-argument contains a list of options. The first part of
  188 dnl   these does only exist to detect the compiler - usually it is
  189 dnl   a global option to enable -ansi or -extrawarnings. All other
  190 dnl   compilers will fail about it. That was needed since a lot of
  191 dnl   compilers will give false positives for some option-syntax
  192 dnl   like -Woption or -Xoption as they think of it is a pass-through
  193 dnl   to later compile stages or something. The "%" is used as a
  194 dnl   delimimiter. A non-option comment can be given after "%%" marks
  195 dnl   which will be shown but not added to the respective C/CXXFLAGS.
  196 
  197 dnl -------------------------------------------------------------------
  198 
  199 # ===========================================================================
  200 #       http://www.gnu.org/software/autoconf-archive/ax_have_epoll.html
  201 # ===========================================================================
  202 #
  203 # SYNOPSIS
  204 #
  205 #   AX_HAVE_EPOLL([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  206 #   AX_HAVE_EPOLL_PWAIT([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  207 #
  208 # DESCRIPTION
  209 #
  210 #   This macro determines whether the system supports the epoll I/O event
  211 #   interface. A neat usage example would be:
  212 #
  213 #     AX_HAVE_EPOLL(
  214 #       [AX_CONFIG_FEATURE_ENABLE(epoll)],
  215 #       [AX_CONFIG_FEATURE_DISABLE(epoll)])
  216 #     AX_CONFIG_FEATURE(
  217 #       [epoll], [This platform supports epoll(7)],
  218 #       [HAVE_EPOLL], [This platform supports epoll(7).])
  219 #
  220 #   The epoll interface was added to the Linux kernel in version 2.5.45, and
  221 #   the macro verifies that a kernel newer than this is installed. This
  222 #   check is somewhat unreliable if <linux/version.h> doesn't match the
  223 #   running kernel, but it is necessary regardless, because glibc comes with
  224 #   stubs for the epoll_create(), epoll_wait(), etc. that allow programs to
  225 #   compile and link even if the kernel is too old; the problem would then
  226 #   be detected only at runtime.
  227 #
  228 #   Linux kernel version 2.6.19 adds the epoll_pwait() call in addition to
  229 #   epoll_wait(). The availability of that function can be tested with the
  230 #   second macro. Generally speaking, it is safe to assume that
  231 #   AX_HAVE_EPOLL would succeed if AX_HAVE_EPOLL_PWAIT has, but not the
  232 #   other way round.
  233 #
  234 # LICENSE
  235 #
  236 #   Copyright (c) 2008 Peter Simons <simons@cryp.to>
  237 #
  238 #   Copying and distribution of this file, with or without modification, are
  239 #   permitted in any medium without royalty provided the copyright notice
  240 #   and this notice are preserved. This file is offered as-is, without any
  241 #   warranty.
  242 
  243 AC_DEFUN([AX_HAVE_EPOLL], [dnl
  244   ax_have_epoll_cppflags="${CPPFLAGS}"
  245   AC_CHECK_HEADER([linux/version.h], [CPPFLAGS="${CPPFLAGS} -DHAVE_LINUX_VERSION_H"])
  246   AC_MSG_CHECKING([for Linux epoll(7) interface])
  247   AC_CACHE_VAL([ax_cv_have_epoll], [dnl
  248     AC_LINK_IFELSE([dnl
  249       AC_LANG_PROGRAM([dnl
  250 #include <sys/epoll.h>
  251 #ifdef HAVE_LINUX_VERSION_H
  252 #  include <linux/version.h>
  253 #  if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,45)
  254 #    error linux kernel version is too old to have epoll
  255 #  endif
  256 #endif
  257 ], [dnl
  258 int fd, rc;
  259 struct epoll_event ev;
  260 fd = epoll_create(128);
  261 rc = epoll_wait(fd, &ev, 1, 0);])],
  262       [ax_cv_have_epoll=yes],
  263       [ax_cv_have_epoll=no])])
  264   CPPFLAGS="${ax_have_epoll_cppflags}"
  265   AS_IF([test "${ax_cv_have_epoll}" = "yes"],
  266     [AC_MSG_RESULT([yes])
  267 $1],[AC_MSG_RESULT([no])
  268 $2])
  269 ])dnl
  270 
  271 AC_DEFUN([AX_HAVE_EPOLL_PWAIT], [dnl
  272   ax_have_epoll_cppflags="${CPPFLAGS}"
  273   AC_CHECK_HEADER([linux/version.h],
  274     [CPPFLAGS="${CPPFLAGS} -DHAVE_LINUX_VERSION_H"])
  275   AC_MSG_CHECKING([for Linux epoll(7) interface with signals extension])
  276   AC_CACHE_VAL([ax_cv_have_epoll_pwait], [dnl
  277     AC_LINK_IFELSE([dnl
  278       AC_LANG_PROGRAM([dnl
  279 #ifdef HAVE_LINUX_VERSION_H
  280 #  include <linux/version.h>
  281 #  if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
  282 #    error linux kernel version is too old to have epoll_pwait
  283 #  endif
  284 #endif
  285 #include <sys/epoll.h>
  286 #include <signal.h>
  287 ], [dnl
  288 int fd, rc;
  289 struct epoll_event ev;
  290 fd = epoll_create(128);
  291 rc = epoll_wait(fd, &ev, 1, 0);
  292 rc = epoll_pwait(fd, &ev, 1, 0, (sigset_t const *)(0));])],
  293       [ax_cv_have_epoll_pwait=yes],
  294       [ax_cv_have_epoll_pwait=no])])
  295   CPPFLAGS="${ax_have_epoll_cppflags}"
  296   AS_IF([test "${ax_cv_have_epoll_pwait}" = "yes"],
  297     [AC_MSG_RESULT([yes])
  298 $1],[AC_MSG_RESULT([no])
  299 $2])
  300 ])dnl
  301 
  302 
  303 dnl -------------------------------------------------
  304 
  305 dnl Checks for programs.
  306 AC_PROG_CC
  307 AX_CFLAGS_WARN_ALL
  308 AC_CANONICAL_TARGET
  309 AC_SEARCH_LIBS([strerror],[cposix])
  310 AC_PROG_MAKE_SET
  311 AC_PATH_PROG(RM, rm)
  312 AC_PATH_PROG(CP, cp)
  313 AC_PATH_PROG(MV, mv)
  314 AC_PATH_PROG(SED, sed)
  315 AC_PROG_INSTALL
  316 AC_C_INLINE
  317 
  318 dnl Checks for libraries.
  319 dnl Replace `main' with a function in -lnsl:
  320 AC_CHECK_LIB(nsl, gethostbyname)
  321 AC_CHECK_FUNC(res_mkquery,, AC_CHECK_LIB(resolv, res_mkquery))
  322 AC_CHECK_FUNC(__res_mkquery,, AC_CHECK_LIB(resolv, __res_mkquery))
  323 AC_CHECK_LIB(socket, socket, zlib)
  324 AC_CHECK_FUNC(crypt,, AC_CHECK_LIB(descrypt, crypt,,AC_CHECK_LIB(crypt, crypt,,)))
  325 
  326 dnl Checks for header files.
  327 AC_HEADER_STDC
  328 AC_CHECK_HEADERS([fcntl.h limits.h malloc.h netdb.h netinet/in.h stddef.h])
  329 AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/file.h sys/ioctl.h])
  330 AC_CHECK_HEADERS([sys/param.h sys/socket.h sys/time.h syslog.h unistd.h])
  331 AC_CHECK_HEADERS([zlib.h])
  332 AC_CHECK_HEADERS(inttypes.h sys/resource.h errno.h stdlib.h stddef.h getopt.h)
  333 AC_MSG_CHECKING(MIN and MAX definition)
  334 AC_EGREP_CPP(yes,
  335 [
  336 #if defined( HAVE_SYS_PARAM_H )
  337 #include <sys/param.h>
  338 #ifdef MIN
  339   yes
  340 #endif
  341 #endif
  342 ], AC_DEFINE(HAVE_MINMAX) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
  343 
  344 
  345 dnl Checks for library functions.
  346 AC_PROG_GCC_TRADITIONAL
  347 AC_CHECK_FUNCS([alarm dup2 gethostbyname gethostname getpass gettimeofday])
  348 AC_CHECK_FUNCS([inet_ntoa isascii memmove memset munmap setenv socket])
  349 AC_CHECK_FUNCS([strcasecmp strchr strdup strerror strncasecmp strrchr strtol])
  350 AC_CHECK_FUNCS([strtoul index strerror strtoken strtok inet_addr inet_netof])
  351 AC_CHECK_FUNCS([inet_aton gettimeofday lrand48 sigaction bzero bcmp bcopy])
  352 AC_CHECK_FUNCS([dn_skipname __dn_skipname getrusage times break])
  353 
  354 dnl check for various OSes
  355 
  356 case "$target" in
  357     *-solaris2*)
  358         solaris2="yes"
  359         AC_DEFINE(OS_SOLARIS2)
  360         AC_DEFINE(OS_SOLARIS)
  361         AC_DEFINE_UNQUOTED(WRITEV_IOV, 16)
  362         ;;
  363     *-freebsd*)
  364         freebsd="yes"
  365         AC_DEFINE_UNQUOTED(WRITEV_IOV, 32)
  366         ;;
  367     *-netbsd*)
  368         AC_DEFINE_UNQUOTED(WRITEV_IOV, 32)
  369         ;;
  370     *-openbsd*)
  371         AC_DEFINE_UNQUOTED(WRITEV_IOV, 32)
  372         ;;
  373     *-linux*)
  374         linux="yes"
  375         AC_DEFINE_UNQUOTED(WRITEV_IOV, 32)
  376         ;;
  377     *aix*)
  378         aix="yes"
  379         AC_DEFINE(AIX)
  380         ;;
  381     *-darwin*)
  382         check_hmodules="no"
  383         AC_DEFINE_UNQUOTED(WRITEV_IOV, 32)
  384         ;;
  385 esac
  386 
  387 dnl Checks for loadable hook module support
  388 
  389 set_hmodules="disabled"
  390 
  391 if test "$check_hmodules" = "yes"; then
  392     AC_CHECK_LIB(dl, dlopen)
  393     AC_CHECK_HEADER(dlfcn.h)
  394     AC_CHECK_FUNCS(dlopen dlsym, [set_hmodules="enabled"])
  395     if test "$set_hmodules" = "enabled"; then
  396         AC_DEFINE(USE_HOOKMODULES)
  397         MOD_LDFLAGS="-Wl,-export-dynamic"
  398     fi
  399 fi
  400 
  401 dnl Check for sys_errlist
  402 dnl Stolen from BitchX
  403 AC_MSG_CHECKING(for sys_errlist declaration)
  404 AC_RUN_IFELSE([AC_LANG_SOURCE([[
  405 #include <sys/types.h>
  406 #include <stdio.h>
  407 #include <errno.h>
  408 main()
  409 {
  410   char *s = sys_errlist[0];
  411 	  exit(0);
  412 }
  413 ]])],[AC_MSG_RESULT(yes)
  414   AC_DEFINE(SYS_ERRLIST_DECLARED)],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(cross compiling)])
  415 
  416 dnl Openssl checks - combination of our old way and the hybrid7 method
  417 
  418 save_LIBS="$LIBS"
  419 
  420 AC_MSG_CHECKING(for OpenSSL)
  421 
  422 if test "X$cf_enable_openssl" != "Xno" ; then
  423   cf_openssl_basedir=""
  424   if test "X$cf_enable_openssl" != "Xauto" &&
  425      test "X$cf_enable_openssl" != "Xyes"; then
  426      dnl Support for --enable-openssl=/some/place
  427      cf_openssl_basedir="${cf_enable_openssl}"
  428   else
  429     dnl Do the auto-probe here.  Check some common directory paths.
  430     for dirs in $HOME/openssl /usr/local/ssl /usr/pkg /usr/local /usr/lib /usr/lib/ssl\
  431                 /opt /opt/openssl /usr/local/openssl ; do
  432       if test -f "${dirs}/include/openssl/opensslv.h" ; then
  433         cf_openssl_basedir="${dirs}"
  434         break
  435       fi
  436     done
  437     unset dirs
  438   fi
  439   dnl Now check cf_openssl_found to see if we found anything.
  440   if test "X$cf_openssl_basedir" != "X" ; then
  441     if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then
  442       SSL_INCLUDES="-I${cf_openssl_basedir}/include"
  443       SSL_LDFLAGS="-L${cf_openssl_basedir}/lib"
  444       if test "$cf_openssl_basedir" = "$HOME/openssl"; then
  445         SSL_LDFLAGS="-L${cf_openssl_basedir}/lib -Wl,-rpath,${cf_openssl_basedir}/lib"
  446       fi
  447     else
  448       dnl OpenSSL wasn't found in the directory specified.  Naughty
  449       dnl administrator...
  450       cf_openssl_basedir=""
  451     fi
  452   else
  453     dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
  454     dnl are in /usr/include and /usr/lib.  In this case, we don't want to
  455     dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
  456     dnl We can't do this check above, because some people want two versions
  457     dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
  458     dnl and they want /usr/local/ssl to have preference.
  459     if test -f "/usr/include/openssl/opensslv.h" ; then
  460       cf_openssl_basedir="/usr"
  461     fi
  462   fi
  463   dnl If we have a basedir defined, then everything is okay.  Otherwise,
  464   dnl we have a problem.
  465   if test "X$cf_openssl_basedir" != "X" ; then
  466     CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
  467     LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
  468     LIBS="-lssl -lcrypto $save_LIBS"
  469     AC_MSG_RESULT($cf_openssl_basedir)
  470     cf_enable_openssl="yes"
  471     encryption="enabled"
  472     AC_DEFINE(HAVE_ENCRYPTION_ON)
  473     ENCRYPT_SRC="rc4.c dh.c libcrypto-compat.c"
  474     AC_SUBST(ENCRYPT_SRC)
  475   else
  476     AC_MSG_RESULT(not found.  Please check your path.)
  477     cf_enable_openssl="no"
  478     encryption="disabled"
  479   fi
  480   unset cf_openssl_basedir
  481 else
  482   dnl If --disable-openssl was specified
  483   encryption="disabled"
  484   AC_MSG_RESULT(disabled)
  485 fi
  486 
  487 unset save_LIBS
  488 
  489 dnl end of openssl library test
  490 
  491 dnl select a socket engine
  492 
  493 if test "$check_sengine" = "yes"; then
  494     engine="select"
  495     if test "$freebsd" = "yes"; then
  496         AC_CHECK_FUNC(kevent, [ engine="kqueue" ], )
  497     elif test "$solaris2" = "yes"; then
  498         engine="poll"
  499         AC_CHECK_HEADER(sys/devpoll.h, engine="devpoll", )
  500     elif test "$linux" = "yes"; then
  501         AC_CHECK_FUNC(poll, [ engine="poll" ], )
  502 	AX_HAVE_EPOLL([ engine="epoll" ], )
  503         AC_CHECK_HEADER(sys/epoll.h, HAVE_EPOLL_H=yes, HAVE_EPOLL_H=no)
  504        # AC_CHECK_LIB(epoll, epoll_create, 
  505        #     [LIBS="$LIBS -lepoll"; have_epoll_lib="yes"; engine="epoll"], 
  506        #     have_epoll_lib="no")
  507        # if test "$HAVE_EPOLL_H $have_epoll_lib" = "yes no"; then
  508        #     AC_MSG_CHECKING(for epoll_create [without -lepoll])
  509        #     AC_RUN_IFELSE([AC_LANG_SOURCE([[
  510        #             #include <stdint.h>
  511        #             #include <sys/epoll.h>
  512        #             #include <errno.h>
  513        #             
  514        #             #include <asm/unistd.h>
  515        #             
  516        #             _syscall1(int, epoll_create, int, size)
  517        #             
  518        #             int main(int argc, char **argv) { return epoll_create(5) < 1; }
  519        #             ]])],[have_epoll_lib="yes"],[have_epoll_lib="no"],[])
  520        #     AC_MSG_RESULT($have_epoll_lib)
  521        #     if test "$have_epoll_lib" = "yes"; then
  522        #         AC_DEFINE(NEED_EPOLL_DEFS)
  523        #     fi
  524        # fi
  525        # if test "$HAVE_EPOLL_H $have_epoll_lib" = "yes yes"; then
  526        #     engine="epoll";
  527        # fi
  528     else
  529         AC_CHECK_FUNC(poll, [ engine="poll"], )
  530     fi
  531 elif test "$check_sengine" = "kqueue"; then
  532     AC_CHECK_FUNC(kevent, [ engine="kqueue" ], )
  533     if test "X$engine" = "X"; then
  534         AC_MSG_NOTICE()
  535         AC_MSG_NOTICE(kqueue not supported on this platform!)
  536         AC_MSG_ERROR()
  537     fi
  538     AC_MSG_NOTICE(setting socketengine type to kqueue)
  539 elif test "$check_sengine" = "poll"; then
  540     AC_CHECK_FUNC(poll, [ engine="poll" ], )
  541     if test "X$engine" = "X"; then
  542         AC_MSG_NOTICE()
  543         AC_MSG_NOTICE(poll not supported on this platform!)
  544         AC_MSG_ERROR()
  545     fi
  546     AC_MSG_NOTICE(setting socketengine type to poll)
  547 elif test "$check_sengine" = "devpoll"; then
  548     AC_CHECK_HEADER(sys/devpoll.h, engine="devpoll", )
  549     if test "X$engine" = "X"; then
  550         AC_MSG_NOTICE()
  551         AC_MSG_NOTICE(/dev/poll not supported on this system)
  552         AC_MSG_ERROR()
  553     fi
  554     AC_MSG_NOTICE(setting socketengine to devpoll)
  555 elif test "$check_sengine" = "epoll"; then
  556     AC_CHECK_HEADER(sys/epoll.h, HAVE_EPOLL_H=yes, HAVE_EPOLL_H=no)
  557     AC_CHECK_LIB(epoll, epoll_create, 
  558         [LIBS="$LIBS -lepoll"; have_epoll_lib="yes"; engine="epoll"], 
  559         have_epoll_lib="no")
  560     if test "$HAVE_EPOLL_H $have_epoll_lib" = "yes no"; then
  561         AC_MSG_CHECKING(for epoll_create [without -lepoll])
  562         AC_RUN_IFELSE([AC_LANG_SOURCE([[
  563                 #include <stdint.h>
  564                 #include <sys/epoll.h>
  565                 #include <errno.h>
  566                  
  567                 #include <asm/unistd.h>
  568                  
  569                 _syscall1(int, epoll_create, int, size)
  570                 
  571                 int main(int argc, char **argv) { return epoll_create(5) < 1; }
  572                 ]])],[have_epoll_lib="yes"],[have_epoll_lib="no"],[])
  573         AC_MSG_RESULT($have_epoll_lib)
  574         if test "$have_epoll_lib" = "yes"; then
  575             AC_DEFINE(NEED_EPOLL_DEFS)
  576         fi
  577     fi
  578     if test "$HAVE_EPOLL_H $have_epoll_lib" != "yes yes"; then
  579         AC_MSG_NOTICE()
  580         AC_MSG_ERROR(epoll is not supported on this machine)
  581         AC_MSG_ERROR()
  582     fi
  583     AC_MSG_NOTICE(setting socketengine type to epoll)
  584     engine="epoll";
  585 elif test "$check_sengine" = "select"; then
  586     AC_MSG_NOTICE(setting socketengine type to select.. for some stupid reason)
  587     engine="select"
  588 else
  589     AC_MSG_NOTICE()
  590     AC_MSG_NOTICE(socket engine type incorrect!)
  591     AC_MSG_ERROR()
  592 fi
  593 
  594 SENGINE="socketengine_$engine.c"
  595 
  596 dnl Check to see if we have a broken FD_SETSIZE
  597 if test $engine = "select"; then
  598     AC_MSG_CHECKING(to see if FD_SETSIZE is broken)
  599     AC_RUN_IFELSE([AC_LANG_SOURCE([[
  600     #define FD_SETSIZE 666
  601     #include <sys/types.h>
  602     #include <sys/time.h>
  603 
  604     int main()
  605     {
  606         if(FD_SETSIZE != 666)
  607             exit(1);
  608         exit(0);
  609     }
  610     ]])],[AC_MSG_RESULT(no)],[
  611     AC_MSG_RESULT(YES)
  612     AC_MSG_WARN(FD_SETSIZE is hard set by your operating system)
  613     AC_MSG_WARN(MAXCONNECTIONS must be no higher than the hardwired FD_SETSIZE)
  614     AC_DEFINE(BROKEN_FD_SETSIZE)
  615     broken_fd_setsize="yes"
  616     ],[AC_MSG_RESULT(can't tell)])
  617 fi
  618 
  619 if test "$solaris2" != "yes" && test "$aix" != "yes" && 
  620    test "$set_hmodules" = "enabled"; then
  621     LDFLAGS="$LDFLAGS $MOD_LDFLAGS"
  622 fi
  623 
  624 if test "$check_maxconnections" = "auto"; then
  625 
  626     AC_MSG_CHECKING(Maximum file descriptors);
  627     AC_CACHE_VAL(bh_cv_maxconnections,
  628 [
  629 
  630 AC_LANG_CONFTEST(
  631    [AC_LANG_SOURCE([[
  632     #include <sys/types.h>
  633     #include <sys/time.h>
  634     #include <sys/resource.h>
  635     #include <stdio.h>
  636     #ifdef RLIMIT_FDMAX
  637     #define RLIMIT_FD_MAX   RLIMIT_FDMAX
  638     #else
  639     #ifdef RLIMIT_NOFILE
  640     #define RLIMIT_FD_MAX RLIMIT_NOFILE
  641     #else
  642     #ifdef RLIMIT_OPEN_MAX
  643     #define RLIMIT_FD_MAX RLIMIT_OPEN_MAX
  644     #else
  645     #undef RLIMIT_FD_MAX
  646     #endif
  647     #endif
  648     #endif
  649 
  650 
  651     int main()
  652     {
  653     #ifndef BROKEN_FD_SETSIZE
  654 
  655     #ifdef RLIMIT_FD_MAX
  656         struct rlimit limit;
  657         
  658         if(!getrlimit(RLIMIT_FD_MAX, &limit))
  659         {
  660             if(limit.rlim_max > 32768)
  661                 printf("32768");
  662             else
  663                 printf("%ld", (long) limit.rlim_max);
  664         }
  665         else
  666     #endif
  667             printf("256");
  668 
  669     #else
  670         printf("%d", FD_SETSIZE);
  671     #endif
  672         return 0;
  673     }
  674    ]])
  675 ])
  676 
  677     $CC -o conftest conftest.c >/dev/null 2>&1
  678     maxconnections=`./conftest`
  679     AC_MSG_RESULT($maxconnections)
  680     $RM -f conftest conftest.c
  681 ])
  682     AC_DEFINE_UNQUOTED(MAXCONNECTIONS, ${maxconnections})
  683 
  684 else
  685     maxconnections=$check_maxconnections
  686     AC_DEFINE_UNQUOTED(MAXCONNECTIONS, ${maxconnections})
  687 fi
  688 
  689 # zlib test
  690 # ripped from http://autoconf-archive.cryp.to/check_zlib.html
  691 #
  692 ZLIB_HOME=/usr/local
  693 if test ! -f "${ZLIB_HOME}/include/zlib.h"
  694 then
  695         ZLIB_HOME=/usr
  696 fi
  697 if test -n "${ZLIB_HOME}"
  698 then
  699         ZLIB_OLD_CPPFLAGS="$CPPFLAGS"
  700         ZLIB_OLD_LDFLAGS="$LDFLAGS"
  701 	if test "x$ZLIB_HOME" = "x/usr"; then
  702 	    :
  703 	else
  704 	    CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
  705 	    LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
  706 	fi
  707 	AC_LANG_PUSH([C])
  708         AC_CHECK_LIB(z, inflateEnd, [zlib_cv_libz=yes], [zlib_cv_libz=no])
  709         AC_CHECK_HEADER(zlib.h, [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no])
  710         AC_LANG_POP([])
  711         if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes"
  712         then
  713                 #
  714                 # If both library and header were found, use them
  715                 #
  716                 AC_CHECK_LIB(z, inflateEnd)
  717                 AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
  718                 AC_MSG_RESULT(ok)
  719         else
  720                 #
  721                 # If either header or library was not found, revert and bomb
  722                 #
  723                 AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
  724 		CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
  725                 LDFLAGS="$ZLIB_OLD_LDFLAGS"
  726                 AC_MSG_RESULT(failed)
  727                 AC_MSG_ERROR(either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib)
  728         fi
  729 fi
  730 
  731 if test "$engine" = "select" && test "$broken_fd_setsize" != "yes"; then
  732     CFLAGS="$CFLAGS -DFD_SETSIZE=$maxconnections"
  733 fi
  734 
  735 if test $prefix = NONE; then
  736     prefix=${HOME}/ircd
  737     if test -f "${HOME}/bahamut/ircd" ; then
  738         prefix=${HOME}/bahamut
  739     fi
  740     if test -f "${HOME}/dalnet/ircd" ; then
  741         prefix=${HOME}/dalnet
  742     fi
  743 fi
  744 
  745 INSTALL_DIR="${prefix}"
  746 
  747 AC_SUBST(LIBS)
  748 AC_SUBST(SENGINE)
  749 AC_SUBST(INSTALL_DIR)
  750 
  751 AC_CONFIG_FILES([Makefile src/Makefile tools/Makefile doc/Makefile])
  752 AC_OUTPUT
  753 
  754 echo ""
  755 echo "      ******* Bahamut Configuration Settings *******"
  756 echo "      System Build Type:              $target"
  757 echo "      Socket Engine Type:             $engine"
  758 echo "      Encryption:                     $encryption"
  759 echo "      Loadable Modules:               $set_hmodules"
  760 echo "      Maximum Connections:            $maxconnections"
  761 echo "      Install Directory:              $prefix"
  762 echo ""