bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cross-compiling gettext for windows


From: Jason Dorje Short
Subject: cross-compiling gettext for windows
Date: Sat, 15 Jan 2005 04:31:33 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050105 Debian/1.7.5-1

I tried cross-compiling gettext 0.14.1 on Debian/unstable
(--build=i686-pc-linux-gnu) for Windows (--host=i586-mingw32msvc). I'm using the mingw included in Debian.

It came very close to working out of the box. The only problem was that a crucial library needs to be linked to by libgettextlib - otherwise the mbrtowc() function is undefined.

The attached patch checks in configure for a mingw build and links to libmsvcp60 (yes, libmsvcp60 - this is the only library included in mingw that references this symbol) if mingw is being used. This shouldn't break anything and allows cross-compilation using mingw. There may be a better check however.

(Actually the AC_CHECK_LIB function is a duplicate of the $host_os check, since they both set the same thing. I left the AC_CHECK_LIB part in by mistake...it should compile without but I haven't tested this. The problem is the AC_CHECK_LIB check doesn't find the library, although you'd think it would (a problem I commonly find while cross-compiling). That's why the $host_os check is done. Of course the $host_os check must come after AC_CANONICAL_HOST which is up above.)

-jason short
Index: gettext-tools/configure.ac
===================================================================
RCS file: /home/jdorje/CVSROOT/gettext-0.14.1/gettext-tools/configure.ac,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 configure.ac
--- gettext-tools/configure.ac  15 Jan 2005 07:33:50 -0000      1.1.1.1
+++ gettext-tools/configure.ac  15 Jan 2005 08:30:32 -0000
@@ -98,6 +98,11 @@
 AC_RELOCATABLE
 
 dnl Checks for libraries.
+AC_CHECK_LIB(msvcp60, mbswidth, LTLIBMBS="-lmsvcp60")
+case $host_os in
+  *mingw32* ) LTLIBMBS="-lmsvcp60";;
+esac
+AC_SUBST(LTLIBMBS)
 
 dnl Checks for header files.
 AC_HEADER_STDC
Index: gettext-tools/lib/Makefile.am
===================================================================
RCS file: /home/jdorje/CVSROOT/gettext-0.14.1/gettext-tools/lib/Makefile.am,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile.am
--- gettext-tools/lib/Makefile.am       15 Jan 2005 07:33:53 -0000      1.1.1.1
+++ gettext-tools/lib/Makefile.am       15 Jan 2005 07:38:57 -0000
@@ -116,7 +116,7 @@
 # Need @LTLIBICONV@ because linebreak.c uses iconv().
 libgettextlib_la_LDFLAGS = \
   -release @VERSION@ \
-  @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined
+  @LTLIBINTL@ @LTLIBICONV@ @LTLIBMBS@ -lc -no-undefined
 
 # No need to install libgettextlib.a.
 install-exec-local: install-libLTLIBRARIES install-exec-clean

reply via email to

[Prev in Thread] Current Thread [Next in Thread]