# New Ticket Created by  Andy Dougherty 
# Please include the string:  [perl #34932]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=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.]

Apply with patch -p1.

diff -r -u parrot-orig/config/gen/icu.pl parrot-andy/config/gen/icu.pl
--- parrot-orig/config/gen/icu.pl       Mon Apr 11 11:14:55 2005
+++ parrot-andy/config/gen/icu.pl       Tue Apr 12 10:58:53 2005
@@ -142,10 +142,29 @@
   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";
 

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to