bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] onceonly.m4 quoting fixes


From: Paul Eggert
Subject: [Bug-gnulib] onceonly.m4 quoting fixes
Date: 13 Mar 2003 13:33:20 -0800
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.3

Yesterday I merged gnulib into Bison, and ran into a problem with
onceonly.m4: it didn't quote its results correctly, and the resulting
'configure' file contained improperly expanded gibberish.  I'm not
quite sure why it happened, though when I inspected onceonly.m4 it was
clear that there were some quoting problems, and when I fixed the
quoting problems the bug went away.  So, here's the patch that I
installed into Bison yesterday, and into gnulib today.

This code uses defn rather than m4_defn, because that's the style of
the existing code, I guess for portability to older Autoconfs.  We do
need something like m4_quote to quote correctly, so I've added a
definition for that (again, for older Autoconfs).

Now that I've checked in the patch I see that I replaced [./-] with
[-./] as well.  This shouldn't make a difference, but at some point
during debugging it seemed to matter, so I left that change in.
(Anyway, it's in ASCII order now.  :-)

2003-03-13  Paul Eggert  <address@hidden>

        * onceonly.m4 (m4_quote): New macro.
        (AC_CHECK_HEADERS_ONCE, AC_CHECK_FUNCS_ONCE, AC_CHECK_DECLS_ONCE):
        Quote AC_FOREACH variable-expansions properly.

--- m4/onceonly.m4      31 Dec 2002 13:42:07 -0000      1.1
+++ m4/onceonly.m4      13 Mar 2003 21:23:43 -0000      1.2
@@ -1,5 +1,5 @@
-# onceonly.m4 serial 1
-dnl Copyright (C) 2002 Free Software Foundation, Inc.
+# onceonly.m4 serial 2
+dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
@@ -21,15 +21,20 @@ dnl inside an AC_DEFUNed function, the g
 dnl empty, and the check will be inserted before the body of the AC_DEFUNed
 dnl function.
 
+dnl Taken from Autoconf 2.50; can be removed once we assume 2.50 or later.
+define([m4_quote], [[$*]])
+
 # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
 # AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
 AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
   :
   AC_FOREACH([gl_HEADER_NAME], [$1], [
-    AC_DEFUN([gl_CHECK_HEADER_]translit(gl_HEADER_NAME,[./-], [___]), [
+    AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(defn([gl_HEADER_NAME]),
+                                                [-./], [___])), [
       AC_CHECK_HEADERS(gl_HEADER_NAME)
     ])
-    AC_REQUIRE([gl_CHECK_HEADER_]translit(gl_HEADER_NAME,[./-], [___]))
+    AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
+                                                  [-./], [___])))
   ])
 ])
 
@@ -38,10 +43,10 @@ AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
 AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
   :
   AC_FOREACH([gl_FUNC_NAME], [$1], [
-    AC_DEFUN([gl_CHECK_FUNC_]gl_FUNC_NAME, [
-      AC_CHECK_FUNCS(gl_FUNC_NAME)
+    AC_DEFUN([gl_CHECK_FUNC_]defn([gl_FUNC_NAME]), [
+      AC_CHECK_FUNCS(defn([gl_FUNC_NAME]))
     ])
-    AC_REQUIRE([gl_CHECK_FUNC_]gl_FUNC_NAME)
+    AC_REQUIRE([gl_CHECK_FUNC_]defn([gl_FUNC_NAME]))
   ])
 ])
 
@@ -50,9 +55,9 @@ AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
 AC_DEFUN([AC_CHECK_DECLS_ONCE], [
   :
   AC_FOREACH([gl_DECL_NAME], [$1], [
-    AC_DEFUN([gl_CHECK_DECL_]gl_DECL_NAME, [
-      AC_CHECK_DECLS(gl_DECL_NAME)
+    AC_DEFUN([gl_CHECK_DECL_]defn([gl_DECL_NAME]), [
+      AC_CHECK_DECLS(defn([gl_DECL_NAME]))
     ])
-    AC_REQUIRE([gl_CHECK_DECL_]gl_DECL_NAME)
+    AC_REQUIRE([gl_CHECK_DECL_]defn([gl_DECL_NAME]))
   ])
 ])





reply via email to

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