OpenBSD -> Open@acronym{BSD}
[autoconf/tsuna.git] / bin / autoconf.as
blobc967c26c66895295fc3f837c026b9c43819fffda
1 AS_INIT[]dnl -*- shell-script -*-
2 # autoconf -- create `configure' using m4 macros
4 # Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003,
5 # 2004, 2005, 2006 Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 # 02110-1301, USA.
22 usage=["\
23 Usage: $0 [OPTION] ... [TEMPLATE-FILE]
25 Generate a configuration script from a TEMPLATE-FILE if given, or
26 \`configure.ac' if present, or else \`configure.in'. Output is sent
27 to the standard output if TEMPLATE-FILE is given, else into
28 \`configure'.
30 Operation modes:
31 -h, --help print this help, then exit
32 -V, --version print version number, then exit
33 -v, --verbose verbosely report processing
34 -d, --debug don't remove temporary files
35 -f, --force consider all files obsolete
36 -o, --output=FILE save output in FILE (stdout is the default)
37 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax]
39 Warning categories include:
40 \`cross' cross compilation issues
41 \`obsolete' obsolete constructs
42 \`syntax' dubious syntactic constructs
43 \`all' all the warnings
44 \`no-CATEGORY' turn off the warnings on CATEGORY
45 \`none' turn off all the warnings
46 \`error' warnings are error
48 The environment variables \`M4' and \`WARNINGS' are honored.
50 Library directories:
51 -B, --prepend-include=DIR prepend directory DIR to search path
52 -I, --include=DIR append directory DIR to search path
54 Tracing:
55 -t, --trace=MACRO report the list of calls to MACRO
56 -i, --initialization also trace Autoconf's initialization process
58 In tracing mode, no configuration script is created.
60 Report bugs to <bug-autoconf@gnu.org>."]
62 version=["\
63 autoconf (@PACKAGE_NAME@) @VERSION@
64 Written by David J. MacKenzie and Akim Demaille.
66 Copyright (C) 2006 Free Software Foundation, Inc.
67 This is free software; see the source for copying conditions. There is NO
68 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."]
70 help="\
71 Try \`$as_me --help' for more information."
73 exit_missing_arg="\
74 echo \"$as_me: option \\\`\$1' requires an argument\" >&2
75 echo \"\$help\" >&2
76 exit 1"
78 # Variables.
79 : ${AUTOM4TE='@bindir@/@autom4te-name@'}
80 autom4te_options=
81 outfile=
82 verbose=:
84 # Parse command line.
85 while test $# -gt 0 ; do
86 option=[`expr "x$1" : 'x\(--[^=]*\)' \| \
87 "x$1" : 'x\(-.\)'`]
88 optarg=[`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
89 "x$1" : 'x-.\(.*\)'`]
90 case $1 in
91 --version | -V )
92 echo "$version" ; exit ;;
93 --help | -h )
94 echo "$usage"; exit ;;
96 --verbose | -v )
97 verbose=echo
98 autom4te_options="$autom4te_options $1"; shift ;;
100 # Arguments passed as is to autom4te.
101 --debug | -d | \
102 --force | -f | \
103 --include=* | -I?* | \
104 --prepend-include=* | -B?* | \
105 --warnings=* | -W?* )
106 autom4te_options="$autom4te_options '$1'"; shift ;;
108 # Options with separated arg passed as is to autom4te.
109 --include | -I | \
110 --prepend-include | -B | \
111 --warnings | -W )
112 test $# = 1 && eval "$exit_missing_arg"
113 autom4te_options="$autom4te_options $option '$2'"
114 shift; shift ;;
116 --trace=* | -t?* )
117 traces="$traces --trace='"`echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'"
118 shift ;;
119 --trace | -t )
120 test $# = 1 && eval "$exit_missing_arg"
121 traces="$traces --trace='"`echo "$2" | sed "s/'/'\\\\\\\\''/g"`"'"
122 shift; shift ;;
123 --initialization | -i )
124 autom4te_options="$autom4te_options --melt"
125 shift;;
127 --output=* | -o?* )
128 outfile=$optarg
129 shift ;;
130 --output | -o )
131 test $# = 1 && eval "$exit_missing_arg"
132 outfile=$2
133 shift; shift ;;
135 -- ) # Stop option processing
136 shift; break ;;
137 - ) # Use stdin as input.
138 break ;;
139 -* )
140 exec >&2
141 echo "$as_me: invalid option $1"
142 echo "$help"
143 exit 1 ;;
145 break ;;
146 esac
147 done
149 # Find the input file.
150 case $# in
152 if test -f configure.ac; then
153 if test -f configure.in; then
154 echo "$as_me: warning: both \`configure.ac' and \`configure.in' are present." >&2
155 echo "$as_me: warning: proceeding with \`configure.ac'." >&2
157 infile=configure.ac
158 elif test -f configure.in; then
159 infile=configure.in
160 else
161 echo "$as_me: no input file" >&2
162 exit 1
164 test -z "$traces" && test -z "$outfile" && outfile=configure;;
165 1) # autom4te doesn't like `-'.
166 test "x$1" != "x-" && infile=$1 ;;
167 *) exec >&2
168 echo "$as_me: invalid number of arguments."
169 echo "$help"
170 (exit 1); exit 1 ;;
171 esac
173 # Unless specified, the output is stdout.
174 test -z "$outfile" && outfile=-
176 # Run autom4te with expansion.
177 eval set x $autom4te_options \
178 --language=autoconf --output=\$outfile "$traces" \$infile
179 shift
180 $verbose "$as_me: running $*" >&2
181 exec "$AUTOM4TE" "$@"