diff options
Diffstat (limited to 'm4/curl-confopts.m4')
-rw-r--r-- | m4/curl-confopts.m4 | 76 |
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 |