Skip to content

Commit

Permalink
adjust auto-configuration of CPPFLAGS vs. CFLAGS
Browse files Browse the repository at this point in the history
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 racket#945
  • Loading branch information
mflatt committed Jun 6, 2015
1 parent fc6ead4 commit cf8c3c9
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
21 changes: 21 additions & 0 deletions racket/src/configure
Original file line number Diff line number Diff line change
Expand Up @@ -3268,7 +3268,16 @@ if test "${enable_ios}" != "" ; then
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} LDFLAGS="'"'"${LDFLAGS}"'"'
fi


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_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
Expand Down Expand Up @@ -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_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
AS="${ac_tool_prefix}as"
as_was_set=no
Expand Down
23 changes: 22 additions & 1 deletion racket/src/racket/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,31 @@ if test "${enable_ios}" != "" ; then
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} CPPFLAGS="'"'"${PREFLAGS}"'"'
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} LDFLAGS="'"'"${LDFLAGS}"'"'
fi



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_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
AS="${ac_tool_prefix}as"
as_was_set=no
Expand Down

0 comments on commit cf8c3c9

Please sign in to comment.