*** empty log message ***
[autoconf.git] / acgeneral.m4
blob215e9e72c5f69f8708c365eb4750a1a7df9f2b3a
1 dnl Parameterized macros.
2 dnl Requires GNU m4.
3 dnl This file is part of Autoconf.
4 dnl Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
5 dnl
6 dnl This program is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 2, or (at your option)
9 dnl any later version.
10 dnl
11 dnl This program is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 dnl GNU General Public License for more details.
15 dnl
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with this program; if not, write to the Free Software
18 dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 dnl
20 dnl As a special exception, the Free Software Foundation gives unlimited
21 dnl permission to copy, distribute and modify the configure scripts that
22 dnl are the output of Autoconf.  You need not follow the terms of the GNU
23 dnl General Public License when using or distributing such scripts, even
24 dnl though portions of the text of Autoconf appear in them.  The GNU
25 dnl General Public License (GPL) does govern all other use of the material
26 dnl that constitutes the Autoconf program.
27 dnl
28 dnl Certain portions of the Autoconf source text are designed to be copied
29 dnl (in certain cases, depending on the input) into the output of
30 dnl Autoconf.  We call these the "data" portions.  The rest of the Autoconf
31 dnl source text consists of comments plus executable code that decides which
32 dnl of the data portions to output in any given case.  We call these
33 dnl comments and executable code the "non-data" portions.  Autoconf never
34 dnl copies any of the non-data portions into its output.
35 dnl
36 dnl This special exception to the GPL applies to versions of Autoconf
37 dnl released by the Free Software Foundation.  When you make and
38 dnl distribute a modified version of Autoconf, you may extend this special
39 dnl exception to the GPL to apply to your modified version as well, *unless*
40 dnl your modified version has the potential to copy into its output some
41 dnl of the text that was the non-data portion of the version that you started
42 dnl with.  (In other words, unless your change moves or copies text from
43 dnl the non-data portions to the data portions.)  If your modification has
44 dnl such potential, you must delete any notice of this special exception
45 dnl to the GPL from your modified version.
46 dnl
47 dnl Written by David MacKenzie, with help from
48 dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
49 dnl Roland McGrath, Noah Friedman, david d zuhn, and many others.
50 dnl
51 divert(-1)dnl Throw away output until AC_INIT is called.
52 changequote([, ])
54 define(AC_ACVERSION, 2.1)
56 dnl Some old m4's don't support m4exit.  But they provide
57 dnl equivalent functionality by core dumping because of the
58 dnl long macros we define.
59 ifdef([__gnu__], , [errprint(Autoconf requires GNU m4.
60 Install it before installing Autoconf or set the
61 M4 environment variable to its path name.
62 )m4exit(2)])
64 undefine([eval])
65 undefine([include])
66 undefine([shift])
67 undefine([format])
70 dnl ### Defining macros
73 dnl m4 output diversions.  We let m4 output them all in order at the end,
74 dnl except that we explicitly undivert AC_DIVERSION_SED.
76 dnl AC_DIVERSION_NOTICE - 1 (= 0)       AC_REQUIRE'd #!/bin/sh line
77 define(AC_DIVERSION_NOTICE, 1)dnl       copyright notice & option help strings
78 define(AC_DIVERSION_INIT, 2)dnl         initialization code
79 define(AC_DIVERSION_SED, 3)dnl          variable substitutions in config.status
80 define(AC_DIVERSION_NORMAL_4, 4)dnl     AC_REQUIRE'd code, 4 level deep
81 define(AC_DIVERSION_NORMAL_3, 5)dnl     AC_REQUIRE'd code, 3 level deep
82 define(AC_DIVERSION_NORMAL_2, 6)dnl     AC_REQUIRE'd code, 2 level deep
83 define(AC_DIVERSION_NORMAL_1, 7)dnl     AC_REQUIRE'd code, 1 level deep
84 define(AC_DIVERSION_NORMAL, 8)dnl       the tests and output code
86 dnl Change the diversion stream to STREAM, while stacking old values.
87 dnl AC_DIVERT_PUSH(STREAM)
88 define(AC_DIVERT_PUSH,
89 [pushdef([AC_DIVERSION_CURRENT], $1)dnl
90 divert(AC_DIVERSION_CURRENT)dnl
93 dnl Change the diversion stream to its previous value, unstacking it.
94 dnl AC_DIVERT_POP()
95 define(AC_DIVERT_POP,
96 [popdef([AC_DIVERSION_CURRENT])dnl
97 divert(AC_DIVERSION_CURRENT)dnl
100 dnl Initialize the diversion setup.
101 define([AC_DIVERSION_CURRENT], AC_DIVERSION_NORMAL)
102 dnl This will be popped by AC_REQUIRE in AC_INIT.
103 pushdef([AC_DIVERSION_CURRENT], AC_DIVERSION_NOTICE)
105 dnl The prologue for Autoconf macros.
106 dnl AC_PRO(MACRO-NAME)
107 define(AC_PRO,
108 [define([AC_PROVIDE_$1], )dnl
109 ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL,
110 [AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))],
111 [pushdef([AC_DIVERSION_CURRENT], AC_DIVERSION_CURRENT)])dnl
114 dnl The Epilogue for Autoconf macros.
115 dnl AC_EPI()
116 define(AC_EPI,
117 [AC_DIVERT_POP()dnl
118 ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL,
119 [undivert(AC_DIVERSION_NORMAL_4)dnl
120 undivert(AC_DIVERSION_NORMAL_3)dnl
121 undivert(AC_DIVERSION_NORMAL_2)dnl
122 undivert(AC_DIVERSION_NORMAL_1)dnl
123 ])dnl
126 dnl Define a macro which automatically provides itself.  Add machinery
127 dnl so the macro automatically switches expansion to the diversion
128 dnl stack if it is not already using it.  In this case, once finished,
129 dnl it will bring back all the code accumulated in the diversion stack.
130 dnl This, combined with AC_REQUIRE, achieves the topological ordering of
131 dnl macros.  We don't use this macro to define some frequently called
132 dnl macros that are not involved in ordering constraints, to save m4
133 dnl processing. 
134 dnl AC_DEFUN(NAME, EXPANSION)
135 define([AC_DEFUN],
136 [define($1, [AC_PRO([$1])$2[]AC_EPI()])])
139 dnl ### Initialization
142 dnl AC_INIT_NOTICE()
143 AC_DEFUN(AC_INIT_NOTICE,
144 [# Guess values for system-dependent variables and create Makefiles.
145 # Generated automatically using autoconf version] AC_ACVERSION [
146 # Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
148 # This configure script is free software; the Free Software Foundation
149 # gives unlimited permission to copy, distribute and modify it.
151 # Defaults:
152 ac_help=
153 ac_default_prefix=/usr/local
154 [#] Any additions from configure.in:])
156 dnl AC_PREFIX_DEFAULT(PREFIX)
157 AC_DEFUN(AC_PREFIX_DEFAULT,
158 [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
159 ac_default_prefix=$1
160 AC_DIVERT_POP()])
162 dnl AC_INIT_PARSE_ARGS()
163 AC_DEFUN(AC_INIT_PARSE_ARGS,
165 # Initialize some variables set by options.
166 # The variables have the same names as the options, with
167 # dashes changed to underlines.
168 build=NONE
169 cache_file=./config.cache
170 exec_prefix=NONE
171 host=NONE
172 no_create=
173 nonopt=NONE
174 no_recursion=
175 prefix=NONE
176 program_prefix=NONE
177 program_suffix=NONE
178 program_transform_name=s,x,x,
179 silent=
180 site=
181 srcdir=
182 target=NONE
183 verbose=
184 x_includes=NONE
185 x_libraries=NONE
187 # Initialize some other variables.
188 subdirs=
190 ac_prev=
191 for ac_option
194   # If the previous option needs an argument, assign it.
195   if test -n "$ac_prev"; then
196     eval "$ac_prev=\$ac_option"
197     ac_prev=
198     continue
199   fi
201   case "$ac_option" in
202 changequote(, )dnl
203   -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
204 changequote([, ])dnl
205   *) ac_optarg= ;;
206   esac
208   # Accept the important Cygnus configure options, so we can diagnose typos.
210   case "$ac_option" in
212   -build | --build | --buil | --bui | --bu | --b)
213     ac_prev=build ;;
214   -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
215     build="$ac_optarg" ;;
217   -cache-file | --cache-file | --cache-fil | --cache-fi \
218   | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
219     ac_prev=cache_file ;;
220   -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
221   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
222     cache_file="$ac_optarg" ;;
224   -disable-* | --disable-*)
225     ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
226     # Reject names that are not valid shell variable names.
227 changequote(, )dnl
228     if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
229 changequote([, ])dnl
230       AC_MSG_ERROR($ac_feature: invalid feature name)
231     fi
232     ac_feature=`echo $ac_feature| sed 's/-/_/g'`
233     eval "enable_${ac_feature}=no" ;;
235   -enable-* | --enable-*)
236     ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
237     # Reject names that are not valid shell variable names.
238 changequote(, )dnl
239     if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
240 changequote([, ])dnl
241       AC_MSG_ERROR($ac_feature: invalid feature name)
242     fi
243     ac_feature=`echo $ac_feature| sed 's/-/_/g'`
244     case "$ac_option" in
245       *=*) ;;
246       *) ac_optarg=yes ;;
247     esac
248     eval "enable_${ac_feature}='$ac_optarg'" ;;
250   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
251   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
252   | --exec | --exe | --ex)
253     ac_prev=exec_prefix ;;
254   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
255   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
256   | --exec=* | --exe=* | --ex=*)
257     exec_prefix="$ac_optarg" ;;
259   -gas | --gas | --ga | --g)
260     # Obsolete; use --with-gas.
261     with_gas=yes ;;
263   -help | --help | --hel | --he)
264     # Omit some internal or obsolete options to make the list less imposing.
265     # This message is too long to be a string in the A/UX 3.1 sh.
266     cat << EOF
267 changequote(, )dnl
268 Usage: configure [options] [host]
269 Options: [defaults in brackets after descriptions]
270 Configuration:
271   --cache-file=FILE       cache test results in FILE
272   --help                  print this message
273   --no-create             do not create output files
274   --quiet, --silent       do not print \`checking...' messages
275   --version               print the version of autoconf that created configure
276 Directory and file names:
277   --prefix=PREFIX         install architecture-independent files in PREFIX
278                           [$ac_default_prefix]
279   --exec-prefix=PREFIX    install architecture-dependent files in PREFIX
280                           [same as prefix]
281   --srcdir=DIR            find the sources in DIR [configure dir or ..]
282   --program-prefix=PREFIX prepend PREFIX to installed program names
283   --program-suffix=SUFFIX append SUFFIX to installed program names
284   --program-transform-name=PROGRAM run sed PROGRAM on installed program names
285 Host type:
286   --build=BUILD           configure for building on BUILD [BUILD=HOST]
287   --host=HOST             configure for HOST [guessed]
288   --target=TARGET         configure for TARGET [TARGET=HOST]
289 Features and packages:
290   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
291   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
292   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
293   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
294   --x-includes=DIR        X include files are in DIR
295   --x-libraries=DIR       X library files are in DIR
296 --enable and --with options recognized:$ac_help
297 changequote([, ])dnl
299     exit 0 ;;
301   -host | --host | --hos | --ho)
302     ac_prev=host ;;
303   -host=* | --host=* | --hos=* | --ho=*)
304     host="$ac_optarg" ;;
306   -nfp | --nfp | --nf)
307     # Obsolete; use --without-fp.
308     with_fp=no ;;
310   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
311   | --no-cr | --no-c)
312     no_create=yes ;;
314   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
315   | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
316     no_recursion=yes ;;
318   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
319     ac_prev=prefix ;;
320   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
321     prefix="$ac_optarg" ;;
323   -program-prefix | --program-prefix | --program-prefi | --program-pref \
324   | --program-pre | --program-pr | --program-p)
325     ac_prev=program_prefix ;;
326   -program-prefix=* | --program-prefix=* | --program-prefi=* \
327   | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
328     program_prefix="$ac_optarg" ;;
330   -program-suffix | --program-suffix | --program-suffi | --program-suff \
331   | --program-suf | --program-su | --program-s)
332     ac_prev=program_suffix ;;
333   -program-suffix=* | --program-suffix=* | --program-suffi=* \
334   | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
335     program_suffix="$ac_optarg" ;;
337   -program-transform-name | --program-transform-name \
338   | --program-transform-nam | --program-transform-na \
339   | --program-transform-n | --program-transform- \
340   | --program-transform | --program-transfor \
341   | --program-transfo | --program-transf \
342   | --program-trans | --program-tran \
343   | --progr-tra | --program-tr | --program-t)
344     ac_prev=program_transform_name ;;
345   -program-transform-name=* | --program-transform-name=* \
346   | --program-transform-nam=* | --program-transform-na=* \
347   | --program-transform-n=* | --program-transform-=* \
348   | --program-transform=* | --program-transfor=* \
349   | --program-transfo=* | --program-transf=* \
350   | --program-trans=* | --program-tran=* \
351   | --progr-tra=* | --program-tr=* | --program-t=*)
352     program_transform_name="$ac_optarg" ;;
354   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
355   | -silent | --silent | --silen | --sile | --sil)
356     silent=yes ;;
358   -site | --site | --sit)
359     ac_prev=site ;;
360   -site=* | --site=* | --sit=*)
361     site="$ac_optarg" ;;
363   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
364     ac_prev=srcdir ;;
365   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
366     srcdir="$ac_optarg" ;;
368   -target | --target | --targe | --targ | --tar | --ta | --t)
369     ac_prev=target ;;
370   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
371     target="$ac_optarg" ;;
373   -v | -verbose | --verbose | --verbos | --verbo | --verb)
374     verbose=yes ;;
376   -version | --version | --versio | --versi | --vers)
377     echo "configure generated by autoconf version AC_ACVERSION"
378     exit 0 ;;
380   -with-* | --with-*)
381     ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
382     # Reject names that are not valid shell variable names.
383 changequote(, )dnl
384     if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
385 changequote([, ])dnl
386       AC_MSG_ERROR($ac_package: invalid package name)
387     fi
388     ac_package=`echo $ac_package| sed 's/-/_/g'`
389     case "$ac_option" in
390       *=*) ;;
391       *) ac_optarg=yes ;;
392     esac
393     eval "with_${ac_package}='$ac_optarg'" ;;
395   -without-* | --without-*)
396     ac_package=`echo $ac_option|sed -e 's/-*without-//'`
397     # Reject names that are not valid shell variable names.
398 changequote(, )dnl
399     if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
400 changequote([, ])dnl
401       AC_MSG_ERROR($ac_package: invalid package name)
402     fi
403     ac_package=`echo $ac_package| sed 's/-/_/g'`
404     eval "with_${ac_package}=no" ;;
406   --x)
407     # Obsolete; use --with-x.
408     with_x=yes ;;
410   -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
411   | --x-incl | --x-inc | --x-in | --x-i)
412     ac_prev=x_includes ;;
413   -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
414   | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
415     x_includes="$ac_optarg" ;;
417   -x-libraries | --x-libraries | --x-librarie | --x-librari \
418   | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
419     ac_prev=x_libraries ;;
420   -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
421   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
422     x_libraries="$ac_optarg" ;;
424   -*) AC_MSG_ERROR([$ac_option: invalid option; use --help to show usage])
425     ;;
427   *) 
428 changequote(, )dnl
429     if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
430 changequote([, ])dnl
431       AC_MSG_WARN($ac_option: invalid host type)
432     fi
433     if test "x$nonopt" != xNONE; then
434       AC_MSG_ERROR(can only configure for one host and one target at a time)
435     fi
436     nonopt="$ac_option"
437     ;;
439   esac
440 done
442 if test -n "$ac_prev"; then
443   AC_MSG_ERROR(missing argument to --`echo $ac_prev | sed 's/_/-/g'`)
447 dnl Try to have only one #! line, so the script doesn't look funny
448 dnl for users of AC_REVISION.
449 dnl AC_INIT_BINSH()
450 AC_DEFUN(AC_INIT_BINSH,
451 [#!/bin/sh
454 dnl AC_INIT(UNIQUE-FILE-IN-SOURCE-DIR)
455 AC_DEFUN(AC_INIT,
456 [sinclude(acsite.m4)dnl
457 sinclude(./aclocal.m4)dnl
458 AC_REQUIRE([AC_INIT_BINSH])dnl
459 AC_INIT_NOTICE
460 AC_DIVERT_POP()dnl to NORMAL
461 AC_DIVERT_PUSH(AC_DIVERSION_INIT)dnl
462 AC_INIT_PARSE_ARGS
463 AC_INIT_PREPARE($1)dnl
464 AC_DIVERT_POP()dnl to NORMAL
467 dnl AC_INIT_PREPARE(UNIQUE-FILE-IN-SOURCE-DIR)
468 AC_DEFUN(AC_INIT_PREPARE,
469 [trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
471 # File descriptor usage:
472 # 0 unused; standard input
473 # 1 file creation
474 # 2 errors and warnings
475 # 3 unused; some systems may open it to /dev/tty
476 define(AC_FD_MSG, 4)dnl
477 [#] AC_FD_MSG checking for... messages and results
478 define(AC_FD_CC, 5)dnl
479 [#] AC_FD_CC compiler messages saved in config.log
480 if test "$silent" = yes; then
481   exec AC_FD_MSG>/dev/null
482 else
483   exec AC_FD_MSG>&1
485 exec AC_FD_CC>./config.log
487 echo "\
488 This file contains any messages produced by compilers while
489 running configure, to aid debugging if configure makes a mistake.
490 " 1>&AC_FD_CC
492 # Strip out --no-create and --no-recursion so they do not pile up.
493 # Also quote any args containing shell metacharacters.
494 ac_configure_args=
495 for ac_arg
497   case "$ac_arg" in
498   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
499   | --no-cr | --no-c) ;;
500   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
501   | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
502 changequote(<<, >>)dnl
503 dnl If you change this globbing pattern, test it on an old shell --
504 dnl it's sensitive.  Putting any kind of quote in it causes syntax errors.
505   *" "*|*"      "*|*[\[\]\~\<<#>>\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
506   ac_configure_args="$ac_configure_args '$ac_arg'" ;;
507 changequote([, ])dnl
508   *) ac_configure_args="$ac_configure_args $ac_arg" ;;
509   esac
510 done
512 # NLS nuisances.
513 # Only set LANG and LC_ALL to C if already set.
514 # These must not be set unconditionally because not all systems understand
515 # e.g. LANG=C (notably SCO).
516 if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
517 if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
519 # confdefs.h avoids OS command line length limits that DEFS can exceed.
520 rm -rf conftest* confdefs.h
521 # AIX cpp loses on an empty file, so make sure it contains at least a newline.
522 echo > confdefs.h
524 # A filename unique to this package, relative to the directory that
525 # configure is in, which we can look for to find out if srcdir is correct.
526 ac_unique_file=$1
528 # Find the source files, if location was not specified.
529 if test -z "$srcdir"; then
530   ac_srcdir_defaulted=yes
531   # Try the directory containing this script, then its parent.
532   ac_prog=[$]0
533 changequote(, )dnl
534   ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
535 changequote([, ])dnl
536   test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
537   srcdir=$ac_confdir
538   if test ! -r $srcdir/$ac_unique_file; then
539     srcdir=..
540   fi
541 else
542   ac_srcdir_defaulted=no
544 if test ! -r $srcdir/$ac_unique_file; then
545   if test "$ac_srcdir_defaulted" = yes; then
546     AC_MSG_ERROR(can not find sources in $ac_confdir or ..)
547   else
548     AC_MSG_ERROR(can not find sources in $srcdir)
549   fi
551 dnl Double slashes in pathnames in object file debugging info
552 dnl mess up M-x gdb in Emacs.
553 changequote(, )dnl
554 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
555 changequote([, ])dnl
557 dnl Let the site file select an alternate cache file if it wants to.
558 AC_SITE_LOAD
559 AC_CACHE_LOAD
560 AC_LANG_C
561 AC_PROG_ECHO_N
562 dnl Substitute for predefined variables.
563 AC_SUBST(CFLAGS)dnl
564 AC_SUBST(CPPFLAGS)dnl
565 AC_SUBST(CXXFLAGS)dnl
566 AC_SUBST(DEFS)dnl
567 AC_SUBST(LDFLAGS)dnl
568 AC_SUBST(LIBS)dnl
569 AC_SUBST(exec_prefix)dnl
570 AC_SUBST(prefix)dnl
571 AC_SUBST(program_transform_name)dnl
575 dnl ### Selecting optional features
578 dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
579 AC_DEFUN(AC_ARG_ENABLE,
580 [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
581 ac_help="$ac_help
582 [$2]"
583 AC_DIVERT_POP()dnl
584 [#] Check whether --enable-$1 or --disable-$1 was given.
585 enableval="[$enable_]patsubst($1, -, _)"
586 if test -n "$enableval"; then
587   ifelse([$3], , :, [$3])
588 ifelse([$4], , , [else
589   $4
590 ])dnl
594 AC_DEFUN(AC_ENABLE,
595 [AC_OBSOLETE([$0], [; instead use AC_ARG_ENABLE])dnl
596 AC_ARG_ENABLE([$1], [  --enable-$1], [$2], [$3])dnl
600 dnl ### Working with optional software
603 dnl AC_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
604 AC_DEFUN(AC_ARG_WITH,
605 [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
606 ac_help="$ac_help
607 [$2]"
608 AC_DIVERT_POP()dnl
609 [#] Check whether --with-$1 or --without-$1 was given.
610 withval="[$with_]patsubst($1, -, _)"
611 if test -n "$withval"; then
612   ifelse([$3], , :, [$3])
613 ifelse([$4], , , [else
614   $4
615 ])dnl
619 AC_DEFUN(AC_WITH,
620 [AC_OBSOLETE([$0], [; instead use AC_ARG_WITH])dnl
621 AC_ARG_WITH([$1], [  --with-$1], [$2], [$3])dnl
625 dnl ### Transforming program names.
628 dnl AC_ARG_PROGRAM()
629 AC_DEFUN(AC_ARG_PROGRAM,
630 [if test "$program_transform_name" = s,x,x,; then
631   program_transform_name=
632 else
633   # Double any \ or $.
634   echo 's,\\,\\\\,g; s,\$,$$,g' > conftestsed
635   program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
636   rm -f conftestsed
638 test "$program_prefix" != NONE &&
639   program_transform_name="s,^,${program_prefix},; $program_transform_name"
640 # Use a double $ so make ignores it.
641 test "$program_suffix" != NONE &&
642   program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
644 # sed with no file args requires a program.
645 test "$program_transform_name" = "" && program_transform_name="s,x,x,"
649 dnl ### Version numbers
652 dnl AC_REVISION(REVISION-INFO)
653 AC_DEFUN(AC_REVISION,
654 [AC_REQUIRE([AC_INIT_BINSH])dnl
655 [# From configure.in] translit([$1], $")])
657 dnl Subroutines of AC_PREREQ.
659 dnl Change the dots in NUMBER into commas.
660 dnl AC_PREREQ_SPLIT(NUMBER)
661 define(AC_PREREQ_SPLIT,
662 [translit($1, ., [, ])])
664 dnl Default the ternary version number to 0 (e.g., 1, 7 -> 1, 7, 0).
665 dnl AC_PREREQ_CANON(MAJOR, MINOR [,TERNARY])
666 define(AC_PREREQ_CANON,
667 [$1, $2, ifelse([$3], , 0, [$3])])
669 dnl Complain and exit if version number 1 is less than version number 2.
670 dnl PRINTABLE2 is the printable version of version number 2.
671 dnl AC_PREREQ_COMPARE(MAJOR1, MINOR1, TERNARY1, MAJOR2, MINOR2, TERNARY2,
672 dnl                   PRINTABLE2)
673 define(AC_PREREQ_COMPARE,
674 [ifelse(builtin([eval],
675 [$3 + $2 * 1000 + $1 * 1000000 < $6 + $5 * 1000 + $4 * 1000000]), 1,
676 [errprint(Autoconf version $7 or higher is required for this script
677 )m4exit(3)])])
679 dnl Complain and exit if the Autoconf version is less than VERSION.
680 dnl AC_PREREQ(VERSION)
681 define(AC_PREREQ,
682 [AC_PREREQ_COMPARE(AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)),
683 AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), [$1])])
686 dnl ### Getting the canonical system type
689 dnl Find install-sh, config.sub, config.guess, and Cygnus configure
690 dnl in directory DIR.  These are auxiliary files used in configuration.
691 dnl DIR can be either absolute or relative to $srcdir.
692 dnl AC_CONFIG_AUX_DIR(DIR)
693 AC_DEFUN(AC_CONFIG_AUX_DIR,
694 [AC_CONFIG_AUX_DIRS($1 $srcdir/$1)])
696 dnl The default is `$srcdir' or `$srcdir/..' or `$srcdir/../..'.
697 dnl There's no need to call this macro explicitly; just AC_REQUIRE it.
698 AC_DEFUN(AC_CONFIG_AUX_DIR_DEFAULT,
699 [AC_CONFIG_AUX_DIRS($srcdir $srcdir/.. $srcdir/../..)])
701 dnl Internal subroutine.
702 dnl Search for the configuration auxiliary files in directory list $1.
703 dnl We look only for install-sh, so users of AC_PROG_INSTALL
704 dnl do not automatically need to distribute the other auxiliary files.
705 dnl AC_CONFIG_AUX_DIRS(DIR ...)
706 AC_DEFUN(AC_CONFIG_AUX_DIRS,
707 [ac_aux_dir=
708 for ac_dir in $1; do
709   if test -f $ac_dir/install-sh; then
710     ac_aux_dir=$ac_dir
711     ac_install_sh="$ac_aux_dir/install-sh -c"
712     break
713   elif test -f $ac_dir/install.sh; then
714     ac_aux_dir=$ac_dir
715     ac_install_sh="$ac_aux_dir/install.sh -c"
716     break
717   fi
718 done
719 if test -z "$ac_aux_dir"; then
720   AC_MSG_ERROR([can not find install-sh or install.sh in $1])
722 ac_config_guess=$ac_aux_dir/config.guess
723 ac_config_sub=$ac_aux_dir/config.sub
724 ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
725 AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
728 dnl Canonicalize the host, target, and build system types.
729 AC_DEFUN(AC_CANONICAL_SYSTEM,
730 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
731 AC_BEFORE([$0], [AC_ARG_PROGRAM])
732 # Do some error checking and defaulting for the host and target type.
733 # The inputs are:
734 #    configure --host=HOST --target=TARGET --build=BUILD NONOPT
736 # The rules are:
737 # 1. You are not allowed to specify --host, --target, and nonopt at the
738 #    same time. 
739 # 2. Host defaults to nonopt.
740 # 3. If nonopt is not specified, then host defaults to the current host,
741 #    as determined by config.guess.
742 # 4. Target and build default to nonopt.
743 # 5. If nonopt is not specified, then target and build default to host.
745 # The aliases save the names the user supplied, while $host etc.
746 # will get canonicalized.
747 case $host---$target---$nonopt in
748 NONE---*---* | *---NONE---* | *---*---NONE) ;;
749 *) AC_MSG_ERROR(can only configure for one host and one target at a time) ;;
750 esac
752 AC_CANONICAL_HOST
753 AC_CANONICAL_TARGET
754 AC_CANONICAL_BUILD
755 test "$host_alias" != "$target_alias" &&
756   test "$program_prefix$program_suffix$program_transform_name" = \
757     NONENONEs,x,x, && program_prefix=${target_alias}-
760 dnl Subroutines of AC_CANONICAL_SYSTEM.
762 AC_DEFUN(AC_CANONICAL_HOST,
763 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
765 # Make sure we can run config.sub.
766 if $ac_config_sub sun4 >/dev/null 2>&1; then :
767 else AC_MSG_ERROR(can not run $ac_config_sub)
770 AC_MSG_CHECKING(host system type)
772 host_alias=$host
773 case "$host_alias" in
774 NONE)
775   case $nonopt in
776   NONE)
777     if host_alias=`$ac_config_guess`; then :
778     else AC_MSG_ERROR(can not guess host type; you must specify one)
779     fi ;;
780   *) host_alias=$nonopt ;;
781   esac ;;
782 esac
784 host=`$ac_config_sub $host_alias`
785 host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
786 host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
787 host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
788 AC_MSG_RESULT($host)
789 AC_SUBST(host)dnl
790 AC_SUBST(host_alias)dnl
791 AC_SUBST(host_cpu)dnl
792 AC_SUBST(host_vendor)dnl
793 AC_SUBST(host_os)dnl
796 dnl Internal use only.
797 AC_DEFUN(AC_CANONICAL_TARGET,
798 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
799 AC_MSG_CHECKING(target system type)
801 target_alias=$target
802 case "$target_alias" in
803 NONE)
804   case $nonopt in
805   NONE) target_alias=$host_alias ;;
806   *) target_alias=$nonopt ;;
807   esac ;;
808 esac
810 target=`$ac_config_sub $target_alias`
811 target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
812 target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
813 target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
814 AC_MSG_RESULT($target)
815 AC_SUBST(target)dnl
816 AC_SUBST(target_alias)dnl
817 AC_SUBST(target_cpu)dnl
818 AC_SUBST(target_vendor)dnl
819 AC_SUBST(target_os)dnl
822 dnl Internal use only.
823 AC_DEFUN(AC_CANONICAL_BUILD,
824 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
825 AC_MSG_CHECKING(build system type)
827 build_alias=$build
828 case "$build_alias" in
829 NONE)
830   case $nonopt in
831   NONE) build_alias=$host_alias ;;
832   *) build_alias=$nonopt ;;
833   esac ;;
834 esac
836 build=`$ac_config_sub $build_alias`
837 build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
838 build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
839 build_os=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
840 AC_MSG_RESULT($build)
841 AC_SUBST(build)dnl
842 AC_SUBST(build_alias)dnl
843 AC_SUBST(build_cpu)dnl
844 AC_SUBST(build_vendor)dnl
845 AC_SUBST(build_os)dnl
849 dnl ### Caching test results
852 dnl Look for site or system specific initialization scripts.
853 dnl AC_SITE_LOAD()
854 define(AC_SITE_LOAD,
855 [# Prefer explicitly selected file to automatically selected ones.
856 if test -z "$CONFIG_SITE"; then
857   if test "x$prefix" != xNONE; then
858     CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
859   else
860     CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
861   fi
863 for ac_site_file in $CONFIG_SITE; do
864   if test -r "$ac_site_file"; then
865     echo "loading site script $ac_site_file"
866     . "$ac_site_file"
867   fi
868 done
871 dnl AC_CACHE_LOAD()
872 define(AC_CACHE_LOAD,
873 [if test -r "$cache_file"; then
874   echo "loading cache $cache_file"
875   . $cache_file
876 else
877   echo "creating cache $cache_file"
878   > $cache_file
882 dnl AC_CACHE_SAVE()
883 define(AC_CACHE_SAVE,
884 [if test -w $cache_file; then
885 echo "updating cache $cache_file"
886 cat > $cache_file <<\EOF
887 # This file is a shell script that caches the results of configure
888 # tests run on this system so they can be shared between configure
889 # scripts and configure runs.  It is not useful on other systems.
890 # If it contains results you don't want to keep, you may remove or edit it.
892 # By default, configure uses ./config.cache as the cache file,
893 # creating it if it does not exist already.  You can give configure
894 # the --cache-file=FILE option to use a different cache file; that is
895 # what configure does when it calls configure scripts in
896 # subdirectories, so they share the cache.
897 # Giving --cache-file=/dev/null disables caching, for debugging configure.
898 # config.status only pays attention to the cache file if you give it the
899 # --recheck option to rerun configure.
902 changequote(, )dnl
903 dnl Allow a site initialization script to override cache values.
904 # Ultrix sh set writes to stderr and can't be redirected directly.
905 (set) 2>&1 |
906   sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p" \
907   >> $cache_file
908 changequote([, ])dnl
909 else
910 echo "not updating unwritable cache $cache_file"
914 dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved.
915 dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT)
916 define(AC_CACHE_VAL,
917 [dnl We used to use the below line, but it fails if the 1st arg is a
918 dnl shell variable, so we need the eval.
919 dnl if test "${$1+set}" = set; then
920 if eval "test \"`echo '${'$1'+set}'`\" = set"; then
921   echo $ac_n "(cached) $ac_c" 1>&AC_FD_MSG
922 else
923   $2
928 dnl ### Defining symbols
931 dnl Set VARIABLE to VALUE, verbatim, or 1.
932 dnl AC_DEFINE(VARIABLE [, VALUE])
933 define(AC_DEFINE,
934 [cat >> confdefs.h <<\EOF
935 [#define] $1 ifelse($#, 2, [$2], 1)
939 dnl Similar, but perform shell substitutions $ ` \ once on VALUE.
940 define(AC_DEFINE_UNQUOTED,
941 [cat >> confdefs.h <<EOF
942 [#define] $1 ifelse($#, 2, [$2], 1)
947 dnl ### Setting output variables
950 dnl This macro protects VARIABLE from being diverted twice
951 dnl if this macro is called twice for it.
952 dnl AC_SUBST(VARIABLE)
953 define(AC_SUBST,
954 [ifdef([AC_SUBST_$1], ,
955 [define([AC_SUBST_$1], )dnl
956 AC_DIVERT_PUSH(AC_DIVERSION_SED)dnl
957 s%@$1@%[$]$1%g
958 AC_DIVERT_POP()dnl
959 ])])
961 dnl AC_SUBST_FILE(VARIABLE)
962 define(AC_SUBST_FILE,
963 [ifdef([AC_SUBST_$1], ,
964 [define([AC_SUBST_$1], )dnl
965 AC_DIVERT_PUSH(AC_DIVERSION_SED)dnl
966 /@$1@/r [$]$1
967 s%@$1@%%g
968 AC_DIVERT_POP()dnl
969 ])])
972 dnl ### Printing messages
975 dnl AC_MSG_CHECKING(FEATURE-DESCRIPTION)
976 define(AC_MSG_CHECKING,
977 [echo $ac_n "checking $1""... $ac_c" 1>&AC_FD_MSG])
979 dnl AC_CHECKING(FEATURE-DESCRIPTION)
980 define(AC_CHECKING,
981 [echo "checking $1" 1>&AC_FD_MSG])
983 dnl AC_MSG_RESULT(RESULT-DESCRIPTION)
984 define(AC_MSG_RESULT,
985 [echo "$ac_t""$1" 1>&AC_FD_MSG])
987 dnl AC_VERBOSE(RESULT-DESCRIPTION)
988 define(AC_VERBOSE,
989 [AC_OBSOLETE([$0], [; instead use AC_MSG_RESULT])dnl
990 echo "  $1" 1>&AC_FD_MSG])
992 dnl AC_MSG_WARN(PROBLEM-DESCRIPTION)
993 define(AC_MSG_WARN,
994 [echo "configure: warning: $1" 1>&2])
996 dnl AC_MSG_ERROR(ERROR-DESCRIPTION)
997 define(AC_MSG_ERROR,
998 [{ echo "configure: error: $1" 1>&2; exit 1; }])
1001 dnl ### Selecting which language to use for testing
1004 dnl AC_LANG_C()
1005 AC_DEFUN(AC_LANG_C,
1006 [define([AC_LANG], [C])dnl
1007 ac_ext=c
1008 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
1009 ac_cpp='$CPP $CPPFLAGS'
1010 ac_compile='${CC-cc} $CFLAGS $CPPFLAGS conftest.$ac_ext -c 1>&AC_FD_CC 2>&AC_FD_CC'
1011 ac_link='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC'
1014 dnl AC_LANG_CPLUSPLUS()
1015 AC_DEFUN(AC_LANG_CPLUSPLUS,
1016 [define([AC_LANG], [CPLUSPLUS])dnl
1017 ac_ext=C
1018 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
1019 ac_cpp='$CXXCPP $CPPFLAGS'
1020 ac_compile='${CXX-g++} $CXXFLAGS $CPPFLAGS conftest.$ac_ext -c 1>&AC_FD_CC 2>&AC_FD_CC'
1021 ac_link='${CXX-g++} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC'
1024 dnl Push the current language on a stack.
1025 dnl AC_LANG_SAVE()
1026 define(AC_LANG_SAVE,
1027 [pushdef([AC_LANG_STACK], AC_LANG)])
1029 dnl Restore the current language from the stack.
1030 dnl AC_LANG_RESTORE()
1031 define(AC_LANG_RESTORE,
1032 [ifelse(AC_LANG_STACK, C, [ifelse(AC_LANG, C, , [AC_LANG_C])], [ifelse(AC_LANG, CPLUSPLUS, , [AC_LANG_CPLUSPLUS])])[]popdef([AC_LANG_STACK])])
1035 dnl ### Dependencies between macros
1038 dnl AC_BEFORE(THIS-MACRO-NAME, CALLED-MACRO-NAME)
1039 define(AC_BEFORE,
1040 [ifdef([AC_PROVIDE_$2], [errprint(__file__:__line__: [$2 was called before $1
1041 ])])])
1043 dnl AC_REQUIRE(MACRO-NAME)
1044 define(AC_REQUIRE,
1045 [ifdef([AC_PROVIDE_$1], ,
1046 [AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
1047 indir([$1])
1048 AC_DIVERT_POP()dnl
1049 ])])
1051 dnl AC_PROVIDE(MACRO-NAME)
1052 define(AC_PROVIDE,
1053 [define([AC_PROVIDE_$1], )])
1055 dnl AC_OBSOLETE(THIS-MACRO-NAME [, SUGGESTION])
1056 define(AC_OBSOLETE,
1057 [errprint(__file__:__line__: warning: [$1] is obsolete[$2]
1061 dnl ### Checking for programs
1064 dnl AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUND
1065 dnl               [, VALUE-IF-NOT-FOUND])
1066 AC_DEFUN(AC_CHECK_PROG,
1067 [# Extract the first word of "$2", so it can be a program name with args.
1068 set dummy $2; ac_word=[$]2
1069 AC_MSG_CHECKING([for $ac_word])
1070 AC_CACHE_VAL(ac_cv_prog_$1,
1071 [if test -n "[$]$1"; then
1072   ac_cv_prog_$1="[$]$1" # Let the user override the test.
1073 else
1074   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1075   for ac_dir in $PATH; do
1076     test -z "$ac_dir" && ac_dir=.
1077     if test -f $ac_dir/$ac_word; then
1078       ac_cv_prog_$1="$3"
1079       break
1080     fi
1081   done
1082   IFS="$ac_save_ifs"
1083 dnl If no 4th arg is given, leave the cache variable unset,
1084 dnl so AC_CHECK_PROGS will keep looking.
1085 ifelse([$4], , , [  test -z "[$]ac_cv_prog_$1" && ac_cv_prog_$1="$4"
1086 ])dnl
1087 fi])dnl
1088 $1="$ac_cv_prog_$1"
1089 if test -n "[$]$1"; then
1090   AC_MSG_RESULT([$]$1)
1091 else
1092   AC_MSG_RESULT(no)
1094 AC_SUBST($1)dnl
1097 dnl AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND])
1098 AC_DEFUN(AC_PATH_PROG,
1099 [# Extract the first word of "$2", so it can be a program name with args.
1100 set dummy $2; ac_word=[$]2
1101 AC_MSG_CHECKING([for $ac_word])
1102 AC_CACHE_VAL(ac_cv_path_$1,
1103 [case "[$]$1" in
1104   /*)
1105   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1106   ;;
1107   *)
1108   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1109   for ac_dir in $PATH; do
1110     test -z "$ac_dir" && ac_dir=.
1111     if test -f $ac_dir/$ac_word; then
1112       ac_cv_path_$1="$ac_dir/$ac_word"
1113       break
1114     fi
1115   done
1116   IFS="$ac_save_ifs"
1117 dnl If no 3rd arg is given, leave the cache variable unset,
1118 dnl so AC_PATH_PROGS will keep looking.
1119 ifelse([$3], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$3"
1120 ])dnl
1121   ;;
1122 esac])dnl
1123 $1="$ac_cv_path_$1"
1124 if test -n "[$]$1"; then
1125   AC_MSG_RESULT([$]$1)
1126 else
1127   AC_MSG_RESULT(no)
1129 AC_SUBST($1)dnl
1132 dnl AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND])
1133 AC_DEFUN(AC_CHECK_PROGS,
1134 [for ac_prog in $2
1136 AC_CHECK_PROG($1, [$]ac_prog, [$]ac_prog, )
1137 test -n "[$]$1" && break
1138 done
1139 ifelse([$3], , , [test -n "[$]$1" || $1="$3"
1140 ])])
1142 dnl AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND])
1143 AC_DEFUN(AC_PATH_PROGS,
1144 [for ac_prog in $2
1146 AC_PATH_PROG($1, [$]ac_prog)
1147 test -n "[$]$1" && break
1148 done
1149 ifelse([$3], , , [test -n "[$]$1" || $1="$3"
1150 ])])
1152 dnl Guess the value for the `prefix' variable by looking for
1153 dnl the argument program along PATH and taking its parent.
1154 dnl Example: if the argument is `gcc' and we find /usr/local/gnu/bin/gcc,
1155 dnl set `prefix' to /usr/local/gnu.
1156 dnl This comes too late to find a site file based on the prefix,
1157 dnl and it might use a cached value for the path.
1158 dnl No big loss, I think, since most configures don't use this macro anyway.
1159 dnl AC_PREFIX_PROGRAM(PROGRAM)
1160 AC_DEFUN(AC_PREFIX_PROGRAM,
1161 [if test "x$prefix" = xNONE; then
1162 changequote(<<, >>)dnl
1163 define(<<AC_VAR_NAME>>, translit($1, [a-z], [A-Z]))dnl
1164 changequote([, ])dnl
1165 AC_PATH_PROG(AC_VAR_NAME, $1)
1166 changequote(<<, >>)dnl
1167   if test -n "$ac_cv_path_<<>>AC_VAR_NAME"; then
1168     prefix=`echo $ac_cv_path_<<>>AC_VAR_NAME|sed 's%/[^/][^/]*/[^/][^/]*$%%'`
1169 changequote([, ])dnl
1170   fi
1172 undefine([AC_VAR_NAME])dnl
1176 dnl ### Checking for libraries
1179 dnl AC_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
1180 dnl              [, OTHER-LIBRARIES]]])
1181 AC_DEFUN(AC_CHECK_LIB,
1182 [AC_MSG_CHECKING([for -l$1])
1183 AC_CACHE_VAL(ac_cv_lib_$1,
1184 [ac_save_LIBS="$LIBS"
1185 LIBS="$LIBS -l$1 $5"
1186 AC_TRY_LINK(, [$2()], eval "ac_cv_lib_$1=yes", eval "ac_cv_lib_$1=no")dnl
1187 LIBS="$ac_save_LIBS"
1188 ])dnl
1189 if eval "test \"`echo '$ac_cv_lib_'$1`\" = yes"; then
1190   AC_MSG_RESULT(yes)
1191   ifelse([$3], , 
1192 [changequote(, )dnl
1193   ac_tr_lib=HAVE_LIB`echo $1 | tr '[a-z]' '[A-Z]'`
1194 changequote([, ])dnl
1195   AC_DEFINE_UNQUOTED($ac_tr_lib)
1196   LIBS="$LIBS -l$1"
1197 ], [$3])
1198 else
1199   AC_MSG_RESULT(no)
1200 ifelse([$4], , , [$4
1201 ])dnl
1205 dnl AC_HAVE_LIBRARY(LIBRARY, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
1206 dnl                 [, OTHER-LIBRARIES]]])
1207 AC_DEFUN(AC_HAVE_LIBRARY,
1208 [AC_OBSOLETE([$0], [; instead use AC_CHECK_LIB])dnl
1209 changequote(<<, >>)dnl
1210 define(<<AC_LIB_NAME>>, dnl
1211 patsubst(patsubst($1, <<lib\([^\.]*\)\.a>>, <<\1>>), <<-l>>, <<>>))dnl
1212 define(<<AC_CV_NAME>>, ac_cv_lib_<<>>AC_LIB_NAME)dnl
1213 changequote([, ])dnl
1214 AC_MSG_CHECKING([for -l[]AC_LIB_NAME])
1215 AC_CACHE_VAL(AC_CV_NAME,
1216 [ac_save_LIBS="$LIBS"
1217 LIBS="$LIBS -l[]AC_LIB_NAME[] $4"
1218 AC_TRY_LINK( , [main()], AC_CV_NAME=yes, AC_CV_NAME=no)dnl
1219 LIBS="$ac_save_LIBS"
1220 ])dnl
1221 AC_MSG_RESULT($AC_CV_NAME)
1222 if test "$AC_CV_NAME" = yes; then
1223   ifelse([$2], , 
1224 [AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z]))
1225   LIBS="$LIBS -l[]AC_LIB_NAME[]"
1226 ], [$2])
1227 ifelse([$3], , , [else
1228   $3
1229 ])dnl
1231 undefine([AC_LIB_NAME])dnl
1232 undefine([AC_CV_NAME])dnl
1236 dnl ### Examining declarations
1239 dnl AC_TRY_CPP(INCLUDES, ACTION-IF-TRUE [, ACTION-IF-FALSE])
1240 AC_DEFUN(AC_TRY_CPP,
1241 [AC_REQUIRE_CPP()dnl
1242 cat > conftest.$ac_ext <<EOF
1243 [#]line __oline__ "configure"
1244 #include "confdefs.h"
1245 [$1]
1247 dnl Capture the stderr of cpp.  eval is necessary to expand ac_cpp.
1248 dnl We used to copy stderr to stdout and capture it in a variable, but
1249 dnl that breaks under sh -x, which writes compile commands starting
1250 dnl with ` +' to stderr in eval and subshells.
1251 eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1252 ac_err=`grep -v '^ *+' conftest.out`
1253 if test -z "$ac_err"; then
1254   ifelse([$2], , :, [rm -rf conftest*
1255   $2])
1256 else
1257   echo "$ac_err" >&AC_FD_CC
1258 ifelse([$3], , , [  rm -rf conftest*
1259   $3
1260 ])dnl
1262 rm -f conftest*])
1264 dnl AC_EGREP_HEADER(PATTERN, HEADER-FILE, ACTION-IF-FOUND [,
1265 dnl                 ACTION-IF-NOT-FOUND])
1266 AC_DEFUN(AC_EGREP_HEADER,
1267 [AC_EGREP_CPP([$1], [#include <$2>], [$3], [$4])])
1269 dnl Because this macro is used by AC_PROG_GCC_TRADITIONAL, which must
1270 dnl come early, it is not included in AC_BEFORE checks.
1271 dnl AC_EGREP_CPP(PATTERN, PROGRAM, ACTION-IF-FOUND [,
1272 dnl              ACTION-IF-NOT-FOUND])
1273 AC_DEFUN(AC_EGREP_CPP,
1274 [AC_REQUIRE_CPP()dnl
1275 cat > conftest.$ac_ext <<EOF
1276 [#]line __oline__ "configure"
1277 #include "confdefs.h"
1278 [$2]
1280 dnl eval is necessary to expand ac_cpp.
1281 dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
1282 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
1283   egrep "$1" >/dev/null 2>&1; then
1284   ifelse([$3], , :, [rm -rf conftest*
1285   $3])
1286 ifelse([$4], , , [else
1287   rm -rf conftest*
1288   $4
1289 ])dnl
1291 rm -f conftest*
1295 dnl ### Examining syntax
1298 dnl AC_TRY_COMPILE(INCLUDES, FUNCTION-BODY,
1299 dnl             ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
1300 AC_DEFUN(AC_TRY_COMPILE,
1301 [cat > conftest.$ac_ext <<EOF
1302 dnl This sometimes fails to find confdefs.h, for some reason.
1303 dnl [#]line __oline__ "[$]0"
1304 [#]line __oline__ "configure"
1305 #include "confdefs.h"
1306 [$1]
1307 int main() { return 0; }
1308 int t() {
1309 [$2]
1310 ; return 0; }
1312 if eval $ac_compile; then
1313   ifelse([$3], , :, [rm -rf conftest*
1314   $3])
1315 ifelse([$4], , , [else
1316   rm -rf conftest*
1317   $4
1318 ])dnl
1320 rm -f conftest*]
1324 dnl ### Examining libraries
1327 dnl AC_COMPILE_CHECK(ECHO-TEXT, INCLUDES, FUNCTION-BODY,
1328 dnl                  ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
1329 AC_DEFUN(AC_COMPILE_CHECK,
1330 [AC_OBSOLETE([$0], [; instead use AC_TRY_COMPILE or AC_TRY_LINK, and AC_MSG_CHECKING and AC_MSG_RESULT])dnl
1331 ifelse([$1], , , [AC_CHECKING([for $1])
1332 ])dnl
1333 AC_TRY_LINK([$2], [$3], [$4], [$5])dnl
1336 dnl AC_TRY_LINK(INCLUDES, FUNCTION-BODY,
1337 dnl             ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
1338 AC_DEFUN(AC_TRY_LINK,
1339 [cat > conftest.$ac_ext <<EOF
1340 dnl This sometimes fails to find confdefs.h, for some reason.
1341 dnl [#]line __oline__ "[$]0"
1342 [#]line __oline__ "configure"
1343 #include "confdefs.h"
1344 [$1]
1345 int main() { return 0; }
1346 int t() {
1347 [$2]
1348 ; return 0; }
1350 if eval $ac_link; then
1351   ifelse([$3], , :, [rm -rf conftest*
1352   $3])
1353 ifelse([$4], , , [else
1354   rm -rf conftest*
1355   $4
1356 ])dnl
1358 rm -f conftest*]
1362 dnl ### Checking for run-time features
1365 dnl AC_TRY_RUN(PROGRAM, ACTION-IF-TRUE [, ACTION-IF-FALSE
1366 dnl            [, ACTION-IF-CROSS-COMPILING]])
1367 AC_DEFUN(AC_TRY_RUN,
1368 [AC_REQUIRE([AC_C_CROSS])dnl
1369 if test "$cross_compiling" = yes; then
1370   ifelse([$4], ,
1371     [errprint(__file__:__line__: warning: [AC_TRY_RUN] called without default to allow cross compiling
1372 )dnl
1373   AC_MSG_ERROR(can not run test program while cross compiling)],
1374   [$4])
1375 else
1376 cat > conftest.$ac_ext <<EOF
1377 [#]line __oline__ "configure"
1378 #include "confdefs.h"
1379 ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
1380 extern "C" void exit(int);
1381 #endif
1382 ])dnl
1383 [$1]
1385 eval $ac_link
1386 if test -s conftest && (./conftest; exit) 2>/dev/null; then
1387   ifelse([$2], , :, [$2])
1388 ifelse([$3], , , [else
1389   $3
1390 ])dnl
1393 rm -fr conftest*])
1396 dnl ### Checking for header files
1399 dnl AC_CHECK_HEADER(HEADER-FILE, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
1400 AC_DEFUN(AC_CHECK_HEADER,
1401 [dnl Do the transliteration at runtime so arg 1 can be a shell variable.
1402 ac_safe=`echo "$1" | tr './\055' '___'`
1403 AC_MSG_CHECKING([for $1])
1404 AC_CACHE_VAL(ac_cv_header_$ac_safe,
1405 [AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes",
1406   eval "ac_cv_header_$ac_safe=no")])dnl
1407 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1408   AC_MSG_RESULT(yes)
1409   ifelse([$2], , :, [$2])
1410 else
1411   AC_MSG_RESULT(no)
1412 ifelse([$3], , , [$3
1413 ])dnl
1417 dnl AC_CHECK_HEADERS(HEADER-FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1418 AC_DEFUN(AC_CHECK_HEADERS,
1419 [for ac_hdr in $1
1421 AC_CHECK_HEADER($ac_hdr,
1422 [changequote(, )dnl
1423   ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
1424 changequote([, ])dnl
1425   AC_DEFINE_UNQUOTED($ac_tr_hdr) $2], $3)dnl
1426 done
1430 dnl ### Checking for library functions
1433 dnl AC_CHECK_FUNC(FUNCTION, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
1434 AC_DEFUN(AC_CHECK_FUNC,
1435 [AC_MSG_CHECKING([for $1])
1436 AC_CACHE_VAL(ac_cv_func_$1,
1437 [AC_TRY_LINK(
1438 [#include <ctype.h> /* Arbitrary system header to define __stub macros. */
1439 /* Override any gcc2 internal prototype to avoid an error.  */
1440 ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
1441 extern "C"
1442 #endif
1443 ])dnl
1444 [char $1(); 
1445 ], [
1446 /* The GNU C library defines this for functions which it implements
1447     to always fail with ENOSYS.  Some functions are actually named
1448     something starting with __ and the normal name is an alias.  */
1449 #if defined (__stub_$1) || defined (__stub___$1)
1450 choke me
1451 #else
1452 $1();
1453 #endif
1454 ], eval "ac_cv_func_$1=yes", eval "ac_cv_func_$1=no")])dnl
1455 if eval "test \"`echo '$ac_cv_func_'$1`\" = yes"; then
1456   AC_MSG_RESULT(yes)
1457   ifelse([$2], , :, [$2])
1458 else
1459   AC_MSG_RESULT(no)
1460 ifelse([$3], , , [$3
1461 ])dnl
1465 dnl AC_CHECK_FUNCS(FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1466 AC_DEFUN(AC_CHECK_FUNCS,
1467 [for ac_func in $1
1469 AC_CHECK_FUNC($ac_func,
1470 [changequote(, )dnl
1471   ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'`
1472 changequote([, ])dnl
1473   AC_DEFINE_UNQUOTED($ac_tr_func) $2], $3)dnl
1474 done
1477 dnl AC_REPLACE_FUNCS(FUNCTION-NAME...)
1478 AC_DEFUN(AC_REPLACE_FUNCS,
1479 [for ac_func in $1
1481 AC_CHECK_FUNC($ac_func, , [LIBOBJS="$LIBOBJS ${ac_func}.o"])
1482 done
1483 AC_SUBST(LIBOBJS)dnl
1487 dnl ### Checking compiler characteristics
1490 dnl AC_CHECK_SIZEOF(TYPE)
1491 AC_DEFUN(AC_CHECK_SIZEOF,
1492 [changequote(<<, >>)dnl
1493 dnl The name to #define.
1494 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
1495 dnl The cache variable name.
1496 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
1497 changequote([, ])dnl
1498 AC_MSG_CHECKING(size of $1)
1499 AC_CACHE_VAL(AC_CV_NAME,
1500 [AC_TRY_RUN([#include <stdio.h>
1501 main()
1503   FILE *f=fopen("conftestval", "w");
1504   if (!f) exit(1);
1505   fprintf(f, "%d\n", sizeof($1));
1506   exit(0);
1507 }], AC_CV_NAME=`cat conftestval`)])dnl
1508 AC_MSG_RESULT($AC_CV_NAME)
1509 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
1510 undefine([AC_TYPE_NAME])dnl
1511 undefine([AC_CV_NAME])dnl
1515 dnl ### Checking for typedefs
1518 dnl AC_CHECK_TYPE(TYPE, DEFAULT)
1519 AC_DEFUN(AC_CHECK_TYPE,
1520 [AC_REQUIRE([AC_HEADER_STDC])dnl
1521 AC_MSG_CHECKING(for $1)
1522 AC_CACHE_VAL(ac_cv_type_$1,
1523 [AC_EGREP_CPP($1, [#include <sys/types.h>
1524 #if STDC_HEADERS
1525 #include <stdlib.h>
1526 #endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
1527 AC_MSG_RESULT($ac_cv_type_$1)
1528 if test $ac_cv_type_$1 = no; then
1529   AC_DEFINE($1, $2)
1534 dnl ### Creating output files
1537 dnl AC_CONFIG_HEADER(HEADER-TO-CREATE ...)
1538 AC_DEFUN(AC_CONFIG_HEADER,
1539 [define(AC_LIST_HEADER, $1)])
1541 dnl Link each of the existing files SOURCE... to the corresponding
1542 dnl link name in DEST...
1543 dnl AC_LINK_FILES(SOURCE..., DEST...)
1544 AC_DEFUN(AC_LINK_FILES,
1545 [define([AC_LIST_FILES], [$1])define([AC_LIST_LINKS], [$2])])
1547 dnl AC_CONFIG_SUBDIRS(DIR ...)
1548 AC_DEFUN(AC_CONFIG_SUBDIRS,
1549 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1550 define([AC_LIST_SUBDIRS], [$1])dnl
1551 subdirs="AC_LIST_SUBDIRS"
1552 AC_SUBST(subdirs)dnl
1555 dnl The big finish.
1556 dnl Produce config.status, config.h, and links, and configure subdirs.
1557 dnl AC_OUTPUT([FILE...] [, EXTRA-CMDS] [, INIT-CMDS])
1558 define(AC_OUTPUT,
1559 [trap '' 1 2 15
1560 AC_CACHE_SAVE
1561 trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
1563 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1564 # Let make expand exec_prefix.
1565 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1567 # Any assignment to VPATH causes Sun make to only execute
1568 # the first set of double-colon rules, so remove it if not needed.
1569 # If there is a colon in the path, we need to keep it.
1570 if test "x$srcdir" = x.; then
1571 changequote(, )dnl
1572   ac_vpsub='/^[         ]*VPATH[        ]*=[^:]*$/d'
1573 changequote([, ])dnl
1576 trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
1578 ifdef([AC_LIST_HEADER], [DEFS=-DHAVE_CONFIG_H], [AC_OUTPUT_MAKE_DEFS()])
1580 # Without the "./", some shells look in PATH for config.status.
1581 : ${CONFIG_STATUS=./config.status}
1583 echo creating $CONFIG_STATUS
1584 rm -f $CONFIG_STATUS
1585 cat > $CONFIG_STATUS <<EOF
1586 #!/bin/sh
1587 # Generated automatically by configure.
1588 # Run this file to recreate the current configuration.
1589 # This directory was configured as follows,
1590 dnl hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
1591 dnl so uname gets run too.
1592 # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
1594 [#] [$]0 [$]ac_configure_args
1596 # Compiler output produced by configure, useful for debugging
1597 # configure, is in ./config.log if it exists.
1599 changequote(, )dnl
1600 ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
1601 changequote([, ])dnl
1602 for ac_option
1604   case "[\$]ac_option" in
1605   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
1606     echo "running [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]ac_configure_args --no-create --no-recursion"
1607     exec [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]ac_configure_args --no-create --no-recursion ;;
1608   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
1609     echo "$CONFIG_STATUS generated by autoconf version AC_ACVERSION"
1610     exit 0 ;;
1611   -help | --help | --hel | --he | --h)
1612     echo "[\$]ac_cs_usage"; exit 0 ;;
1613   *) echo "[\$]ac_cs_usage"; exit 1 ;;
1614   esac
1615 done
1617 ac_given_srcdir=$srcdir
1618 ifdef([AC_PROVIDE_AC_PROG_INSTALL], [ac_given_INSTALL="$INSTALL"
1619 ])dnl
1621 ifdef([AC_LIST_HEADER],
1622 [trap 'rm -fr $1 AC_LIST_HEADER conftest*; exit 1' 1 2 15],
1623 [trap 'rm -f $1; exit 1' 1 2 15])
1625 AC_OUTPUT_FILES($1)
1626 ifdef([AC_LIST_HEADER], [AC_OUTPUT_HEADER(AC_LIST_HEADER)])dnl
1627 ifdef([AC_LIST_LINKS], [AC_OUTPUT_LINKS(AC_LIST_FILES, AC_LIST_LINKS)])dnl
1628 ifelse([$3], , , 
1629 [EOF
1630 cat >> $CONFIG_STATUS <<EOF
1633 cat >> $CONFIG_STATUS <<\EOF])
1635 exit 0
1637 chmod +x $CONFIG_STATUS
1638 rm -fr confdefs* $ac_clean_files
1639 test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS
1640 dnl config.status should not do recursion.
1641 ifdef([AC_LIST_SUBDIRS], [AC_OUTPUT_SUBDIRS(AC_LIST_SUBDIRS)])dnl
1642 ])dnl
1644 dnl This is a subroutine of AC_OUTPUT.
1645 dnl It is called inside configure, outside of config.status.
1646 dnl AC_OUTPUT_MAKE_DEFS()
1647 define(AC_OUTPUT_MAKE_DEFS,
1648 [# Transform confdefs.h into DEFS.
1649 dnl Using a here document instead of a string reduces the quoting nightmare.
1650 # Protect against shell expansion while executing Makefile rules.
1651 # Protect against Makefile macro expansion.
1652 cat > conftest.defs <<\EOF
1653 changequote(<<, >>)dnl
1654 s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g
1655 s%[     `~<<#>>$^&*(){}\\|;'"<>?]%\\&%g
1656 s%\[%\\&%g
1657 s%\]%\\&%g
1658 s%\$%$$%g
1659 changequote([, ])dnl
1661 DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
1662 rm -f conftest.defs
1665 dnl This is a subroutine of AC_OUTPUT.  It is called inside an unquoted
1666 dnl here document whose contents are going into config.status.
1667 dnl AC_OUTPUT_FILES(FILE...)
1668 define(AC_OUTPUT_FILES,
1669 [# Protect against being on the right side of a sed subst in config.status. 
1670 changequote(, )dnl
1671 sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; 
1672  s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
1673 changequote([, ])dnl
1674 dnl These here document variables are unquoted when configure runs
1675 dnl but quoted when config.status runs, so variables are expanded once.
1676 $ac_vpsub
1677 dnl Shell code in configure.in might set extrasub.
1678 $extrasub
1679 dnl Insert the sed substitutions of variables.
1680 undivert(AC_DIVERSION_SED)
1681 CEOF
1683 cat >> $CONFIG_STATUS <<EOF
1685 CONFIG_FILES=\${CONFIG_FILES-"$1"}
1687 cat >> $CONFIG_STATUS <<\EOF
1688 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
1689 dnl Specifying an input file breaks the trap to clean up on interrupt,
1690 dnl but that's not a huge problem.
1691   # Support "outfile[:infile]", defaulting infile="outfile.in".
1692   case "$ac_file" in
1693   *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
1694        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1695   *) ac_file_in="${ac_file}.in" ;;
1696   esac
1698   # Adjust relative srcdir, etc. for subdirectories.
1700   # Remove last slash and all that follows it.  Not all systems have dirname.
1701 changequote(, )dnl
1702   ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
1703 changequote([, ])dnl
1704   if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
1705     # The file is in a subdirectory.
1706     test ! -d "$ac_dir" && mkdir "$ac_dir"
1707     ac_dir_suffix="/$ac_dir"
1708     # A "../" for each directory in $ac_dir_suffix.
1709 changequote(, )dnl
1710     ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
1711 changequote([, ])dnl
1712   else
1713     ac_dir_suffix= ac_dots=
1714   fi
1716   case "$ac_given_srcdir" in
1717   .)  srcdir=.
1718       if test -z "$ac_dots"; then top_srcdir=.
1719       else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
1720   /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
1721   *) # Relative path.
1722     srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
1723     top_srcdir="$ac_dots$ac_given_srcdir" ;;
1724   esac
1726 ifdef([AC_PROVIDE_AC_PROG_INSTALL],
1727 [  case "$ac_given_INSTALL" in
1728 changequote(, )dnl
1729   [/$]*) INSTALL="$ac_given_INSTALL" ;;
1730 changequote([, ])dnl
1731   *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
1732   esac
1733 ])dnl
1734   echo creating "$ac_file"
1735   rm -f "$ac_file"
1736   configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
1737   case "$ac_file" in
1738   *Makefile*) ac_comsub="1i\\
1739 # $configure_input" ;;
1740   *) ac_comsub= ;;
1741   esac
1742   sed -e "$ac_comsub
1743 s%@configure_input@%$configure_input%g
1744 s%@srcdir@%$srcdir%g
1745 s%@top_srcdir@%$top_srcdir%g
1746 ifdef([AC_PROVIDE_AC_PROG_INSTALL], [s%@INSTALL@%$INSTALL%g
1747 ])dnl
1748 " -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
1749 fi; done
1750 rm -f conftest.subs
1753 dnl This is a subroutine of AC_OUTPUT.  It is called inside a quoted
1754 dnl here document whose contents are going into config.status.
1755 dnl AC_OUTPUT_HEADER(HEADER-FILE...)
1756 define(AC_OUTPUT_HEADER,
1757 [changequote(<<, >>)dnl
1758 # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
1759 # NAME is the cpp macro being defined and VALUE is the value it is being given.
1761 # ac_d sets the value in "#define NAME VALUE" lines.
1762 ac_dA='s%^\([   ]*\)#\([        ]*define[       ][      ]*\)'
1763 ac_dB='\([      ][      ]*\)[^  ]*%\1#\2'
1764 ac_dC='\3'
1765 ac_dD='%g'
1766 # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
1767 ac_uA='s%^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
1768 ac_uB='\([      ]\)%\1#\2define\3'
1769 ac_uC=' '
1770 ac_uD='\4%g'
1771 # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
1772 ac_eA='s%^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
1773 ac_eB='<<$>>%\1#\2define\3'
1774 ac_eC=' '
1775 ac_eD='%g'
1776 changequote([, ])dnl
1778 CONFIG_HEADERS=${CONFIG_HEADERS-"$1"}
1779 for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
1780   # Support "outfile[:infile]", defaulting infile="outfile.in".
1781   case "$ac_file" in
1782   *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
1783        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1784   *) ac_file_in="${ac_file}.in" ;;
1785   esac
1787   echo creating $ac_file
1789   rm -f conftest.frag conftest.in conftest.out
1790   cp $ac_given_srcdir/$ac_file_in conftest.in
1794 # Transform confdefs.h into a sed script conftest.vals that substitutes
1795 # the proper values into config.h.in to produce config.h.  And first:
1796 # Protect against being on the right side of a sed subst in config.status. 
1797 # Protect against being in an unquoted here document in config.status.
1798 rm -f conftest.vals
1799 dnl Using a here document instead of a string reduces the quoting nightmare.
1800 dnl Putting comments in sed scripts is not portable.
1801 cat > conftest.hdr <<\EOF
1802 changequote(<<, >>)dnl
1803 s/[\\&%]/\\&/g
1804 s%[\\$`]%\\&%g
1805 s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
1806 s%ac_d%ac_u%gp
1807 s%ac_u%ac_e%gp
1808 changequote([, ])dnl
1810 sed -n -f conftest.hdr confdefs.h > conftest.vals
1811 rm -f conftest.hdr
1813 # This sed command replaces #undef with comments.  This is necessary, for
1814 # example, in the case of _POSIX_SOURCE, which is predefined and required
1815 # on some systems where configure will not decide to define it.
1816 cat >> conftest.vals <<\EOF
1817 changequote(, )dnl
1818 s%^[    ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
1819 changequote([, ])dnl
1822 # Break up conftest.vals because some shells have a limit on
1823 # the size of here documents, and old seds have small limits too.
1824 # Maximum number of lines to put in a single here document.
1825 ac_max_here_lines=12
1827 rm -f conftest.tail
1828 while :
1830   ac_lines=`grep -c . conftest.vals`
1831   # grep -c gives empty output for an empty file on some AIX systems.
1832   if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
1833   # Write a limited-size here document to conftest.frag.
1834   echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
1835   sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
1836   echo 'CEOF
1837   sed -f conftest.frag conftest.in > conftest.out
1838   rm -f conftest.in
1839   mv conftest.out conftest.in
1840 ' >> $CONFIG_STATUS
1841   sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
1842   rm -f conftest.vals
1843   mv conftest.tail conftest.vals
1844 done
1845 rm -f conftest.vals
1847 dnl Now back to your regularly scheduled config.status.
1848 cat >> $CONFIG_STATUS <<\EOF
1849   rm -f conftest.frag conftest.h
1850   echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
1851   cat conftest.in >> conftest.h
1852   rm -f conftest.in
1853   if cmp -s $ac_file conftest.h 2>/dev/null; then
1854     echo "$ac_file is unchanged"
1855     rm -f conftest.h
1856   else
1857     rm -f $ac_file
1858     mv conftest.h $ac_file
1859   fi
1860 fi; done
1864 dnl This is a subroutine of AC_OUTPUT.  It is called inside a quoted
1865 dnl here document whose contents are going into config.status.
1866 dnl AC_OUTPUT_LINKS(SOURCE..., DEST...)
1867 define(AC_OUTPUT_LINKS,
1868 [EOF
1870 cat >> $CONFIG_STATUS <<EOF
1871 ac_sources="$1"
1872 ac_dests="$2"
1875 cat >> $CONFIG_STATUS <<\EOF
1876 srcdir=$ac_given_srcdir
1877 while test -n "$ac_sources"; do
1878   set $ac_dests; ac_dest=[$]1; shift; ac_dests=[$]*
1879   set $ac_sources; ac_source=[$]1; shift; ac_sources=[$]*
1881   echo "linking $srcdir/$ac_source to $ac_dest"
1883   if test ! -r $srcdir/$ac_source; then
1884     AC_MSG_ERROR($srcdir/$ac_source: File not found)
1885   fi
1886   rm -f $ac_dest
1888   # Make relative symlinks.
1889   # Remove last slash and all that follows it.  Not all systems have dirname.
1890 changequote(, )dnl
1891   ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'`
1892 changequote([, ])dnl
1893   if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
1894     # The dest file is in a subdirectory.
1895     test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
1896     ac_dest_dir_suffix="/$ac_dest_dir"
1897     # A "../" for each directory in $ac_dest_dir_suffix.
1898 changequote(, )dnl
1899     ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
1900 changequote([, ])dnl
1901   else
1902     ac_dest_dir_suffix= ac_dots=
1903   fi
1905   case "$srcdir" in
1906 changequote(, )dnl
1907   [/$]*) ac_rel_source="$srcdir/$ac_source" ;;
1908 changequote([, ])dnl
1909   *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;;
1910   esac
1912   # Make a symlink if possible; otherwise try a hard link.
1913   if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
1914     ln $srcdir/$ac_source $ac_dest; then :
1915   else
1916     AC_MSG_ERROR(can not link $ac_dest to $srcdir/$ac_source)
1917   fi
1918 done
1921 This is a subroutine of AC_OUTPUT.  It is called after running config.status.
1922 dnl AC_OUTPUT_SUBDIRS(DIRECTORY...)
1923 define(AC_OUTPUT_SUBDIRS,
1925 if test "$no_recursion" != yes; then
1927   # Remove --cache-file and --srcdir arguments so they do not pile up.
1928   ac_sub_configure_args=
1929   ac_prev=
1930   for ac_arg in $ac_configure_args; do
1931     if test -n "$ac_prev"; then
1932       ac_prev=
1933       continue
1934     fi
1935     case "$ac_arg" in
1936     -cache-file | --cache-file | --cache-fil | --cache-fi \
1937     | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
1938       ac_prev=cache_file ;;
1939     -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
1940     | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
1941       ;;
1942     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
1943       ac_prev=srcdir ;;
1944     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
1945       ;;
1946     *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
1947     esac
1948   done
1950   for ac_config_dir in $1; do
1952     # Do not complain, so a configure script can configure whichever
1953     # parts of a large source tree are present.
1954     if test ! -d $srcdir/$ac_config_dir; then
1955       continue
1956     fi
1958     echo configuring in $ac_config_dir
1960     case "$srcdir" in
1961     .) ;;
1962     *)
1963       if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
1964       else
1965         AC_MSG_ERROR(can not create `pwd`/$ac_config_dir)
1966       fi
1967       ;;
1968     esac
1970     ac_popdir=`pwd`
1971     cd $ac_config_dir
1973     case "$srcdir" in
1974     .) # No --srcdir option.  We are building in place.
1975       ac_sub_srcdir=$srcdir ;;
1976     /*) # Absolute path.
1977       ac_sub_srcdir=$srcdir/$ac_config_dir ;;
1978     *) # Relative path.
1979       ac_sub_srcdir=../$srcdir/$ac_config_dir ;;
1980     esac
1982     # Check for guested configure; otherwise get Cygnus style configure.
1983     if test -f $ac_sub_srcdir/configure; then
1984       ac_sub_configure=$ac_sub_srcdir/configure
1985     elif test -f $ac_sub_srcdir/configure.in; then
1986       ac_sub_configure=$ac_configure
1987     else
1988       AC_MSG_WARN(no configuration information is in $ac_config_dir)
1989       ac_sub_configure=
1990     fi
1992     # The recursion is here.
1993     if test -n "$ac_sub_configure"; then
1995       # Make the cache file name correct relative to the subdirectory.
1996 changequote(, )dnl
1997       # A "../" for each directory in /$ac_config_dir.
1998       ac_dots=`echo /$ac_config_dir|sed 's%/[^/]*%../%g'`
1999 changequote([, ])dnl
2000       case "$cache_file" in
2001       /*) ac_sub_cache_file=$cache_file ;;
2002       *) # Relative path.
2003         ac_sub_cache_file="$ac_dots$cache_file" ;;
2004       esac
2006       echo "[running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file] --srcdir=$ac_sub_srcdir"
2007       # The eval makes quoting arguments work.
2008       if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
2009       then :
2010       else
2011         AC_MSG_ERROR($ac_sub_configure failed for $ac_config_dir)
2012       fi
2013     fi
2015     cd $ac_popdir
2016   done