[cairo-commit] build/aclocal.cairo.m4

M. Joonas Pihlaja joonas at kemper.freedesktop.org
Thu Oct 15 08:01:22 PDT 2009


 build/aclocal.cairo.m4 |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

New commits:
commit d5609ca04ecc5f5e3d5cef8ca0e67fa98cd653de
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Thu Oct 15 17:47:33 2009 +0300

    [build] Check compiler flags using AC_TRY_LINK instead of AC_TRY_COMPILE.
    
    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.

diff --git a/build/aclocal.cairo.m4 b/build/aclocal.cairo.m4
index e03fa1c..482763e 100644
--- a/build/aclocal.cairo.m4
+++ b/build/aclocal.cairo.m4
@@ -79,20 +79,17 @@ dnl check compiler flags with a program and no muttering.
 AC_DEFUN([CAIRO_CC_TRY_FLAG_SILENT],
 [dnl     (flags..., optional program, true-action, false-action)
 
-	_compile_program='$2'
-	if test "x$_compile_program" = "x"; then
-		# AC_LANG_PROGRAM() produces a main() w/o args,
-		# but -Wold-style-definition doesn't like that.
-		# We need _some_ program so that we don't get
-		# warnings about empty compilation units.
-		_compile_program='
-			int main(int c, char **v) {
-			    (void)c; (void)v; return 0; }'
-	fi
+	# AC_LANG_PROGRAM() produces a main() w/o args,
+	# but -Wold-style-definition doesn't like that.
+	# We need _some_ program so that we don't get
+	# warnings about empty compilation units, so always
+	# append a reasonable main().
+	_compile_program="$2"'
+		int main(int c, char **v) { (void)c; (void)v; return 0; }'
 
 	_save_cflags="$CFLAGS"
 	CFLAGS="$CFLAGS $1"
-	AC_COMPILE_IFELSE(
+	AC_LINK_IFELSE(
 		[$_compile_program],
 		[cairo_cc_stderr=`test -f conftest.err && cat conftest.err`
 		 cairo_cc_flag=yes],


More information about the cairo-commit mailing list