Merge branch 'maint'
[platform/upstream/automake.git] / m4 / cond.m4
1 # AM_CONDITIONAL                                            -*- Autoconf -*-
2
3 # Copyright (C) 1997-2012 Free Software Foundation, Inc.
4 #
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # serial 10
10
11 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
12 # -------------------------------------
13 # Define a conditional.
14 AC_DEFUN([AM_CONDITIONAL],
15 [AC_PREREQ([2.52])dnl
16  m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
17        [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
18 AC_SUBST([$1_TRUE])dnl
19 AC_SUBST([$1_FALSE])dnl
20 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
21 _AM_SUBST_NOTMAKE([$1_FALSE])dnl
22 m4_define([_AM_COND_VALUE_$1], [$2])dnl
23 if $2; then
24   $1_TRUE=
25   $1_FALSE='#'
26 else
27   $1_TRUE='#'
28   $1_FALSE=
29 fi
30 AC_CONFIG_COMMANDS_PRE(
31 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
32   AC_MSG_ERROR([[conditional "$1" was never defined.
33 Usually this means the macro was only invoked conditionally.]])
34 fi])])