6 use File
::Temp
qw(tempdir);
12 This file seems to determine some configuration.
14 util/config_h.pl GHC BASEDIR
16 GHC - Location and flags of the ghc executable
18 BASEDIR - Base directory of the Pugs installation
19 (defaults to current directory)
23 my ($ghc_line, $base) = @ARGV or exit;
25 $ghc_line ||= $ENV{GHC
} || 'ghc';
28 my ($ghc, @ghc_args) = split /\s+/, $ghc_line;
30 open IN
, "< $base/lib/Perl6/Pugs.pm" or die $!;
31 open OUT
, "> $base/src/Pugs/pugs_config.h" or die $!;
34 /version (\S+) .*\breleased (.*)\./ or next;
40 #define PUGS_VERSION "$1"
45 #define PUGS_DATE "$2"
51 # FIXME: we assume if you have cywin, you're still using ghc-msys
52 if ($^O
=~ /MSWin32|mingw|msys|cygwin/i) {
53 print OUT
"#undef PUGS_HAVE_POSIX\n";
56 print OUT
"#define PUGS_HAVE_POSIX 1\n";
59 my $has_readline = try_compile
(<< '.');
60 import System
.Console
.Readline
62 main
= readline "" >> return ()
66 my $has_th = try_compile
(<< '.');
67 {-# OPTIONS_GHC -fth #-}
68 main
:: (Monad m
) => m
()
69 main
= $([| return () |])
73 print OUT
"#define PUGS_HAVE_TH 1\n";
76 print OUT
"#undef PUGS_HAVE_TH\n";
79 *** Template Haskell compiler backends disabled
. If you want
80 Template Haskell support
, please compile your GHC with the
90 my $temp = "pugs-tmp-$$";
93 open TMP
, "> $temp.hs";
105 my $ok = -s
"$temp.exe";