Subject: | Makefile.PL doesn't correctly detect -lintl on some systems |
Currently, building gettext fails on Cygwin. This is because Makefile.PL doesn't invoke the compiler quite correctly.
On at least some OSes (e.g. Cygwin), the order of source files and -l flags in compilation invocations matters. In other words, "foo.c -lbar" is *not* the same as "-lbar foo.c". Only he "foo.c -lbar" case will work correctly (since dependencies in foo.c will get satisfied from -lbar, in the UNIXish left-to-right order).
Makefile.PL for gettext currently tries to invoke the compiler as
$cc -o conftest -lintl conftest.c
I would suggest replacing that with
$cc -o conftest conftest.c -lintl
The attached patch does exactly that, and fixes the problem on Cygwin.
Thanks,
--Albert Dvornik <dvornik@gmail.com>
--- Makefile.PL.orig 2005-01-30 18:30:22.000000000 -0500
+++ Makefile.PL 2005-10-07 05:35:46.297520000 -0400
@@ -50,7 +50,7 @@
close TEST;
open(SAVE, ">&STDERR");
open(STDERR, ">/dev/null");
- system($cc . " -o conftest " . $libs . " conftest.c");
+ system($cc . " -o conftest conftest.c " . $libs);
my $exitstatus = $?;
open(STDERR, ">&SAVE");
if ($exitstatus != 0) {