[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gettext] build error on Cygwin >= 1.7.10-1
From: |
Daiki Ueno |
Subject: |
Re: [bug-gettext] build error on Cygwin >= 1.7.10-1 |
Date: |
Tue, 25 Dec 2012 10:01:41 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
Daiki Ueno <address@hidden> writes:
> 1. use gnulib's error* variables
> i.e. link libgettextpo to gnulib's error.c
> 2. use Cygwin's error* variables
> i.e. do not remove "dllspec(dllimport)" attribute from error* variables
>
> Which does sound better? I've read the Woe32 DLL note[1] and I feel 1
> might be safer.
>
> Anyway I'll add workaround for 0.18.2 in either way.
I ended up with the following and pushed it to the master, as it works
on both Cygwin and mingw and should not affect other platforms.
Regards,
---
gettext-tools/ChangeLog | 12 ++++++++++++
gettext-tools/configure.ac | 26 +++++++++++++++++++++++---
gettext-tools/woe32dll/gettextlib-exports.c | 8 +++++---
gnulib-local/ChangeLog | 6 ++++++
gnulib-local/lib/error.h.diff | 26 ++++++++++++++++++++++----
5 files changed, 68 insertions(+), 10 deletions(-)
diff --git a/gettext-tools/ChangeLog b/gettext-tools/ChangeLog
index a71fc2e..ab40dbd 100644
--- a/gettext-tools/ChangeLog
+++ b/gettext-tools/ChangeLog
@@ -1,3 +1,15 @@
+2012-12-25 Daiki Ueno <address@hidden>
+
+ 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 <address@hidden>
Fix W64 build errors.
diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac
index 4064f9a..6392756 100644
--- a/gettext-tools/configure.ac
+++ b/gettext-tools/configure.ac
@@ -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. */
diff --git a/gettext-tools/woe32dll/gettextlib-exports.c
b/gettext-tools/woe32dll/gettextlib-exports.c
index a627e1d..0f1c33f 100644
--- a/gettext-tools/woe32dll/gettextlib-exports.c
+++ b/gettext-tools/woe32dll/gettextlib-exports.c
@@ -18,9 +18,11 @@
#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)
diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog
index 767f6ad..fd4c106 100644
--- a/gnulib-local/ChangeLog
+++ b/gnulib-local/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-25 Daiki Ueno <address@hidden>
+
+ 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 <address@hidden>
Add notice about included external libraries.
diff --git a/gnulib-local/lib/error.h.diff b/gnulib-local/lib/error.h.diff
index e9f6130..5b82f22 100644
--- a/gnulib-local/lib/error.h.diff
+++ b/gnulib-local/lib/error.h.diff
@@ -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. */
--
1.7.10.4