autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] AC_CONFIG_MACRO_DIRS: new macro, mostly for aclocal


From: Eric Blake
Subject: Re: [PATCH 1/2] AC_CONFIG_MACRO_DIRS: new macro, mostly for aclocal
Date: Fri, 02 Nov 2012 15:34:22 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1

On 11/02/2012 03:19 PM, Eric Blake wrote:
> 
> I wrote these off the cuff while composing the email, so they are
> relatively untested.  And while re-reading, I see I botched the
> self-redefinition, as well as failed to call AC_CONFIG_MACRO_DIR if the
> first use was AC_CONFIG_MACRO_DIRS.  Here's another attempt, again
> relatively untested.

Self-redefinition is a bit complex; how about this alternative?

# _AC_CONFIG_MACRO_DIRS_USED
# --------------------------
# Witness macro defined to - after the first macro dir is traced.
m4_define([_AC_CONFIG_MACRO_DIRS_USED])

# _AC_CONFIG_MACRO_DIR(DIR)
# -------------------------
# Declare a single directory containing additional macros for aclocal;
# can be called more than once; order of calls is important.  This
# macro exists solely for tracing.
AC_DEFUN([_AC_CONFIG_MACRO_DIR],
[m4_define([$0S_USED], [-])])

# _AC_CONFIG_MACRO_DIRS_HELPER(CALLER, DIR)
# -----------------------------------------
# Internal engine that coordinates between the public macros to
# eventually trace DIR as another macro dir; uses self-redefinition
# to error on incorrect usage, depending on CALLER. Recurses through
# AC_CONFIG_MACRO_DIR on first call if needed for legacy tracing.
# Do not bother tracing this.
m4_define([_AC_CONFIG_MACRO_DIRS_HELPER],
[m4_if([$1], [AC_CONFIG_MACRO_DIRS],
  [AC_CONFIG_MACRO_DIR([$2])],
       [$1], [-AC_CONFIG_MACRO_DIR],
  [AC_MSG_ERROR([AC_CONFIG_MACRO_DIR cannot be used multiple times],
  [_AC_CONFIG_MACRO_DIR([$2])])])

# AC_CONFIG_MACRO_DIRS(DIR1 [DIR2...])
# ------------------------------------
# Declare one or more whitespace-separated directory containing
# additional macros for aclocal; can be called more than once;
# order of calls is important.  Trace _AC_CONFIG_MACRO_DIR
# instead of this.
AC_DEFUN([AC_CONFIG_MACRO_DIRS],
[m4_map_args_w([$1], [_$0_HELPER(_$0_USED()[$0], ], [)])])

# AC_CONFIG_MACRO_DIR(DIR)
# ------------------------
# Declare a single directory containing additional macros for aclocal;
# must be called at most once, and before any AC_CONFIG_MACRO_DIRS.
# Legacy applications traced this, although it is recommended that
# newer applications trace _AC_CONFIG_MACRO_DIR instead.  We guarantee
# that this macro will be traced at most once in a valid configure.ac.
AC_DEFUN([AC_CONFIG_MACRO_DIR],
[_$0S_HELPER(_$0S_USED()[$0], [$1])])

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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