r80: Make it compile again
[nbd.git] / configure.ac
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-2004 Wouter Verhelst <wouter@debian.org>
4 AC_INIT([nbd],[2.7.99pre2.8],[wouter@debian.org])
5 AM_INIT_AUTOMAKE(foreign dist-bzip2)
6
7 AC_ARG_ENABLE(
8   lfs,
9   AC_HELP_STRING(--enable-lfs,Enable Large File Support),
10   [
11     if test "x$enableval" = "xyes" ; then
12       NBD_LFS=1
13     else
14       NBD_LFS=0
15     fi
16   ],
17   [NBD_LFS=0]
18 )
19 AC_MSG_CHECKING([whether Large File Support should be enabled])
20 if test $NBD_LFS -eq 1; then
21   AC_DEFINE(NBD_LFS,1, [Define to 1 if Large File Support should be enabled])
22   AC_MSG_RESULT([yes])
23 else
24   AC_DEFINE(NBD_LFS,0)
25   AC_MSG_RESULT([no])
26 fi
27
28 AC_ARG_ENABLE(
29   syslog,
30   AC_HELP_STRING(--enable-syslog,Enable Syslog logging),
31   [
32     if test "x$enableval" = "xyes" ; then
33       ISSERVER=1
34     else
35       ISSERVER=0
36     fi
37   ],
38   [ISSERVER=0]
39 )
40 AC_MSG_CHECKING([whether syslog logging is requested])
41 if test $ISSERVER -eq 1; then
42   AC_DEFINE(ISSERVER,1, [Define to 1 if you want nbd-server to log through syslog])
43   AC_MSG_RESULT([yes])
44 else
45   AC_MSG_RESULT([no])
46 fi
47
48 AC_PROG_CC
49 AC_PROG_CPP
50 AC_PROG_INSTALL
51 AC_C_BIGENDIAN
52 AC_C_INLINE
53 AC_C_CONST
54 AC_CHECK_SIZEOF(unsigned short int)
55 AC_CHECK_SIZEOF(unsigned int)
56 AC_CHECK_SIZEOF(unsigned long int)
57 AC_CHECK_SIZEOF(unsigned long long int)
58 AC_CHECK_FUNCS([llseek alarm gethostbyname inet_ntoa memset socket strerror strstr])
59 AC_FUNC_FORK
60 AC_FUNC_SETVBUF_REVERSED
61 AC_MSG_CHECKING(whether client should be built)
62 case "`uname`" in
63      *Linux*) sbin_PROGRAMS=nbd-client
64               AC_MSG_RESULT(yes)
65               ;;
66      *) AC_MSG_RESULT(no) ;;
67 esac
68 AC_MSG_CHECKING(where to find a working nbd.h)
69 dnl We need to check for NBD_CMD_DISC, but that's part of an enum, it is not
70 dnl #define'd. Therefore, we check for something which is differently #define'd
71 dnl in the old or new versions, even if we don't really care about that.
72 dnl This might break at some time, but it should work for now, so...
73 AC_TRY_CPP([#include "nbd.h"
74 #ifdef LOCAL_END_REQUEST
75 #error not here
76 #endif
77 ], 
78   [AC_DEFINE(NBD_H_LOCAL, 1, Set to 1 if a (recent enough) nbd.h can be found in the current directory)
79     NBD_H='"nbd.h"'],
80   AC_TRY_CPP([#include <linux/nbd.h>
81 #ifdef LOCAL_END_REQUEST
82 #error not here
83 #endif
84 ],
85     [AC_DEFINE(NBD_H_LINUX, 1, Set to 1 if a (recent enough) nbd.h can be found in the linux directory in the search path) NBD_H='<linux/nbd.h>'],
86     AC_MSG_ERROR(Could not find a (recent enough) nbd.h)
87   )
88 )
89 AC_MSG_RESULT($NBD_H)
90 AC_CHECK_HEADERS([sys/mount.h],,,
91 [[#include <sys/param.h>
92 ]])
93 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h syslog.h])
94 AM_PATH_GLIB_2_0(2.2.0, [HAVE_GLIB=yes], AC_MSG_ERROR([Missing glib]))
95 AC_HEADER_SYS_WAIT
96 AC_TYPE_OFF_T
97 AC_TYPE_PID_T
98 AC_SUBST(sbin_PROGRAMS)
99 AC_CONFIG_HEADERS([config.h])
100 AC_CONFIG_FILES([Makefile])
101 AC_OUTPUT
102