summaryrefslogtreecommitdiff
path: root/autoconf.in
blob: 0027f1fcd8e05379fbd0d7bbc0da1ab5e7349d7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#! @SHELL@
# -*- shell-script -*-
# autoconf -- create `configure' using m4 macros
# Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001
# Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

me=`echo "$0" | sed -e 's,.*[\\/],,'`

usage="\
Usage: $0 [OPTION] ... [TEMPLATE-FILE]

Generate a configuration script from a TEMPLATE-FILE if given, or
\`configure.ac' if present, or else \`configure.in'.  Output is sent
to the standard output if TEMPLATE-FILE is given, else into
\`configure'.

Operation modes:
  -h, --help               print this help, then exit
  -V, --version            print version number, then exit
  -v, --verbose            verbosely report processing
  -d, --debug              don't remove temporary files
  -o, --output=FILE        save output in FILE (stdout is the default)
  -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [syntax]

Warning categories include:
  \`cross'         cross compilation issues
  \`obsolete'      obsolete constructs
  \`syntax'        dubious syntactic constructs
  \`all'           all the warnings
  \`no-CATEGORY'   turn off the warnings on CATEGORY
  \`none'          turn off all the warnings
  \`error'         warnings are error

The environment variable \`WARNINGS' is honored.

Library directories:
  -A, --autoconf-dir=ACDIR  Autoconf's macro files location (rarely needed)
  -l, --localdir=DIR        location of the \`aclocal.m4' file

Tracing:
  -t, --trace=MACRO     report the list of calls to MACRO
  -i, --initialization  also trace Autoconf's initialization process

In tracing mode, no configuration script is created.

Report bugs to <bug-autoconf@gnu.org>."

version="\
autoconf (@PACKAGE_NAME@) @VERSION@
Written by David J. MacKenzie.

Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001
Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."

help="\
Try \`$me --help' for more information."

exit_missing_arg="\
echo \"$me: option \\\`\$1' requires an argument\" >&2
echo \"\$help\" >&2
exit 1"

# NLS nuisances.
if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi

# Variables.
: ${autoconf_dir=${AC_MACRODIR=@datadir@}}
debug=false
dir=`echo "$0" | sed -e 's,[^\\/]*$,,'`
# Trace Autoconf's initialization?
initialization=false
localdir=.
outfile=
# Exit status.
status=0
verbose=:

# Find GNU m4.
# Handle the case that m4 has moved since we were configured.
# It may have been found originally in a build directory.
: ${M4=@M4@}
case "$M4" in
  [\\/]* | ?:[\\/]*) test -f "$M4" || M4=m4 ;;
esac
# Some non-GNU m4's don't reject the --help option, so give them /dev/null.
case `$M4 --help </dev/null 2>&1` in
*reload-state*);;
*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;;
esac

# Set some high recursion limit as the default limit, 250, has already
# been hit with AC_OUTPUT.
case " $M4 " in
  *" --nesting-limit"* | *" -L"* )
  # Don't override the user's choice
  ;;
  *) M4="$M4 --nesting-limit=1024"
  ;;
esac


# We test "$dir/autom4te" in case we are in the build tree, in which case
# the names are not transformed yet.
for autom4te in "$AUTOM4TE" \
                "$dir/@autom4te-name@" \
                "$dir/autom4te" \
                "@bindir@/@autom4te-name@"; do
  test -f "$autom4te" && break
done


# Parse command line.
while test $# -gt 0 ; do
  optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
               "x$1" : 'x-.\(.*\)'`
  case $1 in
    --version | -V )
       echo "$version" ; exit 0 ;;
    --help | -h )
       echo "$usage"; exit 0 ;;

    --debug | -d )
       debug=:; shift ;;
    --verbose | -v )
       verbose=echo
       shift;;

    --localdir=* | -l?* )
       localdir=$optarg
       shift ;;
    --localdir | -l )
       test $# = 1 && eval "$exit_missing_arg"
       shift
       localdir=$1
       shift ;;

    --autoconf-dir=* | -A?* )
      autoconf_dir=$optarg
       shift ;;
    --autoconf-dir | -A )
       test $# = 1 && eval "$exit_missing_arg"
       shift
       autoconf_dir=$1
       shift ;;
    --macrodir=* | -m?* )
       echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
       autoconf_dir=$optarg
       shift ;;
    --macrodir | -m )
       echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
       test $# = 1 && eval "$exit_missing_arg"
       shift
       autoconf_dir=$1
       shift ;;

    --trace=* | -t?* )
       traces="$traces --trace='"`echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'"
       shift ;;
    --trace | -t )
       test $# = 1 && eval "$exit_missing_arg"
       shift
       traces="$traces --trace='"`echo "$1" | sed "s/'/'\\\\\\\\''/g"`"'"
       shift ;;
    --initialization | -i )
       initialization=:
       shift;;

    --output=* | -o?* )
       outfile=$optarg
       shift ;;
    --output | -o )
       test $# = 1 && eval "$exit_missing_arg"
       shift
       outfile=$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; break ;;
    - )	# Use stdin as input.
       break ;;
    -* )
       exec >&2
       echo "$me: invalid option $1"
       echo "$help"
       exit 1 ;;
    * )
       break ;;
  esac
done

# 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
    test -z "$traces" && test -z "$outfile" && outfile=configure;;
  1) # autom4te doesn't like `-'.
     test "x$1" != "x-" && infile=$1 ;;
  *) exec >&2
     echo "$me: invalid number of arguments."
     echo "$help"
     (exit 1); exit 1 ;;
esac

# Unless specified, the output is stdout.
test -z "$outfile" && outfile=-

# Running autom4te.
run_autom4te="$autom4te "\
`$verbose "--verbose "`\
`$debug && echo "--debug "`\
"--include $autoconf_dir --include $localdir "\
"--warning syntax,$warnings "\
"autoconf/autoconf.m4"`$initialization || echo f`" "\
`test -f "$autoconf_dir/acsite.m4" && echo "$autoconf_dir/acsite.m4"`" "\
`test -f "$localdir/aclocal.m4" && echo "$localdir/aclocal.m4"`

# Autom4te expansion.
eval set dummy "$traces"
shift
$verbose "$me: running $run_autom4te ""$@"" $infile --output $outfile" >&2
$run_autom4te "$@" $infile --output $outfile ||
  { (exit 1); exit 1; }

if test -z "$traces" && test "x$outfile" != x-; then
  chmod +x $outfile
fi

(exit $status); exit $status