On Android, set TMPDIR before calling configure
[catagits/fcgi2.git] / perl / Makefile.PL
index 9e712f7..fdf7076 100644 (file)
@@ -1,5 +1,6 @@
 # $Id: Makefile.PL,v 1.33 2002/12/15 19:40:19 skimo Exp $
 
+use 5.006;
 use ExtUtils::MakeMaker;
 use IO::File;
 use Config;
@@ -74,13 +75,16 @@ push @extras, META_MERGE => {
     },
 } if $ExtUtils::MakeMaker::VERSION >= 6.46;
 
-$plfiles = {
-    'echo.PL' => 'echo.fpl',
-    'remote.PL' => 'remote.fpl',
-    'threaded.PL' => 'threaded.fpl',
-    'FCGI.PL' => 'FCGI.pm',
-    'FCGI.XL' => 'FCGI.xs',
-};
+push(@extras,
+    MIN_PERL_VERSION => '5.006',
+) if $ExtUtils::MakeMaker::VERSION >= 6.48;
+
+# not strictly necessary as everything is in core...
+#push(@extras,
+#    CONFIGURE_REQUIRES => {
+#        ...
+#    },
+#) if $ExtUtils::MakeMaker::VERSION >= 6.51_03;
 
 if ("$sys" eq "win32") {
     push @libs, ":nosearch -lws2_32";
@@ -98,7 +102,7 @@ push @extras,
 # Work around bug in previous versions of MakeMaker
 WriteMakefile(
     'NAME'        => 'FCGI',
-    'VERSION_FROM'    => 'version.pm',
+    'VERSION_FROM'    => 'FCGI.pm',
     'dist' => {
         'COMPRESS' => 'gzip -9f',
         'SUFFIX' => 'gz',
@@ -113,10 +117,9 @@ WriteMakefile(
                 '$(MV) MANIFEST.old MANIFEST',
     },
     'clean'        => { FILES => 'config.cache fcgi_config.h' .
-                      ' FCGI.xs FCGI.c ' .
-                      (join ' ', values %$plfiles)},
-    'PL_FILES'        => $plfiles,
+                      ' FCGI.c ' },
     PM            => {'FCGI.pm' => '$(INST_ARCHLIBDIR)/FCGI.pm'},
+    PREREQ_PM     => {'XSLoader' => '0'},
     @extras,
 );
 
@@ -131,18 +134,16 @@ if ($sys eq "win32") {
     unlink("fcgi_config.h");
     my $confdir = $prefix ? "$prefix/include/" : '';
     die $! unless copy("${confdir}fcgi_config_x86.h","fcgi_config.h");
-
-    # Win can't deal with existence of FCGI.xs or absence of FCGI.c
-    unlink("FCGI.xs");
-    open(F, ">FCGI.c"); close(F);
-    $now = time; $before = $now - 600;
-    utime $before, $before, "FCGI.c";
-    utime $now, $now, "FCGI.PL";
 } else {
     print "Running ./configure for you\n";
     print "Please read configure.readme for information on how to run it yourself\n";
 
     $ENV{'CC'} = $Config{'cc'};
+    if ( $^O eq 'android' && !$ENV{'TMPDIR'} ) {
+        # See http://stackoverflow.com/a/15417261
+        require File::Spec;
+        $ENV{'TMPDIR'} = File::Spec->tmpdir();
+    }
     system("$Config{sh} configure");
 }