source: trunk/essentials/sys-libs/ncurses/convert_configure.pl

Last change on this file was 3043, checked in by bird, 18 years ago

-> essentials

File size: 2.6 KB
Line 
1extproc 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# Some frequent manual intervention:
13# a) Some makefiles hardwire SHELL = /bin/sh ==> change to: sh
14# b) Some makefiles recognize that exe files terminate on .exe
15# You need to give this script -no-zexe option...
16
17shift, $no_zexe = 1 if @ARGV and $ARGV[0] eq '-no-zexe';
18
19mkdir '/tmp', 0777 unless -d '/tmp';
20
21print <<EOF;
22extproc sh
23
24EOF
25
26print <<EOF unless $no_zexe;
27# Make sensible defaults:
28CC="gcc -Zexe -Zmt"
29export CC
30CXX="gcc -Zexe -Zmt"
31export CXX
32#GCCOPT="$GCCOPT -Zexe"
33#export GCCOPT
34EOF
35
36print <<EOF;
37CONFIG_SHELL=sh
38export CONFIG_SHELL
39
40# Optimization (GNU make 3.74 cannot be loaded :-():
41emxload -m 30 sh.exe ls.exe tr.exe id.exe sed.exe # make.exe
42emxload -m 30 grep.exe egrep.exe fgrep.exe cat.exe rm.exe mv.exe cp.exe
43emxload -m 30 uniq.exe basename.exe sort.exe awk.exe echo.exe
44
45
46EOF
47
48$checking_path = 0;
49
50while (<>) {
51 if (/for\s+(\w+)\s+in\s*\$(PATH|ac_dummy)\s*;/) {
52 $checking_path = 1;
53 $varname = $1;
54 $subst= <<EOS
55$varname="`echo -E \\"\$$varname\\" | tr \\\\\\\\\\\\\\\\ / `"
56EOS
57 }
58 if (/if\s+test\s+-z\s+\"\$INSTALL\"/) {
59 $checking_install = 1;
60 }
61 $checking_install = $checking_path = 0 if /^\s*done\s*$/;
62 # We want to create an extra line like this one:
63# ac_dir="`echo -E \"$ac_dir\" | tr \\\\\\\\ / `"
64 s{^((\s*)if\s+test)\s*-f\s*(\$$varname/\S+)\s*;}
65 {$2$subst$1 -f $3 -o -f $3.exe ;}
66 if $checking_path; # Checking for executables
67 # change |/usr/sbin/*| to |/usr/sbin/*|?:[\\/]os2[\\/]install[\\/]*|
68 # in the list of things to skip (with both cases)
69 s{\Q|/usr/sbin/*|}
70 {|/usr/sbin/*|?:[\\\\/]os2[\\\\/]install[\\\\/]*|?:[\\\\/]OS2[\\\\/]INSTALL[\\\\/]*|}
71 if $checking_install; # Do not accept d:/os2/install/install.exe
72 s/^(host|build)=NONE$/$1=x86-emx-os2/; # Make default host/build
73 s/"\$\{IFS}:"$/"\${IFS};"/; # Fix IFS line
74 s/\bIFS=\":\"$/IFS=";"/; # Fix another IFS line
75 s/\btest\s+-s\s+conftest\b/test -f conftest/g; # Fix exe test
76 # This one is needed for curses:
77 s/^\s*host=`.*\$ac_config_sub \$host_alias`/$&\nif test -z "\$host"; then host=\$host_alias; fi/;
78 s,/bin/sh(?![/\w]),sh,g;
79 s,^(\s*/usr/sbin/sendmail\s*)\\$,$1 "`whence sendmail | tr '\\\\\\\\' / `" \\,;
80 print;
81}
82
83__END__
84
85Changes: 98/11 : support check for executables in ncurses.
86 99/2 : support INSTALL,
87 new IFS=':' style
88 99/11 : find sendmail
89 00/01 : export CONFIG_SHELL
90 00/10 : new syntax for host=`...` line
Note: See TracBrowser for help on using the repository browser.