mirror of
git://git.sv.gnu.org/autoconf
synced 2024-12-09 02:10:22 +08:00
1758 lines
52 KiB
Plaintext
1758 lines
52 KiB
Plaintext
dnl Parameterized macros that do not check for something specific.
|
|
dnl Requires GNU m4.
|
|
dnl This file is part of Autoconf.
|
|
dnl Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
|
|
dnl
|
|
dnl This program is free software; you can redistribute it and/or modify
|
|
dnl it under the terms of the GNU General Public License as published by
|
|
dnl the Free Software Foundation; either version 2, or (at your option)
|
|
dnl any later version.
|
|
dnl
|
|
dnl This program is distributed in the hope that it will be useful,
|
|
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
dnl GNU General Public License for more details.
|
|
dnl
|
|
dnl You should have received a copy of the GNU General Public License
|
|
dnl along with this program; if not, write to the Free Software
|
|
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
dnl
|
|
dnl Written by David MacKenzie, with help from
|
|
dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
|
|
dnl Roland McGrath, Noah Friedman, and david d zuhn.
|
|
dnl
|
|
changequote([, ])dnl
|
|
undefine([eval])dnl
|
|
undefine([include])dnl
|
|
undefine([shift])dnl
|
|
undefine([format])dnl
|
|
dnl
|
|
dnl Some old m4's don't support m4exit. But they provide
|
|
dnl equivalent functionality by core dumping because of the
|
|
dnl long macros we define.
|
|
ifdef([__gnu__], , [errprint(Autoconf requires GNU m4.
|
|
Install it before installing Autoconf or set the
|
|
M4 environment variable to its path name.
|
|
)m4exit(2)])dnl
|
|
dnl
|
|
define(AC_ACVERSION, 1.102)dnl
|
|
dnl This is defined by the --version option of the autoconf script.
|
|
ifdef([AC_PRINT_VERSION], [Autoconf version AC_ACVERSION
|
|
m4exit(0)])dnl
|
|
dnl
|
|
dnl
|
|
dnl ### Controlling Autoconf operation
|
|
dnl
|
|
dnl
|
|
dnl m4 diversions:
|
|
define(AC_DIVERSION_NORMAL, 0)dnl normal output
|
|
define(AC_DIVERSION_SED, 1)dnl sed substitutions for config.status
|
|
define(AC_DIVERSION_HELP, 3)dnl --enable/--with help strings
|
|
define(AC_DIVERSION_ARG, 4)dnl --enable/--with actions
|
|
divert(AC_DIVERSION_NORMAL)dnl
|
|
dnl
|
|
dnl Define a macro which automatically provides itself.
|
|
dnl Use instead of define for macros to be used as functions.
|
|
dnl AC_DEFUN(NAME, EXPANSION)
|
|
define([AC_DEFUN],
|
|
[define($1,
|
|
[define([AC_PROVIDE_$1], )][$2])])dnl
|
|
dnl
|
|
dnl AC_INIT_NOTICE()
|
|
AC_DEFUN(AC_INIT_NOTICE,
|
|
[# Guess values for system-dependent variables and create Makefiles.
|
|
# Generated automatically using autoconf version] AC_ACVERSION [
|
|
# Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
|
#
|
|
# This configure script is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License as published
|
|
# by the Free Software Foundation; either version 2, or (at your option)
|
|
# any later version.
|
|
#
|
|
# This script is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
# Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
])dnl
|
|
dnl
|
|
dnl AC_INIT_PARSE_ARGS()
|
|
AC_DEFUN(AC_INIT_PARSE_ARGS,
|
|
[AC_BEFORE([$0], [AC_ARG_ENABLE])dnl
|
|
AC_BEFORE([$0], [AC_ARG_WITH])dnl
|
|
# Save the original args to write them into config.status later.
|
|
configure_args="[$]@"
|
|
|
|
# Omit some internal, obsolete, or unimplemented options to make the
|
|
# list less imposing.
|
|
changequote(, )dnl
|
|
ac_usage="Usage: configure [options] [host]
|
|
Options: [defaults in brackets after descriptions]
|
|
Configuration:
|
|
--cache-file=FILE cache test results in FILE
|
|
--help print this message
|
|
--no-create do not create output files
|
|
--quiet, --silent do not print \`checking...' messages
|
|
--version print the version of autoconf that created configure
|
|
Directories:
|
|
--exec-prefix=PREFIX install host dependent files in PREFIX [/usr/local]
|
|
--prefix=PREFIX install host independent files in PREFIX [/usr/local]
|
|
--srcdir=DIR find the sources in DIR [configure dir or ..]
|
|
Host type:
|
|
--build=BUILD configure for building on BUILD [BUILD=HOST]
|
|
--host=HOST configure for HOST [guessed]
|
|
--target=TARGET configure for TARGET [TARGET=HOST]
|
|
Features and packages:
|
|
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
|
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
|
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
|
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
|
|
--x-includes=DIR X include files are in DIR
|
|
--x-libraries=DIR X library files are in DIR
|
|
|
|
--enable/--with options recognized:
|
|
undivert(AC_DIVERSION_HELP)"dnl
|
|
changequote([, ])dnl
|
|
|
|
# Initialize some variables set by options.
|
|
# The variables have the same names as the options, with
|
|
# dashes changed to underlines.
|
|
build=NONE
|
|
cache_file=./config.cache
|
|
exec_prefix=NONE
|
|
host=NONE
|
|
no_create=
|
|
nonopt=NONE
|
|
norecursion=
|
|
prefix=NONE
|
|
program_prefix=
|
|
program_suffix=
|
|
program_transform_name=
|
|
silent=
|
|
srcdir=
|
|
target=NONE
|
|
verbose=
|
|
x_includes=NONE
|
|
x_libraries=NONE
|
|
|
|
# Initialize some other variables.
|
|
subdirs=
|
|
|
|
ac_prev=
|
|
for ac_option
|
|
do
|
|
|
|
# If the previous option needs an argument, assign it.
|
|
if test -n "$ac_prev"; then
|
|
eval "$ac_prev=\$ac_option"
|
|
ac_prev=
|
|
continue
|
|
fi
|
|
|
|
case "$ac_option" in
|
|
changequote(, )dnl
|
|
-*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
|
changequote([, ])dnl
|
|
*) ac_optarg= ;;
|
|
esac
|
|
|
|
# Accept (but ignore some of) the important Cygnus configure
|
|
# options, so we can diagnose typos.
|
|
|
|
case "$ac_option" in
|
|
|
|
-build | --build | --buil | --bui | --bu | --b)
|
|
ac_prev=build ;;
|
|
-build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
|
|
build="$ac_optarg" ;;
|
|
|
|
-cache-file | --cache-file | --cache-fil | --cache-fi \
|
|
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
|
|
ac_prev=cache_file ;;
|
|
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
|
|
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
|
|
cache_file="$ac_optarg" ;;
|
|
|
|
-disable-* | --disable-*)
|
|
ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
|
|
# Reject names that are not valid shell variable names.
|
|
changequote(, )dnl
|
|
if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
|
|
changequote([, ])dnl
|
|
AC_MSG_ERROR($ac_feature: invalid feature name)
|
|
fi
|
|
ac_feature=`echo $ac_feature| sed 's/-/_/g'`
|
|
eval "enable_${ac_feature}=no" ;;
|
|
|
|
-enable-* | --enable-*)
|
|
ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
|
|
# Reject names that are not valid shell variable names.
|
|
changequote(, )dnl
|
|
if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
|
|
changequote([, ])dnl
|
|
AC_MSG_ERROR($ac_feature: invalid feature name)
|
|
fi
|
|
ac_feature=`echo $ac_feature| sed 's/-/_/g'`
|
|
case "$ac_option" in
|
|
*=*) ;;
|
|
*) ac_optarg=yes ;;
|
|
esac
|
|
eval "enable_${ac_feature}='$ac_optarg'" ;;
|
|
|
|
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
|
|
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
|
|
| --exec | --exe | --ex)
|
|
ac_prev=exec_prefix ;;
|
|
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
|
|
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
|
|
| --exec=* | --exe=* | --ex=*)
|
|
exec_prefix="$ac_optarg" ;;
|
|
|
|
-gas | --gas | --ga | --g)
|
|
# Obsolete; use --with-gas.
|
|
with_gas=yes ;;
|
|
|
|
-help | --help | --hel | --he)
|
|
cat << EOF
|
|
$ac_usage
|
|
EOF
|
|
exit 0 ;;
|
|
|
|
-host | --host | --hos | --ho)
|
|
ac_prev=host ;;
|
|
-host=* | --host=* | --hos=* | --ho=*)
|
|
host="$ac_optarg" ;;
|
|
|
|
-nfp | --nfp | --nf)
|
|
# Obsolete; use --without-fp.
|
|
with_fp=no ;;
|
|
|
|
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
|
|
| --no-cr | --no-c)
|
|
no_create=yes ;;
|
|
|
|
-norecursion | --norecursion | --norecursio | --norecursi \
|
|
| --norecurs | --norecur | --norecu | --norec | --nore | --nor)
|
|
norecursion=yes ;;
|
|
|
|
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
|
|
ac_prev=prefix ;;
|
|
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
|
|
prefix="$ac_optarg" ;;
|
|
|
|
-program-prefix | --program-prefix | --program-prefi | --program-pref \
|
|
| --program-pre | --program-pr | --program-p)
|
|
ac_prev=program_prefix ;;
|
|
-program-prefix=* | --program-prefix=* | --program-prefi=* \
|
|
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
|
|
program_prefix="$ac_optarg" ;;
|
|
|
|
-program-suffix | --program-suffix | --program-suffi | --program-suff \
|
|
| --program-suf | --program-su | --program-s)
|
|
ac_prev=program_suffix ;;
|
|
-program-suffix=* | --program-suffix=* | --program-suffi=* \
|
|
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
|
|
program_suffix="$ac_optarg" ;;
|
|
|
|
-program-transform-name | --program-transform-name \
|
|
| --program-transform-nam | --program-transform-na \
|
|
| --program-transform-n | --program-transform- \
|
|
| --program-transform | --program-transfor \
|
|
| --program-transfo | --program-transf \
|
|
| --program-trans | --program-tran \
|
|
| --progr-tra | --program-tr | --program-t)
|
|
ac_prev=program_transform_name ;;
|
|
-program-transform-name=* | --program-transform-name=* \
|
|
| --program-transform-nam=* | --program-transform-na=* \
|
|
| --program-transform-n=* | --program-transform-=* \
|
|
| --program-transform=* | --program-transfor=* \
|
|
| --program-transfo=* | --program-transf=* \
|
|
| --program-trans=* | --program-tran=* \
|
|
| --progr-tra=* | --program-tr=* | --program-t=*)
|
|
program_transform_name="$ac_optarg" ;;
|
|
|
|
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
|
|
| -silent | --silent | --silen | --sile | --sil)
|
|
silent=yes ;;
|
|
|
|
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
|
|
ac_prev=srcdir ;;
|
|
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
|
|
srcdir="$ac_optarg" ;;
|
|
|
|
-target | --target | --targe | --targ | --tar | --ta | --t)
|
|
ac_prev=target ;;
|
|
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
|
|
target="$ac_optarg" ;;
|
|
|
|
-v | -verbose | --verbose | --verbos | --verbo | --verb)
|
|
verbose=yes ;;
|
|
|
|
-version | --version | --versio | --versi | --vers)
|
|
echo "configure generated by autoconf version AC_ACVERSION"
|
|
exit 0 ;;
|
|
|
|
-with-* | --with-*)
|
|
ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
|
|
# Reject names that are not valid shell variable names.
|
|
changequote(, )dnl
|
|
if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
|
|
changequote([, ])dnl
|
|
AC_MSG_ERROR($ac_package: invalid package name)
|
|
fi
|
|
ac_package=`echo $ac_package| sed 's/-/_/g'`
|
|
case "$ac_option" in
|
|
*=*) ;;
|
|
*) ac_optarg=yes ;;
|
|
esac
|
|
eval "with_${ac_package}='$ac_optarg'" ;;
|
|
|
|
-without-* | --without-*)
|
|
ac_package=`echo $ac_option|sed -e 's/-*without-//'`
|
|
# Reject names that are not valid shell variable names.
|
|
changequote(, )dnl
|
|
if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
|
|
changequote([, ])dnl
|
|
AC_MSG_ERROR($ac_package: invalid package name)
|
|
fi
|
|
ac_package=`echo $ac_package| sed 's/-/_/g'`
|
|
eval "with_${ac_package}=no" ;;
|
|
|
|
--x)
|
|
# Obsolete; use --with-x.
|
|
with_x=yes ;;
|
|
|
|
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
|
|
| --x-incl | --x-inc | --x-in | --x-i)
|
|
ac_prev=x_includes ;;
|
|
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
|
|
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
|
|
x_includes="$ac_optarg" ;;
|
|
|
|
-x-libraries | --x-libraries | --x-librarie | --x-librari \
|
|
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
|
|
ac_prev=x_libraries ;;
|
|
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
|
|
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
|
|
x_libraries="$ac_optarg" ;;
|
|
|
|
-*) AC_MSG_ERROR([$ac_option: invalid option; use --help to show usage])
|
|
;;
|
|
|
|
*)
|
|
changequote(, )dnl
|
|
if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
|
|
changequote([, ])dnl
|
|
AC_MSG_WARN($ac_option: invalid host type)
|
|
fi
|
|
if test "x$nonopt" != xNONE; then
|
|
AC_MSG_ERROR(can only configure for one host and one target at a time)
|
|
fi
|
|
nonopt="$ac_option"
|
|
;;
|
|
|
|
esac
|
|
done
|
|
|
|
if test -n "$ac_prev"; then
|
|
AC_MSG_ERROR(missing argument to --`echo $ac_prev | sed 's/_/-/g'`)
|
|
fi
|
|
])dnl
|
|
dnl
|
|
dnl Try to have only one #! line, so the script doesn't look funny.
|
|
dnl AC_BINSH()
|
|
AC_DEFUN(AC_BINSH,
|
|
[#!/bin/sh
|
|
])dnl
|
|
dnl
|
|
dnl AC_INIT(UNIQUE-FILE-IN-SOURCE-DIR)
|
|
AC_DEFUN(AC_INIT,
|
|
[AC_REQUIRE([AC_BINSH])dnl
|
|
AC_INIT_NOTICE
|
|
AC_INIT_PARSE_ARGS
|
|
AC_INIT_PREPARE($1)])dnl
|
|
dnl
|
|
dnl AC_INIT_PREPARE(UNIQUE-FILE-IN-SOURCE-DIR)
|
|
AC_DEFUN(AC_INIT_PREPARE,
|
|
[AC_BEFORE([$0], [AC_ARG_ENABLE])dnl
|
|
AC_BEFORE([$0], [AC_ARG_WITH])dnl
|
|
AC_BEFORE([$0], [AC_CONFIG_HEADER])dnl
|
|
AC_BEFORE([$0], [AC_REVISION])dnl
|
|
AC_BEFORE([$0], [AC_PREREQ])dnl
|
|
dnl AC_BEFORE([$0], [AC_CONFIG_SUBDIRS])dnl
|
|
trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
|
|
trap 'rm -fr confdefs* $ac_clean_files' 0
|
|
|
|
# File descriptor usage:
|
|
# 0 unused; standard input
|
|
# 1 file creation
|
|
# 2 errors and warnings
|
|
# 3 unused; some systems may open it to /dev/tty
|
|
define(AC_FD_MSG, 4)dnl
|
|
[#] AC_FD_MSG checking for... messages and results
|
|
define(AC_FD_CC, 5)dnl
|
|
[#] AC_FD_CC compiler messages saved in config.log
|
|
if test "$silent" = yes; then
|
|
exec AC_FD_MSG>/dev/null
|
|
else
|
|
exec AC_FD_MSG>&1
|
|
fi
|
|
exec AC_FD_CC>./config.log
|
|
|
|
echo "\
|
|
This file contains any messages produced by compilers while
|
|
running configure, to aid debugging if configure makes a mistake.
|
|
" 1>&AC_FD_CC
|
|
|
|
# Save the original args if we used an alternate arg parser.
|
|
ac_configure_temp="${configure_args-[$]@}"
|
|
# Strip out --no-create and --norecursion so they do not pile up.
|
|
# Also quote any args containing spaces.
|
|
configure_args=
|
|
for ac_arg in $ac_configure_temp; do
|
|
case "$ac_arg" in
|
|
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
|
|
| --no-cr | --no-c) ;;
|
|
-norecursion | --norecursion | --norecursio | --norecursi \
|
|
| --norecurs | --norecur | --norecu | --norec | --nore | --nor) ;;
|
|
changequote(, )dnl
|
|
*[" "]*) configure_args="$configure_args '$ac_arg'" ;;
|
|
changequote([, ])dnl
|
|
*) configure_args="$configure_args $ac_arg" ;;
|
|
esac
|
|
done
|
|
|
|
# NLS nuisances.
|
|
# Only set LANG and LC_ALL to C if already set.
|
|
# These must not be set unconditionally because not all systems understand
|
|
# e.g. LANG=C (notably SCO).
|
|
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
|
|
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
|
|
|
|
# confdefs.h avoids OS command line length limits that DEFS can exceed.
|
|
rm -rf conftest* confdefs.h
|
|
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
|
|
echo > confdefs.h
|
|
|
|
# A filename unique to this package, relative to the directory that
|
|
# configure is in, which we can look for to find out if srcdir is correct.
|
|
ac_unique_file=$1
|
|
|
|
# Find the source files, if location was not specified.
|
|
if test -z "$srcdir"; then
|
|
ac_srcdir_defaulted=yes
|
|
# Try the directory containing this script, then its parent.
|
|
ac_prog=[$]0
|
|
changequote(, )dnl
|
|
ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
|
|
changequote([, ])dnl
|
|
test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
|
|
srcdir=$ac_confdir
|
|
if test ! -r $srcdir/$ac_unique_file; then
|
|
srcdir=..
|
|
fi
|
|
else
|
|
ac_srcdir_defaulted=no
|
|
fi
|
|
if test ! -r $srcdir/$ac_unique_file; then
|
|
if test "$ac_srcdir_defaulted" = yes; then
|
|
AC_MSG_ERROR(can not find sources in ${ac_confdir} or ..)
|
|
else
|
|
AC_MSG_ERROR(can not find sources in ${srcdir})
|
|
fi
|
|
fi
|
|
|
|
ifdef([AC_LIST_SUBDIRS], [subdirs="AC_LIST_SUBDIRS"
|
|
AC_SUBST(subdirs)])dnl
|
|
ifdef([AC_LIST_PREFIX_PROGRAM], [AC_PREFIX(AC_LIST_PREFIX_PROGRAM)])dnl
|
|
dnl Let the site file select an alternate cache file if it wants to.
|
|
AC_SITE_LOAD
|
|
AC_CACHE_LOAD
|
|
|
|
AC_LANG_C
|
|
undivert(AC_DIVERSION_ARG)dnl
|
|
dnl Substitute for predefined variables.
|
|
AC_SUBST(LIBS)dnl
|
|
AC_SUBST(prefix)dnl
|
|
AC_SUBST(exec_prefix)dnl
|
|
AC_SUBST(DEFS)dnl
|
|
])dnl
|
|
dnl
|
|
dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
|
|
AC_DEFUN(AC_ARG_ENABLE,
|
|
[divert(AC_DIVERSION_HELP)dnl
|
|
$2
|
|
divert(AC_DIVERSION_ARG)dnl
|
|
AC_ENABLE_INTERNAL([$1], [$3], [$4])dnl
|
|
divert(AC_DIVERSION_NORMAL)dnl
|
|
])dnl
|
|
dnl
|
|
AC_DEFUN(AC_ENABLE,
|
|
[AC_OBSOLETE([$0], [; instead use AC_ARG_ENABLE before AC_INIT])dnl
|
|
AC_ENABLE_INTERNAL([$1], [$2], [$3])dnl
|
|
])dnl
|
|
dnl
|
|
dnl AC_ENABLE_INTERNAL(FEATURE, ACTION-IF-TRUE [, ACTION-IF-FALSE])
|
|
AC_DEFUN(AC_ENABLE_INTERNAL,
|
|
[[#] Check whether --enable-$1 or --disable-$1 was given.
|
|
enableval="[$enable_]patsubst($1, -, _)"
|
|
if test -n "$enableval"; then
|
|
ifelse([$2], , :, [$2])
|
|
ifelse([$3], , , [else
|
|
$3
|
|
])dnl
|
|
fi
|
|
])dnl
|
|
dnl
|
|
dnl AC_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
|
|
AC_DEFUN(AC_ARG_WITH,
|
|
[divert(AC_DIVERSION_HELP)dnl
|
|
$2
|
|
divert(AC_DIVERSION_ARG)dnl
|
|
AC_WITH_INTERNAL([$1], [$3], [$4])dnl
|
|
divert(AC_DIVERSION_NORMAL)dnl
|
|
])dnl
|
|
dnl
|
|
AC_DEFUN(AC_WITH,
|
|
[AC_OBSOLETE([$0], [; instead use AC_ARG_WITH before AC_INIT])dnl
|
|
AC_WITH_INTERNAL([$1], [$2], [$3])dnl
|
|
])dnl
|
|
dnl
|
|
dnl AC_WITH_INTERNAL(PACKAGE, ACTION-IF-TRUE [, ACTION-IF-FALSE])
|
|
AC_DEFUN(AC_WITH_INTERNAL,
|
|
[[#] Check whether --with-$1 or --without-$1 was given.
|
|
withval="[$with_]patsubst($1, -, _)"
|
|
if test -n "$withval"; then
|
|
ifelse([$2], , :, [$2])
|
|
ifelse([$3], , , [else
|
|
$3
|
|
])dnl
|
|
fi
|
|
])dnl
|
|
dnl
|
|
dnl AC_CONFIG_HEADER(HEADER-TO-CREATE ...)
|
|
AC_DEFUN(AC_CONFIG_HEADER,
|
|
[define(AC_LIST_HEADERS, $1)])dnl
|
|
dnl
|
|
dnl AC_REVISION(REVISION-INFO)
|
|
AC_DEFUN(AC_REVISION,
|
|
[AC_REQUIRE([AC_BINSH])dnl
|
|
[# From configure.in] translit([$1], $")])dnl
|
|
dnl
|
|
dnl Subroutines of AC_PREREQ.
|
|
dnl
|
|
dnl Change the dots in NUMBER into commas.
|
|
dnl AC_PREREQ_SPLIT(NUMBER)
|
|
AC_DEFUN(AC_PREREQ_SPLIT,
|
|
[translit($1, ., [, ])])dnl
|
|
dnl
|
|
dnl Default the ternary version number to 0 (e.g., 1, 7 -> 1, 7, 0).
|
|
dnl AC_PREREQ_CANON(MAJOR, MINOR [,TERNARY])
|
|
AC_DEFUN(AC_PREREQ_CANON,
|
|
[$1, $2, ifelse([$3], , 0, [$3])])dnl
|
|
dnl
|
|
dnl Complain and exit if version number 1 is less than version number 2.
|
|
dnl PRINTABLE2 is the printable version of version number 2.
|
|
dnl AC_PREREQ_COMPARE(MAJOR1, MINOR1, TERNARY1, MAJOR2, MINOR2, TERNARY2,
|
|
dnl PRINTABLE2)
|
|
AC_DEFUN(AC_PREREQ_COMPARE,
|
|
[ifelse(builtin([eval],
|
|
[$3 + $2 * 100 + $1 * 10000 < $6 + $5 * 100 + $4 * 10000]), 1,
|
|
[errprint(Autoconf version $7 or higher is required
|
|
)m4exit(3)])])dnl
|
|
dnl
|
|
dnl Complain and exit if the Autoconf version is less than VERSION.
|
|
dnl AC_PREREQ(VERSION)
|
|
AC_DEFUN(AC_PREREQ,
|
|
[AC_PREREQ_COMPARE(AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)),
|
|
AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), [$1])])dnl
|
|
dnl
|
|
dnl Run configure in subdirectories DIR...
|
|
dnl Not actually done until AC_OUTPUT_SUBDIRS.
|
|
dnl AC_CONFIG_SUBDIRS(DIR ...)
|
|
AC_DEFUN(AC_CONFIG_SUBDIRS,
|
|
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
|
|
define([AC_LIST_SUBDIRS], [$1])])dnl
|
|
dnl
|
|
dnl Guess the value for the `prefix' variable by looking for
|
|
dnl the argument program along PATH and taking its parent.
|
|
dnl Example: if the argument is `gcc' and we find /usr/local/gnu/bin/gcc,
|
|
dnl set `prefix' to /usr/local/gnu.
|
|
dnl AC_PREFIX_PROGRAM(PROGRAM)
|
|
AC_DEFUN(AC_PREFIX_PROGRAM,
|
|
[define([AC_LIST_PREFIX_PROGRAM], [$1])])dnl
|
|
AC_DEFUN(AC_PREFIX_INTERNAL,
|
|
[if test "x$prefix" = xNONE; then
|
|
changequote(<<, >>)dnl
|
|
define(<<AC_VAR_NAME>>, translit($1, [a-z], [A-Z]))dnl
|
|
changequote([, ])dnl
|
|
AC_PATH_PROG(AC_VAR_NAME, $1)
|
|
changequote(<<, >>)dnl
|
|
if test -n "$ac_cv_path_<<>>AC_VAR_NAME"; then
|
|
prefix=`echo $ac_cv_path_<<>>AC_VAR_NAME|sed 's%/[^/][^/]*/[^/][^/]*$%%'`
|
|
changequote([, ])dnl
|
|
fi
|
|
fi
|
|
undefine([AC_VAR_NAME])dnl
|
|
])dnl
|
|
AC_DEFUN(AC_PREFIX,
|
|
[AC_OBSOLETE([$0], [; instead use AC_PREFIX_PROGRAM before AC_INIT])dnl
|
|
AC_PREFIX_INTERNAL([$1])])dnl
|
|
dnl
|
|
dnl
|
|
dnl ### Canonicalizing the system type
|
|
dnl
|
|
dnl
|
|
dnl Find install.sh, config.sub, config.guess, and Cygnus configure
|
|
dnl in directory DIR. These are auxiliary files used in configuration.
|
|
dnl DIR can be either absolute or relative to ${srcdir}.
|
|
dnl AC_CONFIG_AUX_DIR(DIR)
|
|
AC_DEFUN(AC_CONFIG_AUX_DIR,
|
|
[AC_CONFIG_AUX_DIRS($1 ${srcdir}/$1)])dnl
|
|
dnl
|
|
dnl The default is `${srcdir}' or `${srcdir}/..' or `${srcdir}/../..'.
|
|
dnl There's no need to call this macro explicitly; just AC_REQUIRE it.
|
|
AC_DEFUN(AC_CONFIG_AUX_DIR_DEFAULT,
|
|
[AC_CONFIG_AUX_DIRS(${srcdir} ${srcdir}/.. ${srcdir}/../..)])dnl
|
|
dnl
|
|
dnl Internal subroutine.
|
|
dnl Search for the configuration auxiliary files in directory list $1.
|
|
dnl We look only for install.sh, so users of AC_PROG_INSTALL
|
|
dnl do not automatically need to distribute the other auxiliary files.
|
|
dnl AC_CONFIG_AUX_DIRS(DIR ...)
|
|
AC_DEFUN(AC_CONFIG_AUX_DIRS,
|
|
[ac_aux_dir=
|
|
for ac_dir in $1; do
|
|
if test -f $ac_dir/install.sh; then
|
|
ac_aux_dir=$ac_dir; break
|
|
fi
|
|
done
|
|
if test -z "$ac_aux_dir"; then
|
|
AC_MSG_ERROR([can not find install.sh in $1])
|
|
fi
|
|
ac_config_guess=${ac_aux_dir}/config.guess
|
|
ac_config_sub=${ac_aux_dir}/config.sub
|
|
ac_configure=${ac_aux_dir}/configure # This should be Cygnus configure.
|
|
ac_install_sh="${ac_aux_dir}/install.sh -c"
|
|
AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
|
|
])dnl
|
|
dnl
|
|
dnl Canonicalize the host, target, and build system types.
|
|
AC_DEFUN(AC_CANONICAL_SYSTEM,
|
|
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
|
|
# Do some error checking and defaulting for the host and target type.
|
|
# The inputs are:
|
|
# configure --host=HOST --target=TARGET --build=BUILD NONOPT
|
|
#
|
|
# The rules are:
|
|
# 1. You are not allowed to specify --host, --target, and nonopt at the
|
|
# same time.
|
|
# 2. Host defaults to nonopt.
|
|
# 3. If nonopt is not specified, then host defaults to the current host,
|
|
# as determined by config.guess.
|
|
# 4. Target defaults to nonopt.
|
|
# 5. If nonopt is not specified, then target defaults to host.
|
|
# 6. build defaults to empty (but implicitly to host).
|
|
|
|
# The aliases save the names the user supplied, while $host etc.
|
|
# will get canonicalized.
|
|
build_alias=$build
|
|
host_alias=$host
|
|
target_alias=$target
|
|
case $host_alias---$target_alias---$nonopt in
|
|
NONE---*---* | *---NONE---* | *---*---NONE) ;;
|
|
*) AC_MSG_ERROR(can only configure for one host and one target at a time) ;;
|
|
esac
|
|
|
|
# Make sure we can run config.sub.
|
|
if ${ac_config_sub} sun4 >/dev/null 2>&1; then :
|
|
else AC_MSG_ERROR(can not run ${ac_config_sub})
|
|
fi
|
|
|
|
AC_CANONICAL_HOST
|
|
AC_CANONICAL_TARGET
|
|
AC_CANONICAL_BUILD
|
|
])dnl
|
|
dnl
|
|
dnl Subroutines of AC_CANONICAL_SYSTEM.
|
|
dnl
|
|
AC_DEFUN(AC_CANONICAL_HOST,
|
|
[AC_MSG_CHECKING(host system type)
|
|
|
|
case "${host_alias}" in
|
|
NONE)
|
|
case $nonopt in
|
|
NONE)
|
|
if host_alias=`${ac_config_guess}`; then :
|
|
else AC_MSG_ERROR(can not guess host type; you must specify one)
|
|
fi ;;
|
|
*) host_alias=$nonopt ;;
|
|
esac ;;
|
|
esac
|
|
|
|
host=`${ac_config_sub} ${host_alias}`
|
|
host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
|
|
host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
|
|
host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
|
|
AC_MSG_RESULT($host)
|
|
AC_SUBST(host)dnl
|
|
AC_SUBST(host_alias)dnl
|
|
AC_SUBST(host_cpu)dnl
|
|
AC_SUBST(host_vendor)dnl
|
|
AC_SUBST(host_os)dnl
|
|
])dnl
|
|
dnl
|
|
AC_DEFUN(AC_CANONICAL_TARGET,
|
|
[AC_MSG_CHECKING(target system type)
|
|
|
|
case "${target_alias}" in
|
|
NONE)
|
|
case $nonopt in
|
|
NONE) target_alias=$host_alias ;;
|
|
*) target_alias=$nonopt ;;
|
|
esac ;;
|
|
esac
|
|
|
|
target=`${ac_config_sub} ${target_alias}`
|
|
target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
|
|
target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
|
|
target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
|
|
AC_MSG_RESULT($target)
|
|
AC_SUBST(target)dnl
|
|
AC_SUBST(target_alias)dnl
|
|
AC_SUBST(target_cpu)dnl
|
|
AC_SUBST(target_vendor)dnl
|
|
AC_SUBST(target_os)dnl
|
|
])dnl
|
|
dnl
|
|
AC_DEFUN(AC_CANONICAL_BUILD,
|
|
[AC_MSG_CHECKING(build system type)
|
|
|
|
case "${build_alias}" in
|
|
NONE) build= build_alias= ;;
|
|
*)
|
|
build=`${ac_config_sub} ${build_alias}`
|
|
build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
|
|
build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
|
|
build_os=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
|
|
;;
|
|
esac
|
|
AC_MSG_RESULT($build)
|
|
AC_SUBST(build)dnl
|
|
AC_SUBST(build_alias)dnl
|
|
AC_SUBST(build_cpu)dnl
|
|
AC_SUBST(build_vendor)dnl
|
|
AC_SUBST(build_os)dnl
|
|
])dnl
|
|
dnl
|
|
dnl Link each of the existing files FILE... to the corresponding
|
|
dnl link name in LINK...
|
|
dnl Not actually done until AC_OUTPUT_LINKS.
|
|
dnl AC_LINK_FILES(LINK ..., FILE ...)
|
|
AC_DEFUN(AC_LINK_FILES,
|
|
[define([AC_LIST_LINKS], [$1])define([AC_LIST_FILES], [$2])])dnl
|
|
dnl
|
|
dnl
|
|
dnl ### Caching test results
|
|
dnl
|
|
dnl
|
|
dnl Look for site or system specific initialization scripts.
|
|
dnl AC_SITE_LOAD()
|
|
AC_DEFUN(AC_SITE_LOAD,
|
|
[# Prefer explicitly selected file to automatically selected ones.
|
|
if test ! -r "$CONFIG_SITE"; then
|
|
if test "x$prefix" != xNONE; then
|
|
CONFIG_SITE=$prefix/lib/config.site
|
|
else
|
|
CONFIG_SITE=/usr/local/lib/config.site
|
|
fi
|
|
# System dependent files override system independent ones.
|
|
if test "x$exec_prefix" != xNONE && test "x$exec_prefix" != "x$prefix"; then
|
|
CONFIG_SITE="$CONFIG_SITE $exec_prefix/lib/config.site"
|
|
fi
|
|
fi
|
|
for ac_site_file in $CONFIG_SITE; do
|
|
if test -r "$ac_site_file"; then
|
|
echo "loading site script $ac_site_file"
|
|
. "$ac_site_file"
|
|
fi
|
|
done
|
|
])dnl
|
|
dnl
|
|
dnl AC_CACHE_LOAD()
|
|
AC_DEFUN(AC_CACHE_LOAD,
|
|
[if test -r "$cache_file"; then
|
|
echo "loading cache $cache_file"
|
|
. $cache_file
|
|
else
|
|
echo "creating cache $cache_file"
|
|
> $cache_file
|
|
fi
|
|
])dnl
|
|
dnl
|
|
dnl AC_CACHE_SAVE()
|
|
AC_DEFUN(AC_CACHE_SAVE,
|
|
[if test -w $cache_file; then
|
|
echo "updating cache $cache_file"
|
|
cat > $cache_file <<\EOF
|
|
# This file is a shell script that caches the results of configure
|
|
# tests run on this system so they can be shared between configure
|
|
# scripts and configure runs. It is not useful on other systems.
|
|
# If its contents are invalid for some reason, you may delete or edit it.
|
|
#
|
|
# By default, configure uses ./config.cache as the cache file,
|
|
# creating it if it does not exist already. You can give configure
|
|
# the --cache-file=FILE option to use a different cache file; that is
|
|
# what configure does when it calls configure scripts in
|
|
# subdirectories, so they share the cache.
|
|
# Giving --cache-file=/dev/null disables caching, for debugging configure.
|
|
# config.status only pays attention to the cache file if you give it the
|
|
# --recheck option to rerun configure.
|
|
EOF
|
|
changequote(, )dnl
|
|
dnl Allow a site initialization script to override cache values.
|
|
# Ultrix sh set writes to stderr and can't be redirected directly.
|
|
(set) 2>&1 | sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1-'\2'}/p" >> $cache_file
|
|
changequote([, ])dnl
|
|
else
|
|
echo "not updating unwritable cache $cache_file"
|
|
fi
|
|
])dnl
|
|
dnl
|
|
dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved.
|
|
dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT)
|
|
AC_DEFUN(AC_CACHE_VAL,
|
|
[AC_REQUIRE([AC_PROG_ECHO_N])dnl
|
|
dnl We used to use the below line, but it fails if the 1st arg is a
|
|
dnl shell variable, so we need the eval.
|
|
dnl if test "${$1+set}" = set; then
|
|
if eval "test \"`echo '${'$1'+set}'`\" = set"; then
|
|
echo $ac_n "(cached) $ac_c" 1>&AC_FD_MSG
|
|
else
|
|
$2
|
|
fi
|
|
])dnl
|
|
dnl
|
|
dnl
|
|
dnl ### Setting variables
|
|
dnl
|
|
dnl
|
|
dnl Set VARIABLE to VALUE, verbatim, or 1.
|
|
dnl AC_DEFINE(VARIABLE [, VALUE])
|
|
AC_DEFUN(AC_DEFINE,
|
|
[cat >> confdefs.h <<\EOF
|
|
[#define] $1 ifelse($#, 2, [$2], 1)
|
|
EOF
|
|
])dnl
|
|
dnl
|
|
dnl Similar, but perform shell substitutions $ ` \ once on VALUE.
|
|
AC_DEFUN(AC_DEFINE_UNQUOTED,
|
|
[cat >> confdefs.h <<EOF
|
|
[#define] $1 ifelse($#, 2, [$2], 1)
|
|
EOF
|
|
])dnl
|
|
dnl
|
|
dnl This macro protects VARIABLE from being diverted twice
|
|
dnl if this macro is called twice for it.
|
|
dnl AC_SUBST(VARIABLE)
|
|
AC_DEFUN(AC_SUBST,
|
|
[ifdef([AC_SUBST_$1], ,
|
|
[define([AC_SUBST_$1], )dnl
|
|
divert(AC_DIVERSION_SED)dnl
|
|
s%@$1@%[$]$1%g
|
|
divert(AC_DIVERSION_NORMAL)dnl
|
|
])])dnl
|
|
dnl
|
|
dnl AC_SUBST_FILE(VARIABLE, FILE)
|
|
AC_DEFUN(AC_SUBST_FILE,
|
|
[if test -f $2; then
|
|
echo using $2 for $1)
|
|
AC_INSERT_FILE($1, $2)
|
|
elif test -f ${srcdir}/$2; then
|
|
echo using ${srcdir}/$2 for $1)
|
|
AC_INSERT_FILE($1, ${srcdir}/$2)
|
|
fi
|
|
])dnl
|
|
dnl Internal subroutine of AC_SUBST_FILE.
|
|
AC_DEFUN(AC_INSERT_FILE,
|
|
[ifdef([AC_SUBST_$1], ,
|
|
[define([AC_SUBST_$1], )dnl
|
|
divert(AC_DIVERSION_SED)dnl
|
|
/@$1@/r [$]$1
|
|
s%@$1@%%g
|
|
divert(AC_DIVERSION_NORMAL)dnl
|
|
])])dnl
|
|
dnl
|
|
dnl
|
|
dnl ### Printing messages
|
|
dnl
|
|
dnl
|
|
dnl AC_MSG_CHECKING(FEATURE-DESCRIPTION)
|
|
AC_DEFUN(AC_MSG_CHECKING,
|
|
[AC_REQUIRE([AC_PROG_ECHO_N])dnl
|
|
echo $ac_n "checking $1""... $ac_c" 1>&AC_FD_MSG])dnl
|
|
dnl
|
|
dnl AC_CHECKING(FEATURE-DESCRIPTION)
|
|
AC_DEFUN(AC_CHECKING,
|
|
[echo "checking $1" 1>&AC_FD_MSG])dnl
|
|
dnl
|
|
dnl AC_MSG_RESULT(RESULT-DESCRIPTION)
|
|
AC_DEFUN(AC_MSG_RESULT,
|
|
[AC_REQUIRE([AC_PROG_ECHO_N])dnl
|
|
echo "$ac_t""$1" 1>&AC_FD_MSG])dnl
|
|
dnl
|
|
dnl AC_VERBOSE(RESULT-DESCRIPTION)
|
|
AC_DEFUN(AC_VERBOSE,
|
|
[AC_OBSOLETE([$0], [; instead use AC_MSG_RESULT])dnl
|
|
echo " $1" 1>&AC_FD_MSG])dnl
|
|
dnl
|
|
dnl AC_MSG_WARN(PROBLEM-DESCRIPTION)
|
|
AC_DEFUN(AC_MSG_WARN,
|
|
[echo "configure: warning: $1" 1>&2])dnl
|
|
dnl
|
|
dnl AC_MSG_ERROR(ERROR-DESCRIPTION)
|
|
AC_DEFUN(AC_MSG_ERROR,
|
|
[{ echo "configure: $1" 1>&2; exit 1; }])dnl
|
|
dnl
|
|
dnl
|
|
dnl ### Selecting which language to use for testing
|
|
dnl
|
|
dnl
|
|
dnl AC_LANG_C()
|
|
AC_DEFUN(AC_LANG_C,
|
|
[define([AC_LANG], [C])dnl
|
|
ac_ext=c
|
|
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
|
|
ac_cpp='${CPP}'
|
|
ac_compile='${CC-cc} $CFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC'
|
|
])dnl
|
|
dnl
|
|
dnl AC_LANG_CPLUSPLUS()
|
|
AC_DEFUN(AC_LANG_CPLUSPLUS,
|
|
[define([AC_LANG], [CPLUSPLUS])dnl
|
|
ac_ext=C
|
|
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
|
|
ac_cpp='${CXXCPP}'
|
|
ac_compile='${CXX-gcc} $CXXFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC'
|
|
])dnl
|
|
dnl
|
|
dnl Push the current language on a stack.
|
|
dnl
|
|
dnl AC_LANG_SAVE()
|
|
AC_DEFUN(AC_LANG_SAVE,
|
|
[pushdef([AC_LANG_STACK], AC_LANG)])dnl
|
|
dnl
|
|
dnl Restore the current language from the stack.
|
|
dnl AC_LANG_RESTORE()
|
|
AC_DEFUN(AC_LANG_RESTORE,
|
|
[ifelse(AC_LANG_STACK, C, [ifelse(AC_LANG, C, , [AC_LANG_C])], [ifelse(AC_LANG, CPLUSPLUS, , [AC_LANG_CPLUSPLUS])])[]popdef([AC_LANG_STACK])])dnl
|
|
dnl
|
|
dnl
|
|
dnl ### Enforcing ordering constraints
|
|
dnl
|
|
dnl
|
|
dnl AC_BEFORE(THIS-MACRO-NAME, CALLED-MACRO-NAME)
|
|
AC_DEFUN(AC_BEFORE,
|
|
[ifdef([AC_PROVIDE_$2], [errprint(__file__:__line__: [$2 was called before $1
|
|
])])])dnl
|
|
dnl
|
|
dnl AC_REQUIRE(MACRO-NAME)
|
|
AC_DEFUN(AC_REQUIRE,
|
|
[ifdef([AC_PROVIDE_$1], , [indir([$1])])])dnl
|
|
dnl
|
|
dnl AC_PROVIDE(MACRO-NAME)
|
|
define(AC_PROVIDE,
|
|
[define([AC_PROVIDE_$1], )])dnl
|
|
dnl
|
|
dnl AC_OBSOLETE(THIS-MACRO-NAME [, SUGGESTION])
|
|
AC_DEFUN(AC_OBSOLETE,
|
|
[errprint(__file__:__line__: warning: [$1] is obsolete[$2]
|
|
)])dnl
|
|
dnl
|
|
dnl
|
|
dnl ### Checking for files - fundamental (caching)
|
|
dnl
|
|
dnl
|
|
dnl AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUND
|
|
dnl [, VALUE-IF-NOT-FOUND])
|
|
AC_DEFUN(AC_CHECK_PROG,
|
|
[# Extract the first word of "$2", so it can be a program name with args.
|
|
set dummy $2; ac_word=[$]2
|
|
AC_MSG_CHECKING([for $ac_word])
|
|
AC_CACHE_VAL(ac_cv_prog_$1,
|
|
[if test -n "[$]$1"; then
|
|
ac_cv_prog_$1="[$]$1" # Let the user override the test.
|
|
else
|
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
|
for ac_dir in $PATH; do
|
|
test -z "$ac_dir" && ac_dir=.
|
|
if test -f $ac_dir/$ac_word; then
|
|
ac_cv_prog_$1="$3"
|
|
break
|
|
fi
|
|
done
|
|
IFS="$ac_save_ifs"
|
|
dnl If no 4th arg is given, leave the cache variable unset,
|
|
dnl so AC_CHECK_PROGS will keep looking.
|
|
ifelse([$4], , , [ test -z "[$]ac_cv_prog_$1" && ac_cv_prog_$1="$4"
|
|
])dnl
|
|
fi])dnl
|
|
$1="$ac_cv_prog_$1"
|
|
if test -n "[$]$1"; then
|
|
AC_MSG_RESULT([$]$1)
|
|
else
|
|
AC_MSG_RESULT(no)
|
|
fi
|
|
AC_SUBST($1)dnl
|
|
])dnl
|
|
dnl
|
|
dnl AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND])
|
|
AC_DEFUN(AC_PATH_PROG,
|
|
[# Extract the first word of "$2", so it can be a program name with args.
|
|
set dummy $2; ac_word=[$]2
|
|
AC_MSG_CHECKING([for $ac_word])
|
|
AC_CACHE_VAL(ac_cv_path_$1,
|
|
[case "[$]$1" in
|
|
/*)
|
|
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
|
;;
|
|
*)
|
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
|
for ac_dir in $PATH; do
|
|
test -z "$ac_dir" && ac_dir=.
|
|
if test -f $ac_dir/$ac_word; then
|
|
ac_cv_path_$1="$ac_dir/$ac_word"
|
|
break
|
|
fi
|
|
done
|
|
IFS="$ac_save_ifs"
|
|
dnl If no 3rd arg is given, leave the cache variable unset,
|
|
dnl so AC_PATH_PROGS will keep looking.
|
|
ifelse([$3], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$3"
|
|
])dnl
|
|
;;
|
|
esac])dnl
|
|
$1="$ac_cv_path_$1"
|
|
if test -n "[$]$1"; then
|
|
AC_MSG_RESULT([$]$1)
|
|
else
|
|
AC_MSG_RESULT(no)
|
|
fi
|
|
AC_SUBST($1)dnl
|
|
])dnl
|
|
dnl
|
|
dnl
|
|
dnl ### Checking for files - derived (caching)
|
|
dnl
|
|
dnl
|
|
dnl AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND])
|
|
AC_DEFUN(AC_CHECK_PROGS,
|
|
[for ac_prog in $2
|
|
do
|
|
AC_CHECK_PROG($1, [$]ac_prog, [$]ac_prog, )
|
|
test -n "[$]$1" && break
|
|
done
|
|
ifelse([$3], , , [test -n "[$]$1" || $1="$3"
|
|
])])dnl
|
|
dnl
|
|
dnl AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND])
|
|
AC_DEFUN(AC_PATH_PROGS,
|
|
[for ac_prog in $2
|
|
do
|
|
AC_PATH_PROG($1, [$]ac_prog)
|
|
test -n "[$]$1" && break
|
|
done
|
|
ifelse([$3], , , [test -n "[$]$1" || $1="$3"
|
|
])])dnl
|
|
dnl
|
|
dnl AC_CHECK_LIB(LIBRARY, FUNCTION, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
|
|
dnl [, OTHER-LIBRARIES]]])
|
|
AC_DEFUN(AC_CHECK_LIB,
|
|
[changequote(<<, >>)dnl
|
|
define(<<AC_LIB_NAME>>, dnl
|
|
patsubst(patsubst($1, <<lib\([^\.]*\)\.a>>, <<\1>>), <<-l>>, <<>>))dnl
|
|
define(<<AC_CV_NAME>>, ac_cv_lib_<<>>AC_LIB_NAME)dnl
|
|
changequote([, ])dnl
|
|
AC_MSG_CHECKING([for -l[]AC_LIB_NAME])
|
|
AC_CACHE_VAL(AC_CV_NAME,
|
|
[ac_save_LIBS="${LIBS}"
|
|
LIBS="${LIBS} -l[]AC_LIB_NAME[] $5"
|
|
AC_TRY_LINK( , [$2()], AC_CV_NAME=yes, AC_CV_NAME=no)dnl
|
|
LIBS="${ac_save_LIBS}"
|
|
])dnl
|
|
AC_MSG_RESULT($AC_CV_NAME)
|
|
if test "${AC_CV_NAME}" = yes; then
|
|
ifelse([$3], ,
|
|
[AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z]))
|
|
LIBS="${LIBS} -l[]AC_LIB_NAME[]"
|
|
], [$3])
|
|
ifelse([$4], , , [else
|
|
$4
|
|
])dnl
|
|
fi
|
|
undefine([AC_LIB_NAME])dnl
|
|
undefine([AC_CV_NAME])dnl
|
|
])dnl
|
|
dnl
|
|
dnl AC_HAVE_LIBRARY(LIBRARY, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
|
|
dnl [, OTHER-LIBRARIES]]])
|
|
AC_DEFUN(AC_HAVE_LIBRARY,
|
|
[AC_OBSOLETE([$0], [; instead use AC_CHECK_LIB])dnl
|
|
AC_CHECK_LIB([$1], main, [$2], [$3], [$4])dnl
|
|
])dnl
|
|
dnl
|
|
dnl
|
|
dnl ### Checking for C features - fundamental (no caching)
|
|
dnl
|
|
dnl
|
|
dnl AC_EGREP_HEADER(PATTERN, HEADER-FILE, ACTION-IF-FOUND [,
|
|
dnl ACTION-IF-NOT-FOUND])
|
|
AC_DEFUN(AC_EGREP_HEADER,
|
|
[AC_EGREP_CPP([$1], [#include <$2>], [$3], [$4])])dnl
|
|
dnl
|
|
dnl Because this macro is used by AC_PROG_GCC_TRADITIONAL, which must
|
|
dnl come early, it is not included in AC_BEFORE checks.
|
|
dnl AC_EGREP_CPP(PATTERN, PROGRAM, ACTION-IF-FOUND [,
|
|
dnl ACTION-IF-NOT-FOUND])
|
|
AC_DEFUN(AC_EGREP_CPP,
|
|
[AC_REQUIRE_CPP()dnl
|
|
cat > conftest.${ac_ext} <<EOF
|
|
#include "confdefs.h"
|
|
[$2]
|
|
EOF
|
|
eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
|
|
if egrep "$1" conftest.out >/dev/null 2>&1; then
|
|
ifelse([$3], , :, [rm -rf conftest*
|
|
$3])
|
|
ifelse([$4], , , [else
|
|
rm -rf conftest*
|
|
$4
|
|
])dnl
|
|
fi
|
|
rm -f conftest*
|
|
])dnl
|
|
dnl
|
|
dnl AC_COMPILE_CHECK(ECHO-TEXT, INCLUDES, FUNCTION-BODY,
|
|
dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
|
AC_DEFUN(AC_COMPILE_CHECK,
|
|
[dnl It's actually ok to use this, if you don't care about caching.
|
|
dnl AC_OBSOLETE([$0], [; instead use AC_TRY_LINK])dnl
|
|
ifelse([$1], , , [AC_CHECKING([for $1])
|
|
])dnl
|
|
AC_TRY_LINK([$2], [$3], [$4], [$5])dnl
|
|
])dnl
|
|
dnl
|
|
dnl AC_TRY_LINK(INCLUDES, FUNCTION-BODY,
|
|
dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
|
AC_DEFUN(AC_TRY_LINK,
|
|
[dnl We use return because because C++ requires a prototype for exit.
|
|
cat > conftest.${ac_ext} <<EOF
|
|
#include "confdefs.h"
|
|
[$1]
|
|
int main() { return 0; }
|
|
int t() {
|
|
[$2]
|
|
; return 0; }
|
|
EOF
|
|
if eval $ac_compile; then
|
|
ifelse([$3], , :, [rm -rf conftest*
|
|
$3])
|
|
ifelse([$4], , , [else
|
|
rm -rf conftest*
|
|
$4
|
|
])dnl
|
|
fi
|
|
rm -f conftest*]
|
|
)dnl
|
|
dnl
|
|
dnl AC_TRY_RUN(PROGRAM, ACTION-IF-TRUE [, ACTION-IF-FALSE
|
|
dnl [, ACTION-IF-CROSS-COMPILING]])
|
|
AC_DEFUN(AC_TRY_RUN,
|
|
[AC_REQUIRE([AC_C_CROSS])dnl
|
|
if test "$cross_compiling" = yes; then
|
|
ifelse([$4], , AC_MSG_ERROR(can not run test program while cross compiling),
|
|
[AC_MSG_WARN(using default for cross-compiling)
|
|
$4
|
|
])
|
|
else
|
|
cat > conftest.${ac_ext} <<EOF
|
|
#include "confdefs.h"
|
|
[$1]
|
|
EOF
|
|
eval $ac_compile
|
|
if test -s conftest && (./conftest; exit) 2>/dev/null; then
|
|
ifelse([$2], , :, [$2])
|
|
ifelse([$3], , , [else
|
|
$3
|
|
])dnl
|
|
fi
|
|
fi
|
|
rm -fr conftest*])dnl
|
|
dnl
|
|
dnl AC_TRY_CPP(INCLUDES, ACTION-IF-TRUE [, ACTION-IF-FALSE])
|
|
AC_DEFUN(AC_TRY_CPP,
|
|
[AC_REQUIRE_CPP()dnl
|
|
cat > conftest.${ac_ext} <<EOF
|
|
#include "confdefs.h"
|
|
[$1]
|
|
EOF
|
|
# Some shells (Coherent) do redirections in the wrong order, so need
|
|
# the parens.
|
|
ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
|
|
if test -z "$ac_err"; then
|
|
ifelse([$2], , :, [rm -rf conftest*
|
|
$2])
|
|
ifelse([$3], , , [else
|
|
rm -rf conftest*
|
|
$3
|
|
])dnl
|
|
fi
|
|
rm -f conftest*])dnl
|
|
dnl
|
|
dnl
|
|
dnl ### Checking for C features - derived (caching)
|
|
dnl
|
|
dnl
|
|
dnl AC_CHECK_HEADER(HEADER-FILE, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
|
AC_DEFUN(AC_CHECK_HEADER,
|
|
[dnl Do the transliteration at runtime so arg 1 can be a shell variable.
|
|
ac_var=`echo "$1" | tr './' '__'`
|
|
AC_MSG_CHECKING([for $1])
|
|
AC_CACHE_VAL(ac_cv_header_$ac_var,
|
|
[AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_var=yes",
|
|
eval "ac_cv_header_$ac_var=no")])dnl
|
|
if eval "test \"`echo '$ac_cv_header_'$ac_var`\" = yes"; then
|
|
AC_MSG_RESULT(yes)
|
|
ifelse([$2], , :, [$2])
|
|
else
|
|
AC_MSG_RESULT(no)
|
|
ifelse([$3], , , [$3
|
|
])dnl
|
|
fi
|
|
])dnl
|
|
dnl
|
|
dnl AC_CHECK_FUNC(FUNCTION, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
|
AC_DEFUN(AC_CHECK_FUNC,
|
|
[AC_MSG_CHECKING([for $1])
|
|
AC_CACHE_VAL(ac_cv_func_$1,
|
|
[AC_TRY_LINK(
|
|
[#include <ctype.h> /* Arbitrary system header to define __stub macros. */], [
|
|
/* The GNU C library defines this for functions which it implements
|
|
to always fail with ENOSYS. Some functions are actually named
|
|
something starting with __ and the normal name is an alias. */
|
|
#if defined (__stub_$1) || defined (__stub___$1)
|
|
choke me
|
|
#else
|
|
/* Override any gcc2 internal prototype to avoid an error. */
|
|
extern char $1(); $1();
|
|
#endif
|
|
], eval "ac_cv_func_$1=yes", eval "ac_cv_func_$1=no")])dnl
|
|
if eval "test \"`echo '$ac_cv_func_'$1`\" = yes"; then
|
|
AC_MSG_RESULT(yes)
|
|
ifelse([$2], , :, [$2])
|
|
else
|
|
AC_MSG_RESULT(no)
|
|
ifelse([$3], , , [$3
|
|
])dnl
|
|
fi
|
|
])dnl
|
|
dnl
|
|
dnl AC_CHECK_FUNCS(FUNCTION... [, ACTION])
|
|
AC_DEFUN(AC_CHECK_FUNCS,
|
|
[for ac_func in $1
|
|
do
|
|
AC_CHECK_FUNC(${ac_func},
|
|
[changequote(, )dnl
|
|
ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'`
|
|
changequote([, ])dnl
|
|
AC_DEFINE_UNQUOTED(${ac_tr_func}) $2])dnl
|
|
done
|
|
])dnl
|
|
dnl
|
|
dnl AC_CHECK_HEADERS(HEADER-FILE... [, ACTION])
|
|
AC_DEFUN(AC_CHECK_HEADERS,
|
|
[AC_REQUIRE_CPP()dnl Make sure the cpp check happens outside the loop.
|
|
for ac_hdr in $1
|
|
do
|
|
AC_CHECK_HEADER(${ac_hdr},
|
|
[changequote(, )dnl
|
|
ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
|
|
changequote([, ])dnl
|
|
AC_DEFINE_UNQUOTED(${ac_tr_hdr}) $2])dnl
|
|
done
|
|
])dnl
|
|
dnl
|
|
dnl AC_REPLACE_FUNCS(FUNCTION-NAME...)
|
|
AC_DEFUN(AC_REPLACE_FUNCS,
|
|
[for ac_func in $1
|
|
do
|
|
AC_CHECK_FUNC(${ac_func}, , [LIBOBJS="$LIBOBJS ${ac_func}.o"])
|
|
done
|
|
AC_SUBST(LIBOBJS)dnl
|
|
])dnl
|
|
dnl
|
|
dnl AC_CHECK_SIZEOF(TYPE)
|
|
AC_DEFUN(AC_CHECK_SIZEOF,
|
|
[changequote(<<, >>)dnl
|
|
dnl The name to #define.
|
|
define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
|
|
dnl The cache variable name.
|
|
define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
|
|
changequote([, ])dnl
|
|
AC_MSG_CHECKING(size of $1)
|
|
AC_CACHE_VAL(AC_CV_NAME,
|
|
[AC_TRY_RUN([#include <stdio.h>
|
|
main()
|
|
{
|
|
FILE *f=fopen("conftestval", "w");
|
|
if (!f) exit(1);
|
|
fprintf(f, "%d\n", sizeof($1));
|
|
exit(0);
|
|
}], AC_CV_NAME=`cat conftestval`)])dnl
|
|
AC_MSG_RESULT($AC_CV_NAME)
|
|
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
|
|
undefine([AC_TYPE_NAME])dnl
|
|
undefine([AC_CV_NAME])dnl
|
|
])dnl
|
|
dnl
|
|
dnl AC_CHECK_TYPE(TYPE, DEFAULT)
|
|
AC_DEFUN(AC_CHECK_TYPE,
|
|
[AC_MSG_CHECKING(for $1 in sys/types.h)
|
|
AC_CACHE_VAL(ac_cv_type_$1,
|
|
[AC_EGREP_HEADER($1, sys/types.h, ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
|
|
AC_MSG_RESULT($ac_cv_type_$1)
|
|
if test $ac_cv_type_$1 = no; then
|
|
AC_DEFINE($1, $2)
|
|
fi
|
|
])dnl
|
|
dnl
|
|
dnl
|
|
dnl ### The big finish
|
|
dnl
|
|
dnl
|
|
dnl Produce config.status, config.h, and links, and configure subdirs.
|
|
dnl AC_OUTPUT([FILE...] [, EXTRA-CMDS])
|
|
AC_DEFUN(AC_OUTPUT,
|
|
[AC_CACHE_SAVE
|
|
|
|
test "x$prefix" = xNONE && prefix=/usr/local
|
|
# Let make expand exec_prefix.
|
|
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
|
|
|
# Any assignment to VPATH causes Sun make to only execute
|
|
# the first set of double-colon rules, so remove it if not needed.
|
|
# If there is a colon in the path, we need to keep it.
|
|
if test "x$srcdir" = x.; then
|
|
changequote(, )dnl
|
|
ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
|
|
changequote([, ])dnl
|
|
fi
|
|
|
|
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
|
|
|
|
ifdef([AC_LIST_HEADERS], [DEFS=-DHAVE_CONFIG_H], [AC_OUTPUT_MAKE_DEFS()])
|
|
|
|
# Without the "./", some shells look in PATH for config.status.
|
|
: ${CONFIG_STATUS=./config.status}
|
|
|
|
echo creating ${CONFIG_STATUS}
|
|
rm -f ${CONFIG_STATUS}
|
|
cat > ${CONFIG_STATUS} <<EOF
|
|
#!/bin/sh
|
|
# Generated automatically by configure.
|
|
# Run this file to recreate the current configuration.
|
|
# This directory was configured as follows,
|
|
dnl hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
|
|
dnl so uname gets run too.
|
|
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
|
|
#
|
|
[#] [$]0 [$]configure_args
|
|
#
|
|
# Compiler output produced by configure, useful for debugging
|
|
# configure, is in ./config.log if it exists.
|
|
|
|
changequote(, )dnl
|
|
ac_cs_usage="Usage: ${CONFIG_STATUS} [--recheck] [--version] [--help]"
|
|
changequote([, ])dnl
|
|
for ac_option
|
|
do
|
|
case "[\$]ac_option" in
|
|
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
|
|
echo running [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args --no-create --norecursion
|
|
exec [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args --no-create --norecursion ;;
|
|
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
|
|
echo "${CONFIG_STATUS} generated by autoconf version AC_ACVERSION"
|
|
exit 0 ;;
|
|
-help | --help | --hel | --he | --h)
|
|
echo "[\$]ac_cs_usage"; exit 0 ;;
|
|
*) echo "[\$]ac_cs_usage"; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
ac_given_srcdir=$srcdir
|
|
|
|
ifdef([AC_LIST_HEADERS],
|
|
[trap 'rm -fr $1 AC_LIST_HEADERS conftest*; exit 1' 1 2 15],
|
|
[trap 'rm -f $1; exit 1' 1 2 15])
|
|
|
|
AC_OUTPUT_FILES($1)
|
|
ifdef([AC_LIST_HEADERS], [AC_OUTPUT_HEADER(AC_LIST_HEADERS)])dnl
|
|
ifdef([AC_LIST_LINKS], [AC_OUTPUT_LINKS(AC_LIST_LINKS, AC_LIST_FILES)])dnl
|
|
$2
|
|
exit 0
|
|
EOF
|
|
chmod +x ${CONFIG_STATUS}
|
|
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} ${CONFIG_STATUS}
|
|
dnl config.status should not do recursion.
|
|
ifdef([AC_LIST_SUBDIRS], [AC_OUTPUT_SUBDIRS(AC_LIST_SUBDIRS)])dnl
|
|
])dnl
|
|
dnl
|
|
dnl This is a subroutine of AC_OUTPUT.
|
|
dnl AC_OUTPUT_MAKE_DEFS()
|
|
AC_DEFUN(AC_OUTPUT_MAKE_DEFS,
|
|
[# Transform confdefs.h into DEFS.
|
|
dnl Using a here document instead of a string reduces the quoting nightmare.
|
|
cat > conftest.defs <<\EOF
|
|
changequote(<<, >>)dnl
|
|
s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g
|
|
# Protect against shell expansion while executing Makefile rules.
|
|
s%[ `~<<#>>$^&*(){}\\|;'"<>?]%\\&%g
|
|
s%\[%\\&%g
|
|
s%\]%\\&%g
|
|
# Protect against Makefile macro expansion.
|
|
s%\$%$$%g
|
|
# Protect against being on the right side of a sed subst in config.status.
|
|
s/[\\&%]/\\&/g
|
|
changequote([, ])dnl
|
|
EOF
|
|
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
|
|
rm -f conftest.defs
|
|
])dnl
|
|
dnl
|
|
dnl This is a subroutine of AC_OUTPUT. It is called inside an unquoted
|
|
dnl here document whose contents are going into config.status.
|
|
dnl AC_OUTPUT_FILES(FILE...)
|
|
AC_DEFUN(AC_OUTPUT_FILES,
|
|
[cat > conftest.subs <<\CEOF
|
|
dnl These here document variables are unquoted when configure runs
|
|
dnl but quoted when config.status runs, so variables are expanded once.
|
|
$ac_vpsub
|
|
dnl Shell code in configure.in might set extrasub.
|
|
$extrasub
|
|
dnl Insert the sed substitutions of variables.
|
|
undivert(AC_DIVERSION_SED)
|
|
CEOF
|
|
EOF
|
|
cat >> ${CONFIG_STATUS} <<\EOF
|
|
|
|
CONFIG_FILES=${CONFIG_FILES-"$1"}
|
|
for ac_file in .. ${CONFIG_FILES}; do if test "x$ac_file" != x..; then
|
|
# Support "outfile[:infile]", defaulting infile="outfile.in".
|
|
case "$ac_file" in
|
|
*:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
|
|
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
|
*) ac_file_in="${ac_file}.in" ;;
|
|
esac
|
|
|
|
# Adjust relative srcdir, etc. for subdirectories.
|
|
|
|
# Remove last slash and all that follows it. Not all systems have dirname.
|
|
changequote(, )dnl
|
|
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
|
|
changequote([, ])dnl
|
|
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
|
|
# The file is in a subdirectory.
|
|
test ! -d "$ac_dir" && mkdir "$ac_dir"
|
|
ac_dir_suffix="/$ac_dir"
|
|
# A "../" for each directory in $ac_dir_suffix.
|
|
changequote(, )dnl
|
|
ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
|
|
changequote([, ])dnl
|
|
else
|
|
ac_dir_suffix= ac_dots=
|
|
fi
|
|
|
|
case "$ac_given_srcdir" in
|
|
.) srcdir=.
|
|
if test -z "$ac_dots"; then top_srcdir=.
|
|
else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
|
|
/*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
|
|
*) # Relative path.
|
|
srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
|
|
top_srcdir="$ac_dots$ac_given_srcdir" ;;
|
|
esac
|
|
|
|
ifdef([AC_PROVIDE_AC_PROG_INSTALL],
|
|
[ case "$ac_given_INSTALL" in
|
|
changequote(, )dnl
|
|
[/$]*) INSTALL="$ac_given_INSTALL" ;;
|
|
changequote([, ])dnl
|
|
*) INSTALL="$ac_dots$ac_given_INSTALL" ;;
|
|
esac
|
|
])dnl
|
|
echo creating "$ac_file"
|
|
rm -f "$ac_file"
|
|
comment_str="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
|
|
case "$ac_file" in
|
|
*.c | *.h | *.C | *.cc | *.cpp | *.hpp | *.m )
|
|
ac_comsub="1i\\
|
|
/* $comment_str */" ;;
|
|
* ) # Add the comment on the second line of scripts, first line of others.
|
|
ac_comsub="
|
|
1{
|
|
s/^#!/&/
|
|
t script
|
|
i\\
|
|
# $comment_str
|
|
b done
|
|
: script
|
|
a\\
|
|
# $comment_str
|
|
: done
|
|
}
|
|
" ;;
|
|
esac
|
|
sed -e "$ac_comsub
|
|
s%@srcdir@%$srcdir%g
|
|
s%@top_srcdir@%$top_srcdir%g
|
|
ifdef([AC_PROVIDE_AC_PROG_INSTALL], [s%@INSTALL@%$INSTALL%g
|
|
])dnl
|
|
" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
|
|
fi; done
|
|
rm -f conftest.subs
|
|
])dnl
|
|
dnl
|
|
dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted
|
|
dnl here document whose contents are going into config.status.
|
|
dnl AC_OUTPUT_HEADER(HEADER-FILE...)
|
|
AC_DEFUN(AC_OUTPUT_HEADER,
|
|
[changequote(<<, >>)dnl
|
|
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
|
|
# NAME is the cpp macro being defined and VALUE is the value it is being given.
|
|
#
|
|
# ac_d sets the value in "#define NAME VALUE" lines.
|
|
ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
|
|
ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
|
|
ac_dC='\3'
|
|
ac_dD='%g'
|
|
# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
|
|
ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
|
|
ac_uB='\([ ]\)%\1#\2define\3'
|
|
ac_uC=' '
|
|
ac_uD='\4%g'
|
|
# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
|
|
ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
|
|
ac_eB='<<$>>%\1#\2define\3'
|
|
ac_eC=' '
|
|
ac_eD='%g'
|
|
changequote([, ])dnl
|
|
|
|
CONFIG_HEADERS=${CONFIG_HEADERS-"$1"}
|
|
for ac_file in .. ${CONFIG_HEADERS}; do if test "x$ac_file" != x..; then
|
|
# Support "outfile[:infile]", defaulting infile="outfile.in".
|
|
case "$ac_file" in
|
|
*:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
|
|
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
|
*) ac_file_in="${ac_file}.in" ;;
|
|
esac
|
|
|
|
echo creating $ac_file
|
|
|
|
rm -f conftest.frag conftest.in conftest.out
|
|
cp $ac_given_srcdir/$ac_file_in conftest.in
|
|
|
|
EOF
|
|
|
|
# Transform confdefs.h into a sed script conftest.vals that substitutes
|
|
# the proper values into config.h.in to produce config.h.
|
|
rm -f conftest.vals
|
|
dnl Using a here document instead of a string reduces the quoting nightmare.
|
|
cat > conftest.hdr <<\EOF
|
|
changequote(<<, >>)dnl
|
|
# Protect against being on the right side of a sed subst in config.status.
|
|
s/[\\&%]/\\&/g
|
|
# Protect against being in an unquoted here document in config.status.
|
|
s%[\\$`]%\\&%g
|
|
s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
|
|
s%ac_d%ac_u%gp
|
|
s%ac_u%ac_e%gp
|
|
changequote([, ])dnl
|
|
EOF
|
|
sed -n -f conftest.hdr confdefs.h > conftest.vals
|
|
rm -f conftest.hdr
|
|
|
|
# This sed command replaces #undef with comments. This is necessary, for
|
|
# example, in the case of _POSIX_SOURCE, which is predefined and required
|
|
# on some systems where configure will not decide to define it.
|
|
cat >> conftest.vals <<\EOF
|
|
changequote(, )dnl
|
|
s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
|
|
changequote([, ])dnl
|
|
EOF
|
|
|
|
# Break up conftest.vals because some shells have a limit on
|
|
# the size of here documents, and old seds have small limits too.
|
|
# Maximum number of lines to put in a single here document.
|
|
ac_max_here_lines=12
|
|
|
|
rm -f conftest.tail
|
|
while :
|
|
do
|
|
ac_lines=`grep -c . conftest.vals`
|
|
# grep -c gives empty output for an empty file on some AIX systems.
|
|
if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
|
|
# Write a limited-size here document to conftest.frag.
|
|
echo ' cat > conftest.frag <<CEOF' >> ${CONFIG_STATUS}
|
|
sed ${ac_max_here_lines}q conftest.vals >> ${CONFIG_STATUS}
|
|
echo 'CEOF
|
|
sed -f conftest.frag conftest.in > conftest.out
|
|
mv conftest.out conftest.in
|
|
' >> ${CONFIG_STATUS}
|
|
sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
|
|
mv conftest.tail conftest.vals
|
|
done
|
|
rm -f conftest.vals
|
|
|
|
# Now back to your regularly scheduled config.status.
|
|
cat >> ${CONFIG_STATUS} <<\EOF
|
|
rm -f conftest.frag conftest.h
|
|
echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
|
|
cat conftest.in >> conftest.h
|
|
rm -f conftest.in
|
|
if cmp -s $ac_file conftest.h 2>/dev/null; then
|
|
echo "$ac_file is unchanged"
|
|
rm -f conftest.h
|
|
else
|
|
rm -f $ac_file
|
|
mv conftest.h $ac_file
|
|
fi
|
|
fi; done
|
|
|
|
])dnl
|
|
dnl
|
|
dnl AC_OUTPUT_LINKS(DEST..., SOURCE...)
|
|
AC_DEFUN(AC_OUTPUT_LINKS,
|
|
[ac_links="$1"
|
|
ac_files="$2"
|
|
while test -n "${ac_files}"; do
|
|
set ${ac_links}; ac_link=[$]1; shift; ac_links=[$]*
|
|
set ${ac_files}; ac_file=[$]1; shift; ac_files=[$]*
|
|
|
|
echo "linking ${ac_link} to ${srcdir}/${ac_file}"
|
|
|
|
if test ! -r ${srcdir}/${ac_file}; then
|
|
AC_MSG_ERROR(${srcdir}/${ac_file}: File not found)
|
|
fi
|
|
rm -f ${ac_link}
|
|
# Make a symlink if possible; otherwise try a hard link.
|
|
if ln -s ${srcdir}/${ac_file} ${ac_link} 2>/dev/null ||
|
|
ln ${srcdir}/${ac_file} ${ac_link}; then :
|
|
else
|
|
AC_MSG_ERROR(can not link ${ac_link} to ${srcdir}/${ac_file})
|
|
fi
|
|
done
|
|
])dnl
|
|
dnl
|
|
dnl AC_OUTPUT_SUBDIRS(DIRECTORY...)
|
|
AC_DEFUN(AC_OUTPUT_SUBDIRS,
|
|
[if test -z "${norecursion}"; then
|
|
|
|
# Remove --cache-file and --srcdir arguments so they do not pile up.
|
|
ac_sub_configure_args=
|
|
ac_prev=
|
|
for ac_arg in $configure_args; do
|
|
if test -n "$ac_prev"; then
|
|
ac_prev=
|
|
continue
|
|
fi
|
|
case "$ac_arg" in
|
|
-cache-file | --cache-file | --cache-fil | --cache-fi \
|
|
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
|
|
ac_prev=cache_file ;;
|
|
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
|
|
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
|
|
;;
|
|
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
|
|
ac_prev=srcdir ;;
|
|
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
|
|
;;
|
|
changequote(, )dnl
|
|
*[" "]*) ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
|
|
changequote([, ])dnl
|
|
*) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
|
|
esac
|
|
done
|
|
|
|
for ac_config_dir in $1; do
|
|
|
|
# Do not complain, so a configure script can configure whichever
|
|
# parts of a large source tree are present.
|
|
if test ! -d ${srcdir}/${ac_config_dir}; then
|
|
continue
|
|
fi
|
|
|
|
echo configuring ${ac_config_dir}
|
|
|
|
case "${srcdir}" in
|
|
.) ;;
|
|
*)
|
|
if test -d ./${ac_config_dir} || mkdir ./${ac_config_dir}; then :;
|
|
else
|
|
AC_MSG_ERROR(can not create `pwd`/${ac_config_dir})
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
ac_popdir=`pwd`
|
|
cd ${ac_config_dir}
|
|
|
|
case "${srcdir}" in
|
|
.) # No --srcdir option. We are building in place.
|
|
ac_sub_srcdir=${srcdir} ;;
|
|
/*) # Absolute path.
|
|
ac_sub_srcdir=${srcdir}/${ac_config_dir} ;;
|
|
*) # Relative path.
|
|
ac_sub_srcdir=../${srcdir}/${ac_config_dir} ;;
|
|
esac
|
|
|
|
# Check for guested configure; otherwise get Cygnus style configure.
|
|
if test -f ${ac_sub_srcdir}/configure; then
|
|
ac_sub_configure=${ac_sub_srcdir}/configure
|
|
elif test -f ${ac_sub_srcdir}/configure.in; then
|
|
ac_sub_configure=${ac_configure}
|
|
else
|
|
AC_MSG_WARN(no configuration information is in ${ac_config_dir})
|
|
ac_sub_configure=
|
|
fi
|
|
|
|
# The recursion is here.
|
|
if test -n "${ac_sub_configure}"; then
|
|
|
|
# Make the cache file name correct relative to the subdirectory.
|
|
changequote(, )dnl
|
|
# A "../" for each directory in /${ac_config_dir}.
|
|
ac_dots=`echo /${ac_config_dir}|sed 's%/[^/]*%../%g'`
|
|
changequote([, ])dnl
|
|
case "$cache_file" in
|
|
/*) ac_sub_cache_file=$cache_file ;;
|
|
*) # Relative path.
|
|
ac_sub_cache_file="$ac_dots$cache_file" ;;
|
|
esac
|
|
|
|
echo "[running ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file] --srcdir=${ac_sub_srcdir}"
|
|
if ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file --srcdir=${ac_sub_srcdir}
|
|
then :
|
|
else
|
|
AC_MSG_ERROR(${ac_sub_configure} failed for ${ac_config_dir})
|
|
fi
|
|
fi
|
|
|
|
cd ${ac_popdir}
|
|
done
|
|
fi
|
|
])dnl
|
|
dnl
|