extproc perl -S -w # This script converts files in subdirectories too, so run it as # convert_configure # # When the converted script runs, it expects that /tmp dir is # available (so we create it). # # run the result like this: # sh configure # Some frequent manual intervention: # a) Some makefiles hardwire SHELL = /bin/sh ==> change to: sh # Most of the time one can put SHELL = @SHELL@ into Makefile.in # # b) Some configure scripts recognize that exe files terminate on .exe # You need to give this script -no-zexe option... [autodetected with newer # configure.] # # c) to disable autodetection, use -zexe option use strict; use File::Find 'find'; use File::Copy 'copy'; my ($no_zexe, $zexe, $overwrite, $omf) = ('') x 4; for (1..20) { shift, $no_zexe = 1 if @ARGV and $ARGV[0] eq '-no-zexe'; shift, $zexe = 1 if @ARGV and $ARGV[0] eq '-zexe'; shift, $omf = 1 if @ARGV and $ARGV[0] eq '-zomf'; shift, $overwrite = 1 if @ARGV and $ARGV[0] eq '-overwrite'; } die "Can't have both -no-zexe and -zexe." if $no_zexe and $zexe; my $VERSION = '20030101'; die <) { $no_exeext = 1 if /^ac_exeext=\s/; # overwritten ac_exeext $cv_exeext = 1 if /ac_cv_exeext=/; # autodetected ac_exeext (but late) } close CONF; if ($cv_exeext and not $no_exeext) { $no_zexe = 1; warn <$_" or die "Cannot open $_ in $File::Find::dir/ for write: $!"; select OUT; { local $_ = $_; do_configure() if /configure/; do_guess() if /\.(guess|sub)/; } close IN or die "Cannot close $from in $File::Find::dir/ for read: $!"; close OUT or die "Cannot close $_ in $File::Find::dir/ for write: $!"; } sub do_configure { print <) { # s/^(\s*)exit 1$/$1$rm_exit/ if defined $rm_exit; # undef $rm_exit if $rm_exit; if (/for\s+(\w+)\s+in\s*\$(PATH|ac_dummy)\s*;/) { $checking_path = 1; $varname = $1; $subst = < $as_executable_p ${_sed} || break s/^\s*test\s*!\s*-f\s*\$\{_sed\}\s*&&/\$as_executable_p \${_sed} ||/; # libtool produces .def files with SINGLE NONSHARED! s/^(\s*archive_cmds=.*)\bSINGLE\s+NONSHARED\b/${1}MULTIPLE NONSHARED/; print; } } sub do_guess { local $/; my $in = ; $in =~ s/(^#!.*\n)/$1echo i386-pc-os2-emx; exit 0;\n\n/; print $in; } __END__ Changes: 98/11 : support check for executables in ncurses. 99/2 : support INSTALL, new IFS=':' style 99/11 : find sendmail 00/01 : export CONFIG_SHELL 00/10 : new syntax for host=`...` line, build= defined new option -no-zexe (needed?). Preload useful commands. 00/11 : New usage: no name should be given, will create configure and configure.guess automatically in all subdirectories. support callin configure.cmd in subdirectories. 01/06 : chmod to allow read-only files. 02/01 : Set LN_S to a sane value. When starting libtool, give the -Zexe-less $CC 03/01 : -zexe option to disable autodetection; autodetect -no-zexe with newer configure; sets ac_exeext; sets as_executable_p; replace ln in config.guess; fix the REx for /usr/sbin/* for disabling OS/2 install; allow libext to be predefined convert \ to / in autoconf 2.57 too 03/09 : new bug in Configure (2.57): ${_sed} without .exe... new option -zomf sets default easy to edit ./configure for OMF... (better have emxomfnm) Populate -I and -L basing on $X11ROOT 04/02 : Add -Zomf etc to FFLAGS if needed Slightly better docs for DO_OMF Logic: a) modify config.guess and config.sub (not needed with newer versions - starting from Dec 00) to accept os2; b) Inside loops which check $dir in $PATH, convert \ to / in $dir, and check for $dir/foo.exe too; [Avoid conversion by converting \ to / in $PATH at the start???] c) When setting $INSTALL, skip directory ?:[\\/]os2[\\/]install[\\/]* (done by changing |/usr/sbin/*| to |/usr/sbin/*|?:[\\/]os2[\\/]install[\\/]*| in the list of things to skip (with both upper/lower cases)). d) Change IFS for splitting of $PATH: "$\{IFS}:" to "\${IFS};" and IFS=":" to IFS=";". e) Change check the tests for existence of linked executable: test -s conftest to test -f conftest; [Do test -s conftest$ac_executable_ext instead?] f) change hard_link and symbolic_link assignmet to put cp there; g) Workaround against a bug in pdksh: $0 may end in a spurious "." (which does not change the file name from the POV of OS, but may break if the script tests $0 for equality) h) Substitute sh for /bin/sh [when setting SHELL= and CONFIG_SHELL=, not needed on #! lines]. i) substitute /usr/sbin/sendmail by the actual path to sendmail. j) Changes LN_S to be cp k) set as_executable_p to a sane value; l) replace ln in config.guess; m) allow libext to be predefined; n) replace `test -f ${_sed}' by $as_executable_p; o) replace broken SINGLE NONSHARED in .def file generation by the correct one Also: 1) Ensures that /tmp exists; 2) Sets CONFIG_SHELL=sh at the start; 3) Sets CC and CXX to the value appropriate for Makefiles and shell scripts which do not expect the need for .exe. [Optional] 4) Not fixed: libtool uses $exeext, which is not set. NOT DONE YET: Some build tools (e.g., of Sablot) require cygpath command to be present. It is easy to write emulation so that "cygpath -w file" acts as "echo file". Newer configure autodetects this, so make it fail unless run with -w. #!/bin/sh # This is quite a placeholder case "$1" in -w) shift;; *) exit 1;; esac echo "$1"