1 # $Id: Makefile.PL,v 1.7 2000/12/11 22:00:36 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/"
18 && -d "$devkit/include" && !grep {!-f "$devkit/include/$_"} (@h))
20 unless (-f "$devkit/libfcgi/libfcgi.a") {
21 warn "Please compile the library before attempting " .
22 "to compile the perl module.\n";
27 push @libs, "-L$devkit/libfcgi -lfcgi";
31 for $dir ("/usr", "/usr/local") {
32 if (-d "$dir/lib/" && -f "$dir/lib/libfcgi.a"
33 && -d "$dir/include" && !grep {!-f "$dir/include/$_"} (@h))
35 print "Found fcgi library and include files in $dir\n";
36 print "Will be using that instead of included files\n";
37 print "Edit Makefile.PL if you don't like it\n";
40 push @libs, "-L$dir/lib -lfcgi";
46 $sys = $^O eq 'MSWin32' ? 'win32' : 'unix';
47 push @o, "fcgiapp.o", "os_$sys.o" unless $prefix;
48 $inc = $prefix ? "-I$prefix/include" : '-I.';
50 push(@extras, CAPI => 'TRUE')
51 if ($] >= 5.005 and $^O eq 'MSWin32'
52 and $Config{archname} =~ /-object\b/i);
55 ABSTRACT => 'Fast CGI module',
56 AUTHOR => 'Sven Verdoolaege (skimo@kotnet.org)')
57 if ($ExtUtils::MakeMaker::VERSION >= 5.4301);
59 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
60 # the contents of the Makefile that is written.
63 'VERSION_FROM' => 'FCGI.pm',
67 'dist' => { 'COMPRESS' => 'gzip -9f',
69 'PREOP' => '$(CP) '.join(' ',
71 (map {"libfcgi/$_"} @dist2),
72 map {"include/$_"} @dist3).' $(DISTVNAME);'.
73 '$(CP) MANIFEST MANIFEST.old;'.
74 'echo -e '. join('\\\n',@dist1,@dist2,@dist3) .
75 '>> $(DISTVNAME)/MANIFEST',
77 '$(MV) MANIFEST.old MANIFEST',
79 'clean' => { FILES => 'config.cache fcgi_config.h' },
80 'PL_FILES' => { 'echo.PL' => 'echo.fpl',
81 'remote.PL' => 'remote.fpl',
82 'threaded.PL' => 'threaded.fpl',
83 'FCGI.PL' => 'FCGI.xs',
88 exit if -f 'fcgi_config.h' or $prefix;
90 # CPAN and no installed lib found
91 if ($sys eq "win32") {
92 # configure will almost certainly not run on a normal NT install,
93 # use the pregenerated configuration file
95 use File::Copy qw(copy);
96 print "Using prebuilt fcgi_config.h file for Windows\n";
97 unlink("fcgi_config.h");
98 die $! unless copy("fcgi_config_x86.h","fcgi_config.h");
100 # Win build system also can't deal with existence of FCGI.xs or absence of
103 open(F, ">FCGI.c"); close(F);
104 $now = time; $before = $now - 600;
105 utime $before, $before, "FCGI.c";
106 utime $now, $now, "FCGI.PL";
109 print "Running ./configure for you\n";
110 print "Please read configure.readme for information on how to run it yourself\n";
112 $ENV{'CC'} = $Config{'cc'};
113 system("./configure");