source: trunk/essentials/sys-devel/autoconf-2.13/autoupdate.sh@ 3247

Last change on this file since 3247 was 3159, checked in by bird, 18 years ago

Applied OS/2 patches.

File size: 3.2 KB
Line 
1#! @SHELL@
2# autoupdate - modernize a configure.in
3# Copyright (C) 1994 Free Software Foundation, Inc.
4
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2, or (at your option)
8# any later version.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18# 02111-1307, USA.
19
20# If given no args, update `configure.in';
21# With one arg, write on the standard output from the given template file.
22#
23# Written by David MacKenzie <djm@gnu.ai.mit.edu>
24
25usage="\
26Usage: autoupdate [-h] [--help] [-m dir] [--macrodir=dir]
27 [--version] [template-file]"
28
29sedtmp=/tmp/acups.$$
30# For debugging.
31#sedtmp=/tmp/acups
32show_version=no
33if test -z "${AC_MACRODIR}"; then
34 if test -d "${UNIXROOT}@datadir@"; then
35 AC_MACRODIR=${UNIXROOT}@datadir@
36 else
37 AC_MACRODIR=@datadir@
38 fi
39fi
40
41while test $# -gt 0 ; do
42 case "${1}" in
43 -h | --help | --h* )
44 echo "${usage}" 1>&2; exit 0 ;;
45 --macrodir=* | --m*=* )
46 AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`"
47 shift ;;
48 -m | --macrodir | --m* )
49 shift
50 test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
51 AC_MACRODIR="${1}"
52 shift ;;
53 --version | --versio | --versi | --vers)
54 show_version=yes; shift ;;
55 -- ) # Stop option processing
56 shift; break ;;
57 - ) # Use stdin as input.
58 break ;;
59 -* )
60 echo "${usage}" 1>&2; exit 1 ;;
61 * )
62 break ;;
63 esac
64done
65
66if test $show_version = yes; then
67 version=`sed -n 's/define.AC_ACVERSION.[ ]*\([0-9.]*\).*/\1/p' \
68 $AC_MACRODIR/acgeneral.m4`
69 echo "Autoconf version $version"
70 exit 0
71fi
72
73: ${SIMPLE_BACKUP_SUFFIX='~'}
74
75tmpout=acupo.$$
76trap 'rm -f $sedtmp $tmpout; exit 1' 1 2 15
77case $# in
78 0) infile=configure.in; out="> $tmpout"
79 # Make sure $infile can be read, and $tmpout has the same permissions.
80 cp $infile $tmpout || exit
81
82 # Make sure $infile can be written.
83 if test ! -w $infile; then
84 rm -f $tmpout
85 echo "$0: $infile: cannot write" >&2
86 exit 1
87 fi
88 ;;
89 1) infile="$1"; out= ;;
90 *) echo "$usage" >&2; exit 1 ;;
91esac
92
93# Turn the m4 macro file into a sed script.
94# For each old macro name, make one substitution command to replace it
95# at the end of a line, and one when followed by ( or whitespace.
96# That is easier than splitting the macros up into those that take
97# arguments and those that don't.
98sed -n -e '
99/^AC_DEFUN(/ {
100 s//s%/
101 s/, *\[indir(\[/$%/
102 s/\].*/%/
103 p
104 s/\$//
105 s/%/^/
106 s/%/\\([( ]\\)^/
107 s/%/\\1^/
108 s/\^/%/g
109 p
110}' ${AC_MACRODIR}/acoldnames.m4 > $sedtmp
111eval sed -f $sedtmp $infile $out
112
113case $# in
114 0) mv configure.in configure.in${SIMPLE_BACKUP_SUFFIX} &&
115 mv $tmpout configure.in ;;
116esac
117
118rm -f $sedtmp $tmpout
119exit 0
Note: See TracBrowser for help on using the repository browser.