From: Daiki Ueno Date: Tue, 25 Dec 2012 00:37:54 +0000 (+0900) Subject: Work around error_* symbol conflict with Cygwin 1.7 DLL. X-Git-Tag: v0.18.2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e1d0603cd3522b8e44b7bdb2bd58be7f0c6ef71;p=thirdparty%2Fgettext.git Work around error_* symbol conflict with Cygwin 1.7 DLL. --- diff --git a/gettext-tools/ChangeLog b/gettext-tools/ChangeLog index a71fc2e2d..ab40dbdd8 100644 --- a/gettext-tools/ChangeLog +++ b/gettext-tools/ChangeLog @@ -1,3 +1,15 @@ +2012-12-25 Daiki Ueno + + 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 Fix W64 build errors. diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac index 4064f9ae4..6392756cc 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 a627e1de7..0f1c33f22 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 767f6ad6e..fd4c106c7 100644 --- a/gnulib-local/ChangeLog +++ b/gnulib-local/ChangeLog @@ -1,3 +1,9 @@ +2012-12-25 Daiki Ueno + + 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 Add notice about included external libraries. diff --git a/gnulib-local/lib/error.h.diff b/gnulib-local/lib/error.h.diff index e9f61301b..5b82f224e 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. */