adjust auto-configuration of CPPFLAGS vs. CFLAGS

When AC_PROG_CC picks GCC, move its selection of CFLAGS
into CPPFLAGS, so that preprocessing will have the same
optimization and debugging flags as compilation.

Arguably, AC_PROG_CC plus AC_PROG_CPP should do that
soemhow, but it's understandable that the autoconf
implementers didn't cover the possibility of
preprocessing that changes with the optimization level.

Closes #945
This commit is contained in:
Matthew Flatt 2015-06-04 08:00:54 -06:00
parent fc6ead4ac2
commit cf8c3c9cfe
2 changed files with 43 additions and 1 deletions

21
racket/src/configure vendored
View File

@ -3268,7 +3268,16 @@ if test "${enable_ios}" != "" ; then
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} LDFLAGS="'"'"${LDFLAGS}"'"' SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} LDFLAGS="'"'"${LDFLAGS}"'"'
fi fi
if test "${enable_oskit}" = "no" ; then if test "${enable_oskit}" = "no" ; then
# Auto-set CC, CPP, etc.
if test "${CFLAGS}${CC}${CPP}" = "" ; then
starts_out_default=yes
else
starts_out_default=no
fi
ac_ext=c ac_ext=c
ac_cpp='$CPP $CPPFLAGS' ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@ -4195,6 +4204,18 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "$starts_out_default" = "yes" ; then
if test "$GCC" = "yes" ; then
# Auto selection of C compiler picked GCC, so we
# assume it also picked the GNU preprocessor; move
# auto-picked CFLAGS to PREFLAGS so that compilation
# and preprocessing are in sync (e.g., for optimization flags)
PREFLAGS="${CFLAGS} ${PREFLAGS}"
CPPFLAGS="${CFLAGS} ${CPPFLAGS}"
CFLAGS=""
fi
fi
if test "$AS" = '' ; then if test "$AS" = '' ; then
AS="${ac_tool_prefix}as" AS="${ac_tool_prefix}as"
as_was_set=no as_was_set=no

View File

@ -540,9 +540,30 @@ if test "${enable_ios}" != "" ; then
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} LDFLAGS="'"'"${LDFLAGS}"'"' SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} LDFLAGS="'"'"${LDFLAGS}"'"'
fi fi
if test "${enable_oskit}" = "no" ; then if test "${enable_oskit}" = "no" ; then
# Auto-set CC, CPP, etc.
if test "${CFLAGS}${CC}${CPP}" = "" ; then
starts_out_default=yes
else
starts_out_default=no
fi
AC_PROG_CC AC_PROG_CC
AC_PROG_CPP AC_PROG_CPP
if test "$starts_out_default" = "yes" ; then
if test "$GCC" = "yes" ; then
# Auto selection of C compiler picked GCC, so we
# assume it also picked the GNU preprocessor; move
# auto-picked CFLAGS to PREFLAGS so that compilation
# and preprocessing are in sync (e.g., for optimization flags)
PREFLAGS="${CFLAGS} ${PREFLAGS}"
CPPFLAGS="${CFLAGS} ${CPPFLAGS}"
CFLAGS=""
fi
fi
if test "$AS" = '' ; then if test "$AS" = '' ; then
AS="${ac_tool_prefix}as" AS="${ac_tool_prefix}as"
as_was_set=no as_was_set=no