1use ExtUtils::MakeMaker; 2use Config; 3 4$expat_libpath = ''; 5$expat_incpath = ''; 6 7my @replacement_args; 8 9foreach (@ARGV) { 10 if (/^EXPAT(LIB|INC)PATH=(.+)/) { 11 if ($1 eq 'LIB') { 12 $expat_libpath = $2; 13 } 14 else { 15 $expat_incpath = $2; 16 } 17 } 18 else { 19 push(@replacement_args, $_); 20 } 21} 22 23@ARGV = @replacement_args; 24 25if (not $expat_libpath and $] >= 5.006001) { 26 require ExtUtils::Liblist; # Buggy before this 27 ($expat_libpath) = ExtUtils::Liblist->ext('-lexpat'); 28} 29 30unless ($expat_libpath) { 31 # Test for existence of libexpat 32 my $found = 0; 33 foreach (split(/\s+/, $Config{libpth})) { 34 if (-f "$_/libexpat." . $Config{so}) { 35 $found = 1; 36 last; 37 } 38 } 39 40 unless ($found) { 41 die <<'Expat_Not_Installed;'; 42 43Expat must be installed prior to building XML::Parser and I can't find 44it in the standard library directories. You can download expat from: 45 46http://sourceforge.net/projects/expat/ 47 48If expat is installed, but in a non-standard directory, then use the 49following options to Makefile.PL: 50 51 EXPATLIBPATH=... To set the directory in which to find libexpat 52 53 EXPATINCPATH=... To set the directory in which to find expat.h 54 55For example: 56 57 perl Makefile.PL EXPATLIBPATH=/home/me/lib EXPATINCPATH=/home/me/include 58 59Note that if you build against a shareable library in a non-standard location 60you may (on some platforms) also have to set your LD_LIBRARY_PATH environment 61variable at run time for perl to find the library. 62 63Expat_Not_Installed; 64 } 65} 66 67# Don't try to descend into Expat directory for testing 68 69sub MY::test 70{ 71 my $self = shift; 72 73 my $hold = delete $self->{DIR}; 74 my $ret = $self->MM::test(@_); 75 $self->{DIR} = $hold if defined($hold); 76 $ret; 77} 78 79@extras = (); 80 81push(@extras, 82 CAPI => 'TRUE') 83 if ($PERL_VERSION >= 5.005 and $OSNAME eq 'MSWin32' 84 and $Config{archname} =~ /-object\b/i); 85 86push(@extras, 87 ABSTRACT_FROM => 'Parser.pm', 88 AUTHOR => 'Clark Cooper (coopercc@netheaven.com)') 89 if ($ExtUtils::MakeMaker::Version >= 5.4301); 90 91WriteMakefile( 92 NAME => 'XML::Parser', 93 DIR => [qw(Expat)], 94 dist => {COMPRESS => 'gzip', SUFFIX => '.gz'}, 95 VERSION_FROM => 'Parser.pm', 96 @extras 97 ); 98 99