changeset 16243:0acb9b939828

Fix for mingw with MSVC9. * m4/ld-version-script.m4: Check that compiler rejects version scripts with syntax errors. Reported by Bruno Haible <bruno@clisp.org>.
author Simon Josefsson <simon@josefsson.org>
date Sat, 07 Jan 2012 10:13:28 +0100
parents 59c686e5b2df
children d3bb78595bd0
files ChangeLog m4/ld-version-script.m4
diffstat 2 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-01-07  Simon Josefsson  <simon@josefsson.org>
+
+	Fix for mingw with MSVC9.
+	* m4/ld-version-script.m4: Check that compiler rejects version
+	scripts with syntax errors.  Reported by Bruno Haible
+	<bruno@clisp.org>.
+
 2012-01-06  Bruno Haible  <bruno@clisp.org>
 
 	Talk about "native Windows API", not "Woe32".
--- a/m4/ld-version-script.m4
+++ b/m4/ld-version-script.m4
@@ -1,4 +1,4 @@
-# ld-version-script.m4 serial 2
+# ld-version-script.m4 serial 3
 dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -26,6 +26,12 @@
     save_LDFLAGS="$LDFLAGS"
     LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
     cat > conftest.map <<EOF
+foo
+EOF
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+                   [accepts_syntax_errors=yes], [accepts_syntax_errors=no])
+    if test "$accepts_syntax_errors" = no; then
+      cat > conftest.map <<EOF
 VERS_1 {
         global: sym;
 };
@@ -34,8 +40,11 @@
         global: sym;
 } VERS_1;
 EOF
-    AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
-                   [have_ld_version_script=yes], [have_ld_version_script=no])
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+                     [have_ld_version_script=yes], [have_ld_version_script=no])
+    else
+      have_ld_version_script=no
+    fi
     rm -f conftest.map
     LDFLAGS="$save_LDFLAGS"
     AC_MSG_RESULT($have_ld_version_script)