From 580e09f7c7d9473443b7b93ff1ab7bcfb6310642 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Fri, 20 Jul 2007 17:51:21 +0000 Subject: [PATCH] Update all of the .m4 files using Apple-shipped autoconf with a change to functions.m4 to make the output match what is currently ni the tree from VZ. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47595 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- build/autoconf_prepend-include/autoconf/c.m4 | 914 ++++++-- .../autoconf/functions.m4 | 2048 +++++++++++++++++ .../autoconf/general.m4 | 1235 +++++----- .../autoconf_prepend-include/autoconf/libs.m4 | 172 +- .../autoconf/status.m4 | 1850 +++++++-------- 5 files changed, 4462 insertions(+), 1757 deletions(-) create mode 100644 build/autoconf_prepend-include/autoconf/functions.m4 diff --git a/build/autoconf_prepend-include/autoconf/c.m4 b/build/autoconf_prepend-include/autoconf/c.m4 index 76865a886a..e37388979b 100644 --- a/build/autoconf_prepend-include/autoconf/c.m4 +++ b/build/autoconf_prepend-include/autoconf/c.m4 @@ -1,6 +1,7 @@ -# This file is part of Autoconf. -*- Autoconf -*- +# This file is part of Autoconf. -*- Autoconf -*- # Programming languages support. -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software +# Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,8 +15,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception, the Free Software Foundation gives unlimited # permission to copy, distribute and modify the configure scripts that @@ -45,6 +46,7 @@ # to the GPL from your modified version. # # Written by David MacKenzie, with help from +# Akim Demaille, Paul Eggert, # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, # Roland McGrath, Noah Friedman, david d zuhn, and many others. @@ -90,7 +92,7 @@ m4_define([_AC_LANG_PREFIX(C)], [C]) # ------------ # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. m4_define([AC_LANG(C++)], -[ac_ext=cc +[ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD' @@ -114,6 +116,38 @@ m4_define([_AC_LANG_PREFIX(C++)], [CXX]) +# ------------------------------ # +# 1d. The Objective C language. # +# ------------------------------ # + + +# AC_LANG(Objective C) +# -------------------- +m4_define([AC_LANG(Objective C)], +[ac_ext=m +ac_cpp='$OBJCPP $CPPFLAGS' +ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD' +ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD' +ac_compiler_gnu=$ac_cv_objc_compiler_gnu +]) + + +# AC_LANG_OBJC +# ------------ +AU_DEFUN([AC_LANG_OBJC], [AC_LANG(Objective C)]) + + +# _AC_LANG_ABBREV(Objective C) +# ---------------------------- +m4_define([_AC_LANG_ABBREV(Objective C)], [objc]) + + +# _AC_LANG_PREFIX(Objective C) +# ---------------------------- +m4_define([_AC_LANG_PREFIX(Objective C)], [OBJC]) + + + ## ---------------------- ## ## 2.Producing programs. ## ## ---------------------- ## @@ -125,7 +159,6 @@ m4_define([_AC_LANG_PREFIX(C++)], [CXX]) # AC_LANG_SOURCE(C)(BODY) # ----------------------- -# This sometimes fails to find confdefs.h, for some reason. # We can't use '#line $LINENO "configure"' here, since # Sun c89 (Sun WorkShop 6 update 2 C 5.3 Patch 111679-08 2002/05/09) # rejects $LINENO greater than 32767, and some configure scripts @@ -162,13 +195,13 @@ $2 m4_define([AC_LANG_CALL(C)], [AC_LANG_PROGRAM([$1 m4_if([$2], [main], , -[/* Override any gcc2 internal prototype to avoid an error. */ +[/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $2 ();])], [$2 ();])]) +char $2 ();])], [return $2 ();])]) # AC_LANG_FUNC_LINK_TRY(C)(FUNCTION) @@ -204,30 +237,26 @@ m4_define([AC_LANG_FUNC_LINK_TRY(C)], #undef $1 -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" -{ #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char $1 (); /* 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) +#if defined __stub_$1 || defined __stub___$1 choke me -#else -char (*f) () = $1; #endif -#ifdef __cplusplus -} -#endif -], [return f != $1;])]) +], [return $1 ();])]) # AC_LANG_BOOL_COMPILE_TRY(C)(PROLOGUE, EXPRESSION) # ------------------------------------------------- +# Return a program that is valid if EXPRESSION is nonzero. +# EXPRESSION must be an integer constant expression. # Be sure to use this array to avoid `unused' warnings, which are even # errors with `-W error'. m4_define([AC_LANG_BOOL_COMPILE_TRY(C)], @@ -242,29 +271,29 @@ test_array @<:@0@:>@ = 0 # But we include them only after the EXPRESSION has been evaluated. m4_define([AC_LANG_INT_SAVE(C)], [AC_LANG_PROGRAM([$1 -long longval () { return $2; } -unsigned long ulongval () { return $2; } +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } @%:@include @%:@include ], [ FILE *f = fopen ("conftest.val", "w"); if (! f) - exit (1); + return 1; if (($2) < 0) { - long i = longval (); + long int i = longval (); if (i != ($2)) - exit (1); + return 1; fprintf (f, "%ld\n", i); } else { - unsigned long i = ulongval (); + unsigned long int i = ulongval (); if (i != ($2)) - exit (1); + return 1; fprintf (f, "%lu\n", i); } - exit (ferror (f) || fclose (f) != 0); + return ferror (f) || fclose (f) != 0; ])]) @@ -303,6 +332,41 @@ m4_copy([AC_LANG_INT_SAVE(C)], [AC_LANG_INT_SAVE(C++)]) +# ------------------------- # +# 2d. Objective C sources. # +# ------------------------- # + +# AC_LANG_SOURCE(Objective C)(BODY) +# --------------------------------- +m4_copy([AC_LANG_SOURCE(C)], [AC_LANG_SOURCE(Objective C)]) + + +# AC_LANG_PROGRAM(Objective C)([PROLOGUE], [BODY]) +# ------------------------------------------------ +m4_copy([AC_LANG_PROGRAM(C)], [AC_LANG_PROGRAM(Objective C)]) + + +# AC_LANG_CALL(Objective C)(PROLOGUE, FUNCTION) +# --------------------------------------------- +m4_copy([AC_LANG_CALL(C)], [AC_LANG_CALL(Objective C)]) + + +# AC_LANG_FUNC_LINK_TRY(Objective C)(FUNCTION) +# -------------------------------------------- +m4_copy([AC_LANG_FUNC_LINK_TRY(C)], [AC_LANG_FUNC_LINK_TRY(Objective C)]) + + +# AC_LANG_BOOL_COMPILE_TRY(Objective C)(PROLOGUE, EXPRESSION) +# ----------------------------------------------------------- +m4_copy([AC_LANG_BOOL_COMPILE_TRY(C)], [AC_LANG_BOOL_COMPILE_TRY(Objective C)]) + + +# AC_LANG_INT_SAVE(Objective C)(PROLOGUE, EXPRESSION) +# --------------------------------------------------- +m4_copy([AC_LANG_INT_SAVE(C)], [AC_LANG_INT_SAVE(Objective C)]) + + + ## -------------------------------------------- ## ## 3. Looking for Compilers and Preprocessors. ## ## -------------------------------------------- ## @@ -315,23 +379,31 @@ m4_copy([AC_LANG_INT_SAVE(C)], [AC_LANG_INT_SAVE(C++)]) # _AC_ARG_VAR_CPPFLAGS # -------------------- # Document and register CPPFLAGS, which is used by -# AC_PROG_{CC, CPP, CXX, CXXCPP}. +# AC_PROG_{CC, CPP, CXX, CXXCPP, OBJC, OBJCPP}. AC_DEFUN([_AC_ARG_VAR_CPPFLAGS], [AC_ARG_VAR([CPPFLAGS], - [C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory ])]) + [C/C++/Objective C preprocessor flags, e.g. -I + if you have headers in a nonstandard directory ])]) # _AC_ARG_VAR_LDFLAGS # ------------------- # Document and register LDFLAGS, which is used by -# AC_PROG_{CC, CXX, F77}. +# AC_PROG_{CC, CXX, F77, FC, OBJC}. AC_DEFUN([_AC_ARG_VAR_LDFLAGS], [AC_ARG_VAR([LDFLAGS], [linker flags, e.g. -L if you have libraries in a nonstandard directory ])]) +# _AC_ARG_VAR_LIBS +# ---------------- +# Document and register LIBS, which is used by +# AC_PROG_{CC, CXX, F77, FC, OBJS}. +AC_DEFUN([_AC_ARG_VAR_LIBS], +[AC_ARG_VAR([LIBS], + [libraries to pass to the linker, e.g. -l])]) + # AC_LANG_PREPROC(C) # ------------------- @@ -344,7 +416,6 @@ AC_DEFUN([AC_LANG_PREPROC(C)], # ----------------------------------------------- # Check if $ac_cpp is a working preprocessor that can flag absent # includes either by the exit status or by warnings. -# Set ac_cpp_err to a non-empty value if the preprocessor failed. # This macro is for all languages, not only C. AC_DEFUN([_AC_PROG_PREPROC_WORKS_IFELSE], [ac_preproc_ok=false @@ -366,7 +437,7 @@ do [# Broken: fails on valid input. continue]) - # OK, works on sane cases. Now check whether non-existent headers + # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ]])], [# Broken: success on invalid input. @@ -453,45 +524,43 @@ AC_DEFUN([AC_PROG_CC], AC_ARG_VAR([CC], [C compiler command])dnl AC_ARG_VAR([CFLAGS], [C compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl +_AC_ARG_VAR_LIBS()dnl _AC_ARG_VAR_CPPFLAGS()dnl m4_ifval([$1], [AC_CHECK_TOOLS(CC, [$1])], [AC_CHECK_TOOL(CC, gcc) if test -z "$CC"; then - AC_CHECK_TOOL(CC, cc) + dnl Here we want: + dnl AC_CHECK_TOOL(CC, cc) + dnl but without the check for a tool without the prefix. + dnl Until the check is removed from there, copy the code: + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc]) + fi fi if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi if test -z "$CC"; then - AC_CHECK_TOOLS(CC, cl) + AC_CHECK_TOOLS(CC, cl.exe) fi ]) test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH]) # Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD +_AS_ECHO_LOG([checking for _AC_LANG compiler version]) ac_compiler=`set X $ac_compile; echo $[2]` -_AC_EVAL([$ac_compiler --version &AS_MESSAGE_LOG_FD]) -_AC_EVAL([$ac_compiler -v &AS_MESSAGE_LOG_FD]) -_AC_EVAL([$ac_compiler -V &AS_MESSAGE_LOG_FD]) +_AC_DO([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) +_AC_DO([$ac_compiler -v >&AS_MESSAGE_LOG_FD]) +_AC_DO([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl _AC_LANG_COMPILER_GNU GCC=`test $ac_compiler_gnu = yes && echo yes` _AC_PROG_CC_G -_AC_PROG_CC_STDC -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -_AC_COMPILE_IFELSE([@%:@ifndef __cplusplus - choke me -@%:@endif], - [_AC_PROG_CXX_EXIT_DECLARATION]) +_AC_PROG_CC_C89 AC_LANG_POP(C)dnl ])# AC_PROG_CC @@ -501,13 +570,25 @@ AC_LANG_POP(C)dnl # Check whether -g works, even if CFLAGS is set, in case the package # plays around with CFLAGS (such as to build both debugging and normal # versions of a library), tasteless as that idea is. +# Don't consider -g to work if it generates warnings when plain compiles don't. m4_define([_AC_PROG_CC_G], [ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -CFLAGS="$CFLAGS -g" AC_CACHE_CHECK(whether $CC accepts -g, ac_cv_prog_cc_g, - [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cc_g=yes], - [ac_cv_prog_cc_g=no])]) + [ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [ac_cv_prog_cc_g=yes], + [CFLAGS="" + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [], + [ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [ac_cv_prog_cc_g=yes])])]) + ac_c_werror_flag=$ac_save_c_werror_flag]) if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then @@ -530,7 +611,8 @@ fi[]dnl # ----------------------- AN_FUNCTION([ioctl], [AC_PROG_GCC_TRADITIONAL]) AC_DEFUN([AC_PROG_GCC_TRADITIONAL], -[if test $ac_cv_c_compiler_gnu = yes; then +[AC_REQUIRE([AC_PROG_CC])dnl +if test $ac_cv_c_compiler_gnu = yes; then AC_CACHE_CHECK(whether $CC needs -traditional, ac_cv_prog_gcc_traditional, [ ac_pattern="Autoconf.*'x'" @@ -566,17 +648,19 @@ AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o, # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. -ac_try='$CC -c conftest.$ac_ext -o conftest.$ac_objext >&AS_MESSAGE_LOG_FD' -if AC_TRY_EVAL(ac_try) && - test -f conftest.$ac_objext && AC_TRY_EVAL(ac_try); +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD' +rm -f conftest2.* +if _AC_DO_VAR(ac_try) && + test -f conftest2.$ac_objext && _AC_DO_VAR(ac_try); then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. - if AC_TRY_COMMAND(cc -c conftest.$ac_ext >&AS_MESSAGE_LOG_FD); then - ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&AS_MESSAGE_LOG_FD' - if AC_TRY_EVAL(ac_try) && - test -f conftest.$ac_objext && AC_TRY_EVAL(ac_try); + if _AC_DO_TOKENS(cc -c conftest.$ac_ext >&AS_MESSAGE_LOG_FD); then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD' + rm -f conftest2.* + if _AC_DO_VAR(ac_try) && + test -f conftest2.$ac_objext && _AC_DO_VAR(ac_try); then # cc works too. : @@ -589,9 +673,9 @@ then else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi -rm -f conftest* +rm -f core conftest* ])dnl -if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) @@ -681,26 +765,31 @@ AC_DEFUN([AC_PROG_CXX], AC_ARG_VAR([CXX], [C++ compiler command])dnl AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl +_AC_ARG_VAR_LIBS()dnl _AC_ARG_VAR_CPPFLAGS()dnl -AC_CHECK_TOOLS(CXX, - [$CCC m4_default([$1], - [g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC])], - g++) - +_AC_ARG_VAR_PRECIOUS([CCC])dnl +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + AC_CHECK_TOOLS(CXX, + [m4_default([$1], + [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC])], + g++) + fi +fi # Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD +_AS_ECHO_LOG([checking for _AC_LANG compiler version]) ac_compiler=`set X $ac_compile; echo $[2]` -_AC_EVAL([$ac_compiler --version &AS_MESSAGE_LOG_FD]) -_AC_EVAL([$ac_compiler -v &AS_MESSAGE_LOG_FD]) -_AC_EVAL([$ac_compiler -V &AS_MESSAGE_LOG_FD]) +_AC_DO([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) +_AC_DO([$ac_compiler -v >&AS_MESSAGE_LOG_FD]) +_AC_DO([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl _AC_LANG_COMPILER_GNU GXX=`test $ac_compiler_gnu = yes && echo yes` _AC_PROG_CXX_G -_AC_PROG_CXX_EXIT_DECLARATION AC_LANG_POP(C++)dnl ])# AC_PROG_CXX @@ -710,21 +799,32 @@ AC_LANG_POP(C++)dnl # Check whether -g works, even if CXXFLAGS is set, in case the package # plays around with CXXFLAGS (such as to build both debugging and # normal versions of a library), tasteless as that idea is. +# Don't consider -g to work if it generates warnings when plain compiles don't. m4_define([_AC_PROG_CXX_G], [ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" AC_CACHE_CHECK(whether $CXX accepts -g, ac_cv_prog_cxx_g, - [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - [ac_cv_prog_cxx_g=yes], - [ac_cv_prog_cxx_g=no])]) + [ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [ac_cv_prog_cxx_g=yes], + [CXXFLAGS="" + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [], + [ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [ac_cv_prog_cxx_g=yes])])]) + ac_cxx_werror_flag=$ac_save_cxx_werror_flag]) if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then - CXXFLAGS="$CXXFLAGS -g -O2" + CXXFLAGS="-g -O2" else - CXXFLAGS="$CXXFLAGS -g" + CXXFLAGS="-g" fi else if test "$GXX" = yes; then @@ -736,40 +836,168 @@ fi[]dnl ])# _AC_PROG_CXX_G -# _AC_PROG_CXX_EXIT_DECLARATION -# ----------------------------- -# If doesn't already provide a valid prototype for exit, -# determine the appropriate prototype and put it in confdefs.h. -# This macro is run only when testing a C++ compiler, but it generates -# a prototype that is also appropriate for C compilers in order to -# support a mixed C/C++ configuration environment. -# We don't need to worry about this for C, since we include -# if it is available, and that method works for all C compilers. -m4_define([_AC_PROG_CXX_EXIT_DECLARATION], -[for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration -@%:@include ], - [exit (42);])], - [], - [continue]) - _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration], - [exit (42);])], - [break]) -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h +# AC_PROG_CXX_C_O +# --------------- +# Test if the C++ compiler accepts the options `-c' and `-o' +# simultaneously, and define `CXX_NO_MINUS_C_MINUS_O' if it does not. +AC_DEFUN([AC_PROG_CXX_C_O], +[AC_REQUIRE([AC_PROG_CXX])dnl +AC_LANG_PUSH([C++])dnl +AC_CACHE_CHECK([whether $CXX understands -c and -o together], + [ac_cv_prog_cxx_c_o], +[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) +# We test twice because some compilers refuse to overwrite an existing +# `.o' file with `-o', although they will create one. +ac_try='$CXX $CXXFLAGS -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD' +rm -f conftest2.* +if _AC_DO_VAR(ac_try) && + test -f conftest2.$ac_objext && + _AC_DO_VAR(ac_try); then + ac_cv_prog_cxx_c_o=yes +else + ac_cv_prog_cxx_c_o=no fi -])# _AC_PROG_CXX_EXIT_DECLARATION +rm -f conftest*]) +if test $ac_cv_prog_cxx_c_o = no; then + AC_DEFINE(CXX_NO_MINUS_C_MINUS_O, 1, + [Define to 1 if your C++ compiler doesn't accept + -c and -o together.]) +fi +AC_LANG_POP([C++])dnl +])# AC_PROG_CXX_C_O + + +# ------------------------------ # +# 3d. The Objective C compiler. # +# ------------------------------ # + + +# AC_LANG_PREPROC(Objective C) +# ---------------------------- +# Find the Objective C preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able. +AC_DEFUN([AC_LANG_PREPROC(Objective C)], +[AC_REQUIRE([AC_PROG_OBJCPP])]) + + +# AC_PROG_OBJCPP +# -------------- +# Find a working Objective C preprocessor. +AC_DEFUN([AC_PROG_OBJCPP], +[AC_REQUIRE([AC_PROG_OBJC])dnl +AC_ARG_VAR([OBJCPP], [Objective C preprocessor])dnl +_AC_ARG_VAR_CPPFLAGS()dnl +AC_LANG_PUSH(Objective C)dnl +AC_MSG_CHECKING([how to run the Objective C preprocessor]) +if test -z "$OBJCPP"; then + AC_CACHE_VAL(ac_cv_prog_OBJCPP, + [dnl + # Double quotes because OBJCPP needs to be expanded + for OBJCPP in "$OBJC -E" "/lib/cpp" + do + _AC_PROG_PREPROC_WORKS_IFELSE([break]) + done + ac_cv_prog_OBJCPP=$OBJCPP + ])dnl + OBJCPP=$ac_cv_prog_OBJCPP +else + ac_cv_prog_OBJCPP=$OBJCPP +fi +AC_MSG_RESULT([$OBJCPP]) +_AC_PROG_PREPROC_WORKS_IFELSE([], + [AC_MSG_FAILURE([Objective C preprocessor "$OBJCPP" fails sanity check])]) +AC_SUBST(OBJCPP)dnl +AC_LANG_POP(Objective C)dnl +])# AC_PROG_OBJCPP + + +# AC_LANG_COMPILER(Objective C) +# ----------------------------- +# Find the Objective C compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able. +AC_DEFUN([AC_LANG_COMPILER(Objective C)], +[AC_REQUIRE([AC_PROG_OBJC])]) + + + +# AC_PROG_OBJC([LIST-OF-COMPILERS]) +# --------------------------------- +# LIST-OF-COMPILERS is a space separated list of Objective C compilers to +# search for (if not specified, a default list is used). This just gives +# the user an opportunity to specify an alternative search list for the +# Objective C compiler. +# objcc StepStone Objective-C compiler (also "standard" name for OBJC) +# objc David Stes' POC. If you installed this, you likely want it. +# cc Native C compiler (for instance, Apple). +# CC You never know. +AN_MAKEVAR([OBJC], [AC_PROG_OBJC]) +AN_PROGRAM([objcc], [AC_PROG_OBJC]) +AN_PROGRAM([objc], [AC_PROG_OBJC]) +AC_DEFUN([AC_PROG_OBJC], +[AC_LANG_PUSH(Objective C)dnl +AC_ARG_VAR([OBJC], [Objective C compiler command])dnl +AC_ARG_VAR([OBJCFLAGS], [Objective C compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +_AC_ARG_VAR_LIBS()dnl +_AC_ARG_VAR_CPPFLAGS()dnl +_AC_ARG_VAR_PRECIOUS([OBJC])dnl +AC_CHECK_TOOLS(OBJC, + [m4_default([$1], [gcc objcc objc cc CC])], + gcc) +# Provide some information about the compiler. +_AS_ECHO_LOG([checking for _AC_LANG compiler version]) +ac_compiler=`set X $ac_compile; echo $[2]` +_AC_DO([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) +_AC_DO([$ac_compiler -v >&AS_MESSAGE_LOG_FD]) +_AC_DO([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) + +m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl +_AC_LANG_COMPILER_GNU +GOBJC=`test $ac_compiler_gnu = yes && echo yes` +_AC_PROG_OBJC_G +AC_LANG_POP(Objective C)dnl +])# AC_PROG_OBJC + + +# _AC_PROG_OBJC_G +# --------------- +# Check whether -g works, even if OBJCFLAGS is set, in case the package +# plays around with OBJCFLAGS (such as to build both debugging and +# normal versions of a library), tasteless as that idea is. +# Don't consider -g to work if it generates warnings when plain compiles don't. +m4_define([_AC_PROG_OBJC_G], +[ac_test_OBJCFLAGS=${OBJCFLAGS+set} +ac_save_OBJCFLAGS=$OBJCFLAGS +AC_CACHE_CHECK(whether $OBJC accepts -g, ac_cv_prog_objc_g, + [ac_save_objc_werror_flag=$ac_objc_werror_flag + ac_objc_werror_flag=yes + ac_cv_prog_objc_g=no + OBJCFLAGS="-g" + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [ac_cv_prog_objc_g=yes], + [OBJCFLAGS="" + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [], + [ac_objc_werror_flag=$ac_save_objc_werror_flag + OBJCFLAGS="-g" + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [ac_cv_prog_objc_g=yes])])]) + ac_objc_werror_flag=$ac_save_objc_werror_flag]) +if test "$ac_test_OBJCFLAGS" = set; then + OBJCFLAGS=$ac_save_OBJCFLAGS +elif test $ac_cv_prog_objc_g = yes; then + if test "$GOBJC" = yes; then + OBJCFLAGS="-g -O2" + else + OBJCFLAGS="-g" + fi +else + if test "$GOBJC" = yes; then + OBJCFLAGS="-O2" + else + OBJCFLAGS= + fi +fi[]dnl +])# _AC_PROG_OBJC_G @@ -785,19 +1013,15 @@ fi # 4b. C compiler characteristics. # # -------------------------------- # -# _AC_PROG_CC_STDC -# ---------------- -# If the C compiler in not in ANSI C mode by default, try to add an -# option to output variable @code{CC} to make it so. This macro tries -# various options that select ANSI C on some system or another. It -# considers the compiler to be in ANSI C mode if it handles function -# prototypes correctly. -AC_DEFUN([_AC_PROG_CC_STDC], -[AC_MSG_CHECKING([for $CC option to accept ANSI C]) -AC_CACHE_VAL(ac_cv_prog_cc_stdc, -[ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -AC_LANG_CONFTEST([AC_LANG_PROGRAM( +# _AC_PROG_CC_C89 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +# ---------------------------------------------------------------- +# If the C compiler is not in ANSI C89 (ISO C90) mode by default, try +# to add an option to output variable CC to make it so. This macro +# tries various options that select ANSI C89 on some system or +# another. It considers the compiler to be in ANSI C89 mode if it +# handles function prototypes correctly. +AC_DEFUN([_AC_PROG_CC_C89], +[_AC_C_STD_TRY([c89], [[#include #include #include @@ -824,50 +1048,260 @@ static char *f (char * (*g) (char **, int), char **p, ...) /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get + as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ + that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv;]], -[[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];]])]) -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +[[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];]], +dnl Don't try gcc -ansi; that turns off useful extensions and +dnl breaks some systems' header files. +dnl AIX circa 2003 -qlanglvl=extc89 +dnl old AIX -qlanglvl=ansi +dnl Ultrix, OSF/1, Tru64 -std +dnl HP-UX 10.20 and later -Ae +dnl HP-UX older versions -Aa -D_HPUX_SOURCE +dnl SVR4 -Xc -D__EXTENSIONS__ +[-qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"], [$1], [$2])[]dnl +])# _AC_PROG_CC_C89 + + +# _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST, +# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) +# -------------------------------------------------------------- +# Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99') +# by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails, +# try again with each compiler option in the space-separated OPTION-LIST; if one +# helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE, +# else ACTION-IF-UNAVAILABLE. +AC_DEFUN([_AC_C_STD_TRY], +[AC_MSG_CHECKING([for $CC option to accept ISO ]m4_translit($1, [c], [C])) +AC_CACHE_VAL(ac_cv_prog_cc_$1, +[ac_cv_prog_cc_$1=no +ac_save_CC=$CC +AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])]) +for ac_arg in '' $4 do CC="$ac_save_CC $ac_arg" - _AC_COMPILE_IFELSE([], - [ac_cv_prog_cc_stdc=$ac_arg -break]) + _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg]) + test "x$ac_cv_prog_cc_$1" != "xno" && break done -rm -f conftest.$ac_ext conftest.$ac_objext +rm -f conftest.$ac_ext CC=$ac_save_CC -]) -case "x$ac_cv_prog_cc_stdc" in - x|xno) +])# AC_CACHE_VAL +case "x$ac_cv_prog_cc_$1" in + x) AC_MSG_RESULT([none needed]) ;; + xno) + AC_MSG_RESULT([unsupported]) ;; *) - AC_MSG_RESULT([$ac_cv_prog_cc_stdc]) - CC="$CC $ac_cv_prog_cc_stdc" ;; + CC="$CC $ac_cv_prog_cc_$1" + AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;; esac -])# _AC_PROG_CC_STDC +AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6]) +])# _AC_C_STD_TRY + + +# _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +# ---------------------------------------------------------------- +# If the C compiler is not in ISO C99 mode by default, try to add an +# option to output variable CC to make it so. This macro tries +# various options that select ISO C99 on some system or another. It +# considers the compiler to be in ISO C99 mode if it handles _Bool, +# // comments, flexible array members, inline, long long int, mixed +# code and declarations, named initialization of structs, restrict, +# va_copy, varargs macros, variable declarations in for loops and +# variable length arrays. +AC_DEFUN([_AC_PROG_CC_C99], +[_AC_C_STD_TRY([c99], +[[#include +#include +#include +#include +#include + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} +]], +[[ + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); +]], +dnl Try +dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999) +dnl AIX -qlanglvl=extc99 (unused restrictive mode: -qlanglvl=stdc99) +dnl Intel ICC -c99 +dnl IRIX -c99 +dnl Solaris (unused because it causes the compiler to assume C99 semantics for +dnl library functions, and this is invalid before Solaris 10: -xc99) +dnl Tru64 -c99 +dnl with extended modes being tried first. +[[-std=gnu99 -c99 -qlanglvl=extc99]], [$1], [$2])[]dnl +])# _AC_PROG_CC_C99 + + +# AC_PROG_CC_C89 +# -------------- +AC_DEFUN([AC_PROG_CC_C89], +[ AC_REQUIRE([AC_PROG_CC])dnl + _AC_PROG_CC_C89 +]) + + +# AC_PROG_CC_C99 +# -------------- +AC_DEFUN([AC_PROG_CC_C99], +[ AC_REQUIRE([AC_PROG_CC])dnl + _AC_PROG_CC_C99 +]) # AC_PROG_CC_STDC # --------------- -# Has been merged into AC_PROG_CC. -AU_DEFUN([AC_PROG_CC_STDC], []) +AC_DEFUN([AC_PROG_CC_STDC], +[ AC_REQUIRE([AC_PROG_CC])dnl + AS_CASE([$ac_cv_prog_cc_stdc], + [no], [ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no], + [_AC_PROG_CC_C99([ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99], + [_AC_PROG_CC_C89([ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89], + [ac_cv_prog_cc_stdc=no])])])dnl + AC_MSG_CHECKING([for $CC option to accept ISO Standard C]) + AC_CACHE_VAL([ac_cv_prog_cc_stdc], []) + AS_CASE([$ac_cv_prog_cc_stdc], + [no], [AC_MSG_RESULT([unsupported])], + [''], [AC_MSG_RESULT([none needed])], + [AC_MSG_RESULT([$ac_cv_prog_cc_stdc])]) +]) # AC_C_BACKSLASH_A @@ -917,28 +1351,6 @@ fi ])# AC_C_CHAR_UNSIGNED -# AC_C_LONG_DOUBLE -# ---------------- -AC_DEFUN([AC_C_LONG_DOUBLE], -[AC_CACHE_CHECK( - [for working long double with more range or precision than double], - [ac_cv_c_long_double], - [AC_COMPILE_IFELSE( - [AC_LANG_BOOL_COMPILE_TRY( - [#include - long double foo = 0.0;], - [/* Using '|' rather than '||' catches a GCC 2.95.2 x86 bug. */ - (DBL_MAX < LDBL_MAX) | (LDBL_EPSILON < DBL_EPSILON) - | (DBL_MAX_EXP < LDBL_MAX_EXP) | (DBL_MANT_DIG < LDBL_MANT_DIG)])], - ac_cv_c_long_double=yes, - ac_cv_c_long_double=no)]) -if test $ac_cv_c_long_double = yes; then - AC_DEFINE(HAVE_LONG_DOUBLE, 1, - [Define to 1 if long double works and has more range or precision than double.]) -fi -])# AC_C_LONG_DOUBLE - - # AC_C_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN]) # ------------------------------------------------------------------------- AC_DEFUN([AC_C_BIGENDIAN], @@ -947,7 +1359,8 @@ AC_DEFUN([AC_C_BIGENDIAN], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include #include ], -[#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN +[#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) bogus endian macros #endif ])], @@ -960,28 +1373,26 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ])], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=no])], [# It does not; compile a test program. AC_RUN_IFELSE( -[AC_LANG_SOURCE([[int -main () -{ +[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[ /* Are we little or big endian? From Harbison&Steele. */ union { - long l; - char c[sizeof (long)]; + long int l; + char c[sizeof (long int)]; } u; u.l = 1; - exit (u.c[sizeof (long) - 1] == 1); -}]])], + return u.c[sizeof (long int) - 1] == 1; +]])], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [# try to guess the endianness by grepping values into an object file ac_cv_c_bigendian=unknown AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +[[short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }]], [[ _ascii (); _ebcdic (); ]])], [if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then @@ -1032,7 +1443,8 @@ static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif ])], - [ac_cv_c_inline=$ac_kw; break]) + [ac_cv_c_inline=$ac_kw]) + test "$ac_cv_c_inline" != no && break done ]) AH_VERBATIM([inline], @@ -1068,10 +1480,10 @@ AC_DEFUN([AC_C_CONST], #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; - const charset x; + const charset cs; /* SunOS 4.1.1 cc rejects this. */ - char const *const *ccp; - char **p; + char const *const *pcpcc; + char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; @@ -1080,16 +1492,17 @@ AC_DEFUN([AC_C_CONST], an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; - ccp = &g + (g ? g-g : 0); + pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ - ++ccp; - p = (char**) ccp; - ccp = (char const *const *) p; + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; + if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; @@ -1108,7 +1521,9 @@ AC_DEFUN([AC_C_CONST], } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; + if (!foo) return 0; } + return !cs[0] && !zero.x; #endif ]])], [ac_cv_c_const=yes], @@ -1123,7 +1538,7 @@ fi # AC_C_RESTRICT # ------------- # based on acx_restrict.m4, from the GNU Autoconf Macro Archive at: -# http://www.gnu.org/software/ac-archive/htmldoc/acx_restrict.html +# http://autoconf-archive.cryp.to/acx_restrict.html # # Determine whether the C/C++ compiler supports the "restrict" keyword # introduced in ANSI C99, or an equivalent. Do nothing if the compiler @@ -1140,9 +1555,17 @@ AC_DEFUN([AC_C_RESTRICT], # Try the official restrict keyword, then gcc's __restrict, and # the less common variants. for ac_kw in restrict __restrict __restrict__ _Restrict; do - AC_COMPILE_IFELSE([AC_LANG_SOURCE( - [float * $ac_kw x;])], - [ac_cv_c_restrict=$ac_kw; break]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[typedef int * int_ptr; + int foo (int_ptr $ac_kw ip) { + return ip[0]; + }]], + [[int s[1]; + int * $ac_kw t = s; + t[0] = 0; + return foo(t)]])], + [ac_cv_c_restrict=$ac_kw]) + test "$ac_cv_c_restrict" != no && break done ]) case $ac_cv_c_restrict in @@ -1168,7 +1591,8 @@ AC_DEFUN([AC_C_VOLATILE], [AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ volatile int x; -int * volatile y;])], +int * volatile y = (int *) 0; +return !x && !y;])], [ac_cv_c_volatile=yes], [ac_cv_c_volatile=no])]) if test $ac_cv_c_volatile = no; then @@ -1207,7 +1631,7 @@ fi AC_DEFUN([AC_C_PROTOTYPES], [AC_REQUIRE([AC_PROG_CC])dnl AC_MSG_CHECKING([for function prototypes]) -if test "$ac_cv_prog_cc_stdc" != no; then +if test "$ac_cv_prog_cc_c89" != no; then AC_MSG_RESULT([yes]) AC_DEFINE(PROTOTYPES, 1, [Define to 1 if the C compiler supports function prototypes.]) @@ -1217,3 +1641,97 @@ else AC_MSG_RESULT([no]) fi ])# AC_C_PROTOTYPES + + +# AC_C_FLEXIBLE_ARRAY_MEMBER +# -------------------------- +# Check whether the C compiler supports flexible array members. +AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER], +[ + AC_CACHE_CHECK([for flexible array members], + ac_cv_c_flexmember, + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + #include + struct s { int n; double d[]; };]], + [[int m = getchar (); + struct s *p = malloc (offsetof (struct s, d) + + m * sizeof (double)); + p->d[0] = 0.0; + return p->d != (double *) NULL;]])], + [ac_cv_c_flexmember=yes], + [ac_cv_c_flexmember=no])]) + if test $ac_cv_c_flexmember = yes; then + AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [], + [Define to nothing if C supports flexible array members, and to + 1 if it does not. That way, with a declaration like `struct s + { int n; double d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack + can be used with pre-C99 compilers. + When computing the size of such an object, don't use 'sizeof (struct s)' + as it overestimates the size. Use 'offsetof (struct s, d)' instead. + Don't use 'offsetof (struct s, d@<:@0@:>@)', as this doesn't work with + MSVC and with C++ compilers.]) + else + AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], 1) + fi +]) + + +# AC_C_VARARRAYS +# -------------- +# Check whether the C compiler supports variable-length arrays. +AC_DEFUN([AC_C_VARARRAYS], +[ + AC_CACHE_CHECK([for variable-length arrays], + ac_cv_c_vararrays, + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], + [[static int x; char a[++x]; a[sizeof a - 1] = 0; return a[0];]])], + [ac_cv_c_vararrays=yes], + [ac_cv_c_vararrays=no])]) + if test $ac_cv_c_vararrays = yes; then + AC_DEFINE([HAVE_C_VARARRAYS], 1, + [Define to 1 if C supports variable-length arrays.]) + fi +]) + + +# AC_C_TYPEOF +# ----------- +# Check if the C compiler supports GCC's typeof syntax. +# The test case provokes incompatibilities in the Sun C compilers +# (both Solaris 8 and Solaris 10). +AC_DEFUN([AC_C_TYPEOF], +[ + AC_CACHE_CHECK([for typeof syntax and keyword spelling], ac_cv_c_typeof, + [ac_cv_c_typeof=no + for ac_kw in typeof __typeof__ no; do + test $ac_kw = no && break + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], + [[ + int value; + typedef struct { + char a [1 + + ! (($ac_kw (value)) + (($ac_kw (value)) 0 < ($ac_kw (value)) -1 + ? ($ac_kw (value)) - 1 + : ~ (~ ($ac_kw (value)) 0 + << sizeof ($ac_kw (value)))))]; } + ac__typeof_type_; + return + (! ((void) ((ac__typeof_type_ *) 0), 0)); + ]])], + [ac_cv_c_typeof=$ac_kw]) + test $ac_cv_c_typeof != no && break + done]) + if test $ac_cv_c_typeof != no; then + AC_DEFINE([HAVE_TYPEOF], 1, + [Define to 1 if typeof works with your compiler.]) + if test $ac_cv_c_typeof != typeof; then + AC_DEFINE_UNQUOTED([typeof], [$ac_cv_c_typeof], + [Define to __typeof__ if your compiler spells it that way.]) + fi + fi +]) diff --git a/build/autoconf_prepend-include/autoconf/functions.m4 b/build/autoconf_prepend-include/autoconf/functions.m4 new file mode 100644 index 0000000000..aefd7e24d6 --- /dev/null +++ b/build/autoconf_prepend-include/autoconf/functions.m4 @@ -0,0 +1,2048 @@ +# This file is part of Autoconf. -*- Autoconf -*- +# Checking for functions. +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software +# Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by David MacKenzie, with help from +# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +# Roland McGrath, Noah Friedman, david d zuhn, and many others. + + +# Table of contents +# +# 1. Generic tests for functions. +# 2. Functions to check with AC_CHECK_FUNCS +# 3. Tests for specific functions. + + +## -------------------------------- ## +## 1. Generic tests for functions. ## +## -------------------------------- ## + + +# AC_CHECK_FUNC(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ----------------------------------------------------------------- +AC_DEFUN([AC_CHECK_FUNC], +[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl +AC_CACHE_CHECK([for $1], [ac_var], +[AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])], + [AS_VAR_SET([ac_var], [yes])], + [AS_VAR_SET([ac_var], [no])])]) +AS_IF([test AS_VAR_GET([ac_var]) = yes], [$2], [$3])dnl +AS_VAR_POPDEF([ac_var])dnl +])# AC_CHECK_FUNC + + +# _AH_CHECK_FUNCS(FUNCTION...) +# ---------------------------- +m4_define([_AH_CHECK_FUNCS], +[m4_foreach_w([AC_Func], [$1], + [AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([AC_Func])), + [Define to 1 if you have the `]m4_defn([AC_Func])[' function.])])]) + + +# AC_CHECK_FUNCS(FUNCTION..., [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# --------------------------------------------------------------------- +AC_DEFUN([AC_CHECK_FUNCS], +[_AH_CHECK_FUNCS([$1])dnl +for ac_func in $1 +do +AC_CHECK_FUNC($ac_func, + [AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$ac_func])]) $2], + [$3])dnl +done +]) + + +# AC_CHECK_FUNCS_ONCE(FUNCTION...) +# -------------------------------- +AC_DEFUN([AC_CHECK_FUNCS_ONCE], +[ + _AH_CHECK_FUNCS([$1]) + m4_foreach_w([AC_Func], [$1], + [AC_DEFUN([_AC_Func_]m4_defn([AC_Func]), + [m4_divert_text([INIT_PREPARE], + [ac_func_list="$ac_func_list AC_Func"]) + _AC_FUNCS_EXPANSION]) + AC_REQUIRE([_AC_Func_]m4_defn([AC_Func]))]) +]) +m4_define([_AC_FUNCS_EXPANSION], +[ + m4_divert_text([DEFAULTS], [ac_func_list=]) + AC_CHECK_FUNCS([$ac_func_list]) + m4_define([_AC_FUNCS_EXPANSION], []) +]) + + +# AC_REPLACE_FUNCS(FUNCTION...) +# ----------------------------- +AC_DEFUN([AC_REPLACE_FUNCS], +[m4_foreach_w([AC_Func], [$1], [AC_LIBSOURCE(AC_Func.c)])dnl +AC_CHECK_FUNCS([$1], , [_AC_LIBOBJ($ac_func)]) +]) + + +# AC_TRY_LINK_FUNC(FUNC, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) +# ------------------------------------------------------------ +# Try to link a program that calls FUNC, handling GCC builtins. If +# the link succeeds, execute ACTION-IF-FOUND; otherwise, execute +# ACTION-IF-NOT-FOUND. +AC_DEFUN([AC_TRY_LINK_FUNC], +[AC_LINK_IFELSE([AC_LANG_CALL([], [$1])], [$2], [$3])]) + + +# AU::AC_FUNC_CHECK +# ----------------- +AU_ALIAS([AC_FUNC_CHECK], [AC_CHECK_FUNC]) + + +# AU::AC_HAVE_FUNCS +# ----------------- +AU_ALIAS([AC_HAVE_FUNCS], [AC_CHECK_FUNCS]) + + + + +## ------------------------------------------- ## +## 2. Functions to check with AC_CHECK_FUNCS. ## +## ------------------------------------------- ## + +AN_FUNCTION([__argz_count], [AC_CHECK_FUNCS]) +AN_FUNCTION([__argz_next], [AC_CHECK_FUNCS]) +AN_FUNCTION([__argz_stringify], [AC_CHECK_FUNCS]) +AN_FUNCTION([__fpending], [AC_CHECK_FUNCS]) +AN_FUNCTION([acl], [AC_CHECK_FUNCS]) +AN_FUNCTION([alarm], [AC_CHECK_FUNCS]) +AN_FUNCTION([atexit], [AC_CHECK_FUNCS]) +AN_FUNCTION([btowc], [AC_CHECK_FUNCS]) +AN_FUNCTION([bzero], [AC_CHECK_FUNCS]) +AN_FUNCTION([clock_gettime], [AC_CHECK_FUNCS]) +AN_FUNCTION([doprnt], [AC_CHECK_FUNCS]) +AN_FUNCTION([dup2], [AC_CHECK_FUNCS]) +AN_FUNCTION([endgrent], [AC_CHECK_FUNCS]) +AN_FUNCTION([endpwent], [AC_CHECK_FUNCS]) +AN_FUNCTION([euidaccess], [AC_CHECK_FUNCS]) +AN_FUNCTION([fchdir], [AC_CHECK_FUNCS]) +AN_FUNCTION([fdatasync], [AC_CHECK_FUNCS]) +AN_FUNCTION([fesetround], [AC_CHECK_FUNCS]) +AN_FUNCTION([floor], [AC_CHECK_FUNCS]) +AN_FUNCTION([fs_stat_dev], [AC_CHECK_FUNCS]) +AN_FUNCTION([ftime], [AC_CHECK_FUNCS]) +AN_FUNCTION([ftruncate], [AC_CHECK_FUNCS]) +AN_FUNCTION([getcwd], [AC_CHECK_FUNCS]) +AN_FUNCTION([getdelim], [AC_CHECK_FUNCS]) +AN_FUNCTION([gethostbyaddr], [AC_CHECK_FUNCS]) +AN_FUNCTION([gethostbyname], [AC_CHECK_FUNCS]) +AN_FUNCTION([gethostname], [AC_CHECK_FUNCS]) +AN_FUNCTION([gethrtime], [AC_CHECK_FUNCS]) +AN_FUNCTION([getmntent], [AC_CHECK_FUNCS]) +AN_FUNCTION([getmntinfo], [AC_CHECK_FUNCS]) +AN_FUNCTION([getpagesize], [AC_CHECK_FUNCS]) +AN_FUNCTION([getpass], [AC_CHECK_FUNCS]) +AN_FUNCTION([getspnam], [AC_CHECK_FUNCS]) +AN_FUNCTION([gettimeofday], [AC_CHECK_FUNCS]) +AN_FUNCTION([getusershell], [AC_CHECK_FUNCS]) +AN_FUNCTION([hasmntopt], [AC_CHECK_FUNCS]) +AN_FUNCTION([inet_ntoa], [AC_CHECK_FUNCS]) +AN_FUNCTION([isascii], [AC_CHECK_FUNCS]) +AN_FUNCTION([iswprint], [AC_CHECK_FUNCS]) +AN_FUNCTION([lchown], [AC_CHECK_FUNCS]) +AN_FUNCTION([listmntent], [AC_CHECK_FUNCS]) +AN_FUNCTION([localeconv], [AC_CHECK_FUNCS]) +AN_FUNCTION([localtime_r], [AC_CHECK_FUNCS]) +AN_FUNCTION([mblen], [AC_CHECK_FUNCS]) +AN_FUNCTION([mbrlen], [AC_CHECK_FUNCS]) +AN_FUNCTION([memchr], [AC_CHECK_FUNCS]) +AN_FUNCTION([memmove], [AC_CHECK_FUNCS]) +AN_FUNCTION([mempcpy], [AC_CHECK_FUNCS]) +AN_FUNCTION([memset], [AC_CHECK_FUNCS]) +AN_FUNCTION([mkdir], [AC_CHECK_FUNCS]) +AN_FUNCTION([mkfifo], [AC_CHECK_FUNCS]) +AN_FUNCTION([modf], [AC_CHECK_FUNCS]) +AN_FUNCTION([munmap], [AC_CHECK_FUNCS]) +AN_FUNCTION([next_dev], [AC_CHECK_FUNCS]) +AN_FUNCTION([nl_langinfo], [AC_CHECK_FUNCS]) +AN_FUNCTION([pathconf], [AC_CHECK_FUNCS]) +AN_FUNCTION([pow], [AC_CHECK_FUNCS]) +AN_FUNCTION([pstat_getdynamic], [AC_CHECK_FUNCS]) +AN_FUNCTION([putenv], [AC_CHECK_FUNCS]) +AN_FUNCTION([re_comp], [AC_CHECK_FUNCS]) +AN_FUNCTION([realpath], [AC_CHECK_FUNCS]) +AN_FUNCTION([regcmp], [AC_CHECK_FUNCS]) +AN_FUNCTION([regcomp], [AC_CHECK_FUNCS]) +AN_FUNCTION([resolvepath], [AC_CHECK_FUNCS]) +AN_FUNCTION([rint], [AC_CHECK_FUNCS]) +AN_FUNCTION([rmdir], [AC_CHECK_FUNCS]) +AN_FUNCTION([rpmatch], [AC_CHECK_FUNCS]) +AN_FUNCTION([select], [AC_CHECK_FUNCS]) +AN_FUNCTION([setenv], [AC_CHECK_FUNCS]) +AN_FUNCTION([sethostname], [AC_CHECK_FUNCS]) +AN_FUNCTION([setlocale], [AC_CHECK_FUNCS]) +AN_FUNCTION([socket], [AC_CHECK_FUNCS]) +AN_FUNCTION([sqrt], [AC_CHECK_FUNCS]) +AN_FUNCTION([stime], [AC_CHECK_FUNCS]) +AN_FUNCTION([stpcpy], [AC_CHECK_FUNCS]) +AN_FUNCTION([strcasecmp], [AC_CHECK_FUNCS]) +AN_FUNCTION([strchr], [AC_CHECK_FUNCS]) +AN_FUNCTION([strcspn], [AC_CHECK_FUNCS]) +AN_FUNCTION([strdup], [AC_CHECK_FUNCS]) +AN_FUNCTION([strerror], [AC_CHECK_FUNCS]) +AN_FUNCTION([strncasecmp], [AC_CHECK_FUNCS]) +AN_FUNCTION([strndup], [AC_CHECK_FUNCS]) +AN_FUNCTION([strpbrk], [AC_CHECK_FUNCS]) +AN_FUNCTION([strrchr], [AC_CHECK_FUNCS]) +AN_FUNCTION([strspn], [AC_CHECK_FUNCS]) +AN_FUNCTION([strstr], [AC_CHECK_FUNCS]) +AN_FUNCTION([strtol], [AC_CHECK_FUNCS]) +AN_FUNCTION([strtoul], [AC_CHECK_FUNCS]) +AN_FUNCTION([strtoull], [AC_CHECK_FUNCS]) +AN_FUNCTION([strtoumax], [AC_CHECK_FUNCS]) +AN_FUNCTION([strverscmp], [AC_CHECK_FUNCS]) +AN_FUNCTION([sysinfo], [AC_CHECK_FUNCS]) +AN_FUNCTION([tzset], [AC_CHECK_FUNCS]) +AN_FUNCTION([uname], [AC_CHECK_FUNCS]) +AN_FUNCTION([utime], [AC_CHECK_FUNCS]) +AN_FUNCTION([utmpname], [AC_CHECK_FUNCS]) +AN_FUNCTION([utmpxname], [AC_CHECK_FUNCS]) +AN_FUNCTION([wcwidth], [AC_CHECK_FUNCS]) + + +AN_FUNCTION([dcgettext], [AM_GNU_GETTEXT]) +AN_FUNCTION([getwd], [warn: getwd is deprecated, use getcwd instead]) + + +## --------------------------------- ## +## 3. Tests for specific functions. ## +## --------------------------------- ## + + +# The macros are sorted: +# +# 1. AC_FUNC_* macros are sorted by alphabetical order. +# +# 2. Helping macros such as _AC_LIBOBJ_* are before the macro that +# uses it. +# +# 3. Obsolete macros are right after the modern macro. + + + +# _AC_LIBOBJ_ALLOCA +# ----------------- +# Set up the LIBOBJ replacement of `alloca'. Well, not exactly +# AC_LIBOBJ since we actually set the output variable `ALLOCA'. +# Nevertheless, for Automake, AC_LIBSOURCES it. +m4_define([_AC_LIBOBJ_ALLOCA], +[# The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. +AC_LIBSOURCES(alloca.c) +AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl +AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using `alloca.c'.]) + +AC_CACHE_CHECK(whether `alloca.c' needs Cray hooks, ac_cv_os_cray, +[AC_EGREP_CPP(webecray, +[#if defined CRAY && ! defined CRAY2 +webecray +#else +wenotbecray +#endif +], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + AC_CHECK_FUNC($ac_func, + [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func, + [Define to one of `_getb67', `GETB67', + `getb67' for Cray-2 and Cray-YMP + systems. This function is required for + `alloca.c' support on those systems.]) + break]) + done +fi + +AC_CACHE_CHECK([stack direction for C alloca], + [ac_cv_c_stack_direction], +[AC_RUN_IFELSE([AC_LANG_SOURCE( +[AC_INCLUDES_DEFAULT +int +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} + +int +main () +{ + return find_stack_direction () < 0; +}])], + [ac_cv_c_stack_direction=1], + [ac_cv_c_stack_direction=-1], + [ac_cv_c_stack_direction=0])]) +AH_VERBATIM([STACK_DIRECTION], +[/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +@%:@undef STACK_DIRECTION])dnl +AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) +])# _AC_LIBOBJ_ALLOCA + + +# AC_FUNC_ALLOCA +# -------------- +AN_FUNCTION([alloca], [AC_FUNC_ALLOCA]) +AN_HEADER([alloca.h], [AC_FUNC_ALLOCA]) +AC_DEFUN([AC_FUNC_ALLOCA], +[# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h, +[AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[@%:@include ]], + [[char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0;]])], + [ac_cv_working_alloca_h=yes], + [ac_cv_working_alloca_h=no])]) +if test $ac_cv_working_alloca_h = yes; then + AC_DEFINE(HAVE_ALLOCA_H, 1, + [Define to 1 if you have and it should be used + (not on Ultrix).]) +fi + +AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works, +[AC_LINK_IFELSE([AC_LANG_PROGRAM( +[[#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include +# define alloca _alloca +# else +# ifdef HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif +]], [[char *p = (char *) alloca (1); + if (p) return 0;]])], + [ac_cv_func_alloca_works=yes], + [ac_cv_func_alloca_works=no])]) + +if test $ac_cv_func_alloca_works = yes; then + AC_DEFINE(HAVE_ALLOCA, 1, + [Define to 1 if you have `alloca', as a function or macro.]) +else + _AC_LIBOBJ_ALLOCA +fi +])# AC_FUNC_ALLOCA + + +# AU::AC_ALLOCA +# ------------- +AU_ALIAS([AC_ALLOCA], [AC_FUNC_ALLOCA]) + + +# AC_FUNC_CHOWN +# ------------- +# Determine whether chown accepts arguments of -1 for uid and gid. +AN_FUNCTION([chown], [AC_FUNC_CHOWN]) +AC_DEFUN([AC_FUNC_CHOWN], +[AC_REQUIRE([AC_TYPE_UID_T])dnl +AC_CHECK_HEADERS(unistd.h) +AC_CACHE_CHECK([for working chown], ac_cv_func_chown_works, +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT +#include +], +[[ char *f = "conftest.chown"; + struct stat before, after; + + if (creat (f, 0600) < 0) + return 1; + if (stat (f, &before) < 0) + return 1; + if (chown (f, (uid_t) -1, (gid_t) -1) == -1) + return 1; + if (stat (f, &after) < 0) + return 1; + return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid); +]])], + [ac_cv_func_chown_works=yes], + [ac_cv_func_chown_works=no], + [ac_cv_func_chown_works=no]) +rm -f conftest.chown +]) +if test $ac_cv_func_chown_works = yes; then + AC_DEFINE(HAVE_CHOWN, 1, + [Define to 1 if your system has a working `chown' function.]) +fi +])# AC_FUNC_CHOWN + + +# AC_FUNC_CLOSEDIR_VOID +# --------------------- +# Check whether closedir returns void, and #define CLOSEDIR_VOID in +# that case. +AN_FUNCTION([closedir], [AC_FUNC_CLOSEDIR_VOID]) +AC_DEFUN([AC_FUNC_CLOSEDIR_VOID], +[AC_REQUIRE([AC_HEADER_DIRENT])dnl +AC_CACHE_CHECK([whether closedir returns void], + [ac_cv_func_closedir_void], +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT +#include <$ac_header_dirent> +#ifndef __cplusplus +int closedir (); +#endif +], + [[return closedir (opendir (".")) != 0;]])], + [ac_cv_func_closedir_void=no], + [ac_cv_func_closedir_void=yes], + [ac_cv_func_closedir_void=yes])]) +if test $ac_cv_func_closedir_void = yes; then + AC_DEFINE(CLOSEDIR_VOID, 1, + [Define to 1 if the `closedir' function returns void instead + of `int'.]) +fi +]) + + +# AC_FUNC_ERROR_AT_LINE +# --------------------- +AN_FUNCTION([error], [AC_FUNC_ERROR_AT_LINE]) +AN_FUNCTION([error_at_line], [AC_FUNC_ERROR_AT_LINE]) +AC_DEFUN([AC_FUNC_ERROR_AT_LINE], +[AC_LIBSOURCES([error.h, error.c])dnl +AC_CACHE_CHECK([for error_at_line], ac_cv_lib_error_at_line, +[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [error_at_line (0, 0, "", 0, "an error occurred");])], + [ac_cv_lib_error_at_line=yes], + [ac_cv_lib_error_at_line=no])]) +if test $ac_cv_lib_error_at_line = no; then + AC_LIBOBJ(error) +fi +]) + + +# AU::AM_FUNC_ERROR_AT_LINE +# ------------------------- +AU_ALIAS([AM_FUNC_ERROR_AT_LINE], [AC_FUNC_ERROR_AT_LINE]) + + +# _AC_FUNC_FNMATCH_IF(STANDARD = GNU | POSIX, CACHE_VAR, IF-TRUE, IF-FALSE) +# ------------------------------------------------------------------------- +# If a STANDARD compliant fnmatch is found, run IF-TRUE, otherwise +# IF-FALSE. Use CACHE_VAR. +AC_DEFUN([_AC_FUNC_FNMATCH_IF], +[AC_CACHE_CHECK( + [for working $1 fnmatch], + [$2], + [# Some versions of Solaris, SCO, and the GNU C Library + # have a broken or incompatible fnmatch. + # So we run a test program. If we are cross-compiling, take no chance. + # Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test. + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [#include +# define y(a, b, c) (fnmatch (a, b, c) == 0) +# define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH) + ], + [return + (!(y ("a*", "abc", 0) + && n ("d*/*1", "d/s/1", FNM_PATHNAME) + && y ("a\\\\bc", "abc", 0) + && n ("a\\\\bc", "abc", FNM_NOESCAPE) + && y ("*x", ".x", 0) + && n ("*x", ".x", FNM_PERIOD) + && m4_if([$1], [GNU], + [y ("xxXX", "xXxX", FNM_CASEFOLD) + && y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH) + && n ("d*/*1", "d/s/1", FNM_FILE_NAME) + && y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR) + && y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) + && y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)], + 1)));])], + [$2=yes], + [$2=no], + [$2=cross])]) +AS_IF([test $$2 = yes], [$3], [$4]) +])# _AC_FUNC_FNMATCH_IF + + +# AC_FUNC_FNMATCH +# --------------- +AC_DEFUN([AC_FUNC_FNMATCH], +[_AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_works], + [AC_DEFINE([HAVE_FNMATCH], 1, + [Define to 1 if your system has a working POSIX `fnmatch' + function.])]) +])# AC_FUNC_FNMATCH + + +# _AC_LIBOBJ_FNMATCH +# ------------------ +# Prepare the replacement of fnmatch. +AC_DEFUN([_AC_LIBOBJ_FNMATCH], +[AC_REQUIRE([AC_C_CONST])dnl +AC_REQUIRE([AC_FUNC_ALLOCA])dnl +AC_REQUIRE([AC_TYPE_MBSTATE_T])dnl +AC_CHECK_DECLS([getenv]) +AC_CHECK_FUNCS([btowc mbsrtowcs mempcpy wmempcpy]) +AC_CHECK_HEADERS([wchar.h wctype.h]) +AC_LIBOBJ([fnmatch]) +AC_CONFIG_LINKS([$ac_config_libobj_dir/fnmatch.h:$ac_config_libobj_dir/fnmatch_.h]) +AC_DEFINE(fnmatch, rpl_fnmatch, + [Define to rpl_fnmatch if the replacement function should be used.]) +])# _AC_LIBOBJ_FNMATCH + + +# AC_REPLACE_FNMATCH +# ------------------ +AN_FUNCTION([fnmatch], [AC_REPLACE_FNMATCH]) +AC_DEFUN([AC_REPLACE_FNMATCH], +[_AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_works], + [rm -f "$ac_config_libobj_dir/fnmatch.h"], + [_AC_LIBOBJ_FNMATCH]) +])# AC_REPLACE_FNMATCH + + +# AC_FUNC_FNMATCH_GNU +# ------------------- +AC_DEFUN([AC_FUNC_FNMATCH_GNU], +[AC_REQUIRE([AC_GNU_SOURCE]) +_AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu], + [rm -f "$ac_config_libobj_dir/fnmatch.h"], + [_AC_LIBOBJ_FNMATCH]) +])# AC_FUNC_FNMATCH_GNU + + +# AU::AM_FUNC_FNMATCH +# AU::fp_FUNC_FNMATCH +# ------------------- +AU_ALIAS([AM_FUNC_FNMATCH], [AC_FUNC_FNMATCH]) +AU_ALIAS([fp_FUNC_FNMATCH], [AC_FUNC_FNMATCH]) + + +# AC_FUNC_FSEEKO +# -------------- +AN_FUNCTION([ftello], [AC_FUNC_FSEEKO]) +AN_FUNCTION([fseeko], [AC_FUNC_FSEEKO]) +AC_DEFUN([AC_FUNC_FSEEKO], +[_AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1, + [ac_cv_sys_largefile_source], + [Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2).], + [@%:@include /* for off_t */ + #include ], + [[int (*fp) (FILE *, off_t, int) = fseeko; + return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);]]) + +# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug +# in glibc 2.1.3, but that breaks too many other things. +# If you want fseeko and ftello with glibc, upgrade to a fixed glibc. +if test $ac_cv_sys_largefile_source != unknown; then + AC_DEFINE(HAVE_FSEEKO, 1, + [Define to 1 if fseeko (and presumably ftello) exists and is declared.]) +fi +])# AC_FUNC_FSEEKO + + +# AC_FUNC_GETGROUPS +# ----------------- +# Try to find `getgroups', and check that it works. +# When cross-compiling, assume getgroups is broken. +AN_FUNCTION([getgroups], [AC_FUNC_GETGROUPS]) +AC_DEFUN([AC_FUNC_GETGROUPS], +[AC_REQUIRE([AC_TYPE_GETGROUPS])dnl +AC_REQUIRE([AC_TYPE_SIZE_T])dnl +AC_CHECK_FUNC(getgroups) + +# If we don't yet have getgroups, see if it's in -lbsd. +# This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1. +ac_save_LIBS=$LIBS +if test $ac_cv_func_getgroups = no; then + AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd]) +fi + +# Run the program to test the functionality of the system-supplied +# getgroups function only if there is such a function. +if test $ac_cv_func_getgroups = yes; then + AC_CACHE_CHECK([for working getgroups], ac_cv_func_getgroups_works, + [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], + [[/* On Ultrix 4.3, getgroups (0, 0) always fails. */ + return getgroups (0, 0) == -1;]])], + [ac_cv_func_getgroups_works=yes], + [ac_cv_func_getgroups_works=no], + [ac_cv_func_getgroups_works=no]) + ]) + if test $ac_cv_func_getgroups_works = yes; then + AC_DEFINE(HAVE_GETGROUPS, 1, + [Define to 1 if your system has a working `getgroups' function.]) + fi +fi +LIBS=$ac_save_LIBS +])# AC_FUNC_GETGROUPS + + +# _AC_LIBOBJ_GETLOADAVG +# --------------------- +# Set up the AC_LIBOBJ replacement of `getloadavg'. +m4_define([_AC_LIBOBJ_GETLOADAVG], +[AC_LIBOBJ(getloadavg) +AC_DEFINE(C_GETLOADAVG, 1, [Define to 1 if using `getloadavg.c'.]) +# Figure out what our getloadavg.c needs. +ac_have_func=no +AC_CHECK_HEADER(sys/dg_sys_info.h, +[ac_have_func=yes + AC_DEFINE(DGUX, 1, [Define to 1 for DGUX with .]) + AC_CHECK_LIB(dgc, dg_sys_info)]) + +AC_CHECK_HEADER(locale.h) +AC_CHECK_FUNCS(setlocale) + +# We cannot check for , because Solaris 2 does not use dwarf (it +# uses stabs), but it is still SVR4. We cannot check for because +# Irix 4.0.5F has the header but not the library. +if test $ac_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes; then + ac_have_func=yes + AC_DEFINE(SVR4, 1, [Define to 1 on System V Release 4.]) +fi + +if test $ac_have_func = no; then + AC_CHECK_HEADER(inq_stats/cpustats.h, + [ac_have_func=yes + AC_DEFINE(UMAX, 1, [Define to 1 for Encore UMAX.]) + AC_DEFINE(UMAX4_3, 1, + [Define to 1 for Encore UMAX 4.3 that has + instead of .])]) +fi + +if test $ac_have_func = no; then + AC_CHECK_HEADER(sys/cpustats.h, + [ac_have_func=yes; AC_DEFINE(UMAX)]) +fi + +if test $ac_have_func = no; then + AC_CHECK_HEADERS(mach/mach.h) +fi + +AC_CHECK_HEADERS(nlist.h, +[AC_CHECK_MEMBERS([struct nlist.n_un.n_name], + [AC_DEFINE(NLIST_NAME_UNION, 1, + [Define to 1 if your `struct nlist' has an + `n_un' member. Obsolete, depend on + `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [], + [@%:@include ]) +])dnl +])# _AC_LIBOBJ_GETLOADAVG + + +# AC_FUNC_GETLOADAVG +# ------------------ +AN_FUNCTION([getloadavg], [AC_FUNC_GETLOADAVG]) +AC_DEFUN([AC_FUNC_GETLOADAVG], +[ac_have_func=no # yes means we've found a way to get the load average. + +# Make sure getloadavg.c is where it belongs, at configure-time. +test -f "$srcdir/$ac_config_libobj_dir/getloadavg.c" || + AC_MSG_ERROR([$srcdir/$ac_config_libobj_dir/getloadavg.c is missing]) + +ac_save_LIBS=$LIBS + +# Check for getloadavg, but be sure not to touch the cache variable. +(AC_CHECK_FUNC(getloadavg, exit 0, exit 1)) && ac_have_func=yes + +# On HPUX9, an unprivileged user can get load averages through this function. +AC_CHECK_FUNCS(pstat_getdynamic) + +# Solaris has libkstat which does not require root. +AC_CHECK_LIB(kstat, kstat_open) +test $ac_cv_lib_kstat_kstat_open = yes && ac_have_func=yes + +# Some systems with -lutil have (and need) -lkvm as well, some do not. +# On Solaris, -lkvm requires nlist from -lelf, so check that first +# to get the right answer into the cache. +# For kstat on solaris, we need libelf to force the definition of SVR4 below. +if test $ac_have_func = no; then + AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS") +fi +if test $ac_have_func = no; then + AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS") + # Check for the 4.4BSD definition of getloadavg. + AC_CHECK_LIB(util, getloadavg, + [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes]) +fi + +if test $ac_have_func = no; then + # There is a commonly available library for RS/6000 AIX. + # Since it is not a standard part of AIX, it might be installed locally. + ac_getloadavg_LIBS=$LIBS + LIBS="-L/usr/local/lib $LIBS" + AC_CHECK_LIB(getloadavg, getloadavg, + [LIBS="-lgetloadavg $LIBS"], [LIBS=$ac_getloadavg_LIBS]) +fi + +# Make sure it is really in the library, if we think we found it, +# otherwise set up the replacement function. +AC_CHECK_FUNCS(getloadavg, [], + [_AC_LIBOBJ_GETLOADAVG]) + +# Some definitions of getloadavg require that the program be installed setgid. +AC_CACHE_CHECK(whether getloadavg requires setgid, + ac_cv_func_getloadavg_setgid, +[AC_EGREP_CPP([Yowza Am I SETGID yet], +[#include "$srcdir/$ac_config_libobj_dir/getloadavg.c" +#ifdef LDAV_PRIVILEGED +Yowza Am I SETGID yet +@%:@endif], + ac_cv_func_getloadavg_setgid=yes, + ac_cv_func_getloadavg_setgid=no)]) +if test $ac_cv_func_getloadavg_setgid = yes; then + NEED_SETGID=true + AC_DEFINE(GETLOADAVG_PRIVILEGED, 1, + [Define to 1 if the `getloadavg' function needs to be run setuid + or setgid.]) +else + NEED_SETGID=false +fi +AC_SUBST(NEED_SETGID)dnl + +if test $ac_cv_func_getloadavg_setgid = yes; then + AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem, +[ # On Solaris, /dev/kmem is a symlink. Get info on the real file. + ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null` + # If we got an error (system does not support symlinks), try without -L. + test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem` + ac_cv_group_kmem=`echo $ac_ls_output \ + | sed -ne ['s/[ ][ ]*/ /g; + s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/; + / /s/.* //;p;']` +]) + AC_SUBST(KMEM_GROUP, $ac_cv_group_kmem)dnl +fi +if test "x$ac_save_LIBS" = x; then + GETLOADAVG_LIBS=$LIBS +else + GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$ac_save_LIBS!!"` +fi +LIBS=$ac_save_LIBS + +AC_SUBST(GETLOADAVG_LIBS)dnl +])# AC_FUNC_GETLOADAVG + + +# AU::AC_GETLOADAVG +# ----------------- +AU_ALIAS([AC_GETLOADAVG], [AC_FUNC_GETLOADAVG]) + + +# AC_FUNC_GETMNTENT +# ----------------- +AN_FUNCTION([getmntent], [AC_FUNC_GETMNTENT]) +AC_DEFUN([AC_FUNC_GETMNTENT], +[# getmntent is in the standard C library on UNICOS, in -lsun on Irix 4, +# -lseq on Dynix/PTX, -lgen on Unixware. +AC_SEARCH_LIBS(getmntent, [sun seq gen], + [ac_cv_func_getmntent=yes + AC_DEFINE([HAVE_GETMNTENT], [], + [Define to 1 if you have the `getmntent' function.])], + [ac_cv_func_getmntent=no]) +]) + + +# AC_FUNC_GETPGRP +# --------------- +# Figure out whether getpgrp requires zero arguments. +AN_FUNCTION([getpgrp], [AC_FUNC_GETPGRP]) +AC_DEFUN([AC_FUNC_GETPGRP], +[AC_CACHE_CHECK(whether getpgrp requires zero arguments, + ac_cv_func_getpgrp_void, +[# Use it with a single arg. +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [getpgrp (0);])], + [ac_cv_func_getpgrp_void=no], + [ac_cv_func_getpgrp_void=yes]) +]) +if test $ac_cv_func_getpgrp_void = yes; then + AC_DEFINE(GETPGRP_VOID, 1, + [Define to 1 if the `getpgrp' function requires zero arguments.]) +fi +])# AC_FUNC_GETPGRP + + +# AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +# ------------------------------------- +# When cross-compiling, be pessimistic so we will end up using the +# replacement version of lstat that checks for trailing slashes and +# calls lstat a second time when necessary. +AN_FUNCTION([lstat], [AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) +AC_DEFUN([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], +[AC_CACHE_CHECK( + [whether lstat dereferences a symlink specified with a trailing slash], + [ac_cv_func_lstat_dereferences_slashed_symlink], +[rm -f conftest.sym conftest.file +echo >conftest.file +if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then + AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], + [struct stat sbuf; + /* Linux will dereference the symlink and fail. + That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + return lstat ("conftest.sym/", &sbuf) == 0;])], + [ac_cv_func_lstat_dereferences_slashed_symlink=yes], + [ac_cv_func_lstat_dereferences_slashed_symlink=no], + [ac_cv_func_lstat_dereferences_slashed_symlink=no]) +else + # If the `ln -s' command failed, then we probably don't even + # have an lstat function. + ac_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f conftest.sym conftest.file +]) + +test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && + AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, 1, + [Define to 1 if `lstat' dereferences a symlink specified + with a trailing slash.]) + +if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then + AC_LIBOBJ(lstat) +fi +]) + + +# _AC_FUNC_MALLOC_IF(IF-WORKS, IF-NOT) +# ------------------------------------ +# If `malloc (0)' properly handled, run IF-WORKS, otherwise, IF-NOT. +AC_DEFUN([_AC_FUNC_MALLOC_IF], +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_CHECK_HEADERS(stdlib.h) +AC_CACHE_CHECK([for GNU libc compatible malloc], ac_cv_func_malloc_0_nonnull, +[AC_RUN_IFELSE( +[AC_LANG_PROGRAM( +[[#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif +]], + [return ! malloc (0);])], + [ac_cv_func_malloc_0_nonnull=yes], + [ac_cv_func_malloc_0_nonnull=no], + [ac_cv_func_malloc_0_nonnull=no])]) +AS_IF([test $ac_cv_func_malloc_0_nonnull = yes], [$1], [$2]) +])# AC_FUNC_MALLOC + + +# AC_FUNC_MALLOC +# -------------- +# Report whether `malloc (0)' properly handled, and replace malloc if +# needed. +AN_FUNCTION([malloc], [AC_FUNC_MALLOC]) +AC_DEFUN([AC_FUNC_MALLOC], +[_AC_FUNC_MALLOC_IF( + [AC_DEFINE([HAVE_MALLOC], 1, + [Define to 1 if your system has a GNU libc compatible `malloc' + function, and to 0 otherwise.])], + [AC_DEFINE([HAVE_MALLOC], 0) + AC_LIBOBJ(malloc) + AC_DEFINE([malloc], [rpl_malloc], + [Define to rpl_malloc if the replacement function should be used.])]) +])# AC_FUNC_MALLOC + + +# AC_FUNC_MBRTOWC +# --------------- +AN_FUNCTION([mbrtowc], [AC_FUNC_MBRTOWC]) +AC_DEFUN([AC_FUNC_MBRTOWC], +[ + AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared], + ac_cv_func_mbrtowc, + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[@%:@include ]], + [[wchar_t wc; + char const s[] = ""; + size_t n = 1; + mbstate_t state; + return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])], + ac_cv_func_mbrtowc=yes, + ac_cv_func_mbrtowc=no)]) + if test $ac_cv_func_mbrtowc = yes; then + AC_DEFINE([HAVE_MBRTOWC], 1, + [Define to 1 if mbrtowc and mbstate_t are properly declared.]) + fi +]) + + +# AC_FUNC_MEMCMP +# -------------- +AN_FUNCTION([memcmp], [AC_FUNC_MEMCMP]) +AC_DEFUN([AC_FUNC_MEMCMP], +[AC_CACHE_CHECK([for working memcmp], ac_cv_func_memcmp_working, +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[ + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = '\100', c1 = '\200', c2 = '\201'; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + return 1; + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + return 1; + } + return 0; + } +]])], + [ac_cv_func_memcmp_working=yes], + [ac_cv_func_memcmp_working=no], + [ac_cv_func_memcmp_working=no])]) +test $ac_cv_func_memcmp_working = no && AC_LIBOBJ([memcmp]) +])# AC_FUNC_MEMCMP + + +# AC_FUNC_MKTIME +# -------------- +AN_FUNCTION([mktime], [AC_FUNC_MKTIME]) +AC_DEFUN([AC_FUNC_MKTIME], +[AC_REQUIRE([AC_HEADER_TIME])dnl +AC_CHECK_HEADERS_ONCE(sys/time.h unistd.h) +AC_CHECK_FUNCS_ONCE(alarm) +AC_CACHE_CHECK([for working mktime], ac_cv_func_working_mktime, +[AC_RUN_IFELSE([AC_LANG_SOURCE( +[[/* Test program from Paul Eggert and Tony Leneis. */ +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#include + +#ifdef HAVE_UNISTD_H +# include +#endif + +#ifndef HAVE_ALARM +# define alarm(X) /* empty */ +#endif + +/* Work around redefinition to rpl_putenv by other config tests. */ +#undef putenv + +static time_t time_t_max; +static time_t time_t_min; + +/* Values we'll use to set the TZ environment variable. */ +static char *tz_strings[] = { + (char *) 0, "TZ=GMT0", "TZ=JST-9", + "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" +}; +#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) + +/* Return 0 if mktime fails to convert a date in the spring-forward gap. + Based on a problem report from Andreas Jaeger. */ +static int +spring_forward_gap () +{ + /* glibc (up to about 1998-10-07) failed this test. */ + struct tm tm; + + /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" + instead of "TZ=America/Vancouver" in order to detect the bug even + on systems that don't support the Olson extension, or don't have the + full zoneinfo tables installed. */ + putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); + + tm.tm_year = 98; + tm.tm_mon = 3; + tm.tm_mday = 5; + tm.tm_hour = 2; + tm.tm_min = 0; + tm.tm_sec = 0; + tm.tm_isdst = -1; + return mktime (&tm) != (time_t) -1; +} + +static int +mktime_test1 (now) + time_t now; +{ + struct tm *lt; + return ! (lt = localtime (&now)) || mktime (lt) == now; +} + +static int +mktime_test (now) + time_t now; +{ + return (mktime_test1 (now) + && mktime_test1 ((time_t) (time_t_max - now)) + && mktime_test1 ((time_t) (time_t_min + now))); +} + +static int +irix_6_4_bug () +{ + /* Based on code from Ariel Faigon. */ + struct tm tm; + tm.tm_year = 96; + tm.tm_mon = 3; + tm.tm_mday = 0; + tm.tm_hour = 0; + tm.tm_min = 0; + tm.tm_sec = 0; + tm.tm_isdst = -1; + mktime (&tm); + return tm.tm_mon == 2 && tm.tm_mday == 31; +} + +static int +bigtime_test (j) + int j; +{ + struct tm tm; + time_t now; + tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j; + now = mktime (&tm); + if (now != (time_t) -1) + { + struct tm *lt = localtime (&now); + if (! (lt + && lt->tm_year == tm.tm_year + && lt->tm_mon == tm.tm_mon + && lt->tm_mday == tm.tm_mday + && lt->tm_hour == tm.tm_hour + && lt->tm_min == tm.tm_min + && lt->tm_sec == tm.tm_sec + && lt->tm_yday == tm.tm_yday + && lt->tm_wday == tm.tm_wday + && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) + == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) + return 0; + } + return 1; +} + +static int +year_2050_test () +{ + /* The correct answer for 2050-02-01 00:00:00 in Pacific time, + ignoring leap seconds. */ + unsigned long int answer = 2527315200UL; + + struct tm tm; + time_t t; + tm.tm_year = 2050 - 1900; + tm.tm_mon = 2 - 1; + tm.tm_mday = 1; + tm.tm_hour = tm.tm_min = tm.tm_sec = 0; + tm.tm_isdst = -1; + + /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" + instead of "TZ=America/Vancouver" in order to detect the bug even + on systems that don't support the Olson extension, or don't have the + full zoneinfo tables installed. */ + putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); + + t = mktime (&tm); + + /* Check that the result is either a failure, or close enough + to the correct answer that we can assume the discrepancy is + due to leap seconds. */ + return (t == (time_t) -1 + || (0 < t && answer - 120 <= t && t <= answer + 120)); +} + +int +main () +{ + time_t t, delta; + int i, j; + + /* This test makes some buggy mktime implementations loop. + Give up after 60 seconds; a mktime slower than that + isn't worth using anyway. */ + alarm (60); + + for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) + continue; + time_t_max--; + if ((time_t) -1 < 0) + for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2) + continue; + delta = time_t_max / 997; /* a suitable prime number */ + for (i = 0; i < N_STRINGS; i++) + { + if (tz_strings[i]) + putenv (tz_strings[i]); + + for (t = 0; t <= time_t_max - delta; t += delta) + if (! mktime_test (t)) + return 1; + if (! (mktime_test ((time_t) 1) + && mktime_test ((time_t) (60 * 60)) + && mktime_test ((time_t) (60 * 60 * 24)))) + return 1; + + for (j = 1; 0 < j; j *= 2) + if (! bigtime_test (j)) + return 1; + if (! bigtime_test (j - 1)) + return 1; + } + return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); +}]])], + [ac_cv_func_working_mktime=yes], + [ac_cv_func_working_mktime=no], + [ac_cv_func_working_mktime=no])]) +if test $ac_cv_func_working_mktime = no; then + AC_LIBOBJ([mktime]) +fi +])# AC_FUNC_MKTIME + + +# AU::AM_FUNC_MKTIME +# ------------------ +AU_ALIAS([AM_FUNC_MKTIME], [AC_FUNC_MKTIME]) + + +# AC_FUNC_MMAP +# ------------ +AN_FUNCTION([mmap], [AC_FUNC_MMAP]) +AC_DEFUN([AC_FUNC_MMAP], +[AC_CHECK_HEADERS(stdlib.h unistd.h) +AC_CHECK_FUNCS(getpagesize) +AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, +[AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT] +[[/* malloc might have been renamed as rpl_malloc. */ +#undef malloc + +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the file system buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propagated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ + +#include +#include + +#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H +char *malloc (); +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +int +main () +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + return 1; + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + return 1; + if (write (fd, data, pagesize) != pagesize) + return 1; + close (fd); + + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + return 1; + data2 = (char *) malloc (2 * pagesize); + if (!data2) + return 1; + data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + return 1; + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + return 1; + + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + return 1; + if (read (fd, data3, pagesize) != pagesize) + return 1; + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + return 1; + close (fd); + return 0; +}]])], + [ac_cv_func_mmap_fixed_mapped=yes], + [ac_cv_func_mmap_fixed_mapped=no], + [ac_cv_func_mmap_fixed_mapped=no])]) +if test $ac_cv_func_mmap_fixed_mapped = yes; then + AC_DEFINE(HAVE_MMAP, 1, + [Define to 1 if you have a working `mmap' system call.]) +fi +rm -f conftest.mmap +])# AC_FUNC_MMAP + + +# AU::AC_MMAP +# ----------- +AU_ALIAS([AC_MMAP], [AC_FUNC_MMAP]) + + +# AC_FUNC_OBSTACK +# --------------- +# Ensure obstack support. Yeah, this is not exactly a `FUNC' check. +AN_FUNCTION([obstack_init], [AC_FUNC_OBSTACK]) +AN_IDENTIFIER([obstack], [AC_FUNC_OBSTACK]) +AC_DEFUN([AC_FUNC_OBSTACK], +[AC_LIBSOURCES([obstack.h, obstack.c])dnl +AC_CACHE_CHECK([for obstacks], ac_cv_func_obstack, +[AC_LINK_IFELSE( + [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT + [@%:@include "obstack.h"]], + [[struct obstack mem; + @%:@define obstack_chunk_alloc malloc + @%:@define obstack_chunk_free free + obstack_init (&mem); + obstack_free (&mem, 0);]])], + [ac_cv_func_obstack=yes], + [ac_cv_func_obstack=no])]) +if test $ac_cv_func_obstack = yes; then + AC_DEFINE(HAVE_OBSTACK, 1, [Define to 1 if libc includes obstacks.]) +else + AC_LIBOBJ(obstack) +fi +])# AC_FUNC_OBSTACK + + +# AU::AM_FUNC_OBSTACK +# ------------------- +AU_ALIAS([AM_FUNC_OBSTACK], [AC_FUNC_OBSTACK]) + + + +# _AC_FUNC_REALLOC_IF(IF-WORKS, IF-NOT) +# ------------------------------------- +# If `realloc (0, 0)' is properly handled, run IF-WORKS, otherwise, IF-NOT. +AC_DEFUN([_AC_FUNC_REALLOC_IF], +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_CHECK_HEADERS(stdlib.h) +AC_CACHE_CHECK([for GNU libc compatible realloc], ac_cv_func_realloc_0_nonnull, +[AC_RUN_IFELSE( +[AC_LANG_PROGRAM( +[[#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include +#else +char *realloc (); +#endif +]], + [return ! realloc (0, 0);])], + [ac_cv_func_realloc_0_nonnull=yes], + [ac_cv_func_realloc_0_nonnull=no], + [ac_cv_func_realloc_0_nonnull=no])]) +AS_IF([test $ac_cv_func_realloc_0_nonnull = yes], [$1], [$2]) +])# AC_FUNC_REALLOC + + +# AC_FUNC_REALLOC +# --------------- +# Report whether `realloc (0, 0)' is properly handled, and replace realloc if +# needed. +AN_FUNCTION([realloc], [AC_FUNC_REALLOC]) +AC_DEFUN([AC_FUNC_REALLOC], +[_AC_FUNC_REALLOC_IF( + [AC_DEFINE([HAVE_REALLOC], 1, + [Define to 1 if your system has a GNU libc compatible `realloc' + function, and to 0 otherwise.])], + [AC_DEFINE([HAVE_REALLOC], 0) + AC_LIBOBJ([realloc]) + AC_DEFINE([realloc], [rpl_realloc], + [Define to rpl_realloc if the replacement function should be used.])]) +])# AC_FUNC_REALLOC + + +# AC_FUNC_SELECT_ARGTYPES +# ----------------------- +# Determine the correct type to be passed to each of the `select' +# function's arguments, and define those types in `SELECT_TYPE_ARG1', +# `SELECT_TYPE_ARG234', and `SELECT_TYPE_ARG5'. +AN_FUNCTION([select], [AC_FUNC_SELECT_ARGTYPES]) +AC_DEFUN([AC_FUNC_SELECT_ARGTYPES], +[AC_CHECK_HEADERS(sys/select.h sys/socket.h) +AC_CACHE_CHECK([types of arguments for select], +[ac_cv_func_select_args], +[for ac_arg234 in 'fd_set *' 'int *' 'void *'; do + for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do + for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( +[AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_SELECT_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +], + [extern int select ($ac_arg1, + $ac_arg234, $ac_arg234, $ac_arg234, + $ac_arg5);])], + [ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3]) + done + done +done +# Provide a safe default value. +: ${ac_cv_func_select_args='int,int *,struct timeval *'} +]) +ac_save_IFS=$IFS; IFS=',' +set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` +IFS=$ac_save_IFS +shift +AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1], + [Define to the type of arg 1 for `select'.]) +AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, ($[2]), + [Define to the type of args 2, 3 and 4 for `select'.]) +AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($[3]), + [Define to the type of arg 5 for `select'.]) +rm -f conftest* +])# AC_FUNC_SELECT_ARGTYPES + + +# AC_FUNC_SETPGRP +# --------------- +AN_FUNCTION([setpgrp], [AC_FUNC_SETPGRP]) +AC_DEFUN([AC_FUNC_SETPGRP], +[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void, +[AC_RUN_IFELSE( +[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], +[/* If this system has a BSD-style setpgrp which takes arguments, + setpgrp(1, 1) will fail with ESRCH and return -1, in that case + exit successfully. */ + return setpgrp (1,1) != -1;])], + [ac_cv_func_setpgrp_void=no], + [ac_cv_func_setpgrp_void=yes], + [AC_MSG_ERROR([cannot check setpgrp when cross compiling])])]) +if test $ac_cv_func_setpgrp_void = yes; then + AC_DEFINE(SETPGRP_VOID, 1, + [Define to 1 if the `setpgrp' function takes no argument.]) +fi +])# AC_FUNC_SETPGRP + + +# _AC_FUNC_STAT(STAT | LSTAT) +# --------------------------- +# Determine whether stat or lstat have the bug that it succeeds when +# given the zero-length file name argument. The stat and lstat from +# SunOS4.1.4 and the Hurd (as of 1998-11-01) do this. +# +# If it does, then define HAVE_STAT_EMPTY_STRING_BUG (or +# HAVE_LSTAT_EMPTY_STRING_BUG) and arrange to compile the wrapper +# function. +m4_define([_AC_FUNC_STAT], +[AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])dnl +AC_CACHE_CHECK([whether $1 accepts an empty string], + [ac_cv_func_$1_empty_string_bug], +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], +[[struct stat sbuf; + return $1 ("", &sbuf) == 0;]])], + [ac_cv_func_$1_empty_string_bug=no], + [ac_cv_func_$1_empty_string_bug=yes], + [ac_cv_func_$1_empty_string_bug=yes])]) +if test $ac_cv_func_$1_empty_string_bug = yes; then + AC_LIBOBJ([$1]) + AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1_EMPTY_STRING_BUG]), 1, + [Define to 1 if `$1' has the bug that it succeeds when + given the zero-length file name argument.]) +fi +])# _AC_FUNC_STAT + + +# AC_FUNC_STAT & AC_FUNC_LSTAT +# ---------------------------- +AN_FUNCTION([stat], [AC_FUNC_STAT]) +AC_DEFUN([AC_FUNC_STAT], [_AC_FUNC_STAT(stat)]) +AN_FUNCTION([lstat], [AC_FUNC_LSTAT]) +AC_DEFUN([AC_FUNC_LSTAT], [_AC_FUNC_STAT(lstat)]) + + +# _AC_LIBOBJ_STRTOD +# ----------------- +m4_define([_AC_LIBOBJ_STRTOD], +[AC_LIBOBJ(strtod) +AC_CHECK_FUNC(pow) +if test $ac_cv_func_pow = no; then + AC_CHECK_LIB(m, pow, + [POW_LIB=-lm], + [AC_MSG_WARN([cannot find library containing definition of pow])]) +fi +])# _AC_LIBOBJ_STRTOD + + +# AC_FUNC_STRTOD +# -------------- +AN_FUNCTION([strtod], [AC_FUNC_STRTOD]) +AC_DEFUN([AC_FUNC_STRTOD], +[AC_SUBST(POW_LIB)dnl +AC_CACHE_CHECK(for working strtod, ac_cv_func_strtod, +[AC_RUN_IFELSE([AC_LANG_SOURCE([[ +]AC_INCLUDES_DEFAULT[ +#ifndef strtod +double strtod (); +#endif +int +main() +{ + { + /* Some versions of Linux strtod mis-parse strings with leading '+'. */ + char *string = " +69"; + char *term; + double value; + value = strtod (string, &term); + if (value != 69 || term != (string + 4)) + return 1; + } + + { + /* Under Solaris 2.4, strtod returns the wrong value for the + terminating character under some conditions. */ + char *string = "NaN"; + char *term; + strtod (string, &term); + if (term != string && *(term - 1) == 0) + return 1; + } + return 0; +} +]])], + ac_cv_func_strtod=yes, + ac_cv_func_strtod=no, + ac_cv_func_strtod=no)]) +if test $ac_cv_func_strtod = no; then + _AC_LIBOBJ_STRTOD +fi +]) + + +# AC_FUNC_STRTOLD +# --------------- +AC_DEFUN([AC_FUNC_STRTOLD], +[ + AC_CACHE_CHECK([whether strtold conforms to C99], + [ac_cv_func_strtold], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[/* On HP-UX before 11.23, strtold returns a struct instead of + long double. Reject implementations like that, by requiring + compatibility with the C99 prototype. */ +# include + static long double (*p) (char const *, char **) = strtold; + static long double + test (char const *nptr, char **endptr) + { + long double r; + r = strtold (nptr, endptr); + return r; + }]], + [[return test ("1.0", NULL) != 1 || p ("1.0", NULL) != 1;]])], + [ac_cv_func_strtold=yes], + [ac_cv_func_strtold=no])]) + if test $ac_cv_func_strtold = yes; then + AC_DEFINE([HAVE_STRTOLD], 1, + [Define to 1 if strtold exists and conforms to C99.]) + fi +])# AC_FUNC_STRTOLD + + +# AU::AM_FUNC_STRTOD +# ------------------ +AU_ALIAS([AM_FUNC_STRTOD], [AC_FUNC_STRTOD]) + + +# AC_FUNC_STRERROR_R +# ------------------ +AN_FUNCTION([strerror_r], [AC_FUNC_STRERROR_R]) +AC_DEFUN([AC_FUNC_STRERROR_R], +[AC_CHECK_DECLS([strerror_r]) +AC_CHECK_FUNCS([strerror_r]) +AC_CACHE_CHECK([whether strerror_r returns char *], + ac_cv_func_strerror_r_char_p, + [ + ac_cv_func_strerror_r_char_p=no + if test $ac_cv_have_decl_strerror_r = yes; then + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], + [[ + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + char *p = strerror_r (0, buf, sizeof buf); + return !p || x; + ]])], + ac_cv_func_strerror_r_char_p=yes) + else + # strerror_r is not declared. Choose between + # systems that have relatively inaccessible declarations for the + # function. BeOS and DEC UNIX 4.0 fall in this category, but the + # former has a strerror_r that returns char*, while the latter + # has a strerror_r that returns `int'. + # This test should segfault on the DEC system. + AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT + extern char *strerror_r ();], + [[char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + return ! isalpha (x);]])], + ac_cv_func_strerror_r_char_p=yes, , :) + fi + ]) +if test $ac_cv_func_strerror_r_char_p = yes; then + AC_DEFINE([STRERROR_R_CHAR_P], 1, + [Define to 1 if strerror_r returns char *.]) +fi +])# AC_FUNC_STRERROR_R + + +# AC_FUNC_STRFTIME +# ---------------- +AN_FUNCTION([strftime], [AC_FUNC_STRFTIME]) +AC_DEFUN([AC_FUNC_STRFTIME], +[AC_CHECK_FUNCS(strftime, [], +[# strftime is in -lintl on SCO UNIX. +AC_CHECK_LIB(intl, strftime, + [AC_DEFINE(HAVE_STRFTIME) +LIBS="-lintl $LIBS"])])dnl +])# AC_FUNC_STRFTIME + + +# AC_FUNC_STRNLEN +# --------------- +AN_FUNCTION([strnlen], [AC_FUNC_STRNLEN]) +AC_DEFUN([AC_FUNC_STRNLEN], +[AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])dnl +AC_CACHE_CHECK([for working strnlen], ac_cv_func_strnlen_working, +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[ +#define S "foobar" +#define S_LEN (sizeof S - 1) + + /* At least one implementation is buggy: that of AIX 4.3 would + give strnlen (S, 1) == 3. */ + + int i; + for (i = 0; i < S_LEN + 1; ++i) + { + int expected = i <= S_LEN ? i : S_LEN; + if (strnlen (S, i) != expected) + return 1; + } + return 0; +]])], + [ac_cv_func_strnlen_working=yes], + [ac_cv_func_strnlen_working=no], + [ac_cv_func_strnlen_working=no])]) +test $ac_cv_func_strnlen_working = no && AC_LIBOBJ([strnlen]) +])# AC_FUNC_STRNLEN + + +# AC_FUNC_SETVBUF_REVERSED +# ------------------------ +AN_FUNCTION([setvbuf], [AC_FUNC_SETVBUF_REVERSED]) +AC_DEFUN([AC_FUNC_SETVBUF_REVERSED], +[AC_REQUIRE([AC_C_PROTOTYPES])dnl +AC_CACHE_CHECK(whether setvbuf arguments are reversed, + ac_cv_func_setvbuf_reversed, + [ac_cv_func_setvbuf_reversed=no + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include +# ifdef PROTOTYPES + int (setvbuf) (FILE *, int, char *, size_t); +# endif]], + [[char buf; return setvbuf (stdout, _IOLBF, &buf, 1);]])], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include +# ifdef PROTOTYPES + int (setvbuf) (FILE *, int, char *, size_t); +# endif]], + [[char buf; return setvbuf (stdout, &buf, _IOLBF, 1);]])], + [# It compiles and links either way, so it must not be declared + # with a prototype and most likely this is a K&R C compiler. + # Try running it. + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT], + [[/* This call has the arguments reversed. + A reversed system may check and see that the address of buf + is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */ + char buf; + if (setvbuf (stdout, _IOLBF, &buf, 1) != 0) + return 1; + putchar ('\r'); + return 0; /* Non-reversed systems SEGV here. */]])], + [ac_cv_func_setvbuf_reversed=yes], + [], + [[: # Assume setvbuf is not reversed when cross-compiling.]])] + ac_cv_func_setvbuf_reversed=yes)])]) +if test $ac_cv_func_setvbuf_reversed = yes; then + AC_DEFINE(SETVBUF_REVERSED, 1, + [Define to 1 if the `setvbuf' function takes the buffering type as + its second argument and the buffer pointer as the third, as on + System V before release 3.]) +fi +])# AC_FUNC_SETVBUF_REVERSED + + +# AU::AC_SETVBUF_REVERSED +# ----------------------- +AU_ALIAS([AC_SETVBUF_REVERSED], [AC_FUNC_SETVBUF_REVERSED]) + + +# AC_FUNC_STRCOLL +# --------------- +AN_FUNCTION([strcoll], [AC_FUNC_STRCOLL]) +AC_DEFUN([AC_FUNC_STRCOLL], +[AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works, +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], + [[return (strcoll ("abc", "def") >= 0 || + strcoll ("ABC", "DEF") >= 0 || + strcoll ("123", "456") >= 0)]])], + ac_cv_func_strcoll_works=yes, + ac_cv_func_strcoll_works=no, + ac_cv_func_strcoll_works=no)]) +if test $ac_cv_func_strcoll_works = yes; then + AC_DEFINE(HAVE_STRCOLL, 1, + [Define to 1 if you have the `strcoll' function and it is properly + defined.]) +fi +])# AC_FUNC_STRCOLL + + +# AU::AC_STRCOLL +# -------------- +AU_ALIAS([AC_STRCOLL], [AC_FUNC_STRCOLL]) + + +# AC_FUNC_UTIME_NULL +# ------------------ +AN_FUNCTION([utime], [AC_FUNC_UTIME_NULL]) +AC_DEFUN([AC_FUNC_UTIME_NULL], +[AC_CHECK_HEADERS_ONCE(utime.h) +AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null, +[rm -f conftest.data; >conftest.data +# Sequent interprets utime(file, 0) to mean use start of epoch. Wrong. +AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT + #ifdef HAVE_UTIME_H + # include + #endif], +[[struct stat s, t; + return ! (stat ("conftest.data", &s) == 0 + && utime ("conftest.data", 0) == 0 + && stat ("conftest.data", &t) == 0 + && t.st_mtime >= s.st_mtime + && t.st_mtime - s.st_mtime < 120);]])], + ac_cv_func_utime_null=yes, + ac_cv_func_utime_null=no, + ac_cv_func_utime_null=no)]) +if test $ac_cv_func_utime_null = yes; then + AC_DEFINE(HAVE_UTIME_NULL, 1, + [Define to 1 if `utime(file, NULL)' sets file's timestamp to the + present.]) +fi +rm -f conftest.data +])# AC_FUNC_UTIME_NULL + + +# AU::AC_UTIME_NULL +# ----------------- +AU_ALIAS([AC_UTIME_NULL], [AC_FUNC_UTIME_NULL]) + + +# AC_FUNC_FORK +# ------------- +AN_FUNCTION([fork], [AC_FUNC_FORK]) +AN_FUNCTION([vfork], [AC_FUNC_FORK]) +AC_DEFUN([AC_FUNC_FORK], +[AC_REQUIRE([AC_TYPE_PID_T])dnl +AC_CHECK_HEADERS(vfork.h) +AC_CHECK_FUNCS(fork vfork) +if test "x$ac_cv_func_fork" = xyes; then + _AC_FUNC_FORK +else + ac_cv_func_fork_works=$ac_cv_func_fork +fi +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross compilation]) +fi +ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + _AC_FUNC_VFORK +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=$ac_cv_func_vfork + AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross compilation]) +fi + +if test "x$ac_cv_func_vfork_works" = xyes; then + AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define to 1 if `vfork' works.]) +else + AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.]) +fi +if test "x$ac_cv_func_fork_works" = xyes; then + AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.]) +fi +])# AC_FUNC_FORK + + +# _AC_FUNC_FORK +# ------------- +AC_DEFUN([_AC_FUNC_FORK], + [AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works, + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], + [ + /* By Ruediger Kuhlmann. */ + return fork () < 0; + ])], + [ac_cv_func_fork_works=yes], + [ac_cv_func_fork_works=no], + [ac_cv_func_fork_works=cross])])] +)# _AC_FUNC_FORK + + +# _AC_FUNC_VFORK +# ------------- +AC_DEFUN([_AC_FUNC_VFORK], +[AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works, +[AC_RUN_IFELSE([AC_LANG_SOURCE([[/* Thanks to Paul Eggert for this test. */ +]AC_INCLUDES_DEFAULT[ +#include +#ifdef HAVE_VFORK_H +# include +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. The compiler + is told about this with #include , but some compilers + (e.g. gcc -O) don't grok . Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static void +#ifdef __cplusplus +sparc_address_test (int arg) +# else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} + +int +main () +{ + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (0); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + return ( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +}]])], + [ac_cv_func_vfork_works=yes], + [ac_cv_func_vfork_works=no], + [ac_cv_func_vfork_works=cross])]) +])# _AC_FUNC_VFORK + + +# AU::AC_FUNC_VFORK +# ------------ +AU_ALIAS([AC_FUNC_VFORK], [AC_FUNC_FORK]) + +# AU::AC_VFORK +# ------------ +AU_ALIAS([AC_VFORK], [AC_FUNC_FORK]) + + +# AC_FUNC_VPRINTF +# --------------- +# Why the heck is that _doprnt does not define HAVE__DOPRNT??? +# That the logical name! +AN_FUNCTION([vfprintf], [AC_FUNC_VPRINTF]) +AN_FUNCTION([vprintf], [AC_FUNC_VPRINTF]) +AN_FUNCTION([vsprintf], [AC_FUNC_VPRINTF]) +AN_FUNCTION([_doprnt], [AC_FUNC_VPRINTF]) +AC_DEFUN([AC_FUNC_VPRINTF], +[AC_CHECK_FUNCS(vprintf, [] +[AC_CHECK_FUNC(_doprnt, + [AC_DEFINE(HAVE_DOPRNT, 1, + [Define to 1 if you don't have `vprintf' but do have + `_doprnt.'])])]) +]) + + +# AU::AC_VPRINTF +# -------------- +AU_ALIAS([AC_VPRINTF], [AC_FUNC_VPRINTF]) + + +# AC_FUNC_WAIT3 +# ------------- +# Don't bother too hard maintaining this macro, as it's obsoleted. +# We don't AU define it, since we don't have any alternative to propose, +# any invocation should be removed, and the code adjusted. +AN_FUNCTION([wait3], [AC_FUNC_WAIT3]) +AC_DEFUN([AC_FUNC_WAIT3], +[AC_DIAGNOSE([obsolete], +[$0: `wait3' has been removed from POSIX. +Remove this `AC_FUNC_WAIT3' and adjust your code to use `waitpid' instead.])dnl +AC_CACHE_CHECK([for wait3 that fills in rusage], + [ac_cv_func_wait3_rusage], +[AC_RUN_IFELSE([AC_LANG_SOURCE( +[AC_INCLUDES_DEFAULT[ +#include +#include +#include +/* HP-UX has wait3 but does not fill in rusage at all. */ +int +main () +{ + struct rusage r; + int i; + /* Use a field that we can force nonzero -- + voluntary context switches. + For systems like NeXT and OSF/1 that don't set it, + also use the system CPU time. And page faults (I/O) for Linux. */ + r.ru_nvcsw = 0; + r.ru_stime.tv_sec = 0; + r.ru_stime.tv_usec = 0; + r.ru_majflt = r.ru_minflt = 0; + switch (fork ()) + { + case 0: /* Child. */ + sleep(1); /* Give up the CPU. */ + _exit(0); + break; + case -1: /* What can we do? */ + _exit(0); + break; + default: /* Parent. */ + wait3(&i, 0, &r); + /* Avoid "text file busy" from rm on fast HP-UX machines. */ + sleep(2); + return (r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0 + && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0); + } +}]])], + [ac_cv_func_wait3_rusage=yes], + [ac_cv_func_wait3_rusage=no], + [ac_cv_func_wait3_rusage=no])]) +if test $ac_cv_func_wait3_rusage = yes; then + AC_DEFINE(HAVE_WAIT3, 1, + [Define to 1 if you have the `wait3' system call. + Deprecated, you should no longer depend upon `wait3'.]) +fi +])# AC_FUNC_WAIT3 + + +# AU::AC_WAIT3 +# ------------ +AU_ALIAS([AC_WAIT3], [AC_FUNC_WAIT3]) diff --git a/build/autoconf_prepend-include/autoconf/general.m4 b/build/autoconf_prepend-include/autoconf/general.m4 index dd52f9cf4d..3ec20bb89f 100644 --- a/build/autoconf_prepend-include/autoconf/general.m4 +++ b/build/autoconf_prepend-include/autoconf/general.m4 @@ -1,7 +1,7 @@ # This file is part of Autoconf. -*- Autoconf -*- # Parameterized macros. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, Free Software Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. # As a special exception, the Free Software Foundation gives unlimited # permission to copy, distribute and modify the configure scripts that @@ -190,22 +190,12 @@ m4_define([AC_OBSOLETE], ## ----------------------------- ## -# AC_FOREACH(VARIABLE, LIST, EXPRESSION) -# -------------------------------------- -# -# Compute EXPRESSION assigning to VARIABLE each value of the LIST. -# LIST is a /bin/sh list, i.e., it has the form ` item_1 item_2 -# ... item_n ': white spaces are separators, and leading and trailing -# spaces are meaningless. -# -# This macro is robust to active symbols: -# AC_FOREACH([Var], [ active -# b act\ -# ive ], [-Var-])end -# => -active--b--active-end -m4_define([AC_FOREACH], -[m4_foreach([$1], m4_split(m4_normalize([$2])), [$3])]) - +# AU::AC_FOREACH(VARIABLE, LIST, EXPRESSION) +# ------------------------------------------ +AU_DEFUN([AC_FOREACH], [[m4_foreach_w($@)]]) +AC_DEFUN([AC_FOREACH], [m4_foreach_w($@)dnl +AC_DIAGNOSE([obsolete], [The macro `AC_FOREACH' is obsolete. +You should run autoupdate.])]) @@ -227,7 +217,7 @@ AU_ALIAS([AC_HELP_STRING], [AS_HELP_STRING]) # It is suggested that the macros in this section appear before # AC_INIT in `configure.ac'. Nevertheless, this is just stylistic, -# and from the implementation point of, AC_INIT *must* be expanded +# and from the implementation point of view, AC_INIT *must* be expanded # beforehand: it puts data in diversions which must appear before the # data provided by the macros of this section. @@ -262,18 +252,10 @@ m4_ifndef([AC_PACKAGE_BUGREPORT], # AC_COPYRIGHT(TEXT, [VERSION-DIVERSION = VERSION_USER]) # ------------------------------------------------------ -# Append Copyright information in the top of `configure'. TEXT is -# evaluated once, hence TEXT can use macros. Note that we do not -# prepend `# ' but `@%:@ ', since m4 does not evaluate the comments. -# Had we used `# ', the Copyright sent in the beginning of `configure' -# would have not been evaluated. Another solution, a bit fragile, -# would have be to use m4_quote to force an evaluation: -# -# m4_bpatsubst(m4_quote($1), [^], [# ]) +# Emit TEXT, a copyright notice, in the top of `configure' and in +# --version output. Macros in TEXT are evaluated once. m4_define([AC_COPYRIGHT], -[m4_divert_text([HEADER-COPYRIGHT], -[m4_bpatsubst([ -$1], [^], [@%:@ ])])dnl +[AS_COPYRIGHT([$1])[]dnl m4_divert_text(m4_default([$2], [VERSION_USER]), [ $1])dnl @@ -354,7 +336,8 @@ m4_ifset([AC_PACKAGE_BUGREPORT], # user copyrights, and after the setup of the --version handling. m4_define([_AC_INIT_COPYRIGHT], [AC_COPYRIGHT( -[Copyright (C) 2003 Free Software Foundation, Inc. +[Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it.], [VERSION_FSF])dnl @@ -365,13 +348,18 @@ gives unlimited permission to copy, distribute and modify it.], # ---------------- # Set up the file descriptors used by `configure'. # File descriptor usage: -# 0 standard input +# 0 standard input (/dev/null) # 1 file creation # 2 errors and warnings # AS_MESSAGE_LOG_FD compiler messages saved in config.log # AS_MESSAGE_FD checking for... messages and results - +# AS_ORIGINAL_STDIN_FD original standard input (still open) +# +# stdin is /dev/null because checks that run programs may +# inadvertently run interactive ones, which would stop configuration +# until someone typed an EOF. m4_define([AS_MESSAGE_FD], 6) +m4_define([AS_ORIGINAL_STDIN_FD], 7) # That's how they used to be named. AU_ALIAS([AC_FD_CC], [AS_MESSAGE_LOG_FD]) AU_ALIAS([AC_FD_MSG], [AS_MESSAGE_FD]) @@ -384,18 +372,20 @@ AU_ALIAS([AC_FD_MSG], [AS_MESSAGE_FD]) m4_define([_AC_INIT_DEFAULTS], [m4_divert_push([DEFAULTS])dnl +exec AS_ORIGINAL_STDIN_FD<&0 &1 + # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` -exec AS_MESSAGE_FD>&1 - # # Initializations. # ac_default_prefix=/usr/local +ac_clean_files= ac_config_libobj_dir=. +LIB@&t@OBJS= cross_compiling=no subdirs= MFLAGS= @@ -403,11 +393,6 @@ MAKEFLAGS= AC_SUBST([SHELL], [${CONFIG_SHELL-/bin/sh}])dnl AC_SUBST([PATH_SEPARATOR])dnl -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - # Identity of this package. AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])])dnl @@ -423,7 +408,14 @@ AC_SUBST([PACKAGE_BUGREPORT], m4_divert_pop([DEFAULTS])dnl m4_wrap([m4_divert_text([DEFAULTS], [ac_subst_vars='m4_ifdef([_AC_SUBST_VARS], [m4_defn([_AC_SUBST_VARS])])' -ac_subst_files='m4_ifdef([_AC_SUBST_FILES], [m4_defn([_AC_SUBST_FILES])])'])])dnl +ac_subst_files='m4_ifdef([_AC_SUBST_FILES], [m4_defn([_AC_SUBST_FILES])])' +m4_ifdef([_AC_PRECIOUS_VARS], + [_AC_ARG_VAR_STORE[]dnl + _AC_ARG_VAR_VALIDATE[]dnl + ac_precious_vars='m4_defn([_AC_PRECIOUS_VARS])']) +m4_ifdef([_AC_LIST_SUBDIRS], + [ac_subdirs_all='m4_defn([_AC_LIST_SUBDIRS])'])dnl +])])dnl ])# _AC_INIT_DEFAULTS @@ -457,43 +449,72 @@ fi # AC_CONFIG_SRCDIR([UNIQUE-FILE-IN-SOURCE-DIR]) # --------------------------------------------- -# UNIQUE-FILE-IN-SOURCE-DIR is a filename unique to this package, +# UNIQUE-FILE-IN-SOURCE-DIR is a file name 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_DEFUN([AC_CONFIG_SRCDIR], [m4_divert_text([DEFAULTS], [ac_unique_file="$1"])]) +# _AC_INIT_DIRCHECK +# ----------------- +# Set ac_pwd, and sanity-check it and the source and installation directories. +# +# (This macro is AC_REQUIREd by _AC_INIT_SRCDIR, so it has to be AC_DEFUNed.) +# +AC_DEFUN([_AC_INIT_DIRCHECK], +[m4_divert_push([PARSE_ARGS])dnl + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + AC_MSG_ERROR([Working directory cannot be determined]) +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + AC_MSG_ERROR([pwd does not report name of working directory]) + +m4_divert_pop([PARSE_ARGS])dnl +])# _AC_INIT_DIRCHECK + # _AC_INIT_SRCDIR # --------------- # Compute `srcdir' based on `$ac_unique_file'. -m4_define([_AC_INIT_SRCDIR], -[m4_divert_push([PARSE_ARGS])dnl +# +# (We have to AC_DEFUN it, since we use AC_REQUIRE.) +# +AC_DEFUN([_AC_INIT_SRCDIR], +[AC_REQUIRE([_AC_INIT_DIRCHECK])dnl +m4_divert_push([PARSE_ARGS])dnl # 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. + # Try the directory containing this script, then the parent directory. ac_confdir=`AS_DIRNAME(["$[0]"])` srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then + 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([cannot find sources ($ac_unique_file) in $ac_confdir or ..]) - else - AC_MSG_ERROR([cannot find sources ($ac_unique_file) in $srcdir]) - fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + AC_MSG_ERROR([cannot find sources ($ac_unique_file) in $srcdir]) fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - AC_MSG_ERROR([sources are in $srcdir, but `cd $srcdir' does not work]) -dnl Double slashes in pathnames in object file debugging info -dnl mess up M-x gdb in Emacs. -srcdir=`echo "$srcdir" | sed 's%\([[^\\/]]\)[[\\/]]*$%\1%'` +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || AC_MSG_ERROR([$ac_msg]) + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[[^/]]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac m4_divert_pop([PARSE_ARGS])dnl ])# _AC_INIT_SRCDIR @@ -528,34 +549,50 @@ x_libraries=NONE # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) AC_SUBST([bindir], ['${exec_prefix}/bin'])dnl AC_SUBST([sbindir], ['${exec_prefix}/sbin'])dnl AC_SUBST([libexecdir], ['${exec_prefix}/libexec'])dnl -AC_SUBST([datadir], ['${prefix}/share'])dnl +AC_SUBST([datarootdir], ['${prefix}/share'])dnl +AC_SUBST([datadir], ['${datarootdir}'])dnl AC_SUBST([sysconfdir], ['${prefix}/etc'])dnl AC_SUBST([sharedstatedir], ['${prefix}/com'])dnl AC_SUBST([localstatedir], ['${prefix}/var'])dnl -AC_SUBST([libdir], ['${exec_prefix}/lib'])dnl AC_SUBST([includedir], ['${prefix}/include'])dnl AC_SUBST([oldincludedir], ['/usr/include'])dnl -AC_SUBST([infodir], ['${prefix}/info'])dnl -AC_SUBST([mandir], ['${prefix}/man'])dnl +AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], + ['${datarootdir}/doc/${PACKAGE_TARNAME}'], + ['${datarootdir}/doc/${PACKAGE}'])])dnl +AC_SUBST([infodir], ['${datarootdir}/info'])dnl +AC_SUBST([htmldir], ['${docdir}'])dnl +AC_SUBST([dvidir], ['${docdir}'])dnl +AC_SUBST([pdfdir], ['${docdir}'])dnl +AC_SUBST([psdir], ['${docdir}'])dnl +AC_SUBST([libdir], ['${exec_prefix}/lib'])dnl +AC_SUBST([localedir], ['${datarootdir}/locale'])dnl +AC_SUBST([mandir], ['${datarootdir}/man'])dnl ac_prev= +ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" + eval $ac_prev=\$ac_option ac_prev= continue fi - ac_optarg=`expr "x$ac_option" : 'x[[^=]]*=\(.*\)'` + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[[^=]]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_option in + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; @@ -577,31 +614,31 @@ do --config-cache | -C) cache_file=config.cache ;; - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) + -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : "[.*[^-_$as_cr_alnum]]" >/dev/null && - AC_MSG_ERROR([invalid feature name: $ac_feature]) - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([[^=]]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : "[.*[^-_$as_cr_alnum]]" >/dev/null && - AC_MSG_ERROR([invalid feature name: $ac_feature]) - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; + _AC_INIT_PARSE_ENABLE([disable], [feature], [no]) + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + _AC_INIT_PARSE_ENABLE([enable], [feature], [\$ac_optarg]) -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -628,6 +665,12 @@ do -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; @@ -652,13 +695,16 @@ do | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) + | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) @@ -723,6 +769,16 @@ do | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; @@ -772,25 +828,9 @@ do -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([[^=]]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : "[.*[^-_$as_cr_alnum]]" >/dev/null && - AC_MSG_ERROR([invalid package name: $ac_package]) - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; + _AC_INIT_PARSE_ENABLE([with], [package], [\$ac_optarg]) - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : "[.*[^-_$as_cr_alnum]]" >/dev/null && - AC_MSG_ERROR([invalid package name: $ac_package]) - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; + _AC_INIT_PARSE_ENABLE([without], [package], [no]) --x) # Obsolete; use --with-x. @@ -819,8 +859,7 @@ Try `$[0] --help' for more information.]) # Reject names that are not valid shell variable names. expr "x$ac_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null && AC_MSG_ERROR([invalid variable name: $ac_envvar]) - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" + eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) @@ -839,25 +878,18 @@ if test -n "$ac_prev"; then AC_MSG_ERROR([missing argument to $ac_option]) fi -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir do - eval ac_val=$`echo $ac_var` + eval ac_val=\$$ac_var case $ac_val in - [[\\/$]]* | ?:[[\\/]]* | NONE | '' ) ;; - *) AC_MSG_ERROR([expected an absolute directory name for --$ac_var: $ac_val]);; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [[\\/$]]* | ?:[[\\/]]* ) ;; - *) AC_MSG_ERROR([expected an absolute directory name for --$ac_var: $ac_val]);; + [[\\/$]]* | ?:[[\\/]]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac + AC_MSG_ERROR([expected an absolute directory name for --$ac_var: $ac_val]) done # There might be people who depend on the old broken behavior: `$host' @@ -887,6 +919,21 @@ m4_divert_pop([PARSE_ARGS])dnl ])# _AC_INIT_PARSE_ARGS +# _AC_INIT_PARSE_ENABLE(OPTION-NAME, FEATURE, VALUE) +# -------------------------------------------------- +# Handle an `--enable' or a `--with' option. +# +m4_define([_AC_INIT_PARSE_ENABLE], +[-$1-* | --$1-*) + ac_$2=`expr "x$ac_option" : 'x-*$1-\(m4_bmatch([$1], [^\(enable\|with\)$], [[[^=]]], [.])*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_$2" : "[.*[^-._$as_cr_alnum]]" >/dev/null && + AC_MSG_ERROR([invalid $2 name: $ac_$2]) + [ac_$2=`echo $ac_$2 | sed 's/[-.]/_/g'`] + eval m4_bmatch([$1], [^\(enable\|disable\)$], [enable], [with])_$ac_$2=$3 ;;dnl +]) + + # _AC_INIT_HELP # ------------- # Handle the `configure --help' message. @@ -922,9 +969,6 @@ Configuration: -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] -_ACEOF - - cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] @@ -942,15 +986,22 @@ Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root ]@<:@DATAROOTDIR/doc/m4_ifset([AC_PACKAGE_TARNAME], [AC_PACKAGE_TARNAME], [PACKAGE])@:>@[ + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF] @@ -992,34 +1043,30 @@ m4_divert_push([HELP_END])dnl m4_ifset([AC_PACKAGE_BUGREPORT], [ Report bugs to .]) _ACEOF +ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. - ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - _AC_SRCPATHS(["$ac_dir"]) - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help + test -d "$ac_dir" || continue + _AC_SRCDIRS(["$ac_dir"]) + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive else AC_MSG_WARN([no configuration information is in $ac_dir]) - fi - cd "$ac_popdir" + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } done fi -test -n "$ac_init_help" && exit 0 +test -n "$ac_init_help" && exit $ac_status m4_divert_pop([HELP_END])dnl ])# _AC_INIT_HELP @@ -1030,16 +1077,13 @@ m4_divert_pop([HELP_END])dnl m4_define([_AC_INIT_VERSION], [m4_divert_text([VERSION_BEGIN], [if $ac_init_version; then - cat <<\_ACEOF])dnl -m4_ifset([AC_PACKAGE_STRING], - [m4_divert_text([VERSION_BEGIN], - [dnl + cat <<\_ACEOF m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])configure[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -generated by m4_PACKAGE_STRING])]) +generated by m4_PACKAGE_STRING]) m4_divert_text([VERSION_END], [_ACEOF - exit 0 + exit fi])dnl ])# _AC_INIT_VERSION @@ -1050,8 +1094,7 @@ fi])dnl m4_define([_AC_INIT_CONFIG_LOG], [m4_divert_text([INIT_PREPARE], [m4_define([AS_MESSAGE_LOG_FD], 5)dnl -exec AS_MESSAGE_LOG_FD>config.log -cat >&AS_MESSAGE_LOG_FD <<_ACEOF +cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -1062,6 +1105,7 @@ generated by m4_PACKAGE_STRING. Invocation command line was $ $[0] $[@] _ACEOF +exec AS_MESSAGE_LOG_FD>>config.log AS_UNAME >&AS_MESSAGE_LOG_FD cat >&AS_MESSAGE_LOG_FD <<_ACEOF @@ -1079,8 +1123,8 @@ _ACEOF # 1. Trap and clean up various tmp files. # 2. Set up the fd and output files # 3. Remember the options given to `configure' for `config.status --recheck'. -# 4. Ensure a correct environment -# 5. Required macros (cache, default AC_SUBST etc.) +# 4. Initiates confdefs.h +# 5. Loads site and cache files m4_define([_AC_INIT_PREPARE], [m4_divert_push([INIT_PREPARE])dnl @@ -1092,7 +1136,6 @@ m4_define([_AC_INIT_PREPARE], ac_configure_args= ac_configure_args0= ac_configure_args1= -ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do @@ -1103,9 +1146,7 @@ do -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; -dnl If you change this globbing pattern, test it on an old shell -- -dnl it's sensitive. Putting any kind of quote in it causes syntax errors. - [ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)] + *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in @@ -1133,9 +1174,7 @@ dnl exit don't matter. -* ) ac_must_keep_next=true ;; esac fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " + ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done @@ -1146,8 +1185,8 @@ AS_UNSET(ac_configure_args1) # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { @@ -1158,25 +1197,31 @@ trap 'exit_status=$? m4_bpatsubsts(m4_defn([_AC_CACHE_DUMP]), [^ *\(#.*\)? ], [], - ['], ['"'"']) + ['], ['\\'']) echo AS_BOX([Output variables.]) echo for ac_var in $ac_subst_vars do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - AS_BOX([Output files.]) + AS_BOX([File substitutions.]) echo for ac_var in $ac_subst_files do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" done | sort echo fi @@ -1184,26 +1229,27 @@ trap 'exit_status=$? if test -s confdefs.h; then AS_BOX([confdefs.h.]) echo - sed "/^$/d" confdefs.h | sort + cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&AS_MESSAGE_LOG_FD - rm -f core *.core && - rm -rf conftest* confdefs* conf$[$]* $ac_clean_files && + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$[$]* $ac_clean_files && exit $exit_status - ' 0 +' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; AS_EXIT([1])' $ac_signal done ac_signal=0 # 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 +rm -f -r conftest* confdefs.h +dnl AIX cpp loses on an empty file, NextStep 3.3 (patch 3) loses on a file +dnl containing less than 14 bytes (including the newline). +dnl But the defines below solve this problem. # Predefined preprocessor variables. AC_DEFINE_UNQUOTED([PACKAGE_NAME], ["$PACKAGE_NAME"], @@ -1221,18 +1267,6 @@ AC_DEFINE_UNQUOTED([PACKAGE_BUGREPORT], ["$PACKAGE_BUGREPORT"], # Let the site file select an alternate cache file if it wants to. AC_SITE_LOAD AC_CACHE_LOAD -_AC_ARG_VAR_VALIDATE -_AC_ARG_VAR_PRECIOUS([build_alias])dnl -_AC_ARG_VAR_PRECIOUS([host_alias])dnl -_AC_ARG_VAR_PRECIOUS([target_alias])dnl -AC_LANG_PUSH(C) - -dnl Substitute for predefined variables. -AC_SUBST([DEFS])dnl -AC_SUBST([ECHO_C])dnl -AC_SUBST([ECHO_N])dnl -AC_SUBST([ECHO_T])dnl -AC_SUBST([LIBS])dnl m4_divert_pop([INIT_PREPARE])dnl ])# _AC_INIT_PREPARE @@ -1267,6 +1301,7 @@ AS_PREPARE m4_ifval([$2], [_AC_INIT_PACKAGE($@)]) _AC_INIT_DEFAULTS _AC_INIT_PARSE_ARGS +_AC_INIT_DIRCHECK _AC_INIT_SRCDIR _AC_INIT_HELP _AC_INIT_VERSION @@ -1275,31 +1310,66 @@ _AC_INIT_PREPARE _AC_INIT_NOTICE _AC_INIT_COPYRIGHT m4_ifval([$2], , [m4_ifval([$1], [AC_CONFIG_SRCDIR([$1])])])dnl +dnl +dnl Substitute for predefined variables. +AC_SUBST([DEFS])dnl +AC_SUBST([ECHO_C])dnl +AC_SUBST([ECHO_N])dnl +AC_SUBST([ECHO_T])dnl +AC_SUBST([LIBS])dnl +_AC_ARG_VAR_PRECIOUS([build_alias])AC_SUBST([build_alias])dnl +_AC_ARG_VAR_PRECIOUS([host_alias])AC_SUBST([host_alias])dnl +_AC_ARG_VAR_PRECIOUS([target_alias])AC_SUBST([target_alias])dnl +dnl +AC_LANG_PUSH(C) ]) -## ----------------------------- ## -## Selecting optional features. ## -## ----------------------------- ## +## ------------------------------------------------------------- ## +## Selecting optional features, working with optional software. ## +## ------------------------------------------------------------- ## + +# AC_PRESERVE_HELP_ORDER +# ---------------------- +# Emit help strings in the order given, rather than grouping all --enable-FOO +# and all --with-BAR. +AC_DEFUN([AC_PRESERVE_HELP_ORDER], +[m4_divert_once([HELP_ENABLE], [[ +Optional 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)]]) +m4_define([_m4_divert(HELP_ENABLE)], _m4_divert(HELP_WITH)) +])# AC_PRESERVE_HELP_ORDER + +# _AC_ENABLE_IF(OPTION, FEATURE, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# ------------------------------------------------------------------- +# Common code for AC_ARG_ENABLE and AC_ARG_WITH. +# OPTION is either "enable" or "with". +# +m4_define([_AC_ENABLE_IF], +[# Check whether --$1-$2 was given. +_AC_ENABLE_IF_ACTION([$1], m4_translit([$2], [-.], [__]), [$3], [$4])[]dnl +]) +m4_define([_AC_ENABLE_IF_ACTION], +[AS_IF([test "${$1_$2+set}" = set], [$1val=$$1_$2; $3], [$4])dnl +]) # AC_ARG_ENABLE(FEATURE, HELP-STRING, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) # ------------------------------------------------------------------------ AC_DEFUN([AC_ARG_ENABLE], +[AC_PROVIDE_IFELSE([AC_PRESERVE_HELP_ORDER], +[], [m4_divert_once([HELP_ENABLE], [[ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes]]])dnl + --enable-FEATURE[=ARG] include FEATURE [ARG=yes]]])])dnl m4_divert_once([HELP_ENABLE], [$2])dnl -# Check whether --enable-$1 or --disable-$1 was given. -if test "[${enable_]m4_bpatsubst([$1], -, _)+set}" = set; then - enableval="[$enable_]m4_bpatsubst([$1], -, _)" - $3 -m4_ifvaln([$4], [else - $4])dnl -fi; dnl +_AC_ENABLE_IF([enable], [$1], [$3], [$4])dnl ])# AC_ARG_ENABLE @@ -1307,27 +1377,17 @@ AU_DEFUN([AC_ENABLE], [AC_ARG_ENABLE([$1], [ --enable-$1], [$2], [$3])]) -## ------------------------------ ## -## Working with optional software ## -## ------------------------------ ## - - - # AC_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE, [ACTION-IF-FALSE]) # -------------------------------------------------------------------- AC_DEFUN([AC_ARG_WITH], +[AC_PROVIDE_IFELSE([AC_PRESERVE_HELP_ORDER], +[], [m4_divert_once([HELP_WITH], [[ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)]]) + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)]])]) m4_divert_once([HELP_WITH], [$2])dnl -# Check whether --with-$1 or --without-$1 was given. -if test "[${with_]m4_bpatsubst([$1], -, _)+set}" = set; then - withval="[$with_]m4_bpatsubst([$1], -, _)" - $3 -m4_ifvaln([$4], [else - $4])dnl -fi; dnl +_AC_ENABLE_IF([with], [$1], [$3], [$4])dnl ])# AC_ARG_WITH AU_DEFUN([AC_WITH], @@ -1340,10 +1400,35 @@ AU_DEFUN([AC_WITH], ## ----------------------------------------- ## +# AC_ARG_VAR(VARNAME, DOCUMENTATION) +# ---------------------------------- +# Register VARNAME as a precious variable, and document it in +# `configure --help' (but only once). +AC_DEFUN([AC_ARG_VAR], +[m4_divert_once([HELP_VAR], [[ +Some influential environment variables:]])dnl +m4_divert_once([HELP_VAR_END], [[ +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations.]])dnl +m4_expand_once([m4_divert_text([HELP_VAR], + [AS_HELP_STRING([$1], [$2], [ ])])], + [$0($1)])dnl +AC_SUBST([$1])dnl +_AC_ARG_VAR_PRECIOUS([$1])dnl +])# AC_ARG_VAR + + # _AC_ARG_VAR_PRECIOUS(VARNAME) # ----------------------------- # Declare VARNAME is precious. -# +m4_define([_AC_ARG_VAR_PRECIOUS], +[m4_append_uniq([_AC_PRECIOUS_VARS], [$1], [ +])dnl +]) + + +# _AC_ARG_VAR_STORE +# ----------------- # We try to diagnose when precious variables have changed. To do this, # make two early snapshots (after the option processing to take # explicit variables into account) of those variables: one (ac_env_) @@ -1354,22 +1439,23 @@ AU_DEFUN([AC_WITH], # # In subsequent runs, after having loaded the cache, compare # ac_cv_env_foo against ac_env_foo. See _AC_ARG_VAR_VALIDATE. -m4_define([_AC_ARG_VAR_PRECIOUS], -[AC_SUBST([$1])dnl -m4_divert_once([PARSE_ARGS], -[ac_env_$1_set=${$1+set} -ac_env_$1_value=$$1 -ac_cv_env_$1_set=${$1+set} -ac_cv_env_$1_value=$$1])dnl +m4_define([_AC_ARG_VAR_STORE], +[m4_divert_text([PARSE_ARGS], +[for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done])dnl ]) # _AC_ARG_VAR_VALIDATE # -------------------- # The precious variables are saved twice at the beginning of -# configure. E.g., PRECIOUS is saved as `ac_env_PRECIOUS_SET' and -# `ac_env_PRECIOUS_VALUE' on the one hand and `ac_cv_env_PRECIOUS_SET' -# and `ac_cv_env_PRECIOUS_VALUE' on the other hand. +# configure. E.g., PRECIOUS is saved as `ac_env_PRECIOUS_set' and +# `ac_env_PRECIOUS_value' on the one hand and `ac_cv_env_PRECIOUS_set' +# and `ac_cv_env_PRECIOUS_value' on the other hand. # # Now the cache has just been loaded, so `ac_cv_env_' represents the # content of the cached values, while `ac_env_' represents that of the @@ -1378,15 +1464,15 @@ ac_cv_env_$1_value=$$1])dnl # So we check that `ac_env_' and `ac_cv_env_' are consistent. If # they aren't, die. m4_define([_AC_ARG_VAR_VALIDATE], +[m4_divert_text([INIT_PREPARE], [# Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([[a-zA-Z_0-9]]*\)_set=.*/\1/p'`; do +for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) AS_MESSAGE([error: `$ac_var' was set to `$ac_old_val' in the previous run], 2) @@ -1406,10 +1492,7 @@ for ac_var in `(set) 2>&1 | # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in -dnl If you change this globbing pattern, test it on an old shell -- -dnl it's sensitive. Putting any kind of quote in it causes syntax errors. -[ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)] - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -1421,27 +1504,10 @@ done if $ac_cache_corrupted; then AS_MESSAGE([error: changes in the environment can compromise the build], 2) AS_ERROR([run `make distclean' and/or `rm $cache_file' and start over]) -fi +fi])dnl ])# _AC_ARG_VAR_VALIDATE -# AC_ARG_VAR(VARNAME, DOCUMENTATION) -# ---------------------------------- -# Register VARNAME as a precious variable, and document it in -# `configure --help' (but only once). -AC_DEFUN([AC_ARG_VAR], -[m4_divert_once([HELP_VAR], [[ -Some influential environment variables:]])dnl -m4_divert_once([HELP_VAR_END], [[ -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations.]])dnl -m4_expand_once([m4_divert_once([HELP_VAR], - [AS_HELP_STRING([$1], [$2], [ ])])], - [$0($1)])dnl -_AC_ARG_VAR_PRECIOUS([$1])dnl -])# AC_ARG_VAR - - @@ -1464,17 +1530,17 @@ Program names: --program-transform-name=PROGRAM run sed PROGRAM on installed program names m4_divert_pop([HELP_BEGIN])dnl test "$program_prefix" != NONE && - program_transform_name="s,^,$program_prefix,;$program_transform_name" + program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && - program_transform_name="s,\$,$program_suffix,;$program_transform_name" + program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed [s/[\\$]/&&/g;s/;s,x,x,$//] _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm conftest.sed +rm -f conftest.sed ])# AC_ARG_PROGRAM @@ -1492,7 +1558,7 @@ rm conftest.sed # in directory DIR. These are auxiliary files used in configuration. # DIR can be either absolute or relative to $srcdir. AC_DEFUN([AC_CONFIG_AUX_DIR], -[AC_CONFIG_AUX_DIRS($1 $srcdir/$1)]) +[AC_CONFIG_AUX_DIRS($1 "$srcdir"/$1)]) # AC_CONFIG_AUX_DIR_DEFAULT @@ -1500,7 +1566,7 @@ AC_DEFUN([AC_CONFIG_AUX_DIR], # The default is `$srcdir' or `$srcdir/..' or `$srcdir/../..'. # 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/../..)]) +[AC_CONFIG_AUX_DIRS("$srcdir" "$srcdir/.." "$srcdir/../..")]) # AC_CONFIG_AUX_DIRS(DIR ...) @@ -1512,15 +1578,15 @@ AC_DEFUN([AC_CONFIG_AUX_DIR_DEFAULT], AC_DEFUN([AC_CONFIG_AUX_DIRS], [ac_aux_dir= for ac_dir in $1; do - if test -f $ac_dir/install-sh; then + if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break - elif test -f $ac_dir/install.sh; then + elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break - elif test -f $ac_dir/shtool; then + elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break @@ -1529,9 +1595,15 @@ done if test -z "$ac_aux_dir"; then AC_MSG_ERROR([cannot find install-sh or install.sh in $1]) fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl ])# AC_CONFIG_AUX_DIRS @@ -1546,20 +1618,23 @@ AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # AC_CONFIG_MACRO_DIR(DIR) # ------------------------ # Declare directory containing additional macros for aclocal. -# DIR can be either absolute or relative to $srcdir. -AC_DEFUN([AC_CONFIG_MACRO_DIR], -[case $1 in - [[\\/]]* | ?:[[\\/]]* ) ac_macro_dir=$1 ;; - *) ac_macro_dir=$srcdir/$1 ;; -esac -if test -d "$ac_macro_dir"; then : -else - AC_MSG_ERROR([cannot find macro directory `$1']) -fi -])# AC_CONFIG_MACRO_DIR +AC_DEFUN([AC_CONFIG_MACRO_DIR], []) +## --------------------- ## +## Requiring aux files. ## +## --------------------- ## + +# AC_REQUIRE_AUX_FILE(FILE) +# ------------------------- +# This macro does nothing, it's a hook to be read with `autoconf --trace'. +# It announces FILE is required in the auxdir. +m4_define([AC_REQUIRE_AUX_FILE], +[AS_LITERAL_IF([$1], [], + [AC_FATAL([$0: requires a literal argument])])]) + + ## ----------------------------------- ## ## Getting the canonical system type. ## @@ -1578,37 +1653,48 @@ fi # -------------------------- # Generate the variables THING, THING_{alias cpu vendor os}. m4_define([_AC_CANONICAL_SPLIT], -[AC_SUBST([$1], [$ac_cv_$1])dnl -dnl FIXME: AC_SUBST([$1_alias], [$ac_cv_$1_alias])dnl -AC_SUBST([$1_cpu], - [`echo $ac_cv_$1 | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\1/'`])dnl -AC_SUBST([$1_vendor], - [`echo $ac_cv_$1 | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\2/'`])dnl -AC_SUBST([$1_os], - [`echo $ac_cv_$1 | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\3/'`])dnl +[case $ac_cv_$1 in +*-*-*) ;; +*) AC_MSG_ERROR([invalid value of canonical $1]);; +esac +AC_SUBST([$1], [$ac_cv_$1])dnl +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_$1 +shift +AC_SUBST([$1_cpu], [$[1]])dnl +AC_SUBST([$1_vendor], [$[2]])dnl +shift; shift +[# Remember, the first character of IFS is used to create $]*, +# except with old shells: +$1_os=$[*] +IFS=$ac_save_IFS +case $$1_os in *\ *) $1_os=`echo "$$1_os" | sed 's/ /-/g'`;; esac +AC_SUBST([$1_os])dnl ])# _AC_CANONICAL_SPLIT # AC_CANONICAL_BUILD # ------------------ -AC_DEFUN_ONCE([AC_CANONICAL_BUILD], +AC_DEFUN([AC_CANONICAL_BUILD], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -m4_divert_text([HELP_CANON], +AC_REQUIRE_AUX_FILE([config.sub])dnl +AC_REQUIRE_AUX_FILE([config.guess])dnl +m4_divert_once([HELP_CANON], [[ System types: --build=BUILD configure for building on BUILD [guessed]]])dnl # Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - AC_MSG_ERROR([cannot run $ac_config_sub]) +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + AC_MSG_ERROR([cannot run $SHELL $ac_aux_dir/config.sub]) AC_CACHE_CHECK([build system type], [ac_cv_build], -[ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && +[ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && AC_MSG_ERROR([cannot guess build type; you must specify one]) -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - AC_MSG_ERROR([$ac_config_sub $ac_cv_build_alias failed]) +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + AC_MSG_ERROR([$SHELL $ac_aux_dir/config.sub $ac_build_alias failed]) ]) _AC_CANONICAL_SPLIT(build) ])# AC_CANONICAL_BUILD @@ -1616,16 +1702,17 @@ _AC_CANONICAL_SPLIT(build) # AC_CANONICAL_HOST # ----------------- -AC_DEFUN_ONCE([AC_CANONICAL_HOST], +AC_DEFUN([AC_CANONICAL_HOST], [AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_divert_text([HELP_CANON], +m4_divert_once([HELP_CANON], [[ --host=HOST cross-compile to build programs to run on HOST [BUILD]]])dnl AC_CACHE_CHECK([host system type], [ac_cv_host], -[ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - AC_MSG_ERROR([$ac_config_sub $ac_cv_host_alias failed]) +[if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + AC_MSG_ERROR([$SHELL $ac_aux_dir/config.sub $host_alias failed]) +fi ]) _AC_CANONICAL_SPLIT([host]) ])# AC_CANONICAL_HOST @@ -1633,18 +1720,18 @@ _AC_CANONICAL_SPLIT([host]) # AC_CANONICAL_TARGET # ------------------- -AC_DEFUN_ONCE([AC_CANONICAL_TARGET], +AC_DEFUN([AC_CANONICAL_TARGET], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_BEFORE([$0], [AC_ARG_PROGRAM])dnl -m4_divert_text([HELP_CANON], +m4_divert_once([HELP_CANON], [[ --target=TARGET configure for building compilers for TARGET [HOST]]])dnl AC_CACHE_CHECK([target system type], [ac_cv_target], -[dnl Set target_alias. -ac_cv_target_alias=$target_alias -test "x$ac_cv_target_alias" = "x" && - ac_cv_target_alias=$ac_cv_host_alias -ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || - AC_MSG_ERROR([$ac_config_sub $ac_cv_target_alias failed]) +[if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + AC_MSG_ERROR([$SHELL $ac_aux_dir/config.sub $target_alias failed]) +fi ]) _AC_CANONICAL_SPLIT([target]) @@ -1678,14 +1765,17 @@ AU_DEFUN([AC_VALIDATE_CACHED_SYSTEM_TUPLE], []) # Look for site or system specific initialization scripts. m4_define([AC_SITE_LOAD], [# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" fi -for ac_site_file in $CONFIG_SITE; do +shift +for ac_site_file +do if test -r "$ac_site_file"; then AC_MSG_NOTICE([loading site script $ac_site_file]) sed 's/^/| /' "$ac_site_file" >&AS_MESSAGE_LOG_FD @@ -1704,8 +1794,8 @@ m4_define([AC_CACHE_LOAD], if test -f "$cache_file"; then AC_MSG_NOTICE([loading cache $cache_file]) case $cache_file in - [[\\/]]* | ?:[[\\/]]* ) . $cache_file;; - *) . ./$cache_file;; + [[\\/]]* | ?:[[\\/]]* ) . "$cache_file";; + *) . "./$cache_file";; esac fi else @@ -1721,26 +1811,40 @@ fi m4_define([_AC_CACHE_DUMP], [# The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. +# So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -{ +( + for ac_var in `(set) 2>&1 | sed -n ['s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p']`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) AC_MSG_WARN([Cache variable $ac_var contains a newline.]) ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ ["s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"] - ;; + ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - ["s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"] + sed -n ["/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"] ;; - esac; -}dnl + esac | + sort +)dnl ])# _AC_CACHE_DUMP @@ -1767,18 +1871,20 @@ _ACEOF _AC_CACHE_DUMP() | sed [' + /^ac_cv_env_/b end t clear - : clear + :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end'] >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end'] >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + AC_MSG_NOTICE([updating cache $cache_file]) cat confcache >$cache_file else - echo "not updating unwritable cache $cache_file" + AC_MSG_NOTICE([not updating unwritable cache $cache_file]) fi fi rm -f confcache[]dnl @@ -1791,7 +1897,7 @@ rm -f confcache[]dnl # Should be dnl'ed. Try to catch common mistakes. m4_defun([AC_CACHE_VAL], [m4_bmatch([$2], [AC_DEFINE], - [AC_DIAGNOSE(syntax, + [AC_DIAGNOSE([syntax], [$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl [where no actions should be taken])])dnl AS_VAR_SET_IF([$1], @@ -1805,7 +1911,19 @@ AS_VAR_SET_IF([$1], m4_defun([AC_CACHE_CHECK], [AC_MSG_CHECKING([$1]) AC_CACHE_VAL([$2], [$3])dnl -AC_MSG_RESULT_UNQUOTED([AS_VAR_GET([$2])])]) +AS_LITERAL_IF([$2], + [AC_MSG_RESULT([$$2])], + [ac_res=AS_VAR_GET([$2]) + AC_MSG_RESULT([$ac_res])])dnl +]) + +# _AC_CACHE_CHECK_INT(MESSAGE, CACHE-ID, EXPRESSION, +# [PROLOGUE = DEFAULT-INCLUDES], [IF-FAILS]) +# ------------------------------------------------------------- +AC_DEFUN([_AC_CACHE_CHECK_INT], +[AC_CACHE_CHECK([$1], [$2], + [AC_COMPUTE_INT([$2], [$3], [$4], [$5])]) +])# _AC_CACHE_CHECK_INT @@ -1816,9 +1934,9 @@ AC_MSG_RESULT_UNQUOTED([AS_VAR_GET([$2])])]) # AC_DEFINE_TRACE_LITERAL(LITERAL-CPP-SYMBOL) # ------------------------------------------- -# This macro is useless, it is used only with --trace to collect the -# list of *literals* CPP values passed to AC_DEFINE/AC_DEFINE_UNQUOTED. -m4_define([AC_DEFINE_TRACE_LITERAL]) +# Used by --trace to collect the list of AC_DEFINEd macros. +m4_define([AC_DEFINE_TRACE_LITERAL], +[m4_pattern_allow([^$1$])]) # AC_DEFINE_TRACE(CPP-SYMBOL) @@ -1834,23 +1952,22 @@ m4_define([AC_DEFINE_TRACE], # Set VARIABLE to VALUE, verbatim, or 1. Remember the value # and if VARIABLE is affected the same VALUE, do nothing, else # die. The third argument is used by autoheader. -m4_define([AC_DEFINE], -[AC_DEFINE_TRACE([$1])dnl -m4_ifval([$3], [AH_TEMPLATE([$1], [$3])])dnl -cat >>confdefs.h <<\_ACEOF -[@%:@define] $1 m4_if($#, 2, [$2], $#, 3, [$2], 1) -_ACEOF -]) +m4_define([AC_DEFINE], [_AC_DEFINE_Q([\], $@)]) # AC_DEFINE_UNQUOTED(VARIABLE, [VALUE], [DESCRIPTION]) # ---------------------------------------------------- # Similar, but perform shell substitutions $ ` \ once on VALUE. -m4_define([AC_DEFINE_UNQUOTED], -[AC_DEFINE_TRACE([$1])dnl -m4_ifval([$3], [AH_TEMPLATE([$1], [$3])])dnl -cat >>confdefs.h <<_ACEOF -[@%:@define] $1 m4_if($#, 2, [$2], $#, 3, [$2], 1) +m4_define([AC_DEFINE_UNQUOTED], [_AC_DEFINE_Q([], $@)]) + + +# _AC_DEFINE_Q(QUOTE, VARIABLE, [VALUE], [DESCRIPTION]) +# ----------------------------------------------------- +m4_define([_AC_DEFINE_Q], +[AC_DEFINE_TRACE([$2])dnl +m4_ifval([$4], [AH_TEMPLATE(m4_bpatsubst([[$2]], [(.*)]), [$4])])dnl +cat >>confdefs.h <<$1_ACEOF +[@%:@define] $2 m4_if($#, 2, 1, [$3]) _ACEOF ]) @@ -1861,17 +1978,24 @@ _ACEOF ## -------------------------- ## +# AC_SUBST_TRACE(VARIABLE) +# ------------------------ +# This macro is used with --trace to collect the list of substituted variables. +m4_define([AC_SUBST_TRACE]) + + # AC_SUBST(VARIABLE, [VALUE]) # --------------------------- # Create an output variable from a shell VARIABLE. If VALUE is given # assign it to VARIABLE. Use `""' is you want to set VARIABLE to an # empty value, not an empty second argument. # -# Beware that if you change this macro, you also have to change the -# sed script at the top of _AC_OUTPUT_FILES. m4_define([AC_SUBST], -[m4_ifvaln([$2], [$1=$2])[]dnl -m4_append_uniq([_AC_SUBST_VARS], [$1], [ ])dnl +[AC_SUBST_TRACE([$1])dnl +m4_pattern_allow([^$1$])dnl +m4_ifvaln([$2], [$1=$2])[]dnl +m4_append_uniq([_AC_SUBST_VARS], [$1], [ +])dnl ])# AC_SUBST @@ -1879,7 +2003,9 @@ m4_append_uniq([_AC_SUBST_VARS], [$1], [ ])dnl # ----------------------- # Read the comments of the preceding macro. m4_define([AC_SUBST_FILE], -[m4_append_uniq([_AC_SUBST_FILES], [$1], [ ])]) +[m4_pattern_allow([^$1$])dnl +m4_append_uniq([_AC_SUBST_FILES], [$1], [ +])]) @@ -1917,25 +2043,16 @@ m4_define([AC_WARNING], # AC_MSG_CHECKING(FEATURE) # ------------------------ m4_define([AC_MSG_CHECKING], -[_AS_ECHO([$as_me:$LINENO: checking $1], AS_MESSAGE_LOG_FD) -_AS_ECHO_N([checking $1... ])[]dnl +[{ _AS_ECHO_LOG([checking $1]) +_AS_ECHO_N([checking $1... ]); }dnl ]) # AC_MSG_RESULT(RESULT) # --------------------- m4_define([AC_MSG_RESULT], -[_AS_ECHO([$as_me:$LINENO: result: $1], AS_MESSAGE_LOG_FD) -_AS_ECHO([${ECHO_T}$1])[]dnl -]) - - -# AC_MSG_RESULT_UNQUOTED(RESULT) -# ------------------------------ -# Likewise, but perform $ ` \ shell substitutions. -m4_define([AC_MSG_RESULT_UNQUOTED], -[_AS_ECHO_UNQUOTED([$as_me:$LINENO: result: $1], AS_MESSAGE_LOG_FD) -_AS_ECHO_UNQUOTED([${ECHO_T}$1])[]dnl +[{ _AS_ECHO_LOG([result: $1]) +_AS_ECHO([${ECHO_T}$1]); }dnl ]) @@ -1966,6 +2083,15 @@ AU_DEFUN([AC_CHECKING], [AS_MESSAGE([checking $1...])]) +# AU::AC_MSG_RESULT_UNQUOTED(RESULT) +# ---------------------------------- +# No escaping, so it performed also backtick substitution. +AU_DEFUN([AC_MSG_RESULT_UNQUOTED], +[_AS_ECHO_UNQUOTED([$as_me:$LINENO: result: $1], AS_MESSAGE_LOG_FD) +_AS_ECHO_UNQUOTED([${ECHO_T}$1])[]dnl +]) + + # AU::AC_VERBOSE(STRING) # ---------------------- AU_ALIAS([AC_VERBOSE], [AC_MSG_RESULT]) @@ -1987,7 +2113,7 @@ AC_DEFUN([_AC_RUN_LOG], [{ ($2) >&AS_MESSAGE_LOG_FD ($1) 2>&AS_MESSAGE_LOG_FD ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + _AS_ECHO_LOG([\$? = $ac_status]) (exit $ac_status); }]) @@ -2005,13 +2131,74 @@ AC_DEFUN([_AC_RUN_LOG_STDERR], grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + _AS_ECHO_LOG([\$? = $ac_status]) (exit $ac_status); }]) +# _AC_DO_ECHO(COMMAND) +# -------------------- +# Echo COMMAND. This is designed to be used just before evaluating COMMAND. +AC_DEFUN([_AC_DO_ECHO], +[m4_if([$1], [$ac_try], [], [ac_try="$1" +])dnl +dnl If the string contains '"', '`', or '\', then just echo it rather +dnl than expanding it. This is a hack, but it is safer, while also +dnl typically expanding simple substrings like '$CC', which is what we want. +dnl +dnl The rest of this macro body is quoted, to work around misuses like +dnl `AC_CHECK_FUNC(sigblock, , AC_CHECK_LIB(bsd, sigblock))', +dnl which underquotes the 3rd arg and would misbehave if we didn't quote here. +dnl The "(($ac_try" instead of $ac_try avoids problems with even-worse +dnl underquoting misuses, such as +dnl `AC_CHECK_FUNC(foo, , AC_CHECK_LIB(a, foo, , AC_CHECK_LIB(b, foo)))'. +dnl We normally wouldn't bother with this kind of workaround for invalid code +dnl but this change was put in just before Autoconf 2.60 and we wanted to +dnl minimize the integration hassle. +[case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\""]]) + +# _AC_DO(COMMAND) +# --------------- +# Eval COMMAND, save the exit status in ac_status, and log it. +# For internal use only. +AC_DEFUN([_AC_DO], +[_AC_RUN_LOG([eval "$1"], + [_AC_DO_ECHO([$1])])]) + + +# _AC_DO_STDERR(COMMAND) +# ---------------------- +# Like _AC_RUN_LOG_STDERR, but eval (instead of running) COMMAND. +AC_DEFUN([_AC_DO_STDERR], +[_AC_RUN_LOG_STDERR([eval "$1"], + [_AC_DO_ECHO([$1])])]) + + +# _AC_DO_VAR(VARIABLE) +# -------------------- +# Evaluate "$VARIABLE", which should be a valid shell command. +# The purpose of this macro is to write "configure:123: command line" +# into config.log for every test run. +AC_DEFUN([_AC_DO_VAR], +[_AC_DO([$$1])]) + + +# _AC_DO_TOKENS(COMMAND) +# ---------------------- +# Like _AC_DO_VAR, but execute COMMAND instead, where COMMAND is a series of +# tokens of the shell command language. +AC_DEFUN([_AC_DO_TOKENS], +[{ ac_try='$1' + _AC_DO([$ac_try]); }]) + # _AC_EVAL(COMMAND) # ----------------- # Eval COMMAND, save the exit status in ac_status, and log it. +# Unlike _AC_DO, this macro mishandles quoted arguments in some cases. +# It is present only for backward compatibility with previous Autoconf versions. AC_DEFUN([_AC_EVAL], [_AC_RUN_LOG([eval $1], [eval echo "$as_me:$LINENO: \"$1\""])]) @@ -2019,8 +2206,9 @@ AC_DEFUN([_AC_EVAL], # _AC_EVAL_STDERR(COMMAND) # ------------------------ -# Same as _AC_RUN_LOG_STDERR, but evals (instead of the running) the -# COMMAND. +# Like _AC_RUN_LOG_STDERR, but eval (instead of running) COMMAND. +# Unlike _AC_DO_STDERR, this macro mishandles quoted arguments in some cases. +# It is present only for backward compatibility with previous Autoconf versions. AC_DEFUN([_AC_EVAL_STDERR], [_AC_RUN_LOG_STDERR([eval $1], [eval echo "$as_me:$LINENO: \"$1\""])]) @@ -2028,14 +2216,28 @@ AC_DEFUN([_AC_EVAL_STDERR], # AC_TRY_EVAL(VARIABLE) # --------------------- -# The purpose of this macro is to "configure:123: command line" -# written into config.log for every test run. +# Evaluate $VARIABLE, which should be a valid shell command. +# The purpose of this macro is to write "configure:123: command line" +# into config.log for every test run. +# +# The AC_TRY_EVAL and AC_TRY_COMMAND macros are dangerous and +# undocumented, and should not be used. +# They may be removed or their API changed in a future release. +# Autoconf itself no longer uses these two macros; they are present +# only for backward compatibility with previous versions of Autoconf. +# Not every shell command will work due to problems with eval +# and quoting, and the rules for exactly what does work are tricky. +# Worse, due to double-expansion during evaluation, arbitrary unintended +# shell commands could be executed in some situations. AC_DEFUN([AC_TRY_EVAL], [_AC_EVAL([$$1])]) # AC_TRY_COMMAND(COMMAND) # ----------------------- +# Like AC_TRY_EVAL, but execute COMMAND instead, where COMMAND is a series of +# tokens of the shell command language. +# This macro should not be used; see the comments under AC_TRY_EVAL for why. AC_DEFUN([AC_TRY_COMMAND], [{ ac_try='$1' _AC_EVAL([$ac_try]); }]) @@ -2061,28 +2263,16 @@ AC_DEFUN([AC_RUN_LOG], # Try to preprocess PROGRAM. # # This macro can be used during the selection of a preprocessor. -# Run cpp and set ac_cpp_err to "yes" for an error, to -# "$ac_(c,cxx)_preproc_warn_flag" if there are warnings or to "" if -# neither warnings nor errors have been detected. eval is necessary -# to expand ac_cpp. +# eval is necessary to expand ac_cpp. AC_DEFUN([_AC_PREPROC_IFELSE], [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl -if _AC_EVAL_STDERR([$ac_cpp conftest.$ac_ext]) >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_[]_AC_LANG_ABBREV[]_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - m4_default([$2], :) -else - _AC_MSG_LOG_CONFTEST - $3 -fi +AS_IF([_AC_DO_STDERR([$ac_cpp conftest.$ac_ext]) >/dev/null && { + test -z "$ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag$ac_[]_AC_LANG_ABBREV[]_werror_flag" || + test ! -s conftest.err + }], + [$2], + [_AC_MSG_LOG_CONFTEST + $3]) rm -f conftest.err m4_ifval([$1], [conftest.$ac_ext])[]dnl ])# _AC_PREPROC_IFELSE @@ -2116,15 +2306,13 @@ AC_DEFUN([AC_EGREP_CPP], [AC_LANG_PREPROC_REQUIRE()dnl AC_REQUIRE([AC_PROG_EGREP])dnl AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])]) -dnl eval is necessary to expand ac_cpp. +AS_IF([dnl eval is necessary to expand ac_cpp. dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. -if (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | +(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | dnl Quote $1 to prevent m4 from eating character classes - $EGREP "[$1]" >/dev/null 2>&1; then - m4_default([$3], :) -m4_ifvaln([$4], [else - $4])dnl -fi + $EGREP "[$1]" >/dev/null 2>&1], + [$3], + [$4])dnl rm -f conftest* ])# AC_EGREP_CPP @@ -2145,25 +2333,26 @@ AC_DEFUN([AC_EGREP_HEADER], ## ------------------ ## -# _AC_COMPILE_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# --------------------------------------------------------------------- +# _AC_COMPILE_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# ---------------------------------------------------------------- # Try to compile PROGRAM. # This macro can be used during the selection of a compiler. m4_define([_AC_COMPILE_IFELSE], [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl rm -f conftest.$ac_objext -AS_IF([_AC_EVAL_STDERR($ac_compile) && - AC_TRY_COMMAND([test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" || test ! -s conftest.err]) && - AC_TRY_COMMAND([test -s conftest.$ac_objext])], +AS_IF([_AC_DO_STDERR($ac_compile) && { + test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext], [$2], [_AC_MSG_LOG_CONFTEST -m4_ifvaln([$3],[$3])dnl])dnl -rm -f conftest.err conftest.$ac_objext m4_ifval([$1], [conftest.$ac_ext])[]dnl + $3]) +rm -f core conftest.err conftest.$ac_objext m4_ifval([$1], [conftest.$ac_ext])[]dnl ])# _AC_COMPILE_IFELSE -# AC_COMPILE_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -------------------------------------------------------------------- +# AC_COMPILE_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# --------------------------------------------------------------- # Try to compile PROGRAM. Requires that the compiler for the current # language was checked for, hence do not use this macro in macros looking # for a compiler. @@ -2173,8 +2362,8 @@ _AC_COMPILE_IFELSE($@)]) # AC_TRY_COMPILE(INCLUDES, FUNCTION-BODY, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -------------------------------------------------------- +# [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# --------------------------------------------------- AU_DEFUN([AC_TRY_COMPILE], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4])]) @@ -2185,26 +2374,31 @@ AU_DEFUN([AC_TRY_COMPILE], ## --------------------- ## -# _AC_LINK_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ------------------------------------------------------------------ +# _AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# ------------------------------------------------------------- # Try to link PROGRAM. # This macro can be used during the selection of a compiler. m4_define([_AC_LINK_IFELSE], [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl rm -f conftest.$ac_objext conftest$ac_exeext -AS_IF([_AC_EVAL_STDERR($ac_link) && - AC_TRY_COMMAND([test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" || test ! -s conftest.err]) && - AC_TRY_COMMAND([test -s conftest$ac_exeext])], +AS_IF([_AC_DO_STDERR($ac_link) && { + test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + AS_TEST_X([conftest$ac_exeext])], [$2], [_AC_MSG_LOG_CONFTEST -m4_ifvaln([$3], [$3])dnl])[]dnl -rm -f conftest.err conftest.$ac_objext \ + $3]) +dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization) +dnl information created by the PGI compiler (conftest_ipa8_conftest.oo), +dnl as it would interfere with the next link command. +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl ])# _AC_LINK_IFELSE -# AC_LINK_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ----------------------------------------------------------------- +# AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# ------------------------------------------------------------ # Try to link PROGRAM. Requires that the compiler for the current # language was checked for, hence do not use this macro in macros looking # for a compiler. @@ -2214,27 +2408,26 @@ _AC_LINK_IFELSE($@)]) # AC_TRY_LINK(INCLUDES, FUNCTION-BODY, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ----------------------------------------------------- +# [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# ------------------------------------------------ # Contrarily to AC_LINK_IFELSE, this macro double quote its first two args. AU_DEFUN([AC_TRY_LINK], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4])]) # AC_COMPILE_CHECK(ECHO-TEXT, INCLUDES, FUNCTION-BODY, -# ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]) -# -------------------------------------------------------- +# ACTION-IF-TRUE, [ACTION-IF-FALSE]) +# --------------------------------------------------- AU_DEFUN([AC_COMPILE_CHECK], -[m4_ifvaln([$1], [AC_CHECKING([for $1])])dnl -AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5]) -]) +[m4_ifvaln([$1], [AC_MSG_CHECKING([for $1])])dnl +AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5])]) -## -------------------------------- ## -## Checking for run-time features. ## -## -------------------------------- ## +## ------------------------------- ## +## Checking for runtime features. ## +## ------------------------------- ## # _AC_RUN_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) @@ -2247,14 +2440,14 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5]) m4_define([_AC_RUN_IFELSE], [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl rm -f conftest$ac_exeext -AS_IF([AC_TRY_EVAL(ac_link) && AC_TRY_COMMAND(./conftest$ac_exeext)], +AS_IF([_AC_DO_VAR(ac_link) && _AC_DO_TOKENS(./conftest$ac_exeext)], [$2], [echo "$as_me: program exited with status $ac_status" >&AS_MESSAGE_LOG_FD _AC_MSG_LOG_CONFTEST m4_ifvaln([$3], [( exit $ac_status ) $3])dnl])[]dnl -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext m4_ifval([$1], +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext m4_ifval([$1], [conftest.$ac_ext])[]dnl ])# _AC_RUN_IFELSE @@ -2271,12 +2464,11 @@ AC_DEFUN([AC_RUN_IFELSE], m4_ifval([$4], [], [AC_DIAGNOSE([cross], [$0 called without default to allow cross compiling])])dnl -if test "$cross_compiling" = yes; then - m4_default([$4], - [AC_MSG_ERROR([internal error: not reached in cross-compile])]) -else - _AC_RUN_IFELSE($@) -fi]) +AS_IF([test "$cross_compiling" = yes], + [m4_default([$4], + [AC_MSG_FAILURE([cannot run test program while cross compiling])])], + [_AC_RUN_IFELSE($@)]) +]) # AC_TRY_RUN(PROGRAM, @@ -2300,15 +2492,15 @@ AC_DEFUN([AC_CHECK_FILE], [AC_DIAGNOSE([cross], [cannot check for file existence when cross compiling])dnl AS_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl -AC_CACHE_CHECK([for $1], ac_File, +AC_CACHE_CHECK([for $1], [ac_File], [test "$cross_compiling" = yes && AC_MSG_ERROR([cannot check for file existence when cross compiling]) if test -r "$1"; then - AS_VAR_SET(ac_File, yes) + AS_VAR_SET([ac_File], [yes]) else - AS_VAR_SET(ac_File, no) + AS_VAR_SET([ac_File], [no]) fi]) -AS_IF([test AS_VAR_GET(ac_File) = yes], [$2], [$3])[]dnl +AS_IF([test AS_VAR_GET([ac_File]) = yes], [$2], [$3])[]dnl AS_VAR_POPDEF([ac_File])dnl ])# AC_CHECK_FILE @@ -2316,7 +2508,7 @@ AS_VAR_POPDEF([ac_File])dnl # AC_CHECK_FILES(FILE..., [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ----------------------------------------------------------------- AC_DEFUN([AC_CHECK_FILES], -[AC_FOREACH([AC_FILE_NAME], [$1], +[m4_foreach_w([AC_FILE_NAME], [$1], [AC_CHECK_FILE(AC_FILE_NAME, [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_FILE_NAME), 1, [Define to 1 if you have the @@ -2334,18 +2526,18 @@ $2], # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], # [INCLUDES = DEFAULT-INCLUDES]) # ------------------------------------------------------- -# Check if SYMBOL (a variable or a function) is declared. +# Check whether SYMBOL (a function, variable, or constant) is declared. AC_DEFUN([AC_CHECK_DECL], [AS_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])dnl -AC_CACHE_CHECK([whether $1 is declared], ac_Symbol, +AC_CACHE_CHECK([whether $1 is declared], [ac_Symbol], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])], [#ifndef $1 - char *p = (char *) $1; + (void) $1; #endif ])], - [AS_VAR_SET(ac_Symbol, yes)], - [AS_VAR_SET(ac_Symbol, no)])]) -AS_IF([test AS_VAR_GET(ac_Symbol) = yes], [$2], [$3])[]dnl + [AS_VAR_SET([ac_Symbol], [yes])], + [AS_VAR_SET([ac_Symbol], [no])])]) +AS_IF([test AS_VAR_GET([ac_Symbol]) = yes], [$2], [$3])[]dnl AS_VAR_POPDEF([ac_Symbol])dnl ])# AC_CHECK_DECL @@ -2370,6 +2562,18 @@ $3], ])# AC_CHECK_DECLS +# AC_CHECK_DECLS_ONCE(SYMBOLS) +# ---------------------------- +# Like AC_CHECK_DECLS(SYMBOLS), but do it at most once. +AC_DEFUN([AC_CHECK_DECLS_ONCE], +[ + m4_foreach([AC_Symbol], [$1], + [AC_DEFUN([_AC_Check_Decl_]m4_defn([AC_Symbol]), + [AC_CHECK_DECLS(m4_defn([AC_Symbol]))]) + AC_REQUIRE([_AC_Check_Decl_]m4_defn([AC_Symbol]))]) +]) + + ## ---------------------------------- ## ## Replacement of library functions. ## @@ -2380,50 +2584,40 @@ $3], # ----------------------------- # Announce LIBOBJ replacement files are in $top_srcdir/DIRNAME. AC_DEFUN_ONCE([AC_CONFIG_LIBOBJ_DIR], -[m4_bmatch([$1], [^]m4_defn([m4_cr_symbols2]), - [AC_WARNING([invalid replacement directory: $1])])dnl -m4_divert_text([DEFAULTS], [ac_config_libobj_dir=$1])[]dnl -]) +[m4_divert_text([DEFAULTS], [ac_config_libobj_dir=$1])]) -# AC_LIBSOURCE(FILENAME) -# ---------------------- -# Announce we might need the file `FILENAME'. +# AC_LIBSOURCE(FILE-NAME) +# ----------------------- +# Announce we might need the file `FILE-NAME'. m4_define([AC_LIBSOURCE], []) -# AC_LIBSOURCES([FILENAME1, ...]) +# AC_LIBSOURCES([FILE-NAME1, ...]) # ------------------------------- # Announce we might need these files. m4_define([AC_LIBSOURCES], -[m4_foreach([_AC_FILENAME], [$1], - [AC_LIBSOURCE(_AC_FILENAME)])]) +[m4_foreach([_AC_FILE_NAME], [$1], + [AC_LIBSOURCE(_AC_FILE_NAME)])]) -# _AC_LIBOBJ(FILENAME-NOEXT, ACTION-IF-INDIR) -# ------------------------------------------- -# We need `FILENAME-NOEXT.o', save this into `LIBOBJS'. -# We don't use AC_SUBST/2 because it forces an unnecessary eol. +# _AC_LIBOBJ(FILE-NAME-NOEXT, ACTION-IF-INDIR) +# -------------------------------------------- +# We need `FILE-NAME-NOEXT.o', save this into `LIBOBJS'. m4_define([_AC_LIBOBJ], [AS_LITERAL_IF([$1], [AC_LIBSOURCE([$1.c])], [$2])dnl -AC_SUBST([LIB@&t@OBJS])dnl -case $LIB@&t@OBJS in - "$1.$ac_objext" | \ - *" $1.$ac_objext" | \ - "$1.$ac_objext "* | \ +case " $LIB@&t@OBJS " in *" $1.$ac_objext "* ) ;; - *) LIB@&t@OBJS="$LIB@&t@OBJS $1.$ac_objext" ;; + *) AC_SUBST([LIB@&t@OBJS], ["$LIB@&t@OBJS $1.$ac_objext"]) ;; esac ]) - -# AC_LIBOBJ(FILENAME-NOEXT) +# AC_LIBOBJ(FILE-NAME-NOEXT) # ------------------------- -# We need `FILENAME-NOEXT.o', save this into `LIBOBJS'. -# We don't use AC_SUBST/2 because it forces an unnecessary eol. +# We need `FILE-NAME-NOEXT.o', save this into `LIBOBJS'. m4_define([AC_LIBOBJ], [_AC_LIBOBJ([$1], [AC_DIAGNOSE(syntax, @@ -2433,7 +2627,7 @@ m4_define([AC_LIBOBJ], # _AC_LIBOBJS_NORMALIZE # --------------------- -# Clean up LIBOBJS abd LTLIBOBJS so that they work with 1. ac_objext, +# Clean up LIBOBJS and LTLIBOBJS so that they work with 1. ac_objext, # 2. Automake's ANSI2KNR, 3. Libtool, 4. combination of the three. # Used with AC_CONFIG_COMMANDS_PRE. AC_DEFUN([_AC_LIBOBJS_NORMALIZE], @@ -2441,11 +2635,12 @@ AC_DEFUN([_AC_LIBOBJS_NORMALIZE], ac_ltlibobjs= for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) @@ -2457,41 +2652,41 @@ AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) ## ----------------------------------- ## -# _AC_COMPUTE_INT_COMPILE(EXPRESSION, VARIABLE, [INCLUDES], [IF-FAILS]) -# --------------------------------------------------------------------- +# _AC_COMPUTE_INT_COMPILE(EXPRESSION, VARIABLE, PROLOGUE, [IF-FAILS]) +# ------------------------------------------------------------------- # Compute the integer EXPRESSION and store the result in the VARIABLE. # Works OK if cross compiling, but assumes twos-complement arithmetic. m4_define([_AC_COMPUTE_INT_COMPILE], [# Depending upon the size, compute the lo and hi bounds. -AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= 0])], +_AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= 0])], [ac_lo=0 ac_mid=0 while :; do - AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_mid])], - [ac_hi=$ac_mid; break], - [ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1`]) + _AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_mid])], + [ac_hi=$ac_mid; break], + [ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1`]) done], [AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) < 0])], [ac_hi=-1 ac_mid=-1 while :; do - AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= $ac_mid])], - [ac_lo=$ac_mid; break], - [ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid`]) + _AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= $ac_mid])], + [ac_lo=$ac_mid; break], + [ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid`]) done], [ac_lo= ac_hi=])]) # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_mid])], + _AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_mid])], [ac_hi=$ac_mid], [ac_lo=`expr '(' $ac_mid ')' + 1`]) done case $ac_lo in @@ -2501,21 +2696,35 @@ esac[]dnl ])# _AC_COMPUTE_INT_COMPILE -# _AC_COMPUTE_INT_RUN(EXPRESSION, VARIABLE, [INCLUDES], [IF-FAILS]) -# ----------------------------------------------------------------- +# _AC_COMPUTE_INT_RUN(EXPRESSION, VARIABLE, PROLOGUE, [IF-FAILS]) +# --------------------------------------------------------------- # Store the evaluation of the integer EXPRESSION in VARIABLE. m4_define([_AC_COMPUTE_INT_RUN], -[AC_RUN_IFELSE([AC_LANG_INT_SAVE([$3], [$1])], - [$2=`cat conftest.val`], [$4])]) +[_AC_RUN_IFELSE([AC_LANG_INT_SAVE([$3], [$1])], + [$2=`cat conftest.val`], [$4])]) -# _AC_COMPUTE_INT(EXPRESSION, VARIABLE, INCLUDES, IF-FAILS) -# --------------------------------------------------------- -m4_define([_AC_COMPUTE_INT], -[if test "$cross_compiling" = yes; then - _AC_COMPUTE_INT_COMPILE([$1], [$2], [$3], [$4]) +# AC_COMPUTE_INT(VARIABLE, EXPRESSION, PROLOGUE, [IF-FAILS]) +# ---------------------------------------------------------- +AC_DEFUN([AC_COMPUTE_INT], +[AC_LANG_COMPILER_REQUIRE()dnl +if test "$cross_compiling" = yes; then + _AC_COMPUTE_INT_COMPILE([$2], [$1], [$3], [$4]) else - _AC_COMPUTE_INT_RUN([$1], [$2], [$3], [$4]) + _AC_COMPUTE_INT_RUN([$2], [$1], [$3], [$4]) fi rm -f conftest.val[]dnl ])# _AC_COMPUTE_INT + +# _AC_COMPUTE_INT(EXPRESSION, VARIABLE, PROLOGUE, [IF-FAILS]) +# ----------------------------------------------------------- +# FIXME: this private interface was used by several packages. +# Give them time to transition to AC_COMPUTE_INT and then delete this one. +AC_DEFUN([_AC_COMPUTE_INT], +[AC_COMPUTE_INT([$2], [$1], [$3], [$4]) +AC_DIAGNOSE([obsolete], +[The macro `_AC_COMPUTE_INT' is obsolete and will be deleted in a +future version or Autoconf. Hence, it is suggested that you use +instead the public AC_COMPUTE_INT macro. Note that the arguments are +slightly different between the two.])dnl +])# _AC_COMPUTE_INT diff --git a/build/autoconf_prepend-include/autoconf/libs.m4 b/build/autoconf_prepend-include/autoconf/libs.m4 index 9f2611f0a6..d70babf3ed 100644 --- a/build/autoconf_prepend-include/autoconf/libs.m4 +++ b/build/autoconf_prepend-include/autoconf/libs.m4 @@ -1,7 +1,7 @@ # This file is part of Autoconf. -*- Autoconf -*- # Checking for libraries. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002 Free Software Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. # As a special exception, the Free Software Foundation gives unlimited # permission to copy, distribute and modify the configure scripts that @@ -67,24 +67,29 @@ # -------------------------------------------------------- # Search for a library defining FUNC, if it's not already available. AC_DEFUN([AC_SEARCH_LIBS], -[AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1], +[AS_VAR_PUSHDEF([ac_Search], [ac_cv_search_$1])dnl +AC_CACHE_CHECK([for library containing $1], [ac_Search], [ac_func_search_save_LIBS=$LIBS -ac_cv_search_$1=no -AC_LINK_IFELSE([AC_LANG_CALL([], [$1])], - [ac_cv_search_$1="none required"]) -if test "$ac_cv_search_$1" = no; then - for ac_lib in $2; do +AC_LANG_CONFTEST([AC_LANG_CALL([], [$1])]) +for ac_lib in '' $2; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS" - AC_LINK_IFELSE([AC_LANG_CALL([], [$1])], - [ac_cv_search_$1="-l$ac_lib" -break]) - done -fi + fi + AC_LINK_IFELSE([], [AS_VAR_SET([ac_Search], [$ac_res])]) + AS_VAR_SET_IF([ac_Search], [break])dnl +done +AS_VAR_SET_IF([ac_Search], , [AS_VAR_SET([ac_Search], [no])])dnl +rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS]) -AS_IF([test "$ac_cv_search_$1" != no], - [test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS" +ac_res=AS_VAR_GET([ac_Search]) +AS_IF([test "$ac_res" != no], + [test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $3], [$4])dnl +AS_VAR_POPDEF([ac_Search])dnl ]) @@ -118,14 +123,14 @@ AC_DEFUN([AC_CHECK_LIB], AS_LITERAL_IF([$1], [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])], [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl -AC_CACHE_CHECK([for $2 in -l$1], ac_Lib, +AC_CACHE_CHECK([for $2 in -l$1], [ac_Lib], [ac_check_lib_save_LIBS=$LIBS LIBS="-l$1 $5 $LIBS" AC_LINK_IFELSE([AC_LANG_CALL([], [$2])], - [AS_VAR_SET(ac_Lib, yes)], - [AS_VAR_SET(ac_Lib, no)]) + [AS_VAR_SET([ac_Lib], [yes])], + [AS_VAR_SET([ac_Lib], [no])]) LIBS=$ac_check_lib_save_LIBS]) -AS_IF([test AS_VAR_GET(ac_Lib) = yes], +AS_IF([test AS_VAR_GET([ac_Lib]) = yes], [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1)) LIBS="-l$1 $LIBS" ])], @@ -137,8 +142,8 @@ AS_VAR_POPDEF([ac_Lib])dnl # AH_CHECK_LIB(LIBNAME) # --------------------- m4_define([AH_CHECK_LIB], -[AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1), - [Define to 1 if you have the `]$1[' library (-l]$1[).])]) +[AH_TEMPLATE(AS_TR_CPP([HAVE_LIB$1]), + [Define to 1 if you have the `$1' library (-l$1).])]) # AC_HAVE_LIBRARY(LIBRARY, @@ -180,21 +185,27 @@ m4_popdef([AC_Lib_Name])dnl # Internal subroutine of _AC_PATH_X. # Set ac_x_includes and/or ac_x_libraries. m4_define([_AC_PATH_X_XMKMF], -[rm -fr conftest.dir +[AC_ARG_VAR(XMKMF, [Path to xmkmf, Makefile generator for X Window System])dnl +rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir - # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' -acfindx: - @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +incroot: + @echo incroot='${INCROOT}' +usrlibdir: + @echo usrlibdir='${USRLIBDIR}' +libdir: + @echo libdir='${LIBDIR}' _ACEOF - if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. - eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + for ac_var in incroot usrlibdir libdir; do + eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" + done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do - if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && - test -f $ac_im_libdir/libX11.$ac_extension; then + if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && + test -f "$ac_im_libdir/libX11.$ac_extension"; then ac_im_usrlibdir=$ac_im_libdir; break fi done @@ -202,7 +213,7 @@ _ACEOF # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in - /usr/include) ;; + /usr/include) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in @@ -211,7 +222,7 @@ _ACEOF esac fi cd .. - rm -fr conftest.dir + rm -f -r conftest.dir fi ])# _AC_PATH_X_XMKMF @@ -259,13 +270,13 @@ ac_x_header_dirs=' /usr/openwin/share/include' if test "$ac_x_includes" = no; then - # Guess where to find include files, by looking for a specified header file. + # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. - AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@include ])], + AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@include ])], [# We can compile using X headers with no special include directory. ac_x_includes=], [for ac_dir in $ac_x_header_dirs; do - if test -r "$ac_dir/X11/Intrinsic.h"; then + if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi @@ -277,9 +288,9 @@ if test "$ac_x_libraries" = no; then # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS - LIBS="-lXt $LIBS" - AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include ], - [XtMalloc (0)])], + LIBS="-lX11 $LIBS" + AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include ], + [XrmInitialize ()])], [LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries=], @@ -288,7 +299,7 @@ for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do - if test -r $ac_dir/libXt.$ac_extension; then + if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 fi @@ -307,14 +318,16 @@ AC_DEFUN([_AC_PATH_X], ac_x_includes=no ac_x_libraries=no _AC_PATH_X_XMKMF _AC_PATH_X_DIRECT -if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then - # Didn't find X anywhere. Cache the known absence of X. - ac_cv_have_x="have_x=no" -else - # Record where we found X for the cache. - ac_cv_have_x="have_x=yes \ - ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" -fi])dnl +case $ac_x_includes,$ac_x_libraries in #( + no,* | *,no | *\'*) + # Didn't find X, or a directory has "'" in its name. + ac_cv_have_x="have_x=no";; #( + *) + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes\ + ac_x_includes='$ac_x_includes'\ + ac_x_libraries='$ac_x_libraries'" +esac])dnl ]) @@ -331,23 +344,19 @@ m4_divert_once([HELP_BEGIN], [ X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR])dnl +AC_MSG_CHECKING([for X]) -if test "x$ac_path_x_has_been_run" != xyes; then - AC_MSG_CHECKING([for X]) - -ac_path_x_has_been_run=yes AC_ARG_WITH(x, [ --with-x use the X Window System]) # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else - if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then - # Both variables are already set. - have_x=yes - else - _AC_PATH_X - fi + case $x_includes,$x_libraries in #( + *\'*) AC_MSG_ERROR([Cannot use X directory names containing ']);; #( + *,NONE | NONE,*) _AC_PATH_X;; #( + *) have_x=yes;; + esac eval "$ac_cv_have_x" fi # $with_x != no @@ -359,16 +368,12 @@ else test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. - ac_cv_have_x="have_x=yes \ - ac_x_includes=$x_includes ac_x_libraries=$x_libraries" - # It might be that x_includes is empty (headers are found in the - # standard search path. Then output the corresponding message - ac_out_x_includes=$x_includes - test "x$x_includes" = x && ac_out_x_includes="in standard search path" - AC_MSG_RESULT([libraries $x_libraries, headers $ac_out_x_includes]) + ac_cv_have_x="have_x=yes\ + ac_x_includes='$x_includes'\ + ac_x_libraries='$x_libraries'" + AC_MSG_RESULT([libraries $x_libraries, headers $x_includes]) fi - -fi])# AC_PATH_X +])# AC_PATH_X @@ -390,29 +395,22 @@ else # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" -dnl FIXME: banish uname from this macro! # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . - case `(uname -sr) 2>/dev/null` in - "SunOS 5"*) - AC_MSG_CHECKING([whether -R must be followed by a space]) - ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" - AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_R_nospace=yes, ac_R_nospace=no) - if test $ac_R_nospace = yes; then - AC_MSG_RESULT([no]) - X_LIBS="$X_LIBS -R$x_libraries" - else - LIBS="$ac_xsave_LIBS -R $x_libraries" - AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_R_space=yes, ac_R_space=no) - if test $ac_R_space = yes; then - AC_MSG_RESULT([yes]) - X_LIBS="$X_LIBS -R $x_libraries" - else - AC_MSG_RESULT([neither works]) - fi - fi - LIBS=$ac_xsave_LIBS - esac + AC_MSG_CHECKING([whether -R must be followed by a space]) + ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" + ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag=$ac_[]_AC_LANG_ABBREV[]_werror_flag + ac_[]_AC_LANG_ABBREV[]_werror_flag=yes + AC_LINK_IFELSE([AC_LANG_PROGRAM()], + [AC_MSG_RESULT([no]) + X_LIBS="$X_LIBS -R$x_libraries"], + [LIBS="$ac_xsave_LIBS -R $x_libraries" + AC_LINK_IFELSE([AC_LANG_PROGRAM()], + [AC_MSG_RESULT([yes]) + X_LIBS="$X_LIBS -R $x_libraries"], + [AC_MSG_RESULT([neither works])])]) + ac_[]_AC_LANG_ABBREV[]_werror_flag=$ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag + LIBS=$ac_xsave_LIBS fi # Check for system-dependent libraries X programs must link with. diff --git a/build/autoconf_prepend-include/autoconf/status.m4 b/build/autoconf_prepend-include/autoconf/status.m4 index f01959179b..7f39190678 100644 --- a/build/autoconf_prepend-include/autoconf/status.m4 +++ b/build/autoconf_prepend-include/autoconf/status.m4 @@ -1,7 +1,7 @@ # This file is part of Autoconf. -*- Autoconf -*- # Parameterizing and creating config.status. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003 Free Software Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. # As a special exception, the Free Software Foundation gives unlimited # permission to copy, distribute and modify the configure scripts that @@ -69,45 +69,11 @@ # # They are output via an *unquoted* here-doc. As a consequence $var # will be output as the value of VAR. This is typically used by -# `configure' to give `config,.status' some variables it needs to run -# the COMMANDS. At the difference of `COMMANDS', the INIT-CMDS are +# `configure' to give `config.status' some variables it needs to run +# the COMMANDS. At the difference of COMMANDS, the INIT-CMDS are # always run. # # -# Some uniformity exists around here, please respect it! -# -# A macro named AC_CONFIG_FOOS has three args: the `TAG...' (or -# `FILE...' when it applies), the `COMMANDS' and the `INIT-CMDS'. It -# first checks that TAG was not registered elsewhere thanks to -# AC_CONFIG_UNIQUE. Then it registers `TAG...' in AC_LIST_FOOS, and for -# each `TAG', a special line in AC_LIST_FOOS_COMMANDS which is used in -# `config.status' like this: -# -# case $ac_tag in -# AC_LIST_FOOS_COMMANDS -# esac -# -# Finally, the `INIT-CMDS' are dumped into a special diversion, via -# `_AC_CONFIG_COMMANDS_INIT'. While `COMMANDS' are output once per TAG, -# `INIT-CMDS' are dumped only once per call to AC_CONFIG_FOOS. -# -# It also leave the TAG in the shell variable ac_config_foo which contains -# those which will actually be executed. In other words: -# -# if false; then -# AC_CONFIG_FOOS(bar, [touch bar]) -# fi -# -# will not create bar. -# -# AC_CONFIG_FOOS can be called several times (with different TAGs of -# course). -# -# Because these macros should not output anything, there should be `dnl' -# everywhere. A pain my friend, a pain. So instead in each macro we -# divert(-1) and restore the diversion at the end. -# -# # Honorable members of this family are AC_CONFIG_FILES, # AC_CONFIG_HEADERS, AC_CONFIG_LINKS and AC_CONFIG_COMMANDS. Bad boys # are AC_LINK_FILES, AC_OUTPUT_COMMANDS and AC_OUTPUT when used with @@ -120,267 +86,496 @@ ## Auxiliary macros. ## ## ------------------ ## -# _AC_SRCPATHS(BUILD-DIR-NAME) -# ---------------------------- +# _AC_SRCDIRS(BUILD-DIR-NAME) +# --------------------------- # Inputs: # - BUILD-DIR-NAME is `top-build -> build' and `top-src -> src' # - `$srcdir' is `top-build -> top-src' # -# Ouputs: +# Outputs: # - `ac_builddir' is `.', for symmetry only. -# - `ac_top_builddir' is `build -> top_build'. +# - `ac_top_builddir_sub' is `build -> top_build'. +# This is used for @top_builddir@. +# - `ac_top_build_prefix' is `build -> top_build'. # If not empty, has a trailing slash. # - `ac_srcdir' is `build -> src'. # - `ac_top_srcdir' is `build -> top-src'. -# -# and `ac_abs_builddir' etc., the absolute paths. -m4_define([_AC_SRCPATHS], +# and `ac_abs_builddir' etc., the absolute directory names. +m4_define([_AC_SRCDIRS], [ac_builddir=. -if test $1 != .; then +case $1 in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) ac_dir_suffix=/`echo $1 | sed 's,^\.[[\\/]],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[[^\\/]]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[[^\\/]]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # We are building in place. ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [[\\/]]* | ?:[[\\/]]* ) # Absolute path. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [[\\/]]* | ?:[[\\/]]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix +])# _AC_SRCDIRS -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -AS_SET_CATFILE([ac_abs_builddir], [`pwd`], [$1]) -AS_SET_CATFILE([ac_abs_top_builddir], - [$ac_abs_builddir], [${ac_top_builddir}.]) -AS_SET_CATFILE([ac_abs_srcdir], [$ac_abs_builddir], [$ac_srcdir]) -AS_SET_CATFILE([ac_abs_top_srcdir], [$ac_abs_builddir], [$ac_top_srcdir]) -])# _AC_SRCPATHS +## ---------------------- ## +## Registering the tags. ## +## ---------------------- ## -## ------------------------------------- ## -## Ensuring the uniqueness of the tags. ## -## ------------------------------------- ## -# AC_CONFIG_IF_MEMBER(DEST, LIST-NAME, ACTION-IF-TRUE, ACTION-IF-FALSE) -# ---------------------------------------------------------------- -# If DEST is member of LIST-NAME, expand to ACTION-IF-TRUE, else -# ACTION-IF-FALSE. -# -# LIST is an AC_CONFIG list, i.e., a list of DEST[:SOURCE], separated -# with spaces. +# _AC_CONFIG_COMMANDS_INIT([INIT-COMMANDS]) +# ----------------------------------------- # -# FIXME: This macro is badly designed, but I'm not guilty: m4 is. There -# is just no way to simply compare two strings in m4, but to use pattern -# matching. The big problem is then that the active characters should -# be quoted. Currently `+*.' are quoted. -m4_define([AC_CONFIG_IF_MEMBER], -[m4_bmatch(m4_defn([$2]), [\(^\| \)]m4_re_escape([$1])[\([: ]\|$\)], - [$3], [$4])]) +# Register INIT-COMMANDS as command pasted *unquoted* in +# `config.status'. This is typically used to pass variables from +# `configure' to `config.status'. Note that $[1] is not over quoted as +# was the case in AC_OUTPUT_COMMANDS. +m4_define([_AC_CONFIG_COMMANDS_INIT], +[m4_ifval([$1], + [m4_append([_AC_OUTPUT_COMMANDS_INIT], + [$1 +])])]) # AC_FILE_DEPENDENCY_TRACE(DEST, SOURCE1, [SOURCE2...]) # ----------------------------------------------------- # This macro does nothing, it's a hook to be read with `autoconf --trace'. +# # It announces DEST depends upon the SOURCE1 etc. m4_define([AC_FILE_DEPENDENCY_TRACE], []) -# _AC_CONFIG_DEPENDENCY(DEST, [SOURCE1], [SOURCE2...]) -# ---------------------------------------------------- +# _AC_FILE_DEPENDENCY_TRACE_COLON(DEST:SOURCE1[:SOURCE2...]) +# ---------------------------------------------------------- +# Declare that DEST depends upon SOURCE1 etc. +# +m4_define([_AC_FILE_DEPENDENCY_TRACE_COLON], +[AC_FILE_DEPENDENCY_TRACE(m4_bpatsubst([$1], [:], [,]))dnl +]) + + +# _AC_CONFIG_DEPENDENCY(MODE, DEST[:SOURCE1...]) +# --------------------------------------------- +# MODE is `FILES', `HEADERS', or `LINKS'. +# # Be sure that a missing dependency is expressed as a dependency upon -# `DEST.in'. +# `DEST.in' (except with config links). +# m4_define([_AC_CONFIG_DEPENDENCY], -[m4_ifval([$2], - [AC_FILE_DEPENDENCY_TRACE($@)], - [AC_FILE_DEPENDENCY_TRACE([$1], [$1.in])])]) +[_AC_FILE_DEPENDENCY_TRACE_COLON([$2]_AC_CONFIG_DEPENDENCY_DEFAULT($@))dnl +]) -# _AC_CONFIG_DEPENDENCIES(DEST[:SOURCE1[:SOURCE2...]]...) -# ------------------------------------------------------- -# Declare the DESTs depend upon their SOURCE1 etc. -m4_define([_AC_CONFIG_DEPENDENCIES], -[AC_FOREACH([AC_File], [$1], - [_AC_CONFIG_DEPENDENCY(m4_bpatsubst(AC_File, [:], [,]))])dnl +# _AC_CONFIG_DEPENDENCY_DEFAULT(MODE, DEST[:SOURCE1...]) +# ------------------------------------------------------ +# Expand to `:DEST.in' if appropriate, or to empty string otherwise. +# +# More detailed edscription: +# If the tag contains `:', expand to nothing. +# Otherwise, for a config file or header, add `:DEST.in'. +# For config link, DEST.in is not appropriate: +# - if the tag is literal, complain. +# - otherwise, just expand to nothing and proceed with fingers crossed. +# (We get to this case from the obsolete AC_LINK_FILES, for example.) +# +m4_define([_AC_CONFIG_DEPENDENCY_DEFAULT], +[m4_bmatch([$2], [:], [], + [m4_if([$1], [LINKS], + [AS_LITERAL_IF([$2], [AC_FATAL([Invalid AC_CONFIG_LINKS tag: `$2'])])], + [:$2.in])])dnl ]) -# _AC_CONFIG_UNIQUE(DEST[:SOURCE]...) -# ----------------------------------- +# _AC_CONFIG_UNIQUE(MODE, DEST) +# ----------------------------- +# MODE is `FILES', `HEADERS', `LINKS', `COMMANDS', or `SUBDIRS'. # -# Verify that there is no double definition of an output file -# (precisely, guarantees there is no common elements between -# CONFIG_HEADERS, CONFIG_FILES, CONFIG_LINKS, and CONFIG_SUBDIRS). +# Verify that there is no double definition of an output file. # -# Note that this macro does not check if the list $[1] itself -# contains doubles. m4_define([_AC_CONFIG_UNIQUE], -[AC_FOREACH([AC_File], [$1], -[m4_pushdef([AC_Dest], m4_bpatsubst(AC_File, [:.*]))dnl - AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_HEADERS], - [AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_HEADERS.])])dnl - AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_LINKS], - [AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_LINKS.])])dnl - AC_CONFIG_IF_MEMBER(AC_Dest, [_AC_LIST_SUBDIRS], - [AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_SUBDIRS.])])dnl - AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_COMMANDS], - [AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_COMMANDS.])])dnl - AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_FILES], - [AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_FILES.])])dnl -m4_popdef([AC_Dest])])dnl +[m4_ifdef([_AC_SEEN_TAG($2)], + [AC_FATAL([`$2' is already registered with AC_CONFIG_]m4_defn([_AC_SEEN_TAG($2)]).)], + [m4_define([_AC_SEEN_TAG($2)], [$1])])dnl ]) - -## ------------------------ ## -## Configuration commands. ## -## ------------------------ ## +# _AC_CONFIG_FOOS(MODE, TAGS..., [COMMANDS], [INIT-CMDS]) +# ------------------------------------------------------- +# MODE is `FILES', `HEADERS', `LINKS', or `COMMANDS'. +# +# Associate the COMMANDS to each TAG, i.e., when config.status creates TAG, +# run COMMANDS afterwards. (This is done in _AC_CONFIG_REGISTER_DEST.) +# +# For COMMANDS, do not m4_normalize TAGS before adding it to ac_config_commands. +# This historical difference allows macro calls in TAGS. +# +m4_define([_AC_CONFIG_FOOS], +[m4_foreach_w([AC_File], [$2], + [_AC_CONFIG_REGISTER([$1], m4_defn([AC_File]), [$3])])dnl +m4_define([_AC_SEEN_CONFIG(ANY)])dnl +m4_define([_AC_SEEN_CONFIG($1)])dnl +_AC_CONFIG_COMMANDS_INIT([$4])dnl +ac_config_[]m4_tolower([$1])="$ac_config_[]m4_tolower([$1]) dnl +m4_if([$1], [COMMANDS], [$2], [m4_normalize([$2])])" +]) -# _AC_CONFIG_COMMANDS_INIT([INIT-COMMANDS]) -# ----------------------------------------- +# _AC_CONFIG_REGISTER(MODE, TAG, [COMMANDS]) +# ------------------------------------------ +# MODE is `FILES', `HEADERS', `LINKS', or `COMMANDS'. # -# Register INIT-COMMANDS as command pasted *unquoted* in -# `config.status'. This is typically used to pass variables from -# `configure' to `config.status'. Note that $[1] is not over quoted as -# was the case in AC_OUTPUT_COMMANDS. -m4_define([_AC_CONFIG_COMMANDS_INIT], -[m4_ifval([$1], - [m4_append([_AC_OUTPUT_COMMANDS_INIT], - [$1 -])])]) +m4_define([_AC_CONFIG_REGISTER], +[m4_if([$1], [COMMANDS], + [], + [_AC_CONFIG_DEPENDENCY([$1], [$2])])dnl +_AC_CONFIG_REGISTER_DEST([$1], [$2], m4_bpatsubst([[$2]], [:.*\(.\)$], [\1]), [$3])dnl +]) -# Initialize. -m4_define([_AC_OUTPUT_COMMANDS_INIT]) - - -# _AC_CONFIG_COMMAND(NAME, [COMMANDS]) -# ------------------------------------ -# See below. -m4_define([_AC_CONFIG_COMMAND], -[_AC_CONFIG_UNIQUE([$1])dnl -m4_append([AC_LIST_COMMANDS], [ $1])dnl -m4_ifval([$2], -[m4_append([AC_LIST_COMMANDS_COMMANDS], -[ ]m4_bpatsubst([$1], [:.*])[ ) $2 ;; + +# _AC_CONFIG_REGISTER_DEST(MODE, TAG, DEST, [COMMANDS]) +# ----------------------------------------------------- +# MODE is `FILES', `HEADERS', `LINKS', or `COMMANDS'. +# TAG is in the form DEST[:SOURCE...]. +# Thus parameter $3 is the first part of $2. +# +# With CONFIG_LINKS, reject DEST=., because it is makes it hard for ./config.status +# to guess the links to establish (`./config.status .'). +# +# Save the name of the first config header to AH_HEADER. +# +m4_define([_AC_CONFIG_REGISTER_DEST], +[_AC_CONFIG_UNIQUE([$1], [$3])dnl +m4_if([$1 $3], [LINKS .], + [AC_FATAL([invalid destination of a config link: `.'])])dnl +m4_if([$1], [HEADERS], + [m4_define_default([AH_HEADER], [$3])])dnl +dnl +dnl Recognize TAG as an argument to config.status: +dnl +m4_append([_AC_LIST_TAGS], +[ "$3") CONFIG_$1="$CONFIG_$1 $2" ;; +])dnl +dnl +dnl Register the associated commands, if any: +dnl +m4_ifval([$4], +[m4_append([_AC_LIST_TAG_COMMANDS], +[ "$3":]m4_bpatsubst([$1], [^\(.\).*$], [\1])[) $4 ;; ])])dnl -]) +])# _AC_CONFIG_REGISTER_DEST -# AC_CONFIG_COMMANDS(NAME...,[COMMANDS], [INIT-CMDS]) -# --------------------------------------------------- + + + +## --------------------- ## +## Configuration files. ## +## --------------------- ## + + +# AC_CONFIG_FILES(FILE..., [COMMANDS], [INIT-CMDS]) +# ------------------------------------------------- +# Specify output files, i.e., files that are configured with AC_SUBST. # -# Specify additional commands to be run by config.status. This -# commands must be associated with a NAME, which should be thought -# as the name of a file the COMMANDS create. -AC_DEFUN([AC_CONFIG_COMMANDS], -[AC_FOREACH([AC_Name], [$1], [_AC_CONFIG_COMMAND(m4_defn([AC_Name]), [$2])])dnl -_AC_CONFIG_COMMANDS_INIT([$3])dnl -ac_config_commands="$ac_config_commands $1" -]) +AC_DEFUN([AC_CONFIG_FILES], [_AC_CONFIG_FOOS([FILES], $@)]) -# Initialize the lists. -m4_define([AC_LIST_COMMANDS]) -m4_define([AC_LIST_COMMANDS_COMMANDS]) +# _AC_SED_CMD_LIMIT +# ----------------- +# Evaluate to an m4 number equal to the maximum number of commands to put +# in any single sed program, not counting ":" commands. +# +# Some seds have small command number limits, like on Digital OSF/1 and HP-UX. +m4_define([_AC_SED_CMD_LIMIT], +dnl One cannot portably go further than 99 commands because of HP-UX. +[99]) -# AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) -# ----------------------------------------- + +# _AC_OUTPUT_FILES_PREPARE +# ------------------------ +# Create the sed scripts needed for CONFIG_FILES. +# Support multiline substitutions and make sure that the substitutions are +# not evaluated recursively. +# The intention is to have readable config.status and configure, even +# though this m4 code might be scaring. # -# Add additional commands for AC_OUTPUT to put into config.status. +# This code was written by Dan Manthey. # -# This macro is an obsolete version of AC_CONFIG_COMMANDS. The only -# difficulty in mapping AC_OUTPUT_COMMANDS to AC_CONFIG_COMMANDS is -# to give a unique key. The scheme we have chosen is `default-1', -# `default-2' etc. for each call. +# This macro is expanded inside a here document. If the here document is +# closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF". # -# Unfortunately this scheme is fragile: bad things might happen -# if you update an included file and configure.ac: you might have -# clashes :( On the other hand, I'd like to avoid weird keys (e.g., -# depending upon __file__ or the pid). -AU_DEFUN([AC_OUTPUT_COMMANDS], -[m4_define([_AC_OUTPUT_COMMANDS_CNT], m4_incr(_AC_OUTPUT_COMMANDS_CNT))dnl -dnl Double quoted since that was the case in the original macro. -AC_CONFIG_COMMANDS([default-]_AC_OUTPUT_COMMANDS_CNT, [[$1]], [[$2]])dnl -]) +m4_define([_AC_OUTPUT_FILES_PREPARE], +[# +# Set up the sed scripts for CONFIG_FILES section. +# +dnl ... and define _AC_SED_CMDS, the pipeline which executes them. +m4_define([_AC_SED_CMDS], [])dnl -# Initialize. -AU_DEFUN([_AC_OUTPUT_COMMANDS_CNT], 0) +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then +_ACEOF -# AC_CONFIG_COMMANDS_PRE(CMDS) -# ---------------------------- -# Commands to run right before config.status is created. Accumulates. -AC_DEFUN([AC_CONFIG_COMMANDS_PRE], -[m4_append([AC_OUTPUT_COMMANDS_PRE], [$1 -])]) +m4_pushdef([_AC_SED_FRAG_NUM], 0)dnl Fragment number. +m4_pushdef([_AC_SED_CMD_NUM], 2)dnl Num of commands in current frag so far. +m4_pushdef([_AC_SED_DELIM_NUM], 0)dnl Expected number of delimiters in file. +m4_pushdef([_AC_SED_FRAG], [])dnl The constant part of the current fragment. +dnl +m4_ifdef([_AC_SUBST_FILES], +[# Create sed commands to just substitute file output variables. + +m4_foreach_w([_AC_Var], m4_defn([_AC_SUBST_FILES]), +[dnl End fragments at beginning of loop so that last fragment is not ended. +m4_if(m4_eval(_AC_SED_CMD_NUM + 3 > _AC_SED_CMD_LIMIT), 1, +[dnl Fragment is full and not the last one, so no need for the final un-escape. +dnl Increment fragment number. +m4_define([_AC_SED_FRAG_NUM], m4_incr(_AC_SED_FRAG_NUM))dnl +dnl Record that this fragment will need to be used. +m4_define([_AC_SED_CMDS], + m4_defn([_AC_SED_CMDS])[| sed -f "$tmp/subs-]_AC_SED_FRAG_NUM[.sed" ])dnl +[cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-]_AC_SED_FRAG_NUM[.sed" <<\CEOF +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +]m4_defn([_AC_SED_FRAG])dnl +[CEOF +_ACEOF +]m4_define([_AC_SED_CMD_NUM], 2)m4_define([_AC_SED_FRAG])dnl +])dnl Last fragment ended. +m4_define([_AC_SED_CMD_NUM], m4_eval(_AC_SED_CMD_NUM + 3))dnl +m4_define([_AC_SED_FRAG], +m4_defn([_AC_SED_FRAG])dnl +[/^[ ]*@]_AC_Var[@[ ]*$/{ +r $]_AC_Var[ +d +} +])dnl +])dnl +# Remaining file output variables are in a fragment that also has non-file +# output varibles. -# AC_OUTPUT_COMMANDS_PRE -# ---------------------- -# A *variable* in which we append all the actions that must be -# performed before *creating* config.status. For a start, clean -# up all the LIBOBJ mess. -m4_define([AC_OUTPUT_COMMANDS_PRE], -[_AC_LIBOBJS_NORMALIZE() ]) +dnl +m4_define([_AC_SED_FRAG], [ +]m4_defn([_AC_SED_FRAG]))dnl +m4_foreach_w([_AC_Var], +m4_ifdef([_AC_SUBST_VARS], [m4_defn([_AC_SUBST_VARS]) ])[@END@], +[m4_if(_AC_SED_DELIM_NUM, 0, +[m4_if(_AC_Var, [@END@], +[dnl The whole of the last fragment would be the final deletion of `|#_!!_#|'. +m4_define([_AC_SED_CMDS], m4_defn([_AC_SED_CMDS])[| sed 's/|#_!!_#|//g' ])], +[ +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +])])dnl +m4_if(_AC_Var, [@END@], + [m4_if(m4_eval(_AC_SED_CMD_NUM + 2 <= _AC_SED_CMD_LIMIT), 1, + [m4_define([_AC_SED_FRAG], [ end]m4_defn([_AC_SED_FRAG]))])], +[m4_define([_AC_SED_CMD_NUM], m4_incr(_AC_SED_CMD_NUM))dnl +m4_define([_AC_SED_DELIM_NUM], m4_incr(_AC_SED_DELIM_NUM))dnl +_AC_Var!$_AC_Var$ac_delim +])dnl +m4_if(_AC_SED_CMD_LIMIT, + m4_if(_AC_Var, [@END@], m4_if(_AC_SED_CMD_NUM, 2, 2, _AC_SED_CMD_LIMIT), _AC_SED_CMD_NUM), +[_ACEOF + +dnl Do not use grep on conf$$subs.sed, since AIX grep has a line length limit. + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = _AC_SED_DELIM_NUM; then + break + elif $ac_last_try; then + AC_MSG_ERROR([could not make $CONFIG_STATUS]) + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +dnl Similarly, avoid grep here too. +ac_eof=`sed -n '/^CEOF[[0-9]]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi -# AC_CONFIG_COMMANDS_POST(CMDS) -# ----------------------------- -# Commands to run after config.status was created. Accumulates. -AC_DEFUN([AC_CONFIG_COMMANDS_POST], -[m4_append([AC_OUTPUT_COMMANDS_POST], [$1 -])]) +dnl Increment fragment number. +m4_define([_AC_SED_FRAG_NUM], m4_incr(_AC_SED_FRAG_NUM))dnl +dnl Record that this fragment will need to be used. +m4_define([_AC_SED_CMDS], +m4_defn([_AC_SED_CMDS])[| sed -f "$tmp/subs-]_AC_SED_FRAG_NUM[.sed" ])dnl +[cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-]_AC_SED_FRAG_NUM[.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b]m4_defn([_AC_SED_FRAG])dnl +[_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +]m4_if(_AC_Var, [@END@], +[m4_if(m4_eval(_AC_SED_CMD_NUM + 2 > _AC_SED_CMD_LIMIT), 1, +[m4_define([_AC_SED_CMDS], m4_defn([_AC_SED_CMDS])[| sed 's/|#_!!_#|//g' ])], +[[:end +s/|#_!!_#|//g +]])])dnl +CEOF$ac_eof +_ACEOF +m4_define([_AC_SED_FRAG], [ +])m4_define([_AC_SED_DELIM_NUM], 0)m4_define([_AC_SED_CMD_NUM], 2)dnl -# Initialize. -m4_define([AC_OUTPUT_COMMANDS_POST]) +])])dnl +dnl +m4_popdef([_AC_SED_FRAG_NUM])dnl +m4_popdef([_AC_SED_CMD_NUM])dnl +m4_popdef([_AC_SED_DELIM_NUM])dnl +m4_popdef([_AC_SED_FRAG])dnl +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub=['/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}'] +fi +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" -# _AC_OUTPUT_COMMANDS -# ------------------- -# This is a subroutine of AC_OUTPUT, in charge of issuing the code -# related to AC_CONFIG_COMMANDS. -# -# It has to send itself into $CONFIG_STATUS (eg, via here documents). -# Upon exit, no here document shall be opened. -m4_define([_AC_OUTPUT_COMMANDS], -[cat >>$CONFIG_STATUS <<\_ACEOF +])# _AC_OUTPUT_FILES_PREPARE + +# _AC_OUTPUT_FILE +# --------------- +# Do the variable substitutions to create the Makefiles or whatever. # -# CONFIG_COMMANDS section. +# This macro is expanded inside a here document. If the here document is +# closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF". # -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[[^:]]*:,,'` - ac_dir=`AS_DIRNAME(["$ac_dest"])` - AS_MKDIR_P(["$ac_dir"]) - _AC_SRCPATHS(["$ac_dir"]) +m4_define([_AC_OUTPUT_FILE], +[ + # + # CONFIG_FILE + # - AC_MSG_NOTICE([executing $ac_dest commands]) -dnl Some shells don't like empty case/esac -m4_ifset([AC_LIST_COMMANDS_COMMANDS], -[ case $ac_dest in -AC_LIST_COMMANDS_COMMANDS()dnl +AC_PROVIDE_IFELSE([AC_PROG_INSTALL], +[ case $INSTALL in + [[\\/$]]* | ?:[[\\/]]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ])dnl -done +AC_PROVIDE_IFELSE([AC_PROG_MKDIR_P], +[ ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [[\\/$]]* | ?:[[\\/]]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +])dnl +_ACEOF + +m4_ifndef([AC_DATAROOTDIR_CHECKED], +[cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +m4_define([_AC_datarootdir_vars], + [datadir, docdir, infodir, localedir, mandir]) +case `sed -n '/datarootdir/ { + p + q +} +m4_foreach([_AC_Var], m4_defn([_AC_datarootdir_vars]), + [/@_AC_Var@/p +])' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@[]m4_join([@*|*@], _AC_datarootdir_vars)@*) + AC_MSG_WARN([$ac_file_inputs seems to ignore the --datarootdir setting]) +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + m4_foreach([_AC_Var], m4_defn([_AC_datarootdir_vars]), + [s&@_AC_Var@&$_AC_Var&g + ])dnl + s&\\\${datarootdir}&$datarootdir&g' ;; +esac _ACEOF -])# _AC_OUTPUT_COMMANDS +])dnl + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +[/@[a-zA-Z_][a-zA-Z_0-9]*@/!b] +dnl configure_input is a somewhat special, so we don't call AC_SUBST_TRACE. +s&@configure_input@&$configure_input&;t t +dnl During the transition period, this is a special case: +s&@top_builddir@&$ac_top_builddir_sub&;t t[]AC_SUBST_TRACE([top_builddir]) +m4_foreach([_AC_Var], [srcdir, abs_srcdir, top_srcdir, abs_top_srcdir, + builddir, abs_builddir, + abs_top_builddir]AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [[, INSTALL]])AC_PROVIDE_IFELSE([AC_PROG_MKDIR_P], [[, MKDIR_P]]), + [s&@_AC_Var@&$ac_[]_AC_Var&;t t[]AC_SUBST_TRACE(_AC_Var) +])dnl +m4_ifndef([AC_DATAROOTDIR_CHECKED], [$ac_datarootdir_hack +])dnl +" $ac_file_inputs m4_defn([_AC_SED_CMDS])>$tmp/out + +m4_ifndef([AC_DATAROOTDIR_CHECKED], +[test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[[ ]]*datarootdir[[ ]]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + AC_MSG_WARN([$ac_file contains a reference to the variable `datarootdir' +which seems to be undefined. Please make sure it is defined.]) +])dnl + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac +dnl This would break Makefile dependencies: +dnl if diff $ac_file "$tmp/out" >/dev/null 2>&1; then +dnl echo "$ac_file is unchanged" +dnl else +dnl rm -f $ac_file; mv "$tmp/out" $ac_file +dnl fi +])# _AC_OUTPUT_FILE @@ -390,44 +585,12 @@ _ACEOF ## ----------------------- ## -# _AC_CONFIG_HEADER(HEADER, [COMMANDS]) -# ------------------------------------- -# See below. -m4_define([_AC_CONFIG_HEADER], -[_AC_CONFIG_UNIQUE([$1])dnl -m4_append([AC_LIST_HEADERS], [ $1])dnl -_AC_CONFIG_DEPENDENCIES([$1])dnl -dnl Register the commands -m4_ifval([$2], -[m4_append([AC_LIST_HEADERS_COMMANDS], -[ ]m4_bpatsubst([$1], [:.*])[ ) $2 ;; -])])dnl -]) - - # AC_CONFIG_HEADERS(HEADERS..., [COMMANDS], [INIT-CMDS]) # ------------------------------------------------------ # Specify that the HEADERS are to be created by instantiation of the -# AC_DEFINEs. Associate the COMMANDS to the HEADERS. This macro -# accumulates if called several times. +# AC_DEFINEs. # -# The commands are stored in a growing string AC_LIST_HEADERS_COMMANDS -# which should be used like this: -# -# case $ac_file in -# AC_LIST_HEADERS_COMMANDS -# esac -AC_DEFUN([AC_CONFIG_HEADERS], -[AC_FOREACH([AC_File], [$1], [_AC_CONFIG_HEADER(m4_defn([AC_File]), [$2])])dnl -_AC_CONFIG_COMMANDS_INIT([$3])dnl -ac_config_headers="$ac_config_headers m4_normalize([$1])" -]) - -# Initialize to empty. It is much easier and uniform to have a config -# list expand to empty when undefined, instead of special casing when -# not defined (since in this case, AC_CONFIG_FOO expands to AC_CONFIG_FOO). -m4_define([AC_LIST_HEADERS]) -m4_define([AC_LIST_HEADERS_COMMANDS]) +AC_DEFUN([AC_CONFIG_HEADERS], [_AC_CONFIG_FOOS([HEADERS], $@)]) # AC_CONFIG_HEADER(HEADER-TO-CREATE ...) @@ -437,248 +600,141 @@ AC_DEFUN([AC_CONFIG_HEADER], [AC_CONFIG_HEADERS([$1])]) -# _AC_OUTPUT_HEADERS -# ------------------ +# _AC_OUTPUT_HEADER +# ----------------- # # Output the code which instantiates the `config.h' files from their # `config.h.in'. # -# This is a subroutine of _AC_OUTPUT_CONFIG_STATUS. It has to send -# itself into $CONFIG_STATUS (eg, via here documents). Upon exit, no -# here document shall be opened. -# +# This macro is expanded inside a here document. If the here document is +# closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF". # -# The code produced used to be extremely costly: there are was a -# single sed script (n lines) handling both `#define' templates, -# `#undef' templates with trailing space, and `#undef' templates -# without trailing spaces. The full script was run on each of the m -# lines of `config.h.in', i.e., about n x m. -# -# Now there are two scripts: `conftest.defines' for the `#define' -# templates, and `conftest.undef' for the `#undef' templates. -# -# Optimization 1. It is incredibly costly to run two `#undef' -# scripts, so just remove trailing spaces first. Removes about a -# third of the cost. -# -# Optimization 2. Since `#define' are rare and obsoleted, -# `conftest.defines' is built and run only if grep says there are -# `#define'. Improves by at least a factor 2, since in addition we -# avoid the cost of *producing* the sed script. -# -# Optimization 3. In each script, first check that the current input -# line is a template. This avoids running the full sed script on -# empty lines and comments (divides the cost by about 3 since each -# template chunk is typically a comment, a template, an empty line). -# -# Optimization 4. Once a substitution performed, since there can be -# only one per line, immediately restart the script on the next input -# line (using the `t' sed instruction). Divides by about 2. -# *Note:* In the case of the AC_SUBST sed script (_AC_OUTPUT_FILES) -# this optimization cannot be applied as is, because there can be -# several substitutions per line. -# -# -# The result is about, hm, ... times blah... plus.... Ahem. The -# result is about much faster. -m4_define([_AC_OUTPUT_HEADERS], -[cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# 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. -dnl Double quote for the `[ ]' and `define'. -[ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t'] - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[[^:]]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[[^:]]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && AC_MSG_NOTICE([creating $ac_file]) - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [[\\/$]]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || AC_MSG_ERROR([cannot find input file: $f]) - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - AC_MSG_ERROR([cannot find input file: $f]) - fi;; - esac - done` || AS_EXIT([1]) - # Remove the trailing spaces. - sed 's/[[ ]]*$//' $ac_file_inputs >$tmp/in - +m4_define([_AC_OUTPUT_HEADER], +[ + # + # CONFIG_HEADER + # _ACEOF -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -dnl Double quote for `[ ]' and `define'. -[s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end] -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +dnl +dnl Quote, for `[ ]' and `define'. +[ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,'] +dnl ac_dD used to contain `;t' at the end, but that was both slow and incorrect. +dnl 1) Since the script must be broken into chunks containing 100 commands, +dnl the extra command meant extra calls to sed. +dnl 2) The code was incorrect: in the unusual case where a symbol has multiple +dnl different AC_DEFINEs, the last one should be honored. +dnl +dnl ac_dB works because every line has a space appended. ac_dD reinserts +dnl the space, because some symbol may have been AC_DEFINEd several times. +dnl +dnl The first use of ac_dA has a space prepended, so that the second +dnl use does not match the initial 's' of $ac_dA. +[ +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines +] +# Remove the space that was appended to ease matching. +# Then replace #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.undefs <<\_ACEOF -[s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,] -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep ["^[ ]*#[ ]*define"] $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +[s,^[ #]*u.*,/* & */,]' >>conftest.defines + +# Break up conftest.defines: +dnl If we cared only about not exceeding line count limits, we would use this: +dnl ac_max_sed_lines=m4_eval(_AC_SED_CMD_LIMIT - 3) +dnl But in practice this can generate scripts that contain too many bytes; +dnl and this can cause obscure 'sed' failures, e.g., +dnl http://lists.gnu.org/archive/html/bug-coreutils/2006-05/msg00127.html +dnl So instead, we use the following, which is about half the size we'd like: +ac_max_sed_lines=50 +dnl In the future, let's use awk or sh instead of sed to do substitutions, +dnl since we have so many problems with sed. + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo ['/^[ ]*#[ ]*define/!b'] >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + # Write a here document: + dnl Quote, for the `[ ]' and `define'. +[ cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF] + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo ['/^[ ]*#[ ]*undef/!b'] >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs +rm -f conftest.defines conftest.tail dnl Now back to your regularly scheduled config.status. +echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then AC_MSG_NOTICE([$ac_file is unchanged]) else - ac_dir=`AS_DIRNAME(["$ac_file"])` - AS_MKDIR_P(["$ac_dir"]) rm -f $ac_file - mv $tmp/config.h $ac_file + mv "$tmp/config.h" $ac_file fi else - cat $tmp/config.h - rm -f $tmp/config.h + echo "/* $configure_input */" + cat "$ac_result" fi + rm -f "$tmp/out[12]" dnl If running for Automake, be ready to perform additional dnl commands to set up the timestamp files. m4_ifdef([_AC_AM_CONFIG_HEADER_HOOK], [_AC_AM_CONFIG_HEADER_HOOK([$ac_file]) ])dnl -m4_ifset([AC_LIST_HEADERS_COMMANDS], -[ # Run the commands associated with the file. - case $ac_file in -AC_LIST_HEADERS_COMMANDS()dnl - esac -])dnl -done -_ACEOF -])# _AC_OUTPUT_HEADERS +])# _AC_OUTPUT_HEADER @@ -687,37 +743,14 @@ _ACEOF ## --------------------- ## -# _AC_CONFIG_LINK(DEST:SOURCE, [COMMANDS]) -# ---------------------------------------- -# See below. -m4_define([_AC_CONFIG_LINK], -[_AC_CONFIG_UNIQUE([$1])dnl -m4_append([AC_LIST_LINKS], [ $1])dnl -_AC_CONFIG_DEPENDENCIES([$1])dnl -m4_bmatch([$1], [^\.:\| \.:], [m4_fatal([$0: invalid destination: `.'])])dnl -dnl Register the commands -m4_ifval([$2], -[m4_append([AC_LIST_LINKS_COMMANDS], -[ ]m4_bpatsubst([$1], [:.*])[ ) $2 ;; -])])dnl -]) - # AC_CONFIG_LINKS(DEST:SOURCE..., [COMMANDS], [INIT-CMDS]) # -------------------------------------------------------- # Specify that config.status should establish a (symbolic if possible) # link from TOP_SRCDIR/SOURCE to TOP_SRCDIR/DEST. # Reject DEST=., because it is makes it hard for ./config.status # to guess the links to establish (`./config.status .'). -AC_DEFUN([AC_CONFIG_LINKS], -[AC_FOREACH([AC_File], [$1], [_AC_CONFIG_LINK(m4_defn([AC_File]), [$2])])dnl -_AC_CONFIG_COMMANDS_INIT([$3])dnl -ac_config_links="$ac_config_links m4_normalize([$1])" -]) - - -# Initialize the list. -m4_define([AC_LIST_LINKS]) -m4_define([AC_LIST_LINKS_COMMANDS]) +# +AC_DEFUN([AC_CONFIG_LINKS], [_AC_CONFIG_FOOS([LINKS], $@)]) # AC_LINK_FILES(SOURCE..., DEST...) @@ -733,10 +766,11 @@ m4_define([AC_LIST_LINKS_COMMANDS]) # interest in creating config links with literal values, no special # mechanism is implemented to handle them. # -# _AC_LINK_CNT is used to be robust to multiple calls. +# _AC_LINK_FILES_CNT is used to be robust to multiple calls. AU_DEFUN([AC_LINK_FILES], [m4_if($#, 2, , [m4_fatal([$0: incorrect number of arguments])])dnl +m4_define_default([_AC_LINK_FILES_CNT], 0)dnl m4_define([_AC_LINK_FILES_CNT], m4_incr(_AC_LINK_FILES_CNT))dnl ac_sources="$1" ac_dests="$2" @@ -747,305 +781,120 @@ while test -n "$ac_sources"; do done AC_CONFIG_LINKS($[ac_config_links_]_AC_LINK_FILES_CNT)dnl ], -[ - It is technically impossible to `autoupdate' cleanly from AC_LINK_FILES - to AC_CONFIG_FILES. `autoupdate' provides a functional but inelegant - update, you should probably tune the result yourself.])# AC_LINK_FILES +[It is technically impossible to `autoupdate' cleanly from AC_LINK_FILES +to AC_CONFIG_LINKS. `autoupdate' provides a functional but inelegant +update, you should probably tune the result yourself.])# AC_LINK_FILES -# Initialize. -AU_DEFUN([_AC_LINK_FILES_CNT], 0) - -# _AC_OUTPUT_LINKS -# ---------------- -# This is a subroutine of AC_OUTPUT. -# -# It has to send itself into $CONFIG_STATUS (eg, via here documents). -# Upon exit, no here document shall be opened. -m4_define([_AC_OUTPUT_LINKS], -[cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_LINKS section. -# - -dnl Here we use : instead of .. because if AC_LINK_FILES was used -dnl with empty parameters (as in gettext.m4), then we obtain here -dnl `:', which we want to skip. So let's keep a single exception: `:'. -for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[[^:]]*:,,'` +# _AC_OUTPUT_LINK +# --------------- +# This macro is expanded inside a here document. If the here document is +# closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF". +m4_define([_AC_OUTPUT_LINK], +[ + # + # CONFIG_LINK + # - AC_MSG_NOTICE([linking $srcdir/$ac_source to $ac_dest]) + AC_MSG_NOTICE([linking $srcdir/$ac_source to $ac_file]) - if test ! -r $srcdir/$ac_source; then + if test ! -r "$srcdir/$ac_source"; then AC_MSG_ERROR([$srcdir/$ac_source: file not found]) fi - rm -f $ac_dest - - # Make relative symlinks. - ac_dest_dir=`AS_DIRNAME(["$ac_dest"])` - AS_MKDIR_P(["$ac_dest_dir"]) - _AC_SRCPATHS(["$ac_dest_dir"]) + rm -f "$ac_file" + # Try a relative symlink, then a hard link, then a copy. case $srcdir in [[\\/$]]* | ?:[[\\/]]* ) ac_rel_source=$srcdir/$ac_source ;; - *) ac_rel_source=$ac_top_builddir$srcdir/$ac_source ;; + *) ac_rel_source=$ac_top_build_prefix$srcdir/$ac_source ;; esac + ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || + ln "$srcdir/$ac_source" "$ac_file" 2>/dev/null || + cp -p "$srcdir/$ac_source" "$ac_file" || + AC_MSG_ERROR([cannot link or copy $srcdir/$ac_source to $ac_file]) +])# _AC_OUTPUT_LINK - # Try a symlink, then a hard link, then a copy. - ln -s $ac_rel_source $ac_dest 2>/dev/null || - ln $srcdir/$ac_source $ac_dest 2>/dev/null || - cp -p $srcdir/$ac_source $ac_dest || - AC_MSG_ERROR([cannot link or copy $srcdir/$ac_source to $ac_dest]) -m4_ifset([AC_LIST_LINKS_COMMANDS], -[ # Run the commands associated with the file. - case $ac_file in -AC_LIST_LINKS_COMMANDS()dnl - esac -])dnl -done -_ACEOF -])# _AC_OUTPUT_LINKS +## ------------------------ ## +## Configuration commands. ## +## ------------------------ ## -## --------------------- ## -## Configuration files. ## -## --------------------- ## +# AC_CONFIG_COMMANDS(NAME...,[COMMANDS], [INIT-CMDS]) +# --------------------------------------------------- +# +# Specify additional commands to be run by config.status. This +# commands must be associated with a NAME, which should be thought +# as the name of a file the COMMANDS create. +# +AC_DEFUN([AC_CONFIG_COMMANDS], [_AC_CONFIG_FOOS([COMMANDS], $@)]) -# _AC_CONFIG_FILE(FILE..., [COMMANDS]) -# ------------------------------------ -# See below. -m4_define([_AC_CONFIG_FILE], -[_AC_CONFIG_UNIQUE([$1])dnl -m4_append([AC_LIST_FILES], [ $1])dnl -_AC_CONFIG_DEPENDENCIES([$1])dnl -dnl Register the commands. -m4_ifval([$2], -[m4_append([AC_LIST_FILES_COMMANDS], -[ ]m4_bpatsubst([$1], [:.*])[ ) $2 ;; -])])dnl -]) -# AC_CONFIG_FILES(FILE..., [COMMANDS], [INIT-CMDS]) -# ------------------------------------------------- -# Specify output files, as with AC_OUTPUT, i.e., files that are -# configured with AC_SUBST. Associate the COMMANDS to each FILE, -# i.e., when config.status creates FILE, run COMMANDS afterwards. +# AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) +# ----------------------------------------- # -# The commands are stored in a growing string AC_LIST_FILES_COMMANDS -# which should be used like this: +# Add additional commands for AC_OUTPUT to put into config.status. # -# case $ac_file in -# AC_LIST_FILES_COMMANDS -# esac -AC_DEFUN([AC_CONFIG_FILES], -[AC_FOREACH([AC_File], [$1], [_AC_CONFIG_FILE(m4_defn([AC_File]), [$2])])dnl -_AC_CONFIG_COMMANDS_INIT([$3])dnl -ac_config_files="$ac_config_files m4_normalize([$1])" +# This macro is an obsolete version of AC_CONFIG_COMMANDS. The only +# difficulty in mapping AC_OUTPUT_COMMANDS to AC_CONFIG_COMMANDS is +# to give a unique key. The scheme we have chosen is `default-1', +# `default-2' etc. for each call. +# +# Unfortunately this scheme is fragile: bad things might happen +# if you update an included file and configure.ac: you might have +# clashes :( On the other hand, I'd like to avoid weird keys (e.g., +# depending upon __file__ or the pid). +AU_DEFUN([AC_OUTPUT_COMMANDS], +[m4_define_default([_AC_OUTPUT_COMMANDS_CNT], 0)dnl +m4_define([_AC_OUTPUT_COMMANDS_CNT], m4_incr(_AC_OUTPUT_COMMANDS_CNT))dnl +dnl Double quoted since that was the case in the original macro. +AC_CONFIG_COMMANDS([default-]_AC_OUTPUT_COMMANDS_CNT, [[$1]], [[$2]])dnl ]) -# Initialize the lists. -m4_define([AC_LIST_FILES]) -m4_define([AC_LIST_FILES_COMMANDS]) - +# _AC_OUTPUT_COMMAND +# ------------------ +# This macro is expanded inside a here document. If the here document is +# closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF". +m4_define([_AC_OUTPUT_COMMAND], +[ AC_MSG_NOTICE([executing $ac_file commands]) +]) -# _AC_OUTPUT_FILES -# ---------------- -# Do the variable substitutions to create the Makefiles or whatever. -# This is a subroutine of AC_OUTPUT. -# -# It has to send itself into $CONFIG_STATUS (eg, via here documents). -# Upon exit, no here document shall be opened. -m4_define([_AC_OUTPUT_FILES], -[cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. -dnl Please, pay attention that this sed code depends a lot on the shape -dnl of the sed commands issued by AC_SUBST. So if you change one, change -dnl the other too. -[ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF] -dnl These here document variables are unquoted when configure runs -dnl but quoted when config.status runs, so variables are expanded once. -dnl Insert the sed substitutions of variables. -m4_ifdef([_AC_SUBST_VARS], - [AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), -[s,@AC_Var@,$AC_Var,;t t -])])dnl -m4_ifdef([_AC_SUBST_FILES], - [AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_FILES]), -[/@AC_Var@/r $AC_Var -s,@AC_Var@,,;t t -])])dnl -CEOF -_ACEOF +## -------------------------------------- ## +## Pre- and post-config.status commands. ## +## -------------------------------------- ## - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. -dnl One cannot portably go further than 100 commands because of HP-UX. -dnl Here, there are 2 cmd per line, and two cmd are added later. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo [':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b'] && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[[^:]]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[[^:]]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac +# AC_CONFIG_COMMANDS_PRE(CMDS) +# ---------------------------- +# Commands to run right before config.status is created. Accumulates. +AC_DEFUN([AC_CONFIG_COMMANDS_PRE], +[m4_append([AC_OUTPUT_COMMANDS_PRE], [$1 +])]) - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`AS_DIRNAME(["$ac_file"])` - AS_MKDIR_P(["$ac_dir"]) - _AC_SRCPATHS(["$ac_dir"]) -AC_PROVIDE_IFELSE([AC_PROG_INSTALL], -[ case $INSTALL in - [[\\/$]]* | ?:[[\\/]]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac -])dnl +# AC_OUTPUT_COMMANDS_PRE +# ---------------------- +# A *variable* in which we append all the actions that must be +# performed before *creating* config.status. For a start, clean +# up all the LIBOBJ mess. +m4_define([AC_OUTPUT_COMMANDS_PRE], +[_AC_LIBOBJS_NORMALIZE +]) - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [[\\/$]]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || AC_MSG_ERROR([cannot find input file: $f]) - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - AC_MSG_ERROR([cannot find input file: $f]) - fi;; - esac - done` || AS_EXIT([1]) - if test x"$ac_file" != x-; then - AC_MSG_NOTICE([creating $ac_file]) - rm -f "$ac_file" - fi -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -dnl Neutralize VPATH when `$srcdir' = `.'. - sed "$ac_vpsub -dnl Shell code in configure.ac might set extrasub. -dnl FIXME: do we really want to maintain this feature? -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -[/@[a-zA-Z_][a-zA-Z_0-9]*@/!b] -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [s,@INSTALL@,$ac_INSTALL,;t t -])dnl -dnl The parens around the eval prevent an "illegal io" in Ultrix sh. -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin -dnl This would break Makefile dependencies. -dnl if diff $ac_file $tmp/out >/dev/null 2>&1; then -dnl echo "$ac_file is unchanged" -dnl else -dnl rm -f $ac_file -dnl mv $tmp/out $ac_file -dnl fi - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi +# AC_CONFIG_COMMANDS_POST(CMDS) +# ----------------------------- +# Commands to run after config.status was created. Accumulates. +AC_DEFUN([AC_CONFIG_COMMANDS_POST], +[m4_append([AC_OUTPUT_COMMANDS_POST], [$1 +])]) -m4_ifset([AC_LIST_FILES_COMMANDS], -[ # Run the commands associated with the file. - case $ac_file in -AC_LIST_FILES_COMMANDS()dnl - esac -])dnl -done -_ACEOF -])# _AC_OUTPUT_FILES +# Initialize. +m4_define([AC_OUTPUT_COMMANDS_POST]) @@ -1057,29 +906,28 @@ _ACEOF # AC_CONFIG_SUBDIRS(DIR ...) # -------------------------- # We define two variables: -# - ac_subdirs_all -# is built in the `default' section, and should contain *all* -# the arguments of AC_CONFIG_SUBDIRS. It is used for --help=recursive. +# - _AC_LIST_SUBDIRS +# A statically built list, should contain *all* the arguments of +# AC_CONFIG_SUBDIRS. The final value is assigned to ac_subdirs_all in +# the `default' section, and used for --help=recursive. +# It is also used in _AC_CONFIG_UNIQUE. # It makes no sense for arguments which are sh variables. # - subdirs -# which is built at runtime, so some of these dirs might not be +# Shell variable built at runtime, so some of these dirs might not be # included, if for instance the user refused a part of the tree. # This is used in _AC_OUTPUT_SUBDIRS. -# _AC_LIST_SUBDIRS is used only for _AC_CONFIG_UNIQUE. AC_DEFUN([AC_CONFIG_SUBDIRS], -[_AC_CONFIG_UNIQUE([$1])dnl -AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -m4_append([_AC_LIST_SUBDIRS], [ $1])dnl +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +m4_foreach_w([_AC_Sub], [$1], + [_AC_CONFIG_UNIQUE([SUBDIRS], + m4_bpatsubst(m4_defn([_AC_Sub]), [:.*]))])dnl +m4_append([_AC_LIST_SUBDIRS], [$1], [ +])dnl AS_LITERAL_IF([$1], [], - [AC_DIAGNOSE(syntax, [$0: you should use literals])]) -m4_divert_text([DEFAULTS], - [ac_subdirs_all="$ac_subdirs_all m4_normalize([$1])"]) -AC_SUBST(subdirs, "$subdirs $1")dnl + [AC_DIAGNOSE([syntax], [$0: you should use literals])])dnl +AC_SUBST([subdirs], ["$subdirs m4_normalize([$1])"])dnl ]) -# Initialize the list. -m4_define([_AC_LIST_SUBDIRS]) - # _AC_OUTPUT_SUBDIRS # ------------------ @@ -1095,7 +943,10 @@ if test "$no_recursion" != yes; then # Remove --cache-file and --srcdir arguments so they do not pile up. ac_sub_configure_args= ac_prev= - for ac_arg in $ac_configure_args; do + eval "set x $ac_configure_args" + shift + for ac_arg + do if test -n "$ac_prev"; then ac_prev= continue @@ -1118,34 +969,50 @@ if test "$no_recursion" != yes; then ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; - *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + *) + case $ac_arg in + *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. - ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args" + ac_arg="--prefix=$prefix" + case $ac_arg in + *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" + + # Pass --silent + if test "$silent" = yes; then + ac_sub_configure_args="--silent $ac_sub_configure_args" + fi ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. - test -d $srcdir/$ac_dir || continue + test -d "$srcdir/$ac_dir" || continue - AC_MSG_NOTICE([configuring in $ac_dir]) + ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" + _AS_ECHO_LOG([$ac_msg]) + _AS_ECHO([$ac_msg]) AS_MKDIR_P(["$ac_dir"]) - _AC_SRCPATHS(["$ac_dir"]) + _AC_SRCDIRS(["$ac_dir"]) - cd $ac_dir + cd "$ac_dir" # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'" - elif test -f $ac_srcdir/configure; then - ac_sub_configure="$SHELL '$ac_srcdir/configure'" - elif test -f $ac_srcdir/configure.in; then - ac_sub_configure=$ac_configure + if test -f "$ac_srcdir/configure.gnu"; then + ac_sub_configure=$ac_srcdir/configure.gnu + elif test -f "$ac_srcdir/configure"; then + ac_sub_configure=$ac_srcdir/configure + elif test -f "$ac_srcdir/configure.in"; then + # This should be Cygnus configure. + ac_sub_configure=$ac_aux_dir/configure else AC_MSG_WARN([no configuration information is in $ac_dir]) ac_sub_configure= @@ -1156,14 +1023,14 @@ if test "$no_recursion" != yes; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;; - *) # Relative path. - ac_sub_cache_file=$ac_top_builddir$cache_file ;; + *) # Relative name. + ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac - AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir]) + AC_MSG_NOTICE([running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir]) # The eval makes quoting arguments work. - eval $ac_sub_configure $ac_sub_configure_args \ - --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir || + eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ + --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir]) fi @@ -1180,8 +1047,8 @@ fi ## -------------------------- ## -# autoupdate::AC_OUTPUT([CONFIG_FILES...], [EXTRA-CMDS], [INIT-CMDS]) -# ------------------------------------------------------------------- +# AU::AC_OUTPUT([CONFIG_FILES...], [EXTRA-CMDS], [INIT-CMDS]) +# ----------------------------------------------------------- # # If there are arguments given to AC_OUTPUT, dispatch them to the # proper modern macros. @@ -1189,7 +1056,7 @@ AU_DEFUN([AC_OUTPUT], [m4_ifvaln([$1], [AC_CONFIG_FILES([$1])])dnl m4_ifvaln([$2$3], - [AC_CONFIG_COMMANDS(default, [[$2]], [[$3]])])dnl + [AC_CONFIG_COMMANDS(default, [$2], [$3])])dnl [AC_OUTPUT]]) @@ -1197,15 +1064,13 @@ m4_ifvaln([$2$3], # ------------------------------------------------------- # The big finish. # Produce config.status, config.h, and links; and configure subdirs. -# The CONFIG_HEADERS are defined in the m4 variable AC_LIST_HEADERS. -# Pay special attention not to have too long here docs: some old -# shells die. Unfortunately the limit is not known precisely... +# m4_define([AC_OUTPUT], [dnl Dispatch the extra arguments to their native macros. -m4_ifval([$1], - [AC_CONFIG_FILES([$1])])dnl -m4_ifval([$2$3], - [AC_CONFIG_COMMANDS(default, [$2], [$3])])dnl +m4_ifvaln([$1], + [AC_CONFIG_FILES([$1])])dnl +m4_ifvaln([$2$3], + [AC_CONFIG_COMMANDS(default, [$2], [$3])])dnl m4_ifval([$1$2$3], [AC_DIAGNOSE([obsolete], [$0 should be used without arguments. @@ -1216,22 +1081,7 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub=['/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}'] -fi - -m4_ifset([AC_LIST_HEADERS], [DEFS=-DHAVE_CONFIG_H], [AC_OUTPUT_MAKE_DEFS()]) +m4_ifdef([_AC_SEEN_CONFIG(HEADERS)], [DEFS=-DHAVE_CONFIG_H], [AC_OUTPUT_MAKE_DEFS()]) dnl Commands to run before creating config.status. AC_OUTPUT_COMMANDS_PRE()dnl @@ -1277,6 +1127,8 @@ AC_PROVIDE_IFELSE([AC_CONFIG_SUBDIRS], [_AC_OUTPUT_SUBDIRS()])dnl # shells die. Unfortunately the limit is not known precisely... m4_define([_AC_OUTPUT_CONFIG_STATUS], [AC_MSG_NOTICE([creating $CONFIG_STATUS]) +dnl AS_MESSAGE_LOG_FD is not available yet: +m4_rename([AS_MESSAGE_LOG_FD], [_AC_save_AS_MESSAGE_LOG_FD])dnl cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. @@ -1298,16 +1150,10 @@ dnl of configure, not config.status. _AS_PREPARE exec AS_MESSAGE_FD>&1 -# Open the log real soon, to keep \$[0] and so on meaningful, and to +# Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD -cat >&AS_MESSAGE_LOG_FD <<_CSEOF - +# values after options handling. +ac_log=" This file was extended by m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])dnl $as_me[]m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]), which was generated by m4_PACKAGE_STRING. Invocation command line was @@ -1318,30 +1164,29 @@ generated by m4_PACKAGE_STRING. Invocation command line was CONFIG_COMMANDS = $CONFIG_COMMANDS $ $[0] $[@] -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&AS_MESSAGE_LOG_FD -echo >&AS_MESSAGE_LOG_FD +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + _ACEOF +cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi +m4_ifdef([_AC_SEEN_CONFIG(FILES)], +[config_files="$ac_config_files" +])dnl +m4_ifdef([_AC_SEEN_CONFIG(HEADERS)], +[config_headers="$ac_config_headers" +])dnl +m4_ifdef([_AC_SEEN_CONFIG(LINKS)], +[config_links="$ac_config_links" +])dnl +m4_ifdef([_AC_SEEN_CONFIG(COMMANDS)], +[config_commands="$ac_config_commands" +])dnl -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi +_ACEOF cat >>$CONFIG_STATUS <<\_ACEOF - ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. @@ -1349,57 +1194,60 @@ current configuration. Usage: $[0] [[OPTIONS]] [[FILE]]... -h, --help print this help, then exit - -V, --version print version number, then exit + -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions -m4_ifset([AC_LIST_FILES], +m4_ifdef([_AC_SEEN_CONFIG(FILES)], [[ --file=FILE[:TEMPLATE] instantiate the configuration file FILE ]])dnl -m4_ifset([AC_LIST_HEADERS], +m4_ifdef([_AC_SEEN_CONFIG(HEADERS)], [[ --header=FILE[:TEMPLATE] instantiate the configuration header FILE ]])dnl -m4_ifset([AC_LIST_FILES], +m4_ifdef([_AC_SEEN_CONFIG(FILES)], [Configuration files: $config_files ])dnl -m4_ifset([AC_LIST_HEADERS], +m4_ifdef([_AC_SEEN_CONFIG(HEADERS)], [Configuration headers: $config_headers ])dnl -m4_ifset([AC_LIST_LINKS], +m4_ifdef([_AC_SEEN_CONFIG(LINKS)], [Configuration links: $config_links ])dnl -m4_ifset([AC_LIST_COMMANDS], +m4_ifdef([_AC_SEEN_CONFIG(COMMANDS)], [Configuration commands: $config_commands ])dnl Report bugs to ." -_ACEOF +_ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.status[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING, - with options \\"`echo "$ac_configure_args" | sed 's/[[\\""\`\$]]/\\\\&/g'`\\" + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[[\\""\`\$]]/\\\\&/g'`\\" -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir + +ac_pwd='$ac_pwd' +srcdir='$srcdir' AC_PROVIDE_IFELSE([AC_PROG_INSTALL], -[dnl Leave those double quotes here: this $INSTALL is evaluated in a -dnl here document, which might result in `INSTALL=/bin/install -c'. -INSTALL="$INSTALL" +[INSTALL='$INSTALL' +])dnl +AC_PROVIDE_IFELSE([AC_PROG_MKDIR_P], +[MKDIR_P='$MKDIR_P' ])dnl _ACEOF @@ -1411,45 +1259,43 @@ while test $[#] != 0 do case $[1] in --*=*) - ac_option=`expr "x$[1]" : 'x\([[^=]]*\)='` - ac_optarg=`expr "x$[1]" : 'x[[^=]]*=\(.*\)'` + ac_option=`expr "X$[1]" : 'X\([[^=]]*\)='` + ac_optarg=`expr "X$[1]" : 'X[[^=]]*=\(.*\)'` ac_shift=: ;; - -*) + *) ac_option=$[1] ac_optarg=$[2] ac_shift=shift ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$[1] - ac_need_defaults=false;; esac case $ac_option in # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - AC_MSG_ERROR([ambiguous option: $[1] -Try `$[0] --help' for more information.]);; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) debug=: ;; +m4_ifdef([_AC_SEEN_CONFIG(FILES)], [dnl --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; +])dnl +m4_ifdef([_AC_SEEN_CONFIG(HEADERS)], [dnl --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + AC_MSG_ERROR([ambiguous option: $[1] +Try `$[0] --help' for more information.]);; +], [ --he | --h |])dnl + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -1458,7 +1304,8 @@ Try `$[0] --help' for more information.]);; -*) AC_MSG_ERROR([unrecognized option: $[1] Try `$[0] --help' for more information.]) ;; - *) ac_config_targets="$ac_config_targets $[1]" ;; + *) ac_config_targets="$ac_config_targets $[1]" + ac_need_defaults=false ;; esac shift @@ -1473,94 +1320,181 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF +dnl Check this before opening the log, to avoid a bug on MinGW, +dnl which prohibits the recursive instance from truncating an open log. if \$ac_cs_recheck; then - echo "running $SHELL $[0] " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&AS_MESSAGE_FD - exec $SHELL $[0] $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + echo "running CONFIG_SHELL=$SHELL $SHELL $[0] "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&AS_MESSAGE_FD + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$[0]"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +dnl Open the log: +m4_rename([_AC_save_AS_MESSAGE_LOG_FD], [AS_MESSAGE_LOG_FD])dnl +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) + echo "$ac_log" +} >&AS_MESSAGE_LOG_FD -dnl We output the INIT-CMDS first for obvious reasons :) -m4_ifset([_AC_OUTPUT_COMMANDS_INIT], -[cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS section. +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +m4_ifdef([_AC_OUTPUT_COMMANDS_INIT], +[# +# INIT-COMMANDS # +_AC_OUTPUT_COMMANDS_INIT +])dnl +_ACEOF -_AC_OUTPUT_COMMANDS_INIT() -_ACEOF]) - - -dnl Issue this section only if there were actually config files. -dnl This checks if one of AC_LIST_HEADERS, AC_LIST_FILES, AC_LIST_COMMANDS, -dnl or AC_LIST_LINKS is set. -m4_ifval(AC_LIST_HEADERS()AC_LIST_LINKS()AC_LIST_FILES()AC_LIST_COMMANDS(), -[ cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. for ac_config_target in $ac_config_targets do - case "$ac_config_target" in - # Handling of arguments. -AC_FOREACH([AC_File], AC_LIST_FILES, -[ "m4_bpatsubst(AC_File, [:.*])" )dnl - CONFIG_FILES="$CONFIG_FILES AC_File" ;; -])dnl -AC_FOREACH([AC_File], AC_LIST_LINKS, -[ "m4_bpatsubst(AC_File, [:.*])" )dnl - CONFIG_LINKS="$CONFIG_LINKS AC_File" ;; -])dnl -AC_FOREACH([AC_File], AC_LIST_COMMANDS, -[ "m4_bpatsubst(AC_File, [:.*])" )dnl - CONFIG_COMMANDS="$CONFIG_COMMANDS AC_File" ;; -])dnl -AC_FOREACH([AC_File], AC_LIST_HEADERS, -[ "m4_bpatsubst(AC_File, [:.*])" )dnl - CONFIG_HEADERS="$CONFIG_HEADERS AC_File" ;; -])dnl + case $ac_config_target in +m4_ifdef([_AC_LIST_TAGS], [_AC_LIST_TAGS]) *) AC_MSG_ERROR([invalid argument: $ac_config_target]);; esac done +m4_ifdef([_AC_SEEN_CONFIG(ANY)], [_AC_OUTPUT_MAIN_LOOP])[]dnl + +AS_EXIT(0) +_ACEOF +chmod +x $CONFIG_STATUS +])# _AC_OUTPUT_CONFIG_STATUS + +# _AC_OUTPUT_MAIN_LOOP +# -------------------- +# The main loop in $CONFIG_STATUS. +# +# This macro is expanded inside a here document. If the here document is +# closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF". +# +AC_DEFUN([_AC_OUTPUT_MAIN_LOOP], +[ # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then -m4_ifset([AC_LIST_FILES], +m4_ifdef([_AC_SEEN_CONFIG(FILES)], [ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files ])dnl -m4_ifset([AC_LIST_HEADERS], +m4_ifdef([_AC_SEEN_CONFIG(HEADERS)], [ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers ])dnl -m4_ifset([AC_LIST_LINKS], +m4_ifdef([_AC_SEEN_CONFIG(LINKS)], [ test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links ])dnl -m4_ifset([AC_LIST_COMMANDS], +m4_ifdef([_AC_SEEN_CONFIG(COMMANDS)], [ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands ])dnl fi # Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, +# simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. -AS_TMPDIR([confstat], [.]) +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'AS_EXIT([1])' 1 2 13 15 +} +dnl The comment above AS_TMPDIR says at most 4 chars are allowed. +AS_TMPDIR([conf], [.]) + +m4_ifdef([_AC_SEEN_CONFIG(FILES)], [_AC_OUTPUT_FILES_PREPARE])[]dnl + +for ac_tag in[]dnl + m4_ifdef([_AC_SEEN_CONFIG(FILES)], [:F $CONFIG_FILES])[]dnl + m4_ifdef([_AC_SEEN_CONFIG(HEADERS)], [:H $CONFIG_HEADERS])[]dnl + m4_ifdef([_AC_SEEN_CONFIG(LINKS)], [:L $CONFIG_LINKS])[]dnl + m4_ifdef([_AC_SEEN_CONFIG(COMMANDS)], [:C $CONFIG_COMMANDS]) +do + case $ac_tag in + :[[FHLC]]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[[FHL]]*:*);; + :L* | :C*:*) AC_MSG_ERROR([Invalid tag $ac_tag.]);; + :[[FH]]-) ac_tag=-:-;; + :[[FH]]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$[1] + shift -_ACEOF -])[]dnl m4_ifval + case $ac_mode in + :L) ac_source=$[1];; + :[[FH]]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [[\\/$]]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + AC_MSG_ERROR([cannot find input file: $ac_f]);; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $[*] | sed ['s|^[^:]*/||;s|:[^:]*/|, |g']`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + AC_MSG_NOTICE([creating $ac_file]) + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac -dnl The following four sections are in charge of their own here -dnl documenting into $CONFIG_STATUS. -m4_ifset([AC_LIST_FILES], [_AC_OUTPUT_FILES()])dnl -m4_ifset([AC_LIST_HEADERS], [_AC_OUTPUT_HEADERS()])dnl -m4_ifset([AC_LIST_LINKS], [_AC_OUTPUT_LINKS()])dnl -m4_ifset([AC_LIST_COMMANDS], [_AC_OUTPUT_COMMANDS()])dnl + ac_dir=`AS_DIRNAME(["$ac_file"])` + AS_MKDIR_P(["$ac_dir"]) + _AC_SRCDIRS(["$ac_dir"]) -cat >>$CONFIG_STATUS <<\_ACEOF + case $ac_mode in + m4_ifdef([_AC_SEEN_CONFIG(FILES)], [:F)_AC_OUTPUT_FILE ;;]) + m4_ifdef([_AC_SEEN_CONFIG(HEADERS)], [:H)_AC_OUTPUT_HEADER ;;]) + m4_ifdef([_AC_SEEN_CONFIG(LINKS)], [:L)_AC_OUTPUT_LINK ;;]) + m4_ifdef([_AC_SEEN_CONFIG(COMMANDS)], [:C)_AC_OUTPUT_COMMAND ;;]) + esac -AS_EXIT(0) -_ACEOF -chmod +x $CONFIG_STATUS -])# _AC_OUTPUT_CONFIG_STATUS +dnl Some shells don't like empty case/esac +m4_ifdef([_AC_LIST_TAG_COMMANDS], [ + case $ac_file$ac_mode in +_AC_LIST_TAG_COMMANDS + esac +])dnl +done # for ac_tag + +])# _AC_OUTPUT_MAIN_LOOP # AC_OUTPUT_MAKE_DEFS @@ -1568,37 +1502,35 @@ chmod +x $CONFIG_STATUS # Set the DEFS variable to the -D options determined earlier. # This is a subroutine of AC_OUTPUT. # It is called inside configure, outside of config.status. -# Using a here document instead of a string reduces the quoting nightmare. m4_define([AC_OUTPUT_MAKE_DEFS], [[# Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that -# take arguments), then we branch to the quote section. Otherwise, +# take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF +ac_script=' t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote -d -: quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g -s,\[,\\&,g -s,\],\\&,g -s,\$,$$,g -p -_ACEOF -# We use echo to avoid assuming a particular line-breaking character. -# The extra dot is to prevent the shell from consuming trailing -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` ]])# AC_OUTPUT_MAKE_DEFS -- 2.47.2