autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_DEFUN_ONCE semantics


From: Eric Blake
Subject: Re: AC_DEFUN_ONCE semantics
Date: Wed, 28 Jan 2009 16:16:00 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> According to Paolo Bonzini on 1/27/2009 1:03 AM:
> > I think that only the following macros must absolutely be defined with
> > AC_DEFUN_ONCE: AC_CANONICAL_*, AC_USE_SYSTEM_EXTENSIONS.
> > 
> > Regarding AC_PROG_* macros, I think most of them pose no problems, but I
> > agree that this should be left to a future version N years down the
> > road.
> 
> OK, on the argument that it is not fixing a bug, but just optimizing
> performance (even for things like AC_PROG_MKDIR_P, where I've already
> proven that it shrinks the size of coreutils), I will not change any of
> the AC_PROG on this go-around.  I'll post my revised patch for review soon.

I've trimmed my original proposal down to two smaller patches; I'm inclined to 
submit the first one today, but hold off on the second for another 72 hours in 
case anyone can find a reason why AC_PROG_INSTALL or AC_PROG_MKDIR_P should be 
expanded more than once.

$ git pull git://repo.or.cz/autoconf/ericb.git m4-require

>From c4c2a01bd9d4af37d8e839f65ffb7e0ae627b4d1 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 28 Jan 2009 09:11:28 -0700
Subject: [PATCH] Use AC_DEFUN_ONCE for uncontroversial one-shot macros.

* lib/autoconf/headers.m4 (AC_HEADER_ASSERT): Switch to
AC_DEFUN_ONCE, since this is a one-shot macro.
* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Likewise.
* lib/autoconf/general.m4 (AC_CANONICAL_BUILD)
(AC_CANONICAL_HOST, AC_CANONICAL_TARGET): Likewise.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog                |    9 +++++++++
 lib/autoconf/general.m4  |    6 +++---
 lib/autoconf/headers.m4  |    2 +-
 lib/autoconf/specific.m4 |    6 +++---
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2885f27..e734c71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2009-01-28  Eric Blake  <address@hidden>
 
+       Use AC_DEFUN_ONCE for uncontroversial one-shot macros.
+       * lib/autoconf/headers.m4 (AC_HEADER_ASSERT): Switch to
+       AC_DEFUN_ONCE, since this is a one-shot macro.
+       * lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Likewise.
+       * lib/autoconf/general.m4 (AC_CANONICAL_BUILD)
+       (AC_CANONICAL_HOST, AC_CANONICAL_TARGET): Likewise.
+
+2009-01-28  Eric Blake  <address@hidden>
+
        Fix years in copyright notices.
        * lib/m4sugar/m4sugar.m4 (m4_copyright_condense): New macro,
        undocumented for now.
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index cb7e5c2..83254ed 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -1791,7 +1791,7 @@ AC_SUBST([$1_os])dnl
 
 # AC_CANONICAL_BUILD
 # ------------------
-AC_DEFUN([AC_CANONICAL_BUILD],
+AC_DEFUN_ONCE([AC_CANONICAL_BUILD],
 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_REQUIRE_AUX_FILE([config.sub])dnl
 AC_REQUIRE_AUX_FILE([config.guess])dnl
@@ -1818,7 +1818,7 @@ _AC_CANONICAL_SPLIT(build)
 
 # AC_CANONICAL_HOST
 # -----------------
-AC_DEFUN([AC_CANONICAL_HOST],
+AC_DEFUN_ONCE([AC_CANONICAL_HOST],
 [AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 m4_divert_once([HELP_CANON],
 [[  --host=HOST       cross-compile to build programs to run on HOST [BUILD]]])
dnl
@@ -1836,7 +1836,7 @@ _AC_CANONICAL_SPLIT([host])
 
 # AC_CANONICAL_TARGET
 # -------------------
-AC_DEFUN([AC_CANONICAL_TARGET],
+AC_DEFUN_ONCE([AC_CANONICAL_TARGET],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_BEFORE([$0], [AC_ARG_PROGRAM])dnl
 m4_divert_once([HELP_CANON],
diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index 3702a85..120adc9 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -431,7 +431,7 @@ AN_HEADER([wctype.h],           [AC_CHECK_HEADERS])
 # AC_HEADER_ASSERT
 # ----------------
 # Check whether to enable assertions.
-AC_DEFUN([AC_HEADER_ASSERT],
+AC_DEFUN_ONCE([AC_HEADER_ASSERT],
 [
   AC_MSG_CHECKING([whether to enable assertions])
   AC_ARG_ENABLE([assert],
diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4
index 5fcfe37..322364e 100644
--- a/lib/autoconf/specific.m4
+++ b/lib/autoconf/specific.m4
@@ -2,8 +2,8 @@
 # Macros that test for specific, unclassified, features.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
-# Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 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
@@ -383,7 +383,7 @@ matches *mingw32*])# AC_MINGW32
 # AC_DEFINE.  The goal here is to define all known feature-enabling
 # macros, then, if reports of conflicts are made, disable macros that
 # cause problems on some platforms (such as __EXTENSIONS__).
-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
 [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
 
-- 
1.6.0.4


>From b9303e86046f004be271b3ba74e3668adaf3b090 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 28 Jan 2009 09:11:43 -0700
Subject: [PATCH] Use AC_DEFUN_ONCE for some one-shot AC_PROG macros.

* lib/autoconf/programs.m4 (AC_PROG_MKDIR_P): Switch to
AC_DEFUN_ONCE, since this is a one-shot macro.
(AC_PROG_INSTALL): Likewise.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog                |    5 +++++
 lib/autoconf/programs.m4 |    7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e734c71..7ecaeca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-01-28  Eric Blake  <address@hidden>
 
+       Use AC_DEFUN_ONCE for some one-shot AC_PROG macros.
+       * lib/autoconf/programs.m4 (AC_PROG_MKDIR_P): Switch to
+       AC_DEFUN_ONCE, since this is a one-shot macro.
+       (AC_PROG_INSTALL): Likewise.
+
        Use AC_DEFUN_ONCE for uncontroversial one-shot macros.
        * lib/autoconf/headers.m4 (AC_HEADER_ASSERT): Switch to
        AC_DEFUN_ONCE, since this is a one-shot macro.
diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4
index 3f66ae3..d12c0ae 100644
--- a/lib/autoconf/programs.m4
+++ b/lib/autoconf/programs.m4
@@ -2,7 +2,8 @@
 # Checking for programs.
 
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 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
@@ -544,7 +545,7 @@ m4_ifval([$3],
 # ---------------
 AN_MAKEVAR([INSTALL], [AC_PROG_INSTALL])
 AN_PROGRAM([install], [AC_PROG_INSTALL])
-AC_DEFUN([AC_PROG_INSTALL],
+AC_DEFUN_ONCE([AC_PROG_INSTALL],
 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_REQUIRE_AUX_FILE([install-sh])dnl
 # Find a good install program.  We prefer a C program (faster),
@@ -682,7 +683,7 @@ AC_SUBST(INSTALL_DATA)dnl
 # recognize any option.  It will interpret all options as
 # directories to create.
 AN_MAKEVAR([MKDIR_P], [AC_PROG_MKDIR_P])
-AC_DEFUN([AC_PROG_MKDIR_P],
+AC_DEFUN_ONCE([AC_PROG_MKDIR_P],
 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_REQUIRE_AUX_FILE([install-sh])dnl
 AC_MSG_CHECKING([for a thread-safe mkdir -p])
-- 
1.6.0.4







reply via email to

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