| 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 | # 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 |
|
|---|
| 17 | shift, $no_zexe = 1 if @ARGV and $ARGV[0] eq '-no-zexe';
|
|---|
| 18 |
|
|---|
| 19 | mkdir '/tmp', 0777 unless -d '/tmp';
|
|---|
| 20 |
|
|---|
| 21 | print <<EOF;
|
|---|
| 22 | extproc sh
|
|---|
| 23 |
|
|---|
| 24 | EOF
|
|---|
| 25 |
|
|---|
| 26 | print <<EOF unless $no_zexe;
|
|---|
| 27 | # Make sensible defaults:
|
|---|
| 28 | CC="gcc -Zexe -Zmt"
|
|---|
| 29 | export CC
|
|---|
| 30 | CXX="gcc -Zexe -Zmt"
|
|---|
| 31 | export CXX
|
|---|
| 32 | #GCCOPT="$GCCOPT -Zexe"
|
|---|
| 33 | #export GCCOPT
|
|---|
| 34 | EOF
|
|---|
| 35 |
|
|---|
| 36 | print <<EOF;
|
|---|
| 37 | CONFIG_SHELL=sh
|
|---|
| 38 | export CONFIG_SHELL
|
|---|
| 39 |
|
|---|
| 40 | # Optimization (GNU make 3.74 cannot be loaded :-():
|
|---|
| 41 | emxload -m 30 sh.exe ls.exe tr.exe id.exe sed.exe # make.exe
|
|---|
| 42 | emxload -m 30 grep.exe egrep.exe fgrep.exe cat.exe rm.exe mv.exe cp.exe
|
|---|
| 43 | emxload -m 30 uniq.exe basename.exe sort.exe awk.exe echo.exe
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 | EOF
|
|---|
| 47 |
|
|---|
| 48 | $checking_path = 0;
|
|---|
| 49 |
|
|---|
| 50 | while (<>) {
|
|---|
| 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 \\\\\\\\\\\\\\\\ / `"
|
|---|
| 56 | EOS
|
|---|
| 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 |
|
|---|
| 85 | Changes: 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
|
|---|