Mail Archives: cygwin-apps/2001/10/06/02:46:09
This is a multi-part message in MIME format.
--------------020006040207050901010405
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
So here's my first attempt at a wrapper script. (Of course, I'll also
need to do wrappers for autoheader, autoreconf, autoscan, autoupdate,
and ifnames -- and then repeat for the automake packages.)
Assuming that autoconf-2.13 is installed into /usr/auto-stable/* and
autoconf-2.52 is installed into /usr/auto-devel/* (as I have built them
on my system) this works pretty well.
What do you think? Should I continue on this path?
--Chuck
--------------020006040207050901010405
Content-Type: text/plain;
name="autoconf"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="autoconf"
#! /bin/bash
path_stable=/usr/auto-stable
path_devel=/usr/auto-devel
# Set up variables
unset opt_version
unset opt_help
unset opt_debug
unset opt_verbose
unset opt_localdir
unset opt_autoconfdir
unset opt_macrodir
unset opt_traces
unset traces
unset opt_initialization
unset opt_output
unset opt_warnings
unset warnings
unset opt_stop
unset autosense_input
me=`echo "$0" | sed -e 's,.*[\\/],,'`
help="\
Try \`$me --help' for more information."
exit_missing_arg="\
echo \"$me: option \\\`\$1' requires an argument\" >&2
echo \"\$help\" >&2
exit 1"
# Parse command line. We have to do this in case the user
# specifies the input file or uses stdin. If so, then
# we must accommodate...but we can only do that if we
# parse ALL possible options. This gets ugly if the
# two versions of autoconf accept different options.
while test $# -gt 0 ; do
optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
"x$1" : 'x-.\(.*\)'`
case $1 in
--version | -V )
opt_version="--version"
shift ;;
--help | -h )
opt_help="--help"
shift ;;
--debug | -d )
opt_debug="--debug"
shift ;;
--verbose | -v )
opt_verbose="--verbose"
shift ;;
--localdir=* | -l?* )
opt_localdir="--localdir=$optarg"
shift ;;
--localdir | -l )
test $# = 1 && eval "$exit_missing_arg"
shift
opt_localdir="--localdir=$1"
shift ;;
--autoconf-dir=* | -A?* )
opt_autoconfdir="--autoconf-dir=$optarg"
shift ;;
--autoconf-dir | -A )
test $# = 1 && eval "$exit_missing_arg"
shift
opt_autoconfdir="--autoconf-dir=$1"
shift ;;
--macrodir=* | -m?* )
opt_macrodir="--macrodir=$optarg"
shift ;;
--macrodir | -m )
test $# = 1 && eval "$exit_missing_arg"
shift
opt_macrodir="--macrodir=$1"
shift ;;
--trace=* | -t?* )
traces="$traces '"`echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'"
shift ;;
--trace | -t )
test $# = 1 && eval "$exit_missing_arg"
shift
traces="$traces '"`echo "$1" | sed "s/'/'\\\\\\\\''/g"`"'"
shift ;;
--initialization | -i )
opt_initialization="--initialization"
shift ;;
--output=* | -o?* )
opt_output="--output=$optarg"
shift ;;
--output | -o )
test $# = 1 && eval "$exit_missing_arg"
shift
opt_output="--output=$1"
shift ;;
--warnings=* | -W?* )
warnings=$warnings,$optarg
shift ;;
--warnings | -W )
test $# = 1 && eval "$exit_missing_arg"
shift
warnings=$warnings,$1
shift ;;
-- ) # Stop option processing
shift
opt_stop="--"
break ;;
- ) # Use stdin as input.
break ;;
-* )
exec >&2
echo "$me: invalid option $1"
echo "$help"
exit 1 ;;
* )
break ;;
esac
done
# Special handling for the options that can be called
# multiple times.
if [ "x$warnings" != "x" ] ; then
opt_warnings="--warnings=$warnings"
fi
if [ "x$traces" != "x" ] ; then
opt_traces="--trace=$traces"
fi
# Trap on 0 to stop playing with `rm'.
$debug ||
{
trap 'status=$?; rm -rf $tmp && exit $status' 0
trap '(exit 1); exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
: ${TMPDIR=/tmp}
{
tmp=`(umask 077 && mktemp -d -q "$TMPDIR/acXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
tmp=$TMPDIR/ac$$
(umask 077 && mkdir $tmp)
} ||
{
echo "$me: cannot create a temporary directory in $TMPDIR" >&2
(exit 1); exit 1;
}
# Find the input file.
case $# in
0)
case `ls configure.ac configure.in 2>/dev/null` in
*ac*in )
echo "$me: warning: both \`configure.ac' and \`configure.in' are present." >&2
echo "$me: warning: proceeding with \`configure.ac'." >&2
infile=configure.ac;;
*ac ) infile=configure.ac;;
*in ) infile=configure.in;;
* )
echo "$me: no input file" >&2
exit 1;;
esac
autosense_input=true ;;
1) infile=$1 ;;
*) exec >&2
echo "$me: invalid number of arguments."
echo "$help"
(exit 1); exit 1 ;;
esac
# We need an actual file.
if test z$infile = z-; then
infile=$tmp/stdin
cat >$infile
elif test ! -r "$infile"; then
echo "$me: $infile: No such file or directory" >&2
(exit 1); exit 1
fi
# Find the version
VER=`sed -n -e '/AC_PREREQ/s/[^(]*(\([[:digit:]\.]*\))/\1/p' < configure.in`
VER1=`echo $VER | awk -F. '{print $1 "." $2}'`
# Set the PATH appropriately
if [ "x${VER1}" == "x2.13" ] ; then
export PATH=${path_stable}/bin:${PATH}
export M4PATH=${path_stable}/share/autoconf
else
export PATH=${path_devel}/bin:${PATH}
export M4PATH=${path_devel}/share/autoconf
fi
# exec the "real" autoconf
if [ "z$infile" == "z$tmp/stdin" ] ; then
exec autoconf $opt_version $opt_help \
$opt_debug $opt_verbose $opt_localdir \
$opt_autoconfdir $opt_macrodir $opt_traces \
$opt_initialization $opt_output $opt_warnings \
$opt_stop - < $infile
elif [ "z$autosense_input" == "ztrue" ] ; then
rm -rf $tmp
exec autoconf $opt_version $opt_help \
$opt_debug $opt_verbose $opt_localdir \
$opt_autoconfdir $opt_macrodir $opt_traces \
$opt_initialization $opt_output $opt_warnings \
$opt_stop
else
rm -rf $tmp
exec autoconf $opt_version $opt_help \
$opt_debug $opt_verbose $opt_localdir \
$opt_autoconfdir $opt_macrodir $opt_traces \
$opt_initialization $opt_output $opt_warnings \
$opt_stop $infile
fi
--------------020006040207050901010405--
- Raw text -