3 dnl Copyright (C) 2002,2003,2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
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)
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.
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.
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.
27 AC_INIT(util-vserver-pl, 0.3, support@planet-lab.org)
28 AC_CONFIG_SRCDIR([python/vserverimpl.c])
29 AC_CONFIG_HEADER([config.h])
31 AM_INIT_AUTOMAKE([1.8.3 gnu dist-bzip2 subdir-objects])
37 # Checks for programs.
47 AC_ARG_VAR(CC, [The C compiler])
50 AC_CHECK_HEADERS([asm/types.h stdint.h], [ : ],
51 [ ensc_have_vserver=no ])
52 AC_CHECK_TYPES([xid_t], [ : ], [AC_DEFINE_UNQUOTED([xid_t], [uint32_t],
53 [Define this to an unsigned integer type])],
54 [AC_INCLUDES_DEFAULT()
55 #ifdef HAVE_ASM_TYPES_H
56 # include <asm/types.h>
58 AC_CHECK_TYPES([nid_t], [ : ], [AC_DEFINE_UNQUOTED([nid_t], [uint32_t],
59 [Define this to an unsigned integer type])],
60 [AC_INCLUDES_DEFAULT()
61 #ifdef HAVE_ASM_TYPES_H
62 # include <asm/types.h>
64 AC_CHECK_TYPES([tag_t], [ : ], [AC_DEFINE_UNQUOTED([tag_t], [uint32_t],
65 [Define this to an unsigned integer type])],
66 [AC_INCLUDES_DEFAULT()
67 #ifdef HAVE_ASM_TYPES_H
68 # include <asm/types.h>
71 AC_CHECK_HEADER([vserver.h], [ : ],
72 [ AC_MSG_ERROR([No vserver.h found!]) ])
74 AC_CHECK_LIB(vserver, vc_ctx_create, [ : ],
75 [ AC_MSG_ERROR([No libvserver found!]) ])
82 if test x"$ensc_have_libnl" = xyes; then
83 AC_CHECK_HEADERS([asm/types.h stdint.h], [ : ],
84 [ ensc_have_libnl=no ])
85 AC_CHECK_TYPES([__s64], [ : ], [AC_DEFINE_UNQUOTED([__s64], [int64_t],
86 [Define this to a signed 64-bit integer type])],
87 [AC_INCLUDES_DEFAULT()
88 #ifdef HAVE_ASM_TYPES_H
89 # include <asm/types.h>
91 AC_CHECK_TYPES([__u64], [ : ], [AC_DEFINE_UNQUOTED([__u64], [uint64_t],
92 [Define this to an unsigned 64-bit integer type])],
93 [AC_INCLUDES_DEFAULT()
94 #ifdef HAVE_ASM_TYPES_H
95 # include <asm/types.h>
99 if test x"$ensc_have_libnl" = xyes; then
100 AC_CHECK_HEADERS([netlink/netlink.h netlink/route/addr.h], [ : ],
101 [ ensc_have_libnl=no ], [AC_INCLUDES_DEFAULT()
102 #ifdef HAVE_ASM_TYPES_H
103 # include <asm/types.h>
108 if test x"$ensc_have_libnl" = xyes; then
109 AC_CHECK_LIB(nl, nl_handle_alloc_cb, [
110 AC_DEFINE(HAVE_LIBNL_1_1, [],
111 [Define this to use the libnl 1.1 API])],
112 [AC_CHECK_LIB(nl, nlmsg_get_src,
113 [AC_DEFINE(HAVE_LIBNL_1_0, [],
114 [Define this to use the libnl 1.0-pre6 API])],
115 [ensc_have_libnl=no])])
118 if test x"$ensc_have_libnl" != xyes; then
121 **** 'libnl' could not be found;
122 **** this will disable the build of 'vip6-autod'
126 AM_CONDITIONAL(ENSC_HAVE_LIBNL, test x"$ensc_have_libnl" = xyes)
129 dnl libnl stuff ends here}
131 dnl #######################
134 dnl Get python includes
137 AC_MSG_CHECKING([for python includes])
138 PYTHON_INCLUDES=`python-config --includes 2>/dev/null`
139 if test x"$PYTHON_INCLUDES" = x; then
140 python_inc_plat=`$PYTHON -c "from distutils.sysconfig import get_python_inc; print get_python_inc(1)"`
141 python_inc=`$PYTHON -c "from distutils.sysconfig import get_python_inc; print get_python_inc()"`
142 if test x"$python_inc_plat" != x; then
143 PYTHON_INCLUDES="$PYTHON_INCLUDES -I$python_inc_plat"
145 if test x"$python_inc" != x; then
146 PYTHON_INCLUDES="$PYTHON_INCLUDES -I$python_inc"
149 AC_MSG_RESULT([$PYTHON_INCLUDES])
150 AC_SUBST(PYTHON_INCLUDES)
154 dnl Figure out util-vserver directories
158 PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin"
160 AC_MSG_CHECKING([for vserver-Rootdir])
161 DEFAULT_VSERVERDIR=`vserver-info 2>/dev/null | awk '$1 == "vserver-Rootdir:" { print $2 }'`
162 if test x"$DEFAULT_VSERVERDIR" = x; then
163 AC_MSG_ERROR([No vserver-Rootdir could be found!])
165 AC_MSG_RESULT([$DEFAULT_VSERVERDIR])
166 AC_DEFINE_UNQUOTED([DEFAULT_VSERVERDIR], ["$DEFAULT_VSERVERDIR"],
167 [Define this to the path where your guests live])
169 AC_MSG_CHECKING([for util-vserver-vars])
170 UV_PREFIX=`vserver-info 2>/dev/null | awk '$1 == "prefix:" { print $2 }'`
171 UV_PKGLIBDIR=`echo "$UV_PREFIX"/lib*/util-vserver`
172 if test x"$UV_PREFIX" = x -o ! -d "$UV_PKGLIBDIR" -o ! -r "$UV_PKGLIBDIR/util-vserver-vars"; then
173 AC_MSG_ERROR([No util-vserver-vars could be found in $UV_PKGLIBDIR])
175 AC_MSG_RESULT([$UV_PKGLIBDIR])
176 AC_SUBST(UV_PKGLIBDIR)
182 AC_DEFINE_UNQUOTED([LOCALSTATEDIR], ["$localstatedir"],
183 [Define this to the local state directory])
184 AC_ARG_WITH([initrddir], [AC_HELP_STRING([--with-initrddir <DIR>],
185 [use <DIR> as directory for SysV init-files (default: $sysconfdir/init.d)])],
187 yes|no) AC_MSG_ERROR(['$withval' is not a valid value for '--with-initrddir']);;
188 *) sysvdir="$withval";;
190 [sysvdir="${sysconfdir}/init.d"])
194 AC_DEFINE(_FILE_OFFSET_BITS, [64], [Use 64bit interface for filesystem operations])
196 AC_CONFIG_FILES([Makefile])