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