Author: Isomer <isomer@undernet.org>
[ircu2.10.12-pk.git] / configure.in
index 531c045f226776d9942a9fbce0e7acaf3717be30..732916399655faa1507230bcbb2f211d4e87d555 100644 (file)
@@ -41,8 +41,8 @@ ac_default_prefix=$unet_cv_prefix
 dnl Define the input and output configuration header file.
 AC_CONFIG_HEADER([config.h])
 
-dnl Demand at least version 2.50 of autoconf
-AC_PREREQ(2.50)
+dnl Demand at least version 2.59 of autoconf (for AS_HELP_STRING)
+AC_PREREQ(2.59)
 
 dnl Find out what type of system we are
 AC_CANONICAL_HOST
@@ -52,13 +52,17 @@ AC_PROG_CC
 
 dnl ANSIfy the C compiler whenever possible.
 AM_PROG_CC_STDC
-dnl Use -O3 instead of -O2.
-if test x"$CFLAGS" != x; then
-    CFLAGS=`echo "$CFLAGS" | sed -e 's/-O2/-O3/'`
+dnl Allow specification of optimization level.
+AC_ARG_WITH([optimization],
+    AS_HELP_STRING([--with-optimization=[-O2]], [Explicitly set the compiler optimization flags (default: -O3)]),
+    [unet_cv_optimization=$withval],
+    [unet_cv_optimization='-O3'])
+AC_CACHE_CHECK([optimization level], [unet_cv_optimization], [unet_cv_optimization='-O3'])
+if test "x$unet_cv_optimization" = "xno" ; then
+    unet_cv_optimization=""
 fi
-dnl Remove -pipe during configure
 if test x"$CFLAGS" != x; then
-    CFLAGS=`echo "$CFLAGS" | sed -e 's/-pipe//g'`
+    CFLAGS=`echo "$CFLAGS" | sed -e s/-O2/$unet_cv_optimization/`
 fi
 dnl Notice the -g flag and deal accordingly
 if test x"$CFLAGS" != x; then
@@ -168,16 +172,13 @@ if test "$YACC" = ":" ; then
 elif echo "" | $YACC -V -v --version > /dev/null 2>&1 ; then
   :
 else
-  AC_MSG_ERROR([Cannot use $YACC as yacc.])
+dnl byacc does not seem to have any way to test for workingness, so only warn.
+  AC_MSG_WARN([$YACC may not work as yacc.])
 fi
 
-
 unet_NONBLOCKING
 unet_SIGNALS
 
-dnl Add -pipe when possible
-unet_PIPE_CFLAGS
-
 dnl Check OS for os_dep files.
 AC_MSG_CHECKING(for OS-dependent information)
 case "$host" in
@@ -248,7 +249,7 @@ fi
 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()])
+    AC_DEFINE([USE_POLL], 1, [Specify whether or not to use poll()])
     ENGINE_C=engine_poll.c
 else
     ENGINE_C=engine_select.c
@@ -265,7 +266,7 @@ AC_ARG_ENABLE([debug],
 AC_MSG_RESULT([$unet_cv_enable_debug])
 
 if test x"$unet_cv_enable_debug" = xyes; then
-    AC_DEFINE([DEBUGMODE], , [Enable debugging code])
+    AC_DEFINE([DEBUGMODE], 1, [Enable debugging code])
 fi
 
 dnl Now look for --enable-leak-detect
@@ -291,7 +292,7 @@ AC_ARG_WITH([ipv6],
     [ac_cv_use_ipv6=$unet_have_sockaddr_in6])
 AC_CACHE_CHECK([whether to use IPv6], [ac_cv_use_ipv6], [ac_cv_use_ipv6=no])
 if test x"$ac_cv_use_ipv6" != "xno" ; then
-    AC_DEFINE([IPV6], , [Enable IPv6 support])
+    AC_DEFINE([IPV6], 1, [Enable IPv6 support])
 fi
 
 dnl And now for --disable-asserts
@@ -304,7 +305,7 @@ AC_ARG_ENABLE([asserts],
 AC_MSG_RESULT([$unet_cv_enable_asserts])
 
 if test x"$unet_cv_enable_asserts" = xno; then
-    AC_DEFINE([NDEBUG], , [Disable assertions])
+    AC_DEFINE([NDEBUG], 1, [Disable assertions])
 fi
 
 dnl Check for --enable-symbols
@@ -369,7 +370,7 @@ AC_ARG_ENABLE([inlines],
 AC_MSG_RESULT([$unet_cv_enable_inlines])
 
 if test x"$unet_cv_enable_inlines" = xyes; then
-    AC_DEFINE([FORCEINLINE], , [Force inlining for a few critical functions])
+    AC_DEFINE([FORCEINLINE], 1, [Force inlining for a few critical functions])
 fi
 
 dnl --disable-devpoll check...
@@ -387,7 +388,7 @@ 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])
+    AC_DEFINE([USE_DEVPOLL], 1, [Define to enable the /dev/poll engine])
     ENGINE_C="engine_devpoll.c $ENGINE_C"
 fi
 
@@ -406,7 +407,7 @@ 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])
+    AC_DEFINE([USE_KQUEUE], 1, [Define to enable the kqueue engine])
     ENGINE_C="engine_kqueue.c $ENGINE_C"
 fi
 
@@ -431,8 +432,8 @@ if test x"$unet_cv_enable_epoll" != xno; then
     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])
+         AC_DEFINE([EPOLL_NEED_BODY], 1, [Define to implement epoll system calls])])
+    AC_DEFINE([USE_EPOLL], 1, [Define to enable the epoll engine])
     ENGINE_C="engine_epoll.c $ENGINE_C"
 fi