File: configure.ac

package info (click to toggle)
nbd 1:3.20-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 5,960 kB
  • sloc: ansic: 7,494; sh: 6,496; makefile: 147
file content (379 lines) | stat: -rw-r--r-- 10,981 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
dnl Configure script for NBD system
dnl (c) 1998 Martin Mares <mj@ucw.cz>, (c) 2000 Pavel Machek <pavel@ucw.cz>,
dnl (c) 2003-2006 Wouter Verhelst <wouter@debian.org>
AC_INIT([nbd],
  [3.18],
  [nbd@other.debian.org],,
  [http://nbd.sourceforge.net/])
m4_define([serial_tests], [
  m4_esyscmd([automake --version |
              head -1 |
              awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
  ])
])
AM_INIT_AUTOMAKE(foreign dist-xz serial_tests subdir-objects)
AM_MAINTAINER_MODE([enable])
AM_SILENT_RULES([yes])
AC_CONFIG_MACRO_DIR([support])
LT_INIT

AC_ARG_ENABLE(
  lfs,
  AC_HELP_STRING(--disable-lfs,Disable Large File Support (default on)),
  [
    if test "x$enableval" = "xyes" ; then
      NBD_LFS=1
    else
      NBD_LFS=0
    fi
  ],
  [NBD_LFS=1]
)
AC_MSG_CHECKING([whether Large File Support should be enabled])
if test $NBD_LFS -eq 1; then
  AC_DEFINE(NBD_LFS,1, [Define to 1 if Large File Support should be enabled])
  AC_MSG_RESULT([yes])
else
  AC_DEFINE(NBD_LFS,0)
  AC_MSG_RESULT([no])
fi

AC_ARG_ENABLE(
  syslog,
  AC_HELP_STRING(--enable-syslog,Enable Syslog logging),
  [
    if test "x$enableval" = "xyes" ; then
      ISSERVER=1
    else
      ISSERVER=0
    fi
  ],
  [ISSERVER=0]
)

AC_MSG_CHECKING([whether syslog logging is requested])
if test $ISSERVER -eq 1; then
  AC_DEFINE(ISSERVER,1, [Define to 1 if you want nbd-server to log through syslog])
  AC_MSG_RESULT([yes])
else
  AC_MSG_RESULT([no])
fi

AC_ARG_ENABLE(
  debug,
  AC_HELP_STRING(--enable-debug,Build a debugging version of the server),
  [
    if test "x$enableval" = "xyes"; then
      DODBG=1
    else
      DODBG=0
    fi
  ],
  [DODBG=0]
)

AC_MSG_CHECKING([whether a debugging version is requested])
if test $DODBG -eq 1; then
  AC_MSG_RESULT([yes])
  if test $ISSERVER -eq 1; then
    AC_MSG_ERROR([You requested both syslog logging and a debugging version of the server. Bad idea!])
  fi
  AC_DEFINE(DODBG,1,[Define if you want a debugging version of nbd-server (lots of copious output)])
  AC_DEFINE(NOFORK,1,[Define if you do not want the nbd-server to fork()])
else
  AC_MSG_RESULT([no])
fi

AC_ARG_ENABLE(
  sdp,
  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)),
  [
    if test "x$enableval" = "xyes"; then
      AC_DEFINE(WITH_SDP, 1, [Define to 1 if you have and want support for the Socket Direct Protocol])
    fi
  ]
)

AC_ARG_ENABLE(
  [gznbd],
  [AS_HELP_STRING([--enable-gznbd],[Build gznbd too (nbd server with on-the-fly decompression of images. NOTE: no support for newstyle protocol.)])],
  [
    AS_IF(
      [test "x$enableval" = "xyes"],
      [ENABLE_GZNBD=yes],
      [ENABLE_GZNBD=no]
    )
  ],
  [ENABLE_GZNBD=no]
)

AC_PROG_CC_C99
AC_PROG_CPP
AC_PROG_INSTALL
PKG_PROG_PKG_CONFIG
AC_CANONICAL_HOST
AC_C_BIGENDIAN
AC_C_INLINE
AC_C_CONST
AC_CHECK_SIZEOF(unsigned short int)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long int)
AC_CHECK_SIZEOF(unsigned long long int)
AC_STRUCT_DIRENT_D_TYPE
AC_CHECK_FUNCS([llseek alarm gethostbyname inet_ntoa memset socket strerror strstr mkstemp fdatasync])
HAVE_FL_PH=no

AC_CHECK_FUNC(fallocate,
  [
    AC_CHECK_HEADERS([linux/falloc.h])
    if test "x$ac_cv_header_linux_falloc_h" = "xyes"
    then
      AC_CHECK_DECL(FALLOC_FL_PUNCH_HOLE, [HAVE_FL_PH=yes], [HAVE_FL_PH=no], [[#include <linux/falloc.h>]])
    fi
  ]
)

AC_MSG_CHECKING([for FALLOC_FL_PUNCH_HOLE support])
if test "x$HAVE_FL_PH" = "xyes"
then
	AC_DEFINE(HAVE_FALLOC_PH, 1, [Define to 1 if you have FALLOC_FL_PUNCH_HOLE])
	AC_MSG_RESULT([yes])
else
	AC_DEFINE(HAVE_FALLOC_PH, 0, [Define to 1 if you have FALLOC_FL_PUNCH_HOLE])
	AC_MSG_RESULT([no])
fi

AC_CHECK_DECL([BLKDISCARD], AC_DEFINE(HAVE_BLKDISCARD, 1, [Define to 1 if you have the BLKDISCARD ioctl]), AC_DEFINE(HAVE_BLKDISCARD, 0), [#include <linux/fs.h>])

AC_CHECK_FUNC(splice, [HAVE_SPLICE=yes], [HAVE_SPLICE=no])
if test "$HAVE_SPLICE" = "yes"
then
	HAVE_SETPIPE_SZ=no
	AC_CHECK_DECL(F_SETPIPE_SZ, [HAVE_SETPIPE_SZ=yes],
		[
			unset ac_cv_have_decl_F_SETPIPE_SZ
			AC_CHECK_HEADERS([linux/fcntl.h])
			if test "$ac_cv_header_linux_fcntl_h" = "yes"
			then
				AC_CHECK_DECL(F_SETPIPE_SZ, [HAVE_SETPIPE_SZ=define], [HAVE_SETPIPE_SZ=no], [[#include <linux/fcntl.h>]])
			fi
		],
		[[
			#define _GNU_SOURCE
			#include <fcntl.h>
		]]
	)
	AC_MSG_CHECKING([for F_SETPIPE_SZ support])
	case $HAVE_SETPIPE_SZ in
		yes)
			AC_DEFINE(HAVE_SPLICE, 1, [Define to 1 if we have splice support])
			AC_MSG_RESULT([yes])
		;;
		define)
			AC_DEFINE(HAVE_SPLICE, 1, [Define to 1 if we have splice support])
			AC_DEFINE(F_SETPIPE_SZ, 1031, [Define to 1031 if we have kernel support but no userspace support])
			AC_MSG_RESULT([yes])
		;;
		no)
			AC_MSG_RESULT([missing, disabling splice support])
		;;
	esac
fi

m4_ifndef([PKG_CHECK_MODULES], [m4_fatal([Missing pkg-config M4 macros. Please ensure that pkg-config is installed.])])

dnl AC_MSG_CHECKING([where to puth systemd unit files])
dnl AC_ARG_WITH(
dnl   systemd,
dnl   AS_HELP_STRING([--with-systemd=loc|pkgconfig],[Install systemd files in loc; if passing pkgconfig, use pkg-config to detect the correct location and install there.])
dnl   [
dnl     if test "x$enableval" = "xyes"; then
dnl       ENABLE_SYSTEMD=yes
dnl     else
dnl       ENABLE_SYSTEMD=no
dnl     fi
dnl   ],[]
dnl )
dnl 
dnl if test "x$ENABLE_SYSTEMD" != "xno"; then
dnl 	PKG_CHECK_VAR([SYSTEMDUNIT],[systemd],systemdsystemunitdir],[AC_SUBST([SYSTEMDLOC], [$SYSTEMDUNIT])])
dnl fi
dnl AM_CONDITIONAL(SYSTEMD, [test ! -z "$SYSTEMDUNIT"])
dnl if test ! -z $SYSTEMDUNIT; then
dnl 	AC_MSG_RESULT([$SYSTEMDUNIT])
dnl else
dnl 	case $ENABLE_SYSTEMD in
dnl 		no)
dnl 			AC_MSG_RESULT([disabled])
dnl 		;;
dnl 		yes)
dnl 			AC_MSG_ERROR([systemd not found])
dnl 		;;
dnl 		*)
dnl 			AC_MSG_RESULT([not found])
dnl 		;;
dnl 	esac
dnl fi

AC_ARG_WITH([gnutls],
	[AS_HELP_STRING([--without-gnutls],
		[do not use gnutls])],
	[],
	[with_gnutls=check]
)
if test "x$with_gnutls" != "xno"; then
	PKG_CHECK_MODULES(GnuTLS, [gnutls >= 2.12.0],
		[HAVE_GNUTLS=1
		AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if you have a GnuTLS version of 2.12 or above])],
		[if test "x$with_gnutls" = "xyes"; then
			AC_MSG_ERROR([--with-gnutls given but cannot find gnutls])
		else
			HAVE_GNUTLS=0
			AC_DEFINE(HAVE_GNUTLS, 0)
		fi]
	)
else
	HAVE_GNUTLS=0
	AC_DEFINE(HAVE_GNUTLS, 0)
fi
AM_CONDITIONAL([GNUTLS], [test "x$HAVE_GNUTLS" = "x1"])

AC_CHECK_HEADERS([winioctl.h], [], [],
[#include <io.h>
#include <windef.h>
#include <winbase.h>
])
HAVE_FSCTL_SET_ZERO_DATA=no
if test "x$ac_cv_header_winioctl_h" = "xyes"
then
        AC_CHECK_DECL(FSCTL_SET_ZERO_DATA, [HAVE_FSCTL_SET_ZERO_DATA=yes], [HAVE_FSCTL_SET_ZERO_DATA=no],
        [#include <windef.h>
        #include <winbase.h>
        #include <winioctl.h>
        ])
fi
if test "x$HAVE_FSCTL_SET_ZERO_DATA" = "xyes"
then
        AC_DEFINE(HAVE_FSCTL_SET_ZERO_DATA, 1, [Define to 1 if you have FSCTL_SET_ZERO_DATA])
else
        AC_DEFINE(HAVE_FSCTL_SET_ZERO_DATA, 0, [Define to 1 if you have FSCTL_SET_ZERO_DATA])
fi

AC_CHECK_FUNC([sync_file_range],
	[AC_DEFINE([HAVE_SYNC_FILE_RANGE], [sync_file_range(2) is not supported], [sync_file_range(2) is supported])],
        [])
AC_FUNC_FORK
AC_FUNC_SETVBUF_REVERSED
AC_MSG_CHECKING(whether client should be built)
AS_CASE([$host_os],
  [linux*], [NBD_CLIENT_NAME="nbd-client"; AC_MSG_RESULT(yes)],
  [NBD_CLIENT_NAME=""; AC_MSG_RESULT(no)]
)
AC_MSG_CHECKING(whether to expect tlshuge test to fail)
AS_CASE([$host_os],
  [darwin*], [RUN_XFAIL=tlshuge; AC_MSG_RESULT(yes)],
  [RUN_XFAIL=""; AC_MSG_RESULT(no)]
)
AC_SUBST([RUN_XFAIL])
AM_CONDITIONAL(CLIENT, [test ! -z "$NBD_CLIENT_NAME"])
AC_SEARCH_LIBS(bind, socket,, AC_MSG_ERROR([Could not find an implementation of the bind() system call]))
AC_SEARCH_LIBS(inet_ntoa, nsl,, AC_MSG_ERROR([Could not find an implementation of the inet_ntoa() system call]))
AC_SEARCH_LIBS(daemon, resolv,, AC_MSG_ERROR([Could not find an implementation of the daemon() system call]))
AC_CHECK_HEADERS([sys/mount.h],,,
[[#include <sys/param.h>
]])
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h syslog.h linux/types.h sys/dirent.h sys/uio.h])
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.26.0 gthread-2.0 >= 2.26.0], [HAVE_GLIB=yes], AC_MSG_ERROR([Missing glib]))

my_save_cflags="$CFLAGS"
CFLAGS="-Wdeprecated-declarations -Werror $GLIB_CFLAGS"
AC_MSG_CHECKING([if we are using an old glib 2.0 library])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
	[[#include <glib.h>]],
	[[g_thread_init(NULL);]])],
	[
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_OLD_GLIB, 1, [Define to 1 if you have an old glib library])
	],
	[
		AC_MSG_RESULT(no)
		AC_DEFINE(HAVE_OLD_GLIB, 0, [Define to 1 if you have an old glib library])
	]
)
CFLAGS="$my_save_cflags"

AC_MSG_CHECKING([whether _BSD_SOURCE needs to be defined for DT_* macros])
AC_PREPROC_IFELSE(
	[AC_LANG_PROGRAM([[#include <dirent.h>]],
			 [[#ifndef DT_UNKNOWN
#error nope
#endif]])],
	[AC_MSG_RESULT([no]); NEED_BSD_SOURCE=0],
	[AC_MSG_RESULT([yes]); NEED_BSD_SOURCE=1])
AC_DEFINE([NEED_BSD_SOURCE], $NEED_BSD_SOURCE, [Define to 1 if _BSD_SOURCE needs to be defined before certain inclusions])

AC_ARG_WITH([libnl],
	[AS_HELP_STRING([--without-libnl],
		[do not use libnl])],
	[],
	[with_libnl=check]
)
if test "x$with_libnl" != "xno"; then
	PKG_CHECK_MODULES(LIBNL3, libnl-genl-3.0 >= 3.1,
		[HAVE_NETLINK=1
		AC_DEFINE(HAVE_NETLINK, 1, [Define to 1 if we have netlink support])
		CFLAGS="$CFLAGS $LIBNL3_CFLAGS"
		LIBS="$LIBS $LIBNL3_LIBS"],
		[if test "x$with_libnl" = "xyes"; then
			AC_MSG_ERROR([--with-libnl given but cannot find libnl])
		else
			HAVE_NETLINK=0
			AC_DEFINE(HAVE_NETLINK, 0)
		fi]
	)
else
	HAVE_NETLINK=0
	AC_DEFINE(HAVE_NETLINK, 0, [Define to 1 if we have netlink support])
fi

AC_ARG_ENABLE([manpages],
	AS_HELP_STRING([--disable-manpages], [Do not install man pages]))
AM_CONDITIONAL(MANPAGES, test "x$enablemanpages" != "xno")
AS_IF([test "x$enable_manpages" != "xno"], [
	AC_SUBST([MAN_CONFIG_FILES],["\
		man/nbd-client.8.sh \
		man/nbd-server.5.sh \
		man/nbd-server.1.sh \
		man/nbd-trdump.1.sh \
		man/nbdtab.5.sh \
		"])
	])

AC_HEADER_SYS_WAIT
AC_TYPE_OFF_T
AC_TYPE_PID_T
AM_CPPFLAGS=$AM_CPPFLAGS" -DSYSCONFDIR='\"$sysconfdir\"'"
AC_SUBST(AM_CPPFLAGS)
AM_CONDITIONAL(GZNBD, [test "x$ENABLE_GZNBD" = "xyes"])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_LINKS([tests/run/buffer.c:buffer.c
		 tests/run/crypto-gnutls.c:crypto-gnutls.c
		 tests/run/cliserv.c:cliserv.c])
AC_CONFIG_FILES([Makefile
		 doc/Doxyfile
		 doc/Makefile
		 man/Makefile
		 gznbd/Makefile
		 tests/Makefile
		 tests/code/Makefile
		 tests/run/Makefile
                 man/nbd-client.8.sh
                 man/nbd-server.5.sh
                 man/nbd-server.1.sh
                 man/nbd-trdump.1.sh
                 man/nbdtab.5.sh
		 systemd/Makefile
		 systemd/nbd@.service.sh
		])
AC_OUTPUT