diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-22 22:04:53 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-23 11:16:40 +0100 |
commit | 195fd27cc64c7aaf18a6d48ccd9d94548331fd4d (patch) | |
tree | 1281a7ce73ce555371430e16ff5ae66e2dc79990 /build/aclocal.cairo.m4 | |
parent | d692284ab8f90d7402621f1a07aaddcf11d87ef5 (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/aclocal.cairo.m4')
-rw-r--r-- | build/aclocal.cairo.m4 | 20 |
1 files changed, 20 insertions, 0 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], |