initial checkin
[util-vserver.git] / util-vserver / m4 / ensc_dietlibc.m4
1 dnl $Id$
2
3 dnl Copyright (C) 2002 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
4 dnl  
5 dnl This program 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; version 2 of the License.
8 dnl  
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl  
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 dnl Usage: ENSC_ENABLE_DIETLIBC(<conditional>)
19 dnl        <conditional> ... automake-conditional which will be set when
20 dnl                          dietlibc shall be enabled
21
22 AC_DEFUN(ENSC_ENABLE_DIETLIBC,
23 [
24         AC_MSG_CHECKING([whether to enable dietlibc])
25         AC_ARG_ENABLE([dietlibc],
26                       [AC_HELP_STRING([--disable-dietlibc],
27                                       [do not use dietlibc (default: use dietlibc)])],
28                       [case "$withval" in
29                           yes)  use_dietlibc=forced;;
30                           no)   use_dietlibc=forced_no;;
31                           *)    AC_MSG_ERROR(['$withval' is not a valid value for --enable-dietlibc]);;
32                        esac],
33                       [: ${DIET:=diet}
34                        which "$DIET" >/dev/null 2>/dev/null && use_dietlibc=detected || use_dietlibc=detected_no])
35
36         case x"$use_dietlibc" in
37             xdetected)
38                 AM_CONDITIONAL($1, true)
39                 AC_MSG_RESULT([yes (autodetected)])
40                 ;;
41             xforced)
42                 AM_CONDITIONAL($1, true)
43                 AC_MSG_RESULT([yes (forced)])
44                 ;;
45             xdetected_no)
46                 AM_CONDITIONAL($1, false)
47                 AC_MSG_RESULT([no (detected)])
48                 ;;
49             xforced_no)
50                 AM_CONDITIONAL($1, false)
51                 AC_MSG_RESULT([no (forced)])
52                 ;;
53             *)
54                 AC_MSG_ERROR([internal error, use_dietlibc was "$use_dietlibc"])
55                 ;;
56         esac
57 ])