1 # $Id: Makefile.PL,v 1.1 1999/02/13 05:26:44 roberts 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 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
46 # the contents of the Makefile that is written.
49 'VERSION_FROM' => 'FCGI.pm',
53 'dist' => { 'COMPRESS' => 'gzip -9f',
55 'PREOP' => '$(CP) '.join(' ',
57 (map {"libfcgi/$_"} @dist2),
58 map {"include/$_"} @dist3).' $(DISTVNAME);'.
59 '$(CP) MANIFEST MANIFEST.old;'.
60 'echo -e '. join('\\\n',@dist1,@dist2,@dist3) .
61 '>> $(DISTVNAME)/MANIFEST',
63 '$(MV) MANIFEST.old MANIFEST',
65 'clean' => { FILES => 'config.cache fcgi_config.h' },
66 'PL_FILES' => { 'echo.PL' => 'echo.fpl', 'FCGI.PL' => 'FCGI.xs' },
69 exit if -f 'fcgi_config.h' or $prefix;
71 # CPAN and no installed lib found
72 if ($sys eq "win32") {
73 # configure will almost certainly not run on a normal NT install,
74 # use the pregenerated configuration file
76 print "Using prebuilt fcgi_config.h file for Windows\n";
77 unlink("fcgi_config.h");
78 die $! unless rename("fcgi_config_x86.h","fcgi_config.h");
80 # Win build system also can't deal with existence of FCGI.xs or absence of
83 open(F, ">FCGI.c"); close(F);
84 $now = time; $before = $now - 600;
85 utime $before, $before, "FCGI.c";
86 utime $now, $now, "FCGI.PL";
89 print "Running ./configure for you\n";
90 print "Please read INSTALL for information on how to run it yourself\n";
92 $ENV{'CC'} = $Config{'cc'};
93 system("./configure");