]> ncurses.scripts.mit.edu Git - ncurses.git/blob - convert_configure.pl
ncurses 5.1
[ncurses.git] / convert_configure.pl
1 extproc perl -S -w
2
3 # The converted script is written to stdout, so run this script as
4 #    convert_configure configure > configure.cmd
5 #
6 # When the converted script runs, it expects that /tmp dir is
7 # available (so we create it).
8 #
9 # run the result like this:
10 #    .\configure
11 ;
12
13 mkdir '/tmp', 0777 unless -d '/tmp';
14
15 print <<EOF;
16 extproc sh
17
18 # Make sensible defaults:
19 CC="gcc -Zexe"
20 export CC
21 #GCCOPT="$GCCOPT -Zexe"
22 #export GCCOPT
23 CONFIG_SHELL=sh
24
25 EOF
26
27 $checking_path = 0;
28
29 while (<>) {
30   if (/for\s+(\w+)\s+in\s*\$PATH\s*;/) {
31     $checking_path = 1;
32     $varname = $1;
33     $subst= <<EOS
34 $varname="`echo -E \\"\$$varname\\" | tr \\\\\\\\\\\\\\\\ / `"
35 EOS
36   } 
37   $checking_path = 0 if /^\s*done\s*$/;
38   # We want to create an extra line like this one:
39 #   ac_dir="`echo -E \"$ac_dir\" | tr \\\\\\\\ / `"
40   s{^((\s*)if\s+test)\s*-f\s*(\$$varname/\S+)\s*;}
41     {$2$subst$1 -f $3 -o -f $3.exe ;}
42       if $checking_path;        # Checking for executables
43   s/^host=NONE$/host=os2/;      # Make default host
44   s/"\$\{IFS}:"$/"\${IFS};"/;   # Fix IFS line
45   s/\btest\s+-s\s+conftest\b/test -f conftest/g; # Fix exe test
46   # This one is needed for curses:
47   s/host=`\$ac_config_sub \$host_alias`/$&\nif test -z "$host"; then host=\$host_alias; fi/;
48   s,/bin/sh(?![/\w]),sh,g;
49   print;
50 }
51
52 __END__
53
54 Changes: 98/11 : support check for executables in ncurses.