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
62 AC_MSG_CHECKING([whether a debugging version is requested])
63 if test $DODBG -eq 1; then
65 if test $ISSERVER -eq 1; then
66 AC_MSG_ERROR([You requested both syslog logging and a debugging version of the server. Bad idea!])
68 AC_DEFINE(DODBG,1,[Define if you want a debugging version of nbd-server (lots of copious output)])
69 AC_DEFINE(NOFORK,1,[Define if you don't want the nbd-server to fork()])
81 AC_CHECK_SIZEOF(unsigned short int)
82 AC_CHECK_SIZEOF(unsigned int)
83 AC_CHECK_SIZEOF(unsigned long int)
84 AC_CHECK_SIZEOF(unsigned long long int)
85 AC_CHECK_FUNCS([llseek alarm gethostbyname inet_ntoa memset socket strerror strstr])
87 AC_FUNC_SETVBUF_REVERSED
88 AC_MSG_CHECKING(whether client should be built)
90 linux*) sbin_PROGRAMS=nbd-client
93 *) AC_MSG_RESULT(no) ;;
95 AC_MSG_CHECKING(where to find a working nbd.h)
96 AC_TRY_COMPILE([#define u32 int
102 [int foo=NBD_CMD_DISC],
103 [AC_DEFINE(NBD_H_LOCAL, 1, Set to 1 if a (2.6) nbd.h can be found in the current directory)
105 AC_TRY_COMPILE([#define u32 int
109 #include <linux/nbd.h>
111 [int foo=NBD_CMD_DISC],
112 [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)
113 NBD_H='<linux/nbd.h>'],
114 AC_TRY_COMPILE([#include <linux/nbd.h>
116 [int foo=NBD_CMD_DISC],
117 [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)
118 NBD_H='<linux/nbd.h>'],
119 AC_MSG_ERROR(Could not find an nbd.h from 2.6 or above.)
125 if test "$NBD_H" = '<linux/nbd.h>'
127 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])
130 AC_MSG_RESULT($NBD_H)
131 AC_SEARCH_LIBS(bind, socket,, AC_MSG_ERROR([Could not find an implementation of the bind() system call]))
132 AC_SEARCH_LIBS(inet_ntoa, nsl,, AC_MSG_ERROR([Could not find an implementation of the inet_ntoa() system call]))
133 AC_SEARCH_LIBS(daemon, resolv,, AC_MSG_ERROR([Could not find an implementation of the daemon() system call]))
134 AC_CHECK_HEADERS([sys/mount.h],,,
135 [[#include <sys/param.h>
137 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h syslog.h])
138 AM_PATH_GLIB_2_0(2.6.0, [HAVE_GLIB=yes], AC_MSG_ERROR([Missing glib]))
142 AC_SUBST(sbin_PROGRAMS)
143 nbd_server_CPPFLAGS=$nbd_server_CPPFLAGS" -DSYSCONFDIR='\"$sysconfdir\"'"
144 AC_SUBST(nbd_server_CPPFLAGS)
145 AC_CONFIG_HEADERS([config.h])
146 AC_CONFIG_FILES([Makefile Doxyfile nbd-server.1 nbd-server.5])