aboutsummaryrefslogtreecommitdiff
path: root/m4/curl-confopts.m4
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-10-07 13:13:34 +0000
committerYang Tse <yangsita@gmail.com>2008-10-07 13:13:34 +0000
commitd930280af5df9de318229b8fa7d4f1f7d27b748d (patch)
treec79ac6f04669ee46421271c6eabd9f7bbddb000f /m4/curl-confopts.m4
parent445e4a9792f5a71ce3c38de2fa0334bf13cff15a (diff)
Initial attempt to support configure's --(dis|en)able-optimize
option to specify dis(activation) of compiler optimizations. If option is specified, it will be honored independant of the --(dis|en)able-debug option.
Diffstat (limited to 'm4/curl-confopts.m4')
-rw-r--r--m4/curl-confopts.m476
1 files changed, 66 insertions, 10 deletions
diff --git a/m4/curl-confopts.m4 b/m4/curl-confopts.m4
index 0c125d9c3..b0c1f3cd4 100644
--- a/m4/curl-confopts.m4
+++ b/m4/curl-confopts.m4
@@ -22,7 +22,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 2
+# serial 3
dnl CURL_CHECK_OPTION_DEBUG
@@ -33,13 +33,13 @@ dnl variable want_debug value as appropriate.
AC_DEFUN([CURL_CHECK_OPTION_DEBUG], [
AC_BEFORE([$0],[CURL_CHECK_OPTION_WARNINGS])dnl
- AC_BEFORE([$0],[AC_PROG_CC])dnl
+ AC_BEFORE([$0],[CURL_CHECK_PROG_CC])dnl
AC_MSG_CHECKING([whether to enable debug build options])
OPT_DEBUG_BUILD="default"
AC_ARG_ENABLE(debug,
- AC_HELP_STRING([--enable-debug],[Enable debug build options])
- AC_HELP_STRING([--disable-debug],[Disable debug build options]),
- OPT_DEBUG_BUILD=$enableval)
+AC_HELP_STRING([--enable-debug],[Enable debug build options])
+AC_HELP_STRING([--disable-debug],[Disable debug build options]),
+ OPT_DEBUG_BUILD=$enableval)
case "$OPT_DEBUG_BUILD" in
no)
dnl --disable-debug option used
@@ -58,21 +58,77 @@ AC_DEFUN([CURL_CHECK_OPTION_DEBUG], [
])
+dnl CURL_CHECK_OPTION_OPTIMIZE
+dnl -------------------------------------------------
+dnl Verify if configure has been invoked with option
+dnl --enable-optimize or --disable-optimize, and set
+dnl shell variable want_optimize value as appropriate.
+
+AC_DEFUN([CURL_CHECK_OPTION_OPTIMIZE], [
+ AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
+ AC_BEFORE([$0],[CURL_CHECK_PROG_CC])dnl
+ AC_MSG_CHECKING([whether to enable compiler optimizer])
+ OPT_COMPILER_OPTIMIZE="default"
+ AC_ARG_ENABLE(optimize,
+AC_HELP_STRING([--enable-optimize],[Enable compiler optimizations])
+AC_HELP_STRING([--disable-optimize],[Disable compiler optimizations]),
+ OPT_COMPILER_OPTIMIZE=$enableval)
+ case "$OPT_COMPILER_OPTIMIZE" in
+ no)
+ dnl --disable-optimize option used. We will handle this as
+ dnl a request to disable compiler optimizations if possible.
+ dnl If the compiler is known CFLAGS and CPPFLAGS will be
+ dnl overridden, otherwise this can not be honored.
+ want_optimize="no"
+ AC_MSG_RESULT([no])
+ ;;
+ default)
+ dnl configure's optimize option not specified. Initially we will
+ dnl handle this as a a request contrary to configure's setting
+ dnl for --enable-debug. IOW, initially, for debug-enabled builds
+ dnl this will be handled as a request to disable optimizations if
+ dnl possible, and for debug-disabled builds this will be handled
+ dnl initially as a request to enable optimizations if possible.
+ dnl Finally, if the compiler is known and CFLAGS and CPPFLAGS do
+ dnl not have any optimizer flag the request will be honored, in
+ dnl any other case the request can not be honored.
+ dnl IOW, existing optimizer flags defined in CFLAGS or CPPFLAGS
+ dnl will always take precedence over any initial assumption.
+ if test "$want_debug" = "yes"; then
+ want_optimize="assume_no"
+ AC_MSG_RESULT([not specified (assuming no)])
+ else
+ want_optimize="assume_yes"
+ AC_MSG_RESULT([not specified (assuming yes)])
+ fi
+ ;;
+ *)
+ dnl --enable-optimize option used. We will handle this as
+ dnl a request to enable compiler optimizations if possible.
+ dnl If the compiler is known CFLAGS and CPPFLAGS will be
+ dnl overridden, otherwise this can not be honored.
+ want_optimize="yes"
+ AC_MSG_RESULT([yes])
+ ;;
+ esac
+])
+
+
dnl CURL_CHECK_OPTION_WARNINGS
dnl -------------------------------------------------
dnl Verify if configure has been invoked with option
dnl --enable-warnings or --disable-warnings, and set
-DNL shell variable want_warnings as appropriate.
+dnl shell variable want_warnings as appropriate.
AC_DEFUN([CURL_CHECK_OPTION_WARNINGS], [
AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
- AC_BEFORE([$0],[AC_PROG_CC])dnl
+ AC_BEFORE([$0],[CURL_CHECK_PROG_CC])dnl
AC_MSG_CHECKING([whether to enable strict compiler warnings])
OPT_COMPILER_WARNINGS="default"
AC_ARG_ENABLE(warnings,
- AC_HELP_STRING([--enable-warnings],[Enable strict compiler warnings])
- AC_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]),
- OPT_COMPILER_WARNINGS=$enableval)
+AC_HELP_STRING([--enable-warnings],[Enable strict compiler warnings])
+AC_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]),
+ OPT_COMPILER_WARNINGS=$enableval)
case "$OPT_COMPILER_WARNINGS" in
no)
dnl --disable-warnings option used