Author: Alex Badea <vampire@p16.pub.ro>
[ircu2.10.12-pk.git] / configure.in
index 14b86d01edd79022b9a683d0d280b177ac4e18e0..e5f837e5c241cefd00a0c30493633c4b43021505 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!
@@ -76,6 +78,24 @@ 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.
 
@@ -93,7 +113,7 @@ AC_SEARCH_LIBS(res_mkquery, resolv, ,
 
 dnl Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS(poll.h)
+AC_CHECK_HEADERS(poll.h sys/devpoll.h sys/event.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics
 dnl AC_C_CONST
@@ -105,6 +125,7 @@ AC_TYPE_UID_T
 unet_CHECK_TYPE_SIZES
 
 dnl Checks for library functions.
+AC_CHECK_FUNCS([kqueue setrlimit getrusage times])
 
 dnl Do we have restarting syscalls ?
 AC_SYS_RESTARTABLE_SYSCALLS
@@ -172,6 +193,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.])
@@ -200,7 +227,11 @@ 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])
@@ -215,13 +246,13 @@ if test x"$unet_cv_enable_debug" = xyes; then
     AC_DEFINE([DEBUGMODE], , [Enable debugging code])
 fi
 
-dnl And now for --enable-asserts
+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
@@ -241,6 +272,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],
@@ -254,6 +298,32 @@ 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])
+
+if test x"$unet_cv_enable_warnings" = xyes; then
+    CFLAGS="-Wall $CFLAGS"
+fi
+
 dnl --disable-inlines check...
 AC_MSG_CHECKING([whether to enable inlining for a few critical functions])
 AC_ARG_ENABLE([inlines],
@@ -267,6 +337,44 @@ if test x"$unet_cv_enable_inlines" = xyes; then
     AC_DEFINE([FORCEINLINE], , [Force inlining for a few critical functions])
 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],
+[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        Enable 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
+
+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 --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],