Author: Isomer <isomer@undernet.org>
[ircu2.10.12-pk.git] / configure.in
index d5e9b07daba542f0f813e3c35dfea305f657dc6b..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
@@ -172,13 +176,9 @@ 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