Add a `--clean' option for autoconf, autoheader, autoreconf and autom4te.
[autoconf/tsuna.git] / bin / autoconf.as
blob49b2f74413b2531bb87ef09799487ca0c7e472ad
1 AS_INIT[]dnl -*- shell-script -*-
2 m4_divert_push([HEADER-COPYRIGHT])dnl
3 # @configure_input@
4 # autoconf -- create `configure' using m4 macros
6 # Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003,
7 # 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 m4_divert_pop([HEADER-COPYRIGHT])dnl back to BODY
24 usage=["\
25 Usage: $0 [OPTION] ... [TEMPLATE-FILE]
27 Generate a configuration script from a TEMPLATE-FILE if given, or
28 \`configure.ac' if present, or else \`configure.in'. Output is sent
29 to the standard output if TEMPLATE-FILE is given, else into
30 \`configure'.
32 Operation modes:
33 -h, --help print this help, then exit
34 -V, --version print version number, then exit
35 -v, --verbose verbosely report processing
36 --clean remove files installed by autoconf
37 -d, --debug don't remove temporary files
38 -f, --force consider all files obsolete
39 -o, --output=FILE save output in FILE (stdout is the default)
40 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax]
42 Warning categories include:
43 \`cross' cross compilation issues
44 \`obsolete' obsolete constructs
45 \`syntax' dubious syntactic constructs
46 \`all' all the warnings
47 \`no-CATEGORY' turn off the warnings on CATEGORY
48 \`none' turn off all the warnings
49 \`error' warnings are error
51 The environment variables \`M4' and \`WARNINGS' are honored.
53 Library directories:
54 -B, --prepend-include=DIR prepend directory DIR to search path
55 -I, --include=DIR append directory DIR to search path
57 Tracing:
58 -t, --trace=MACRO report the list of calls to MACRO
59 -i, --initialization also trace Autoconf's initialization process
61 In tracing mode, no configuration script is created.
63 Report bugs to <bug-autoconf@gnu.org>."]
65 version=["\
66 autoconf (@PACKAGE_NAME@) @VERSION@
67 Copyright (C) @RELEASE_YEAR@ Free Software Foundation, Inc.
68 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
69 This is free software: you are free to change and redistribute it.
70 There is NO WARRANTY, to the extent permitted by law.
72 Written by David J. MacKenzie and Akim Demaille."]
74 help="\
75 Try \`$as_me --help' for more information."
77 exit_missing_arg='
78 AS_ECHO(["$as_me: option \`$[1]'\'' requires an argument"]) >&2
79 AS_ECHO(["$help"]) >&2
80 exit 1
81 ' # restore font-lock: "
83 # Variables.
84 : ${AUTOM4TE='@bindir@/@autom4te-name@'}
85 autom4te_options=
86 outfile=
87 verbose=false
88 clean=false
90 # Parse command line.
91 while test $# -gt 0 ; do
92 option=[`expr "x$1" : 'x\(--[^=]*\)' \| \
93 "x$1" : 'x\(-.\)'`]
94 optarg=[`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
95 "x$1" : 'x-.\(.*\)'`]
96 case $1 in
97 --version | -V )
98 echo "$version" ; exit ;;
99 --help | -h )
100 AS_ECHO(["$usage"]); exit ;;
102 --verbose | -v )
103 verbose=:
104 autom4te_options="$autom4te_options $1"; shift ;;
106 --clean )
107 clean=:
108 autom4te_options="$autom4te_options $1"; shift ;;
110 # Arguments passed as is to autom4te.
111 --debug | -d | \
112 --force | -f | \
113 --include=* | -I?* | \
114 --prepend-include=* | -B?* | \
115 --warnings=* | -W?* )
116 autom4te_options="$autom4te_options '$1'"; shift ;;
118 # Options with separated arg passed as is to autom4te.
119 --include | -I | \
120 --prepend-include | -B | \
121 --warnings | -W )
122 test $# = 1 && eval "$exit_missing_arg"
123 autom4te_options="$autom4te_options $option '$2'"
124 shift; shift ;;
126 --trace=* | -t?* )
127 traces="$traces --trace='"`AS_ECHO(["$optarg"]) | sed "s/'/'\\\\\\\\''/g"`"'"
128 shift ;;
129 --trace | -t )
130 test $# = 1 && eval "$exit_missing_arg"
131 traces="$traces --trace='"`AS_ECHO(["$[2]"]) | sed "s/'/'\\\\\\\\''/g"`"'"
132 shift; shift ;;
133 --initialization | -i )
134 autom4te_options="$autom4te_options --melt"
135 shift;;
137 --output=* | -o?* )
138 outfile=$optarg
139 shift ;;
140 --output | -o )
141 test $# = 1 && eval "$exit_missing_arg"
142 outfile=$2
143 shift; shift ;;
145 -- ) # Stop option processing
146 shift; break ;;
147 - ) # Use stdin as input.
148 break ;;
149 -* )
150 exec >&2
151 AS_ECHO(["$as_me: invalid option $[1]"])
152 AS_ECHO(["$help"])
153 exit 1 ;;
155 break ;;
156 esac
157 done
159 # Find the input file.
160 case $# in
162 if test -f configure.ac; then
163 if test -f configure.in; then
164 AS_ECHO(["$as_me: warning: both \`configure.ac' and \`configure.in' are present."]) >&2
165 AS_ECHO(["$as_me: warning: proceeding with \`configure.ac'."]) >&2
167 infile=configure.ac
168 elif test -f configure.in; then
169 infile=configure.in
170 else
171 AS_ECHO(["$as_me: no input file"]) >&2
172 exit 1
174 test -z "$traces" && test -z "$outfile" && outfile=configure
175 if $clean && test x"$outfile" != x; then
176 rm -f "$outfile"
180 infile=$1 ;;
181 *) exec >&2
182 AS_ECHO(["$as_me: invalid number of arguments."])
183 AS_ECHO(["$help"])
184 (exit 1); exit 1 ;;
185 esac
187 # Unless specified, the output is stdout.
188 test -z "$outfile" && outfile=-
190 # Run autom4te with expansion.
191 eval set x $autom4te_options \
192 --language=autoconf --output=\$outfile "$traces" \$infile
193 shift
194 $verbose && AS_ECHO(["$as_me: running $AUTOM4TE $*"]) >&2
195 exec "$AUTOM4TE" "$@"