diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2011-12-15 17:42:01 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2011-12-15 17:42:01 +0400 |
commit | 58dc9c51b933676ac77f675773b09b181f11485e (patch) | |
tree | e3bb153a82eecb1deb667c984a0c67ae913c4764 /configure.ac | |
parent | 585f9b9f3ad31c32c0e44ad68bac2aea53d89ec9 (diff) | |
download | bdwgc-58dc9c51b933676ac77f675773b09b181f11485e.tar.gz |
Fix configure to disable GCC aliasing optimization unless forced to
* configure.ac (ac_cv_fno_strict_aliasing): New variable (set to
"skipped" if the client passed "-fstrict-aliasing" option to CFLAGS
else set to "yes" if GCC supports "-fno-strict-aliasing" option,
otherwise set to "no").
* configure.ac (CFLAGS): Append "-fno-strict-aliasing" if
ac_cv_fno_strict_aliasing is "yes" (only if GCC).
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index e1c6e2c2..0f96066d 100644 --- a/configure.ac +++ b/configure.ac @@ -397,6 +397,30 @@ if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then AC_DEFINE([DARWIN_DONT_PARSE_STACK], 1, [See doc/README.macros.]) fi +if test "$GCC" == yes; then + # Disable aliasing optimization unless forced to. + AC_MSG_CHECKING([whether gcc supports -fno-strict-aliasing]) + ac_cv_fno_strict_aliasing=no + for cflag in $CFLAGS; do + case "$cflag" in + -fstrict-aliasing) + # Opposite option already present + ac_cv_fno_strict_aliasing=skipped + break + ;; + esac + done + if test "$ac_cv_fno_strict_aliasing" != skipped; then + old_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-strict-aliasing" + AC_TRY_COMPILE([],[], [ac_cv_fno_strict_aliasing=yes], []) + CFLAGS="$old_CFLAGS" + AS_IF([test "$ac_cv_fno_strict_aliasing" = yes], + [CFLAGS="$CFLAGS -fno-strict-aliasing"], []) + fi + AC_MSG_RESULT($ac_cv_fno_strict_aliasing) +fi + case "$host" in # While IRIX 6 has libdl for the O32 and N32 ABIs, it's missing for N64 # and unnecessary everywhere. |