]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/m4sugar/m4sugar.m4 (m4_define_default, m4_fst, m4_map): New.
authorAkim Demaille <akim@epita.fr>
Tue, 19 Mar 2002 07:42:06 +0000 (07:42 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 19 Mar 2002 07:42:06 +0000 (07:42 +0000)
ChangeLog
lib/m4sugar/m4sugar.m4

index 7a5b34d394166959733201f8391a103f9a8a8d1a..5a8649c1d34ff6bb10d5da296ed04ebaf1de50c7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2002-03-19  Akim Demaille  <akim@epita.fr>
+
+       * lib/m4sugar/m4sugar.m4 (m4_define_default, m4_fst, m4_map): New.
+
 2002-03-18  Paul Eggert  <eggert@twinsun.com>
 
        * doc/autoconf.texi (Programming in M4sh): Add AS_MKDIR_P.
index 08317ccc77eb1842f40b0904ab179e9c75c05638..bc965229ae2120a14304c3fa3f0686d9afd6cffd 100644 (file)
@@ -2,7 +2,7 @@ divert(-1)#                                                  -*- Autoconf -*-
 # This file is part of Autoconf.
 # Base M4 layer.
 # Requires GNU M4.
-# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002 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
@@ -426,6 +426,16 @@ m4_define([m4_bmatch],
        [$3])])
 
 
+# m4_map(MACRO, LIST)
+# -------------------
+# Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements
+# of LIST (which can be lists themselves, for multiple arguments MACROs).
+m4_define([m4_fst], [$1])
+m4_define([m4_map],
+[m4_if([$2], [[]], [],
+       [$1(m4_fst($2))[]dnl
+m4_map([$1], m4_cdr($2))])])
+
 
 ## ---------------------------------------- ##
 ## 6. Enhanced version of some primitives.  ##
@@ -466,6 +476,13 @@ m4_define([m4_do],
        [$1[]m4_do(m4_shift($@))])])
 
 
+# m4_define_default(MACRO, VALUE)
+# -------------------------------
+# If MACRO is undefined, set it to VALUE.
+m4_define([m4_define_default],
+[m4_ifndef([$1], [m4_define($@)])])
+
+
 # m4_default(EXP1, EXP2)
 # ----------------------
 # Returns EXP1 if non empty, otherwise EXP2.
@@ -532,6 +549,7 @@ m4_builtin([popdef], $@)])
 m4_define([m4_quote],  [[$*]])
 m4_define([m4_dquote],  [[$@]])
 
+
 # m4_noquote(STRING)
 # ------------------
 # Return the result of ignoring all quotes in STRING and invoking the