On 11/02/2012 02:46 PM, Eric Blake wrote: >> +++ b/lib/autoconf/general.m4 >> @@ -1727,13 +1727,21 @@ AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl >> ## ------------------------ ## >> >> >> +# AC_CONFIG_MACRO_DIRS(DIR-1 [DIR-2 ... DIR-n]) >> +# -------------------------------------------- >> +# Declare directories containing additional macros for aclocal. >> +# This macro can be called multiple times, and with multiple arguments. >> +AC_DEFUN([AC_CONFIG_MACRO_DIRS], []) > > Rather, I think we need this (and this also works with my above goal of > triggering an AC_CONFIG_MACRO_DIR trace exactly once): > > # _AC_CONFIG_MACRO_DIRS_USED(CALLER) > # ---------------------------------- > # Witness macro that says whether the first macro dir has been listed, > # in order to fail on incorrect usage. Self-redefining, so that all > # but the first call check who CALLER is, and error if needed. > m4_define([_AC_CONFIG_MACRO_DIRS_USED], > [m4_define([$0], [m4_if([$1], [AC_CONFIG_MACRO_DIR], > [AC_MSG_ERROR([$1 cannot be used multiple times])])])])
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. # _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]) # _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_DIR], [_AC_CONFIG_MACRO_DIR([$2])], [AC_CONFIG_MACRO_DIR([$2])])m4_define([$0], m4_defn([$0_])]) # _AC_CONFIG_MACRO_DIRS_HELPER_(CALLER, DIR) # ------------------------------------------ # Second definition of _AC_CONFIG_MACRO_DIRS_HELPER. # Do not bother tracing this. m4_define([_AC_CONFIG_MACRO_DIRS_HELPER_], [_AC_CONFIG_MACRO_DIR($[2])m4_if($[1], [AC_CONFIG_MACRO_DIR], [AC_MSG_ERROR([$1 cannot be used multiple times])])]) # 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], ], [)])]) # 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([$0], [$1])]) -- Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
