1 # $Id: Makefile.PL,v 1.10 2001/06/05 15:52:42 skimo Exp $
3 use ExtUtils::MakeMaker;
8 @h1 = qw(fastcgi.h fcgiapp.h fcgiappmisc.h fcgimisc.h fcgios.h);
9 @h = (@h1, 'fcgi_config.h');
11 @dist1 = qw(LICENSE.TERMS acconfig.h);
12 @dist2 = qw(fcgiapp.c os_unix.c os_win32.c);
13 @dist3 = (@h1, qw(fcgi_config.h.in fcgi_config_x86.h));
16 (prompt("Do you want to use the pure perl implementation", "no") =~ /^y/)
18 open(CFG,">FCGI.cfg");
19 print CFG "\$pure = $pure;1;\n";
22 $devkit = cwd() . "/..";
24 if (-d "$devkit/libfcgi/"
25 && -d "$devkit/include" && !grep {!-f "$devkit/include/$_"} (@h))
27 unless (-f "$devkit/libfcgi/libfcgi.a") {
28 warn "Please compile the library before attempting " .
29 "to compile the perl module.\n";
34 push @libs, "-L$devkit/libfcgi -lfcgi";
38 for $dir ("/usr", "/usr/local") {
39 if (-d "$dir/lib/" && -f "$dir/lib/libfcgi.a"
40 && -d "$dir/include" && !grep {!-f "$dir/include/$_"} (@h))
42 print "Found fcgi library and include files in $dir\n";
43 print "Will be using that instead of included files\n";
44 print "Edit Makefile.PL if you don't like it\n";
47 push @libs, "-L$dir/lib -lfcgi";
53 $sys = $^O eq 'MSWin32' ? 'win32' : 'unix';
54 push @o, "fcgiapp.o", "os_$sys.o" unless $prefix;
55 $inc = $prefix ? "-I$prefix/include" : '-I.';
57 push(@extras, CAPI => 'TRUE')
58 if ($] >= 5.005 and $^O eq 'MSWin32'
59 and $Config{archname} =~ /-object\b/i);
62 ABSTRACT => 'Fast CGI module',
63 AUTHOR => 'Sven Verdoolaege (skimo@kotnet.org)')
64 if ($ExtUtils::MakeMaker::VERSION >= 5.4301);
66 $plfiles = { 'echo.PL' => 'echo.fpl',
67 'remote.PL' => 'remote.fpl',
68 'threaded.PL' => 'threaded.fpl',
69 'FCGI.PL' => 'FCGI.pm',
71 $plfiles->{'FCGI.XL'} = 'FCGI.xs' unless $pure;
82 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
83 # the contents of the Makefile that is written.
85 # Work around bug in previous versions of MakeMaker
86 WriteMakefile(NAME => 'FCGI')
87 if $ExtUtils::MakeMaker::VERSION <= 5.4302;
91 'VERSION_FROM' => 'FCGI.PL',
92 'dist' => { 'COMPRESS' => 'gzip -9f',
94 'PREOP' => '$(CP) '.join(' ',
96 (map {"libfcgi/$_"} @dist2),
97 map {"include/$_"} @dist3).' $(DISTVNAME);'.
98 '$(CP) MANIFEST MANIFEST.old;'.
99 'echo -e '. join('\\\n',@dist1,@dist2,@dist3) .
100 '>> $(DISTVNAME)/MANIFEST',
102 '$(MV) MANIFEST.old MANIFEST',
104 'clean' => { FILES => 'config.cache fcgi_config.h' .
105 ' FCGI.xs FCGI.c FCGI.cfg ' .
106 (join ' ', values %$plfiles)},
107 'PL_FILES' => $plfiles,
108 PM => {'FCGI.pm' => '$(INST_ARCHLIBDIR)/FCGI.pm'},
111 # don't install oldinterface pod
112 delete $mm->{MAN3PODS}{oldinterface.pod};
115 exit if -f 'fcgi_config.h' or $prefix or $pure;
117 # CPAN and no installed lib found
118 if ($sys eq "win32") {
119 # configure will almost certainly not run on a normal NT install,
120 # use the pregenerated configuration file
122 use File::Copy qw(copy);
123 print "Using prebuilt fcgi_config.h file for Windows\n";
124 unlink("fcgi_config.h");
125 die $! unless copy("fcgi_config_x86.h","fcgi_config.h");
127 # Win build system also can't deal with existence of FCGI.xs or absence of
130 open(F, ">FCGI.c"); close(F);
131 $now = time; $before = $now - 600;
132 utime $before, $before, "FCGI.c";
133 utime $now, $now, "FCGI.PL";
136 print "Running ./configure for you\n";
137 print "Please read configure.readme for information on how to run it yourself\n";
139 $ENV{'CC'} = $Config{'cc'};
140 system("./configure");