]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Work around error_* symbol conflict with Cygwin 1.7 DLL.
authorDaiki Ueno <ueno@gnu.org>
Tue, 25 Dec 2012 00:37:54 +0000 (09:37 +0900)
committerDaiki Ueno <ueno@gnu.org>
Tue, 25 Dec 2012 00:37:54 +0000 (09:37 +0900)
gettext-tools/ChangeLog
gettext-tools/configure.ac
gettext-tools/woe32dll/gettextlib-exports.c
gnulib-local/ChangeLog
gnulib-local/lib/error.h.diff

index a71fc2e2d2d74ac68a0f18c440346bc480dfa97d..ab40dbdd8a29fbe2f3bc726143f76f52eb498959 100644 (file)
@@ -1,3 +1,15 @@
+2012-12-25  Daiki Ueno  <ueno@gnu.org>
+
+       Work around error_* symbol conflict with Cygwin 1.7 DLL.
+       * configure.ac: Reset ac_cv_lib_error_at_line on Cygwin.
+       (GETTEXTLIB_EXPORTS_FLAGS): Add -DGNULIB_DEFINED_ERROR if the
+       error facility is replaced by gnulib.
+       (GNULIB_REPLACE_ERROR): Define if the error facility is replaced
+       by gnulib.
+       * woe32dll/gettextlib-exports.c (rpl_error_message_count)
+       (rpl_error_one_per_line, rpl_error_print_progname): Export only
+       if GNULIB_DEFINED_ERROR is set.
+
 2012-12-21  Daiki Ueno  <ueno@gnu.org>
 
        Fix W64 build errors.
index 4064f9ae4084da8668343f45b109a46e6391cb3f..6392756cc40f5b5f47e81411b81bca61efce0979 100644 (file)
@@ -105,6 +105,13 @@ case "$host_os" in
 esac
 AM_CONDITIONAL([WOE32], [test $is_woe32 = yes])
 
+dnl On Cygwin 1.7.10-1 or later, error_* variables are defined in the
+dnl Cygwin DLL.  To avoid any conflict with gettext DLLs, always link
+dnl to gnulib's error.c.  See GETTEXTLIB_EXPORTS_FLAGS setting below.
+case "$host_os" in
+  cygwin*) ac_cv_lib_error_at_line=no ;;
+esac
+
 dnl Checks for libraries.
 
 dnl These are the only lines required to internationalize the package.
@@ -215,16 +222,29 @@ if test $is_woe32dll = yes; then
     [Define when --enable-shared is used on mingw or Cygwin.])
 fi
 
+GETTEXTLIB_EXPORTS_FLAGS=
 dnl woe32dll/gettextlib-exports.c needs to know whether the getopt facility
 dnl is replaced by gnulib. GETOPT_H is set by gl_FUNC_GETOPT_POSIX, inside
 dnl gl_INIT.
 if test -n "$GETOPT_H"; then
-  GETTEXTLIB_EXPORTS_FLAGS="-DGNULIB_DEFINED_GETOPT"
-else
-  GETTEXTLIB_EXPORTS_FLAGS=
+  GETTEXTLIB_EXPORTS_FLAGS="-DGNULIB_DEFINED_GETOPT $GETTEXTLIB_EXPORTS_FLAGS"
+fi
+dnl woe32dll/gettextlib-exports.c needs to know whether the error
+dnl facility is replaced by gnulib. ac_cv_lib_error_at_line is set by
+dnl gl_ERROR, inside gl_INIT.
+if test "$ac_cv_lib_error_at_line" = no; then
+  GETTEXTLIB_EXPORTS_FLAGS="-DGNULIB_DEFINED_ERROR $GETTEXTLIB_EXPORTS_FLAGS"
 fi
 AC_SUBST([GETTEXTLIB_EXPORTS_FLAGS])
 
+dnl Tell the source files that the error facility is replaced by
+dnl gnulib, to make sure to prepend "rpl_" prefix to the error_*
+dnl symbols.
+if test "$ac_cv_lib_error_at_line" = no; then
+  AC_DEFINE([GNULIB_REPLACE_ERROR], [1],
+    [Define when the error facility is replaced by gnulib.])
+fi
+
 dnl Put some default definitions into config.h.
 AH_TOP([
 /* Default value for alignment of strings in .mo file.  */
index a627e1de7618b26f20da580fe8d54c129a51a818..0f1c33f226ac9478097d94518141e97f6c85b117 100644 (file)
 #include "woe32dll/export.h"
 
 VARIABLE(argmatch_die)
-VARIABLE(error_message_count)
-VARIABLE(error_one_per_line)
-VARIABLE(error_print_progname)
+#if GNULIB_DEFINED_ERROR
+VARIABLE(rpl_error_message_count)
+VARIABLE(rpl_error_one_per_line)
+VARIABLE(rpl_error_print_progname)
+#endif
 VARIABLE(error_with_progname)
 VARIABLE(exit_failure)
 VARIABLE(gl_array_list_implementation)
index 767f6ad6e7681ac0f02c78e2a78c12d9175a7d76..fd4c106c7e67c3be6ad13afefdc829924ca01c8f 100644 (file)
@@ -1,3 +1,9 @@
+2012-12-25  Daiki Ueno  <ueno@gnu.org>
+
+       Work around error_* symbol conflict with Cygwin 1.7 DLL.
+       * lib/error.h.diff: Rename the error_* symbol if
+       GNULIB_REPLACE_ERROR is defined.
+
 2012-12-12  Daiki Ueno  <ueno@unixuser.org>
 
        Add notice about included external libraries.
index e9f61301b41fe3403410b9b1d5502fa04ba4ce2f..5b82f224ef714681d39bbcf4b80a27b0f760714b 100644 (file)
@@ -1,7 +1,25 @@
-*** gnulib/lib/error.h 2005-05-14 08:03:58.000000000 +0200
---- srclib/error.h     2005-05-20 23:06:02.000000000 +0200
+*** gnulib/lib/error.h 2012-12-24 20:10:43.000000000 +0900
+--- srclib/error.h     2012-12-24 20:08:16.000000000 +0900
 ***************
-*** 50,63 ****
+*** 31,36 ****
+--- 31,45 ----
+  # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
+  #endif
+  
++ #if GNULIB_REPLACE_ERROR
++ # undef error_print_progname
++ # undef error_message_count
++ # undef error_one_per_line
++ # define error_print_progname rpl_error_print_progname
++ # define error_message_count rpl_error_message_count
++ # define error_one_per_line rpl_error_one_per_line
++ #endif
++ 
+  #ifdef __cplusplus
+  extern "C" {
+  #endif
+***************
+*** 49,62 ****
   /* If NULL, error will flush stdout, then print on stderr the program
      name, a colon and a space.  Otherwise, error will call this
      function without parameters instead.  */
@@ -16,7 +34,7 @@
   
   #ifdef       __cplusplus
   }
---- 50,63 ----
+--- 58,71 ----
   /* If NULL, error will flush stdout, then print on stderr the program
      name, a colon and a space.  Otherwise, error will call this
      function without parameters instead.  */