8c7b902b5708b61d2c0806f9405d6d9982f44e6a
[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
24     # detect invalid combinations of components
25     if ! ${WANT_SERVER-true} && ${WANT_RESTORE-true}; then
26         AC_MSG_ERROR([--without-server requires --without-restore])
27     fi
28     if ! ${WANT_CLIENT-true} && ${WANT_RECOVER-true}; then
29         AC_MSG_ERROR([--without-client requires --without-amrecover])
30     fi
31
32     AM_CONDITIONAL(WANT_CLIENT, $WANT_CLIENT)
33     AM_CONDITIONAL(WANT_RESTORE, $WANT_RESTORE)
34     AM_CONDITIONAL(WANT_SERVER, $WANT_SERVER)
35     AM_CONDITIONAL(WANT_RECOVER, $WANT_RECOVER)
36
37     AM_CONDITIONAL(WANT_TAPE, $WANT_SERVER || $WANT_RESTORE)
38 ])
39
40
41 # SYNOPSIS
42 #
43 #   AMANDA_WITHOUT_SERVER
44 #
45 # OVERVIEW
46 #
47 #   Add option --without-server, and set WANT_SERVER to true or false, 
48 #   accordingly.
49 #
50 AC_DEFUN([AMANDA_WITHOUT_SERVER], [
51     WANT_SERVER=true
52     AC_ARG_WITH(server,
53         AS_HELP_STRING([--without-server], [do not build server stuff (set --without-restore)]), [
54             case "$withval" in
55             y | ye | yes) WANT_SERVER=true;;
56             n | no) WANT_SERVER=false;;
57             *) AC_MSG_ERROR([You must not supply an argument to the --without-server option.]) ;;
58             esac
59     ])
60 ])
61
62 # SYNOPSIS
63 #
64 #   AMANDA_WITHOUT_CLIENT
65 #
66 # OVERVIEW
67 #
68 #   Add option --without-client, and set WANT_CLIENT to true or false, 
69 #   accordingly.
70 #
71 AC_DEFUN([AMANDA_WITHOUT_CLIENT], [
72     WANT_CLIENT=true
73     AC_ARG_WITH(client,
74         AS_HELP_STRING([--without-client], [do not build client stuff]), [
75             case "$withval" in
76             y | ye | yes) WANT_CLIENT=true;;
77             n | no) WANT_CLIENT=false;;
78             *) AC_MSG_ERROR([You must not supply an argument to the --without-client option.]) ;;
79             esac
80     ])
81 ])
82
83 # SYNOPSIS
84 #
85 #   AMANDA_WITHOUT_RESTORE
86 #
87 # OVERVIEW
88 #
89 #   Add option --without-restore, and set WANT_RESTORE to true or false, 
90 #   accordingly.
91 #
92 AC_DEFUN([AMANDA_WITHOUT_RESTORE], [
93     AC_REQUIRE([AMANDA_WITHOUT_SERVER])
94     WANT_RESTORE=${WANT_SERVER-true}
95     AC_ARG_WITH(restore,
96         AS_HELP_STRING([--without-restore], [do not build amrestore nor amidxtaped]), [
97             case "$withval" in
98             y | ye | yes) WANT_RESTORE=true;;
99             n | no) WANT_RESTORE=false;;
100             *) AC_MSG_ERROR([You must not supply an argument to --with-restore option.]) ;;
101             esac
102     ])
103 ])
104
105 # SYNOPSIS
106 #
107 #   AMANDA_WITHOUT_AMRECOVER
108 #
109 # OVERVIEW
110 #
111 #   Add option --without-amrecover, and set WANT_RECOVER (not WANT_AMRECOVER) to
112 #   true or false, accordingly.
113 #
114 AC_DEFUN([AMANDA_WITHOUT_AMRECOVER], [
115     AC_REQUIRE([AMANDA_WITHOUT_CLIENT])
116     WANT_RECOVER=${WANT_CLIENT-true}
117     AC_ARG_WITH(amrecover,
118         AS_HELP_STRING([--without-amrecover],
119                        [do not build amrecover]), [
120             case "$withval" in
121             y | ye | yes) WANT_RECOVER=false;;
122             n | no) WANT_RECOVER=false;;
123             *) AC_MSG_ERROR([You must not supply an argument to --with-amrecover option.]) ;;
124             esac
125         ])
126 ])
127
128 ## deprecated --with-* options
129
130 AC_DEFUN([AMANDA_WITH_CLIENT_ONLY], [
131     AC_ARG_WITH(client-only,
132         AS_HELP_STRING([--with-client-only], [deprecated: use --without-server]),
133         [   AC_MSG_ERROR([--with-client-only is deprecated, use --without-server instead.])
134         ])
135 ],)
136
137 AC_DEFUN([AMANDA_WITH_SERVER_ONLY], [
138     AC_ARG_WITH(server-only,
139         AS_HELP_STRING([--with-server-only], [deprecated: use --without-client]),
140         [   AC_MSG_ERROR([--with-server-only is deprecated, use --without-client instead.])
141         ],)
142 ])
143
144 # SYNOPSIS
145 #
146 #   AMANDA_SHOW_COMPONENTS_SUMMARY
147 #
148 # OVERVIEW
149 #
150 #   Show a summary of the settings from this file.
151 #
152 AC_DEFUN([AMANDA_SHOW_COMPONENTS_SUMMARY],
153 [
154     components=''
155     if $WANT_SERVER; then
156         components="$components server";
157     else 
158         components="$components (no server)";
159     fi
160     if $WANT_RESTORE; then
161         components="$components restore";
162     else 
163         components="$components (no restore)";
164     fi
165     if $WANT_CLIENT; then
166         components="$components client";
167     else 
168         components="$components (no client)";
169     fi
170     if $WANT_RECOVER; then
171         components="$components amrecover";
172     else 
173         components="$components (no amrecover)";
174     fi
175
176     echo "Amanda Components: $components"
177 ])