diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-08-08 13:29:53 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-08-08 15:09:37 +0200 |
commit | 81969a73a494a36356e764cf3576aa48c101bffb (patch) | |
tree | 9e70f3986169acf266dada2a19507a529e26ed88 /configure.ac | |
parent | a6e4507a4b9f48379e69748e7c4a0374dd11b13d (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 | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac index a7fbd1a1..f56be997 100644 --- a/configure.ac +++ b/configure.ac @@ -98,30 +98,12 @@ if test "x$M4" = xno ; then AC_MSG_ERROR([m4 missing]) fi -# GCC flags - -test_gcc_flag() { - AC_LANG_CONFTEST([int main(int argc, char*argv[]) {}]) - $CC -c conftest.c $CFLAGS -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" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - done -fi +dnl Compiler flags +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 # Native atomic operation support AC_ARG_ENABLE([atomic-arm-linux-helpers], |