[Speex-dev] [PATCH] fix gcc 3.4 warnings
Erik de Castro Lopo
erikd-100 at mega-nerd.com
Mon Sep 5 16:51:06 PDT 2005
Ralph Giles wrote:
> FWIW, configure is already checking to see whether the compiler is gcc
> or not. There's an if clause in the configure scripts for ogg, vorbis,
> theora, and other of our packages that uses this to add for example
> '-O2 -Wall' to CFLAGS iff $CC is gcc. You can crib from there if you
> want.
>From the configure.ac of libsndfile:
------------------------8<-----------------------------
if test x$ac_cv_c_compiler_gnu = xyes ; then
CFLAGS="$CFLAGS -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings"
# -Wpointer-arith -Wundef -Wmissing-declarations -Winline -Wconversion"
if test "$ac_arg_gcc_opt" = "N" ; then
temp_CFLAGS=`echo $CFLAGS | sed "s/O2/O0/"`
CFLAGS=$temp_CFLAGS
AC_MSG_WARN([[*** Compiler optimisations switched off. ***]])
fi
# OS specific tweaks.
case "$host_os" in
darwin* | rhapsody*)
# Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody.
# System headers on these systems are broken.
temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall -pedantic//" | sed "s/-Wshadow//" | sed "s/-Waggregate-return//"`
CFLAGS=$temp_CFLAGS
SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(srcdir)/Symbols.darwin"
;;
linux*)
SHLIB_VERSION_ARG="-Wl,--version-script=\$(srcdir)/Symbols.linux"
;;
*)
;;
esac
if test x$ac_arg_gcc_pipe != "xN" ; then
CFLAGS="$CFLAGS -pipe"
fi
if test x$ac_arg_gcc_werror = "xyes" ; then
CFLAGS="-Werror $CFLAGS"
fi
AC_DEFINE([COMPILER_IS_GCC],1, [Set to 1 if the compile is GNU GCC.])
GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"`
AC_DEFINE_UNQUOTED([GCC_MAJOR_VERSION],${GCC_MAJOR_VERSION}, [Major version of GCC or 3 otherwise.])
fi
CFLAGS="$CFLAGS $OS_SPECIFIC_CFLAGS"
if test x"$CFLAGS" = x ; then
echo "Error in configure script. CFLAGS has been screwed up."
exit
fi
------------------------8<-----------------------------
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo nospam at mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"... there's something really scary about a language (C++) where
copying state from one object to another is this complicated"
-- Richard Gillam
More information about the Speex-dev
mailing list