views:

432

answers:

1

I'd like to cross-compile some open-source libraries (libiconv, gettext, glib2) for windows using mingw on Mac OS X. I've installed mingw on Mac with MacPorts. But now I'm not sure what to give to the configure script so that it will work. The cross-compilation tutorials I've seen all talk about makefiles, but no one mentions what to give autoconf-based projects.

I'm configuring like this:

./configure --prefix=/opt/local/i386-mingw32 --host=i586-mingw32msvc

but it doesn't seem to take. While the configure will pass, running "make" will give this error:

i686-apple-darwin9-gcc-4.0.1: no input files

I thought the "--host" argument to configure was supposed to tell it to use the mingw compiler? I'm not sure what's going on here.

+1  A: 

I've been working on a similar problem and have finally gotten it to work. Here is how I put it together:

#!/bin/sh
make distclean
CC=/opt/local/bin/i386-mingw32-gcc
CXX=/opt/local/bin/i386-mingw32-g++
MINGWFLAGS="-mwin32 -mconsole -march=pentium4 "
CFLAGS="$MINGWFLAGS"
CXXFLAGS="$MINGWFLAGS"
./configure CC=$CC CXX=$CXX --target=i586-mingw32msvc --host=i586
echo make CC=$CC CXX=/opt/local/bin/i386-mingw32-g++ CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS"
make CC=$CC CXX=/opt/local/bin/i386-mingw32-g++ CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS"

This is using the version of mingw that is installed using the MacPorts command:

sudo port install i386-mingw32-binutils i386-mingw32-gcc i386-mingw32-libunicows i386-mingw32-runtime i386-mingw32-w32api

Good luck!

vy32