3 # $Id: convert_configure.pl,v 1.3 2006/04/22 23:04:06 tom Exp $
4 ##############################################################################
5 # Copyright (c) 1998-2000,2006 Free Software Foundation, Inc. #
7 # Permission is hereby granted, free of charge, to any person obtaining a #
8 # copy of this software and associated documentation files (the "Software"), #
9 # to deal in the Software without restriction, including without limitation #
10 # the rights to use, copy, modify, merge, publish, distribute, distribute #
11 # with modifications, sublicense, and/or sell copies of the Software, and to #
12 # permit persons to whom the Software is furnished to do so, subject to the #
13 # following conditions: #
15 # The above copyright notice and this permission notice shall be included in #
16 # all copies or substantial portions of the Software. #
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
19 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
20 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
21 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
22 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
23 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
24 # DEALINGS IN THE SOFTWARE. #
26 # Except as contained in this notice, the name(s) of the above copyright #
27 # holders shall not be used in advertising or otherwise to promote the sale, #
28 # use or other dealings in this Software without prior written #
30 ##############################################################################
32 # The converted script is written to stdout, so run this script as
33 # convert_configure configure > configure.cmd
35 # When the converted script runs, it expects that /tmp dir is
36 # available (so we create it).
38 # run the result like this:
41 # Some frequent manual intervention:
42 # a) Some makefiles hardwire SHELL = /bin/sh ==> change to: sh
43 # b) Some makefiles recognize that exe files terminate on .exe
44 # You need to give this script -no-zexe option...
46 shift, $no_zexe = 1 if @ARGV and $ARGV[0] eq '-no-zexe';
48 mkdir '/tmp', 0777 unless -d '/tmp';
55 print <<EOF unless $no_zexe;
56 # Make sensible defaults:
61 #GCCOPT="$GCCOPT -Zexe"
69 # Optimization (GNU make 3.74 cannot be loaded :-():
70 emxload -m 30 sh.exe ls.exe tr.exe id.exe sed.exe # make.exe
71 emxload -m 30 grep.exe egrep.exe fgrep.exe cat.exe rm.exe mv.exe cp.exe
72 emxload -m 30 uniq.exe basename.exe sort.exe awk.exe echo.exe
80 if (/for\s+(\w+)\s+in\s*\$(PATH|ac_dummy)\s*;/) {
84 $varname="`echo -E \\"\$$varname\\" | tr \\\\\\\\\\\\\\\\ / `"
87 if (/if\s+test\s+-z\s+\"\$INSTALL\"/) {
88 $checking_install = 1;
90 $checking_install = $checking_path = 0 if /^\s*done\s*$/;
91 # We want to create an extra line like this one:
92 # ac_dir="`echo -E \"$ac_dir\" | tr \\\\\\\\ / `"
93 s{^((\s*)if\s+test)\s*-f\s*(\$$varname/\S+)\s*;}
94 {$2$subst$1 -f $3 -o -f $3.exe ;}
95 if $checking_path; # Checking for executables
96 # change |/usr/sbin/*| to |/usr/sbin/*|?:[\\/]os2[\\/]install[\\/]*|
97 # in the list of things to skip (with both cases)
99 {|/usr/sbin/*|?:[\\\\/]os2[\\\\/]install[\\\\/]*|?:[\\\\/]OS2[\\\\/]INSTALL[\\\\/]*|}
100 if $checking_install; # Do not accept d:/os2/install/install.exe
101 s/^(host|build)=NONE$/$1=x86-emx-os2/; # Make default host/build
102 s/"\$\{IFS}:"$/"\${IFS};"/; # Fix IFS line
103 s/\bIFS=\":\"$/IFS=";"/; # Fix another IFS line
104 s/\btest\s+-s\s+conftest\b/test -f conftest/g; # Fix exe test
105 # This one is needed for curses:
106 s/^\s*host=`.*\$ac_config_sub \$host_alias`/$&\nif test -z "\$host"; then host=\$host_alias; fi/;
107 s,/bin/sh(?![/\w]),sh,g;
108 s,^(\s*/usr/sbin/sendmail\s*)\\$,$1 "`whence sendmail | tr '\\\\\\\\' / `" \\,;
114 Changes: 98/11 : support check for executables in ncurses.
115 99/2 : support INSTALL,
117 99/11 : find sendmail
118 00/01 : export CONFIG_SHELL
119 00/10 : new syntax for host=`...` line