I just figured out the coolest stuff today, so I thought I would pass it on. Most of you probably already know that autoconf can do this, (as did I), but I've never used this feature before today.
I have a whole mingw32 gcc cross-compiler suite installed that makes win32 exes. I also have all the development stuff (dlls and everything) for using GTK/win32. So it's easy to build win32 exe's with gtk: i386-mingw32-gcc -mms-bitfields -mwindows -o myapp.exe main.c interface.c callbacks.c support.c `PKG_CONFIG_PATH=/usr/i386-mingw32/lib/pkgconfig pkg-config --cflags --libs gtk+-2.0` Got all that? Good. Well, configure lets you make a directory inside the root of the build tree and configure it for a specific platform. This lets you use one source tree to build multiple targets simultaneously. Glade-2 produces a configure that can be trivially set to target win32: ./configure --target=i386-mingw32 --host=i386-mingw32. However unless I do: CFLAGS='-mms-bitfields' LDFLAGS='-mwindows' PKG_CONFIG_PATH=/usr/i386-mingw32/lib/pkgconfig ./configure --target=i386-mingw32 --host=i386-mingw32 then I get exe's that won't run with the win32 dlls of gtk because they were built with visual studio. The ms-bitfields flag makes the dlls work with gcc. Anyway, rather than type all that in every time, I looked at another configure.in script (the recipe that makes the real configure script) and was able to trivially modify the configure.in file produced by Glade-2 so that after running autoconf, the new configure script was properly able to identify the win32 target and set those compiler flags and pkg-config path automatically. This means I can now do: mkdir win32 cd win32 ../configure --target=i386-mingw32 --host=i386-mingw32 make and simultaneously in another tree: mkdir linux cd linux ../configure make And I can build linux and win32 binaries from the same source tree at the same time. This whole cross-developing is really fun. If anyone wants a tarball snapshot of my whole mingw32 cross kit, I'll post it somewhere, a long with my little changes to make configure.in turn on the right compiler flags. Thought I'd mention also that the win32 gtk exe's I build run with the same gtk runtime that GAIM/Win32 uses, so that makes software distribution quite easy. That and the Wimp theme that gaim uses makes my GTK applications fit in on XP (and 2000). Yeah! Next stop, cross-compiling evolution for win32/gtk. Just kidding. Evolution has too many gnome and X11 dependencies to be practial right now. But hey. A question that probably only ed schaller can answer: How the heck to I build a version of gcc that targets the cygwin environment (rather than straight win32)? No matter what I do, I can't get gcc to link exes against the cygwin1.dll binary -- it keeps wanting to produce a mingw32 gcc. Anyway, this is something I'll investigate further. Michael -- Michael Torrie <[EMAIL PROTECTED]> ____________________ BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________ List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
