home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / gnu / lib / autoconf / acgeneral.m4 < prev    next >
Encoding:
M4 Source File  |  1994-04-26  |  35.0 KB  |  1,164 lines

  1. dnl Parameterized macros that do not check for something specific.
  2. dnl This file is part of Autoconf.
  3. dnl Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  4. dnl
  5. dnl This program is free software; you can redistribute it and/or modify
  6. dnl it under the terms of the GNU General Public License as published by
  7. dnl the Free Software Foundation; either version 2, or (at your option)
  8. dnl any later version.
  9. dnl
  10. dnl This program is distributed in the hope that it will be useful,
  11. dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. dnl GNU General Public License for more details.
  14. dnl
  15. dnl You should have received a copy of the GNU General Public License
  16. dnl along with this program; if not, write to the Free Software
  17. dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. dnl
  19. dnl Written by David MacKenzie, with help from
  20. dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
  21. dnl Roland McGrath, Noah Friedman, and david d zuhn.
  22. dnl
  23. changequote([,])dnl
  24. undefine([eval])dnl
  25. undefine([include])dnl
  26. undefine([shift])dnl
  27. undefine([format])dnl
  28. dnl
  29. ifdef([__gnu__], , [errprint(Autoconf requires GNU m4
  30. )m4exit(2)])dnl
  31. dnl
  32. dnl
  33. dnl Utility functions for stamping the configure script.
  34. dnl
  35. dnl
  36. define(AC_ACVERSION, 1.9)dnl
  37. dnl This is defined by the --version option of the autoconf script.
  38. ifdef([AC_PRINT_VERSION], [errprint(Autoconf version AC_ACVERSION
  39. )])dnl
  40. dnl
  41. dnl These are currently not used, for the sake of people who diff
  42. dnl configure scripts and don't want spurious differences.
  43. dnl But they are too clever to just delete.
  44. dnl
  45. define(AC_USER, [esyscmd(
  46. changequote({,})dnl
  47. # Extract the user name from the first pair of parentheses.
  48. ({ac_sedcmd='s/[^(]*(\([^)]*\)).*/\1/';}
  49. changequote([,])dnl
  50. whoami || id|sed "$ac_sedcmd") 2>/dev/null|tr -d '\012')])dnl
  51. dnl
  52. define(AC_HOST, [esyscmd((hostname || uname -n) 2>/dev/null|tr -d '\012')])dnl
  53. dnl
  54. define(AC_DATE, [esyscmd(date|tr -d '\012')])dnl
  55. dnl
  56. dnl
  57. dnl Controlling Autoconf operation
  58. dnl
  59. dnl
  60. dnl This is separate from AC_INIT to prevent GNU m4 1.0 from coredumping
  61. dnl when AC_CONFIG_HEADER is used.
  62. define(AC_NOTICE,
  63. [# Guess values for system-dependent variables and create Makefiles.
  64. dnl [#] Generated automatically using autoconf.
  65. # Generated automatically using autoconf version] AC_ACVERSION [
  66. dnl [#] by AC_USER@AC_HOST on AC_DATE
  67. # Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
  68.  
  69. # This configure script is free software; you can redistribute it and/or
  70. # modify it under the terms of the GNU General Public License as published
  71. # by the Free Software Foundation; either version 2, or (at your option)
  72. # any later version.
  73.  
  74. # This script is distributed in the hope that it will be useful, but
  75. # WITHOUT ANY WARRANTY; without even the implied warranty of
  76. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
  77. # Public License for more details.
  78.  
  79. # You should have received a copy of the GNU General Public License
  80. # along with this program; if not, write to the Free Software
  81. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  82. ])dnl
  83. dnl
  84. define(AC_PARSEARGS,
  85. [# Save the original args to write them into config.status later.
  86. configure_args="[$]*"
  87.  
  88. # Only options that might do something get documented.
  89. changequote(,)dnl
  90. ac_usage="Usage: configure [options] [host]
  91. Options: [defaults in brackets after descriptions]
  92. --build=BUILD        configure for building on BUILD [BUILD=HOST]
  93. --disable-FEATURE    do not include FEATURE (same as --enable-FEATURE=no)
  94. --enable-FEATURE[=ARG]    include FEATURE [ARG=yes]
  95. --exec-prefix=PREFIX    install host dependent files in PREFIX [/usr/local]
  96. --help            print this message
  97. --host=HOST        configure for HOST [guessed]
  98. --prefix=PREFIX        install host independent files in PREFIX [/usr/local]
  99. --quiet, --silent    do not print \`checking for...' messages
  100. --srcdir=DIR        find the sources in DIR [configure dir or ..]
  101. --target=TARGET        configure for TARGET [TARGET=HOST]
  102. --verbose        print results of checks
  103. --version        print the version of autoconf that created configure
  104. --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  105. --without-PACKAGE    do not use PACKAGE (same as --with-PACKAGE=no)
  106. --x-includes=DIR    X include files are in DIR
  107. --x-libraries=DIR    X library files are in DIR"
  108. changequote([,])dnl
  109.  
  110. # Initialize some variables set by options.
  111. # The variables have the same names as the options, with
  112. # dashes changed to underlines.
  113. build=NONE
  114. exec_prefix=
  115. host=NONE
  116. no_create=
  117. nonopt=NONE
  118. norecursion=
  119. prefix=
  120. program_prefix=
  121. program_suffix=
  122. program_transform_name=
  123. silent=
  124. srcdir=
  125. target=NONE
  126. verbose=
  127. x_includes=
  128. x_libraries=
  129.  
  130. ac_prev=
  131. for ac_option
  132. do
  133.  
  134.   # If the previous option needs an argument, assign it.
  135.   if test -n "$ac_prev"; then
  136.     eval "$ac_prev=\$ac_option"
  137.     ac_prev=
  138.     continue
  139.   fi
  140.  
  141.   # Accept (but ignore some of) the important Cygnus configure
  142.   # options, so we can diagnose typos.
  143.  
  144.   case "$ac_option" in
  145. changequote(,)dnl
  146.   -*=*) ac_optarg=`/bin/echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  147. changequote([,])dnl
  148.   *) ac_optarg= ;;
  149.   esac
  150.  
  151.   case "$ac_option" in
  152.  
  153.   -build | --build | --buil | --bui | --bu | --b)
  154.     ac_prev=build ;;
  155.   -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
  156.     build="$ac_optarg" ;;
  157.  
  158.   -disable-* | --disable-*)
  159.     ac_feature=`/bin/echo $ac_option|sed -e 's/-*disable-//'`
  160.     # Reject names that aren't valid shell variable names.
  161. changequote(,)dnl
  162.     if test -n "`/bin/echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
  163. changequote([,])dnl
  164.       AC_ERROR($ac_feature: invalid feature name)
  165.     fi
  166.     ac_feature=`/bin/echo $ac_feature| sed 's/-/_/g'`
  167.     eval "enable_${ac_feature}=no" ;;
  168.  
  169.   -enable-* | --enable-*)
  170.     ac_feature=`/bin/echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
  171.     # Reject names that aren't valid shell variable names.
  172. changequote(,)dnl
  173.     if test -n "`/bin/echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
  174. changequote([,])dnl
  175.       AC_ERROR($ac_feature: invalid feature name)
  176.     fi
  177.     ac_feature=`/bin/echo $ac_feature| sed 's/-/_/g'`
  178.     case "$ac_option" in
  179.       *=*) ;;
  180.       *) ac_optarg=yes ;;
  181.     esac
  182.     eval "enable_${ac_feature}='$ac_optarg'" ;;
  183.  
  184.   # For backward compatibility, recognize -exec-prefix and --exec_prefix.
  185.   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
  186.   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
  187.   | --exec | --exe | --ex)
  188.     ac_prev=exec_prefix ;;
  189.   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
  190.   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
  191.   | --exec=* | --exe=* | --ex=*)
  192.     exec_prefix="$ac_optarg" ;;
  193.  
  194.   -gas | --gas | --ga | --g)
  195.     with_gas=yes ;; # Obsolete; use --with-gas.
  196.  
  197.   -help | --help | --hel | --he)
  198.     cat << EOF
  199. $ac_usage
  200. EOF
  201.     exit 0 ;;
  202.  
  203.   -host | --host | --hos | --ho)
  204.     ac_prev=host ;;
  205.   -host=* | --host=* | --hos=* | --ho=*)
  206.     host="$ac_optarg" ;;
  207.  
  208.   -nfp | --nfp | --nf)
  209.     with_fp=no ;; # Obsolete; use --without-fp.
  210.  
  211.   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  212.   | --no-cr | --no-c)
  213.     no_create=yes ;;
  214.  
  215.   -norecursion | --norecursion | --norecursio | --norecursi \
  216.   | --norecurs | --norecur | --norecu | --norec | --nore | --nor)
  217.     norecursion=yes ;;
  218.  
  219.   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  220.     ac_prev=prefix ;;
  221.   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  222.     prefix="$ac_optarg" ;;
  223.  
  224.   -program-prefix | --program-prefix | --program-prefi | --program-pref \
  225.   | --program-pre | --program-pr | --program-p)
  226.     ac_prev=program_prefix ;;
  227.   -program-prefix=* | --program-prefix=* | --program-prefi=* \
  228.   | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
  229.     program_prefix="$ac_optarg" ;;
  230.  
  231.   -program-suffix | --program-suffix | --program-suffi | --program-suff \
  232.   | --program-suf | --program-su | --program-s)
  233.     ac_prev=program_suffix ;;
  234.   -program-suffix=* | --program-suffix=* | --program-suffi=* \
  235.   | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
  236.     program_suffix="$ac_optarg" ;;
  237.  
  238.   -program-transform-name | --program-transform-name \
  239.   | --program-transform-nam | --program-transform-na \
  240.   | --program-transform-n | --program-transform- \
  241.   | --program-transform | --program-transfor \
  242.   | --program-transfo | --program-transf \
  243.   | --program-trans | --program-tran \
  244.   | --progr-tra | --program-tr | --program-t)
  245.     ac_prev=program_transform_name ;;
  246.   -program-transform-name=* | --program-transform-name=* \
  247.   | --program-transform-nam=* | --program-transform-na=* \
  248.   | --program-transform-n=* | --program-transform-=* \
  249.   | --program-transform=* | --program-transfor=* \
  250.   | --program-transfo=* | --program-transf=* \
  251.   | --program-trans=* | --program-tran=* \
  252.   | --progr-tra=* | --program-tr=* | --program-t=*)
  253.     program_transform_name="$ac_optarg" ;;
  254.  
  255.   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  256.   | -silent | --silent | --silen | --sile | --sil)
  257.     silent=yes ;;
  258.  
  259.   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
  260.     ac_prev=srcdir ;;
  261.   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
  262.     srcdir="$ac_optarg" ;;
  263.  
  264.   -target | --target | --targe | --targ | --tar | --ta | --t)
  265.     ac_prev=target ;;
  266.   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
  267.     target="$ac_optarg" ;;
  268.  
  269.   -v | -verbose | --verbose | --verbos | --verbo | --verb)
  270.     verbose=yes ;;
  271.  
  272.   -version | --version | --versio | --versi | --vers)
  273.     /bin/echo "configure generated by autoconf version AC_ACVERSION"
  274.     exit 0 ;;
  275.  
  276.   -with-* | --with-*)
  277.     ac_package=`/bin/echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
  278.     # Reject names that aren't valid shell variable names.
  279. changequote(,)dnl
  280.     if test -n "`/bin/echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
  281. changequote([,])dnl
  282.       AC_ERROR($ac_package: invalid package name)
  283.     fi
  284.     ac_package=`/bin/echo $ac_package| sed 's/-/_/g'`
  285.     case "$ac_option" in
  286.       *=*) ;;
  287.       *) ac_optarg=yes ;;
  288.     esac
  289.     eval "with_${ac_package}='$ac_optarg'" ;;
  290.  
  291.   -without-* | --without-*)
  292.     ac_package=`/bin/echo $ac_option|sed -e 's/-*without-//'`
  293.     # Reject names that aren't valid shell variable names.
  294. changequote(,)dnl
  295.     if test -n "`/bin/echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
  296. changequote([,])dnl
  297.       AC_ERROR($ac_package: invalid package name)
  298.     fi
  299.     ac_package=`/bin/echo $ac_package| sed 's/-/_/g'`
  300.     eval "with_${ac_package}=no" ;;
  301.  
  302.   --x) with_x=yes ;; # Obsolete; use --with-x.
  303.  
  304.   -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
  305.   | --x-incl | --x-inc | --x-in | --x-i)
  306.     ac_prev=x_includes ;;
  307.   -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
  308.   | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
  309.     x_includes="$ac_optarg" ;;
  310.  
  311.   -x-libraries | --x-libraries | --x-librarie | --x-librari \
  312.   | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
  313.     ac_prev=x_libraries ;;
  314.   -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
  315.   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
  316.     x_libraries="$ac_optarg" ;;
  317.  
  318.   -*) AC_ERROR([$ac_option: invalid option; use --help to show usage])
  319.     ;;
  320.  
  321.   *) 
  322. changequote(,)dnl
  323.     if test -n "`/bin/echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
  324. changequote([,])dnl
  325.       AC_WARN($ac_option: invalid host type)
  326.     fi
  327.     if test "x$nonopt" != xNONE; then
  328.       AC_ERROR(can only configure for one host and one target at a time)
  329.     fi
  330.     nonopt="$ac_option"
  331.     ;;
  332.  
  333.   esac
  334. done
  335.  
  336. if test -n "$ac_prev"; then
  337.   AC_ERROR(missing argument to --`/bin/echo $ac_prev | sed 's/_/-/g'`)
  338. fi
  339. ])dnl
  340. dnl
  341. define(AC_INIT,
  342. [#!/bin/sh
  343. AC_NOTICE
  344. AC_PARSEARGS
  345. AC_PREPARE($1)])dnl
  346. dnl
  347. define(AC_PREPARE,
  348. [trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
  349. trap 'rm -fr confdefs* $ac_clean_files' 0
  350.  
  351. # Save the original args if we used an alternate arg parser.
  352. ac_configure_temp="${configure_args-[$]*}"
  353. # Strip out --no-create and --norecursion so they don't pile up.
  354. configure_args=
  355. for ac_arg in $ac_configure_temp; do
  356.   case "$ac_arg" in
  357.   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  358.   | --no-cr | --no-c) ;;
  359.   -norecursion | --norecursion | --norecursio | --norecursi \
  360.   | --norecurs | --norecur | --norecu | --norec | --nore | --nor) ;;
  361.   *) configure_args="$configure_args $ac_arg" ;;
  362.   esac
  363. done
  364.  
  365. # NLS nuisances.
  366. # These must not be set unconditionally because not all systems understand
  367. # e.g. LANG=C (notably SCO).
  368. if test "${LC_ALL+set}" = 'set'; then LC_ALL=C; export LC_ALL; fi
  369. if test "${LANG+set}"   = 'set'; then LANG=C;   export LANG;   fi
  370.  
  371. # confdefs.h avoids OS command line length limits that DEFS can exceed.
  372. rm -rf conftest* confdefs.h
  373. # AIX cpp loses on an empty file, so make sure it contains at least a newline.
  374. /bin/echo > confdefs.h
  375.  
  376. # A filename unique to this package, relative to the directory that
  377. # configure is in, which we can look for to find out if srcdir is correct.
  378. ac_unique_file=$1
  379.  
  380. # Find the source files, if location was not specified.
  381. if test -z "$srcdir"; then
  382.   ac_srcdir_defaulted=yes
  383.   # Try the directory containing this script, then `..'.
  384.   ac_prog=[$]0
  385. changequote(,)dnl
  386.   ac_confdir=`/bin/echo $ac_prog|sed 's%/[^/][^/]*$%%'`
  387. changequote([,])dnl
  388.   test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
  389.   srcdir=$ac_confdir
  390.   if test ! -r $srcdir/$ac_unique_file; then
  391.     srcdir=..
  392.   fi
  393. fi
  394. if test ! -r $srcdir/$ac_unique_file; then
  395.   if test x$ac_srcdir_defaulted = xyes; then
  396.     AC_ERROR(can not find sources in ${ac_confdir} or ..)
  397.   else
  398.     AC_ERROR(can not find sources in ${srcdir})
  399.   fi
  400. fi
  401. AC_LANG_C
  402. ])dnl
  403. dnl
  404. define(AC_ENABLE,
  405. [[#] check whether --enable-$1 was given
  406. enableval="[$enable_]patsubst($1,-,_)"
  407. if test -n "$enableval"; then
  408.   ifelse([$2], , :, [$2])
  409. ifelse([$3], , , [else
  410.   $3
  411. ])dnl
  412. fi
  413. ])dnl
  414. dnl
  415. dnl Giving --with an argument is deprecated.
  416. define(AC_WITH,
  417. [[#] check whether --with-$1 or --without-$1 was given.
  418. withval="[$with_]patsubst($1,-,_)"
  419. if test -n "$withval"; then
  420.   ifelse([$2], , :, [$2])
  421. ifelse([$3], , , [else
  422.   $3
  423. ])dnl
  424. fi
  425. ])dnl
  426. dnl
  427. dnl Guess the value for the `prefix' variable by looking for
  428. dnl the argument program along PATH and taking its parent.
  429. dnl Example: if the argument is `gcc' and we find /usr/local/gnu/bin/gcc,
  430. dnl set `prefix' to /usr/local/gnu.
  431. define(AC_PREFIX,
  432. [if test -z "$prefix"
  433. then
  434.   AC_CHECKING([for $1 to derive installation directory prefix])
  435.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="$IFS:"
  436.   for ac_dir in $PATH; do
  437.     test -z "$ac_dir" && ac_dir=.
  438.     if test $ac_dir != . && test -f $ac_dir/$1; then
  439. changequote(,)dnl
  440.       # Not all systems have dirname.
  441.       prefix=`/bin/echo $ac_dir|sed 's%/[^/][^/]*$%%'`
  442. changequote([,])dnl
  443.       break
  444.     fi
  445.   done
  446.   IFS="$ac_save_ifs"
  447.   AC_VERBOSE(chose installation directory prefix ${prefix})
  448. fi
  449. ])dnl
  450. dnl
  451. define(AC_CONFIG_HEADER, [define(AC_CONFIG_NAMES, $1)])dnl
  452. dnl
  453. define(AC_DOREV, [#!/bin/sh
  454. # From configure.in $1
  455. ])dnl
  456. define(AC_REVISION, [AC_DOREV(translit($1,$"))])dnl
  457. dnl
  458. dnl Subroutines of AC_PREREQ.
  459. dnl
  460. dnl Change the dots in version number $1 into commas.
  461. define(AC_PREREQ_SPLIT, [translit($1,.,[,])])dnl
  462. dnl
  463. dnl Default the ternary version number to 0 (e.g., 1,7 -> 1,7,0).
  464. define(AC_PREREQ_CANON, [$1,$2,ifelse([$3],,0,[$3])])dnl
  465. dnl
  466. dnl Complain and exit if the version number in $1 through $3 is less than
  467. dnl the version number in $4 through $6.
  468. dnl $7 is the printable version of the second version number.
  469. define(AC_PREREQ_COMPARE,
  470. [ifelse(builtin([eval],
  471. [$3 + $2 * 100 + $1 * 10000 < $6 + $5 * 100 + $4 * 10000]),1,
  472. [errprint(Autoconf version $7 or higher is required
  473. )m4exit(3)])])dnl
  474. dnl
  475. dnl Complain and exit if the Autoconf version is less than $1.
  476. define(AC_PREREQ,
  477. [AC_PREREQ_COMPARE(AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)),
  478. AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),[$1])])dnl
  479. dnl
  480. dnl
  481. dnl Setting variables
  482. dnl
  483. dnl
  484. dnl Several simple subroutines to do various flavors of quoting.
  485. dnl
  486. dnl Quote $1 against shell "s.
  487. define(AC_QUOTE_DQUOTE, [dnl We use \1 instead of \& to avoid an m4 1.0.3 bug.
  488. patsubst($1, changequote(,)\([$"`\\]\)changequote([,]), \\\1)])dnl
  489. dnl
  490. dnl Quote $1 against shell 's.
  491. define(AC_QUOTE_SQUOTE, [patsubst($1, ', '\\'')])dnl
  492. dnl
  493. dnl Quote $1 against shell here documents (<<EOF).
  494. define(AC_QUOTE_HERE, [changequote({,})dnl
  495. dnl We use \1 instead of \& to avoid an m4 1.0.3 bug.
  496. patsubst(patsubst($1, \(\\[$`\\]\), \\\1), \([$`]\), \\\1){}dnl
  497. changequote([,])])dnl
  498. dnl
  499. dnl Quote $1 against the right hand side of a sed substitution.
  500. define(AC_QUOTE_SED, [changequote({,})dnl
  501. dnl We use \1 instead of \& to avoid an m4 1.0.3 bug.
  502. dnl % and @ and ! are commonly used as the sed s separator character.
  503. patsubst($1, \([&\\%@!]\), \\\1){}dnl
  504. changequote([,])])dnl
  505. dnl
  506. dnl Quote $1 against tokenization.
  507. define(AC_QUOTE_TOKEN, [changequote({,})dnl
  508. patsubst($1, \([     ]\), \\\1){}dnl
  509. changequote([,])])dnl
  510. dnl
  511. dnl Subroutines of AC_DEFINE.  Does more quoting magic than any sane person
  512. dnl should be able to understand.  The point of it all is that what goes into
  513. dnl Makefile et al should be verbatim what was written in configure.in.
  514. define(AC_DEFINE_QUOTE, [dnl
  515. AC_QUOTE_TOKEN(AC_QUOTE_SQUOTE(AC_QUOTE_DQUOTE($1)))])dnl
  516. dnl
  517. define(AC_DEFINE_SEDQUOTE, [dnl
  518. AC_QUOTE_DQUOTE(AC_QUOTE_HERE(AC_QUOTE_HERE(AC_QUOTE_SED($1))))])dnl
  519. dnl
  520. dnl Don't compare $2 to a blank, so we can support "-Dfoo=".
  521. dnl If creating a configuration header file, we add
  522. dnl commands to ac_sed_defs to define the variable.  ac_[due][ABCD]
  523. dnl get defined in config.status.  Here we just insert the
  524. dnl variable parts of the string: the variable name to define
  525. dnl and the value to give it.
  526. dnl The newlines around the curly braces prevent sh syntax errors.
  527. define(AC_DEFINE,[
  528. {
  529. dnl Uniformly use AC_DEFINE_[SED]QUOTE, so callers of AC_DEFINE_UNQUOTED
  530. dnl can use AC_QUOTE_* manually if they want to.
  531. test -n "$verbose" && \
  532. ifelse($#, 2,
  533. [define([AC_VAL], $2)dnl
  534. /bin/echo "    defining" $1 to be ifelse(AC_VAL,, empty, "AC_QUOTE_SQUOTE(AC_VAL)")],
  535. [define([AC_VAL], 1)dnl
  536. /bin/echo "    defining $1"])
  537. dnl
  538. /bin/echo "[#][define]" $1 "AC_QUOTE_SQUOTE(AC_VAL)" >> confdefs.h
  539. dnl Define DEFS even if AC_CONFIG_NAMES for use in user case statements.
  540. DEFS="$DEFS -D$1=AC_QUOTE_SQUOTE(AC_VAL)"
  541. ifdef([AC_CONFIG_NAMES],
  542. ac_sed_defs="dnl
  543. ${ac_sed_defs}\${ac_dA}$1\${ac_dB}$1\${ac_dC}AC_DEFINE_SEDQUOTE(AC_VAL)\${ac_dD}
  544. \${ac_uA}$1\${ac_uB}$1\${ac_uC}AC_DEFINE_SEDQUOTE(AC_VAL)\${ac_uD}
  545. \${ac_eA}$1\${ac_eB}$1\${ac_eC}AC_DEFINE_SEDQUOTE(AC_VAL)\${ac_eD}
  546. "
  547. )dnl
  548. }
  549. ])dnl
  550. dnl
  551. dnl Unsafe version of AC_DEFINE.
  552. dnl Users are responsible for the quoting nightmare.
  553. dnl Well, not all of it.  We need to pull the identify function out to
  554. dnl the top level, because m4 doesn't really support nested functions;
  555. dnl it doesn't distinguish between the arguments to the outer
  556. dnl function, which should be expanded, and the arguments to the inner
  557. dnl function, which shouldn't yet.
  558. define(AC_IDENTITY,$1)dnl
  559. define(AC_DEFINE_UNQUOTED,[dnl
  560. pushdef([AC_QUOTE_SQUOTE],defn([AC_IDENTITY]))dnl
  561. pushdef([AC_DEFINE_SEDQUOTE],defn([AC_IDENTITY]))dnl
  562. AC_DEFINE($1,$2)dnl
  563. popdef([AC_DEFINE_SEDQUOTE])dnl
  564. popdef([AC_QUOTE_SQUOTE])dnl
  565. ])dnl
  566. dnl
  567. dnl Protects the argument from being diverted twice
  568. dnl if this macro is called twice for it.
  569. dnl Diversion 0 is the normal output.
  570. dnl Diversion 1 is sed substitutions for output files.
  571. dnl Diversion 2 is variable assignments for config.status.
  572. define(AC_SUBST,
  573. [ifdef([AC_SUBST_$1], ,
  574. [define([AC_SUBST_$1], )dnl
  575. divert(1)dnl
  576. s%@$1@%[$]$1%g
  577. divert(2)dnl
  578. $1='[$]$1'
  579. divert(0)dnl
  580. ])])dnl
  581. dnl
  582. dnl
  583. dnl Printing messages
  584. dnl
  585. dnl
  586. define(AC_CHECKING,
  587. [test -n "$silent" || /bin/echo "checking $1"])dnl
  588. dnl
  589. define(AC_VERBOSE,
  590. [test -n "$verbose" && /bin/echo "    $1"])dnl
  591. dnl
  592. define(AC_WARN,
  593. [/bin/echo "configure: warning: $1" >&2])dnl
  594. dnl
  595. define(AC_ERROR,
  596. [/bin/echo "configure: $1" >&2; exit 1])dnl
  597. dnl
  598. dnl
  599. dnl Selecting which language to use for testing
  600. dnl
  601. dnl
  602. define(AC_LANG_C,
  603. [define([AC_LANG],[C])AC_PROVIDE([$0])ac_ext=c
  604. ac_cpp='${CPP} $CFLAGS'
  605. ac_compile='${CC-cc} $CFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS >/dev/null 2>&1'
  606. ])dnl
  607. dnl
  608. define(AC_LANG_CPLUSPLUS,
  609. [define([AC_LANG],[CPLUSPLUS])AC_PROVIDE([$0])ac_ext=C
  610. ac_cpp='${CXXCPP} $CXXFLAGS'
  611. ac_compile='${CXX-gcc} $CXXFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS >/dev/null 2>&1'
  612. ])dnl
  613. dnl
  614. dnl Push the current language on a stack.
  615. define(AC_LANG_SAVE, [pushdef([AC_LANG_STACK], AC_LANG)])dnl
  616. dnl
  617. dnl Restore the current language from the stack.
  618. define(AC_LANG_RESTORE,
  619. [ifelse(AC_LANG_STACK,C,[ifelse(AC_LANG,C,,[AC_LANG_C])],[ifelse(AC_LANG,CPLUSPLUS,,[AC_LANG_CPLUSPLUS])])[]popdef([AC_LANG_STACK])])dnl
  620. dnl
  621. dnl
  622. dnl Enforcing ordering constraints
  623. dnl
  624. dnl
  625. define(AC_BEFORE,
  626. [ifdef([AC_PROVIDE_$2], [errprint(__file__:__line__: [$2 was called before $1
  627. ])])])dnl
  628. dnl
  629. define(AC_REQUIRE,
  630. [ifdef([AC_PROVIDE_$1],,[indir([$1])
  631. ])])dnl
  632. dnl
  633. define(AC_PROVIDE,
  634. [define([AC_PROVIDE_$1],)])dnl
  635. dnl
  636. define(AC_OBSOLETE,
  637. [errprint(__file__:__line__: warning: [$1] is obsolete[$2]
  638. )])dnl
  639. dnl
  640. dnl
  641. dnl Checking for kinds of features
  642. dnl
  643. dnl
  644. define(AC_PROGRAM_CHECK,
  645. [if test -z "[$]$1"; then
  646.   # Extract the first word of `$2', so it can be a program name with args.
  647.   set ac_dummy $2; ac_word=[$]2
  648.   AC_CHECKING([for $ac_word])
  649.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  650.   for ac_dir in $PATH; do
  651.     test -z "$ac_dir" && ac_dir=.
  652.     if test -f $ac_dir/$ac_word; then
  653.       $1="$3"
  654.       break
  655.     fi
  656.   done
  657.   IFS="$ac_save_ifs"
  658. fi
  659. ifelse([$4],,, [test -z "[$]$1" && $1="$4"])
  660. test -n "[$]$1" && AC_VERBOSE(setting $1 to [$]$1)
  661. AC_SUBST($1)dnl
  662. ])dnl
  663. dnl
  664. define(AC_PROGRAMS_CHECK,
  665. [for ac_prog in $2
  666. do
  667. AC_PROGRAM_CHECK($1, [$]ac_prog, [$]ac_prog, )
  668. test -n "[$]$1" && break
  669. done
  670. ifelse([$3],,, [test -n "[$]$1" || $1="$3"
  671. ])])dnl
  672. dnl
  673. define(AC_PROGRAM_PATH,
  674. [if test -z "[$]$1"; then
  675.   # Extract the first word of `$2', so it can be a program name with args.
  676.   set ac_dummy $2; ac_word=[$]2
  677.   AC_CHECKING([for $ac_word])
  678.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  679.   for ac_dir in $PATH; do
  680.     test -z "$ac_dir" && ac_dir=.
  681.     if test -f $ac_dir/$ac_word; then
  682.       $1="$ac_dir/$ac_word"
  683.       break
  684.     fi
  685.   done
  686.   IFS="$ac_save_ifs"
  687. fi
  688. ifelse([$3],,, [test -z "[$]$1" && $1="$3"])
  689. test -n "[$]$1" && AC_VERBOSE(setting $1 to [$]$1)
  690. AC_SUBST($1)dnl
  691. ])dnl
  692. define(AC_PROGRAMS_PATH,
  693. [for ac_prog in $2
  694. do
  695. AC_PROGRAM_PATH($1, [$]ac_prog)
  696. test -n "[$]$1" && break
  697. done
  698. ifelse([$3],,, [test -n "[$]$1" || $1="$3"
  699. ])])dnl
  700. define(AC_HEADER_EGREP,
  701. [AC_REQUIRE_CPP()AC_PROVIDE([$0])/bin/echo '#include "confdefs.h"
  702. #include <$2>' > conftest.${ac_ext}
  703. eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
  704. if egrep "$1" conftest.out >/dev/null 2>&1; then
  705.   ifelse([$3], , :, [rm -rf conftest*
  706.   $3
  707. ])
  708. ifelse([$4], , , [else
  709.   rm -rf conftest*
  710.   $4
  711. ])dnl
  712. fi
  713. rm -f conftest*
  714. ])dnl
  715. dnl
  716. dnl Because this macro is used by AC_GCC_TRADITIONAL, which must come early,
  717. dnl it is not included in AC_BEFORE checks.
  718. define(AC_PROGRAM_EGREP,
  719. [AC_REQUIRE_CPP()AC_PROVIDE([$0])cat > conftest.${ac_ext} <<EOF
  720. #include "confdefs.h"
  721. [$2]
  722. EOF
  723. eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
  724. if egrep "$1" conftest.out >/dev/null 2>&1; then
  725.   ifelse([$3], , :, [rm -rf conftest*
  726.   $3
  727. ])
  728. ifelse([$4], , , [else
  729.   rm -rf conftest*
  730.   $4
  731. ])dnl
  732. fi
  733. rm -f conftest*
  734. ])dnl
  735. dnl
  736. define(AC_HEADER_CHECK,
  737. [AC_CHECKING([for $1])
  738. ifelse([$3], , [AC_TEST_CPP([#include <$1>], [$2])],
  739. [AC_TEST_CPP([#include <$1>], [$2], [$3])])
  740. ])dnl
  741. dnl
  742. define(AC_COMPILE_CHECK,
  743. [AC_PROVIDE([$0])dnl
  744. ifelse([$1], , , [AC_CHECKING([for $1])]
  745. )dnl
  746. dnl We use return because because C++ requires a prototype for exit.
  747. cat > conftest.${ac_ext} <<EOF
  748. #include "confdefs.h"
  749. [$2]
  750. int main() { return 0; }
  751. int t() { [$3]; return 0; }
  752. EOF
  753. dnl Don't try to run the program, which would prevent cross-configuring.
  754. if eval $ac_compile; then
  755.   ifelse([$4], , :, [rm -rf conftest*
  756.   $4
  757. ])
  758. ifelse([$5], , , [else
  759.   rm -rf conftest*
  760.   $5
  761. ])dnl
  762. fi
  763. rm -f conftest*]
  764. )dnl
  765. dnl
  766. define(AC_TEST_PROGRAM,
  767. [AC_PROVIDE([$0])ifelse([$4], , , [AC_REQUIRE([AC_CROSS_CHECK])if test -n "$cross_compiling"
  768. then
  769.   $4
  770. else
  771. ])dnl
  772. cat > conftest.${ac_ext} <<EOF
  773. #include "confdefs.h"
  774. [$1]
  775. EOF
  776. eval $ac_compile
  777. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  778.   ifelse([$2], , :, [$2
  779. ])
  780. ifelse([$3], , , [else
  781.   $3
  782. ])dnl
  783. fi
  784. ifelse([$4], , , fi
  785. )dnl
  786. rm -fr conftest*])dnl
  787. dnl
  788. define(AC_TEST_CPP,
  789. [AC_REQUIRE_CPP()dnl
  790. cat > conftest.${ac_ext} <<EOF
  791. #include "confdefs.h"
  792. [$1]
  793. EOF
  794. # Some shells (Coherent) do redirections in the wrong order, so need
  795. # the parens.
  796. ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
  797. if test -z "$ac_err"; then
  798.   ifelse([$2], , :, [rm -rf conftest*
  799.   $2
  800. ])
  801. ifelse([$3], , , [else
  802.   rm -rf conftest*
  803.   $3
  804. ])dnl
  805. fi
  806. rm -f conftest*])dnl
  807. dnl
  808. define(AC_REPLACE_FUNCS,
  809. [for ac_func in $1
  810. do
  811. AC_COMPILE_CHECK([${ac_func}], [#include <ctype.h>], [
  812. /* The GNU C library defines this for functions which it implements
  813.     to always fail with ENOSYS.  Some functions are actually named
  814.     something starting with __ and the normal name is an alias.  */
  815. #if defined (__stub_${ac_func}) || defined (__stub___${ac_func})
  816. choke me
  817. #else
  818. /* Override any gcc2 internal prototype to avoid an error.  */
  819. extern char ${ac_func}(); ${ac_func}();
  820. #endif
  821. ], , [LIBOBJS="$LIBOBJS ${ac_func}.o"
  822. AC_VERBOSE(using ${ac_func}.o instead)])
  823. done
  824. AC_SUBST(LIBOBJS)dnl
  825. ])dnl
  826. dnl
  827. define(AC_FUNC_CHECK,
  828. [ifelse([$3], , [AC_COMPILE_CHECK($1, [#include <ctype.h>], [
  829. /* The GNU C library defines this for functions which it implements
  830.     to always fail with ENOSYS.  Some functions are actually named
  831.     something starting with __ and the normal name is an alias.  */
  832. #if defined (__stub_$1) || defined (__stub___$1)
  833. choke me
  834. #else
  835. /* Override any gcc2 internal prototype to avoid an error.  */
  836. extern char $1(); $1();
  837. #endif
  838. ],
  839. $2)], [AC_COMPILE_CHECK($1, [#include <ctype.h>], [
  840. /* The GNU C library defines this for functions which it implements
  841.     to always fail with ENOSYS.  Some functions are actually named
  842.     something starting with __ and the normal name is an alias.  */
  843. #if defined (__stub_$1) || defined (__stub___$1)
  844. choke me
  845. #else
  846. /* Override any gcc2 internal prototype to avoid an error.  */
  847. extern char $1(); $1();
  848. #endif
  849. ],
  850. $2, $3)])dnl
  851. ])dnl
  852. dnl
  853. define(AC_HAVE_FUNCS,
  854. [for ac_func in $1
  855. do
  856. changequote(,)dnl
  857. ac_tr_func=HAVE_`/bin/echo $ac_func | tr '[a-z]' '[A-Z]'`
  858. changequote([,])dnl
  859. AC_FUNC_CHECK(${ac_func},
  860. AC_DEFINE(${ac_tr_func}))dnl
  861. done
  862. ])dnl
  863. dnl
  864. define(AC_HAVE_HEADERS,
  865. [AC_REQUIRE_CPP()dnl Make sure the cpp check happens outside the loop.
  866. for ac_hdr in $1
  867. do
  868. changequote(,)dnl
  869. ac_tr_hdr=HAVE_`/bin/echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
  870. changequote([,])dnl
  871. AC_HEADER_CHECK(${ac_hdr},
  872. AC_DEFINE(${ac_tr_hdr}))dnl
  873. done
  874. ])dnl
  875. dnl
  876. define(AC_HAVE_LIBRARY, [dnl
  877. changequote(/,/)dnl
  878. define(/AC_LIB_NAME/, dnl
  879. patsubst(patsubst($1, /lib\([^\.]*\)\.a/, /\1/), /-l/, //))dnl
  880. changequote([,])dnl
  881. ac_save_LIBS="${LIBS}"
  882. LIBS="${LIBS} -l[]AC_LIB_NAME[]"
  883. ac_have_lib=""
  884. AC_COMPILE_CHECK([-l[]AC_LIB_NAME[]], , [main();], [ac_have_lib="1"])dnl
  885. LIBS="${ac_save_LIBS}"
  886. ifelse($#, 1, [dnl
  887. if test -n "${ac_have_lib}"; then
  888.    AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z]))
  889.    LIBS="${LIBS} -l[]AC_LIB_NAME[]"
  890. fi
  891. undefine(AC_LIB_NAME)dnl
  892. ], [dnl
  893. if test -n "${ac_have_lib}"; then
  894.    :; $2
  895. else
  896.    :; $3
  897. fi
  898. ])])dnl
  899. dnl
  900. define(AC_SIZEOF_TYPE,
  901. [AC_CHECKING(size of $1)
  902. ac_size=0
  903. AC_TEST_PROGRAM([#include <stdio.h>
  904. main()
  905. {
  906.   FILE *f=fopen("conftestval", "w");
  907.   if (!f) exit(1);
  908.   fprintf(f, "%d\n", sizeof($1));
  909.   exit(0);
  910. }], ac_size=`cat conftestval`)
  911. AC_DEFINE_UNQUOTED(changequote(<<,>>) translit(sizeof_$1, [a-z *], [A-Z_P])<<>>changequote([,]), $ac_size)])dnl
  912. dnl
  913. dnl
  914. dnl The big finish
  915. dnl
  916. dnl
  917. define(AC_OUTPUT,
  918. [changequote(,)dnl
  919. # Set default prefixes.
  920. if test -n "$prefix"; then
  921.   test -z "$exec_prefix" && exec_prefix='${prefix}' # Let make expand it.
  922.   ac_prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  923. fi
  924. if test -n "$exec_prefix"; then
  925.   ac_prsub="$ac_prsub
  926. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
  927. fi
  928. # Any assignment to VPATH causes Sun make to only execute
  929. # the first set of double-colon rules, so remove it if not needed.
  930. # If there is a colon in the path, we need to keep it.
  931. if test "x$srcdir" = x.; then
  932.   ac_vpsub='/^[     ]*VPATH[     ]*=[^:]*$/d'
  933. fi
  934.  
  935. # Quote sed substitution magic chars in DEFS.
  936. cat >conftest.def <<EOF
  937. $DEFS
  938. EOF
  939. ac_escape_ampersand_and_backslash='s%[&\\]%\\&%g'
  940. DEFS=`sed "$ac_escape_ampersand_and_backslash" <conftest.def`
  941. rm -f conftest.def
  942. # Substitute for predefined variables.
  943. changequote([,])dnl
  944. AC_SUBST(LIBS)dnl
  945. AC_SUBST(srcdir)dnl
  946. AC_SUBST(top_srcdir)dnl
  947. AC_SUBST(prefix)dnl
  948. AC_SUBST(exec_prefix)dnl
  949. dnl Substituting for DEFS would confuse sed if it contains multiple lines.
  950. ifdef([AC_CONFIG_NAMES],
  951. [divert(1)dnl
  952. s%@DEFS@%-DHAVE_CONFIG_H%],
  953. [divert(1)dnl
  954. s%@DEFS@%$DEFS%]
  955. [divert(2)dnl
  956. DEFS='$DEFS'
  957. ])dnl
  958. divert(2)dnl
  959. ac_prsub='$ac_prsub'
  960. ac_vpsub='$ac_vpsub'
  961. extrasub='$extrasub'
  962. divert(0)dnl
  963.  
  964. trap 'rm -f config.status; exit 1' 1 2 15
  965. /bin/echo creating config.status
  966. rm -f config.status
  967. cat > config.status <<EOF
  968. #!/bin/sh
  969. # Generated automatically by configure.
  970. # Run this file to recreate the current configuration.
  971. # This directory was configured as follows,
  972. dnl hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
  973. dnl so uname gets run too.
  974. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  975. #
  976. [#] [$]0 [$]configure_args
  977.  
  978. changequote(,)dnl
  979. ac_cs_usage="Usage: config.status [--recheck] [--version] [--help]"
  980. changequote([,])dnl
  981. for ac_option
  982. do
  983.   case "[\$]ac_option" in
  984.   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  985.     /bin/echo running [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args --no-create
  986.     exec [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args --no-create ;;
  987.   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
  988.     /bin/echo "config.status generated by autoconf version AC_ACVERSION"
  989.     exit 0 ;;
  990.   -help | --help | --hel | --he | --h)
  991.     /bin/echo "[\$]ac_cs_usage"; exit 0 ;;
  992.   *) /bin/echo "[\$]ac_cs_usage"; exit 1 ;;
  993.   esac
  994. done
  995.  
  996. ifdef([AC_CONFIG_NAMES],
  997. [trap 'rm -fr $1 AC_CONFIG_NAMES conftest*; exit 1' 1 2 15],
  998. [trap 'rm -f $1; exit 1' 1 2 15])
  999. dnl Insert the variable assignments.
  1000. undivert(2)dnl
  1001. EOF
  1002. cat >> config.status <<\EOF
  1003.  
  1004. ac_given_srcdir=$srcdir
  1005.  
  1006. CONFIG_FILES=${CONFIG_FILES-"$1"}
  1007. for ac_file in .. ${CONFIG_FILES}; do if test "x$ac_file" != x..; then
  1008.   # Remove last slash and all that follows it.  Not all systems have dirname.
  1009. changequote(,)dnl
  1010.   ac_dir=`/bin/echo $ac_file|sed 's%/[^/][^/]*$%%'`
  1011. changequote([,])dnl
  1012.   if test "$ac_dir" != "$ac_file"; then
  1013.     # The file is in a subdirectory.
  1014.     test ! -d "$ac_dir" && mkdir "$ac_dir"
  1015.     ac_dir_suffix="/$ac_dir"
  1016.   else
  1017.     ac_dir_suffix=
  1018.   fi
  1019.  
  1020. changequote(,)dnl
  1021.   # A "../" for each directory in $ac_dir_suffix.
  1022.   ac_dots=`/bin/echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
  1023. changequote([,])dnl
  1024.   case "$ac_given_srcdir" in
  1025.   .)  srcdir=.; top_srcdir="$ac_dots." ;;
  1026.   /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
  1027.   *) # Relative path.
  1028.     srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
  1029.     top_srcdir="$ac_dots$ac_given_srcdir" ;;
  1030.   esac
  1031.  
  1032.   /bin/echo creating "$ac_file"
  1033.   rm -f "$ac_file"
  1034.   comment_str="Generated automatically from `/bin/echo $ac_file|sed 's|.*/||'`.in by configure."
  1035.   case "$ac_file" in
  1036.     *.c | *.h | *.C | *.cc | *.m )  /bin/echo "/* $comment_str */" > "$ac_file" ;;
  1037.     * )          /bin/echo "# $comment_str"     > "$ac_file" ;;
  1038.   esac
  1039.   sed -e "
  1040. $ac_prsub
  1041. $ac_vpsub
  1042. dnl Shell code in configure.in might set extrasub.
  1043. $extrasub
  1044. dnl Insert the sed substitutions.
  1045. undivert(1)dnl
  1046. " $ac_given_srcdir/${ac_file}.in >> $ac_file
  1047. fi; done
  1048. AC_OUTPUT_HEADER
  1049. $2
  1050. exit 0
  1051. EOF
  1052. chmod +x config.status
  1053. test -n "$no_create" || ${CONFIG_SHELL-/bin/sh} config.status
  1054. ])dnl
  1055. dnl This is a subroutine of AC_OUTPUT, broken out primarily to avoid bugs
  1056. dnl with long definitions in GNU m4 1.0.  This is called inside a quoted
  1057. dnl here document whose contents are going into config.status.
  1058. define(AC_OUTPUT_HEADER,[dnl
  1059. ifdef([AC_CONFIG_NAMES],[dnl
  1060. changequote(<<,>>)dnl
  1061.  
  1062. # These sed commands are put into ac_sed_defs when defining a macro.
  1063. # They are broken into pieces to make the sed script easier to manage.
  1064. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  1065. # is the cpp macro being defined and VALUE is the value it is being given.
  1066. # Each defining turns into a single global substitution command.
  1067. # Hopefully no one uses "!" as a variable value.
  1068. # Other candidates for the sed separators, like , and @, do get used.
  1069. #
  1070. # ac_d sets the value in "#define NAME VALUE" lines.
  1071. ac_dA='s!^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  1072. ac_dB='\([     ][     ]*\)[^     ]*!\1#\2'
  1073. ac_dC='\3'
  1074. ac_dD='!g'
  1075. # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  1076. ac_uA='s!^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  1077. ac_uB='\([     ]\)!\1#\2define\3'
  1078. ac_uC=' '
  1079. ac_uD='\4!g'
  1080. # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  1081. ac_eA='s!^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  1082. ac_eB='<<$>>!\1#\2define\3'
  1083. ac_eC=' '
  1084. ac_eD='!g'
  1085. changequote([,])dnl
  1086. rm -f conftest.sed
  1087. EOF
  1088. # Turn off quoting long enough to insert the sed commands.
  1089. rm -f conftest.sh
  1090. cat > conftest.sh <<EOF
  1091. $ac_sed_defs
  1092. EOF
  1093.  
  1094. # Break up $ac_sed_defs (now in conftest.sh) because some shells have a limit
  1095. # on the size of here documents.
  1096.  
  1097. # Maximum number of lines to put in a single here document.
  1098. ac_max_sh_lines=9
  1099.  
  1100. while :
  1101. do
  1102.   # wc gives bogus results for an empty file on some AIX systems.
  1103.   ac_lines=`grep -c . conftest.sh`
  1104.   if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
  1105.   rm -f conftest.s1 conftest.s2
  1106.   sed ${ac_max_sh_lines}q conftest.sh > conftest.s1 # Like head -20.
  1107.   sed 1,${ac_max_sh_lines}d conftest.sh > conftest.s2 # Like tail +21.
  1108.   # Write a limited-size here document to append to conftest.sed.
  1109.   /bin/echo 'cat >> conftest.sed <<CONFEOF' >> config.status
  1110.   cat conftest.s1 >> config.status
  1111.   /bin/echo 'CONFEOF' >> config.status
  1112.   rm -f conftest.s1 conftest.sh
  1113.   mv conftest.s2 conftest.sh
  1114. done
  1115. rm -f conftest.sh
  1116.  
  1117. # Now back to your regularly scheduled config.status.
  1118. cat >> config.status <<\EOF
  1119. # This sed command replaces #undef's with comments.  This is necessary, for
  1120. # example, in the case of _POSIX_SOURCE, which is predefined and required
  1121. # on some systems where configure will not decide to define it in
  1122. [#] AC_CONFIG_NAMES.
  1123. cat >> conftest.sed <<\CONFEOF
  1124. changequote(,)dnl
  1125. s,^[     ]*#[     ]*undef[     ][     ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
  1126. changequote([,])dnl
  1127. CONFEOF
  1128. rm -f conftest.h
  1129. # Break up the sed commands because old seds have small limits.
  1130. ac_max_sed_lines=20
  1131.  
  1132. CONFIG_HEADERS=${CONFIG_HEADERS-"AC_CONFIG_NAMES"}
  1133. for ac_file in .. ${CONFIG_HEADERS}; do if test "x$ac_file" != x..; then
  1134.   /bin/echo creating $ac_file
  1135.  
  1136.   cp $ac_given_srcdir/$ac_file.in conftest.h1
  1137.   while :
  1138.   do
  1139.     ac_lines=`grep -c . conftest.sed`
  1140.     if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
  1141.     rm -f conftest.s1 conftest.s2 conftest.h2
  1142.     sed ${ac_max_sed_lines}q conftest.sed > conftest.s1 # Like head -20.
  1143.     sed 1,${ac_max_sed_lines}d conftest.sed > conftest.s2 # Like tail +21.
  1144.     sed -f conftest.s1 < conftest.h1 > conftest.h2
  1145.     rm -f conftest.s1 conftest.h1 conftest.sed
  1146.     mv conftest.h2 conftest.h1
  1147.     mv conftest.s2 conftest.sed
  1148.   done
  1149.   rm -f conftest.sed conftest.h
  1150.   /bin/echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
  1151.   cat conftest.h1 >> conftest.h
  1152.   rm -f conftest.h1
  1153.   if cmp -s $ac_file conftest.h 2>/dev/null; then
  1154.     # The file exists and we would not be changing it.
  1155.     /bin/echo "$ac_file is unchanged"
  1156.     rm -f conftest.h
  1157.   else
  1158.     rm -f $ac_file
  1159.     mv conftest.h $ac_file
  1160.   fi
  1161. fi; done
  1162.  
  1163. ])])dnl
  1164.