- Added some tools to detect memory leaks.
[ircu2.10.12-pk.git] / configure.in
index 07db11ff0a289331f77cf664a104a4f4943e2cc3..4e0149445830e37f6250621de248d2dddb8e1b5e 100644 (file)
@@ -27,10 +27,12 @@ AC_INIT(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!
@@ -104,11 +106,6 @@ 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)
@@ -123,7 +120,7 @@ AC_TYPE_UID_T
 unet_CHECK_TYPE_SIZES
 
 dnl Checks for library functions.
-AC_CHECK_FUNC(kqueue)
+AC_CHECK_FUNCS([kqueue setrlimit getrusage times])
 
 dnl Do we have restarting syscalls ?
 AC_SYS_RESTARTABLE_SYSCALLS
@@ -191,6 +188,12 @@ case "$host" in
        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.])
@@ -238,13 +241,30 @@ if test x"$unet_cv_enable_debug" = xyes; then
     AC_DEFINE([DEBUGMODE], , [Enable debugging code])
 fi
 
-dnl And now for --enable-asserts
+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],
-[  --enable-asserts        Enable asserts],
+[  --disable-asserts       Disable assertion checking],
 [unet_cv_enable_asserts=$enable_asserts],
 [AC_CACHE_VAL(unet_cv_enable_asserts,
-[unet_cv_enable_asserts=no])])
+[unet_cv_enable_asserts=yes])])
 AC_MSG_RESULT([$unet_cv_enable_asserts])
 
 if test x"$unet_cv_enable_asserts" = xno; then
@@ -264,6 +284,19 @@ 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],
@@ -316,13 +349,13 @@ if test x"$unet_cv_enable_inlines" = xyes; then
     AC_DEFINE([FORCEINLINE], , [Force inlining for a few critical functions])
 fi
 
-dnl --enable-devpoll check...
+dnl --disable-devpoll check...
 AC_MSG_CHECKING([whether to enable the /dev/poll event engine])
 AC_ARG_ENABLE([devpoll],
-[  --enable-devpoll        Enable the experimental /dev/poll-based engine],
+[  --disable-devpoll       Enable the /dev/poll-based engine],
 [unet_cv_enable_devpoll=$enable_devpoll],
 [AC_CACHE_VAL(unet_cv_enable_devpoll,
-[unet_cv_enable_devpoll=no])])
+[unet_cv_enable_devpoll=yes])])
 
 if test x"$ac_cv_header_sys_devpoll_h" = xno; then
     unet_cv_enable_devpoll=no
@@ -335,13 +368,13 @@ if test x"$unet_cv_enable_devpoll" != xno; then
     ENGINE_C="engine_devpoll.c $ENGINE_C"
 fi
 
-dnl --enable-kqueue check...
+dnl --disable-kqueue check...
 AC_MSG_CHECKING([whether to enable the kqueue event engine])
 AC_ARG_ENABLE([kqueue],
-[  --enable-kqueue         Enable the experimental kqueue-based engine],
+[  --disable-kqueue        Enable the kqueue-based engine],
 [unet_cv_enable_kqueue=$enable_kqueue],
 [AC_CACHE_VAL(unet_cv_enable_kqueue,
-[unet_cv_enable_kqueue=no])])
+[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
@@ -354,6 +387,34 @@ if test x"$unet_cv_enable_kqueue" != xno; then
     ENGINE_C="engine_kqueue.c $ENGINE_C"
 fi
 
+dnl --disable-adns check...
+AC_MSG_CHECKING([whether to enable the adns resolver engine])
+AC_ARG_ENABLE([adns],
+[  --disable-adns          Disable adns resolver],
+[unet_cv_enable_adns=$enable_adns],
+[AC_CACHE_VAL(unet_cv_enable_adns,
+[unet_cv_enable_adns=yes])])
+
+AC_MSG_RESULT([$unet_cv_enable_adns])
+
+if test x"$unet_cv_enable_adns" != xno; then
+    AC_DEFINE([USE_ADNS], , [Define to enable the adns resolver])
+    AC_CONFIG_SUBDIRS([adns])
+    RES_C="res_adns.c"
+    LIBS="../adns/src/libadns.a $LIBS"
+    ADNS_SUBDIR="adns"
+else
+    RES_C="res_libresolv.c"
+    ADNS_SUBDIR=""
+
+    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()])])
+fi
+AC_SUBST(RES_C)
+AC_SUBST(ADNS_SUBDIR)
+
 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],
@@ -649,3 +710,29 @@ AC_DEFINE_UNQUOTED(MAXCONNECTIONS, $unet_cv_with_maxcon,
 
 dnl Finally really generate all output files:
 AC_OUTPUT(Makefile ircd/Makefile doc/Makefile, [echo timestamp > stamp-h])
+
+dnl Report configuration
+AC_OUTPUT_COMMANDS([echo "
+ircu is now hopefully configured for your system.
+
+  Host system:         $host_os
+  Prefix:              $prefix
+  Asserts:             $unet_cv_enable_asserts
+  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
+  
+  Domain:              $unet_cv_with_domain
+  DPath:               $unet_cv_with_dpath
+  CPath:               $unet_cv_with_cpath
+  LPath:               $unet_cv_with_lpath
+  Maximum connections: $unet_cv_with_maxcon
+  
+  poll() engine:       $unet_cv_enable_poll
+  kqueue() engine:     $unet_cv_enable_kqueue
+  /dev/poll engine:    $unet_cv_enable_devpoll
+"])