diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-08-07 14:05:28 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-08-07 14:05:28 +0200 |
commit | 8bb8c84d624edd100dbd37d5e22721aca8c08dfa (patch) | |
tree | 876657a04a2d36fba3c24bef4bf20925178598bc /configure.ac | |
parent | cf31ec3e0bea593f076e9a39dc59d1eed17300b7 (diff) |
Replace the CFLAGS-checking code with a common macro from xine-lib.
Instead of writing custom code to check for cflags checking, import a
copy of attributes.m4 from xine-lib's repository and use the
CC_CHECK_CFLAGS macro.
The advantage lies not only in being able to reduce the custom code in
configure.ac, but also in the fact that the CC_CHECK_CFLAGS macro
caches the results, making ./configure -C quite faster on second run.
Check for the CFLAGS for any compiler and not just GCC, if the
compiler does support the flag it is better to u se it anyway,
otherwise it will be skipped.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/configure.ac b/configure.ac index 0d00b25..1a62085 100644 --- a/configure.ac +++ b/configure.ac @@ -44,29 +44,11 @@ AC_USE_SYSTEM_EXTENSIONS AC_PROG_MAKE_SET AC_PROG_LIBTOOL -test_gcc_flag() { - AC_LANG_CONFTEST([int main(int argc, char*argv[]) {}]) - $CC -c conftest.c $CFLAGS "$1" -o conftest.o > /dev/null 2> /dev/null - ret=$? - rm -f conftest.o - return $ret -} - -# If using GCC specify some additional parameters -if test "x$GCC" = "xyes" ; then - DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter -ffast-math" - - for flag in $DESIRED_FLAGS ; do - AC_MSG_CHECKING([whether $CC accepts $flag]) - if test_gcc_flag $flag ; then - CFLAGS="$CFLAGS $flag" - CXXFLAGS="$CXXFLAGS $flag" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - done -fi +DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter -ffast-math" + +for flag in $DESIRED_FLAGS ; do + CC_CHECK_CFLAGS([$flag], [CFLAGS="$CFLAGS $flag"]) +done # Checks for header files. AC_HEADER_ASSERT |