diff options
author | Ralf Wildenhues <Ralf.Wildenhues@gmx.de> | 2008-03-26 07:00:44 +0100 |
---|---|---|
committer | Ralf Wildenhues <Ralf.Wildenhues@gmx.de> | 2008-03-26 07:24:59 +0100 |
commit | e19a2988bbd78fa046159ded5075ca4358e437b3 (patch) | |
tree | e4626381f9f1c4c741cfd2c8f77766972a7cd5cb /m4/cond-if.m4 | |
parent | bfb846498ca08e33dc7448a6b618cab360a12921 (diff) | |
download | automake-e19a2988bbd78fa046159ded5075ca4358e437b3.tar.gz |
Implement conditional AC_CONFIG_FILES: AM_COND_IF.
* automake.in (%ac_config_files_condition): New.
(scan_autoconf_config_files): Record condition if any.
(scan_autoconf_traces): Trace _AM_COND_IF, _AM_COND_ELSE,
_AM_COND_ENDIF, updating @cond_stack as appropriate.
(handle_configure): Prefix config.status rule with condition.
Check that m4 quotation is done consistently.
* m4/cond.m4 (AM_CONDITION): Define `_AM_COND_VALUE_name'
with `name' being the name of the condition, to its shell
condition.
* m4/cond-if.m4: New file.
(_AM_COND_IF, _AM_COND_ELSE, _AM_COND_ENDIF): New trace helpers.
(AM_COND_IF): New macro, implements conditionals.
* m4/Makefile.am: Adjust.
* doc/automake.texi (Requirements, Optional, Conditionals):
Document AM_COND_IF.
* NEWS: Update.
* tests/cond39.test, tests/cond40.test, tests/cond41.test,
tests/cond42.test, tests/cond43.test: New tests.
* tests/Makefile.am: Adjust.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Diffstat (limited to 'm4/cond-if.m4')
-rw-r--r-- | m4/cond-if.m4 | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/m4/cond-if.m4 b/m4/cond-if.m4 new file mode 100644 index 000000000..9f2611ecb --- /dev/null +++ b/m4/cond-if.m4 @@ -0,0 +1,39 @@ +# AM_COND_IF -*- Autoconf -*- + +# Copyright (C) 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# _AM_COND_IF +# _AM_COND_ELSE +# _AM_COND_ENDIF +# -------------- +# These macros are only used for tracing. +m4_define([_AM_COND_IF]) +m4_define([_AM_COND_ELSE]) +m4_define([_AM_COND_ENDIF]) + + +# AM_COND_IF(COND, [IF-TRUE], [IF-FALSE]) +# --------------------------------------- +# If the shell condition matching COND is true, execute IF-TRUE, +# otherwise execute IF-FALSE. Allow automake to learn about conditional +# instantiating macros (the AC_CONFIG_FOOS). +AC_DEFUN([AM_COND_IF], +[m4_ifndef([_AM_COND_VALUE_$1], + [m4_fatal([$0: no such condition "$1"])])dnl +_AM_COND_IF([$1])dnl +if _AM_COND_VALUE_$1; then + m4_default([$2], [:]) +m4_ifval([$3], +[_AM_COND_ELSE([$1])dnl +else + $3 +])dnl +_AM_COND_ENDIF([$1])dnl +fi[]dnl +]) |