summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-10-22 22:04:53 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-10-23 11:16:40 +0100
commit195fd27cc64c7aaf18a6d48ccd9d94548331fd4d (patch)
tree1281a7ce73ce555371430e16ff5ae66e2dc79990 /build
parentd692284ab8f90d7402621f1a07aaddcf11d87ef5 (diff)
[build] Use AC_LINK_IFELSE for testing linker flags.
Richard Hult reported that -Wl,--allow-shlib-undefined was incorrectly being identified as supported by gcc under Mac OS/X: configure:25103: checking whether gcc supports -Wl,--allow-shlib-undefined configure:25117: gcc -c -Werror -Wl,--allow-shlib-undefined conftest.c >&5 i686-apple-darwin9-gcc-4.0.1: --allow-shlib-undefined: linker input file unused because linking not done So instead of just checking whether the compiler accepts the flag, check that we can actually link a dummy file.
Diffstat (limited to 'build')
-rw-r--r--build/aclocal.cairo.m420
-rw-r--r--build/configure.ac.warnings2
2 files changed, 21 insertions, 1 deletions
diff --git a/build/aclocal.cairo.m4 b/build/aclocal.cairo.m4
index f00b137f..1c898b96 100644
--- a/build/aclocal.cairo.m4
+++ b/build/aclocal.cairo.m4
@@ -93,6 +93,26 @@ AC_DEFUN([CAIRO_CC_TRY_FLAG],
AC_MSG_RESULT([$cairo_cc_flag])
])
+dnl check compiler/ld flags
+AC_DEFUN([CAIRO_CC_TRY_LINK_FLAG],
+[dnl
+ AC_MSG_CHECKING([whether $CC supports $1])
+
+ _save_cflags="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror $1"
+ AC_LINK_IFELSE([int main(void){ return 0;} ],
+ [cairo_cc_flag=yes],
+ [cairo_cc_flag=no])
+ CFLAGS="$_save_cflags"
+
+ if test "x$cairo_cc_flag" = "xyes"; then
+ ifelse([$2], , :, [$2])
+ else
+ ifelse([$3], , :, [$3])
+ fi
+ AC_MSG_RESULT([$cairo_cc_flag])
+])
+
dnl Usage:
dnl CAIRO_CHECK_NATIVE_ATOMIC_PRIMITIVES
AC_DEFUN([CAIRO_CHECK_NATIVE_ATOMIC_PRIMITIVES],
diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings
index 2d111a00..c0cfe5eb 100644
--- a/build/configure.ac.warnings
+++ b/build/configure.ac.warnings
@@ -69,7 +69,7 @@ AC_DEFINE_UNQUOTED([WARN_UNUSED_RESULT], [$cairo_cv_warn_unused_result],
dnl check linker flags
AC_CACHE_CHECK([how to allow undefined symbols in shared libraries used by test suite], cairo_cv_test_undefined_ldflags,
- [CAIRO_CC_TRY_FLAG([-Wl,--allow-shlib-undefined],
+ [CAIRO_CC_TRY_LINK_FLAG([-Wl,--allow-shlib-undefined],
[cairo_cv_test_undefined_ldflags="-Wl,--allow-shlib-undefined]")])
CAIRO_TEST_UNDEFINED_LDFLAGS="$cairo_cv_test_undefined_ldflags"
AC_SUBST(CAIRO_TEST_UNDEFINED_LDFLAGS)