1 dnl Configure script for NBD system
2 dnl (c) 1998 Martin Mares <mj@ucw.cz>, (c) 2000 Pavel Machek <pavel@ucw.cz>,
3 dnl (c) 2003-2006 Wouter Verhelst <wouter@debian.org>
4 AC_INIT([nbd],[SVN],[wouter@debian.org])
5 AM_INIT_AUTOMAKE(foreign dist-bzip2)
10 AC_HELP_STRING(--disable-lfs,Disable Large File Support (default on)),
12 if test "x$enableval" = "xyes" ; then
20 AC_MSG_CHECKING([whether Large File Support should be enabled])
21 if test $NBD_LFS -eq 1; then
22 AC_DEFINE(NBD_LFS,1, [Define to 1 if Large File Support should be enabled])
31 AC_HELP_STRING(--enable-syslog,Enable Syslog logging),
33 if test "x$enableval" = "xyes" ; then
42 AC_MSG_CHECKING([whether syslog logging is requested])
43 if test $ISSERVER -eq 1; then
44 AC_DEFINE(ISSERVER,1, [Define to 1 if you want nbd-server to log through syslog])
52 AC_HELP_STRING(--enable-debug,Build a debugging version of the server),
54 if test "x$enableval" = "xyes"; then
63 AC_MSG_CHECKING([whether a debugging version is requested])
64 if test $DODBG -eq 1; then
66 if test $ISSERVER -eq 1; then
67 AC_MSG_ERROR([You requested both syslog logging and a debugging version of the server. Bad idea!])
69 AC_DEFINE(DODBG,1,[Define if you want a debugging version of nbd-server (lots of copious output)])
70 AC_DEFINE(NOFORK,1,[Define if you don't want the nbd-server to fork()])
77 AC_HELP_STRING(--enable-sdp,Build a version of nbd-server with support for the Socket Direct Protocol (SDP). Requires you to build and install a kernel with the InfiniBand patches (default disabled)),
79 if test "x$enableval" = "xyes"; then
80 AC_DEFINE(WITH_SDP, 1, [Define to 1 if you have and want support for the Socket Direct Protocol])
85 AC_MSG_CHECKING(for klcc)
88 AC_HELP_STRING(--with-klcc,[Build a version of nbd-client against klibc (for initramfs uses). Specify the path to 'klcc' (default autodetected)]),
90 if test "x$withval" != "x"; then
91 if test -x "$withval"; then
93 sbin_PROGRAMS=knbd-client
96 if test "$withval" = "no"; then
98 AC_MSG_RESULT(Disabled)
100 AC_MSG_ERROR([specified klcc ($withval) is not executable or does not exist.])
104 if test -x /usr/bin/klcc; then
106 sbin_PROGRAMS=knbd-client
109 AC_MSG_ERROR([klcc not found! Please specify it as a parameter to the --with-klcc option]);
113 [ if test -x /usr/bin/klcc; then
114 sbin_PROGRAMS=knbd-client
118 AC_MSG_RESULT(not found)
131 AC_CHECK_SIZEOF(unsigned short int)
132 AC_CHECK_SIZEOF(unsigned int)
133 AC_CHECK_SIZEOF(unsigned long int)
134 AC_CHECK_SIZEOF(unsigned long long int)
135 AC_CHECK_FUNCS([llseek alarm gethostbyname inet_ntoa memset socket strerror strstr])
137 AC_FUNC_SETVBUF_REVERSED
138 AC_MSG_CHECKING(whether client should be built)
140 linux*) sbin_PROGRAMS="$sbin_PROGRAMS nbd-client"
143 *) AC_MSG_RESULT(no) ;;
145 AC_MSG_CHECKING(where to find a working nbd.h)
146 AC_TRY_COMPILE([#define u32 int
152 #define UNUSED __attribute__((__unused__))
157 [int UNUSED foo=NBD_CMD_DISC],
158 [AC_DEFINE(NBD_H_LOCAL, 1, Set to 1 if a (2.6) nbd.h can be found in the current directory)
160 AC_TRY_COMPILE([#define u32 int
164 #include <linux/nbd.h>
166 #define UNUSED __attribute__((__unused__))
171 [int UNUSED foo=NBD_CMD_DISC],
172 [AC_DEFINE(NBD_H_LINUX, 1, Set to 1 if a (2.6) nbd.h can be found in the linux directory in the search path)
173 NBD_H='<linux/nbd.h>'],
174 AC_TRY_COMPILE([#include <linux/nbd.h>
176 #define UNUSED __attribute__((__unused__))
181 [int UNUSED foo=NBD_CMD_DISC],
182 [AC_DEFINE(NBD_H_LINUX, 1, Set to 1 if a (2.6) nbd.h can be found in the linux directory in the search path)
183 NBD_H='<linux/nbd.h>'],
184 AC_MSG_ERROR(Could not find an nbd.h from 2.6 or above.)
190 if test "$NBD_H" = '<linux/nbd.h>'
192 AC_MSG_WARN([there is a local nbd.h, but it is from the 2.4-series of kernels. Using the system-provided, working, nbd.h])
195 AC_MSG_RESULT($NBD_H)
196 AC_SEARCH_LIBS(bind, socket,, AC_MSG_ERROR([Could not find an implementation of the bind() system call]))
197 AC_SEARCH_LIBS(inet_ntoa, nsl,, AC_MSG_ERROR([Could not find an implementation of the inet_ntoa() system call]))
198 AC_SEARCH_LIBS(daemon, resolv,, AC_MSG_ERROR([Could not find an implementation of the daemon() system call]))
199 AC_CHECK_HEADERS([sys/mount.h],,,
200 [[#include <sys/param.h>
202 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h syslog.h])
203 AM_PATH_GLIB_2_0(2.6.0, [HAVE_GLIB=yes], AC_MSG_ERROR([Missing glib]))
207 AC_SUBST(sbin_PROGRAMS)
208 nbd_server_CPPFLAGS=$nbd_server_CPPFLAGS" -DSYSCONFDIR='\"$sysconfdir\"'"
209 AC_SUBST(nbd_server_CPPFLAGS)
210 AC_CONFIG_HEADERS([config.h])
211 AC_CONFIG_FILES([Makefile Doxyfile nbd-server.1 nbd-server.5])