]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Support for mingw platform.
authorBruno Haible <bruno@clisp.org>
Wed, 6 Jul 2005 10:55:49 +0000 (10:55 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:12:37 +0000 (12:12 +0200)
12 files changed:
gettext-runtime/ChangeLog
gettext-runtime/configure.ac
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/printf-args.c
gettext-runtime/libasprintf/ChangeLog
gettext-runtime/libasprintf/printf-args.c
gettext-tools/ChangeLog
gettext-tools/configure.ac
gettext-tools/lib/ChangeLog
gettext-tools/lib/Makefile.am
gettext-tools/src/ChangeLog
gettext-tools/src/Makefile.am

index f23c3ee9551b155deab3e1a57507b58f556bc22c..a75195995fe0f440bc845d3c3bceda6daaee0da6 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-05  Bruno Haible  <bruno@clisp.org>
+
+       * configure.ac (DLL_VARIABLE): Define also as nonempty when building
+       shared libraries with mingw.
+
 2005-05-23  Bruno Haible  <bruno@clisp.org>
 
        * gettext-0.14.5 released.
index 497a10a8b2cb1305bc8b072c3828813456b28c87..8efdc54c06a900d890ed40681f4ab4ac3dd09980 100644 (file)
@@ -104,7 +104,7 @@ AM_GNU_GETTEXT(use-libtool, need-ngettext)
 dnl Put some default definitions into config.h.
 AH_BOTTOM([
 /* On Windows, variables that may be in a DLL must be marked specially.  */
-#if defined _MSC_VER && defined _DLL
+#if (defined _MSC_VER && defined _DLL) || (defined __MINGW32__ && defined DLL_EXPORT)
 # define DLL_VARIABLE __declspec (dllimport)
 #else
 # define DLL_VARIABLE
index 63fc7bb4e9aca4ddddd6f94c427309ae129f7bdc..2551c9c1af262224613d578551bf6aeff4484ca1 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-05  Bruno Haible  <bruno@clisp.org>
+
+       * printf-args.c (printf_fetchargs): Work around broken definition of
+       wint_t on mingw.
+
 2005-07-02  Bruno Haible  <bruno@clisp.org>
 
        * localcharset.c (get_charset_aliases) [WIN32]: Add CP65001 and others.
index f9759014706c582a7b6b4f77e42adff3dac39281..5bb1ce1b01675feb75779b5117140777a25972b0 100644 (file)
@@ -1,5 +1,5 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published
@@ -80,7 +80,13 @@ printf_fetchargs (va_list args, arguments *a)
        break;
 #ifdef HAVE_WINT_T
       case TYPE_WIDE_CHAR:
-       ap->a.a_wide_char = va_arg (args, wint_t);
+       /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
+          default argument promotions", this is not the case in mingw32,
+          where wint_t is 'unsigned short'.  */
+       ap->a.a_wide_char =
+         (sizeof (wint_t) < sizeof (int)
+          ? va_arg (args, int)
+          : va_arg (args, wint_t));
        break;
 #endif
       case TYPE_STRING:
index 2dc6b714e1197c64a98c18f0913059b3e87e1c37..74865c72842af70667ea95e7e7534da21ce626c3 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-05  Bruno Haible  <bruno@clisp.org>
+
+       * printf-args.c (printf_fetchargs): Work around broken definition of
+       wint_t on mingw.
+
 2005-05-23  Bruno Haible  <bruno@clisp.org>
 
        * gettext-0.14.5 released.
index f9759014706c582a7b6b4f77e42adff3dac39281..5bb1ce1b01675feb75779b5117140777a25972b0 100644 (file)
@@ -1,5 +1,5 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published
@@ -80,7 +80,13 @@ printf_fetchargs (va_list args, arguments *a)
        break;
 #ifdef HAVE_WINT_T
       case TYPE_WIDE_CHAR:
-       ap->a.a_wide_char = va_arg (args, wint_t);
+       /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
+          default argument promotions", this is not the case in mingw32,
+          where wint_t is 'unsigned short'.  */
+       ap->a.a_wide_char =
+         (sizeof (wint_t) < sizeof (int)
+          ? va_arg (args, int)
+          : va_arg (args, wint_t));
        break;
 #endif
       case TYPE_STRING:
index 7286c30c64ff7c6521d9c5ba73f52d75eb448dab..0f78c8825c16fdf054616ab8c1a0215adf4341e2 100644 (file)
@@ -1,3 +1,11 @@
+2005-07-05  Bruno Haible  <bruno@clisp.org>
+
+       * mingw: New directory.
+       * configure.ac (LTNOUNDEF): New macro.
+       (MINGW): New conditional.
+       (DLL_VARIABLE): Define also as nonempty when building shared libraries
+       with mingw.
+
 2005-05-01  Bruno Haible  <bruno@clisp.org>
 
        * configure.ac: Call gt_CSHARPEXEC with parameters.
index 28ba1e17ca2b35346bcc6fefa8e0a363ebb7125a..05cce2d0bb7bbf8972fa9814a0a7b3548a23f8f7 100644 (file)
@@ -94,6 +94,11 @@ gl_USE_SYSTEM_EXTENSIONS
 dnl Check for build configuration.
 AC_LIBTOOL_WIN32_DLL
 AC_PROG_LIBTOOL
+case "$host_os" in
+  nonexistent*) LTNOUNDEF='-no-undefined' ;;
+  *) LTNOUNDEF='' ;;
+esac
+AC_SUBST([LTNOUNDEF])
 
 AC_RELOCATABLE
 
@@ -166,6 +171,14 @@ dnl These are the only lines required to internationalize the package.
 dnl (OK, not quite, the AC_CONFIG_FILES has also some parts.)
 AM_GNU_GETTEXT(use-libtool, need-ngettext)
 
+dnl Compilation on mingw needs special Makefile rules, because of variables
+dnl being exported from or imported into shared libraries.
+case "$host_os" in
+  mingw*) is_mingw=yes ;;
+  *) is_mingw=no ;;
+esac
+AM_CONDITIONAL([MINGW], [test $is_mingw = yes])
+
 dnl Put some default definitions into config.h.
 AH_TOP([
 /* Default value for alignment of strings in .mo file.  */
@@ -197,7 +210,7 @@ AH_BOTTOM([
 #define PAGE_WIDTH 79
 
 /* On Windows, variables that may be in a DLL must be marked specially.  */
-#if defined _MSC_VER && defined _DLL
+#if (defined _MSC_VER && defined _DLL) || (defined __MINGW32__ && defined DLL_EXPORT)
 # define DLL_VARIABLE __declspec (dllimport)
 #else
 # define DLL_VARIABLE
index 5112132aa38c9936db1d4b89fa07180f61f2b585..9e779a27f904aa73148f59c3a77b96f1128d3cbe 100644 (file)
@@ -1,3 +1,7 @@
+2005-07-05  Bruno Haible  <bruno@clisp.org>
+
+       * Makefile.am (libgettextlib_la_LDFLAGS): Use LTNOUNDEF.
+
 2005-07-02  Bruno Haible  <bruno@clisp.org>
 
        * localcharset.c (get_charset_aliases) [WIN32]: Add CP65001 and others.
index cb41612e36fb898484dc1a77303b0c6fe1314750..f96c19c502c0c927520776bac3a942f691420f14 100644 (file)
@@ -121,7 +121,7 @@ libgettextlib_la_LIBADD = @LTLIBOBJS@
 # Need @LTLIBICONV@ because linebreak.c uses iconv().
 libgettextlib_la_LDFLAGS = \
   -release @VERSION@ \
-  @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined
+  @LTLIBINTL@ @LTLIBICONV@ -lc @LTNOUNDEF@
 
 # No need to install libgettextlib.a, except on AIX.
 install-exec-local: install-libLTLIBRARIES install-exec-clean
index 1245b60890f725cb07b94911af0b7eab187b69c3..6627c3b2e6b2fdad98583df65c0e6c7bf25844fa 100644 (file)
@@ -1,3 +1,15 @@
+2005-07-05  Bruno Haible  <bruno@clisp.org>
+
+       * Makefile.am (msgmerge_SOURCES, xgettext_SOURCES, msgattrib_SOURCES,
+       msgcat_SOURCES, msgcomm_SOURCES, msgconv_SOURCES, msgen_SOURCES,
+       msgfilter_SOURCES, msggrep_SOURCES, msguniq_SOURCES): On mingw, use
+       C++ source code.
+       (libgettextsrc_la_LDFLAGS, libgettextpo_la_LDFLAGS): Use LTNOUNDEF.
+       (format_CFLAGS): New variable.
+       (format.lo): New rule.
+       (msg*_CFLAGS, xgettext_CFLAGS): Remove variables.
+       (msg*_CPPFLAGS, xgettext_CPPFLAGS): New variables.
+
 2005-05-27  Bruno Haible  <bruno@clisp.org>
 
        * write-po.c (wrap): Output \a and \v as an escape sequence, like
index 962d387067389f1d70a0e2744df4cdc5e7edc5b4..b41f07c8d933da2e8f00fbcdc37f4fd778b5a247 100644 (file)
@@ -131,26 +131,71 @@ LIBUNINAME = ../libuniname/libuniname.a
 
 # Source dependencies.
 msgcmp_SOURCES = msgcmp.c
-msgfmt_SOURCES = msgfmt.c \
+msgfmt_SOURCES = msgfmt.c
+msgfmt_SOURCES += \
   write-mo.c write-java.c write-csharp.c write-resources.c write-tcl.c \
   write-qt.c plural-eval.c ../../gettext-runtime/intl/hash-string.c
-msgmerge_SOURCES = msgmerge.c plural-count.c
-msgunfmt_SOURCES = msgunfmt.c \
+if !MINGW
+msgmerge_SOURCES = msgmerge.c
+else
+msgmerge_SOURCES = ../mingw/c++msgmerge.cc
+endif
+msgmerge_SOURCES += plural-count.c
+msgunfmt_SOURCES = msgunfmt.c
+msgunfmt_SOURCES += \
   read-mo.c read-java.c read-csharp.c read-resources.c read-tcl.c
-xgettext_SOURCES = xgettext.c \
+if !MINGW
+xgettext_SOURCES = xgettext.c
+else
+xgettext_SOURCES = ../mingw/c++xgettext.cc
+endif
+xgettext_SOURCES += \
   x-c.c x-po.c x-sh.c x-python.c x-lisp.c x-elisp.c x-librep.c x-scheme.c \
   x-smalltalk.c x-java.c x-csharp.c x-awk.c x-ycp.c x-tcl.c x-perl.c x-php.c \
   x-rst.c x-glade.c
+if !MINGW
 msgattrib_SOURCES = msgattrib.c
+else
+msgattrib_SOURCES = ../mingw/c++msgattrib.cc
+endif
+if !MINGW
 msgcat_SOURCES = msgcat.c
+else
+msgcat_SOURCES = ../mingw/c++msgcat.cc
+endif
+if !MINGW
 msgcomm_SOURCES = msgcomm.c
+else
+msgcomm_SOURCES = ../mingw/c++msgcomm.cc
+endif
+if !MINGW
 msgconv_SOURCES = msgconv.c
+else
+msgconv_SOURCES = ../mingw/c++msgconv.cc
+endif
+if !MINGW
 msgen_SOURCES = msgen.c
+else
+msgen_SOURCES = ../mingw/c++msgen.cc
+endif
 msgexec_SOURCES = msgexec.c
+if !MINGW
 msgfilter_SOURCES = msgfilter.c
+else
+msgfilter_SOURCES = ../mingw/c++msgfilter.cc
+endif
+if !MINGW
 msggrep_SOURCES = msggrep.c
-msginit_SOURCES = msginit.c plural-count.c ../../gettext-runtime/intl/localealias.c
+else
+msggrep_SOURCES = ../mingw/c++msggrep.cc
+endif
+msginit_SOURCES = msginit.c
+msginit_SOURCES +=  plural-count.c ../../gettext-runtime/intl/localealias.c
+if !MINGW
 msguniq_SOURCES = msguniq.c
+else
+msguniq_SOURCES = ../mingw/c++msguniq.cc
+endif
 hostname_SOURCES = hostname.c
 urlget_SOURCES = urlget.c
 
@@ -161,7 +206,16 @@ urlget_SOURCES = urlget.c
 # use iconv().
 libgettextsrc_la_LDFLAGS = \
   -release @VERSION@ \
-  ../lib/libgettextlib.la @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined
+  ../lib/libgettextlib.la @LTLIBINTL@ @LTLIBICONV@ -lc @LTNOUNDEF@
+
+# Special rules for mingw.
+if MINGW
+format_CFLAGS = -x c++
+# Work around an automake 1.9 bug: *_CFLAGS settings are ignored for elements
+# of a libtool library.
+format.lo: format.c
+       $(LTCOMPILE) $(format_CFLAGS) -c -o format.lo format.c
+endif
 
 # No need to install libgettextsrc.a, except on AIX.
 install-exec-local: install-libLTLIBRARIES install-exec-clean
@@ -177,7 +231,7 @@ install-exec-clean:
 libgettextpo_la_LDFLAGS = \
   -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
   -rpath $(libdir) \
-  libgettextsrc.la ../lib/libgettextlib.la @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined
+  libgettextsrc.la ../lib/libgettextlib.la @LTLIBINTL@ @LTLIBICONV@ -lc @LTNOUNDEF@
 # Build order. Only needed for "make -j[N]".
 libgettextpo_la_DEPENDENCIES = libgettextsrc.la
 
@@ -203,23 +257,23 @@ msginit_LDADD = ../intl/localename.@INTL_LIBTOOL_SUFFIX_PREFIX@o \
 msguniq_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
 
 # Specify installation directory, for --enable-relocatable.
-msgcmp_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msgfmt_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msgmerge_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msgunfmt_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-xgettext_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msgattrib_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msgcat_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msgcomm_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msgconv_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msgen_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msgexec_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msgfilter_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msggrep_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msginit_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-msguniq_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
-hostname_CFLAGS = -DINSTALLDIR=\"$(pkglibdir)\"
-urlget_CFLAGS = -DINSTALLDIR=\"$(pkglibdir)\"
+msgcmp_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msgfmt_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msgmerge_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msgunfmt_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+xgettext_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msgattrib_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msgcat_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msgcomm_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msgconv_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msgen_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msgexec_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msgfilter_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msggrep_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msginit_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+msguniq_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+hostname_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(pkglibdir)\"
+urlget_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(pkglibdir)\"
 if RELOCATABLE_VIA_LD
 msgcmp_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
 msgfmt_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`