1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-07 01:55:05 -05:00
curl/ares/m4/cares-confopts.m4
Yang Tse d930280af5 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.
2008-10-07 13:13:34 +00:00

143 lines
5.2 KiB
Plaintext

#***************************************************************************
# $Id$
#
# Copyright (C) 2008 by Daniel Stenberg et al
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
# serial 2
dnl CARES_CHECK_OPTION_DEBUG
dnl -------------------------------------------------
dnl Verify if configure has been invoked with option
dnl --enable-debug or --disable-debug, and set shell
dnl variable want_debug value as appropriate.
AC_DEFUN([CARES_CHECK_OPTION_DEBUG], [
AC_BEFORE([$0],[CARES_CHECK_OPTION_WARNINGS])dnl
AC_BEFORE([$0],[CARES_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)
case "$OPT_DEBUG_BUILD" in
no)
dnl --disable-debug option used
want_debug="no"
;;
default)
dnl configure option not specified
want_debug="no"
;;
*)
dnl --enable-debug option used
want_debug="yes"
;;
esac
AC_MSG_RESULT([$want_debug])
])
dnl CARES_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([CARES_CHECK_OPTION_OPTIMIZE], [
AC_REQUIRE([CARES_CHECK_OPTION_DEBUG])dnl
AC_BEFORE([$0],[CARES_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(=OPT)],[Enable compiler optimizations (default=-O2)])
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 CARES_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.
AC_DEFUN([CARES_CHECK_OPTION_WARNINGS], [
AC_REQUIRE([CARES_CHECK_OPTION_DEBUG])dnl
AC_BEFORE([$0],[CARES_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)
case "$OPT_COMPILER_WARNINGS" in
no)
dnl --disable-warnings option used
want_warnings="no"
;;
default)
dnl configure option not specified, so
dnl use same setting as --enable-debug
want_warnings="$want_debug"
;;
*)
dnl --enable-warnings option used
want_warnings="yes"
;;
esac
AC_MSG_RESULT([$want_warnings])
])