summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2005-12-07 12:38:57 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:12:57 +0200
commit2f4da4fd5edf9ac89ace9b88a5a702232537f551 (patch)
treedf97e3a49e136ff0c6068c17ef7e503d67fc725e /m4
parent3917d35a1660f464e4b1c41fbc166506c523bd2e (diff)
downloadexternal_gettext-2f4da4fd5edf9ac89ace9b88a5a702232537f551.zip
external_gettext-2f4da4fd5edf9ac89ace9b88a5a702232537f551.tar.gz
external_gettext-2f4da4fd5edf9ac89ace9b88a5a702232537f551.tar.bz2
Move gettext-runtime/m4/woe32-dll.m4 to m4/woe32-dll.m4.
Diffstat (limited to 'm4')
-rw-r--r--m4/woe32-dll.m441
1 files changed, 41 insertions, 0 deletions
diff --git a/m4/woe32-dll.m4 b/m4/woe32-dll.m4
new file mode 100644
index 0000000..73530b4
--- /dev/null
+++ b/m4/woe32-dll.m4
@@ -0,0 +1,41 @@
+# woe32-dll.m4 serial 1
+dnl Copyright (C) 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+# Add --disable-auto-import to the LDFLAGS if the linker supports it.
+# GNU ld has an --enable-auto-import option, and it is the default on Cygwin
+# since July 2005. But it two fatal drawbacks:
+# - It produces executables and shared libraries with relocations in the
+# .text segment, defeating the principles of virtual memory.
+# - For some constructs such as
+# extern int var;
+# int * const b = &var;
+# it creates an executable that will give an error at runtime, rather than
+# either a compile-time or link-time error or a working executable.
+# (This is with both gcc and g++.) Whereas this code, not relying on auto-
+# import:
+# extern __declspec (dllimport) int var;
+# int * const b = &var;
+# gives a compile-time error with gcc and works with g++.
+AC_DEFUN([gl_WOE32_DLL],
+[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ case "$host_os" in
+ mingw* | cygwin*)
+ AC_MSG_CHECKING([for auto-import of symbols])
+ AC_CACHE_VAL([gl_cv_ld_autoimport], [
+ gl_save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,--disable-auto-import"
+ AC_TRY_LINK([], [], [gl_cv_ld_autoimport=yes], [gl_cv_ld_autoimport=no])
+ LDFLAGS="$gl_save_LDFLAGS"])
+ AC_MSG_RESULT([$gl_cv_ld_autoimport])
+ if test $gl_cv_ld_autoimport = yes; then
+ LDFLAGS="$LDFLAGS -Wl,--disable-auto-import"
+ fi
+ ;;
+ esac
+])