The main difference is that the former requires AC_LANG_COMPILER.
* aclang (AC_LANG_PREPROC, AC_LANG_PREPROC(C), AC_LANG_PREPROC(C++))
(AC_LANG_PREPROC(Fortran 77), AC_LANG_PREPROC_REQUIRE): New
macros. Issue a warning when looking for the Fortran 77
preprocessor instead of an error.
(AC_LANG_COMPILER): Check that it is run before the corresponding
AC_LANG_PREPROC.
(AC_PROG_C
(AC_LANG_COMPILER_REQUIRE): Don't call directly
AC_LANG_COMPILER(_AC_LANG), rather invoke AC_LANG_COMPILER so that
the generic code in AC_LANG_COMPILER is run.
(AC_REQUIRE_CPP): Use AC_LANG_PREPROC_REQUIRE.
(AC_PROG_CC, AC_PROG_CXX): Don't require being run before the
corresponding AC_LANG_PREPROC: AC_LANG_COMPILER does it.
Propagate AC_LANG_PREPROC_REQUIRE.
* acgeneral.m4 (AC_TRY_CPP, AC_EGREP_CPP): Use it instead of
AC_REQUIRE_CPP.
* acspecific.m4 (_AC_DECL_YYTEXT, AC_PATH_X): Don't
AC_REQUIRE_CPP, inner macro will do it.
* aclang.m4 (AC_PROG_GCC_TRADITIONAL, AC_C_STRINGIZE)
(AC_C_PROTOTYPES): Likewise.
(AC_C_STRINGIZE): Yeeks! The body of AC_CACHE_CHECK was not
quoted. Use @%:@ do assist Emacs.
For some reason (don't ask), this revamping revealed that
AC_PROG_CC_STDC, because of the `break', does not clean its tmp
files.
* aclang.m4 (AC_PROG_CC_STDC): Extract the creation of conftest.c
out of AC_COMPILE_IFELSE.
Be sure to clean the tmp files.
+2000-11-14 Akim Demaille <akim@epita.fr>
+
+ Set AC_LANG_PREPROC_REQUIRE which replaces AC_REQUIRE_CPP.
+ The main difference is that the former requires AC_LANG_COMPILER.
+
+ * aclang (AC_LANG_PREPROC, AC_LANG_PREPROC(C), AC_LANG_PREPROC(C++))
+ (AC_LANG_PREPROC(Fortran 77), AC_LANG_PREPROC_REQUIRE): New
+ macros. Issue a warning when looking for the Fortran 77
+ preprocessor instead of an error.
+ (AC_LANG_COMPILER): Check that it is run before the corresponding
+ AC_LANG_PREPROC.
+ (AC_PROG_C
+ (AC_LANG_COMPILER_REQUIRE): Don't call directly
+ AC_LANG_COMPILER(_AC_LANG), rather invoke AC_LANG_COMPILER so that
+ the generic code in AC_LANG_COMPILER is run.
+ (AC_REQUIRE_CPP): Use AC_LANG_PREPROC_REQUIRE.
+ (AC_PROG_CC, AC_PROG_CXX): Don't require being run before the
+ corresponding AC_LANG_PREPROC: AC_LANG_COMPILER does it.
+
+
+ Propagate AC_LANG_PREPROC_REQUIRE.
+
+ * acgeneral.m4 (AC_TRY_CPP, AC_EGREP_CPP): Use it instead of
+ AC_REQUIRE_CPP.
+ * acspecific.m4 (_AC_DECL_YYTEXT, AC_PATH_X): Don't
+ AC_REQUIRE_CPP, inner macro will do it.
+ * aclang.m4 (AC_PROG_GCC_TRADITIONAL, AC_C_STRINGIZE)
+ (AC_C_PROTOTYPES): Likewise.
+ (AC_C_STRINGIZE): Yeeks! The body of AC_CACHE_CHECK was not
+ quoted. Use @%:@ do assist Emacs.
+
+
+ For some reason (don't ask), this revamping revealed that
+ AC_PROG_CC_STDC, because of the `break', does not clean its tmp
+ files.
+
+ * aclang.m4 (AC_PROG_CC_STDC): Extract the creation of conftest.c
+ out of AC_COMPILE_IFELSE.
+ Be sure to clean the tmp files.
+
2000-11-14 Akim Demaille <akim@epita.fr>
* tests/m4sh.at (AS_DIRNAME & AS_DIRNAME_SED): Simplify.
#
# INCLUDES are not defaulted.
AC_DEFUN([AC_TRY_CPP],
-[AC_REQUIRE_CPP()dnl
+[AC_LANG_PREPROC_REQUIRE()dnl
AC_LANG_CONFTEST([AC_LANG_SOURCE([[$1]])])
_AC_TRY_CPP()
if test -z "$ac_cpp_err"; then
# Because this macro is used by AC_PROG_GCC_TRADITIONAL, which must
# come early, it is not included in AC_BEFORE checks.
AC_DEFUN([AC_EGREP_CPP],
-[AC_REQUIRE_CPP()dnl
+[AC_LANG_PREPROC_REQUIRE()dnl
AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
dnl eval is necessary to expand ac_cpp.
dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
# This file is part of Autoconf. -*- Autoconf -*-
# Programming languages support.
-# Copyright 1992, 93, 94, 95, 96, 98, 99, 2000
+# Copyright 2000
# Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# AC_LANG_COMPILER
# ----------------
-# Find a compiler for the current LANG. Note that because we might
-# AC_REQUIRE `AC_LANG_COMPILER(C)' for instance, the latter must be
-# AC_DEFUN'd, not just define'd.
+# Find a compiler for the current LANG. Be sure to be run before
+# AC_LANG_PREPROC.
+#
+# Note that because we might AC_REQUIRE `AC_LANG_COMPILER(C)' for
+# instance, the latter must be AC_DEFUN'd, not just define'd.
m4_define([AC_LANG_COMPILER],
-[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+[AC_BEFORE([AC_LANG_COMPILER(]_AC_LANG[)],
+ [AC_LANG_PREPROC(]_AC_LANG[)])dnl
+_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
# AC_LANG_COMPILER_REQUIRE
# Ensure we have a compiler for the current LANG.
AC_DEFUN([AC_LANG_COMPILER_REQUIRE],
[_AC_REQUIRE([AC_LANG_COMPILER(]_AC_LANG[)],
- [m4_indir([AC_LANG_COMPILER(]_AC_LANG[)])])])
-
-
-# AC_REQUIRE_CPP
-# --------------
-# Require finding the C or C++ preprocessor, whichever is the
-# current language.
-AC_DEFUN([AC_REQUIRE_CPP],
-[AC_LANG_CASE(C, [AC_REQUIRE([AC_PROG_CPP])],
- C++, [AC_REQUIRE([AC_PROG_CXXCPP])],
- [AC_FATAL([No preprocessor defined for ]_AC_LANG)])])
+ [AC_LANG_COMPILER])])
# _AC_LANG_COMPILER_WORKS
])])# _AC_LANG_COMPILER_GNU
+# AC_LANG_PREPROC
+# ---------------
+# Find a preprocessor for the current language. Note that because we
+# might AC_REQUIRE `AC_LANG_PREPROC(C)' for instance, the latter must
+# be AC_DEFUN'd, not just define'd. Since the preprocessor depends
+# upon the compiler, look for the compiler.
+m4_define([AC_LANG_PREPROC],
+[AC_LANG_COMPILER_REQUIRE()dnl
+_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+
+# AC_LANG_PREPROC_REQUIRE
+# -----------------------
+# Ensure we have a preprocessor for the current language.
+AC_DEFUN([AC_LANG_PREPROC_REQUIRE],
+[_AC_REQUIRE([AC_LANG_PREPROC(]_AC_LANG[)],
+ [AC_LANG_PREPROC])])
+
+
+# AC_REQUIRE_CPP
+# --------------
+# Require the preprocessor for the current language.
+# FIXME: AU_ALIAS once AC_LANG is officially documented (2.51?).
+AC_DEFUN([AC_REQUIRE_CPP],
+[AC_LANG_PREPROC_REQUIRE])
+
+
# AC_NO_EXECUTABLES
# -----------------
# -------------------- #
+# AC_LANG_PREPROC(C)
+# -------------------
+# Find the C preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(C)],
+[AC_REQUIRE([AC_PROG_CPP])])
+
+
# _AC_PROG_PREPROC_WORKS
# ----------------------
# Check if $ac_cpp is a working preprocessor that can flag absent
# This just gives the user an opportunity to specify an alternative
# search list for the C compiler.
AC_DEFUN([AC_PROG_CC],
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_LANG_PUSH(C)
+[AC_LANG_PUSH(C)
AC_ARG_VAR([CC], [C compiler command])
AC_ARG_VAR([CFLAGS], [C compiler flags])
ifval([$1],
# AC_PROG_GCC_TRADITIONAL
# -----------------------
AC_DEFUN([AC_PROG_GCC_TRADITIONAL],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_CPP])dnl
-if test $ac_cv_c_compiler_gnu = yes; then
+[if test $ac_cv_c_compiler_gnu = yes; then
AC_CACHE_CHECK(whether ${CC-cc} needs -traditional,
ac_cv_prog_gcc_traditional,
[ ac_pattern="Autoconf.*'x'"
# ---------------------- #
+# AC_LANG_PREPROC(C++)
+# ---------------------
+# Find the C++ preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(C++)],
+[AC_REQUIRE([AC_PROG_CXXCPP])])
+
+
# AC_PROG_CXXCPP
# --------------
# Find a working C++ preprocessor
# xlC_r AIX C Set++ (with support for reentrant code)
# xlC AIX C Set++
AC_DEFUN([AC_PROG_CXX],
-[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
-AC_LANG_PUSH(C++)
+[AC_LANG_PUSH(C++)
AC_ARG_VAR([CXX], [C++ compiler command])
AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])
AC_CHECK_TOOLS(CXX,
# ----------------------------- #
+# AC_LANG_PREPROC(Fortran 77)
+# ---------------------------
+# Find the Fortran 77 preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(Fortran 77)],
+[m4_warn([syntax],
+ [$0: No preprocessor defined for ]_AC_LANG)])
+
+
# AC_LANG_COMPILER(Fortran 77)
# ----------------------------
# Find the Fortran 77 compiler. Must be AC_DEFUN'd to be
AC_CACHE_VAL(ac_cv_prog_cc_stdc,
[ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
-# 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__"
-do
- CC="$ac_save_CC $ac_arg"
- AC_COMPILE_IFELSE(
-[AC_LANG_PROGRAM(
+AC_LANG_CONFTEST([AC_LANG_PROGRAM(
[[#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
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];]])],
- [ac_cv_prog_cc_stdc=$ac_arg; break])
+[[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__"
+do
+ CC="$ac_save_CC $ac_arg"
+ AC_COMPILE_IFELSE([],
+ [ac_cv_prog_cc_stdc=$ac_arg
+rm -f conftest.$ac_ext conftest.$ac_objext
+break])
done
CC=$ac_save_CC
])
# Checks if `#' can be used to glue strings together at the CPP level.
# Defines HAVE_STRINGIZE if positive.
AC_DEFUN([AC_C_STRINGIZE],
-[AC_REQUIRE([AC_PROG_CPP])dnl
-AC_MSG_CHECKING([for preprocessor stringizing operator])
-AC_CACHE_VAL(ac_cv_c_stringize,
-AC_EGREP_CPP([#teststring],[
-#define x(y) #y
-
-char *s = x(teststring);
-], ac_cv_c_stringize=no, ac_cv_c_stringize=yes))
+[AC_CACHE_CHECK([for preprocessor stringizing operator],
+ [ac_cv_c_stringize],
+[AC_EGREP_CPP([@%:@teststring],
+ [@%:@define x(y) #y
+
+char *s = x(teststring);],
+ [ac_cv_c_stringize=no],
+ [ac_cv_c_stringize=yes])])
if test "${ac_cv_c_stringize}" = yes; then
AC_DEFINE(HAVE_STRINGIZE, 1,
- [Define if cpp supports the ANSI # stringizing operator.])
+ [Define if cpp supports the ANSI @%:@ stringizing operator.])
fi
-AC_MSG_RESULT([${ac_cv_c_stringize}])
])# AC_C_STRINGIZE
# options.
AC_DEFUN([AC_C_PROTOTYPES],
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
-AC_REQUIRE([AC_PROG_CPP])dnl
AC_MSG_CHECKING([for function prototypes])
if test "$ac_cv_prog_cc_stdc" != no; then
AC_MSG_RESULT([yes])
# ---------------
# Check if lex declares yytext as a char * by default, not a char[].
m4_define([_AC_DECL_YYTEXT],
-[AC_REQUIRE_CPP()dnl
-AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root,
+[AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root,
[# The minimal lex program is just a single line: %%. But some broken lexes
# (Solaris, I think it was) want two %% lines, so accommodate them.
echo '%%
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
AC_DEFUN([AC_PATH_X],
-[AC_REQUIRE_CPP()dnl Set CPP; we run _AC_PATH_X_DIRECT conditionally.
-dnl Document the X abnormal options inherited from history.
+[dnl Document the X abnormal options inherited from history.
AC_DIVERT_ONCE([HELP_BEGIN], [
X features:
--x-includes=DIR X include files are in DIR
# This file is part of Autoconf. -*- Autoconf -*-
# Programming languages support.
-# Copyright 1992, 93, 94, 95, 96, 98, 99, 2000
+# Copyright 2000
# Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# AC_LANG_COMPILER
# ----------------
-# Find a compiler for the current LANG. Note that because we might
-# AC_REQUIRE `AC_LANG_COMPILER(C)' for instance, the latter must be
-# AC_DEFUN'd, not just define'd.
+# Find a compiler for the current LANG. Be sure to be run before
+# AC_LANG_PREPROC.
+#
+# Note that because we might AC_REQUIRE `AC_LANG_COMPILER(C)' for
+# instance, the latter must be AC_DEFUN'd, not just define'd.
m4_define([AC_LANG_COMPILER],
-[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+[AC_BEFORE([AC_LANG_COMPILER(]_AC_LANG[)],
+ [AC_LANG_PREPROC(]_AC_LANG[)])dnl
+_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
# AC_LANG_COMPILER_REQUIRE
# Ensure we have a compiler for the current LANG.
AC_DEFUN([AC_LANG_COMPILER_REQUIRE],
[_AC_REQUIRE([AC_LANG_COMPILER(]_AC_LANG[)],
- [m4_indir([AC_LANG_COMPILER(]_AC_LANG[)])])])
-
-
-# AC_REQUIRE_CPP
-# --------------
-# Require finding the C or C++ preprocessor, whichever is the
-# current language.
-AC_DEFUN([AC_REQUIRE_CPP],
-[AC_LANG_CASE(C, [AC_REQUIRE([AC_PROG_CPP])],
- C++, [AC_REQUIRE([AC_PROG_CXXCPP])],
- [AC_FATAL([No preprocessor defined for ]_AC_LANG)])])
+ [AC_LANG_COMPILER])])
# _AC_LANG_COMPILER_WORKS
])])# _AC_LANG_COMPILER_GNU
+# AC_LANG_PREPROC
+# ---------------
+# Find a preprocessor for the current language. Note that because we
+# might AC_REQUIRE `AC_LANG_PREPROC(C)' for instance, the latter must
+# be AC_DEFUN'd, not just define'd. Since the preprocessor depends
+# upon the compiler, look for the compiler.
+m4_define([AC_LANG_PREPROC],
+[AC_LANG_COMPILER_REQUIRE()dnl
+_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+
+# AC_LANG_PREPROC_REQUIRE
+# -----------------------
+# Ensure we have a preprocessor for the current language.
+AC_DEFUN([AC_LANG_PREPROC_REQUIRE],
+[_AC_REQUIRE([AC_LANG_PREPROC(]_AC_LANG[)],
+ [AC_LANG_PREPROC])])
+
+
+# AC_REQUIRE_CPP
+# --------------
+# Require the preprocessor for the current language.
+# FIXME: AU_ALIAS once AC_LANG is officially documented (2.51?).
+AC_DEFUN([AC_REQUIRE_CPP],
+[AC_LANG_PREPROC_REQUIRE])
+
+
# AC_NO_EXECUTABLES
# -----------------
# -------------------- #
+# AC_LANG_PREPROC(C)
+# -------------------
+# Find the C preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(C)],
+[AC_REQUIRE([AC_PROG_CPP])])
+
+
# _AC_PROG_PREPROC_WORKS
# ----------------------
# Check if $ac_cpp is a working preprocessor that can flag absent
# This just gives the user an opportunity to specify an alternative
# search list for the C compiler.
AC_DEFUN([AC_PROG_CC],
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_LANG_PUSH(C)
+[AC_LANG_PUSH(C)
AC_ARG_VAR([CC], [C compiler command])
AC_ARG_VAR([CFLAGS], [C compiler flags])
ifval([$1],
# AC_PROG_GCC_TRADITIONAL
# -----------------------
AC_DEFUN([AC_PROG_GCC_TRADITIONAL],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_CPP])dnl
-if test $ac_cv_c_compiler_gnu = yes; then
+[if test $ac_cv_c_compiler_gnu = yes; then
AC_CACHE_CHECK(whether ${CC-cc} needs -traditional,
ac_cv_prog_gcc_traditional,
[ ac_pattern="Autoconf.*'x'"
# ---------------------- #
+# AC_LANG_PREPROC(C++)
+# ---------------------
+# Find the C++ preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(C++)],
+[AC_REQUIRE([AC_PROG_CXXCPP])])
+
+
# AC_PROG_CXXCPP
# --------------
# Find a working C++ preprocessor
# xlC_r AIX C Set++ (with support for reentrant code)
# xlC AIX C Set++
AC_DEFUN([AC_PROG_CXX],
-[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
-AC_LANG_PUSH(C++)
+[AC_LANG_PUSH(C++)
AC_ARG_VAR([CXX], [C++ compiler command])
AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])
AC_CHECK_TOOLS(CXX,
# ----------------------------- #
+# AC_LANG_PREPROC(Fortran 77)
+# ---------------------------
+# Find the Fortran 77 preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(Fortran 77)],
+[m4_warn([syntax],
+ [$0: No preprocessor defined for ]_AC_LANG)])
+
+
# AC_LANG_COMPILER(Fortran 77)
# ----------------------------
# Find the Fortran 77 compiler. Must be AC_DEFUN'd to be
AC_CACHE_VAL(ac_cv_prog_cc_stdc,
[ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
-# 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__"
-do
- CC="$ac_save_CC $ac_arg"
- AC_COMPILE_IFELSE(
-[AC_LANG_PROGRAM(
+AC_LANG_CONFTEST([AC_LANG_PROGRAM(
[[#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
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];]])],
- [ac_cv_prog_cc_stdc=$ac_arg; break])
+[[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__"
+do
+ CC="$ac_save_CC $ac_arg"
+ AC_COMPILE_IFELSE([],
+ [ac_cv_prog_cc_stdc=$ac_arg
+rm -f conftest.$ac_ext conftest.$ac_objext
+break])
done
CC=$ac_save_CC
])
# Checks if `#' can be used to glue strings together at the CPP level.
# Defines HAVE_STRINGIZE if positive.
AC_DEFUN([AC_C_STRINGIZE],
-[AC_REQUIRE([AC_PROG_CPP])dnl
-AC_MSG_CHECKING([for preprocessor stringizing operator])
-AC_CACHE_VAL(ac_cv_c_stringize,
-AC_EGREP_CPP([#teststring],[
-#define x(y) #y
-
-char *s = x(teststring);
-], ac_cv_c_stringize=no, ac_cv_c_stringize=yes))
+[AC_CACHE_CHECK([for preprocessor stringizing operator],
+ [ac_cv_c_stringize],
+[AC_EGREP_CPP([@%:@teststring],
+ [@%:@define x(y) #y
+
+char *s = x(teststring);],
+ [ac_cv_c_stringize=no],
+ [ac_cv_c_stringize=yes])])
if test "${ac_cv_c_stringize}" = yes; then
AC_DEFINE(HAVE_STRINGIZE, 1,
- [Define if cpp supports the ANSI # stringizing operator.])
+ [Define if cpp supports the ANSI @%:@ stringizing operator.])
fi
-AC_MSG_RESULT([${ac_cv_c_stringize}])
])# AC_C_STRINGIZE
# options.
AC_DEFUN([AC_C_PROTOTYPES],
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
-AC_REQUIRE([AC_PROG_CPP])dnl
AC_MSG_CHECKING([for function prototypes])
if test "$ac_cv_prog_cc_stdc" != no; then
AC_MSG_RESULT([yes])
# This file is part of Autoconf. -*- Autoconf -*-
# Programming languages support.
-# Copyright 1992, 93, 94, 95, 96, 98, 99, 2000
+# Copyright 2000
# Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# AC_LANG_COMPILER
# ----------------
-# Find a compiler for the current LANG. Note that because we might
-# AC_REQUIRE `AC_LANG_COMPILER(C)' for instance, the latter must be
-# AC_DEFUN'd, not just define'd.
+# Find a compiler for the current LANG. Be sure to be run before
+# AC_LANG_PREPROC.
+#
+# Note that because we might AC_REQUIRE `AC_LANG_COMPILER(C)' for
+# instance, the latter must be AC_DEFUN'd, not just define'd.
m4_define([AC_LANG_COMPILER],
-[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+[AC_BEFORE([AC_LANG_COMPILER(]_AC_LANG[)],
+ [AC_LANG_PREPROC(]_AC_LANG[)])dnl
+_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
# AC_LANG_COMPILER_REQUIRE
# Ensure we have a compiler for the current LANG.
AC_DEFUN([AC_LANG_COMPILER_REQUIRE],
[_AC_REQUIRE([AC_LANG_COMPILER(]_AC_LANG[)],
- [m4_indir([AC_LANG_COMPILER(]_AC_LANG[)])])])
-
-
-# AC_REQUIRE_CPP
-# --------------
-# Require finding the C or C++ preprocessor, whichever is the
-# current language.
-AC_DEFUN([AC_REQUIRE_CPP],
-[AC_LANG_CASE(C, [AC_REQUIRE([AC_PROG_CPP])],
- C++, [AC_REQUIRE([AC_PROG_CXXCPP])],
- [AC_FATAL([No preprocessor defined for ]_AC_LANG)])])
+ [AC_LANG_COMPILER])])
# _AC_LANG_COMPILER_WORKS
])])# _AC_LANG_COMPILER_GNU
+# AC_LANG_PREPROC
+# ---------------
+# Find a preprocessor for the current language. Note that because we
+# might AC_REQUIRE `AC_LANG_PREPROC(C)' for instance, the latter must
+# be AC_DEFUN'd, not just define'd. Since the preprocessor depends
+# upon the compiler, look for the compiler.
+m4_define([AC_LANG_PREPROC],
+[AC_LANG_COMPILER_REQUIRE()dnl
+_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+
+# AC_LANG_PREPROC_REQUIRE
+# -----------------------
+# Ensure we have a preprocessor for the current language.
+AC_DEFUN([AC_LANG_PREPROC_REQUIRE],
+[_AC_REQUIRE([AC_LANG_PREPROC(]_AC_LANG[)],
+ [AC_LANG_PREPROC])])
+
+
+# AC_REQUIRE_CPP
+# --------------
+# Require the preprocessor for the current language.
+# FIXME: AU_ALIAS once AC_LANG is officially documented (2.51?).
+AC_DEFUN([AC_REQUIRE_CPP],
+[AC_LANG_PREPROC_REQUIRE])
+
+
# AC_NO_EXECUTABLES
# -----------------
# -------------------- #
+# AC_LANG_PREPROC(C)
+# -------------------
+# Find the C preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(C)],
+[AC_REQUIRE([AC_PROG_CPP])])
+
+
# _AC_PROG_PREPROC_WORKS
# ----------------------
# Check if $ac_cpp is a working preprocessor that can flag absent
# This just gives the user an opportunity to specify an alternative
# search list for the C compiler.
AC_DEFUN([AC_PROG_CC],
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_LANG_PUSH(C)
+[AC_LANG_PUSH(C)
AC_ARG_VAR([CC], [C compiler command])
AC_ARG_VAR([CFLAGS], [C compiler flags])
ifval([$1],
# AC_PROG_GCC_TRADITIONAL
# -----------------------
AC_DEFUN([AC_PROG_GCC_TRADITIONAL],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_CPP])dnl
-if test $ac_cv_c_compiler_gnu = yes; then
+[if test $ac_cv_c_compiler_gnu = yes; then
AC_CACHE_CHECK(whether ${CC-cc} needs -traditional,
ac_cv_prog_gcc_traditional,
[ ac_pattern="Autoconf.*'x'"
# ---------------------- #
+# AC_LANG_PREPROC(C++)
+# ---------------------
+# Find the C++ preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(C++)],
+[AC_REQUIRE([AC_PROG_CXXCPP])])
+
+
# AC_PROG_CXXCPP
# --------------
# Find a working C++ preprocessor
# xlC_r AIX C Set++ (with support for reentrant code)
# xlC AIX C Set++
AC_DEFUN([AC_PROG_CXX],
-[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
-AC_LANG_PUSH(C++)
+[AC_LANG_PUSH(C++)
AC_ARG_VAR([CXX], [C++ compiler command])
AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])
AC_CHECK_TOOLS(CXX,
# ----------------------------- #
+# AC_LANG_PREPROC(Fortran 77)
+# ---------------------------
+# Find the Fortran 77 preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(Fortran 77)],
+[m4_warn([syntax],
+ [$0: No preprocessor defined for ]_AC_LANG)])
+
+
# AC_LANG_COMPILER(Fortran 77)
# ----------------------------
# Find the Fortran 77 compiler. Must be AC_DEFUN'd to be
AC_CACHE_VAL(ac_cv_prog_cc_stdc,
[ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
-# 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__"
-do
- CC="$ac_save_CC $ac_arg"
- AC_COMPILE_IFELSE(
-[AC_LANG_PROGRAM(
+AC_LANG_CONFTEST([AC_LANG_PROGRAM(
[[#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
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];]])],
- [ac_cv_prog_cc_stdc=$ac_arg; break])
+[[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__"
+do
+ CC="$ac_save_CC $ac_arg"
+ AC_COMPILE_IFELSE([],
+ [ac_cv_prog_cc_stdc=$ac_arg
+rm -f conftest.$ac_ext conftest.$ac_objext
+break])
done
CC=$ac_save_CC
])
# Checks if `#' can be used to glue strings together at the CPP level.
# Defines HAVE_STRINGIZE if positive.
AC_DEFUN([AC_C_STRINGIZE],
-[AC_REQUIRE([AC_PROG_CPP])dnl
-AC_MSG_CHECKING([for preprocessor stringizing operator])
-AC_CACHE_VAL(ac_cv_c_stringize,
-AC_EGREP_CPP([#teststring],[
-#define x(y) #y
-
-char *s = x(teststring);
-], ac_cv_c_stringize=no, ac_cv_c_stringize=yes))
+[AC_CACHE_CHECK([for preprocessor stringizing operator],
+ [ac_cv_c_stringize],
+[AC_EGREP_CPP([@%:@teststring],
+ [@%:@define x(y) #y
+
+char *s = x(teststring);],
+ [ac_cv_c_stringize=no],
+ [ac_cv_c_stringize=yes])])
if test "${ac_cv_c_stringize}" = yes; then
AC_DEFINE(HAVE_STRINGIZE, 1,
- [Define if cpp supports the ANSI # stringizing operator.])
+ [Define if cpp supports the ANSI @%:@ stringizing operator.])
fi
-AC_MSG_RESULT([${ac_cv_c_stringize}])
])# AC_C_STRINGIZE
# options.
AC_DEFUN([AC_C_PROTOTYPES],
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
-AC_REQUIRE([AC_PROG_CPP])dnl
AC_MSG_CHECKING([for function prototypes])
if test "$ac_cv_prog_cc_stdc" != no; then
AC_MSG_RESULT([yes])
#
# INCLUDES are not defaulted.
AC_DEFUN([AC_TRY_CPP],
-[AC_REQUIRE_CPP()dnl
+[AC_LANG_PREPROC_REQUIRE()dnl
AC_LANG_CONFTEST([AC_LANG_SOURCE([[$1]])])
_AC_TRY_CPP()
if test -z "$ac_cpp_err"; then
# Because this macro is used by AC_PROG_GCC_TRADITIONAL, which must
# come early, it is not included in AC_BEFORE checks.
AC_DEFUN([AC_EGREP_CPP],
-[AC_REQUIRE_CPP()dnl
+[AC_LANG_PREPROC_REQUIRE()dnl
AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
dnl eval is necessary to expand ac_cpp.
dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
# This file is part of Autoconf. -*- Autoconf -*-
# Programming languages support.
-# Copyright 1992, 93, 94, 95, 96, 98, 99, 2000
+# Copyright 2000
# Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# AC_LANG_COMPILER
# ----------------
-# Find a compiler for the current LANG. Note that because we might
-# AC_REQUIRE `AC_LANG_COMPILER(C)' for instance, the latter must be
-# AC_DEFUN'd, not just define'd.
+# Find a compiler for the current LANG. Be sure to be run before
+# AC_LANG_PREPROC.
+#
+# Note that because we might AC_REQUIRE `AC_LANG_COMPILER(C)' for
+# instance, the latter must be AC_DEFUN'd, not just define'd.
m4_define([AC_LANG_COMPILER],
-[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+[AC_BEFORE([AC_LANG_COMPILER(]_AC_LANG[)],
+ [AC_LANG_PREPROC(]_AC_LANG[)])dnl
+_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
# AC_LANG_COMPILER_REQUIRE
# Ensure we have a compiler for the current LANG.
AC_DEFUN([AC_LANG_COMPILER_REQUIRE],
[_AC_REQUIRE([AC_LANG_COMPILER(]_AC_LANG[)],
- [m4_indir([AC_LANG_COMPILER(]_AC_LANG[)])])])
-
-
-# AC_REQUIRE_CPP
-# --------------
-# Require finding the C or C++ preprocessor, whichever is the
-# current language.
-AC_DEFUN([AC_REQUIRE_CPP],
-[AC_LANG_CASE(C, [AC_REQUIRE([AC_PROG_CPP])],
- C++, [AC_REQUIRE([AC_PROG_CXXCPP])],
- [AC_FATAL([No preprocessor defined for ]_AC_LANG)])])
+ [AC_LANG_COMPILER])])
# _AC_LANG_COMPILER_WORKS
])])# _AC_LANG_COMPILER_GNU
+# AC_LANG_PREPROC
+# ---------------
+# Find a preprocessor for the current language. Note that because we
+# might AC_REQUIRE `AC_LANG_PREPROC(C)' for instance, the latter must
+# be AC_DEFUN'd, not just define'd. Since the preprocessor depends
+# upon the compiler, look for the compiler.
+m4_define([AC_LANG_PREPROC],
+[AC_LANG_COMPILER_REQUIRE()dnl
+_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+
+# AC_LANG_PREPROC_REQUIRE
+# -----------------------
+# Ensure we have a preprocessor for the current language.
+AC_DEFUN([AC_LANG_PREPROC_REQUIRE],
+[_AC_REQUIRE([AC_LANG_PREPROC(]_AC_LANG[)],
+ [AC_LANG_PREPROC])])
+
+
+# AC_REQUIRE_CPP
+# --------------
+# Require the preprocessor for the current language.
+# FIXME: AU_ALIAS once AC_LANG is officially documented (2.51?).
+AC_DEFUN([AC_REQUIRE_CPP],
+[AC_LANG_PREPROC_REQUIRE])
+
+
# AC_NO_EXECUTABLES
# -----------------
# -------------------- #
+# AC_LANG_PREPROC(C)
+# -------------------
+# Find the C preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(C)],
+[AC_REQUIRE([AC_PROG_CPP])])
+
+
# _AC_PROG_PREPROC_WORKS
# ----------------------
# Check if $ac_cpp is a working preprocessor that can flag absent
# This just gives the user an opportunity to specify an alternative
# search list for the C compiler.
AC_DEFUN([AC_PROG_CC],
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_LANG_PUSH(C)
+[AC_LANG_PUSH(C)
AC_ARG_VAR([CC], [C compiler command])
AC_ARG_VAR([CFLAGS], [C compiler flags])
ifval([$1],
# AC_PROG_GCC_TRADITIONAL
# -----------------------
AC_DEFUN([AC_PROG_GCC_TRADITIONAL],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_CPP])dnl
-if test $ac_cv_c_compiler_gnu = yes; then
+[if test $ac_cv_c_compiler_gnu = yes; then
AC_CACHE_CHECK(whether ${CC-cc} needs -traditional,
ac_cv_prog_gcc_traditional,
[ ac_pattern="Autoconf.*'x'"
# ---------------------- #
+# AC_LANG_PREPROC(C++)
+# ---------------------
+# Find the C++ preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(C++)],
+[AC_REQUIRE([AC_PROG_CXXCPP])])
+
+
# AC_PROG_CXXCPP
# --------------
# Find a working C++ preprocessor
# xlC_r AIX C Set++ (with support for reentrant code)
# xlC AIX C Set++
AC_DEFUN([AC_PROG_CXX],
-[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
-AC_LANG_PUSH(C++)
+[AC_LANG_PUSH(C++)
AC_ARG_VAR([CXX], [C++ compiler command])
AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])
AC_CHECK_TOOLS(CXX,
# ----------------------------- #
+# AC_LANG_PREPROC(Fortran 77)
+# ---------------------------
+# Find the Fortran 77 preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(Fortran 77)],
+[m4_warn([syntax],
+ [$0: No preprocessor defined for ]_AC_LANG)])
+
+
# AC_LANG_COMPILER(Fortran 77)
# ----------------------------
# Find the Fortran 77 compiler. Must be AC_DEFUN'd to be
AC_CACHE_VAL(ac_cv_prog_cc_stdc,
[ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
-# 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__"
-do
- CC="$ac_save_CC $ac_arg"
- AC_COMPILE_IFELSE(
-[AC_LANG_PROGRAM(
+AC_LANG_CONFTEST([AC_LANG_PROGRAM(
[[#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
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];]])],
- [ac_cv_prog_cc_stdc=$ac_arg; break])
+[[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__"
+do
+ CC="$ac_save_CC $ac_arg"
+ AC_COMPILE_IFELSE([],
+ [ac_cv_prog_cc_stdc=$ac_arg
+rm -f conftest.$ac_ext conftest.$ac_objext
+break])
done
CC=$ac_save_CC
])
# Checks if `#' can be used to glue strings together at the CPP level.
# Defines HAVE_STRINGIZE if positive.
AC_DEFUN([AC_C_STRINGIZE],
-[AC_REQUIRE([AC_PROG_CPP])dnl
-AC_MSG_CHECKING([for preprocessor stringizing operator])
-AC_CACHE_VAL(ac_cv_c_stringize,
-AC_EGREP_CPP([#teststring],[
-#define x(y) #y
-
-char *s = x(teststring);
-], ac_cv_c_stringize=no, ac_cv_c_stringize=yes))
+[AC_CACHE_CHECK([for preprocessor stringizing operator],
+ [ac_cv_c_stringize],
+[AC_EGREP_CPP([@%:@teststring],
+ [@%:@define x(y) #y
+
+char *s = x(teststring);],
+ [ac_cv_c_stringize=no],
+ [ac_cv_c_stringize=yes])])
if test "${ac_cv_c_stringize}" = yes; then
AC_DEFINE(HAVE_STRINGIZE, 1,
- [Define if cpp supports the ANSI # stringizing operator.])
+ [Define if cpp supports the ANSI @%:@ stringizing operator.])
fi
-AC_MSG_RESULT([${ac_cv_c_stringize}])
])# AC_C_STRINGIZE
# options.
AC_DEFUN([AC_C_PROTOTYPES],
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
-AC_REQUIRE([AC_PROG_CPP])dnl
AC_MSG_CHECKING([for function prototypes])
if test "$ac_cv_prog_cc_stdc" != no; then
AC_MSG_RESULT([yes])
# ---------------
# Check if lex declares yytext as a char * by default, not a char[].
m4_define([_AC_DECL_YYTEXT],
-[AC_REQUIRE_CPP()dnl
-AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root,
+[AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root,
[# The minimal lex program is just a single line: %%. But some broken lexes
# (Solaris, I think it was) want two %% lines, so accommodate them.
echo '%%
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
AC_DEFUN([AC_PATH_X],
-[AC_REQUIRE_CPP()dnl Set CPP; we run _AC_PATH_X_DIRECT conditionally.
-dnl Document the X abnormal options inherited from history.
+[dnl Document the X abnormal options inherited from history.
AC_DIVERT_ONCE([HELP_BEGIN], [
X features:
--x-includes=DIR X include files are in DIR