Get rid of warnings about undefined crypt() and assignment in if().
[ircu2.10.12-pk.git] / configure.in
index 7b0fa7dff8a96e27d8e1739b9f99bad5f1b5112d..d827312a7c06ffb8e1703d15129ecdf6a18d9d45 100644 (file)
@@ -106,9 +106,14 @@ AC_SEARCH_LIBS(crypt, descrypt 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.
+AC_SEARCH_LIBS(res_mkquery, resolv, ,
+[AC_MSG_ERROR([Unable to find library containing res_mkquery()])])
+
 dnl Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS(poll.h sys/devpoll.h sys/event.h)
+AC_CHECK_HEADERS(crypt.h inttypes.h poll.h sys/devpoll.h sys/epoll.h sys/event.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics
 dnl AC_C_CONST
@@ -241,6 +246,23 @@ if test x"$unet_cv_enable_debug" = xyes; then
     AC_DEFINE([DEBUGMODE], , [Enable debugging code])
 fi
 
+dnl Now look for --enable-leak-detect
+AC_MSG_CHECKING([whether to enable leak detection])
+AC_ARG_WITH([leak-detect],
+[  --with-leak-detect          Turn on the leak detector(requires patched boehm)],
+[unet_cv_with_leak_detect=$with_leak_detect],
+[AC_CACHE_VAL(unet_cv_with_leak_detect,
+[unet_cv_with_leak_detect=no])])
+AC_MSG_RESULT([$unet_cv_enable_leak_detect])
+
+if test x"$unet_cv_with_leak_detect" != xno; then
+    LIBS="-lgc $LIBS"
+    CFLAGS="-DMDEBUG $CFLAGS"
+    if test x"$unet_cv_with_leak_detect" != xyes; then
+       LIBS="-L$unet_cv_with_leak_detect $LIBS"
+    fi
+fi
+
 dnl And now for --disable-asserts
 AC_MSG_CHECKING([whether to enable asserts])
 AC_ARG_ENABLE([asserts],
@@ -267,19 +289,6 @@ if test x"$unet_cv_enable_symbols" = xyes; then
     CFLAGS="-g $CFLAGS"
 fi
 
-dnl Check for --disable-headinsand
-AC_MSG_CHECKING([whether to enable head in sand 'features'])
-AC_ARG_ENABLE([headinsand],
-[  --disable-headinsand      Disable head in sand (-DNO_HEAD_IN_SAND)],
-[unet_cv_enable_headinsand=$enable_headinsand],
-[AC_CACHE_VAL(unet_cv_enable_headinsand,
-[unet_cv_enable_headinsand=yes])])
-AC_MSG_RESULT([$unet_cv_enable_headinsand])
-
-if test x"$unet_cv_enable_headinsand" = xno; then
-    CFLAGS="-DNO_HEAD_IN_SAND $CFLAGS"
-fi
-
 dnl Now check for --enable-profile
 AC_MSG_CHECKING([whether to enable profiling support (gprof)])
 AC_ARG_ENABLE([profile],
@@ -335,7 +344,7 @@ fi
 dnl --disable-devpoll check...
 AC_MSG_CHECKING([whether to enable the /dev/poll event engine])
 AC_ARG_ENABLE([devpoll],
-[  --disable-devpoll       Enable the /dev/poll-based engine],
+[  --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])])
@@ -354,7 +363,7 @@ fi
 dnl --disable-kqueue check...
 AC_MSG_CHECKING([whether to enable the kqueue event engine])
 AC_ARG_ENABLE([kqueue],
-[  --disable-kqueue        Enable the kqueue-based engine],
+[  --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])])
@@ -370,6 +379,32 @@ if test x"$unet_cv_enable_kqueue" != xno; then
     ENGINE_C="engine_kqueue.c $ENGINE_C"
 fi
 
+dnl --disable-epoll check
+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; 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 <sys/epoll.h>], [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 --disable-adns check...
 AC_MSG_CHECKING([whether to enable the adns resolver engine])
 AC_ARG_ENABLE([adns],
@@ -674,6 +709,9 @@ 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],
@@ -704,7 +742,6 @@ ircu is now hopefully configured for your system.
   Warnings:            $unet_cv_enable_warnings
   Debug:               $unet_cv_enable_debug
   Profile:             $unet_cv_enable_profile
-  Head-in-sand:        $unet_cv_enable_headinsand
   ADNS:                $unet_cv_enable_adns
   Owner/mode:          $unet_cv_with_owner.$unet_cv_with_group ($unet_cv_with_mode)
   Chroot:              $unet_cv_with_chroot
@@ -718,4 +755,5 @@ ircu is now hopefully configured for your system.
   poll() engine:       $unet_cv_enable_poll
   kqueue() engine:     $unet_cv_enable_kqueue
   /dev/poll engine:    $unet_cv_enable_devpoll
+  epoll() engine:      $unet_cv_enable_epoll
 "])