summaryrefslogtreecommitdiffstats
path: root/contrib/ncurses/convert_configure.pl
blob: 9d1026d16878ce3a8e4ecbe02376b852391d5b18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
extproc perl -S -w

# The converted script is written to stdout, so run this script as
#    convert_configure configure > configure.cmd
#
# When the converted script runs, it expects that /tmp dir is
# available (so we create it).
#
# run the result like this:
#    .\configure
;

mkdir '/tmp', 0777 unless -d '/tmp';

print <<EOF;
extproc sh

# Make sensible defaults:
CC="gcc -Zexe"
export CC
#GCCOPT="$GCCOPT -Zexe"
#export GCCOPT
CONFIG_SHELL=sh

EOF

$checking_path = 0;

while (<>) {
  if (/for\s+(\w+)\s+in\s*\$PATH\s*;/) {
    $checking_path = 1;
    $varname = $1;
    $subst= <<EOS
$varname="`echo -E \\"\$$varname\\" | tr \\\\\\\\\\\\\\\\ / `"
EOS
  } 
  $checking_path = 0 if /^\s*done\s*$/;
  # We want to create an extra line like this one:
#   ac_dir="`echo -E \"$ac_dir\" | tr \\\\\\\\ / `"
  s{^((\s*)if\s+test)\s*-f\s*(\$$varname/\S+)\s*;}
    {$2$subst$1 -f $3 -o -f $3.exe ;}
      if $checking_path;	# Checking for executables
  s/^host=NONE$/host=os2/;	# Make default host
  s/"\$\{IFS}:"$/"\${IFS};"/;	# Fix IFS line
  s/\btest\s+-s\s+conftest\b/test -f conftest/g; # Fix exe test
  # This one is needed for curses:
  s/host=`\$ac_config_sub \$host_alias`/$&\nif test -z "$host"; then host=\$host_alias; fi/;
  s,/bin/sh(?![/\w]),sh,g;
  print;
}

__END__

Changes: 98/11 : support check for executables in ncurses.
OpenPOWER on IntegriCloud