autoconf-patches
[Top][All Lists]
Advanced

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

ac-var-2-as-var.patch


From: akim
Subject: ac-var-2-as-var.patch
Date: Sun, 3 Jun 2001 11:10:06 +0200
User-agent: Mutt/1.3.18i

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        
        * acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
        (AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
        (AC_TR_SH): Move as...
        * m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
        (AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
        (AS_TR_SH): these.
        (_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
        (_AS_TR_SH_PREPARE): New.
        (AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
        * tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
        
Index: acfunctions.m4
--- acfunctions.m4 Mon, 19 Feb 2001 23:50:41 +0100 akim (ace/b/37_acfunction 
1.18 644)
+++ acfunctions.m4 Sun, 03 Jun 2001 10:23:59 +0200 akim (ace/b/37_acfunction 
1.18 644)
@@ -64,13 +64,13 @@
 # AC_CHECK_FUNC(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 # -----------------------------------------------------------------
 AC_DEFUN([AC_CHECK_FUNC],
-[AC_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl
+[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])],
-                [AC_VAR_SET(ac_var, yes)],
-                [AC_VAR_SET(ac_var, no)])])
-AS_IF([test AC_VAR_GET(ac_var) = yes], [$2], [$3])dnl
-AC_VAR_POPDEF([ac_var])dnl
+                [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
 
 
@@ -78,12 +78,12 @@ AC_DEFUN([AC_CHECK_FUNC],
 # ---------------------------------------------------------------------
 AC_DEFUN([AC_CHECK_FUNCS],
 [AC_FOREACH([AC_Func], [$1],
-  [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Func),
+  [AH_TEMPLATE(AS_TR_CPP(HAVE_[]AC_Func),
                [Define if you have the `]AC_Func[' function.])])dnl
 for ac_func in $1
 do
 AC_CHECK_FUNC($ac_func,
-              [AC_DEFINE_UNQUOTED([AC_TR_CPP([HAVE_$ac_func])]) $2],
+              [AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$ac_func])]) $2],
               [$3])dnl
 done
 ])
@@ -1207,7 +1207,7 @@ m4_define([_AC_FUNC_STAT],
             [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(AC_TR_CPP([HAVE_$1_EMPTY_STRING_BUG]), 1,
+  AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1_EMPTY_STRING_BUG]), 1,
                      [Define if `$1' has the bug that it succeeds when
                       given the zero-length file name argument.])
 fi
Index: acgeneral.m4
--- acgeneral.m4 Sun, 25 Feb 2001 10:04:51 +0100 akim (ace/27_acgeneral. 
1.169.8.132 644)
+++ acgeneral.m4 Sun, 03 Jun 2001 10:23:59 +0200 akim (ace/27_acgeneral. 
1.169.8.132 644)
@@ -319,142 +319,6 @@ m4_define([_AH_COUNTER], [0])
 
 
 
-## --------------------------------------------------- ##
-## Common m4/sh handling of variables (indirections).  ##
-## --------------------------------------------------- ##
-
-
-# The purpose of this section is to provide a uniform API for
-# reading/setting sh variables with or without indirection.
-# Typically, one can write
-#   AC_VAR_SET(var, val)
-# or
-#   AC_VAR_SET(ac_$var, val)
-# and expect the right thing to happen.
-
-
-# AC_VAR_SET(VARIABLE, VALUE)
-# ---------------------------
-# Set the VALUE of the shell VARIABLE.
-# If the variable contains indirections (e.g. `ac_cv_func_$ac_func')
-# perform whenever possible at m4 level, otherwise sh level.
-m4_define([AC_VAR_SET],
-[AS_LITERAL_IF([$1],
-               [$1=$2],
-               [eval "$1=$2"])])
-
-
-# AC_VAR_GET(VARIABLE)
-# --------------------
-# Get the value of the shell VARIABLE.
-# Evaluates to $VARIABLE if there are no indirection in VARIABLE,
-# else into the appropriate `eval' sequence.
-m4_define([AC_VAR_GET],
-[AS_LITERAL_IF([$1],
-               [$[]$1],
-               [`eval echo '${'m4_patsubst($1, [[\\`]], [\\\&])'}'`])])
-
-
-# AC_VAR_TEST_SET(VARIABLE)
-# -------------------------
-# Expands into the `test' expression which is true if VARIABLE
-# is set.  Polymorphic.  Should be dnl'ed.
-m4_define([AC_VAR_TEST_SET],
-[AS_LITERAL_IF([$1],
-               [test "${$1+set}" = set],
-               [eval "test \"\${$1+set}\" = set"])])
-
-
-# AC_VAR_SET_IFELSE(VARIABLE, IF-TRUE, IF-FALSE)
-# ----------------------------------------------
-# Implement a shell `if-then-else' depending whether VARIABLE is set
-# or not.  Polymorphic.
-m4_define([AC_VAR_SET_IFELSE],
-[AS_IF([AC_VAR_TEST_SET([$1])], [$2], [$3])])
-
-
-# AC_VAR_PUSHDEF and AC_VAR_POPDEF
-# --------------------------------
-#
-
-# Sometimes we may have to handle literals (e.g. `stdlib.h'), while at
-# other moments, the same code may have to get the value from a
-# variable (e.g., `ac_header').  To have a uniform handling of both
-# cases, when a new value is about to be processed, declare a local
-# variable, e.g.:
-#
-#   AC_VAR_PUSHDEF([header], [ac_cv_header_$1])
-#
-# and then in the body of the macro, use `header' as is.  It is of
-# first importance to use `AC_VAR_*' to access this variable.  Don't
-# quote its name: it must be used right away by m4.
-#
-# If the value `$1' was a literal (e.g. `stdlib.h'), then `header' is
-# in fact the value `ac_cv_header_stdlib_h'.  If `$1' was indirect,
-# then `header's value in m4 is in fact `$ac_header', the shell
-# variable that holds all of the magic to get the expansion right.
-#
-# At the end of the block, free the variable with
-#
-#   AC_VAR_POPDEF([header])
-
-
-# AC_VAR_PUSHDEF(VARNAME, VALUE)
-# ------------------------------
-# Define the m4 macro VARNAME to an accessor to the shell variable
-# named VALUE.  VALUE does not need to be a valid shell variable name:
-# the transliteration is handled here.  To be dnl'ed.
-m4_define([AC_VAR_PUSHDEF],
-[AS_LITERAL_IF([$2],
-               [m4_pushdef([$1], [AC_TR_SH($2)])],
-               [ac_$1=AC_TR_SH($2)
-m4_pushdef([$1], [$ac_[$1]])])])
-
-
-# AC_VAR_POPDEF(VARNAME)
-# ----------------------
-# Free the shell variable accessor VARNAME.  To be dnl'ed.
-m4_define([AC_VAR_POPDEF],
-[m4_popdef([$1])])
-
-
-
-## ------------------------------------ ##
-## Common m4/sh character translation.  ##
-## ------------------------------------ ##
-
-# The point of this section is to provide high level functions
-# comparable to m4's `translit' primitive, but m4:sh polymorphic.
-# Transliteration of literal strings should be handled by m4, while
-# shell variables' content will be translated at runtime (tr or sed).
-
-# AC_TR_CPP(EXPRESSION)
-# ---------------------
-# Map EXPRESSION to an upper case string which is valid as rhs for a
-# `#define'.  sh/m4 polymorphic.  Make sure to update the definition
-# of `$ac_tr_cpp' if you change this.
-m4_define([AC_TR_CPP],
-[AS_LITERAL_IF([$1],
-               [m4_patsubst(m4_translit([[$1]],
-                                        [*abcdefghijklmnopqrstuvwxyz],
-                                        [PABCDEFGHIJKLMNOPQRSTUVWXYZ]),
-                            [[^A-Z0-9_]], [_])],
-               [`echo "$1" | $ac_tr_cpp`])])
-
-
-# AC_TR_SH(EXPRESSION)
-# --------------------
-# Transform EXPRESSION into a valid shell variable name.
-# sh/m4 polymorphic.
-# Make sure to update the definition of `$ac_tr_sh' if you change this.
-m4_define([AC_TR_SH],
-[AS_LITERAL_IF([$1],
-               [m4_patsubst(m4_translit([[$1]], [*+], [pp]),
-                            [[^a-zA-Z0-9_]], [_])],
-               [`echo "$1" | $ac_tr_sh`])])
-
-
-
 ## ----------------------------- ##
 ## Implementing Autoconf loops.  ##
 ## ----------------------------- ##
@@ -741,16 +605,6 @@ m4_define([_AC_INIT_DEFAULTS],
 # only ac_max_sed_lines should be used.
 : ${ac_max_here_lines=38}
 
-# Avoid depending upon Character Ranges.
-ac_cr_az='abcdefghijklmnopqrstuvwxyz'
-ac_cr_AZ='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-ac_cr_09='0123456789'
-ac_cr_alnum=$ac_cr_az$ac_cr_AZ$ac_cr_09
-
-# Sed expression to map a string onto a valid sh and CPP variable names.
-ac_tr_sh="sed y%*+%pp%;s%[[^_$ac_cr_alnum]]%_%g"
-ac_tr_cpp="sed y%*$ac_cr_az%P$ac_cr_AZ%;s%[[^_$ac_cr_alnum]]%_%g"
-
 m4_divert_pop([DEFAULTS])dnl
 ])# _AC_INIT_DEFAULTS
 
@@ -904,7 +758,7 @@ m4_define([_AC_INIT_PARSE_ARGS],
   -disable-* | --disable-*)
     ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : "[.*[^-_$ac_cr_alnum]]" >/dev/null &&
+    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" ;;
@@ -912,7 +766,7 @@ m4_define([_AC_INIT_PARSE_ARGS],
   -enable-* | --enable-*)
     ac_feature=`expr "x$ac_option" : 'x-*enable-\([[^=]]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : "[.*[^-_$ac_cr_alnum]]" >/dev/null &&
+    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
@@ -1093,7 +947,7 @@ m4_define([_AC_INIT_PARSE_ARGS],
   -with-* | --with-*)
     ac_package=`expr "x$ac_option" : 'x-*with-\([[^=]]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : "[.*[^-_$ac_cr_alnum]]" >/dev/null &&
+    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
@@ -1105,7 +959,7 @@ m4_define([_AC_INIT_PARSE_ARGS],
   -without-* | --without-*)
     ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : "[.*[^-_$ac_cr_alnum]]" >/dev/null &&
+    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" ;;
@@ -1135,7 +989,7 @@ m4_define([_AC_INIT_PARSE_ARGS],
   *=*)
     ac_envvar=`expr "x$ac_option" : 'x\([[^=]]*\)='`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_envvar" : "[.*[^_$ac_cr_alnum]]" >/dev/null &&
+    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'"
@@ -1144,7 +998,7 @@ m4_define([_AC_INIT_PARSE_ARGS],
   *)
     # FIXME: should be removed in autoconf 3.0.
     AC_MSG_WARN([you should use --build, --host, --target])
-    expr "x$ac_option" : "[.*[^-._$ac_cr_alnum]]" >/dev/null &&
+    expr "x$ac_option" : "[.*[^-._$as_cr_alnum]]" >/dev/null &&
       AC_MSG_WARN([invalid host type: $ac_option])
     : ${build_alias=$ac_option} ${host_alias=$ac_option} 
${target_alias=$ac_option}
     ;;
@@ -1941,12 +1795,12 @@ m4_define([_AC_CACHE_DUMP],
       # substitution turns \\\\ into \\, and sed turns \\ into \).
       sed -n \
         ["s/'/'\\\\''/g;
-         s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"]
+         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/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"]
+        ["s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"]
       ;;
     esac;
 }dnl
@@ -2003,9 +1857,9 @@ m4_define([AC_CACHE_VAL],
       [AC_DIAGNOSE(syntax,
 [$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl
 [where no actions should be taken])])dnl
-AC_VAR_SET_IFELSE([$1],
-                  [echo $ECHO_N "(cached) $ECHO_C" >&AS_MESSAGE_FD],
-                  [$2])])
+AS_VAR_SET_IF([$1],
+              [echo $ECHO_N "(cached) $ECHO_C" >&AS_MESSAGE_FD],
+              [$2])])
 
 
 # AC_CACHE_CHECK(MESSAGE, CACHE-ID, COMMANDS)
@@ -2014,7 +1868,7 @@ m4_define([AC_CACHE_VAL],
 m4_define([AC_CACHE_CHECK],
 [AC_MSG_CHECKING([$1])
 AC_CACHE_VAL([$2], [$3])dnl
-AC_MSG_RESULT_UNQUOTED([AC_VAR_GET([$2])])])
+AC_MSG_RESULT_UNQUOTED([AS_VAR_GET([$2])])])
 
 
 
@@ -2630,27 +2484,27 @@ AC_DEFUN([AC_SEARCH_LIBS],
 # freedom.
 AC_DEFUN([AC_CHECK_LIB],
 [m4_ifval([$3], , [AH_CHECK_LIB([$1])])dnl
-AC_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])dnl
+AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])dnl
 AC_CACHE_CHECK([for $2 in -l$1], ac_Lib,
 [ac_check_lib_save_LIBS=$LIBS
 LIBS="-l$1 $5 $LIBS"
 AC_TRY_LINK_FUNC([$2],
-                 [AC_VAR_SET(ac_Lib, yes)],
-                 [AC_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 AC_VAR_GET(ac_Lib) = yes],
-      [m4_default([$3], [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_LIB$1))
+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"
 ])],
       [$4])dnl
-AC_VAR_POPDEF([ac_Lib])dnl
+AS_VAR_POPDEF([ac_Lib])dnl
 ])# AC_CHECK_LIB
 
 
 # AH_CHECK_LIB(LIBNAME)
 # ---------------------
 m4_define([AH_CHECK_LIB],
-[AH_TEMPLATE(AC_TR_CPP(HAVE_LIB$1),
+[AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1),
              [Define if you have the `]$1[' library (-l]$1[).])])
 
 
@@ -2925,17 +2779,17 @@ AC_DEFUN([AC_TRY_RUN],
 AC_DEFUN([AC_CHECK_FILE],
 [AC_DIAGNOSE([cross],
              [cannot check for file existence when cross compiling])dnl
-AC_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl
+AS_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl
 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
-  AC_VAR_SET(ac_File, yes)
+  AS_VAR_SET(ac_File, yes)
 else
-  AC_VAR_SET(ac_File, no)
+  AS_VAR_SET(ac_File, no)
 fi])
-AS_IF([test AC_VAR_GET(ac_File) = yes], [$2], [$3])[]dnl
-AC_VAR_POPDEF([ac_File])dnl
+AS_IF([test AS_VAR_GET(ac_File) = yes], [$2], [$3])[]dnl
+AS_VAR_POPDEF([ac_File])dnl
 ])# AC_CHECK_FILE
 
 
@@ -2944,7 +2798,7 @@ AC_DEFUN([AC_CHECK_FILE],
 AC_DEFUN([AC_CHECK_FILES],
 [AC_FOREACH([AC_FILE_NAME], [$1],
   [AC_CHECK_FILE(AC_FILE_NAME,
-                 [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_FILE_NAME), 1,
+                 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_FILE_NAME), 1,
                                    [Define if you have the file `]AC_File['.])
 $2],
                  [$3])])])
@@ -2961,17 +2815,17 @@ AC_DEFUN([AC_CHECK_FILES],
 # -------------------------------------------------------
 # Check if SYMBOL (a variable or a function) is declared.
 AC_DEFUN([AC_CHECK_DECL],
-[AC_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])dnl
+[AS_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])dnl
 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;
 #endif
 ])],
-                   [AC_VAR_SET(ac_Symbol, yes)],
-                   [AC_VAR_SET(ac_Symbol, no)])])
-AS_IF([test AC_VAR_GET(ac_Symbol) = yes], [$2], [$3])[]dnl
-AC_VAR_POPDEF([ac_Symbol])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
 
 
@@ -2985,11 +2839,11 @@ AC_DEFUN([AC_CHECK_DECL],
 AC_DEFUN([AC_CHECK_DECLS],
 [m4_foreach([AC_Symbol], [$1],
   [AC_CHECK_DECL(AC_Symbol,
-                 [AC_DEFINE_UNQUOTED(AC_TR_CPP([HAVE_DECL_]AC_Symbol), 1,
+                 [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_DECL_]AC_Symbol), 1,
                                      [Define to 1 if you have the declaration
                                      of `]AC_Symbol[', and to 0 if you don't.])
 $2],
-                 [AC_DEFINE_UNQUOTED(AC_TR_CPP([HAVE_DECL_]AC_Symbol), 0)
+                 [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_DECL_]AC_Symbol), 0)
 $3],
                  [$4])])
 ])# AC_CHECK_DECLS
Index: acheaders.m4
--- acheaders.m4 Tue, 23 Jan 2001 02:06:08 +0100 akim (ace/b/48_acheaders. 1.6 
666)
+++ acheaders.m4 Sun, 03 Jun 2001 10:23:59 +0200 akim (ace/b/48_acheaders. 1.6 
666)
@@ -63,13 +63,13 @@
 # AC_CHECK_HEADER(HEADER-FILE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 # ----------------------------------------------------------------------
 AC_DEFUN([AC_CHECK_HEADER],
-[AC_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl
+[AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl
 AC_CACHE_CHECK([for $1], ac_Header,
                [AC_PREPROC_IFELSE([AC_LANG_SOURCE(address@hidden:@include 
<$1>])],
-                                  [AC_VAR_SET(ac_Header, yes)],
-                                  [AC_VAR_SET(ac_Header, no)])])
-AS_IF([test AC_VAR_GET(ac_Header) = yes], [$2], [$3])[]dnl
-AC_VAR_POPDEF([ac_Header])dnl
+                                  [AS_VAR_SET(ac_Header, yes)],
+                                  [AS_VAR_SET(ac_Header, no)])])
+AS_IF([test AS_VAR_GET(ac_Header) = yes], [$2], [$3])[]dnl
+AS_VAR_POPDEF([ac_Header])dnl
 ])# AC_CHECK_HEADER
 
 
@@ -77,7 +77,7 @@ AC_DEFUN([AC_CHECK_HEADER],
 # --------------------------------
 m4_define([AH_CHECK_HEADERS],
 [AC_FOREACH([AC_Header], [$1],
-  [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Header),
+  [AH_TEMPLATE(AS_TR_CPP(HAVE_[]AC_Header),
                [Define if you have the <]AC_Header[> header file.])])])
 
 
@@ -89,7 +89,7 @@ AC_DEFUN([AC_CHECK_HEADERS],
 for ac_header in $1
 do
 AC_CHECK_HEADER($ac_header,
-                [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_$ac_header)) $2],
+                [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$ac_header)) $2],
                 [$3])dnl
 done
 ])
@@ -109,16 +109,16 @@ AC_DEFUN([AC_CHECK_HEADERS],
 # Like AC_CHECK_HEADER, except also make sure that HEADER-FILE
 # defines the type `DIR'.  dirent.h on NextStep 3.2 doesn't.
 m4_define([_AC_CHECK_HEADER_DIRENT],
-[AC_VAR_PUSHDEF([ac_Header], [ac_cv_header_dirent_$1])dnl
+[AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_dirent_$1])dnl
 AC_CACHE_CHECK([for $1 that defines DIR], ac_Header,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
 #include <$1>
 ],
                                     [DIR *dirp = 0;])],
-                   [AC_VAR_SET(ac_Header, yes)],
-                   [AC_VAR_SET(ac_Header, no)])])
-AS_IF([test AC_VAR_GET(ac_Header) = yes], [$2], [$3])[]dnl
-AC_VAR_POPDEF([ac_Header])dnl
+                   [AS_VAR_SET(ac_Header, yes)],
+                   [AS_VAR_SET(ac_Header, no)])])
+AS_IF([test AS_VAR_GET(ac_Header) = yes], [$2], [$3])[]dnl
+AS_VAR_POPDEF([ac_Header])dnl
 ])# _AC_CHECK_HEADER_DIRENT
 
 
@@ -126,7 +126,7 @@ m4_define([_AC_CHECK_HEADER_DIRENT],
 # -----------------------------------
 m4_define([AH_CHECK_HEADERS_DIRENT],
 [AC_FOREACH([AC_Header], [$1],
-  [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Header),
+  [AH_TEMPLATE(AS_TR_CPP(HAVE_[]AC_Header),
                [Define if you have the <]AC_Header[> header file, and
                 it defines `DIR'.])])])
 
@@ -138,7 +138,7 @@ AC_DEFUN([AC_HEADER_DIRENT],
 ac_header_dirent=no
 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
   _AC_CHECK_HEADER_DIRENT($ac_hdr,
-                          [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_$ac_hdr), 1)
+                          [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$ac_hdr), 1)
 ac_header_dirent=$ac_hdr; break])
 done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
Index: actypes.m4
--- actypes.m4 Thu, 01 Feb 2001 20:35:31 +0100 akim (ace/c/2_actypes.m4 1.2 644)
+++ actypes.m4 Sun, 03 Jun 2001 10:23:59 +0200 akim (ace/c/2_actypes.m4 1.2 644)
@@ -141,17 +141,17 @@
 # variable, we just use a cast to avoid warnings from the compiler.
 # Suggested by Paul Eggert.
 m4_define([_AC_CHECK_TYPE_NEW],
-[AC_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl
+[AS_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl
 AC_CACHE_CHECK([for $1], ac_Type,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
 [if (($1 *) 0)
   return 0;
 if (sizeof ($1))
   return 0;])],
-                   [AC_VAR_SET(ac_Type, yes)],
-                   [AC_VAR_SET(ac_Type, no)])])
-AS_IF([test AC_VAR_GET(ac_Type) = yes], [$2], [$3])[]dnl
-AC_VAR_POPDEF([ac_Type])dnl
+                   [AS_VAR_SET(ac_Type, yes)],
+                   [AS_VAR_SET(ac_Type, no)])])
+AS_IF([test AS_VAR_GET(ac_Type) = yes], [$2], [$3])[]dnl
+AS_VAR_POPDEF([ac_Type])dnl
 ])# _AC_CHECK_TYPE_NEW
 
 
@@ -164,7 +164,7 @@ m4_define([_AC_CHECK_TYPE_NEW],
 AC_DEFUN([AC_CHECK_TYPES],
 [m4_foreach([AC_Type], [$1],
   [_AC_CHECK_TYPE_NEW(AC_Type,
-                      [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Type), 1,
+                      [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_Type), 1,
                                           [Define if the system has the type
                                           `]AC_Type['.])
 $2],
@@ -350,15 +350,15 @@ AC_DEFUN([AC_CHECK_SIZEOF],
 [AS_LITERAL_IF([$1], [],
                [AC_FATAL([$0: requires literal arguments])])dnl
 AC_CHECK_TYPE([$1], [], [], [$3])
-AC_CACHE_CHECK([size of $1], AC_TR_SH([ac_cv_sizeof_$1]),
-[if test "$AC_TR_SH([ac_cv_type_$1])" = yes; then
+AC_CACHE_CHECK([size of $1], AS_TR_SH([ac_cv_sizeof_$1]),
+[if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
   _AC_COMPUTE_INT([sizeof ($1)],
-                  [AC_TR_SH([ac_cv_sizeof_$1])],
+                  [AS_TR_SH([ac_cv_sizeof_$1])],
                   [AC_INCLUDES_DEFAULT([$3])])
 else
-  AC_TR_SH([ac_cv_sizeof_$1])=0
+  AS_TR_SH([ac_cv_sizeof_$1])=0
 fi])dnl
-AC_DEFINE_UNQUOTED(AC_TR_CPP(sizeof_$1), $AC_TR_SH([ac_cv_sizeof_$1]),
+AC_DEFINE_UNQUOTED(AS_TR_CPP(sizeof_$1), $AS_TR_SH([ac_cv_sizeof_$1]),
                    [The size of a `$1', as computed by sizeof.])
 ])# AC_CHECK_SIZEOF
 
@@ -419,7 +419,7 @@ AC_DEFUN([AC_CHECK_MEMBER],
                [AC_FATAL([$0: requires literal arguments])])dnl
 m4_if(m4_regexp([$1], [\.]), -1,
       [AC_FATAL([$0: Did not see any dot in `$1'])])dnl
-AC_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
+AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
 dnl Extract the aggregate name, and the member name
 AC_CACHE_CHECK([for $1], ac_Member,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
@@ -427,10 +427,10 @@ AC_DEFUN([AC_CHECK_MEMBER],
 m4_patsubst([$1], [\..*]) foo;
 dnl foo.MEMBER;
 foo.m4_patsubst([$1], [^[^.]*\.]);])],
-                [AC_VAR_SET(ac_Member, yes)],
-                [AC_VAR_SET(ac_Member, no)])])
-AS_IF([test AC_VAR_GET(ac_Member) = yes], [$2], [$3])dnl
-AC_VAR_POPDEF([ac_Member])dnl
+                [AS_VAR_SET(ac_Member, yes)],
+                [AS_VAR_SET(ac_Member, no)])])
+AS_IF([test AS_VAR_GET(ac_Member) = yes], [$2], [$3])dnl
+AS_VAR_POPDEF([ac_Member])dnl
 ])# AC_CHECK_MEMBER
 
 
@@ -442,7 +442,7 @@ AC_DEFUN([AC_CHECK_MEMBER],
 AC_DEFUN([AC_CHECK_MEMBERS],
 [m4_foreach([AC_Member], [$1],
   [AC_CHECK_MEMBER(AC_Member,
-         [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Member), 1,
+         [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_Member), 1,
                             [Define if `]m4_patsubst(AC_Member,
                                                      [^[^.]*\.])[' is
                              member of `]m4_patsubst(AC_Member, [\..*])['.])
Index: m4sh.m4
--- m4sh.m4 Sun, 25 Feb 2001 10:04:51 +0100 akim (ace/b/41_m4sh.m4 1.25 644)
+++ m4sh.m4 Sun, 03 Jun 2001 10:25:50 +0200 akim (ace/b/41_m4sh.m4 1.25 644)
@@ -70,6 +70,7 @@
 _AS_LN_S_PREPARE
 _AS_TEST_PREPARE
 _AS_UNSET_PREPARE
+_AS_TR_PREPARE
 
 # NLS nuisances.
 AS_UNSET([LANG],        [C])
@@ -519,6 +520,186 @@ m4_define([AS_UNAME],
 
 _ASUNAME
 }])
+
+
+
+## ------------------------------------ ##
+## Common m4/sh character translation.  ##
+## ------------------------------------ ##
+
+# The point of this section is to provide high level macros comparable
+# to m4's `translit' primitive, but m4/sh polymorphic.
+# Transliteration of literal strings should be handled by m4, while
+# shell variables' content will be translated at runtime (tr or sed).
+
+
+# _AS_CR_PREPARE
+# --------------
+# Output variables defining common character ranges.
+# See m4_cr_letters etc.
+m4_defun([_AS_CR_PREPARE],
+[# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+])
+
+
+# _AS_TR_SH_PREPARE
+# -----------------
+m4_defun([_AS_TR_SH_PREPARE],
+[m4_require([_AS_CR_PREPARE])dnl
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g"
+])
+
+
+# AS_TR_SH(EXPRESSION)
+# --------------------
+# Transform EXPRESSION into a valid shell variable name.
+# sh/m4 polymorphic.
+# Be sure to update the definition of `$as_tr_sh' if you change this.
+m4_defun([AS_TR_SH],
+[m4_require([_$0_PREPARE])dnl
+AS_LITERAL_IF([$1],
+              [m4_patsubst(m4_translit([[$1]], [*+], [pp]),
+                           [[^a-zA-Z0-9_]], [_])],
+              [`echo "$1" | $as_tr_sh`])])
+
+
+# _AS_TR_CPP_PREPARE
+# ------------------
+m4_defun([_AS_TR_CPP_PREPARE],
+[m4_require([_AS_CR_PREPARE])dnl
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g"
+])
+
+
+# AS_TR_CPP(EXPRESSION)
+# ---------------------
+# Map EXPRESSION to an upper case string which is valid as rhs for a
+# `#define'.  sh/m4 polymorphic.  Be sure to update the definition
+# of `$as_tr_cpp' if you change this.
+m4_defun([AS_TR_CPP],
+[m4_require([_$0_PREPARE])dnl
+AS_LITERAL_IF([$1],
+              [m4_patsubst(m4_translit([[$1]],
+                                       [*abcdefghijklmnopqrstuvwxyz],
+                                       [PABCDEFGHIJKLMNOPQRSTUVWXYZ]),
+                           [[^A-Z0-9_]], [_])],
+              [`echo "$1" | $as_tr_cpp`])])
+
+
+# _AS_TR_PREPARE
+# --------------
+m4_defun([_AS_TR_PREPARE],
+[m4_require([_AS_TR_SH_PREPARE])dnl
+m4_require([_AS_TR_CPP_PREPARE])dnl
+])
+
+
+
+
+## --------------------------------------------------- ##
+## Common m4/sh handling of variables (indirections).  ##
+## --------------------------------------------------- ##
+
+
+# The purpose of this section is to provide a uniform API for
+# reading/setting sh variables with or without indirection.
+# Typically, one can write
+#   AS_VAR_SET(var, val)
+# or
+#   AS_VAR_SET(as_$var, val)
+# and expect the right thing to happen.
+
+
+# AS_VAR_SET(VARIABLE, VALUE)
+# ---------------------------
+# Set the VALUE of the shell VARIABLE.
+# If the variable contains indirections (e.g. `ac_cv_func_$ac_func')
+# perform whenever possible at m4 level, otherwise sh level.
+m4_define([AS_VAR_SET],
+[AS_LITERAL_IF([$1],
+               [$1=$2],
+               [eval "$1=$2"])])
+
+
+# AS_VAR_GET(VARIABLE)
+# --------------------
+# Get the value of the shell VARIABLE.
+# Evaluates to $VARIABLE if there are no indirection in VARIABLE,
+# else into the appropriate `eval' sequence.
+m4_define([AS_VAR_GET],
+[AS_LITERAL_IF([$1],
+               [$[]$1],
+               [`eval echo '${'m4_patsubst($1, [[\\`]], [\\\&])'}'`])])
+
+
+# AS_VAR_TEST_SET(VARIABLE)
+# -------------------------
+# Expands into the `test' expression which is true if VARIABLE
+# is set.  Polymorphic.  Should be dnl'ed.
+m4_define([AS_VAR_TEST_SET],
+[AS_LITERAL_IF([$1],
+               [test "${$1+set}" = set],
+               [eval "test \"\${$1+set}\" = set"])])
+
+
+# AS_VAR_SET_IF(VARIABLE, IF-TRUE, IF-FALSE)
+# ------------------------------------------
+# Implement a shell `if-then-else' depending whether VARIABLE is set
+# or not.  Polymorphic.
+m4_define([AS_VAR_SET_IF],
+[AS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3])])
+
+
+# AS_VAR_PUSHDEF and AS_VAR_POPDEF
+# --------------------------------
+#
+
+# Sometimes we may have to handle literals (e.g. `stdlib.h'), while at
+# other moments, the same code may have to get the value from a
+# variable (e.g., `ac_header').  To have a uniform handling of both
+# cases, when a new value is about to be processed, declare a local
+# variable, e.g.:
+#
+#   AS_VAR_PUSHDEF([header], [ac_cv_header_$1])
+#
+# and then in the body of the macro, use `header' as is.  It is of
+# first importance to use `AS_VAR_*' to access this variable.  Don't
+# quote its name: it must be used right away by m4.
+#
+# If the value `$1' was a literal (e.g. `stdlib.h'), then `header' is
+# in fact the value `ac_cv_header_stdlib_h'.  If `$1' was indirect,
+# then `header's value in m4 is in fact `$ac_header', the shell
+# variable that holds all of the magic to get the expansion right.
+#
+# At the end of the block, free the variable with
+#
+#   AS_VAR_POPDEF([header])
+
+
+# AS_VAR_PUSHDEF(VARNAME, VALUE)
+# ------------------------------
+# Define the m4 macro VARNAME to an accessor to the shell variable
+# named VALUE.  VALUE does not need to be a valid shell variable name:
+# the transliteration is handled here.  To be dnl'ed.
+m4_define([AS_VAR_PUSHDEF],
+[AS_LITERAL_IF([$2],
+               [m4_pushdef([$1], [AS_TR_SH($2)])],
+               [as_$1=AS_TR_SH($2)
+m4_pushdef([$1], [$as_[$1]])])])
+
+
+# AS_VAR_POPDEF(VARNAME)
+# ----------------------
+# Free the shell variable accessor VARNAME.  To be dnl'ed.
+m4_define([AS_VAR_POPDEF],
+[m4_popdef([$1])])
 
 
 
Index: tests/aclocal.m4
--- tests/aclocal.m4 Mon, 19 Feb 2001 23:50:41 +0100 akim (ace/b/23_actest.m4 
1.23 644)
+++ tests/aclocal.m4 Sun, 03 Jun 2001 11:05:53 +0200 akim (ace/b/23_actest.m4 
1.23 644)
@@ -34,7 +34,7 @@
 m4_defun([AC_STATE_SAVE],
 [(set) 2>&1 |
   egrep -v -e 'm4_join([|],
-      [^ac_],
+      [^a[cs]_],
       [^((exec_)?prefix|DEFS|CONFIG_STATUS)=],
       [^(CC|CFLAGS|CPP|GCC|CXX|CXXFLAGS|CXXCPP|GXX|F77|FFLAGS|FLIBS|G77)=],
       [^(LIBS|LIBOBJS|LDFLAGS)=],



reply via email to

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