From 611fbfa917846e1cf1ebd3e9f965cd857f67081c Mon Sep 17 00:00:00 2001 From: Cris Bailiff Date: Thu, 20 Sep 2001 09:48:52 +0000 Subject: Commit Curl_easy v1.1.8 - constants updated for libcurl 7.9 - tests modularised --- perl/Curl_easy/Makefile.PL | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'perl/Curl_easy/Makefile.PL') diff --git a/perl/Curl_easy/Makefile.PL b/perl/Curl_easy/Makefile.PL index 58a8528ad..551808fa9 100644 --- a/perl/Curl_easy/Makefile.PL +++ b/perl/Curl_easy/Makefile.PL @@ -12,3 +12,76 @@ WriteMakefile( 'INC' => '', # e.g., '-I/usr/include/other' 'clean' => {FILES => "head.out body.out"} ); + +# +# This utility helper generates the constants function from curl.h +# +# It is normally only used by the maintainer, but if you're curl is older +# or missing some constants, you can delete curlopt-constants.c and re-run 'perl Makefile.PL' +# + +if (!open(CONSTANTS,") { + if ($_ =~ m/CINIT\(/ and $_ !~ m/#/) { + my ($option,$type,$code)=m/.*CINIT\((\w*)\s*,\s*(\w+)\s*,\s*(\d+).*/; + $types{$option}=$type; + $codes{$option}=$code; + } +} +close(CURL_H); + +# some things are ifdefed out... +foreach my $ifdef0 (qw(FLAGS PROGRESSMODE)) +{ + delete $types{$ifdef0}; delete $codes{$ifdef0}; +} + +open(CURL_XS,">curlopt-constants.c") or die "Can't write curlopt-constants.c\n"; +foreach my $next_initial ('A'..'Z') { + print CURL_XS " case '$next_initial':\n"; + my $count=0; + foreach my $option (sort keys %types) { + my $initial=substr($option,0,1); + if ($next_initial eq $initial) { + print CURL_XS " if (strEQ(name, \"$option\")) return CURLOPT_$option;\n"; + $count++; + } + } + if ($count) { + print CURL_XS " break;\n"; + } +} +close(CURL_XS); +} -- cgit v1.2.3