61b7660fb2d9772b9359701a0e91f69c1f3d60ab
[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
4 AC_INIT([nbd],[2.7.99pre2.8],[wouter@debian.org])
5 AM_INIT_AUTOMAKE()
6
7 AC_ARG_ENABLE(
8   lfs,
9   AS_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   AS_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_MSG_CHECKING(whether warnings should be enabled)
50 if test -n "$GCC" ; then
51   AC_MSG_RESULT(yes)
52   #CFLAGS="$CFLAGS -Wall -W -Wno-parentheses -Wstrict-prototypes -Wno-unused"
53 else
54   AC_MSG_RESULT(no)
55 fi
56 AC_PROG_INSTALL
57 AC_C_BIGENDIAN
58 AC_C_INLINE
59 AC_C_CONST
60 AC_CHECK_SIZEOF(unsigned short int)
61 AC_CHECK_SIZEOF(unsigned int)
62 AC_CHECK_SIZEOF(unsigned long int)
63 AC_CHECK_SIZEOF(unsigned long long int)
64 AC_CHECK_FUNCS([llseek alarm gethostbyname inet_ntoa memset socket strerror strstr])
65 AC_FUNC_FORK
66 AC_FUNC_SETVBUF_REVERSED
67 AC_MSG_CHECKING(whether client should be built)
68 case "`uname`" in
69      *Linux*) sbin_PROGRAMS=nbd-client
70               AC_MSG_RESULT(yes)
71               ;;
72      *) AC_MSG_RESULT(no) ;;
73 esac
74 AC_MSG_CHECKING(whether there is a local nbd.h)
75 if test -f nbd.h; then
76   AC_DEFINE(HAVE_LOCAL_NBD_H,1, [Define to 1 if you want to use a local nbd.h (not provided, must be supplied by you)])
77   AC_MSG_RESULT(yes)
78 else
79   AC_MSG_RESULT(no)
80 fi
81 AC_CHECK_HEADERS([linux/nbd.h],,,
82 [[#define u32 unsigned int
83 #define u64 unsigned long int
84 ]])
85 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/ioctl.h sys/mount.h sys/socket.h syslog.h])
86 AM_PATH_GLIB_2_0(2.2.3, [HAVE_GLIB=yes], AC_MSG_ERROR([Missing glib]))
87 AC_HEADER_SYS_WAIT
88 AC_TYPE_OFF_T
89 AC_TYPE_PID_T
90 AC_SUBST(sbin_PROGRAMS)
91 AC_CONFIG_HEADERS([config.h])
92 AC_CONFIG_FILES([Makefile])
93 AC_OUTPUT
94