Imported Upstream version 3.1.0
[debian/amanda] / config / amanda / components.m4
1 # SYNOPSIS
2 #
3 #   AMANDA_CHECK_COMPONENTS
4 #
5 # OVERVIEW
6 #
7 #   Defines --without-client, --without-server, --without-restore, and 
8 #   --without-amrecover, and checks the results.
9 #
10 #   Sets the AM_CONDITIONALs WANT_CLIENT, WANT_SERVER, WANT_RESTORE, 
11 #   and WANT_RECOVER.
12 #   
13 #   AM_CONDITIONAL WANT_TAPE is set if either server or restore support is
14 #   being built.
15 #
16 AC_DEFUN([AMANDA_CHECK_COMPONENTS], [
17     AC_REQUIRE([AMANDA_WITHOUT_SERVER])
18     AC_REQUIRE([AMANDA_WITHOUT_CLIENT])
19     AC_REQUIRE([AMANDA_WITHOUT_RESTORE])
20     AC_REQUIRE([AMANDA_WITHOUT_AMRECOVER])
21     AC_REQUIRE([AMANDA_WITH_CLIENT_ONLY]) dnl deprecated
22     AC_REQUIRE([AMANDA_WITH_SERVER_ONLY]) dnl deprecated
23     AC_REQUIRE([AMANDA_WITHOUT_NDMP])
24
25     # detect invalid combinations of components
26     if ! ${WANT_SERVER-true} && ${WANT_RESTORE-true}; then
27         AC_MSG_ERROR([--without-server requires --without-restore])
28     fi
29     if ! ${WANT_CLIENT-true} && ${WANT_RECOVER-true}; then
30         AC_MSG_ERROR([--without-client requires --without-amrecover])
31     fi
32
33     AM_CONDITIONAL(WANT_CLIENT, $WANT_CLIENT)
34     AM_CONDITIONAL(WANT_RESTORE, $WANT_RESTORE)
35     AM_CONDITIONAL(WANT_SERVER, $WANT_SERVER)
36     AM_CONDITIONAL(WANT_RECOVER, $WANT_RECOVER)
37     AM_CONDITIONAL(WANT_NDMP, $WANT_NDMP)
38
39     AM_CONDITIONAL(WANT_TAPE, $WANT_SERVER || $WANT_RESTORE)
40
41     # AMANDA_COMPONENTS goes to Amanda::Constants; missing_components is just for the
42     # summary, below
43     AMANDA_COMPONENTS=''
44     missing_components=''
45
46     if $WANT_SERVER; then
47         AMANDA_COMPONENTS="$AMANDA_COMPONENTS server";
48     else
49         missing_components="$missing_components (no server)";
50     fi
51     if $WANT_RESTORE; then
52         AMANDA_COMPONENTS="$AMANDA_COMPONENTS restore";
53     else
54         missing_components="$missing_components (no restore)";
55     fi
56     if $WANT_CLIENT; then
57         AMANDA_COMPONENTS="$AMANDA_COMPONENTS client";
58     else
59         missing_components="$missing_components (no client)";
60     fi
61     if $WANT_RECOVER; then
62         AMANDA_COMPONENTS="$AMANDA_COMPONENTS amrecover";
63     else
64         missing_components="$missing_components (no amrecover)";
65     fi
66     if $WANT_NDMP; then
67         AMANDA_COMPONENTS="$AMANDA_COMPONENTS ndmp";
68     else
69         missing_components="$missing_components (no ndmp)";
70     fi
71
72     AC_SUBST(AMANDA_COMPONENTS)
73 ])
74
75
76 # SYNOPSIS
77 #
78 #   AMANDA_WITHOUT_SERVER
79 #
80 # OVERVIEW
81 #
82 #   Add option --without-server, and set WANT_SERVER to true or false, 
83 #   accordingly.
84 #
85 AC_DEFUN([AMANDA_WITHOUT_SERVER], [
86     WANT_SERVER=true
87     AC_ARG_WITH(server,
88         AS_HELP_STRING([--without-server], [do not build server stuff (set --without-restore)]), [
89             case "$withval" in
90             y | ye | yes) WANT_SERVER=true;;
91             n | no) WANT_SERVER=false;;
92             *) AC_MSG_ERROR([You must not supply an argument to the --without-server option.]) ;;
93             esac
94     ])
95 ])
96
97 # SYNOPSIS
98 #
99 #   AMANDA_WITHOUT_CLIENT
100 #
101 # OVERVIEW
102 #
103 #   Add option --without-client, and set WANT_CLIENT to true or false, 
104 #   accordingly.
105 #
106 AC_DEFUN([AMANDA_WITHOUT_CLIENT], [
107     WANT_CLIENT=true
108     AC_ARG_WITH(client,
109         AS_HELP_STRING([--without-client], [do not build client stuff]), [
110             case "$withval" in
111             y | ye | yes) WANT_CLIENT=true;;
112             n | no) WANT_CLIENT=false;;
113             *) AC_MSG_ERROR([You must not supply an argument to the --without-client option.]) ;;
114             esac
115     ])
116 ])
117
118 # SYNOPSIS
119 #
120 #   AMANDA_WITHOUT_RESTORE
121 #
122 # OVERVIEW
123 #
124 #   Add option --without-restore, and set WANT_RESTORE to true or false, 
125 #   accordingly.
126 #
127 AC_DEFUN([AMANDA_WITHOUT_RESTORE], [
128     AC_REQUIRE([AMANDA_WITHOUT_SERVER])
129     WANT_RESTORE=${WANT_SERVER-true}
130     AC_ARG_WITH(restore,
131         AS_HELP_STRING([--without-restore], [do not build amrestore nor amidxtaped]), [
132             case "$withval" in
133             y | ye | yes) WANT_RESTORE=true;;
134             n | no) WANT_RESTORE=false;;
135             *) AC_MSG_ERROR([You must not supply an argument to --with-restore option.]) ;;
136             esac
137     ])
138 ])
139
140 # SYNOPSIS
141 #
142 #   AMANDA_WITHOUT_AMRECOVER
143 #
144 # OVERVIEW
145 #
146 #   Add option --without-amrecover, and set WANT_RECOVER (not WANT_AMRECOVER) to
147 #   true or false, accordingly.
148 #
149 AC_DEFUN([AMANDA_WITHOUT_AMRECOVER], [
150     AC_REQUIRE([AMANDA_WITHOUT_CLIENT])
151     WANT_RECOVER=${WANT_CLIENT-true}
152     AC_ARG_WITH(amrecover,
153         AS_HELP_STRING([--without-amrecover],
154                        [do not build amrecover]), [
155             case "$withval" in
156             y | ye | yes) WANT_RECOVER=true;;
157             n | no) WANT_RECOVER=false;;
158             *) AC_MSG_ERROR([You must not supply an argument to --with-amrecover option.]) ;;
159             esac
160         ])
161 ])
162
163 # SYNOPSIS
164 #
165 #   AMANDA_WITHOUT_NDMP
166 #
167 # OVERVIEW
168 #
169 #   Add option --without-ndmp, and set WANT_NDMP to
170 #   true or false, accordingly.
171 #
172 AC_DEFUN([AMANDA_WITHOUT_NDMP], [
173     WANT_NDMP=${WANT_NDMP-true}
174     AC_ARG_WITH(ndmp,
175         AS_HELP_STRING([--without-ndmp],
176                        [do not build ndmp]), [
177             case "$withval" in
178             y | ye | yes) WANT_NDMP=true;;
179             n | no) WANT_NDMP=false;;
180             *) AC_MSG_ERROR([You must not supply an argument to --with-ndmp option.]) ;;
181             esac
182         ])
183 ])
184
185 ## deprecated --with-* options
186
187 AC_DEFUN([AMANDA_WITH_CLIENT_ONLY], [
188     AC_ARG_WITH(client-only,
189         AS_HELP_STRING([--with-client-only], [deprecated: use --without-server]),
190         [   AC_MSG_ERROR([--with-client-only is deprecated, use --without-server instead.])
191         ])
192 ],)
193
194 AC_DEFUN([AMANDA_WITH_SERVER_ONLY], [
195     AC_ARG_WITH(server-only,
196         AS_HELP_STRING([--with-server-only], [deprecated: use --without-client]),
197         [   AC_MSG_ERROR([--with-server-only is deprecated, use --without-client instead.])
198         ],)
199 ])
200
201 # SYNOPSIS
202 #
203 #   AMANDA_SHOW_COMPONENTS_SUMMARY
204 #
205 # OVERVIEW
206 #
207 #   Show a summary of the settings from this file.
208 #
209 AC_DEFUN([AMANDA_SHOW_COMPONENTS_SUMMARY],
210 [
211     echo "Amanda Components:$AMANDA_COMPONENTS$missing_components"
212 ])