Introduce a new CAIRO_CC_TRY_LINK_WITH_ENV_SILENT macro for running
generic link tests with arbitrary CFLAGS/LIBS/LDFLAGS and no muttering
of autoconf messages. Rewrite the previous CAIRO_CC_TRY_FLAG in terms
of it.
Turns out we were passing suncc warning suppression flags to gcc
by mistake since -e<entry point> is actually a valid option for
gcc. This caused the -erroff=E_ENUM_TYPE_MISMATCH_ARG and other
-erroff options to be passed to the linker. In the normal case
of a GNU ld linker this doesn't matter since it ignores bogus
entry points, but the GNU gold linker replaces a bogus entry
point with NULL. This patch makes the CAIRO_CC_TRY_FLAG()
check stricter by testing that the flag doesn't interfere with
linking executables.
We don't actually check that -Wno-attribute does what
we think it does. On clang it doesn't since it happily
seems to recognize but ignore the attribute.
This patch factors out a silent version of CAIRO_CC_TRY_FLAG
which accepts an optional program argument and actually tests
that the compiler doesn't produce any warning messages. It
is then used to check that -Wno-attribute doesn't complain
when the __warn_unused_result__ attribute is applied to
void functions or variables.
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.
Bug 18140 identifies a case where we have an atomic increment, but not an
atomic exchange. We need both to implement atomic reference counting, so
add a second check to detect whether __sync_val_compare_and_swap
generates a non-atomic instruction.
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=18140.
The macros CAIRO_BEGIN_DECLS and CAIRO_END_DECLS are declared in two
places: config.h and cairo.h. On Win32 build there is no config.h. So,
we can't rely on pulling CAIRO_BEGIN_DECLS from there. Hence, we now:
* Not add those declarations to config.h anymore,
* Test that every cairo private header includes some other cairo
header before any other includes.
These two are fairly enough to ensure that cairo.h is seen from all
private headers. There's still the case of headers not including
any header file at all. I'll fix that later.