1 # $Id: Makefile.PL,v 1.3 1999/03/08 16:26:05 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));
15 $devkit = cwd() . "/..";
17 if (-d "$devkit/libfcgi/" && -f "$devkit/libfcgi/libfcgi.a"
18 && -d "$devkit/include" && !grep {!-f "$devkit/include/$_"} (@h))
22 push @libs, "-L$devkit/libfcgi -lfcgi";
26 for $dir ("/usr", "/usr/local") {
27 if (-d "$dir/lib/" && -f "$dir/lib/libfcgi.a"
28 && -d "$dir/include" && !grep {!-f "$dir/include/$_"} (@h))
30 print "Found fcgi library and include files in $dir\n";
31 print "Will be using that instead of included files\n";
32 print "Edit Makefile.PL if you don't like it\n";
35 push @libs, "-L$dir/lib -lfcgi";
41 $sys = $^O eq 'MSWin32' ? 'win32' : 'unix';
42 push @o, "fcgiapp.o", "os_$sys.o" unless $prefix;
43 $inc = $prefix ? "-I$prefix/include" : '-I.';
45 push(@extras, CAPI => 'TRUE')
46 if ($] >= 5.005 and $^O eq 'MSWin32'
47 and $Config{archname} =~ /-object\b/i);
50 ABSTRACT => 'Fast CGI module',
51 AUTHOR => 'Sven Verdoolaege (skimo@kotnet.org)')
52 if ($ExtUtils::MakeMaker::VERSION >= 5.4301);
54 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
55 # the contents of the Makefile that is written.
58 'VERSION_FROM' => 'FCGI.pm',
62 'dist' => { 'COMPRESS' => 'gzip -9f',
64 'PREOP' => '$(CP) '.join(' ',
66 (map {"libfcgi/$_"} @dist2),
67 map {"include/$_"} @dist3).' $(DISTVNAME);'.
68 '$(CP) MANIFEST MANIFEST.old;'.
69 'echo -e '. join('\\\n',@dist1,@dist2,@dist3) .
70 '>> $(DISTVNAME)/MANIFEST',
72 '$(MV) MANIFEST.old MANIFEST',
74 'clean' => { FILES => 'config.cache fcgi_config.h' },
75 'PL_FILES' => { 'echo.PL' => 'echo.fpl', 'FCGI.PL' => 'FCGI.xs' },
79 exit if -f 'fcgi_config.h' or $prefix;
81 # CPAN and no installed lib found
82 if ($sys eq "win32") {
83 # configure will almost certainly not run on a normal NT install,
84 # use the pregenerated configuration file
86 print "Using prebuilt fcgi_config.h file for Windows\n";
87 unlink("fcgi_config.h");
88 die $! unless rename("fcgi_config_x86.h","fcgi_config.h");
90 # Win build system also can't deal with existence of FCGI.xs or absence of
93 open(F, ">FCGI.c"); close(F);
94 $now = time; $before = $now - 600;
95 utime $before, $before, "FCGI.c";
96 utime $now, $now, "FCGI.PL";
99 print "Running ./configure for you\n";
100 print "Please read configure.readme for information on how to run it yourself\n";
102 $ENV{'CC'} = $Config{'cc'};
103 system("./configure");