2 use ExtUtils::MakeMaker;
5 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
6 # the contents of the Makefile that is written.
8 my %MakeParams = InitMakeParams();
11 WriteMakefile(%MakeParams);
16 LibIDN.pm: _LibIDN.pm _test.pl
17 perl Makefile.PL $options
20 perl Makefile.PL $options
28 'NAME' => 'Net::LibIDN',
29 'VERSION_FROM' => 'LibIDN.pm', # finds $VERSION
30 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1
31 ($] >= 5.005 ? ## Add these new keywords supported since 5.005
32 (ABSTRACT_FROM => 'LibIDN.pm', # retrieve abstract from module
33 AUTHOR => 'Thomas Jacob <jacob@internet24.de>') : ()),
34 # MAN3PODS => { 'LibIDN.pm' },
35 PM => { 'LibIDN.pm' => '$(INST_LIB)/Net/LibIDN.pm' },
38 clean => { FILES => "test.pl LibIDN.pm" }
40 my ($libdir, $incdir, $disable_tld);
42 $options=join(' ', @ARGV);
46 "with-libidn=s" => \$libdir,
47 "with-libidn-inc=s" => \$incdir,
48 "disable-tld" => \$disable_tld
53 $Params{LIBS} = "-L$libdir -lidn";
57 $Params{LIBS} = '-lidn';
62 $Params{INC} = "-I$incdir";
69 my $libidn = CheckLibidn($Params{INC}, $Params{LIBS});
71 die "This module requires GNU Libidn, which could not be found.\n" unless $libidn;
73 print "Found LibIDN, ";
74 print $libidn == 1? "without": "with";
75 print " TLD checking support\n";
77 if ($libidn == 2 && $disable_tld)
79 print "TLD checking support disabled at user request\n";
82 $disable_tld = 1 if ($libidn<2);
90 $Params{DEFINE} = '-DHAVE_TLD';
92 FilterTLD("_LibIDN.pm", "LibIDN.pm", !$disable_tld);
93 FilterTLD("_test.pl", "test.pl", !$disable_tld);
105 open(IN, "<$in") || die "Can't open file $in\n";
106 open(OUT, ">$out") || die "Can't write file $out\n";
131 print OUT $_ unless $else;
162 res = idna_to_ascii_8z("libidn", &output, 0);
163 printf("%d-%s", res, output);
167 open(FILE, ">__test1.c");
171 system "cc $cflags $ldflags -o __test1 __test1.c";
172 $final=1 if ($? >> 8);
176 open(FILE, "./__test1|");
179 $final=1 if $_ ne "0-libidn";
186 return $result if ($final);
198 res =tld_get_z ("libidn.idn", &output);
199 printf("%d-%s", res, output);
203 open(FILE, ">__test2.c");
207 system "cc $cflags $ldflags -o __test2 __test2.c ";
208 $final = 1 if ($? >> 8);
212 open(FILE, "./__test2|");
215 $final = 1 if $_ ne "0-idn";
222 return $result if $final;