Blame view

am/enable.m4 2.82 KB
1
dnl This file is part of GNU mailutils.
2 3
dnl Copyright (C) 2002, 2005, 2007, 2009, 2010 Free Software Foundation,
dnl Inc.
4
dnl
5
dnl GNU Mailutils is free software; you can redistribute it and/or modify
6
dnl it under the terms of the GNU General Public License as published by
7
dnl the Free Software Foundation; either version 3 of the License, or
8 9
dnl (at your option) any later version.
dnl
10
dnl GNU Mailutils is distributed in the hope that it will be useful,
11 12 13 14 15
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
16
dnl along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
17

18
dnl MU_ENABLE_SUPPORT(feature, [action-if-true], [action-if-false],
19
dnl                   [default-value])
20 21

AC_DEFUN([MU_ENABLE_SUPPORT], [
22 23
	pushdef([mu_upcase],translit($1,[a-z+-],[A-ZX_]))
	pushdef([mu_cache_var],[mu_cv_enable_]translit($1,[+-],[x_]))
24
	pushdef([mu_cond],[MU_COND_SUPPORT_]mu_upcase)
25

26
	AC_ARG_ENABLE($1, 
27 28 29 30
	              AC_HELP_STRING([--disable-]$1,
		                     [disable ]$1[ support]),
	              [
	case "${enableval}" in
31 32
		yes) mu_cache_var=yes;;
                no)  mu_cache_var=no;;
33
	        *)   AC_MSG_ERROR([bad value ${enableval} for --disable-$1]) ;;
34
        esac],
35
                      [mu_cache_var=ifelse([$4],,yes,[$4])])
36

37
	if test "[$]mu_cache_var" = "yes"; then
38
		ifelse([$2],,:,[$2])
39
	ifelse([$3],,,else
40
               [$3])
41
	fi
42
	if test "[$]mu_cache_var" = "yes"; then
43 44
		AC_DEFINE([ENABLE_]mu_upcase,1,[Define this if you enable $1 support])
        fi
45
	AM_CONDITIONAL(mu_cond, [test "[$]mu_cache_var" = "yes"])
46
	popdef([mu_cond])
47
	popdef([mu_cache_var])
48
	popdef([mu_upcase])
49 50
])

51 52
dnl MU_ENABLE_BUILD(feature, [action-if-true], [action-if-false],
dnl                 [additional-cond], [default-value])
53 54 55 56 57 58 59 60 61 62 63 64 65 66
AC_DEFUN([MU_ENABLE_BUILD], [
	pushdef([mu_upcase],translit($1,[a-z+-],[A-ZX_]))
	pushdef([mu_cache_var],[mu_cv_enable_build_]translit($1,[+-],[x_]))
	pushdef([mu_cond],[MU_COND_]mu_upcase)

	AC_ARG_ENABLE(build-$1, 
	              AC_HELP_STRING([--disable-build-]$1,
		                     [do not build ]$1),
	              [
	case "${enableval}" in
		yes) mu_cache_var=yes;;
                no)  mu_cache_var=no;;
	        *)   AC_MSG_ERROR([bad value ${enableval} for --disable-$1]) ;;
        esac],
67
                      [mu_cache_var=ifelse([$5],,yes,[$5])])
68

69
	if test "[$]mu_cache_var" = "yes"; then
70 71 72 73
		ifelse([$2],,:,[$2])
	ifelse([$3],,,else
               [$3])
	fi
74
	if test "[$]mu_cache_var" = "yes"; then
75 76 77
		AC_DEFINE([MU_BUILD_]mu_upcase,1,[Define this if you build $1])
        fi
	AM_CONDITIONAL(mu_cond,
78
	               [test "[$]mu_cache_var" = "yes"])
79 80 81 82 83
	
	popdef([mu_upcase])
	popdef([mu_cache_var])
	popdef([mu_cond])
])
84 85