Author: jrieks
Date: Tue Apr 12 11:32:26 2005
New Revision: 7817

Modified:
   trunk/config/gen/icu.pl
Log:
[perl #34932]

If the user has ICU installed in a location not normally searched by
the compiler, but does specify the location of the icu-config program,
Configure.pl ought to add in the appropriate -I/path/to/icu to
ccflags, if necessary.

This patch has Configure.pl test if that additional -I flag is needed.
If ICU is found, it first tries to include <unicode/ucnv.h>.  If that
fails, then it adds -I $icuheaders to ccflags.

I don't understand ICU on Windows.  If anyone could test this patch
there, I'd appreciate it.

[As an aside:  I didn't suggest using icu-config --cppflags because
that's broken in icu-3.2 for Solaris; I've sent an appropriate patch
off to the icu list.]

Courtesy of Andy Dougherty <[EMAIL PROTECTED]>



Modified: trunk/config/gen/icu.pl
==============================================================================
--- trunk/config/gen/icu.pl     (original)
+++ trunk/config/gen/icu.pl     Tue Apr 12 11:32:26 2005
@@ -142,11 +142,30 @@
   Configure::Data->set(
     has_icu    => 1,
     icu_shared  => $icushared,
-    icu_cflags  => "-I$icuheaders",
     icu_headers => join( ' ', @icu_headers ),
     icu_datadir => $icudatadir,
   );
 
+  # Add -I $Icuheaders if necessary
+  my $header = "unicode/ucnv.h";
+  Configure::Data->set(testheaders =>"#include <$header>\n");
+  Configure::Data->set(testheader => "$header");
+  cc_gen('config/auto/headers/test_c.in');
+
+  Configure::Data->set(testheaders => undef);  # Clean up.
+  Configure::Data->set(testheader => undef);
+  eval { cc_build(); };
+  if (!$@ && cc_run() =~ /^$header OK/) {
+    # Ok, we don't need anything more.
+    print "Your compiler found the icu headers... good!\n" if $verbose;
+  }
+  else {
+    print "Adding -I $icuheaders to ccflags for icu headers.\n" if $verbose;
+    Configure::Data->add(' ',
+    ccflags    => "-I $icuheaders");
+  }
+  cc_clean();
+
   $Configure::Step::result = "yes";
 
 }

Reply via email to