* NEWS: Reword notice for AC_TRY_COMMAND, AC_TRY_EVAL,
[autoconf.git] / lib / autoconf / status.m4
blob13ea507dbc851e13fb76ccc8c62be7437de9a226
1 # This file is part of Autoconf.                       -*- Autoconf -*-
2 # Parameterizing and creating config.status.
3 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
4 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301, USA.
21 # As a special exception, the Free Software Foundation gives unlimited
22 # permission to copy, distribute and modify the configure scripts that
23 # are the output of Autoconf.  You need not follow the terms of the GNU
24 # General Public License when using or distributing such scripts, even
25 # though portions of the text of Autoconf appear in them.  The GNU
26 # General Public License (GPL) does govern all other use of the material
27 # that constitutes the Autoconf program.
29 # Certain portions of the Autoconf source text are designed to be copied
30 # (in certain cases, depending on the input) into the output of
31 # Autoconf.  We call these the "data" portions.  The rest of the Autoconf
32 # source text consists of comments plus executable code that decides which
33 # of the data portions to output in any given case.  We call these
34 # comments and executable code the "non-data" portions.  Autoconf never
35 # copies any of the non-data portions into its output.
37 # This special exception to the GPL applies to versions of Autoconf
38 # released by the Free Software Foundation.  When you make and
39 # distribute a modified version of Autoconf, you may extend this special
40 # exception to the GPL to apply to your modified version as well, *unless*
41 # your modified version has the potential to copy into its output some
42 # of the text that was the non-data portion of the version that you started
43 # with.  (In other words, unless your change moves or copies text from
44 # the non-data portions to the data portions.)  If your modification has
45 # such potential, you must delete any notice of this special exception
46 # to the GPL from your modified version.
48 # Written by David MacKenzie, with help from
49 # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
50 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
53 # This file handles about all the preparation aspects for
54 # `config.status': registering the configuration files, the headers,
55 # the links, and the commands `config.status' will run.  There is a
56 # little mixture though of things actually handled by `configure',
57 # such as running the `configure' in the sub directories.  Minor
58 # detail.
60 # There are two kinds of commands:
62 # COMMANDS:
64 #   They are output into `config.status' via a quoted here doc.  These
65 #   commands are always associated to a tag which the user can use to
66 #   tell `config.status' what are the commands she wants to run.
68 # INIT-CMDS:
70 #   They are output via an *unquoted* here-doc.  As a consequence $var
71 #   will be output as the value of VAR.  This is typically used by
72 #   `configure' to give `config.status' some variables it needs to run
73 #   the COMMANDS.  At the difference of COMMANDS, the INIT-CMDS are
74 #   always run.
77 # Honorable members of this family are AC_CONFIG_FILES,
78 # AC_CONFIG_HEADERS, AC_CONFIG_LINKS and AC_CONFIG_COMMANDS.  Bad boys
79 # are AC_LINK_FILES, AC_OUTPUT_COMMANDS and AC_OUTPUT when used with
80 # arguments.  False members are AC_CONFIG_SRCDIR, AC_CONFIG_SUBDIRS
81 # and AC_CONFIG_AUX_DIR.  Cousins are AC_CONFIG_COMMANDS_PRE and
82 # AC_CONFIG_COMMANDS_POST.
85 ## ------------------ ##
86 ## Auxiliary macros.  ##
87 ## ------------------ ##
89 # _AC_SRCDIRS(BUILD-DIR-NAME)
90 # ---------------------------
91 # Inputs:
92 #   - BUILD-DIR-NAME is `top-build -> build' and `top-src -> src'
93 #   - `$srcdir' is `top-build -> top-src'
95 # Outputs:
96 # - `ac_builddir' is `.', for symmetry only.
97 # - `ac_top_builddir_sub' is `build -> top_build'.
98 #      This is used for @top_builddir@.
99 # - `ac_top_build_prefix' is `build -> top_build'.
100 #      If not empty, has a trailing slash.
101 # - `ac_srcdir' is `build -> src'.
102 # - `ac_top_srcdir' is `build -> top-src'.
103 # and `ac_abs_builddir' etc., the absolute directory names.
104 m4_define([_AC_SRCDIRS],
105 [ac_builddir=.
107 case $1 in
108 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
110   ac_dir_suffix=/`echo $1 | sed 's,^\.[[\\/]],,'`
111   # A ".." for each directory in $ac_dir_suffix.
112   ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[[^\\/]]*,/..,g;s,/,,'`
113   case $ac_top_builddir_sub in
114   "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
115   *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
116   esac ;;
117 esac
118 ac_abs_top_builddir=$ac_pwd
119 ac_abs_builddir=$ac_pwd$ac_dir_suffix
120 # for backward compatibility:
121 ac_top_builddir=$ac_top_build_prefix
123 case $srcdir in
124   .)  # We are building in place.
125     ac_srcdir=.
126     ac_top_srcdir=$ac_top_builddir_sub
127     ac_abs_top_srcdir=$ac_pwd ;;
128   [[\\/]]* | ?:[[\\/]]* )  # Absolute name.
129     ac_srcdir=$srcdir$ac_dir_suffix;
130     ac_top_srcdir=$srcdir
131     ac_abs_top_srcdir=$srcdir ;;
132   *) # Relative name.
133     ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
134     ac_top_srcdir=$ac_top_build_prefix$srcdir
135     ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
136 esac
137 ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
138 ])# _AC_SRCDIRS
142 ## ---------------------- ##
143 ## Registering the tags.  ##
144 ## ---------------------- ##
147 # _AC_CONFIG_COMMANDS_INIT([INIT-COMMANDS])
148 # -----------------------------------------
150 # Register INIT-COMMANDS as command pasted *unquoted* in
151 # `config.status'.  This is typically used to pass variables from
152 # `configure' to `config.status'.  Note that $[1] is not over quoted as
153 # was the case in AC_OUTPUT_COMMANDS.
154 m4_define([_AC_CONFIG_COMMANDS_INIT],
155 [m4_ifval([$1],
156           [m4_append([_AC_OUTPUT_COMMANDS_INIT],
157                      [$1
158 ])])])
161 # AC_FILE_DEPENDENCY_TRACE(DEST, SOURCE1, [SOURCE2...])
162 # -----------------------------------------------------
163 # This macro does nothing, it's a hook to be read with `autoconf --trace'.
165 # It announces DEST depends upon the SOURCE1 etc.
166 m4_define([AC_FILE_DEPENDENCY_TRACE], [])
169 # _AC_FILE_DEPENDENCY_TRACE_COLON(DEST:SOURCE1[:SOURCE2...])
170 # ----------------------------------------------------------
171 # Declare that DEST depends upon SOURCE1 etc.
173 m4_define([_AC_FILE_DEPENDENCY_TRACE_COLON],
174 [AC_FILE_DEPENDENCY_TRACE(m4_bpatsubst([$1], [:], [,]))dnl
178 # _AC_CONFIG_DEPENDENCY(MODE, DEST[:SOURCE1...])
179 # ---------------------------------------------
180 # MODE is `FILES', `HEADERS', or `LINKS'.
182 # Be sure that a missing dependency is expressed as a dependency upon
183 # `DEST.in' (except with config links).
185 m4_define([_AC_CONFIG_DEPENDENCY],
186 [_AC_FILE_DEPENDENCY_TRACE_COLON([$2]_AC_CONFIG_DEPENDENCY_DEFAULT($@))dnl
190 # _AC_CONFIG_DEPENDENCY_DEFAULT(MODE, DEST[:SOURCE1...])
191 # ------------------------------------------------------
192 # Expand to `:DEST.in' if appropriate, or to empty string otherwise.
194 # More detailed edscription:
195 # If the tag contains `:', expand to nothing.
196 # Otherwise, for a config file or header, add `:DEST.in'.
197 # For config link, DEST.in is not appropriate:
198 #  - if the tag is literal, complain.
199 #  - otherwise, just expand to nothing and proceed with fingers crossed.
200 #    (We get to this case from the obsolete AC_LINK_FILES, for example.)
202 m4_define([_AC_CONFIG_DEPENDENCY_DEFAULT],
203 [m4_bmatch([$2], [:], [],
204            [m4_if([$1], [LINKS],
205                   [AS_LITERAL_IF([$2], [AC_FATAL([Invalid AC_CONFIG_LINKS tag: `$2'])])],
206                   [:$2.in])])dnl
210 # _AC_CONFIG_UNIQUE(MODE, DEST)
211 # -----------------------------
212 # MODE is `FILES', `HEADERS', `LINKS', `COMMANDS', or `SUBDIRS'.
214 # Verify that there is no double definition of an output file.
216 m4_define([_AC_CONFIG_UNIQUE],
217 [m4_ifdef([_AC_SEEN_TAG($2)],
218    [AC_FATAL([`$2' is already registered with AC_CONFIG_]m4_defn([_AC_SEEN_TAG($2)]).)],
219    [m4_define([_AC_SEEN_TAG($2)], [$1])])dnl
223 # _AC_CONFIG_FOOS(MODE, TAGS..., [COMMANDS], [INIT-CMDS])
224 # -------------------------------------------------------
225 # MODE is `FILES', `HEADERS', `LINKS', or `COMMANDS'.
227 # Associate the COMMANDS to each TAG, i.e., when config.status creates TAG,
228 # run COMMANDS afterwards.  (This is done in _AC_CONFIG_REGISTER_DEST.)
230 # For COMMANDS, do not m4_normalize TAGS before adding it to ac_config_commands.
231 # This historical difference allows macro calls in TAGS.
233 m4_define([_AC_CONFIG_FOOS],
234 [m4_foreach_w([AC_File], [$2],
235               [_AC_CONFIG_REGISTER([$1], m4_defn([AC_File]), [$3])])dnl
236 m4_define([_AC_SEEN_CONFIG(ANY)])dnl
237 m4_define([_AC_SEEN_CONFIG($1)])dnl
238 _AC_CONFIG_COMMANDS_INIT([$4])dnl
239 ac_config_[]m4_tolower([$1])="$ac_config_[]m4_tolower([$1]) dnl
240 m4_if([$1], [COMMANDS], [$2], [m4_normalize([$2])])"
244 # _AC_CONFIG_REGISTER(MODE, TAG, [COMMANDS])
245 # ------------------------------------------
246 # MODE is `FILES', `HEADERS', `LINKS', or `COMMANDS'.
248 m4_define([_AC_CONFIG_REGISTER],
249 [m4_if([$1], [COMMANDS],
250        [],
251        [_AC_CONFIG_DEPENDENCY([$1], [$2])])dnl
252 _AC_CONFIG_REGISTER_DEST([$1], [$2], m4_bpatsubst([[$2]], [:.*\(.\)$], [\1]), [$3])dnl
256 # _AC_CONFIG_REGISTER_DEST(MODE, TAG, DEST, [COMMANDS])
257 # -----------------------------------------------------
258 # MODE is `FILES', `HEADERS', `LINKS', or `COMMANDS'.
259 # TAG is in the form DEST[:SOURCE...].
260 # Thus parameter $3 is the first part of $2.
262 # With CONFIG_LINKS, reject DEST=., because it is makes it hard for ./config.status
263 # to guess the links to establish (`./config.status .').
265 # Save the name of the first config header to AH_HEADER.
267 m4_define([_AC_CONFIG_REGISTER_DEST],
268 [_AC_CONFIG_UNIQUE([$1], [$3])dnl
269 m4_if([$1 $3], [LINKS .],
270       [AC_FATAL([invalid destination of a config link: `.'])])dnl
271 m4_if([$1], [HEADERS],
272       [m4_define_default([AH_HEADER], [$3])])dnl
274 dnl Recognize TAG as an argument to config.status:
276 m4_append([_AC_LIST_TAGS],
277 [    "$3") CONFIG_$1="$CONFIG_$1 $2" ;;
278 ])dnl
280 dnl Register the associated commands, if any:
282 m4_ifval([$4],
283 [m4_append([_AC_LIST_TAG_COMMANDS],
284 [    "$3":]m4_bpatsubst([$1], [^\(.\).*$], [\1])[) $4 ;;
285 ])])dnl
286 ])# _AC_CONFIG_REGISTER_DEST
291 ## --------------------- ##
292 ## Configuration files.  ##
293 ## --------------------- ##
296 # AC_CONFIG_FILES(FILE..., [COMMANDS], [INIT-CMDS])
297 # -------------------------------------------------
298 # Specify output files, i.e., files that are configured with AC_SUBST.
300 AC_DEFUN([AC_CONFIG_FILES], [_AC_CONFIG_FOOS([FILES], $@)])
303 # _AC_SED_CMD_LIMIT
304 # -----------------
305 # Evaluate to an m4 number equal to the maximum number of commands to put
306 # in any single sed program, not counting ":" commands.
308 # Some seds have small command number limits, like on Digital OSF/1 and HP-UX.
309 m4_define([_AC_SED_CMD_LIMIT],
310 dnl One cannot portably go further than 99 commands because of HP-UX.
311 [99])
314 # _AC_OUTPUT_FILES_PREPARE
315 # ------------------------
316 # Create the sed scripts needed for CONFIG_FILES.
317 # Support multiline substitutions and make sure that the substitutions are
318 # not evaluated recursively.
319 # The intention is to have readable config.status and configure, even
320 # though this m4 code might be scaring.
322 # This code was written by Dan Manthey.
324 # This macro is expanded inside a here document.  If the here document is
325 # closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF".
327 m4_define([_AC_OUTPUT_FILES_PREPARE],
329 # Set up the sed scripts for CONFIG_FILES section.
331 dnl ... and define _AC_SED_CMDS, the pipeline which executes them.
332 m4_define([_AC_SED_CMDS], [])dnl
334 # No need to generate the scripts if there are no CONFIG_FILES.
335 # This happens for instance when ./config.status config.h
336 if test -n "$CONFIG_FILES"; then
338 _ACEOF
340 m4_pushdef([_AC_SED_FRAG_NUM], 0)dnl Fragment number.
341 m4_pushdef([_AC_SED_CMD_NUM], 2)dnl Num of commands in current frag so far.
342 m4_pushdef([_AC_SED_DELIM_NUM], 0)dnl Expected number of delimiters in file.
343 m4_pushdef([_AC_SED_FRAG], [])dnl The constant part of the current fragment.
345 m4_ifdef([_AC_SUBST_FILES],
346 [# Create sed commands to just substitute file output variables.
348 m4_foreach_w([_AC_Var], m4_defn([_AC_SUBST_FILES]),
349 [dnl End fragments at beginning of loop so that last fragment is not ended.
350 m4_if(m4_eval(_AC_SED_CMD_NUM + 3 > _AC_SED_CMD_LIMIT), 1,
351 [dnl Fragment is full and not the last one, so no need for the final un-escape.
352 dnl Increment fragment number.
353 m4_define([_AC_SED_FRAG_NUM], m4_incr(_AC_SED_FRAG_NUM))dnl
354 dnl Record that this fragment will need to be used.
355 m4_define([_AC_SED_CMDS],
356   m4_defn([_AC_SED_CMDS])[| sed -f "$tmp/subs-]_AC_SED_FRAG_NUM[.sed" ])dnl
357 [cat >>$CONFIG_STATUS <<_ACEOF
358 cat >"\$tmp/subs-]_AC_SED_FRAG_NUM[.sed" <<\CEOF
359 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
360 ]m4_defn([_AC_SED_FRAG])dnl
361 [CEOF
363 _ACEOF
364 ]m4_define([_AC_SED_CMD_NUM], 2)m4_define([_AC_SED_FRAG])dnl
365 ])dnl Last fragment ended.
366 m4_define([_AC_SED_CMD_NUM], m4_eval(_AC_SED_CMD_NUM + 3))dnl
367 m4_define([_AC_SED_FRAG],
368 m4_defn([_AC_SED_FRAG])dnl
369 [/^[     ]*@]_AC_Var[@[  ]*$/{
370 r $]_AC_Var[
373 ])dnl
374 ])dnl
375 # Remaining file output variables are in a fragment that also has non-file
376 # output varibles.
380 m4_define([_AC_SED_FRAG], [
381 ]m4_defn([_AC_SED_FRAG]))dnl
382 m4_foreach_w([_AC_Var],
383 m4_ifdef([_AC_SUBST_VARS], [m4_defn([_AC_SUBST_VARS]) ])[@END@],
384 [m4_if(_AC_SED_DELIM_NUM, 0,
385 [m4_if(_AC_Var, [@END@],
386 [dnl The whole of the last fragment would be the final deletion of `|#_!!_#|'.
387 m4_define([_AC_SED_CMDS], m4_defn([_AC_SED_CMDS])[| sed 's/|#_!!_#|//g' ])],
389 ac_delim='%!_!# '
390 for ac_last_try in false false false false false :; do
391   cat >conf$$subs.sed <<_ACEOF
392 ])])dnl
393 m4_if(_AC_Var, [@END@],
394       [m4_if(m4_eval(_AC_SED_CMD_NUM + 2 <= _AC_SED_CMD_LIMIT), 1,
395              [m4_define([_AC_SED_FRAG], [ end]m4_defn([_AC_SED_FRAG]))])],
396 [m4_define([_AC_SED_CMD_NUM], m4_incr(_AC_SED_CMD_NUM))dnl
397 m4_define([_AC_SED_DELIM_NUM], m4_incr(_AC_SED_DELIM_NUM))dnl
398 _AC_Var!$_AC_Var$ac_delim
399 ])dnl
400 m4_if(_AC_SED_CMD_LIMIT,
401       m4_if(_AC_Var, [@END@], m4_if(_AC_SED_CMD_NUM, 2, 2, _AC_SED_CMD_LIMIT), _AC_SED_CMD_NUM),
402 [_ACEOF
404   if test `grep -c "$ac_delim\$" conf$$subs.sed` = _AC_SED_DELIM_NUM; then
405     break
406   elif $ac_last_try; then
407     AC_MSG_ERROR([could not make $CONFIG_STATUS])
408   else
409     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
410   fi
411 done
413 ac_eof=
414 if grep '^CEOF$' conf$$subs.sed >/dev/null; then
415   ac_eof=`sed -n '/^CEOF[[0-9]]*$/s/CEOF//p' conf$$subs.sed | sort -nru | sed 1q`
416   ac_eof=`expr 0$ac_eof + 1`
419 dnl Increment fragment number.
420 m4_define([_AC_SED_FRAG_NUM], m4_incr(_AC_SED_FRAG_NUM))dnl
421 dnl Record that this fragment will need to be used.
422 m4_define([_AC_SED_CMDS],
423 m4_defn([_AC_SED_CMDS])[| sed -f "$tmp/subs-]_AC_SED_FRAG_NUM[.sed" ])dnl
424 [cat >>$CONFIG_STATUS <<_ACEOF
425 cat >"\$tmp/subs-]_AC_SED_FRAG_NUM[.sed" <<\CEOF$ac_eof
426 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b]m4_defn([_AC_SED_FRAG])dnl
427 [_ACEOF
428 sed '
429 s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
430 s/^/s,@/; s/!/@,|#_!!_#|/
432 t n
433 s/'"$ac_delim"'$/,g/; t
434 s/$/\\/; p
435 N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
436 ' >>$CONFIG_STATUS <conf$$subs.sed
437 rm -f conf$$subs.sed
438 cat >>$CONFIG_STATUS <<_ACEOF
439 ]m4_if(_AC_Var, [@END@],
440 [m4_if(m4_eval(_AC_SED_CMD_NUM + 2 > _AC_SED_CMD_LIMIT), 1,
441 [m4_define([_AC_SED_CMDS], m4_defn([_AC_SED_CMDS])[| sed 's/|#_!!_#|//g' ])],
442 [[:end
443 s/|#_!!_#|//g
444 ]])])dnl
445 CEOF$ac_eof
446 _ACEOF
447 m4_define([_AC_SED_FRAG], [
448 ])m4_define([_AC_SED_DELIM_NUM], 0)m4_define([_AC_SED_CMD_NUM], 2)dnl
450 ])])dnl
452 m4_popdef([_AC_SED_FRAG_NUM])dnl
453 m4_popdef([_AC_SED_CMD_NUM])dnl
454 m4_popdef([_AC_SED_DELIM_NUM])dnl
455 m4_popdef([_AC_SED_FRAG])dnl
457 # VPATH may cause trouble with some makes, so we remove $(srcdir),
458 # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
459 # trailing colons and then remove the whole line if VPATH becomes empty
460 # (actually we leave an empty line to preserve line numbers).
461 if test "x$srcdir" = x.; then
462   ac_vpsub=['/^[         ]*VPATH[        ]*=/{
463 s/:*\$(srcdir):*/:/
464 s/:*\${srcdir}:*/:/
465 s/:*@srcdir@:*/:/
466 s/^\([^=]*=[     ]*\):*/\1/
467 s/:*$//
468 s/^[^=]*=[       ]*$//
472 cat >>$CONFIG_STATUS <<\_ACEOF
473 fi # test -n "$CONFIG_FILES"
475 ])# _AC_OUTPUT_FILES_PREPARE
478 # _AC_OUTPUT_FILE
479 # ---------------
480 # Do the variable substitutions to create the Makefiles or whatever.
482 # This macro is expanded inside a here document.  If the here document is
483 # closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF".
485 m4_define([_AC_OUTPUT_FILE],
487   #
488   # CONFIG_FILE
489   #
491 AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
492 [  case $INSTALL in
493   [[\\/$]]* | ?:[[\\/]]* ) ac_INSTALL=$INSTALL ;;
494   *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
495   esac
496 ])dnl
497 AC_PROVIDE_IFELSE([AC_PROG_MKDIR_P],
498 [  ac_MKDIR_P=$MKDIR_P
499   case $MKDIR_P in
500   [[\\/$]]* | ?:[[\\/]]* ) ;;
501   */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
502   esac
503 ])dnl
504 _ACEOF
506 cat >>$CONFIG_STATUS <<\_ACEOF
507 # If the template does not know about datarootdir, expand it.
508 # FIXME: This hack should be removed a few years after 2.60.
509 ac_datarootdir_hack=
510 m4_define([_AC_datarootdir_vars],
511           [datadir, docdir, infodir, localedir, mandir])
512 case `sed -n '/datarootdir/ {
513   p
514   q
516 m4_foreach([_AC_Var], m4_defn([_AC_datarootdir_vars]),
517            [/@_AC_Var@/p
518 ])' $ac_file_inputs` in
519 *datarootdir*) ;;
520 *@[]m4_join([@*|*@], _AC_datarootdir_vars)@*)
521   AC_MSG_WARN([$ac_file_inputs seems to ignore the --datarootdir setting])
522 _ACEOF
523 cat >>$CONFIG_STATUS <<_ACEOF
524   ac_datarootdir_hack='
525   m4_foreach([_AC_Var], m4_defn([_AC_datarootdir_vars]),
526                [s&@_AC_Var@&$_AC_Var&g
527   ])dnl
528   s&\\\${datarootdir}&$datarootdir&g' ;;
529 esac
530 _ACEOF
532 # Neutralize VPATH when `$srcdir' = `.'.
533 # Shell code in configure.ac might set extrasub.
534 # FIXME: do we really want to maintain this feature?
535 cat >>$CONFIG_STATUS <<_ACEOF
536   sed "$ac_vpsub
537 $extrasub
538 _ACEOF
539 cat >>$CONFIG_STATUS <<\_ACEOF
541 [/@[a-zA-Z_][a-zA-Z_0-9]*@/!b]
542 dnl configure_input is a somewhat special, so we don't call AC_SUBST_TRACE.
543 s&@configure_input@&$configure_input&;t t
544 dnl During the transition period, this is a special case:
545 s&@top_builddir@&$ac_top_builddir_sub&;t t[]AC_SUBST_TRACE([top_builddir])
546 m4_foreach([_AC_Var], [srcdir, abs_srcdir, top_srcdir, abs_top_srcdir,
547                         builddir, abs_builddir,
548                         abs_top_builddir]AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [[, INSTALL]])AC_PROVIDE_IFELSE([AC_PROG_MKDIR_P], [[, MKDIR_P]]),
549            [s&@_AC_Var@&$ac_[]_AC_Var&;t t[]AC_SUBST_TRACE(_AC_Var)
550 ])dnl
551 $ac_datarootdir_hack
552 " $ac_file_inputs m4_defn([_AC_SED_CMDS])>$tmp/out
554   rm -f "$tmp/stdin"
555   case $ac_file in
556   -) cat "$tmp/out"; rm -f "$tmp/out";;
557   *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
558   esac
559 dnl This would break Makefile dependencies:
560 dnl  if diff $ac_file "$tmp/out" >/dev/null 2>&1; then
561 dnl    echo "$ac_file is unchanged"
562 dnl  else
563 dnl     rm -f $ac_file; mv "$tmp/out" $ac_file
564 dnl  fi
565 ])# _AC_OUTPUT_FILE
570 ## ----------------------- ##
571 ## Configuration headers.  ##
572 ## ----------------------- ##
575 # AC_CONFIG_HEADERS(HEADERS..., [COMMANDS], [INIT-CMDS])
576 # ------------------------------------------------------
577 # Specify that the HEADERS are to be created by instantiation of the
578 # AC_DEFINEs.
580 AC_DEFUN([AC_CONFIG_HEADERS], [_AC_CONFIG_FOOS([HEADERS], $@)])
583 # AC_CONFIG_HEADER(HEADER-TO-CREATE ...)
584 # --------------------------------------
585 # FIXME: Make it obsolete?
586 AC_DEFUN([AC_CONFIG_HEADER],
587 [AC_CONFIG_HEADERS([$1])])
590 # _AC_OUTPUT_HEADER
591 # -----------------
593 # Output the code which instantiates the `config.h' files from their
594 # `config.h.in'.
596 # This macro is expanded inside a here document.  If the here document is
597 # closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF".
599 m4_define([_AC_OUTPUT_HEADER],
601   #
602   # CONFIG_HEADER
603   #
604 _ACEOF
606 # Transform confdefs.h into a sed script `conftest.defines', that
607 # substitutes the proper values into config.h.in to produce config.h.
608 rm -f conftest.defines conftest.tail
609 # First, append a space to every undef/define line, to ease matching.
610 echo 's/$/ /' >conftest.defines
611 # Then, protect against being on the right side of a sed subst, or in
612 # an unquoted here document, in config.status.  If some macros were
613 # called several times there might be several #defines for the same
614 # symbol, which is useless.  But do not sort them, since the last
615 # AC_DEFINE must be honored.
617 dnl Quote, for `[ ]' and `define'.
618 [ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
619 # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
620 # NAME is the cpp macro being defined, VALUE is the value it is being given.
621 # PARAMS is the parameter list in the macro definition--in most cases, it's
622 # just an empty string.
623 ac_dA='s,^\\([   #]*\\)[^        ]*\\([  ]*'
624 ac_dB='\\)[      (].*,\\1define\\2'
625 ac_dC=' '
626 ac_dD=' ,']
627 dnl ac_dD used to contain `;t' at the end, but that was both slow and incorrect.
628 dnl 1) Since the script must be broken into chunks containing 100 commands,
629 dnl the extra command meant extra calls to sed.
630 dnl 2) The code was incorrect: in the unusual case where a symbol has multiple
631 dnl different AC_DEFINEs, the last one should be honored.
633 dnl ac_dB works because every line has a space appended.  ac_dD reinserts
634 dnl the space, because some symbol may have been AC_DEFINEd several times.
636 dnl The first use of ac_dA has a space prepended, so that the second
637 dnl use does not match the initial 's' of $ac_dA.
639 uniq confdefs.h |
640   sed -n '
641         t rset
642         :rset
643         s/^[     ]*#[    ]*define[       ][      ]*//
644         t ok
645         d
646         :ok
647         s/[\\&,]/\\&/g
648         s/^\('"$ac_word_re"'\)\(([^()]*)\)[      ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
649         s/^\('"$ac_word_re"'\)[  ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
650   ' >>conftest.defines
652 # Remove the space that was appended to ease matching.
653 # Then replace #undef with comments.  This is necessary, for
654 # example, in the case of _POSIX_SOURCE, which is predefined and required
655 # on some systems where configure will not decide to define it.
656 # (The regexp can be short, since the line contains either #define or #undef.)
657 echo 's/ $//
658 [s,^[    #]*u.*,/* & */,]' >>conftest.defines
660 # Break up conftest.defines:
661 dnl If we cared only about not exceeding line count limits, we would use this:
662 dnl ac_max_sed_lines=m4_eval(_AC_SED_CMD_LIMIT - 3)
663 dnl But in practice this can generate scripts that contain too many bytes;
664 dnl and this can cause obscure 'sed' failures, e.g.,
665 dnl http://lists.gnu.org/archive/html/bug-coreutils/2006-05/msg00127.html
666 dnl So instead, we use the following, which is about half the size we'd like:
667 ac_max_sed_lines=50
668 dnl In the future, let's use awk or sh instead of sed to do substitutions,
669 dnl since we have so many problems with sed.
671 # First sed command is:  sed -f defines.sed $ac_file_inputs >"$tmp/out1"
672 # Second one is:         sed -f defines.sed "$tmp/out1" >"$tmp/out2"
673 # Third one will be:     sed -f defines.sed "$tmp/out2" >"$tmp/out1"
674 # et cetera.
675 ac_in='$ac_file_inputs'
676 ac_out='"$tmp/out1"'
677 ac_nxt='"$tmp/out2"'
679 while :
681   # Write a here document:
682   dnl Quote, for the `[ ]' and `define'.
683 [  cat >>$CONFIG_STATUS <<_ACEOF
684     # First, check the format of the line:
685     cat >"\$tmp/defines.sed" <<\\CEOF
686 /^[      ]*#[    ]*undef[        ][      ]*$ac_word_re[  ]*\$/b def
687 /^[      ]*#[    ]*define[       ][      ]*$ac_word_re[(         ]/b def
689 :def
690 _ACEOF]
691   sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
692   echo 'CEOF
693     sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
694   ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
695   sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
696   grep . conftest.tail >/dev/null || break
697   rm -f conftest.defines
698   mv conftest.tail conftest.defines
699 done
700 rm -f conftest.defines conftest.tail
702 dnl Now back to your regularly scheduled config.status.
703 echo "ac_result=$ac_in" >>$CONFIG_STATUS
704 cat >>$CONFIG_STATUS <<\_ACEOF
705   if test x"$ac_file" != x-; then
706     echo "/* $configure_input  */" >"$tmp/config.h"
707     cat "$ac_result" >>"$tmp/config.h"
708     if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
709       AC_MSG_NOTICE([$ac_file is unchanged])
710     else
711       rm -f $ac_file
712       mv "$tmp/config.h" $ac_file
713     fi
714   else
715     echo "/* $configure_input  */"
716     cat "$ac_result"
717   fi
718   rm -f "$tmp/out[12]"
719 dnl If running for Automake, be ready to perform additional
720 dnl commands to set up the timestamp files.
721 m4_ifdef([_AC_AM_CONFIG_HEADER_HOOK],
722          [_AC_AM_CONFIG_HEADER_HOOK([$ac_file])
723 ])dnl
724 ])# _AC_OUTPUT_HEADER
728 ## --------------------- ##
729 ## Configuration links.  ##
730 ## --------------------- ##
733 # AC_CONFIG_LINKS(DEST:SOURCE..., [COMMANDS], [INIT-CMDS])
734 # --------------------------------------------------------
735 # Specify that config.status should establish a (symbolic if possible)
736 # link from TOP_SRCDIR/SOURCE to TOP_SRCDIR/DEST.
737 # Reject DEST=., because it is makes it hard for ./config.status
738 # to guess the links to establish (`./config.status .').
740 AC_DEFUN([AC_CONFIG_LINKS], [_AC_CONFIG_FOOS([LINKS], $@)])
743 # AC_LINK_FILES(SOURCE..., DEST...)
744 # ---------------------------------
745 # Link each of the existing files SOURCE... to the corresponding
746 # link name in DEST...
748 # Unfortunately we can't provide a very good autoupdate service here,
749 # since in `AC_LINK_FILES($from, $to)' it is possible that `$from'
750 # and `$to' are actually lists.  It would then be completely wrong to
751 # replace it with `AC_CONFIG_LINKS($to:$from).  It is possible in the
752 # case of literal values though, but because I don't think there is any
753 # interest in creating config links with literal values, no special
754 # mechanism is implemented to handle them.
756 # _AC_LINK_FILES_CNT is used to be robust to multiple calls.
757 AU_DEFUN([AC_LINK_FILES],
758 [m4_if($#, 2, ,
759        [m4_fatal([$0: incorrect number of arguments])])dnl
760 m4_define_default([_AC_LINK_FILES_CNT], 0)dnl
761 m4_define([_AC_LINK_FILES_CNT], m4_incr(_AC_LINK_FILES_CNT))dnl
762 ac_sources="$1"
763 ac_dests="$2"
764 while test -n "$ac_sources"; do
765   set $ac_dests; ac_dest=$[1]; shift; ac_dests=$[*]
766   set $ac_sources; ac_source=$[1]; shift; ac_sources=$[*]
767   [ac_config_links_]_AC_LINK_FILES_CNT="$[ac_config_links_]_AC_LINK_FILES_CNT $ac_dest:$ac_source"
768 done
769 AC_CONFIG_LINKS($[ac_config_links_]_AC_LINK_FILES_CNT)dnl
771 [It is technically impossible to `autoupdate' cleanly from AC_LINK_FILES
772 to AC_CONFIG_LINKS.  `autoupdate' provides a functional but inelegant
773 update, you should probably tune the result yourself.])# AC_LINK_FILES
776 # _AC_OUTPUT_LINK
777 # ---------------
778 # This macro is expanded inside a here document.  If the here document is
779 # closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF".
780 m4_define([_AC_OUTPUT_LINK],
782   #
783   # CONFIG_LINK
784   #
786   AC_MSG_NOTICE([linking $srcdir/$ac_source to $ac_file])
788   if test ! -r "$srcdir/$ac_source"; then
789     AC_MSG_ERROR([$srcdir/$ac_source: file not found])
790   fi
791   rm -f "$ac_file"
793   # Try a relative symlink, then a hard link, then a copy.
794   case $srcdir in
795   [[\\/$]]* | ?:[[\\/]]* ) ac_rel_source=$srcdir/$ac_source ;;
796       *) ac_rel_source=$ac_top_build_prefix$srcdir/$ac_source ;;
797   esac
798   ln -s "$ac_rel_source" "$ac_file" 2>/dev/null ||
799     ln "$srcdir/$ac_source" "$ac_file" 2>/dev/null ||
800     cp -p "$srcdir/$ac_source" "$ac_file" ||
801     AC_MSG_ERROR([cannot link or copy $srcdir/$ac_source to $ac_file])
802 ])# _AC_OUTPUT_LINK
806 ## ------------------------ ##
807 ## Configuration commands.  ##
808 ## ------------------------ ##
811 # AC_CONFIG_COMMANDS(NAME...,[COMMANDS], [INIT-CMDS])
812 # ---------------------------------------------------
814 # Specify additional commands to be run by config.status.  This
815 # commands must be associated with a NAME, which should be thought
816 # as the name of a file the COMMANDS create.
818 AC_DEFUN([AC_CONFIG_COMMANDS], [_AC_CONFIG_FOOS([COMMANDS], $@)])
821 # AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS)
822 # -----------------------------------------
824 # Add additional commands for AC_OUTPUT to put into config.status.
826 # This macro is an obsolete version of AC_CONFIG_COMMANDS.  The only
827 # difficulty in mapping AC_OUTPUT_COMMANDS to AC_CONFIG_COMMANDS is
828 # to give a unique key.  The scheme we have chosen is `default-1',
829 # `default-2' etc. for each call.
831 # Unfortunately this scheme is fragile: bad things might happen
832 # if you update an included file and configure.ac: you might have
833 # clashes :(  On the other hand, I'd like to avoid weird keys (e.g.,
834 # depending upon __file__ or the pid).
835 AU_DEFUN([AC_OUTPUT_COMMANDS],
836 [m4_define_default([_AC_OUTPUT_COMMANDS_CNT], 0)dnl
837 m4_define([_AC_OUTPUT_COMMANDS_CNT], m4_incr(_AC_OUTPUT_COMMANDS_CNT))dnl
838 dnl Double quoted since that was the case in the original macro.
839 AC_CONFIG_COMMANDS([default-]_AC_OUTPUT_COMMANDS_CNT, [[$1]], [[$2]])dnl
843 # _AC_OUTPUT_COMMAND
844 # ------------------
845 # This macro is expanded inside a here document.  If the here document is
846 # closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF".
847 m4_define([_AC_OUTPUT_COMMAND],
848 [  AC_MSG_NOTICE([executing $ac_file commands])
853 ## -------------------------------------- ##
854 ## Pre- and post-config.status commands.  ##
855 ## -------------------------------------- ##
858 # AC_CONFIG_COMMANDS_PRE(CMDS)
859 # ----------------------------
860 # Commands to run right before config.status is created. Accumulates.
861 AC_DEFUN([AC_CONFIG_COMMANDS_PRE],
862 [m4_append([AC_OUTPUT_COMMANDS_PRE], [$1
863 ])])
866 # AC_OUTPUT_COMMANDS_PRE
867 # ----------------------
868 # A *variable* in which we append all the actions that must be
869 # performed before *creating* config.status.  For a start, clean
870 # up all the LIBOBJ mess.
871 m4_define([AC_OUTPUT_COMMANDS_PRE],
872 [_AC_LIBOBJS_NORMALIZE
876 # AC_CONFIG_COMMANDS_POST(CMDS)
877 # -----------------------------
878 # Commands to run after config.status was created.  Accumulates.
879 AC_DEFUN([AC_CONFIG_COMMANDS_POST],
880 [m4_append([AC_OUTPUT_COMMANDS_POST], [$1
881 ])])
883 # Initialize.
884 m4_define([AC_OUTPUT_COMMANDS_POST])
888 ## ----------------------- ##
889 ## Configuration subdirs.  ##
890 ## ----------------------- ##
893 # AC_CONFIG_SUBDIRS(DIR ...)
894 # --------------------------
895 # We define two variables:
896 # - _AC_LIST_SUBDIRS
897 #   A statically built list, should contain *all* the arguments of
898 #   AC_CONFIG_SUBDIRS.  The final value is assigned to ac_subdirs_all in
899 #   the `default' section, and used for --help=recursive.
900 #   It is also used in _AC_CONFIG_UNIQUE.
901 #   It makes no sense for arguments which are sh variables.
902 # - subdirs
903 #   Shell variable built at runtime, so some of these dirs might not be
904 #   included, if for instance the user refused a part of the tree.
905 #   This is used in _AC_OUTPUT_SUBDIRS.
906 AC_DEFUN([AC_CONFIG_SUBDIRS],
907 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
908 m4_foreach_w([_AC_Sub], [$1],
909              [_AC_CONFIG_UNIQUE([SUBDIRS],
910                                 m4_bpatsubst(m4_defn([_AC_Sub]), [:.*]))])dnl
911 m4_append([_AC_LIST_SUBDIRS], [$1], [
912 ])dnl
913 AS_LITERAL_IF([$1], [],
914               [AC_DIAGNOSE([syntax], [$0: you should use literals])])dnl
915 AC_SUBST([subdirs], ["$subdirs m4_normalize([$1])"])dnl
919 # _AC_OUTPUT_SUBDIRS
920 # ------------------
921 # This is a subroutine of AC_OUTPUT, but it does not go into
922 # config.status, rather, it is called after running config.status.
923 m4_define([_AC_OUTPUT_SUBDIRS],
926 # CONFIG_SUBDIRS section.
928 if test "$no_recursion" != yes; then
930   # Remove --cache-file and --srcdir arguments so they do not pile up.
931   ac_sub_configure_args=
932   ac_prev=
933   eval "set x $ac_configure_args"
934   shift
935   for ac_arg
936   do
937     if test -n "$ac_prev"; then
938       ac_prev=
939       continue
940     fi
941     case $ac_arg in
942     -cache-file | --cache-file | --cache-fil | --cache-fi \
943     | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
944       ac_prev=cache_file ;;
945     -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
946     | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
947     | --c=*)
948       ;;
949     --config-cache | -C)
950       ;;
951     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
952       ac_prev=srcdir ;;
953     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
954       ;;
955     -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
956       ac_prev=prefix ;;
957     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
958       ;;
959     *)
960       case $ac_arg in
961       *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
962       esac
963       ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
964     esac
965   done
967   # Always prepend --prefix to ensure using the same prefix
968   # in subdir configurations.
969   ac_arg="--prefix=$prefix"
970   case $ac_arg in
971   *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
972   esac
973   ac_sub_configure_args="$ac_arg $ac_sub_configure_args"
975   ac_popdir=`pwd`
976   for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
978     # Do not complain, so a configure script can configure whichever
979     # parts of a large source tree are present.
980     test -d "$srcdir/$ac_dir" || continue
982     ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
983     _AS_ECHO_LOG([$ac_msg])
984     _AS_ECHO([$ac_msg])
985     AS_MKDIR_P(["$ac_dir"])
986     _AC_SRCDIRS(["$ac_dir"])
988     cd "$ac_dir"
990     # Check for guested configure; otherwise get Cygnus style configure.
991     if test -f "$ac_srcdir/configure.gnu"; then
992       ac_sub_configure=$ac_srcdir/configure.gnu
993     elif test -f "$ac_srcdir/configure"; then
994       ac_sub_configure=$ac_srcdir/configure
995     elif test -f "$ac_srcdir/configure.in"; then
996       # This should be Cygnus configure.
997       ac_sub_configure=$ac_aux_dir/configure
998     else
999       AC_MSG_WARN([no configuration information is in $ac_dir])
1000       ac_sub_configure=
1001     fi
1003     # The recursion is here.
1004     if test -n "$ac_sub_configure"; then
1005       # Make the cache file name correct relative to the subdirectory.
1006       case $cache_file in
1007       [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
1008       *) # Relative name.
1009         ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
1010       esac
1012       AC_MSG_NOTICE([running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
1013       # The eval makes quoting arguments work.
1014       eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
1015            --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
1016         AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
1017     fi
1019     cd "$ac_popdir"
1020   done
1022 ])# _AC_OUTPUT_SUBDIRS
1027 ## -------------------------- ##
1028 ## Outputting config.status.  ##
1029 ## -------------------------- ##
1032 # AU::AC_OUTPUT([CONFIG_FILES...], [EXTRA-CMDS], [INIT-CMDS])
1033 # -----------------------------------------------------------
1035 # If there are arguments given to AC_OUTPUT, dispatch them to the
1036 # proper modern macros.
1037 AU_DEFUN([AC_OUTPUT],
1038 [m4_ifvaln([$1],
1039            [AC_CONFIG_FILES([$1])])dnl
1040 m4_ifvaln([$2$3],
1041           [AC_CONFIG_COMMANDS(default, [$2], [$3])])dnl
1042 [AC_OUTPUT]])
1045 # AC_OUTPUT([CONFIG_FILES...], [EXTRA-CMDS], [INIT-CMDS])
1046 # -------------------------------------------------------
1047 # The big finish.
1048 # Produce config.status, config.h, and links; and configure subdirs.
1050 m4_define([AC_OUTPUT],
1051 [dnl Dispatch the extra arguments to their native macros.
1052 m4_ifvaln([$1],
1053           [AC_CONFIG_FILES([$1])])dnl
1054 m4_ifvaln([$2$3],
1055           [AC_CONFIG_COMMANDS(default, [$2], [$3])])dnl
1056 m4_ifval([$1$2$3],
1057          [AC_DIAGNOSE([obsolete],
1058                       [$0 should be used without arguments.
1059 You should run autoupdate.])])dnl
1060 AC_CACHE_SAVE
1062 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1063 # Let make expand exec_prefix.
1064 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1066 m4_ifdef([_AC_SEEN_CONFIG(HEADERS)], [DEFS=-DHAVE_CONFIG_H], [AC_OUTPUT_MAKE_DEFS()])
1068 dnl Commands to run before creating config.status.
1069 AC_OUTPUT_COMMANDS_PRE()dnl
1071 : ${CONFIG_STATUS=./config.status}
1072 ac_clean_files_save=$ac_clean_files
1073 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
1074 _AC_OUTPUT_CONFIG_STATUS()dnl
1075 ac_clean_files=$ac_clean_files_save
1077 dnl Commands to run after config.status was created
1078 AC_OUTPUT_COMMANDS_POST()dnl
1080 # configure is writing to config.log, and then calls config.status.
1081 # config.status does its own redirection, appending to config.log.
1082 # Unfortunately, on DOS this fails, as config.log is still kept open
1083 # by configure, so config.status won't be able to write to it; its
1084 # output is simply discarded.  So we exec the FD to /dev/null,
1085 # effectively closing config.log, so it can be properly (re)opened and
1086 # appended to by config.status.  When coming back to configure, we
1087 # need to make the FD available again.
1088 if test "$no_create" != yes; then
1089   ac_cs_success=:
1090   ac_config_status_args=
1091   test "$silent" = yes &&
1092     ac_config_status_args="$ac_config_status_args --quiet"
1093   exec AS_MESSAGE_LOG_FD>/dev/null
1094   $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
1095   exec AS_MESSAGE_LOG_FD>>config.log
1096   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
1097   # would make configure fail if this is the last instruction.
1098   $ac_cs_success || AS_EXIT([1])
1100 dnl config.status should not do recursion.
1101 AC_PROVIDE_IFELSE([AC_CONFIG_SUBDIRS], [_AC_OUTPUT_SUBDIRS()])dnl
1102 ])# AC_OUTPUT
1105 # _AC_OUTPUT_CONFIG_STATUS
1106 # ------------------------
1107 # Produce config.status.  Called by AC_OUTPUT.
1108 # Pay special attention not to have too long here docs: some old
1109 # shells die.  Unfortunately the limit is not known precisely...
1110 m4_define([_AC_OUTPUT_CONFIG_STATUS],
1111 [AC_MSG_NOTICE([creating $CONFIG_STATUS])
1112 dnl AS_MESSAGE_LOG_FD is not available yet:
1113 m4_rename([AS_MESSAGE_LOG_FD], [_AC_save_AS_MESSAGE_LOG_FD])dnl
1114 cat >$CONFIG_STATUS <<_ACEOF
1115 #! $SHELL
1116 # Generated by $as_me.
1117 # Run this file to recreate the current configuration.
1118 # Compiler output produced by configure, useful for debugging
1119 # configure, is in config.log if it exists.
1121 debug=false
1122 ac_cs_recheck=false
1123 ac_cs_silent=false
1124 SHELL=\${CONFIG_SHELL-$SHELL}
1125 _ACEOF
1127 cat >>$CONFIG_STATUS <<\_ACEOF
1128 AS_SHELL_SANITIZE
1129 dnl Watch out, this is directly the initializations, do not use
1130 dnl AS_PREPARE, otherwise you'd get it output in the initialization
1131 dnl of configure, not config.status.
1132 _AS_PREPARE
1133 exec AS_MESSAGE_FD>&1
1135 # Save the log message, to keep $[0] and so on meaningful, and to
1136 # report actual input values of CONFIG_FILES etc. instead of their
1137 # values after options handling.
1138 ac_log="
1139 This file was extended by m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])dnl
1140 $as_me[]m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]), which was
1141 generated by m4_PACKAGE_STRING.  Invocation command line was
1143   CONFIG_FILES    = $CONFIG_FILES
1144   CONFIG_HEADERS  = $CONFIG_HEADERS
1145   CONFIG_LINKS    = $CONFIG_LINKS
1146   CONFIG_COMMANDS = $CONFIG_COMMANDS
1147   $ $[0] $[@]
1149 on `(hostname || uname -n) 2>/dev/null | sed 1q`
1152 _ACEOF
1154 cat >>$CONFIG_STATUS <<_ACEOF
1155 # Files that config.status was made for.
1156 m4_ifdef([_AC_SEEN_CONFIG(FILES)],
1157 [config_files="$ac_config_files"
1158 ])dnl
1159 m4_ifdef([_AC_SEEN_CONFIG(HEADERS)],
1160 [config_headers="$ac_config_headers"
1161 ])dnl
1162 m4_ifdef([_AC_SEEN_CONFIG(LINKS)],
1163 [config_links="$ac_config_links"
1164 ])dnl
1165 m4_ifdef([_AC_SEEN_CONFIG(COMMANDS)],
1166 [config_commands="$ac_config_commands"
1167 ])dnl
1169 _ACEOF
1171 cat >>$CONFIG_STATUS <<\_ACEOF
1172 ac_cs_usage="\
1173 \`$as_me' instantiates files from templates according to the
1174 current configuration.
1176 Usage: $[0] [[OPTIONS]] [[FILE]]...
1178   -h, --help       print this help, then exit
1179   -V, --version    print version number, then exit
1180   -q, --quiet      do not print progress messages
1181   -d, --debug      don't remove temporary files
1182       --recheck    update $as_me by reconfiguring in the same conditions
1183 m4_ifdef([_AC_SEEN_CONFIG(FILES)],
1184 [[  --file=FILE[:TEMPLATE]
1185                    instantiate the configuration file FILE
1186 ]])dnl
1187 m4_ifdef([_AC_SEEN_CONFIG(HEADERS)],
1188 [[  --header=FILE[:TEMPLATE]
1189                    instantiate the configuration header FILE
1190 ]])dnl
1192 m4_ifdef([_AC_SEEN_CONFIG(FILES)],
1193 [Configuration files:
1194 $config_files
1196 ])dnl
1197 m4_ifdef([_AC_SEEN_CONFIG(HEADERS)],
1198 [Configuration headers:
1199 $config_headers
1201 ])dnl
1202 m4_ifdef([_AC_SEEN_CONFIG(LINKS)],
1203 [Configuration links:
1204 $config_links
1206 ])dnl
1207 m4_ifdef([_AC_SEEN_CONFIG(COMMANDS)],
1208 [Configuration commands:
1209 $config_commands
1211 ])dnl
1212 Report bugs to <bug-autoconf@gnu.org>."
1214 _ACEOF
1215 cat >>$CONFIG_STATUS <<_ACEOF
1216 ac_cs_version="\\
1217 m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.status[]dnl
1218 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
1219 configured by $[0], generated by m4_PACKAGE_STRING,
1220   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[[\\""\`\$]]/\\\\&/g'`\\"
1222 Copyright (C) 2006 Free Software Foundation, Inc.
1223 This config.status script is free software; the Free Software Foundation
1224 gives unlimited permission to copy, distribute and modify it."
1226 ac_pwd='$ac_pwd'
1227 srcdir='$srcdir'
1228 AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
1229 [INSTALL='$INSTALL'
1230 ])dnl
1231 AC_PROVIDE_IFELSE([AC_PROG_MKDIR_P],
1232 [MKDIR_P='$MKDIR_P'
1233 ])dnl
1234 _ACEOF
1236 cat >>$CONFIG_STATUS <<\_ACEOF
1237 # If no file are specified by the user, then we need to provide default
1238 # value.  By we need to know if files were specified by the user.
1239 ac_need_defaults=:
1240 while test $[#] != 0
1242   case $[1] in
1243   --*=*)
1244     ac_option=`expr "X$[1]" : 'X\([[^=]]*\)='`
1245     ac_optarg=`expr "X$[1]" : 'X[[^=]]*=\(.*\)'`
1246     ac_shift=:
1247     ;;
1248   *)
1249     ac_option=$[1]
1250     ac_optarg=$[2]
1251     ac_shift=shift
1252     ;;
1253   esac
1255   case $ac_option in
1256   # Handling of the options.
1257   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
1258     ac_cs_recheck=: ;;
1259   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
1260     echo "$ac_cs_version"; exit ;;
1261   --debug | --debu | --deb | --de | --d | -d )
1262     debug=: ;;
1263 m4_ifdef([_AC_SEEN_CONFIG(FILES)], [dnl
1264   --file | --fil | --fi | --f )
1265     $ac_shift
1266     CONFIG_FILES="$CONFIG_FILES $ac_optarg"
1267     ac_need_defaults=false;;
1268 ])dnl
1269 m4_ifdef([_AC_SEEN_CONFIG(HEADERS)], [dnl
1270   --header | --heade | --head | --hea )
1271     $ac_shift
1272     CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
1273     ac_need_defaults=false;;
1274   --he | --h)
1275     # Conflict between --help and --header
1276     AC_MSG_ERROR([ambiguous option: $[1]
1277 Try `$[0] --help' for more information.]);;
1278 ], [  --he | --h |])dnl
1279   --help | --hel | -h )
1280     echo "$ac_cs_usage"; exit ;;
1281   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
1282   | -silent | --silent | --silen | --sile | --sil | --si | --s)
1283     ac_cs_silent=: ;;
1285   # This is an error.
1286   -*) AC_MSG_ERROR([unrecognized option: $[1]
1287 Try `$[0] --help' for more information.]) ;;
1289   *) ac_config_targets="$ac_config_targets $[1]"
1290      ac_need_defaults=false ;;
1292   esac
1293   shift
1294 done
1296 ac_configure_extra_args=
1298 if $ac_cs_silent; then
1299   exec AS_MESSAGE_FD>/dev/null
1300   ac_configure_extra_args="$ac_configure_extra_args --silent"
1303 _ACEOF
1304 cat >>$CONFIG_STATUS <<_ACEOF
1305 dnl Check this before opening the log, to avoid a bug on MinGW,
1306 dnl which prohibits the recursive instance from truncating an open log.
1307 if \$ac_cs_recheck; then
1308   echo "running CONFIG_SHELL=$SHELL $SHELL $[0] "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&AS_MESSAGE_FD
1309   CONFIG_SHELL=$SHELL
1310   export CONFIG_SHELL
1311   exec $SHELL "$[0]"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
1314 _ACEOF
1315 cat >>$CONFIG_STATUS <<\_ACEOF
1316 dnl Open the log:
1317 m4_rename([_AC_save_AS_MESSAGE_LOG_FD], [AS_MESSAGE_LOG_FD])dnl
1318 exec AS_MESSAGE_LOG_FD>>config.log
1320   echo
1321   AS_BOX([Running $as_me.])
1322   echo "$ac_log"
1323 } >&AS_MESSAGE_LOG_FD
1325 _ACEOF
1326 cat >>$CONFIG_STATUS <<_ACEOF
1327 m4_ifdef([_AC_OUTPUT_COMMANDS_INIT],
1329 # INIT-COMMANDS
1331 _AC_OUTPUT_COMMANDS_INIT
1332 ])dnl
1333 _ACEOF
1335 cat >>$CONFIG_STATUS <<\_ACEOF
1337 # Handling of arguments.
1338 for ac_config_target in $ac_config_targets
1340   case $ac_config_target in
1341 m4_ifdef([_AC_LIST_TAGS], [_AC_LIST_TAGS])
1342   *) AC_MSG_ERROR([invalid argument: $ac_config_target]);;
1343   esac
1344 done
1346 m4_ifdef([_AC_SEEN_CONFIG(ANY)], [_AC_OUTPUT_MAIN_LOOP])[]dnl
1348 AS_EXIT(0)
1349 _ACEOF
1350 chmod +x $CONFIG_STATUS
1351 ])# _AC_OUTPUT_CONFIG_STATUS
1353 # _AC_OUTPUT_MAIN_LOOP
1354 # --------------------
1355 # The main loop in $CONFIG_STATUS.
1357 # This macro is expanded inside a here document.  If the here document is
1358 # closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF".
1360 AC_DEFUN([_AC_OUTPUT_MAIN_LOOP],
1362 # If the user did not use the arguments to specify the items to instantiate,
1363 # then the envvar interface is used.  Set only those that are not.
1364 # We use the long form for the default assignment because of an extremely
1365 # bizarre bug on SunOS 4.1.3.
1366 if $ac_need_defaults; then
1367 m4_ifdef([_AC_SEEN_CONFIG(FILES)],
1368 [  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
1369 ])dnl
1370 m4_ifdef([_AC_SEEN_CONFIG(HEADERS)],
1371 [  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
1372 ])dnl
1373 m4_ifdef([_AC_SEEN_CONFIG(LINKS)],
1374 [  test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links
1375 ])dnl
1376 m4_ifdef([_AC_SEEN_CONFIG(COMMANDS)],
1377 [  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
1378 ])dnl
1381 # Have a temporary directory for convenience.  Make it in the build tree
1382 # simply because there is no reason against having it here, and in addition,
1383 # creating and moving files from /tmp can sometimes cause problems.
1384 # Hook for its removal unless debugging.
1385 # Note that there is a small window in which the directory will not be cleaned:
1386 # after its creation but before its name has been assigned to `$tmp'.
1387 $debug ||
1389   tmp=
1390   trap 'exit_status=$?
1391   { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
1392 ' 0
1393   trap 'AS_EXIT([1])' 1 2 13 15
1395 dnl The comment above AS_TMPDIR says at most 4 chars are allowed.
1396 AS_TMPDIR([conf], [.])
1398 m4_ifdef([_AC_SEEN_CONFIG(FILES)], [_AC_OUTPUT_FILES_PREPARE])[]dnl
1400 for ac_tag in[]dnl
1401   m4_ifdef([_AC_SEEN_CONFIG(FILES)],    [:F $CONFIG_FILES])[]dnl
1402   m4_ifdef([_AC_SEEN_CONFIG(HEADERS)],  [:H $CONFIG_HEADERS])[]dnl
1403   m4_ifdef([_AC_SEEN_CONFIG(LINKS)],    [:L $CONFIG_LINKS])[]dnl
1404   m4_ifdef([_AC_SEEN_CONFIG(COMMANDS)], [:C $CONFIG_COMMANDS])
1406   case $ac_tag in
1407   :[[FHLC]]) ac_mode=$ac_tag; continue;;
1408   esac
1409   case $ac_mode$ac_tag in
1410   :[[FHL]]*:*);;
1411   :L* | :C*:*) AC_MSG_ERROR([Invalid tag $ac_tag.]);;
1412   :[[FH]]-) ac_tag=-:-;;
1413   :[[FH]]*) ac_tag=$ac_tag:$ac_tag.in;;
1414   esac
1415   ac_save_IFS=$IFS
1416   IFS=:
1417   set x $ac_tag
1418   IFS=$ac_save_IFS
1419   shift
1420   ac_file=$[1]
1421   shift
1423   case $ac_mode in
1424   :L) ac_source=$[1];;
1425   :[[FH]])
1426     ac_file_inputs=
1427     for ac_f
1428     do
1429       case $ac_f in
1430       -) ac_f="$tmp/stdin";;
1431       *) # Look for the file first in the build tree, then in the source tree
1432          # (if the path is not absolute).  The absolute path cannot be DOS-style,
1433          # because $ac_f cannot contain `:'.
1434          test -f "$ac_f" ||
1435            case $ac_f in
1436            [[\\/$]]*) false;;
1437            *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
1438            esac ||
1439            AC_MSG_ERROR([cannot find input file: $ac_f]);;
1440       esac
1441       ac_file_inputs="$ac_file_inputs $ac_f"
1442     done
1444     # Let's still pretend it is `configure' which instantiates (i.e., don't
1445     # use $as_me), people would be surprised to read:
1446     #    /* config.h.  Generated by config.status.  */
1447     configure_input="Generated from "`IFS=:
1448           echo $[*] | sed ['s|^[^:]*/||;s|:[^:]*/|, |g']`" by configure."
1449     if test x"$ac_file" != x-; then
1450       configure_input="$ac_file.  $configure_input"
1451       AC_MSG_NOTICE([creating $ac_file])
1452     fi
1454     case $ac_tag in
1455     *:-:* | *:-) cat >"$tmp/stdin";;
1456     esac
1457     ;;
1458   esac
1460   ac_dir=`AS_DIRNAME(["$ac_file"])`
1461   AS_MKDIR_P(["$ac_dir"])
1462   _AC_SRCDIRS(["$ac_dir"])
1464   case $ac_mode in
1465   m4_ifdef([_AC_SEEN_CONFIG(FILES)],    [:F)_AC_OUTPUT_FILE ;;])
1466   m4_ifdef([_AC_SEEN_CONFIG(HEADERS)],  [:H)_AC_OUTPUT_HEADER ;;])
1467   m4_ifdef([_AC_SEEN_CONFIG(LINKS)],    [:L)_AC_OUTPUT_LINK ;;])
1468   m4_ifdef([_AC_SEEN_CONFIG(COMMANDS)], [:C)_AC_OUTPUT_COMMAND ;;])
1469   esac
1471 dnl Some shells don't like empty case/esac
1472 m4_ifdef([_AC_LIST_TAG_COMMANDS], [
1473   case $ac_file$ac_mode in
1474 _AC_LIST_TAG_COMMANDS
1475   esac
1476 ])dnl
1477 done # for ac_tag
1479 ])# _AC_OUTPUT_MAIN_LOOP
1482 # AC_OUTPUT_MAKE_DEFS
1483 # -------------------
1484 # Set the DEFS variable to the -D options determined earlier.
1485 # This is a subroutine of AC_OUTPUT.
1486 # It is called inside configure, outside of config.status.
1487 # Using a here document instead of a string reduces the quoting nightmare.
1488 m4_define([AC_OUTPUT_MAKE_DEFS],
1489 [[# Transform confdefs.h into DEFS.
1490 # Protect against shell expansion while executing Makefile rules.
1491 # Protect against Makefile macro expansion.
1493 # If the first sed substitution is executed (which looks for macros that
1494 # take arguments), then we branch to the quote section.  Otherwise,
1495 # look for a macro that doesn't take arguments.
1496 cat >confdef2opt.sed <<\_ACEOF
1497 t clear
1498 :clear
1499 s/^[     ]*#[    ]*define[       ][      ]*\([^  (][^    (]*([^)]*)\)[   ]*\(.*\)/-D\1=\2/g
1500 t quote
1501 s/^[     ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)/-D\1=\2/g
1502 t quote
1504 :quote
1505 s/[      `~#$^&*(){}\\|;'"<>?]/\\&/g
1506 s/\[/\\&/g
1507 s/\]/\\&/g
1508 s/\$/$$/g
1510 _ACEOF
1511 # We use echo to avoid assuming a particular line-breaking character.
1512 # The extra dot is to prevent the shell from consuming trailing
1513 # line-breaks from the sub-command output.  A line-break within
1514 # single-quotes doesn't work because, if this script is created in a
1515 # platform that uses two characters for line-breaks (e.g., DOS), tr
1516 # would break.
1517 ac_LF_and_DOT=`echo; echo .`
1518 DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
1519 rm -f confdef2opt.sed
1520 ]])# AC_OUTPUT_MAKE_DEFS