root/trunk/configure.ac

Revision 547, 5.8 kB (checked in by hollow, 2 years ago)

first part of client unification

Line 
1 # Copyright 2006-2007 Benedikt Böhm <hollow@gentoo.org>
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the
15 # Free Software Foundation, Inc.,
16 # 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
18 # Generic configuration
19 AC_PREREQ(2.59)
20 AC_INIT(vcd, 1.0_pre1, hollow@gentoo.org)
21 AC_GNU_SOURCE
22
23 AC_CANONICAL_BUILD
24 AC_CANONICAL_HOST
25 AC_CANONICAL_TARGET
26
27 # Automake
28 AM_INIT_AUTOMAKE([1.9 gnu dist-bzip2])
29 AM_MAINTAINER_MODE
30
31 # Checks for programs.
32 AC_PROG_CC
33 AM_PROG_CC_C_O
34 AC_PROG_LIBTOOL
35 AC_PROG_INSTALL
36 AC_PROG_LN_S
37 AC_PROG_MAKE_SET
38
39 # Parts to build
40 AC_ARG_ENABLE([server],
41               [AC_HELP_STRING([--disable-server],
42                               [Disable the VServer Control Daemon])],
43               [case "${enableval}" in
44                 yes) enable_server=true;;
45                 no)  enable_server=false;;
46                 *)   AC_MSG_ERROR(bad value ${enableval} for --enable-server);;
47               esac],
48               [enable_server=true])
49 AM_CONDITIONAL(ENABLE_SERVER, test x$enable_server = xtrue)
50
51 AC_ARG_ENABLE([client],
52               [AC_HELP_STRING([--disable-client],
53                               [Disable the VServer Control Client])],
54               [case "${enableval}" in
55                 yes) enable_client=true;;
56                 no)  enable_client=false;;
57                 *)   AC_MSG_ERROR(bad value ${enableval} for --enable-client);;
58               esac],
59               [enable_client=true])
60 AM_CONDITIONAL(ENABLE_CLIENT, test x$enable_client = xtrue)
61
62 # Checks for libraries.
63 # syscalls not in glibc < 2.4
64 AC_CHECK_FUNCS([fchmodat fchownat linkat mkdirat openat symlinkat])
65
66 # confuse
67 AC_PATH_PROG(CONFUSE_CONFIG, confuse-config)
68 if test -z "$CONFUSE_CONFIG"; then
69         AC_MSG_ERROR([confuse-config not found])
70 fi
71
72 CONFUSE_LIBS="$($CONFUSE_CONFIG --libs)"
73
74 AC_SUBST(CONFUSE_LIBS)
75
76 # lucid
77 AC_CHECK_LIB(ucid, str_path_concat,
78         LUCID_LIBS="-lucid", AC_MSG_ERROR([lucid not found]),)
79
80 AC_SUBST(LUCID_LIBS)
81
82 AC_DEFINE(_LUCID_PRINTF_MACROS)
83 AC_DEFINE(_LUCID_SCANF_MACROS)
84
85 # vserver
86 AC_CHECK_LIB(vserver, vx_stat,
87         VSERVER_LIBS="-lvserver", AC_MSG_ERROR([libvserver >= 2.0 not found]),)
88
89 AC_SUBST(VSERVER_LIBS)
90
91 # xmlrpc-c
92 AC_PATH_PROG(XMLRPC_C_CONFIG, xmlrpc-c-config)
93 if test -z "$XMLRPC_C_CONFIG"; then
94         AC_MSG_ERROR([xmlrpc-c-config not found])
95 fi
96
97 XMLRPC_C_VERSION="$($XMLRPC_C_CONFIG --version)"
98 XMLRPC_C_MAJOR="${XMLRPC_C_VERSION/.*}"
99 XMLRPC_C_MINOR="${XMLRPC_C_VERSION#*.}"
100 XMLRPC_C_MINOR="${XMLRPC_C_MINOR/.*}"
101
102 AC_MSG_CHECKING([for xmlrpc-c >= 1.05])
103
104 if test $XMLRPC_C_MAJOR -lt 1; then
105         AC_MSG_ERROR([xmlrpc-c-$XMLRPC_VERSION does not match])
106 fi
107
108 if test $XMLRPC_C_MAJOR -eq 1 && test $XMLRPC_C_MINOR -lt 05; then
109         AC_MSG_ERROR([xmlrpc-c-$XMLRPC_VERSION does not match])
110 fi
111
112 AC_MSG_RESULT([found])
113
114 XMLRPC_C_CLIENT_LIBS="$($XMLRPC_C_CONFIG client --libs)"
115 XMLRPC_C_SERVER_LIBS="$($XMLRPC_C_CONFIG abyss-server --libs)"
116
117 if test -z "$XMLRPC_C_CLIENT_LIBS"; then
118         AC_MSG_ERROR([no xmlrpc-c client library found])
119 fi
120
121 AC_SUBST(XMLRPC_C_CLIENT_LIBS)
122 AC_SUBST(XMLRPC_C_SERVER_LIBS)
123
124 # util
125 if test x$enable_client = xtrue; then
126 AC_CHECK_FUNC(openpty, UTIL_LIBS="",[
127         AC_CHECK_LIB(util, openpty, UTIL_LIBS="-lutil", AC_MSG_ERROR([libutil not found]))
128 ])
129
130 AC_SUBST(UTIL_LIBS)
131 fi
132
133 # sqlite3
134 if test x$enable_server = xtrue; then
135 AC_CHECK_LIB(sqlite3, sqlite3_open,
136         SQLITE3_LIBS="-lsqlite3", AC_MSG_ERROR([sqlite3 not found]))
137
138 AC_SUBST(SQLITE3_LIBS)
139 fi
140
141 # Checks for header files.
142
143 # Checks for typedefs, structures, and compiler characteristics.
144 AC_C_CONST
145 AC_C_INLINE
146
147 # Compiler settings
148 CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE"
149 CFLAGS="${CFLAGS} -std=gnu99 -pedantic"
150 CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-qual -Winline"
151 CFLAGS="${CFLAGS} -Wredundant-decls -Wcast-align -Wno-unused-parameter"
152
153 # Site settings
154 AC_MSG_CHECKING([for vserver base directory])
155 AC_ARG_WITH([vbasedir],
156             [AC_HELP_STRING([--with-vbasedir=DIR],
157                             [vserver base directory (default: /vservers)])],
158             [vbasedir=$withval],
159             [vbasedir=/vservers])
160 AC_MSG_RESULT([$vbasedir])
161
162 AC_SUBST(vbasedir)
163
164 PATH_CPPFLAGS="$PATH_CPPFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
165 PATH_CPPFLAGS="$PATH_CPPFLAGS -DPKGDATADIR='\"\$(pkgdatadir)\"'"
166 PATH_CPPFLAGS="$PATH_CPPFLAGS -DVBASEDIR='\"\$(vbasedir)\"'"
167 PATH_CPPFLAGS="$PATH_CPPFLAGS -DLOCALSTATEDIR='\"\$(localstatedir)\"'"
168
169 AC_SUBST(PATH_CPPFLAGS)
170
171 # Final info page
172 AC_CONFIG_COMMANDS_PRE([SUMMARY="$PACKAGE_STRING configured successfully:
173
174                        CC: $CC ($($CC --version | head -n1))
175                  CPPFLAGS: '$CPPFLAGS'
176                    CFLAGS: '$CFLAGS'
177                     build: $build
178                      host: $host
179                    target: $target
180
181                    prefix: $prefix
182                sysconfdir: $sysconfdir
183                  vbasedir: $vbasedir
184             localstatedir: $localstatedir
185 "])
186
187 # Output
188 AC_CONFIG_FILES([Makefile
189                  doc/Makefile
190                  src/vcc/vcc/Makefile
191                  src/vcc/vcdadm/Makefile
192                  src/vcc/vce/Makefile
193                  src/vcc/vgc/Makefile
194                  src/vcc/Makefile
195                  src/vcd/methods/Makefile
196                  src/vcd/Makefile
197                  src/vshelper/Makefile
198                  src/vxpasswd/Makefile
199                  src/Makefile
200                  syscall/Makefile
201                  test/Makefile])
202
203 AC_OUTPUT
204
205 AC_MSG_NOTICE([$SUMMARY])
Note: See TracBrowser for help on using the browser.