autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

16-ac-lang-preproc-require.patch


From: Akim Demaille
Subject: 16-ac-lang-preproc-require.patch
Date: 12 Nov 2000 15:55:42 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        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.

Index: acgeneral.m4
--- acgeneral.m4 Sun, 12 Nov 2000 10:51:06 +0100 akim (ace/27_acgeneral. 
1.169.8.90 644)
+++ acgeneral.m4 Sun, 12 Nov 2000 11:47:23 +0100 akim (ace/27_acgeneral. 
1.169.8.90 644)
@@ -2799,7 +2799,7 @@ AC_DEFUN([_AC_TRY_CPP],
 #
 # 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
@@ -2820,7 +2820,7 @@ AC_DEFUN([AC_TRY_CPP],
 # 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.
Index: aclang.m4
--- aclang.m4 Sat, 11 Nov 2000 18:31:28 +0100 akim (ace/b/32_aclang.m4 1.5.3.47 
644)
+++ aclang.m4 Sun, 12 Nov 2000 12:33:44 +0100 akim (ace/b/32_aclang.m4 1.5.3.47 
644)
@@ -1,6 +1,6 @@
 # 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
@@ -493,11 +493,15 @@ m4_define([AC_LANG_CALL(Fortran 77)],

 # 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
@@ -505,17 +509,7 @@ m4_define([AC_LANG_COMPILER],
 # 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
@@ -561,6 +555,33 @@ m4_define([_AC_LANG_COMPILER_GNU],
 ])])# _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
 # -----------------
@@ -600,6 +621,13 @@ m4_define([AC_LINK_IFELSE],
 # -------------------- #


+# AC_LANG_PREPROC(C)
+# -------------------
+# Find the C compiler.  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
@@ -693,8 +721,7 @@ AC_DEFUN([AC_LANG_COMPILER(C)],
 # 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],
@@ -756,9 +783,7 @@ m4_define([_AC_PROG_CC_G],
 # 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'"
@@ -835,6 +860,13 @@ AC_DEFUN([AC_PROG_CC_C_O],
 # ---------------------- #


+# AC_LANG_PREPROC(C++)
+# ---------------------
+# Find the C compiler.  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
@@ -894,8 +926,7 @@ AC_DEFUN([AC_LANG_COMPILER(C++)],
 # 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,
@@ -950,6 +981,14 @@ m4_define([_AC_PROG_CXX_G],
 # ----------------------------- #


+# AC_LANG_PREPROC(Fortran 77)
+# ---------------------------
+# Find the C compiler.  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
@@ -1095,18 +1134,7 @@ AC_DEFUN([AC_PROG_CC_STDC],
 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>
@@ -1135,8 +1163,21 @@ AC_DEFUN([AC_PROG_CC_STDC],
 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
 ])
@@ -1366,19 +1407,18 @@ AC_DEFUN([AC_C_VOLATILE],
 # 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(address@hidden:@teststring],
+              address@hidden:@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


@@ -1388,7 +1428,6 @@ AC_DEFUN([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)
Index: acspecific.m4
--- acspecific.m4 Sat, 11 Nov 2000 18:44:22 +0100 akim (ace/25_acspecific 1.110 
644)
+++ acspecific.m4 Sun, 12 Nov 2000 11:48:35 +0100 akim (ace/25_acspecific 1.110 
644)
@@ -145,8 +145,7 @@ AC_DEFUN_ONCE([AC_PROG_LEX],
 # ---------------
 # 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 '%%
@@ -849,8 +848,7 @@ AC_DEFUN([AC_SYS_POSIX_TERMIOS],
 # 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]