summaryrefslogtreecommitdiff
path: root/am/enable.m4
blob: 82e872dad1011df6412bd3f2a1214097dcf170d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
dnl This file is part of GNU mailutils.
dnl Copyright (C) 2002-2019 Free Software Foundation, Inc.
dnl
dnl GNU Mailutils is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl GNU Mailutils is distributed in the hope that it will be useful,
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
dnl along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.

dnl MU_ENABLE_SUPPORT(feature, [action-if-true], [action-if-false],
dnl                   [additional-cond], [default-value])

AC_DEFUN([MU_ENABLE_SUPPORT], [
	m4_pushdef([mu_upcase],m4_translit($1,[a-z+-],[A-ZX_]))
	m4_pushdef([mu_cache_var],[mu_cv_enable_]m4_translit($1,[+-],[x_]))
	m4_pushdef([mu_cond],[MU_COND_SUPPORT_]mu_upcase)

       	m4_if([$4],,,[if test $4; then])
	  AC_ARG_ENABLE($1, 
	                AC_HELP_STRING([--disable-]$1,
		                       [disable ]$1[ support]),
	                [
	  case "${enableval}" in
		yes) mu_cache_var=yes;;
                no)  mu_cache_var=no;;
	        *)   AC_MSG_ERROR([bad value ${enableval} for --disable-$1]) ;;
          esac],
                      [mu_cache_var=m4_if([$5],,yes,[$5])])

	  if test "[$]mu_cache_var" = "yes"; then
		  m4_if([$2],,:,[$2])
 	  m4_if([$3],,,else
                 [$3])
	  fi
	m4_if([$4],,,[else
		mu_cache_var=no
        fi])
	if test "[$]mu_cache_var" = "yes"; then
		AC_DEFINE([ENABLE_]mu_upcase,1,[Define this if you enable $1 support])
        fi
	AM_CONDITIONAL(mu_cond, [test "[$]mu_cache_var" = "yes"])
	m4_popdef([mu_cond])
	m4_popdef([mu_cache_var])
	m4_popdef([mu_upcase])
])

dnl MU_ENABLE_BUILD(feature, [action-if-true], [action-if-false],
dnl                 [additional-cond], [default-value], [listvar])
AC_DEFUN([MU_ENABLE_BUILD], [
	m4_pushdef([mu_upcase],m4_translit($1,[a-z+-],[A-ZX_]))
	m4_pushdef([mu_cache_var],[mu_cv_enable_build_]m4_translit($1,[+-],[x_]))
	m4_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],
                      [m4_if([$4],,[mu_cache_var=m4_if([$5],,yes,[$5])],
		              [if test $4; then
			         mu_cache_var=yes
			       else
			         mu_cache_var=no
			       fi])])

	if test "[$]mu_cache_var" = "yes"; then
		  m4_if([$2],,:,[$2])
		  m4_if([$6],,,[$6="$[]$6 $1"])
	m4_if([$3],,,else
               [$3])
	fi
	if test "[$]mu_cache_var" = "yes"; then
	  AC_DEFINE([MU_BUILD_]mu_upcase,1,[Define this if you build $1])
        fi
	  
	AM_CONDITIONAL(mu_cond,
	               [test "[$]mu_cache_var" = "yes"])
	
	m4_popdef([mu_upcase])
	m4_popdef([mu_cache_var])
	m4_popdef([mu_cond])
])

AC_CONFIG_COMMANDS_PRE([
AC_SUBST([MU_LIB_LOCAL_MAILBOX])
AC_SUBST([MU_LIB_REMOTE_MAILBOX])
AC_SUBST([MU_LIB_MAILBOX],['$(MU_LIB_LOCAL_MAILBOX) $(MU_LIB_REMOTE_MAILBOX)'])
])

dnl MU_ENABLE_MAILBOX_FORMAT([CATEGORY], [SCHEME],
dnl                   [action-if-true], [action-if-false],
dnl                   [additional-cond], [default-value])

AC_DEFUN([MU_ENABLE_MAILBOX_FORMAT], [
 m4_pushdef([LIBNAME],[[MU_LIB_]translit($2,[a-z+-],[A-ZX_])])
 AC_SUBST(LIBNAME)
 MU_ENABLE_SUPPORT([$2],
  [LIBNAME='${top_builddir}/libproto/$2/libmu_$2.la'
   $3],
  m4_shift(m4_shift(m4_shift($@))))
  AC_CONFIG_FILES([libproto/$2/Makefile])
  m4_syscmd([test -f libproto/$2/tests/Makefile.am -a -f libproto/$2/tests/atlocal.in])
  m4_if(sysval,0,[MU_CONFIG_TESTSUITE([libproto/$2])])
  [MU_LIB_]$1[_MAILBOX]="${[MU_LIB_]$1[_MAILBOX]} \$(LIBNAME)"
  m4_popdef([LIBNAME])
])

AC_DEFUN([MU_ENABLE_LOCAL_MAILBOX_FORMAT],
 [MU_ENABLE_MAILBOX_FORMAT([LOCAL],$@)])

AC_DEFUN([MU_ENABLE_REMOTE_MAILBOX_FORMAT],
 [MU_ENABLE_MAILBOX_FORMAT([REMOTE],$@)])

Return to:

Send suggestions and report system problems to the System administrator.