Mercurial > hg > xemacs-beta
changeset 2512:38caebdefb55
[xemacs-hg @ 2005-01-26 10:02:12 by ben]
Separate out optimization and debugging cflags
configure.in, configure.usage: Add --with-optimization, cflags-optimization,
cflags-debugging. Separate out optimization and debugging arguments.
Document.
author | ben |
---|---|
date | Wed, 26 Jan 2005 10:02:13 +0000 |
parents | b9a1074dc6bf |
children | d8595adfc810 |
files | ChangeLog configure.in configure.usage |
diffstat | 3 files changed, 121 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jan 26 09:57:14 2005 +0000 +++ b/ChangeLog Wed Jan 26 10:02:13 2005 +0000 @@ -1,3 +1,13 @@ +2005-01-26 Ben Wing <ben@xemacs.org> + + * configure.in (AC_INIT_PARSE_ARGS): + * configure.in (CANONICALIZE_PATH): + * configure.in (TAB): + * configure.usage: + Add --with-optimization, cflags-optimization, + cflags-debugging. Separate out optimization and debugging arguments. + Document. + 2005-01-21 Aidan Kehoe <kehoea@parhasard.net> * configure:
--- a/configure.in Wed Jan 26 09:57:14 2005 +0000 +++ b/configure.in Wed Jan 26 10:02:13 2005 +0000 @@ -531,6 +531,7 @@ with_dnet | \ with_infodock | \ with_netinstall | \ + with_optimization | \ with_ipv6_cname | \ external_widget | \ use_kkcc | \ @@ -560,6 +561,8 @@ xemacs_compiler | \ cflags | \ cflags_warning | \ + cflags_optimization | \ + cflags_debugging | \ cpp | \ cppflags | \ libs | \ @@ -1675,6 +1678,16 @@ else cflags_warning_specified=no; fi +if test "${cflags_optimization-unset}" != unset + then cflags_optimization_specified=yes; + else cflags_optimization_specified=no; +fi + +if test "${cflags_debugging-unset}" != unset + then cflags_debugging_specified=yes; + else cflags_debugging_specified=no; +fi + xe_save_CFLAGS="$CFLAGS" AC_PROG_CC dnl Autoconf has its own magic for compiler autodetection @@ -2011,34 +2024,66 @@ fi fi -dnl #### This may need to be overhauled so that all of XEMACS_CC's flags -dnl are handled separately, not just the xe_cflags_warning stuff. - -AC_MSG_CHECKING([for preferred CFLAGS]) - -dnl Use either command line flag, environment var, or autodetection -if test "$cflags_specified" = "no"; then - dnl Following values of CFLAGS are known to work well. - dnl Should we take debugging options into consideration? - if test "$GCC" = "yes"; then - CFLAGS="-g -O3" - elif test "$__SUNPRO_C" = "yes"; then - case "$opsys" in - sol2 ) CFLAGS="-xO4" ;; - sunos4* ) CFLAGS="-xO2" ;; - esac - elif test "$__DECC" = "yes"; then - CFLAGS="-O3" - elif test "$CC" = "xlc"; then - CFLAGS="-g -O3 -qstrict -qnoansialias -qlibansi -qro -qmaxmem=20000" - elif test "$__ICC" = "yes"; then - CFLAGS="-g -O3 -Ob2" - dnl ### Add optimal CFLAGS support for other compilers HERE! +dnl Calculate optimization flags. These will be off by default in beta +dnl versions and on in release versions. + +if test -z "$with_optimization" ; then + if test -n "$emacs_is_beta" ; then + with_optimization=no else - CFLAGS="-O" ;dnl The only POSIX-approved flag + with_optimization=yes fi fi -AC_MSG_RESULT([${CFLAGS}]) + +dnl #### We should be checking C_OPTIMIZE_SWITCH in m/*, s/*. + +AC_MSG_CHECKING([for preferred optimization flags]) +if test "$with_optimization" = "yes" ; then + if test "$cflags_optimization_specified" = "no"; then + dnl Following values of cflags_optimization are known to work well. + dnl Should we take debugging options into consideration? + if test "$GCC" = "yes"; then + cflags_optimization="-O3" + elif test "$__SUNPRO_C" = "yes"; then + case "$opsys" in + sol2 ) cflags_optimization="-xO4" ;; + sunos4* ) cflags_optimization="-xO2" ;; + esac + elif test "$__DECC" = "yes"; then + cflags_optimization="-O3" + elif test "$CC" = "xlc"; then + dnl see http://www.nersc.gov/vendor_docs/ibm/vac/sc094959.pdf + cflags_optimization="-O3 -qstrict -qnoansialias -qlibansi -qmaxmem=20000" + elif test "$__ICC" = "yes"; then + cflags_optimization="-O3 -Ob2" + dnl ### Add optimal cflags_optimization support for other compilers HERE! + else + cflags_optimization="-O" ;dnl The only POSIX-approved flag + fi + fi +else + cflags_optimization= +fi + +AC_MSG_RESULT([${cflags_optimization}]) + +dnl #### We should be checking C_DEBUG_SWITCH in m/*, s/*. + +AC_MSG_CHECKING([for preferred debugging flags]) +if test "$cflags_debugging_specified" = "no"; then + dnl ### Add optimal debugging support for other compilers HERE! + cflags_debugging="-g" + + debugging_ok_with_optimization=no + if test "$GCC" = "yes" -o "$CC" = "xlc" -o "$__ICC" = "yes"; then + debugging_ok_with_optimization=yes + fi + + if test "$with_optimization" = "yes" -a "$debugging_ok_with_optimization" = "no"; then + cflags_debugging= + fi +fi +AC_MSG_RESULT([${cflags_debugging}]) dnl Calculate warning flags. We separate the flags for warnings from dnl the other flags because we want to force the warnings to be seen @@ -2102,13 +2147,33 @@ AC_MSG_CHECKING([for preferred warning flags for CC]) AC_MSG_RESULT([${cflags_warning}]) -dnl Now combine all C flags. Put the warning flags first so that -dnl user-specified flags will override. -dnl Do XE_CFLAGS before adding warning flags to CFLAGS. +dnl Calculate remaining cflags. +dnl Use either command line flag, environment var, or autodetection + +AC_MSG_CHECKING([for remaining CFLAGS]) + +if test "$cflags_specified" = "no"; then + dnl Following values of CFLAGS are known to work well. + if test "$CC" = "xlc"; then + CFLAGS="-qro" + dnl ### Add optimal CFLAGS support for other compilers HERE! + fi +fi +AC_MSG_RESULT([${CFLAGS}]) + +dnl Now combine all C flags. Put the warning and optimization flags first +dnl so that user-specified flags will override. +dnl Do XE_CFLAGS before adding flags to CFLAGS. dnl Flags for XEMACS_CC: -XE_CFLAGS="$xe_cflags_warning $CFLAGS" + +XE_CFLAGS="$xe_cflags_warning $cflags_debugging $cflags_optimization $CFLAGS" dnl Flags for CC: -CFLAGS="$cflags_warning $CFLAGS" +CFLAGS="$cflags_warning $cflags_debugging $cflags_optimization $CFLAGS" + +AC_MSG_CHECKING([total value of XE_CFLAGS]) +AC_MSG_RESULT([${XE_CFLAGS}]) +AC_MSG_CHECKING([total value of CFLAGS]) +AC_MSG_RESULT([${CFLAGS}]) dnl Search for GCC specific build problems we know about if test "$GCC" = "yes"; then
--- a/configure.usage Wed Jan 26 09:57:14 2005 +0000 +++ b/configure.usage Wed Jan 26 10:02:13 2005 +0000 @@ -42,6 +42,22 @@ --cflags-warning=FLAGS Override compiler flags used to control warnings. Normally, don't set this, as XEmacs already turns on the maximum safe warning level. +--with-optimization Control whether compilation is optimized. + By default, optimization is on in release versions + and off in beta versions, since it can interfere + with proper stack backtraces. +--cflags-optimization=FLAGS + Override compiler flags used to control optimization. + Only has an effect when optimization is enabled. + Normally, don't set this, as XEmacs will already set + the maximum safe optimization flags appropriate for + the compiler being invoked. +--cflags-debugging=FLAGS + Override compiler flags used to add debugging + information to the executable. Normally, debugging + information is added whenever possible (i.e. unless + optimization is turned on and the compiler does not + permit debugging and optimization simultaneously). --cpp=PROG C preprocessor to use (e.g. /usr/ccs/lib/cpp or cc -E) --cppflags=FLAGS C preprocessor flags (e.g. -I/foo or -Dfoo=bar) --libs=LIBS Additional libraries (e.g. -lfoo)