1# nbdkit
2# Copyright (C) 2013-2020 Red Hat Inc.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met:
7#
8# * Redistributions of source code must retain the above copyright
9# notice, this list of conditions and the following disclaimer.
10#
11# * Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14#
15# * Neither the name of Red Hat nor the names of its contributors may be
16# used to endorse or promote products derived from this software without
17# specific prior written permission.
18#
19# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
20# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
23# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30# SUCH DAMAGE.
31
32m4_define([NBDKIT_VERSION_MAJOR], [1])
33m4_define([NBDKIT_VERSION_MINOR], [20])
34m4_define([NBDKIT_VERSION_MICRO], [4])
35AC_INIT([nbdkit],
36        NBDKIT_VERSION_MAJOR.NBDKIT_VERSION_MINOR.NBDKIT_VERSION_MICRO)
37AC_CONFIG_MACRO_DIR([m4])
38m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],[],
39         [m4_define([AC_USE_SYSTEM_EXTENSIONS],[])])
40
41dnl This must be used very early else you will get
42dnl "warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS"
43AC_USE_SYSTEM_EXTENSIONS
44
45dnl NB: Do not [quote] this parameter.
46AM_INIT_AUTOMAKE(foreign)
47AC_PROG_LIBTOOL
48LT_INIT
49
50dnl List of plugins and filters.
51lang_plugins="\
52        golang \
53        lua \
54        ocaml \
55        perl \
56        python \
57        ruby \
58        rust \
59        sh \
60        tcl \
61        "
62non_lang_plugins="\
63        curl \
64        data \
65        eval \
66        example1 \
67        example2 \
68        example3 \
69        example4 \
70        ext2 \
71        file \
72        floppy \
73        full \
74        guestfs \
75        gzip \
76        info \
77        iso \
78        libvirt \
79        linuxdisk \
80        memory \
81        nbd \
82        null \
83        partitioning \
84        pattern \
85        random \
86        split \
87        ssh \
88        streaming \
89        tar \
90        tmpdisk \
91        vddk \
92        zero \
93        "
94plugins="$(echo $(printf %s\\n $lang_plugins $non_lang_plugins | sort -u))"
95filters="\
96        blocksize \
97        cache \
98        cacheextents \
99        cow \
100        delay \
101        error \
102        exitlast \
103        ext2 \
104        extentlist \
105        fua \
106        ip \
107        limit \
108        log \
109        nocache \
110        noextents \
111        nofilter \
112        noparallel \
113        nozero \
114        offset \
115        partition \
116        rate \
117        readahead \
118        retry \
119        stats \
120        truncate \
121        xz \
122        "
123AC_SUBST([plugins])
124AC_SUBST([lang_plugins])
125AC_SUBST([non_lang_plugins])
126AC_SUBST([filters])
127
128dnl Some very basic tools.
129AC_PROG_SED
130
131dnl Check for basic C environment.
132AC_PROG_CC_STDC
133AC_PROG_INSTALL
134AC_PROG_CPP
135AC_CANONICAL_HOST
136AC_SYS_LARGEFILE
137
138AC_C_PROTOTYPES
139test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
140
141AM_PROG_CC_C_O
142
143dnl Check for C++ (optional, we just use this to test the header
144dnl can be included from C++ code).
145AC_PROG_CXX
146
147dnl The C++ compiler test is pretty useless because even if it fails
148dnl it sets CXX=g++.  So test the compiler actually works.
149AC_MSG_CHECKING([if the C++ compiler really really works])
150AS_IF([$CXX --version >&AS_MESSAGE_LOG_FD 2>&1],[have_cxx=yes],[have_cxx=no])
151AC_MSG_RESULT([$have_cxx])
152AM_CONDITIONAL([HAVE_CXX], [test "$have_cxx" = "yes"])
153
154AC_ARG_ENABLE([gcc-warnings],
155    [AS_HELP_STRING([--enable-gcc-warnings],
156                    [turn on lots of GCC warnings (for developers)])],
157     [case $enableval in
158      yes|no) ;;
159      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
160      esac
161      gcc_warnings=$enableval],
162      [gcc_warnings=no]
163)
164if test "x$gcc_warnings" = "xyes"; then
165    WARNINGS_CFLAGS="-Wall -Wshadow -Wvla -Werror"
166    AC_SUBST([WARNINGS_CFLAGS])
167fi
168
169dnl Check if the compiler supports -std=c90 flag.  This is only used
170dnl during a test.  OpenBSD GCC does not support this flag so we skip
171dnl that test.
172AC_MSG_CHECKING([if the compiler supports -std=c90 for ANSI C test])
173old_CFLAGS="$CFLAGS"
174CFLAGS="$CFLAGS -std=c90"
175AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
176    [supports_std_c90=yes],
177    [supports_std_c90=no])
178CFLAGS="$old_CFLAGS"
179AC_MSG_RESULT([$supports_std_c90])
180AM_CONDITIONAL([CAN_TEST_ANSI_C], [test "x$supports_std_c90" = "xyes"])
181
182dnl On Haiku we must use BSD-compatibility headers to get the endian
183dnl macros we use.
184AC_MSG_CHECKING(whether OS-dependent include paths are required)
185AS_CASE([$host_os],
186  [haiku*], [CFLAGS="$CFLAGS -I`findpaths -p /system B_FIND_PATH_HEADERS_DIRECTORY`/bsd"; AC_MSG_RESULT(yes)],
187  [AC_MSG_RESULT(no)]
188)
189
190dnl On Linux /tmp is often tmpfs which is not large enough, so use /var/tmp.
191dnl But Haiku only has /tmp.
192AC_MSG_CHECKING([for temporary directory for large files])
193AS_CASE([$host_os],
194  [haiku*], [LARGE_TMPDIR=/tmp],
195  [LARGE_TMPDIR=/var/tmp]
196)
197AC_MSG_RESULT([$LARGE_TMPDIR])
198AC_DEFINE_UNQUOTED([LARGE_TMPDIR],["$LARGE_TMPDIR"],
199                   [Temporary directory for large files])
200
201dnl Check if libc has program_invocation_short_name.
202AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
203
204AX_PTHREAD
205
206dnl Check if __attribute__((cleanup(...))) works.
207dnl Set -Werror, otherwise gcc will only emit a warning for attributes
208dnl that it doesn't understand.
209acx_nbdkit_save_CFLAGS="${CFLAGS}"
210CFLAGS="${CFLAGS} -Werror"
211AC_MSG_CHECKING([if __attribute__((cleanup(...))) works with this compiler])
212AC_COMPILE_IFELSE([
213AC_LANG_SOURCE([[
214#include <stdio.h>
215#include <stdlib.h>
216
217void
218freep (void *ptr)
219{
220  exit (EXIT_SUCCESS);
221}
222
223void
224test (void)
225{
226  __attribute__((cleanup(freep))) char *ptr = malloc (100);
227}
228
229int
230main (int argc, char *argv[])
231{
232  test ();
233  exit (EXIT_FAILURE);
234}
235]])
236    ],[
237    AC_MSG_RESULT([yes])
238    ],[
239    AC_MSG_RESULT([no])
240    AC_MSG_ERROR(
241['__attribute__((cleanup(...)))' does not work.
242
243You may not be using a sufficiently recent version of GCC or CLANG, or
244you may be using a C compiler which does not support this attribute,
245or the configure test may be wrong.
246
247This code requires the attribute to work for proper locking between threads.])])
248CFLAGS="${acx_nbdkit_save_CFLAGS}"
249
250dnl Check for __auto_type (GCC extension).
251AC_MSG_CHECKING([if __auto_type is available in this compiler])
252AC_COMPILE_IFELSE([
253AC_LANG_SOURCE([[
254static int
255test (int a)
256{
257  __auto_type at = a;
258  return at;
259}
260]])
261    ],[
262    AC_MSG_RESULT([yes])
263    AC_DEFINE([HAVE_AUTO_TYPE],[1],[__auto_type is available])
264    ],[
265    AC_MSG_RESULT([no])
266    ]
267)
268
269dnl 'environ' is not always declared in public header files:
270dnl Linux => <unistd.h>  Haiku => <stdlib.h>
271dnl FreeBSD & OpenBSD => not declared
272dnl On platforms where it's not declared we must add an extern decl.
273AC_MSG_CHECKING([if environ is declared in header files])
274AC_COMPILE_IFELSE([
275AC_LANG_SOURCE([[
276#include <stdlib.h>
277#include <unistd.h>
278static int
279test (void)
280{
281  const char **env = environ;
282  return env ? 1 : 0; // this just forces env to be used
283}
284]])
285    ],[
286    AC_MSG_RESULT([yes])
287    AC_DEFINE([HAVE_ENVIRON_DECL],[1],[environ is declared in headers])
288    ],[
289    AC_MSG_RESULT([no])
290    ]
291)
292
293dnl Check for other headers, all optional.
294AC_CHECK_HEADERS([\
295	alloca.h \
296	byteswap.h \
297	endian.h \
298	stdatomic.h \
299	sys/endian.h \
300	sys/mman.h \
301	sys/prctl.h \
302	sys/procctl.h])
303
304AC_CHECK_HEADERS([linux/vm_sockets.h], [], [], [#include <sys/socket.h>])
305
306dnl Check for functions in libc, all optional.
307AC_CHECK_FUNCS([\
308	accept4 \
309	fdatasync \
310	get_current_dir_name \
311	mkostemp \
312	mlockall \
313	pipe2 \
314	ppoll \
315	posix_fadvise])
316
317dnl Check whether printf("%m") works
318AC_CACHE_CHECK([whether the printf family supports %m],
319  [nbdkit_cv_func_printf_percent_m],
320  [AC_RUN_IFELSE(
321    [AC_LANG_PROGRAM([[
322#include <stdio.h>
323#include <string.h>
324#include <errno.h>
325    ]], [[
326    char buf[200] = "";
327    errno = EINVAL;
328    snprintf(buf, sizeof buf, "%m");
329    return !!strcmp (buf, strerror (EINVAL));
330    ]])],
331    [nbdkit_cv_func_printf_percent_m=yes],
332    [nbdkit_cv_func_printf_percent_m=no],
333    [[
334    case "$host_os" in
335      *-gnu* | gnu*) nbdkit_cv_func_printf_percent_m=yes;;
336      *) nbdkit_cv_func_printf_percent_m="guessing no";;
337    esac
338    ]])])
339AS_IF([test "x$nbdkit_cv_func_printf_percent_m" = xyes],
340  [AC_DEFINE([HAVE_VFPRINTF_PERCENT_M],[1],
341    [Define to 1 if vfprintf supports %m.])])
342
343old_LIBS="$LIBS"
344AC_SEARCH_LIBS([dlsym], [dl dld], [
345        AS_IF([test "x$ac_cv_search_dlsym" != "xnone required"],
346	    [DL_LIBS="$ac_cv_search_dlsym"], [DL_LIBS=])
347        AC_SUBST([DL_LIBS])
348    ], [AC_MSG_ERROR([unable to find the dlsym() function])
349])
350LIBS="$old_LIBS"
351
352dnl Test if <iconv.h> header can build working binaries.
353dnl
354dnl On FreeBSD: iconv and libiconv both exist, both can be installed
355dnl simultaneously, <iconv.h> can exist in two separate places, and
356dnl if you get the wrong header/library mix everything breaks.
357dnl
358dnl On Haiku: libiconv is required to link to iconv_* functions.
359AC_ARG_WITH([iconv],
360    [AS_HELP_STRING([--without-iconv],
361                    [don't try to link against iconv @<:@default=check@:>@])],
362    [],
363    [with_iconv=check])
364AS_IF([test "x$with_iconv" != "xno"],[
365    AC_CHECK_HEADER([iconv.h],[
366        AC_MSG_CHECKING([if <iconv.h> can be used to link a program])
367        AC_LINK_IFELSE([
368AC_LANG_SOURCE([[
369#include <stdio.h>
370#include <stdlib.h>
371#include <iconv.h>
372int
373main (int argc, char *argv[])
374{
375  iconv_t ic = iconv_open ("", "");
376  iconv_close (ic);
377  exit (0);
378}
379]])
380            ],[
381            AC_MSG_RESULT([yes])
382            iconv_working=yes
383            ],[
384            AC_MSG_RESULT([no])
385            ])
386        ])
387    ])
388AM_CONDITIONAL([HAVE_ICONV], [test "x$iconv_working" = "xyes"])
389
390dnl Don't use linker script for the server on FreeBSD because
391dnl FreeBSD's linker is broken.  See eg:
392dnl https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190851
393AC_MSG_CHECKING([if we should use a linker script for the server])
394AS_CASE([$host_os],
395  [freebsd*], [use_linker_script_for_server=no],
396  [use_linker_script_for_server=yes]
397)
398AC_MSG_RESULT([$use_linker_script_for_server])
399AM_CONDITIONAL([USE_LINKER_SCRIPT_FOR_SERVER],
400               [test "x$use_linker_script_for_server" = "xyes"])
401
402dnl Check if -rdynamic linker flag works.
403acx_nbdkit_save_LDFLAGS="${LDFLAGS}"
404LDFLAGS="${LDFLAGS} -rdynamic"
405AC_MSG_CHECKING([if linker supports -rdynamic])
406AC_LINK_IFELSE([
407AC_LANG_SOURCE([[
408#include <stdlib.h>
409int
410main (int argc, char *argv[])
411{
412  exit (EXIT_SUCCESS);
413}
414]])
415    ],[
416    AC_MSG_RESULT([yes])
417    DL_LDFLAGS=-rdynamic
418    ],[
419    AC_MSG_RESULT([no])
420])
421dnl restore CFLAGS
422LDFLAGS="${acx_nbdkit_save_LDFLAGS}"
423AC_SUBST([DL_LDFLAGS])
424
425dnl Check for dladdr in -ldl, optional.  This is a glibc extension.
426old_LIBS="$LIBS"
427LIBS="$DL_LIBS $LIBS"
428AC_CHECK_FUNCS([dladdr])
429LIBS="$old_LIBS"
430
431dnl On mingw we should enable the -no-undefined flag.
432AC_MSG_CHECKING([SHARED_LDFLAGS])
433AS_CASE([$host_os],
434    [mingw*|msys*|cygwin*], [SHARED_LDFLAGS="$SHARED_LDFLAGS -no-undefined"],
435    []
436)
437AC_MSG_RESULT([$SHARED_LDFLAGS])
438AC_SUBST([SHARED_LDFLAGS])
439
440AC_SEARCH_LIBS([getaddrinfo], [network socket])
441
442dnl Check for SELinux socket labelling (optional).
443PKG_CHECK_MODULES([LIBSELINUX], [libselinux], [
444    AC_SUBST([LIBSELINUX_CFLAGS])
445    AC_SUBST([LIBSELINUX_LIBS])
446    AC_DEFINE([HAVE_LIBSELINUX],[1],[libselinux found at compile time.])
447], [
448    AC_MSG_WARN([libselinux not found, SELinux socket labelling support will be disabled.])
449])
450
451dnl Check for GnuTLS (optional, for TLS support).
452PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3.0], [
453    AC_SUBST([GNUTLS_CFLAGS])
454    AC_SUBST([GNUTLS_LIBS])
455    AC_DEFINE([HAVE_GNUTLS],[1],[gnutls found at compile time.])
456], [
457    AC_MSG_WARN([gnutls not found or < 3.3.0, TLS support will be disabled.])
458])
459
460AS_IF([test "$GNUTLS_LIBS" != ""],[
461    AC_MSG_CHECKING([for default TLS session priority string])
462    AC_ARG_WITH([tls-priority],
463        [AS_HELP_STRING([--with-tls-priority],
464                        [default TLS session priority string @<:@default=NORMAL@:>@])],
465        [tls_priority=$withval],
466        [tls_priority=NORMAL])
467    AC_MSG_RESULT([$tls_priority])
468    AC_DEFINE_UNQUOTED([TLS_PRIORITY],["$tls_priority"],
469                       [Default TLS session priority string])
470
471    # Check for APIs which may not be present.
472    old_LIBS="$LIBS"
473    LIBS="$GNUTLS_LIBS $LIBS"
474    AC_CHECK_FUNCS([\
475	gnutls_base64_decode2 \
476	gnutls_certificate_set_known_dh_params \
477	gnutls_session_set_verify_cert])
478    LIBS="$old_LIBS"
479])
480
481dnl Check for mke2fs -d (used by linuxdisk plugin).  There are two
482dnl possible outcomes that we care about: (1) We have mke2fs and
483dnl it supports the -d option.  (2) We either don't have mke2fs
484dnl or it's too old to support the -d option (eg. on RHEL 7).
485mke2fs_with_d=no
486AC_MSG_CHECKING([for mke2fs supporting the -d option])
487AS_IF([mke2fs -V >/dev/null 2>&1], [
488    AS_IF([LANG=C mke2fs -d 2>&1 | grep -sq "option requires an argument"], [
489        mke2fs_with_d=yes
490    ])
491])
492AC_MSG_RESULT([$mke2fs_with_d])
493AM_CONDITIONAL([HAVE_MKE2FS_WITH_D],[test "x$mke2fs_with_d" = "xyes"])
494
495dnl Check for valgrind.
496AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind],[no])
497
498dnl If valgrind headers are available (optional).
499dnl Since this is only useful for developers, you have to enable
500dnl it explicitly using --enable-valgrind.
501AC_ARG_ENABLE([valgrind],
502    [AS_HELP_STRING([--enable-valgrind],
503                    [enable Valgrind extensions (for developers)])],
504    [enable_valgrind=yes],
505    [enable_valgrind=no])
506AS_IF([test "x$enable_valgrind" = "xyes"],[
507    PKG_CHECK_MODULES([VALGRIND], [valgrind], [
508        AC_SUBST([VALGRIND_CFLAGS])
509        AC_SUBST([VALGRIND_LIBS])
510        AC_DEFINE([HAVE_VALGRIND],[1],[Valgrind headers found at compile time])
511    ],[
512        AC_MSG_ERROR([--enable-valgrind given, but Valgrind headers are not available])
513    ])
514])
515
516dnl Build the special libFuzzer version of nbdkit.  DO NOT USE THIS for
517dnl normal builds.  See fuzzing/README.
518AC_ARG_ENABLE([libfuzzer],
519    [AS_HELP_STRING([--enable-libfuzzer],
520                    [build libFuzzer test binary (developers only)])],
521    [enable_libfuzzer=yes],
522    [enable_libfuzzer=no])
523AS_IF([test "x$enable_libfuzzer" = "xyes"],[
524    AC_DEFINE([ENABLE_LIBFUZZER],[1],[Enable special libFuzzer binary])
525])
526AM_CONDITIONAL([ENABLE_LIBFUZZER],[test "x$enable_libfuzzer" = "xyes"])
527
528dnl Bash completion.
529PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [
530    bash_completion=yes
531    AC_MSG_CHECKING([for bash-completions directory])
532    m4_ifdef([PKG_CHECK_VAR],[
533        PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir])
534    ])
535    AS_IF([test -z "$bashcompdir"], [
536        bashcompdir="${sysconfdir}/bash_completion.d"
537    ])
538    AC_MSG_RESULT([$bashcompdir])
539    AC_SUBST([bashcompdir])
540],[
541    bash_completion=no
542    AC_MSG_WARN([bash-completion not installed])
543])
544AM_CONDITIONAL([HAVE_BASH_COMPLETION],[test "x$bash_completion" = "xyes"])
545
546dnl Check we have enough to run podwrapper.
547AC_CHECK_PROG([PERL],[perl],[perl],[no])
548AS_IF([test "x$PERL" != "xno"],[
549    AC_MSG_CHECKING([if we have perl Pod::Man and Pod::Simple])
550    AS_IF([$PERL -MPod::Man -MPod::Simple -e 1 >&AS_MESSAGE_LOG_FD 2>&1],[
551        enable_pod=yes
552    ],[
553        enable_pod=no
554    ])
555    AC_MSG_RESULT([$enable_pod])
556])
557AM_CONDITIONAL([HAVE_POD],
558               [test "x$PERL" != "xno" && test "x$enable_pod" = "xyes"])
559
560dnl Define the path to the podwrapper program.
561PODWRAPPER="$PERL $(pwd)/podwrapper.pl"
562AC_SUBST([PODWRAPPER])
563
564dnl Allow all plugins and filters to be disabled.
565AC_ARG_ENABLE([plugins],
566    [AS_HELP_STRING([--disable-plugins],
567                    [disable all bundled plugins and filters])])
568AM_CONDITIONAL([HAVE_PLUGINS], [test "x$enable_plugins" != "xno"])
569
570dnl Check for Perl, for embedding in the perl plugin.
571dnl Note that the perl binary is checked above.
572AC_ARG_ENABLE([perl],
573    [AS_HELP_STRING([--disable-perl], [disable Perl embed plugin])],
574    [],
575    [enable_perl=yes])
576AS_IF([test "x$PERL" != "xno" && test "x$enable_perl" != "xno"],[
577    dnl Check for Perl archlib.
578    AC_MSG_CHECKING([for Perl embed archlib])
579    PERL_ARCHLIB="$($PERL -MConfig -e 'print $Config{archlib}')"
580    AS_IF([ test -n "$PERL_ARCHLIB" ],[
581        AC_MSG_RESULT([$PERL_ARCHLIB])
582    ],[
583        AC_MSG_NOTICE([Perl embed module disabled])
584        enable_perl=no
585    ])
586
587    dnl Check for Perl CFLAGS.
588    AC_MSG_CHECKING([for Perl embed CFLAGS])
589    PERL_CFLAGS="$($PERL -MExtUtils::Embed -e 'ccflags')"
590    AS_IF([ test -n "$PERL_CFLAGS" ],[
591        AC_MSG_RESULT([$PERL_CFLAGS])
592    ],[
593        AC_MSG_NOTICE([Perl embed module disabled])
594        enable_perl=no
595    ])
596
597    dnl Check for Perl LDOPTS.
598    AC_MSG_CHECKING([for Perl embed LDOPTS])
599    PERL_LDOPTS="$($PERL -MExtUtils::Embed -e 'ldopts')"
600    AC_MSG_RESULT([$PERL_LDOPTS])
601
602    dnl XXX Could check these actually work.
603])
604AM_CONDITIONAL([HAVE_PERL],[test "x$enable_perl" != "xno" && test "x$PERL" != "xno"])
605AC_SUBST([PERL_ARCHLIB])
606AC_SUBST([PERL_CFLAGS])
607AC_SUBST([PERL_LDOPTS])
608
609dnl Check for Python 3, for embedding in the python plugin.
610AC_PATH_PROGS([PYTHON],[python3 python],[no])
611AC_ARG_ENABLE([python],
612    [AS_HELP_STRING([--disable-python], [disable Python embed plugin])],
613    [],
614    [enable_python=yes])
615AS_IF([test "x$PYTHON" != "xno" && test "x$enable_python" != "xno"],[
616    AC_MSG_CHECKING([version of $PYTHON])
617    PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info@<:@0@:>@)"`
618    PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info@<:@1@:>@)"`
619    PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR"
620    AS_IF([test -n "$PYTHON_VERSION"],[
621        AC_MSG_RESULT([$PYTHON_VERSION])
622    ],[
623        AC_MSG_NOTICE([Python embed module disabled])
624        enable_python=no
625    ])
626
627    AC_MSG_CHECKING([Python major version is 3])
628    AS_IF([test "x$PYTHON_VERSION_MAJOR" = "x3"],[
629        AC_MSG_RESULT([yes])
630    ],[
631        AC_MSG_RESULT([no])
632        AC_MSG_ERROR([Python $PYTHON_VERSION_MAJOR <> 3 is no longer supported.
633
634Python 2 end of life is 2020-01-01 and nbdkit >= 1.16 no longer
635supports it.
636
637If you want to use Python 2, you will need to use nbdkit 1.14.])
638    ])
639
640    dnl Check for Python CFLAGS, libraries.
641    dnl For Python >= 3.8 we have to use python-<VERSION>-embed.pc, see:
642    dnl https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
643    dnl The python.pc is called python-<VERSION>.pc on Debian and
644    dnl later versions of Fedora, and python.pc on older versions
645    dnl of Fedora.
646    PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"-embed], [
647        AC_SUBST([PYTHON_CFLAGS])
648        AC_SUBST([PYTHON_LIBS])
649        AC_SUBST([PYTHON_VERSION])
650        AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
651    ],[
652    PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"], [
653        AC_SUBST([PYTHON_CFLAGS])
654        AC_SUBST([PYTHON_LIBS])
655        AC_SUBST([PYTHON_VERSION])
656        AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
657    ],[
658    PKG_CHECK_MODULES([PYTHON], [python], [
659        AC_SUBST([PYTHON_CFLAGS])
660        AC_SUBST([PYTHON_LIBS])
661        AC_SUBST([PYTHON_VERSION])
662        AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
663    ],[
664        AC_MSG_WARN([python $PYTHON_VERSION not found])
665        enable_python=no
666    ])])])
667])
668AM_CONDITIONAL([HAVE_PYTHON],[test "x$enable_python" != "xno" && test "x$PYTHON" != "xno"])
669AC_SUBST([PYTHON_CFLAGS])
670AC_SUBST([PYTHON_LIBS])
671AC_SUBST([PYTHON_LDFLAGS])
672
673dnl For the OCaml plugin, you can set OCAMLOPTFLAGS before running
674dnl ./configure to specify any extra flags you want to pass to
675dnl ocamlopt.
676AC_SUBST([OCAMLOPTFLAGS])
677
678dnl Check for OCaml, for embedding in the ocaml plugin.
679AC_PROG_OCAML
680AC_ARG_ENABLE([ocaml],
681    [AS_HELP_STRING([--disable-ocaml], [disable OCaml embed plugin])],
682    [],
683    [enable_ocaml=yes])
684AS_IF([test "x$OCAMLOPT" != "xno" && test "x$enable_ocaml" != "xno"],[
685    dnl Check OCaml can create a shared library (see README for details).
686    AC_MSG_CHECKING([if $OCAMLOPT can create a shared library])
687    echo 'print_endline "test"' > conftest.ml
688    AS_IF([$OCAMLOPT $OCAMLOPTFLAGS -output-obj -runtime-variant _pic -o conftest.so conftest.ml >&AS_MESSAGE_LOG_FD 2>&1],[
689        AC_MSG_RESULT([yes])
690        ocaml_link_shared=yes
691    ],[
692        AC_MSG_RESULT([no])
693    ])
694    rm -f conftest.ml conftest.cmi conftest.cmx conftest.so conftest.o
695])
696AM_CONDITIONAL([HAVE_OCAML],[test "x$OCAMLOPT" != "xno" &&
697                             test "x$ocaml_link_shared" = "xyes"])
698
699dnl Check if OCaml has caml_alloc_initialized_string (added 2017).
700AS_IF([test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && \
701       test "x$enable_ocaml" = "xyes"],[
702    AC_MSG_CHECKING([for caml_alloc_initialized_string])
703    cat >conftest.c <<'EOF'
704#include <caml/alloc.h>
705int main () { char *p = (void *) caml_alloc_initialized_string; return 0; }
706EOF
707    AS_IF([$OCAMLC conftest.c >&AS_MESSAGE_LOG_FD 2>&1],[
708        AC_MSG_RESULT([yes])
709        AC_DEFINE([HAVE_CAML_ALLOC_INITIALIZED_STRING],[1],
710                  [caml_alloc_initialized_string found at compile time.])
711    ],[
712        AC_MSG_RESULT([no])
713    ])
714    rm -f conftest.c conftest.o
715])
716
717dnl For developing plugins in Rust, optional.
718AC_CHECK_PROG([CARGO],[cargo],[cargo],[no])
719AC_ARG_ENABLE([rust],
720    [AS_HELP_STRING([--disable-rust], [disable Rust plugin])],
721    [],
722    [enable_rust=yes])
723AM_CONDITIONAL([HAVE_RUST],
724               [test "x$CARGO" != "xno" && test "x$enable_rust" != "xno"])
725
726dnl Check for Ruby, for embedding in the Ruby plugin.
727AC_CHECK_PROG([RUBY],[ruby],[ruby],[no])
728AC_ARG_ENABLE([ruby],
729    [AS_HELP_STRING([--disable-ruby], [disable Ruby plugin])],
730    [],
731    [enable_ruby=yes])
732AS_IF([test "x$RUBY" != "xno" && test "x$enable_ruby" != "xno"],[
733    PKG_CHECK_MODULES([RUBY], [ruby], [
734        AC_SUBST([RUBY_CFLAGS])
735        AC_SUBST([RUBY_LIBS])
736    ],[
737        AC_MSG_WARN([ruby not found])
738        enable_ruby=no
739    ])
740])
741AM_CONDITIONAL([HAVE_RUBY],[test "x$RUBY" != "xno" &&
742                            test "x$enable_ruby" = "xyes"])
743
744dnl Check for Tcl, for embedding in the Tcl plugin.
745AC_ARG_ENABLE([tcl],
746    [AS_HELP_STRING([--disable-tcl], [disable Tcl plugin])],
747    [],
748    [enable_tcl=yes])
749AS_IF([test "x$enable_tcl" != "xno"],[
750    PKG_CHECK_MODULES([TCL], [tcl], [
751        AC_SUBST([TCL_CFLAGS])
752        AC_SUBST([TCL_LIBS])
753    ],[
754        AC_MSG_WARN([Tcl not found])
755        enable_tcl=no
756    ])
757])
758AM_CONDITIONAL([HAVE_TCL],[test "x$enable_tcl" = "xyes"])
759
760dnl Check for Lua, for embedding in the Lua plugin.
761AC_ARG_ENABLE([lua],
762    [AS_HELP_STRING([--disable-lua], [disable Lua plugin])],
763    [],
764    [enable_lua=yes])
765AS_IF([test "x$enable_lua" != "xno"],[
766    PKG_CHECK_MODULES([LUA], [lua], [
767        AC_SUBST([LUA_CFLAGS])
768        AC_SUBST([LUA_LIBS])
769
770	dnl Lua 5.1 used by RHEL 7 does not have lua_isinteger.
771	old_LIBS="$LIBS"
772	LIBS="$LUA_LIBS $LIBS"
773	AC_CHECK_FUNCS([lua_isinteger])
774	LIBS="$old_LIBS"
775    ],[
776        AC_MSG_WARN([Lua not found])
777        enable_lua=no
778    ])
779])
780AM_CONDITIONAL([HAVE_LUA],[test "x$enable_lua" = "xyes"])
781
782dnl Check for golang.
783AC_ARG_ENABLE([golang],
784    AS_HELP_STRING([--disable-golang], [disable Go language plugin]),
785        [],
786        [enable_golang=yes])
787AS_IF([test "x$enable_golang" != "xno"],[
788    AC_CHECK_PROG([GOLANG],[go],[go],[no])
789    AS_IF([test "x$GOLANG" != "xno"],[
790        AC_MSG_CHECKING([if $GOLANG is usable])
791        AS_IF([$GOLANG run $srcdir/plugins/golang/config-test.go 2>&AS_MESSAGE_LOG_FD],[
792            AC_MSG_RESULT([yes])
793
794            # Substitute some golang environment.
795            GOOS=`$GOLANG env GOOS`
796            GOARCH=`$GOLANG env GOARCH`
797            GOROOT=`$GOLANG env GOROOT`
798            AC_SUBST([GOOS])
799            AC_SUBST([GOARCH])
800            AC_SUBST([GOROOT])
801        ],[
802            AC_MSG_RESULT([no])
803            AC_MSG_WARN([golang ($GOLANG) is installed but not usable])
804            GOLANG=no
805        ])
806    ])
807],[GOLANG=no])
808AM_CONDITIONAL([HAVE_GOLANG],[test "x$GOLANG" != "xno"])
809
810dnl Check for curl (only if you want to compile the curl plugin).
811AC_ARG_WITH([curl],
812    [AS_HELP_STRING([--without-curl],
813                    [disable curl plugin @<:@default=check@:>@])],
814    [],
815    [with_curl=check])
816AS_IF([test "$with_curl" != "no"],[
817    PKG_CHECK_MODULES([CURL], [libcurl],[
818        AC_SUBST([CURL_CFLAGS])
819        AC_SUBST([CURL_LIBS])
820        AC_DEFINE([HAVE_CURL],[1],[curl found at compile time.])
821        AC_CHECK_DECL([CURLOPT_UNIX_SOCKET_PATH], [
822            AC_DEFINE([HAVE_CURLOPT_UNIX_SOCKET_PATH],[1],
823                      [CURLOPT_UNIX_SOCKET_PATH found at compile time.])
824            ], [], [#include <curl/curl.h>])
825    ],
826    [AC_MSG_WARN([curl not found, curl plugin will be disabled])])
827])
828AM_CONDITIONAL([HAVE_CURL],[test "x$CURL_LIBS" != "x"])
829
830dnl Check for libssh (only if you want to compile the ssh plugin).
831AC_ARG_WITH([ssh],
832    [AS_HELP_STRING([--without-ssh],
833                    [disable ssh plugin @<:@default=check@:>@])],
834    [],
835    [with_ssh=check])
836AS_IF([test "$with_ssh" != "no"],[
837    PKG_CHECK_MODULES([SSH], [libssh >= 0.8.0],[
838        AC_SUBST([SSH_CFLAGS])
839        AC_SUBST([SSH_LIBS])
840    ],
841    [AC_MSG_WARN([libssh not found, ssh plugin will be disabled])])
842])
843AM_CONDITIONAL([HAVE_SSH],[test "x$SSH_LIBS" != "x"])
844
845dnl Check for genisoimage or mkisofs
846dnl (only if you want to compile the iso plugin).
847ISOPROG="no"
848AC_ARG_WITH([iso],
849    [AS_HELP_STRING([--without-iso],
850                    [disable iso plugin @<:@default=check@:>@])],
851    [],
852    [with_iso=check])
853AS_IF([test "$with_iso" != "no"],[
854    AC_CHECK_PROG([GENISOIMAGE],[genisoimage],[genisoimage],[no])
855    AC_CHECK_PROG([MKISOFS],[mkisofs],[mkisofs],[no])
856    AS_IF([test "x$GENISOIMAGE" != "xno"],[
857        ISOPROG="$GENISOIMAGE"
858    ],[
859        AS_IF([test "x$MKISOFS" != "xno"],[
860            ISOPROG="$MKISOFS"
861        ])
862    ])
863    AS_IF([test "x$ISOPROG" != "xno"],[
864        AC_DEFINE_UNQUOTED([ISOPROG],["$ISOPROG"],
865                           [Program used by iso plugin to make ISOs.])
866    ])
867])
868AC_SUBST([ISOPROG])
869AM_CONDITIONAL([HAVE_ISO],[test "x$ISOPROG" != "xno"])
870
871dnl Check for libvirt (only if you want to compile the libvirt plugin).
872AC_ARG_WITH([libvirt],
873    [AS_HELP_STRING([--without-libvirt],
874                    [disable libvirt plugin @<:@default=check@:>@])],
875    [],
876    [with_libvirt=check])
877AS_IF([test "$with_libvirt" != "no"],[
878    PKG_CHECK_MODULES([LIBVIRT], [libvirt],[
879        AC_SUBST([LIBVIRT_CFLAGS])
880        AC_SUBST([LIBVIRT_LIBS])
881        AC_DEFINE([HAVE_LIBVIRT],[1],[libvirt found at compile time.])
882    ],
883    [AC_MSG_WARN([libvirt not found, libvirt plugin will be disabled])])
884])
885AM_CONDITIONAL([HAVE_LIBVIRT],[test "x$LIBVIRT_LIBS" != "x"])
886
887dnl Check for zlib (only if you want to compile the gzip plugin).
888AC_ARG_WITH([zlib],
889    [AS_HELP_STRING([--without-zlib],
890                    [disable gzip plugin @<:@default=check@:>@])],
891    [],
892    [with_zlib=check])
893AS_IF([test "$with_zlib" != "no"],[
894    PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3.5],[
895        AC_SUBST([ZLIB_CFLAGS])
896        AC_SUBST([ZLIB_LIBS])
897        AC_DEFINE([HAVE_ZLIB],[1],[zlib found at compile time.])
898    ],
899    [AC_MSG_WARN([zlib >= 1.2.3.5 not found, gzip plugin will be disabled])])
900])
901AM_CONDITIONAL([HAVE_ZLIB],[test "x$ZLIB_LIBS" != "x"])
902
903dnl Check for libnbd (only if you want to compile the nbd plugin).
904AC_ARG_WITH([libnbd],
905    [AS_HELP_STRING([--without-libnbd],
906                    [disable nbd plugin @<:@default=check@:>@])],
907    [],
908    [with_libnbd=check])
909AS_IF([test "$with_libnbd" != "no"],[
910    PKG_CHECK_MODULES([LIBNBD], [libnbd >= 0.9.8],[
911        AC_SUBST([LIBNBD_CFLAGS])
912        AC_SUBST([LIBNBD_LIBS])
913        AC_DEFINE([HAVE_LIBNBD],[1],[libnbd found at compile time.])
914    ],
915    [AC_MSG_WARN([libnbd >= 0.9.8 not found, nbd plugin will be crippled])])
916])
917
918dnl For backwards compatibilty, we have a second way to disable the nbd plugin.
919AC_ARG_ENABLE([nbd-plugin],
920    [AS_HELP_STRING([--disable-nbd-plugin], [disable nbd plugin (deprecated, use --without-libnbd)])],
921    [],
922    [enable_nbd_plugin=yes])
923AM_CONDITIONAL([HAVE_LIBNBD],
924  [test "x$LIBNBD_LIBS" != "x" && test "x$enable_nbd_plugin" = "xyes"])
925
926dnl Check for liblzma (only if you want to compile the xz filter).
927AC_ARG_WITH([liblzma],
928    [AS_HELP_STRING([--without-liblzma],
929                    [disable xz filter @<:@default=check@:>@])],
930    [],
931    [with_liblzma=check])
932AS_IF([test "$with_liblzma" != "no"],[
933    PKG_CHECK_MODULES([LIBLZMA], [liblzma],[
934        AC_SUBST([LIBLZMA_CFLAGS])
935        AC_SUBST([LIBLZMA_LIBS])
936        AC_DEFINE([HAVE_LIBLZMA],[1],[liblzma found at compile time.])
937    ],
938    [AC_MSG_WARN([liblzma not found, xz filter will be disabled])])
939])
940AM_CONDITIONAL([HAVE_LIBLZMA],[test "x$LIBLZMA_LIBS" != "x"])
941
942dnl Check for libguestfs (only for the guestfs plugin and the test suite).
943AC_ARG_WITH([libguestfs],
944    [AS_HELP_STRING([--without-libguestfs],
945                    [disable guestfs plugin and tests @<:@default=check@:>@])],
946    [],
947    [with_libguestfs=check])
948AS_IF([test "$with_libguestfs" != "no"],[
949    PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs],[
950        # Although the library was found, we want to make sure it supports nbd
951        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
952#include <guestfs.h>
953        ]], [[
954#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL
955#error unsupported
956#endif
957        ]])], [
958        AC_SUBST([LIBGUESTFS_CFLAGS])
959        AC_SUBST([LIBGUESTFS_LIBS])
960        AC_DEFINE([HAVE_LIBGUESTFS],[1],[libguestfs found at compile time.])
961        ],[
962        LIBGUESTFS_LIBS=
963        AC_MSG_WARN([libguestfs too old, guestfs plugin and tests will be disabled])])
964    ],
965    [AC_MSG_WARN([libguestfs not found, guestfs plugin and tests will be disabled])])
966])
967AM_CONDITIONAL([HAVE_LIBGUESTFS],[test "x$LIBGUESTFS_LIBS" != "x"])
968
969dnl Check for guestfish (only needed for some of the tests).
970AC_CHECK_PROG([GUESTFISH], [guestfish], [guestfish], [no])
971AM_CONDITIONAL([HAVE_GUESTFISH], [test "x$GUESTFISH" != "xno"])
972
973dnl Check for ext2fs and com_err, for the ext2 filter and plugin.
974AC_ARG_WITH([ext2],
975    [AS_HELP_STRING([--without-ext2],
976                    [disable ext2 filter @<:@default=check@:>@])],
977    [],
978    [with_ext2=check])
979AS_IF([test "$with_ext2" != "no"], [
980    PKG_CHECK_MODULES([EXT2FS], [ext2fs], [
981        AC_SUBST([EXT2FS_CFLAGS])
982        AC_SUBST([EXT2FS_LIBS])
983        AC_DEFINE([HAVE_EXT2FS],[1],[ext2fs found at compile time.])
984    ],
985    [AC_MSG_WARN([ext2fs not found, ext2 plugin will be disabled])])
986    PKG_CHECK_MODULES([COM_ERR], [com_err], [
987        AC_SUBST([COM_ERR_CFLAGS])
988        AC_SUBST([COM_ERR_LIBS])
989        AC_DEFINE([HAVE_COM_ERR],[1],[com_err found at compile time.])
990    ],
991    [AC_MSG_WARN([com_err not found, ext2 plugin will be disabled])])
992
993    AC_CHECK_MEMBERS([struct struct_io_manager.cache_readahead,
994                      struct struct_io_manager.zeroout])
995])
996AM_CONDITIONAL([HAVE_EXT2],
997               [test "x$EXT2FS_LIBS" != "x" && test "x$COM_ERR_LIBS" != "x"])
998
999dnl Check if the user wants to disable VDDK support.
1000dnl See plugins/vddk/README.VDDK.
1001AC_ARG_ENABLE([vddk],
1002    [AS_HELP_STRING([--disable-vddk],
1003                    [disable VMware VDDK plugin])],
1004    [],
1005    [
1006     dnl While VDDK was available on i686 in 5.1.1, we only support 5.5.5
1007     dnl and newer, which is supported only on x86-64.  Don't compile on
1008     dnl other platforms.
1009     AC_MSG_CHECKING([if the host CPU is compatible with VDDK])
1010     AS_IF([test "$host_cpu" = "x86_64"],[
1011        AC_MSG_RESULT([yes ($host_cpu)])
1012        enable_vddk=yes
1013     ],[
1014        AC_MSG_RESULT([no ($host_cpu)])
1015        enable_vddk=no
1016     ])
1017    ])
1018AM_CONDITIONAL([HAVE_VDDK], [test "x$enable_vddk" = "xyes"])
1019
1020dnl Expose version information to the public headers
1021[NBDKIT_]VERSION_MAJOR=NBDKIT_VERSION_MAJOR
1022[NBDKIT_]VERSION_MINOR=NBDKIT_VERSION_MINOR
1023[NBDKIT_]VERSION_MICRO=NBDKIT_VERSION_MICRO
1024AC_SUBST([NBDKIT_VERSION_MAJOR])
1025AC_SUBST([NBDKIT_VERSION_MINOR])
1026AC_SUBST([NBDKIT_VERSION_MICRO])
1027
1028dnl Produce output files.
1029AC_CONFIG_HEADERS([config.h])
1030AC_CONFIG_FILES([podwrapper.pl],
1031                [chmod +x,-w podwrapper.pl])
1032AC_CONFIG_FILES([common/protocol/generate-protostrings.sh],
1033                [chmod +x,-w common/protocol/generate-protostrings.sh])
1034AC_CONFIG_FILES([Makefile
1035                 bash/Makefile
1036                 common/bitmap/Makefile
1037                 common/gpt/Makefile
1038                 common/include/Makefile
1039                 common/protocol/Makefile
1040                 common/regions/Makefile
1041                 common/sparse/Makefile
1042                 common/utils/Makefile
1043                 docs/Makefile
1044                 include/Makefile
1045                 include/nbdkit-version.h
1046                 plugins/Makefile
1047                 plugins/curl/Makefile
1048                 plugins/data/Makefile
1049                 plugins/eval/Makefile
1050                 plugins/example1/Makefile
1051                 plugins/example2/Makefile
1052                 plugins/example3/Makefile
1053                 plugins/example4/Makefile
1054                 plugins/ext2/Makefile
1055                 plugins/file/Makefile
1056                 plugins/floppy/Makefile
1057                 plugins/full/Makefile
1058                 plugins/golang/Makefile
1059                 plugins/guestfs/Makefile
1060                 plugins/gzip/Makefile
1061                 plugins/info/Makefile
1062                 plugins/iso/Makefile
1063                 plugins/libvirt/Makefile
1064                 plugins/linuxdisk/Makefile
1065                 plugins/lua/Makefile
1066                 plugins/memory/Makefile
1067                 plugins/nbd/Makefile
1068                 plugins/null/Makefile
1069                 plugins/ocaml/Makefile
1070                 plugins/partitioning/Makefile
1071                 plugins/pattern/Makefile
1072                 plugins/perl/Makefile
1073                 plugins/python/Makefile
1074                 plugins/random/Makefile
1075                 plugins/ruby/Makefile
1076                 plugins/rust/Cargo.toml
1077                 plugins/rust/Makefile
1078                 plugins/sh/Makefile
1079                 plugins/ssh/Makefile
1080                 plugins/split/Makefile
1081                 plugins/streaming/Makefile
1082                 plugins/tar/Makefile
1083                 plugins/tcl/Makefile
1084                 plugins/tmpdisk/Makefile
1085                 plugins/vddk/Makefile
1086                 plugins/zero/Makefile
1087                 filters/Makefile
1088                 filters/blocksize/Makefile
1089                 filters/cache/Makefile
1090                 filters/cacheextents/Makefile
1091                 filters/cow/Makefile
1092                 filters/delay/Makefile
1093                 filters/error/Makefile
1094                 filters/exitlast/Makefile
1095                 filters/ext2/Makefile
1096                 filters/extentlist/Makefile
1097                 filters/fua/Makefile
1098                 filters/ip/Makefile
1099                 filters/limit/Makefile
1100                 filters/log/Makefile
1101                 filters/nocache/Makefile
1102                 filters/noextents/Makefile
1103                 filters/nofilter/Makefile
1104                 filters/noparallel/Makefile
1105                 filters/nozero/Makefile
1106                 filters/offset/Makefile
1107                 filters/partition/Makefile
1108                 filters/rate/Makefile
1109                 filters/readahead/Makefile
1110                 filters/retry/Makefile
1111                 filters/stats/Makefile
1112                 filters/truncate/Makefile
1113                 filters/xz/Makefile
1114                 fuzzing/Makefile
1115                 server/local/nbdkit.pc
1116                 server/Makefile
1117                 server/nbdkit.pc
1118                 tests/functions.sh
1119                 tests/Makefile
1120                 valgrind/Makefile])
1121
1122AC_OUTPUT
1123
1124dnl Summary.
1125echo
1126echo
1127echo "----------------------------------------------------------------------"
1128echo "Thank you for downloading $PACKAGE_STRING"
1129echo
1130echo "This is how we have configured the optional components for you today:"
1131echo
1132
1133feature ()
1134{
1135    printf %s "    $1"
1136    shift
1137    if $@; then echo "yes"; else echo "no"; fi
1138}
1139
1140echo "Optional server features:"
1141echo
1142feature "bash-completion ........................ " \
1143        test "x$HAVE_BASH_COMPLETION_TRUE" = "x"
1144feature "manual pages ........................... " \
1145        test "x$HAVE_POD_TRUE" = "x"
1146feature "SELinux ................................ " \
1147        test "x$LIBSELINUX_LIBS" != "x"
1148feature "TLS .................................... " \
1149        test "x$GNUTLS_LIBS" != "x"
1150
1151echo
1152echo "Optional plugins:"
1153echo
1154feature "curl ................................... " \
1155        test "x$HAVE_CURL_TRUE" = "x"
1156feature "example4 ............................... " \
1157        test "x$HAVE_PERL_TRUE" = "x"
1158feature "ext2 ................................... " \
1159        test "x$HAVE_EXT2_TRUE" = "x"
1160feature "floppy ................................. " \
1161        test "x$HAVE_ICONV_TRUE" = "x"
1162feature "guestfs ................................ " \
1163        test "x$HAVE_LIBGUESTFS_TRUE" = "x"
1164feature "gzip ................................... " \
1165        test "x$HAVE_ZLIB_TRUE" = "x"
1166feature "iso .................................... " \
1167        test "x$HAVE_ISO_TRUE" = "x"
1168feature "libvirt ................................ " \
1169        test "x$HAVE_LIBVIRT_TRUE" = "x"
1170feature "nbd .................................... " \
1171        test "x$HAVE_LIBNBD_TRUE" = "x"
1172feature "ssh .................................... " \
1173        test "x$HAVE_SSH_TRUE" = "x"
1174feature "tar .................................... " \
1175        test "x$HAVE_PERL_TRUE" = "x"
1176feature "vddk ................................... " \
1177        test "x$HAVE_VDDK_TRUE" = "x"
1178
1179
1180echo
1181echo "Languages:"
1182echo
1183feature "go ..................................... " \
1184        test "x$HAVE_GOLANG_TRUE" = "x"
1185feature "lua .................................... " \
1186        test "x$HAVE_LUA_TRUE" = "x"
1187feature "ocaml .................................. " \
1188        test "x$HAVE_OCAML_TRUE" = "x"
1189feature "perl ................................... " \
1190        test "x$HAVE_PERL_TRUE" = "x"
1191feature "python ................................. " \
1192        test "x$HAVE_PYTHON_TRUE" = "x"
1193feature "ruby ................................... " \
1194        test "x$HAVE_RUBY_TRUE" = "x"
1195feature "rust ................................... " \
1196        test "x$HAVE_RUST_TRUE" = "x"
1197feature "tcl .................................... " \
1198        test "x$HAVE_TCL_TRUE" = "x"
1199
1200
1201echo
1202echo "Optional filters:"
1203echo
1204feature "ext2 ................................... " \
1205        test "x$HAVE_EXT2_TRUE" = "x"
1206feature "xz ..................................... " \
1207        test "x$HAVE_LIBLZMA_TRUE" = "x"
1208
1209echo
1210echo "If any optional component is configured ‘no’ when you expected ‘yes’"
1211echo "then you should check the preceding messages and README."
1212echo
1213echo "Please report bugs back to the mailing list:"
1214echo "http://www.redhat.com/mailman/listinfo/libguestfs"
1215echo
1216echo "Next you should type 'make' to build the package,"
1217echo "then 'make check' to run the tests."
1218