From: Daiki Ueno Date: Mon, 25 Feb 2013 09:18:24 +0000 (+0900) Subject: Determine Woe32 C symbol prefix at configure time. X-Git-Tag: v0.18.2.1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3edd52dde1406df3a8429ce59ddcc286228bf3f;p=thirdparty%2Fgettext.git Determine Woe32 C symbol prefix at configure time. --- diff --git a/gettext-runtime/ChangeLog b/gettext-runtime/ChangeLog index 4c9c28322..b523cfdfd 100644 --- a/gettext-runtime/ChangeLog +++ b/gettext-runtime/ChangeLog @@ -1,3 +1,8 @@ +2012-12-27 Daiki Ueno + + * configure.ac (WOE32DLL): New conditional. + (INTL_EXPORTS_FLAGS): New substituted variable. + 2012-12-25 Daiki Ueno * gettext-0.18.2 released. diff --git a/gettext-runtime/configure.ac b/gettext-runtime/configure.ac index 745caf6d1..e300c733e 100644 --- a/gettext-runtime/configure.ac +++ b/gettext-runtime/configure.ac @@ -106,6 +106,35 @@ AH_BOTTOM([ #endif ]) +dnl Compilation on mingw and Cygwin needs special Makefile rules, because +dnl 1. when we install a shared library, we must arrange to export +dnl auxiliary pointer variables for every exported variable, +dnl 2. when we install a shared library and a static library simultaneously, +dnl the include file specifies __declspec(dllimport) and therefore we +dnl must arrange to define the auxiliary pointer variables for the +dnl exported variables _also_ in the static library. +if test "$enable_shared" = yes; then + case "$host_os" in + mingw* | cygwin*) is_woe32dll=yes ;; + *) is_woe32dll=no ;; + esac +else + is_woe32dll=no +fi +AM_CONDITIONAL([WOE32DLL], [test $is_woe32dll = yes]) +if test $is_woe32dll = yes; then + AC_DEFINE([WOE32DLL], [1], + [Define when --enable-shared is used on mingw or Cygwin.]) +fi + +INTL_EXPORTS_FLAGS= +dnl 64-bit mingw does not prepend an underscore to C symbols. +dnl USER_LABEL_PREFIX is set by gl_ASM_SYMBOL_PREFIX, inside gl_INIT. +if test "$USER_LABEL_PREFIX" = _; then + INTL_EXPORTS_FLAGS="-DUSER_LABEL_PREFIX_UNDERSCORE $INTL_EXPORTS_FLAGS" +fi +AC_SUBST([INTL_EXPORTS_FLAGS]) + dnl Check for tools needed for formatting the documentation. ac_aux_dir_abs=`cd $ac_aux_dir && pwd` AC_PATH_PROG([PERL], [perl], [$ac_aux_dir_abs/missing perl]) diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index c3786a73b..8368bec95 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,10 @@ +2013-02-25 Daiki Ueno + + Determine imported C symbol prefix at configure time. + Suggested by Evgeny Grin in . + * intl-exports.c (IMP): Define depending on the result of the + configure run. + 2013-01-21 Daiki Ueno Remove references to non-existing COPYING.LIB-2.*. diff --git a/gettext-runtime/intl/intl-exports.c b/gettext-runtime/intl/intl-exports.c index 4a5126b50..891c25e26 100644 --- a/gettext-runtime/intl/intl-exports.c +++ b/gettext-runtime/intl/intl-exports.c @@ -16,13 +16,10 @@ along with this program. If not, see . */ /* IMP(x) is a symbol that contains the address of x. */ -#if defined _WIN64 && defined __MINGW32__ - /* mingw W64 started using __imp_ prefix for MSVC compatibility since - 2010. Ideally we should check the prefix in configure though, - we assume __imp_ on mingw W64 for the time being. */ -# define IMP(x) __imp_##x -#else +#if USER_LABEL_PREFIX_UNDERSCORE # define IMP(x) _imp__##x +#else +# define IMP(x) __imp_##x #endif /* Ensure that the variable x is exported from the library, and that a diff --git a/gettext-tools/ChangeLog b/gettext-tools/ChangeLog index 167d6a6df..123c114ef 100644 --- a/gettext-tools/ChangeLog +++ b/gettext-tools/ChangeLog @@ -1,3 +1,13 @@ +2012-12-27 Daiki Ueno + + Determine imported C symbol prefix at configure time. + Suggested by Evgeny Grin in . + * woe32dll/export.h (IMP): Define depending on the result of the + configure run. + * configure.ac (GETTEXTLIB_EXPORTS_FLAGS): Add + -DUSER_LABEL_PREFIX_UNDERSCORE if imported C symbol has + underscore prefix. + 2012-12-25 Daiki Ueno * gettext-0.18.2 released. diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac index 6392756cc..373d3cc81 100644 --- a/gettext-tools/configure.ac +++ b/gettext-tools/configure.ac @@ -235,6 +235,12 @@ 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 + +dnl 64-bit mingw does not prepend an underscore to C symbols. +dnl USER_LABEL_PREFIX is set by gl_ASM_SYMBOL_PREFIX, inside gl_INIT. +if test "$USER_LABEL_PREFIX" = _; then + GETTEXTLIB_EXPORTS_FLAGS="-DUSER_LABEL_PREFIX_UNDERSCORE $GETTEXTLIB_EXPORTS_FLAGS" +fi AC_SUBST([GETTEXTLIB_EXPORTS_FLAGS]) dnl Tell the source files that the error facility is replaced by diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 5293673b4..80308ddbe 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,8 @@ +2013-02-25 Daiki Ueno + + * Makefile.am (libgettextsrc_la_CPPFLAGS): Define to specify Woe32 + DLL export flags. + 2013-01-09 Andreas Stricker (tiny change) * po-xerror.c: Include error.h for error_message_count. diff --git a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am index 87cc35821..aea01e65c 100644 --- a/gettext-tools/src/Makefile.am +++ b/gettext-tools/src/Makefile.am @@ -240,10 +240,13 @@ libgettextsrc_la_LDFLAGS = \ -release @VERSION@ \ ../gnulib-lib/libgettextlib.la $(LTLIBUNISTRING) @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined +libgettextsrc_la_CPPFLAGS = $(AM_CPPFLAGS) + # Tell the mingw or Cygwin linker which symbols to export. if WOE32DLL libgettextsrc_la_SOURCES += ../woe32dll/gettextsrc-exports.c libgettextsrc_la_LDFLAGS += -Wl,--export-all-symbols +libgettextsrc_la_CPPFLAGS += $(GETTEXTLIB_EXPORTS_FLAGS) endif # No need to install libgettextsrc.a, except on AIX. diff --git a/gettext-tools/woe32dll/export.h b/gettext-tools/woe32dll/export.h index 68e9bcc5f..8bd156680 100644 --- a/gettext-tools/woe32dll/export.h +++ b/gettext-tools/woe32dll/export.h @@ -94,13 +94,10 @@ #if defined __GNUC__ /* GCC compiler, GNU toolchain */ /* IMP(x) is a symbol that contains the address of x. */ -#if defined _WIN64 && defined __MINGW32__ - /* mingw W64 started using __imp_ prefix for MSVC compatibility since - 2010. Ideally we should check the prefix in configure though, - we assume __imp_ on mingw W64 for the time being. */ -# define IMP(x) __imp_##x -#else +#if USER_LABEL_PREFIX_UNDERSCORE # define IMP(x) _imp__##x +#else +# define IMP(x) __imp_##x #endif /* Ensure that the variable x is exported from the library, and that a diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog index 5a3a48643..8d7e5432b 100644 --- a/gnulib-local/ChangeLog +++ b/gnulib-local/ChangeLog @@ -1,3 +1,8 @@ +2013-02-25 Daiki Ueno + + * modules/gettext-runtime-misc (AM_CPPFLAGS): Augment by + INTL_EXPORTS_FLAGS. + 2013-01-03 Daiki Ueno Update after gnulib changed. diff --git a/gnulib-local/modules/gettext-runtime-misc b/gnulib-local/modules/gettext-runtime-misc index 4cad86d65..de358b6ff 100644 --- a/gnulib-local/modules/gettext-runtime-misc +++ b/gnulib-local/modules/gettext-runtime-misc @@ -15,6 +15,11 @@ AM_CPPFLAGS += -I$(top_builddir)/intl -I$(top_srcdir)/intl # Parametrization of the 'relocatable' module. AM_CPPFLAGS += -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 +# Tell the mingw or Cygwin linker which symbols to export. +if WOE32DLL +AM_CPPFLAGS += @INTL_EXPORTS_FLAGS@ +endif + Include: License: