Get rid of the context on vuserdel.
[util-vserver-pl.git] / configure.ac
1 dnl $Id$
2
3 dnl Copyright (C) 2002,2003,2004 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; either version 2, or (at your option)
8 dnl any later version.
9 dnl  
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl GNU General Public License for more details.
14 dnl  
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program; if not, write to the Free Software
17 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 dnl  
19 dnl  
20 dnl As a special exception to the GNU General Public License, if you
21 dnl distribute this file as part of a program that contains a configuration
22 dnl script generated by Autoconf, you may include it under the same
23 dnl distribution terms that you use for the rest of that program.
24 dnl  
25
26 AC_PREREQ(2.57)
27 AC_INIT(util-vserver-pl, 0.1, support@planet-lab.org)
28 AC_CONFIG_SRCDIR([python/vserverimpl.c])
29 AC_CONFIG_HEADER([config.h])
30
31 AM_INIT_AUTOMAKE([1.8.3 gnu dist-bzip2 subdir-objects])
32 AM_MAINTAINER_MODE
33
34 AC_CANONICAL_BUILD
35 AC_CANONICAL_HOST
36
37 # Checks for programs.
38 AC_PROG_CC
39 AC_PROG_INSTALL
40 AC_PROG_LN_S
41 AM_PROG_CC_C_O
42 AC_DISABLE_STATIC
43 AC_PROG_LIBTOOL
44 AM_PATH_PYTHON(2.3)
45
46 AC_ARG_VAR(CC, [The C compiler])
47
48
49 AC_CHECK_HEADERS([asm/types.h stdint.h], [ : ],
50                  [ ensc_have_vserver=no ])
51 AC_CHECK_TYPES([xid_t], [ : ], [AC_DEFINE_UNQUOTED([xid_t], [uint32_t],
52         [Define this to an unsigned integer type])],
53         [AC_INCLUDES_DEFAULT()
54 #ifdef HAVE_ASM_TYPES_H
55 #  include <asm/types.h>
56 #endif])
57 AC_CHECK_TYPES([nid_t], [ : ], [AC_DEFINE_UNQUOTED([nid_t], [uint32_t],
58         [Define this to an unsigned integer type])],
59         [AC_INCLUDES_DEFAULT()
60 #ifdef HAVE_ASM_TYPES_H
61 #  include <asm/types.h>
62 #endif])
63 AC_CHECK_TYPES([tag_t], [ : ], [AC_DEFINE_UNQUOTED([tag_t], [uint32_t],
64         [Define this to an unsigned integer type])],
65         [AC_INCLUDES_DEFAULT()
66 #ifdef HAVE_ASM_TYPES_H
67 #  include <asm/types.h>
68 #endif])
69
70 AC_CHECK_HEADER([vserver.h], [ : ],
71                 [ AC_MSG_ERROR([No vserver.h found!]) ])
72
73 AC_CHECK_LIB(vserver, vc_ctx_create, [ : ],
74              [ AC_MSG_ERROR([No libvserver found!]) ])
75
76 dnl {check for libnl
77 dnl
78
79 ensc_have_libnl=yes
80 LIBNL_ROOT=`readlink -f ../libnl*/`
81 if test -d "$LIBNL_ROOT"; then
82         CFLAGS="$CFLAGS -I ${LIBNL_ROOT}/include"
83         LDFLAGS="$LDFLAGS -L${LIBNL_ROOT}/lib"
84 fi
85
86 if test x"$ensc_have_libnl" = xyes; then
87         AC_CHECK_HEADERS([asm/types.h stdint.h], [ : ],
88                          [ ensc_have_libnl=no ])
89         AC_CHECK_TYPES([__s64], [ : ], [AC_DEFINE_UNQUOTED([__s64], [int64_t],
90                 [Define this to a signed 64-bit integer type])],
91                 [AC_INCLUDES_DEFAULT()
92 #ifdef HAVE_ASM_TYPES_H
93 #  include <asm/types.h>
94 #endif])
95         AC_CHECK_TYPES([__u64], [ : ], [AC_DEFINE_UNQUOTED([__u64], [uint64_t],
96                 [Define this to an unsigned 64-bit integer type])],
97                 [AC_INCLUDES_DEFAULT()
98 #ifdef HAVE_ASM_TYPES_H
99 #  include <asm/types.h>
100 #endif])
101 fi
102
103 if test x"$ensc_have_libnl" = xyes; then
104         AC_CHECK_HEADERS([netlink/netlink.h netlink/route/addr.h], [ : ],
105                          [ ensc_have_libnl=no ], [AC_INCLUDES_DEFAULT()
106 #ifdef HAVE_ASM_TYPES_H
107 #  include <asm/types.h>
108 #endif]
109                 )
110 fi
111
112 if test x"$ensc_have_libnl" = xyes; then
113         AC_CHECK_LIB(nl, nlmsg_get_src, [ : ],
114                      [ ensc_have_libnl=no ])
115 fi
116
117 if test x"$ensc_have_libnl" != xyes; then
118         AC_MSG_WARN([
119 ****
120 **** 'libnl' could not be found;
121 **** this will disable the build of 'vip6-autod'
122 ****])
123 fi
124
125 AM_CONDITIONAL(ENSC_HAVE_LIBNL, test x"$ensc_have_libnl" = xyes)
126
127 dnl
128 dnl libnl stuff ends here}
129 dnl
130 dnl #######################
131
132 dnl
133 dnl Get python includes
134 dnl
135
136 AC_MSG_CHECKING([for python includes])
137 PYTHON_INCLUDES=`python-config --includes 2>/dev/null`
138 if test x"$PYTHON_INCLUDES" = x; then
139         python_inc_plat=`$PYTHON -c "from distutils.sysconfig import get_python_inc; print get_python_inc(1)"`
140         python_inc=`$PYTHON -c "from distutils.sysconfig import get_python_inc; print get_python_inc()"`
141         if test x"$python_inc_plat" != x; then
142                 PYTHON_INCLUDES="$PYTHON_INCLUDES -I$python_inc_plat"
143         fi
144         if test x"$python_inc" != x; then
145                 PYTHON_INCLUDES="$PYTHON_INCLUDES -I$python_inc"
146         fi
147 fi
148 AC_MSG_RESULT([$PYTHON_INCLUDES])
149 AC_SUBST(PYTHON_INCLUDES)
150
151
152 dnl
153 dnl Figure out util-vserver directories
154 dnl
155
156 old_PATH="$PATH"
157 PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin"
158
159 AC_MSG_CHECKING([for vserver-Rootdir])
160 DEFAULT_VSERVERDIR=`vserver-info 2>/dev/null | awk '$1 == "vserver-Rootdir:" { print $2 }'`
161 if test x"$DEFAULT_VSERVERDIR" = x; then
162         AC_MSG_ERROR([No vserver-Rootdir could be found!])
163 fi
164 AC_MSG_RESULT([$DEFAULT_VSERVERDIR])
165 AC_DEFINE_UNQUOTED([DEFAULT_VSERVERDIR], ["$DEFAULT_VSERVERDIR"],
166                    [Define this to the path where your guests live])
167
168 AC_MSG_CHECKING([for util-vserver-vars])
169 UV_PREFIX=`vserver-info 2>/dev/null | awk '$1 == "prefix:" { print $2 }'`
170 UV_PKGLIBDIR=`echo "$UV_PREFIX"/lib*/util-vserver`
171 if test x"$UV_PREFIX" = x -o ! -d "$UV_PKGLIBDIR" -o ! -r "$UV_PKGLIBDIR/util-vserver-vars"; then
172         AC_MSG_ERROR([No util-vserver-vars could be found in $UV_PKGLIBDIR])
173 fi
174 AC_MSG_RESULT([$UV_PKGLIBDIR])
175 AC_SUBST(UV_PKGLIBDIR)
176
177
178 PATH="$old_PATH"
179
180
181 AC_DEFINE_UNQUOTED([LOCALSTATEDIR], ["$localstatedir"],
182                    [Define this to the local state directory])
183 AC_ARG_WITH([initrddir], [AC_HELP_STRING([--with-initrddir <DIR>],
184         [use <DIR> as directory for SysV init-files (default: $sysconfdir/init.d)])],
185         [case "$withval" in
186                 yes|no) AC_MSG_ERROR(['$withval' is not a valid value for '--with-initrddir']);;
187                 *)      sysvdir="$withval";;
188          esac],
189         [sysvdir="${sysconfdir}/init.d"])
190 AC_SUBST(sysvdir)
191
192
193 AC_DEFINE(_FILE_OFFSET_BITS, [64], [Use 64bit interface for filesystem operations])
194
195 AC_CONFIG_FILES([util-vserver-pl.spec Makefile])
196 AC_OUTPUT