X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=m4%2Fax_save_flags.m4;h=39f45be46ebc3fbef54a5979e9762e2d95482287;hb=f6879bcc9ff979bf313c7dd155ab2e1fee8605d8;hp=d2a054223b910e8da1815417b9488d17ed707105;hpb=27bed94f9adf2d67670daf8a237be68f5bb7a076;p=awesomized%2Flibmemcached diff --git a/m4/ax_save_flags.m4 b/m4/ax_save_flags.m4 index d2a05422..39f45be4 100644 --- a/m4/ax_save_flags.m4 +++ b/m4/ax_save_flags.m4 @@ -4,28 +4,68 @@ # # SYNOPSIS # -# AX_SAVE_FLAGS() +# AX_SAVE_FLAGS([NAMESPACE]) # # DESCRIPTION # -# Save common compilation flags into temporary variables +# Save common compilation flags into temporary variables. +# +# Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS, +# OBJCFLAGS. +# +# By default these flags are saved to a global (empty) namespace, but user +# could specify a specific NAMESPACE to AX_SAVE_FLAGS macro and latter +# restore it by using AX_RESTORE_FLAGS(NAMESPACE). +# +# AX_SAVE_FLAGS(mypackage) +# CPPFLAGS="-Imypackagespath ${CPPFLAGS}" +# dnl .. do some detection ... +# AX_RESTORE_FLAGS(mypackage) # # LICENSE # # Copyright (c) 2009 Filippo Giunchedi +# Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University +# Copyright (c) 2011 Russ Allbery +# Copyright (c) 2013 Bastien ROUCARIES # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 3 +#serial 7 + +# list of flag to save +AC_DEFUN([_AX_SAVE_FLAGS_LIST],[dnl +[CCASFLAGS],dnl +[CFLAGS],dnl +[CPPFLAGS],dnl +[CXXFLAGS],dnl +[ERLCFLAGS],dnl +[FCFLAGS],dnl +[FCLIBS],dnl +[FFLAGS],dnl +[FLIBS],dnl +[GCJFLAGS],dnl +[JAVACFLAGS],dnl +[LDFLAGS],dnl +[LIBS],dnl +[OBJCFLAGS],dnl +[OBJCXXFLAGS],dnl +[UPCFLAGS],dnl +[VALAFLAGS]dnl +]) + +# save one flag in name space +AC_DEFUN([_AX_SAVE_ONE_FLAG],[ + AS_VAR_PUSHDEF([_ax_save_flag_var], [$2[]_$1[]_ax_save_flags]) + AS_VAR_COPY(_ax_save_flag_var, $2[]) + AS_VAR_POPDEF([_ax_save_flag_var]) +]) -AC_DEFUN([AX_SAVE_FLAGS], [ - CPPFLAGS_save="${CPPFLAGS}" - CFLAGS_save="${CFLAGS}" - CXXFLAGS_save="${CXXFLAGS}" - OBJCFLAGS_save="${OBJCFLAGS}" - LDFLAGS_save="${LDFLAGS}" - LIBS_save="${LIBS}" +AC_DEFUN([AX_SAVE_FLAGS],[dnl + m4_foreach([FLAG], dnl + [_AX_SAVE_FLAGS_LIST()], dnl + [_AX_SAVE_ONE_FLAG([$1],FLAG)]) ])