2 |
# This file is part of Autoconf. |
# This file is part of Autoconf. |
3 |
# Base M4 layer. |
# Base M4 layer. |
4 |
# Requires GNU M4. |
# Requires GNU M4. |
5 |
# Copyright 1999, 2000, 2001 Free Software Foundation, Inc. |
# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
6 |
# |
# |
7 |
# This program is free software; you can redistribute it and/or modify |
# This program is free software; you can redistribute it and/or modify |
8 |
# it under the terms of the GNU General Public License as published by |
# it under the terms of the GNU General Public License as published by |
426 |
[$3])]) |
[$3])]) |
427 |
|
|
428 |
|
|
429 |
|
# m4_map(MACRO, LIST) |
430 |
|
# ------------------- |
431 |
|
# Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements |
432 |
|
# of LIST (which can be lists themselves, for multiple arguments MACROs). |
433 |
|
m4_define([m4_fst], [$1]) |
434 |
|
m4_define([m4_map], |
435 |
|
[m4_if([$2], [[]], [], |
436 |
|
[$1(m4_fst($2))[]dnl |
437 |
|
m4_map([$1], m4_cdr($2))])]) |
438 |
|
|
439 |
|
|
440 |
## ---------------------------------------- ## |
## ---------------------------------------- ## |
441 |
## 6. Enhanced version of some primitives. ## |
## 6. Enhanced version of some primitives. ## |
476 |
[$1[]m4_do(m4_shift($@))])]) |
[$1[]m4_do(m4_shift($@))])]) |
477 |
|
|
478 |
|
|
479 |
|
# m4_define_default(MACRO, VALUE) |
480 |
|
# ------------------------------- |
481 |
|
# If MACRO is undefined, set it to VALUE. |
482 |
|
m4_define([m4_define_default], |
483 |
|
[m4_ifndef([$1], [m4_define($@)])]) |
484 |
|
|
485 |
|
|
486 |
# m4_default(EXP1, EXP2) |
# m4_default(EXP1, EXP2) |
487 |
# ---------------------- |
# ---------------------- |
488 |
# Returns EXP1 if non empty, otherwise EXP2. |
# Returns EXP1 if non empty, otherwise EXP2. |
549 |
m4_define([m4_quote], [[$*]]) |
m4_define([m4_quote], [[$*]]) |
550 |
m4_define([m4_dquote], [[$@]]) |
m4_define([m4_dquote], [[$@]]) |
551 |
|
|
552 |
|
|
553 |
# m4_noquote(STRING) |
# m4_noquote(STRING) |
554 |
# ------------------ |
# ------------------ |
555 |
# Return the result of ignoring all quotes in STRING and invoking the |
# Return the result of ignoring all quotes in STRING and invoking the |