2 # Copyright (C) 2013-2023 Red Hat Inc.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
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.
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.
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
32 m4_define([NBDKIT_VERSION_MAJOR], [1])
33 m4_define([NBDKIT_VERSION_MINOR], [33])
34 m4_define([NBDKIT_VERSION_MICRO], [7])
36 NBDKIT_VERSION_MAJOR.NBDKIT_VERSION_MINOR.NBDKIT_VERSION_MICRO)
37 AC_CONFIG_MACRO_DIR([m4])
39 dnl This must be used very early else you will get
40 dnl "warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS"
41 m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],[],
42 [m4_define([AC_USE_SYSTEM_EXTENSIONS],[])])
43 AC_USE_SYSTEM_EXTENSIONS
45 dnl NB: Do not [quote] this parameter.
46 AM_INIT_AUTOMAKE(foreign)
49 dnl Extra string, a freeform string defined by downstream packagers.
50 dnl eg. If you are packaging nbdkit for Linux distro X 1.1, you could
51 dnl ./configure --with-extra="X release 1.1"
53 [AS_HELP_STRING([--with-extra=...],
54 [extra version information (for use by packagers)])],
55 [NBDKIT_VERSION_EXTRA="$withval"],
56 [NBDKIT_VERSION_EXTRA=]
58 AC_DEFINE_UNQUOTED([NBDKIT_VERSION_EXTRA], ["$NBDKIT_VERSION_EXTRA"],
59 [Extra version information (for use by packagers)])
61 AC_MSG_NOTICE([nbdkit version NBDKIT_VERSION_MAJOR.NBDKIT_VERSION_MINOR.NBDKIT_VERSION_MICRO ($NBDKIT_VERSION_EXTRA)])
63 dnl List of plugins and filters.
110 plugins="$(echo $(printf %s\\n $lang_plugins $non_lang_plugins | sort -u))"
155 AC_SUBST([lang_plugins])
156 AC_SUBST([non_lang_plugins])
159 dnl Some very basic tools.
163 dnl Check for basic C environment.
170 test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
174 dnl Define the host CPU architecture (defines 'host_cpu').
176 AC_DEFINE_UNQUOTED([host_cpu],["$host_cpu"],[Host architecture.])
178 dnl Define 'host_os'.
179 AC_DEFINE_UNQUOTED([host_os],["$host_os"],[Host operating system.])
181 dnl Defines WORDS_BIGENDIAN on big endian platforms.
184 dnl These are defined in <unistd.h> which is included by
185 dnl AC_DEFAULT_INCLUDES.
186 AC_CHECK_SIZEOF([pid_t])
187 AC_CHECK_SIZEOF([uid_t])
188 AC_CHECK_SIZEOF([gid_t])
190 dnl Check for C++ (optional, we just use this to test the header
191 dnl can be included from C++ code).
194 dnl The C++ compiler test is pretty useless because even if it fails
195 dnl it sets CXX=g++. So test the compiler actually works.
196 AC_MSG_CHECKING([if the C++ compiler really really works])
197 AS_IF([$CXX --version >&AS_MESSAGE_LOG_FD 2>&1],[have_cxx=yes],[have_cxx=no])
198 AC_MSG_RESULT([$have_cxx])
199 AM_CONDITIONAL([HAVE_CXX], [test "$have_cxx" = "yes"])
201 AC_ARG_ENABLE([gcc-warnings],
202 [AS_HELP_STRING([--enable-gcc-warnings],
203 [turn on lots of GCC warnings (for developers)])],
206 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
208 gcc_warnings=$enableval],
211 if test "x$gcc_warnings" = "xyes"; then
212 WARNINGS_CFLAGS="-Wall -Wshadow -Wvla -Werror"
213 AC_SUBST([WARNINGS_CFLAGS])
216 dnl Check if the compiler supports -std=c90 flag. This is only used
217 dnl during a test. OpenBSD GCC does not support this flag so we skip
219 AC_MSG_CHECKING([if the compiler supports -std=c90 for ANSI C test])
221 CFLAGS="$CFLAGS -std=c90"
222 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
223 [supports_std_c90=yes],
224 [supports_std_c90=no])
226 AC_MSG_RESULT([$supports_std_c90])
227 AM_CONDITIONAL([CAN_TEST_ANSI_C], [test "x$supports_std_c90" = "xyes"])
229 dnl Check for __builtin_*_overflow. We need the dummy parameters
230 dnl else detection doesn't work correctly for some reason.
231 AC_CHECK_DECLS([__builtin_add_overflow(int, int, int *),
232 __builtin_mul_overflow(int, int, int *)],
235 dnl On Haiku we must use BSD-compatibility headers to get the endian
237 AC_MSG_CHECKING(whether OS-dependent include paths are required)
239 [haiku*], [CFLAGS="$CFLAGS -I`findpaths -p /system B_FIND_PATH_HEADERS_DIRECTORY`/bsd"; AC_MSG_RESULT(yes)],
243 dnl On Linux /tmp is often tmpfs which is not large enough, so use /var/tmp.
244 dnl But Haiku only has /tmp.
245 AC_MSG_CHECKING([for temporary directory for large files])
247 [haiku*], [LARGE_TMPDIR=/tmp],
248 [LARGE_TMPDIR=/var/tmp]
250 AC_MSG_RESULT([$LARGE_TMPDIR])
251 AC_DEFINE_UNQUOTED([LARGE_TMPDIR],["$LARGE_TMPDIR"],
252 [Temporary directory for large files])
254 dnl Check if libc has program_invocation_short_name.
255 AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
259 dnl Check if __attribute__((cleanup(...))) works.
260 dnl Set -Werror, otherwise gcc will only emit a warning for attributes
261 dnl that it doesn't understand.
262 acx_nbdkit_save_CFLAGS="${CFLAGS}"
263 CFLAGS="${CFLAGS} -Werror"
264 AC_MSG_CHECKING([if __attribute__((cleanup(...))) works with this compiler])
279 __attribute__((cleanup(freep))) char *ptr = malloc (100);
284 main (int argc, char *argv[])
295 ['__attribute__((cleanup(...)))' does not work.
297 You may not be using a sufficiently recent version of GCC or CLANG, or
298 you may be using a C compiler which does not support this attribute,
299 or the configure test may be wrong.
301 This code requires the attribute to work for proper locking between threads.])])
302 CFLAGS="${acx_nbdkit_save_CFLAGS}"
304 dnl Check for __auto_type (GCC extension).
305 AC_MSG_CHECKING([if __auto_type is available in this compiler])
317 AC_DEFINE([HAVE_AUTO_TYPE],[1],[__auto_type is available])
323 dnl 'environ' is not always declared in public header files:
324 dnl Linux => <unistd.h> Haiku => <stdlib.h>
325 dnl FreeBSD & OpenBSD => not declared
326 dnl On platforms where it's not declared we must add an extern decl.
327 AC_MSG_CHECKING([if environ is declared in header files])
335 const char **env = environ;
336 return env ? 1 : 0; // this just forces env to be used
341 AC_DEFINE([HAVE_ENVIRON_DECL],[1],[environ is declared in headers])
347 dnl Check for other headers, all optional.
376 AC_CHECK_HEADERS([linux/vm_sockets.h], [], [], [#include <sys/socket.h>])
378 dnl Check for functions in libc, all optional.
398 dnl Check for structs and members.
399 AC_CHECK_MEMBERS([struct dirent.d_type], [], [], [[#include <dirent.h>]])
400 AC_CHECK_MEMBERS([struct ucred.uid], [], [],
402 #ifdef HAVE_SYS_SOCKET_H
403 #include <sys/socket.h>
405 #ifdef HAVE_SYS_UCRED_H
406 #include <sys/ucred.h>
409 AC_CHECK_MEMBERS([struct sockpeercred.uid], [], [],
411 #ifdef HAVE_SYS_SOCKET_H
412 #include <sys/socket.h>
416 dnl Replacement functions that we provide for some platforms.
417 AC_CONFIG_LIBOBJ_DIR([common/replacements])
421 get_current_dir_name \
436 dnl Check whether printf("%m") works
437 AC_CACHE_CHECK([whether the printf family supports %m],
438 [nbdkit_cv_func_printf_percent_m],
447 snprintf(buf, sizeof buf, "%m");
448 return !!strcmp (buf, strerror (EINVAL));
450 [nbdkit_cv_func_printf_percent_m=yes],
451 [nbdkit_cv_func_printf_percent_m=no],
454 *-gnu* | gnu*) nbdkit_cv_func_printf_percent_m=yes;;
455 *) nbdkit_cv_func_printf_percent_m="guessing no";;
458 AS_IF([test "x$nbdkit_cv_func_printf_percent_m" = xyes],
459 [AC_DEFINE([HAVE_VFPRINTF_PERCENT_M],[1],
460 [Define to 1 if vfprintf supports %m.])])
463 AC_SEARCH_LIBS([dlsym], [dl dld], [
464 AS_IF([test "x$ac_cv_search_dlsym" != "xnone required"],
465 [DL_LIBS="$ac_cv_search_dlsym"], [DL_LIBS=])
467 ], [AC_MSG_ERROR([unable to find the dlsym() function])
471 dnl Test if <iconv.h> header can build working binaries.
473 dnl On FreeBSD: iconv and libiconv both exist, both can be installed
474 dnl simultaneously, <iconv.h> can exist in two separate places, and
475 dnl if you get the wrong header/library mix everything breaks.
477 dnl On Haiku: libiconv is required to link to iconv_* functions.
479 [AS_HELP_STRING([--without-iconv],
480 [don't try to link against iconv @<:@default=check@:>@])],
483 AS_IF([test "x$with_iconv" != "xno"],[
484 AC_CHECK_HEADER([iconv.h],[
485 AC_MSG_CHECKING([if <iconv.h> can be used to link a program])
492 main (int argc, char *argv[])
494 iconv_t ic = iconv_open ("", "");
507 AM_CONDITIONAL([HAVE_ICONV], [test "x$iconv_working" = "xyes"])
509 use_linker_script=yes
511 dnl Don't use linker script on FreeBSD because FreeBSD's linker is
513 dnl https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190851
514 dnl Also on macOS (darwin) which fails with:
515 dnl ld: unknown option: --version-script=./nbdkit.syms
516 dnl clang: error: linker command failed with exit code 1
517 AC_MSG_CHECKING([if we should disable the linker script (FreeBSD, macOS)])
519 [freebsd*|darwin*], [
523 [AC_MSG_RESULT([no])]
526 dnl Check if -rdynamic linker flag works.
527 acx_nbdkit_save_LDFLAGS="${LDFLAGS}"
528 LDFLAGS="${LDFLAGS} -rdynamic"
529 AC_MSG_CHECKING([if linker supports -rdynamic])
534 main (int argc, char *argv[])
546 LDFLAGS="${acx_nbdkit_save_LDFLAGS}"
547 AC_SUBST([DL_LDFLAGS])
549 dnl Check for dladdr in -ldl, optional. This is a glibc extension.
551 LIBS="$DL_LIBS $LIBS"
552 AC_CHECK_FUNCS([dladdr])
556 AC_MSG_CHECKING([if the target is Windows])
560 LIBS="$LIBS -lmsvcrt -lkernel32 -luser32 -lws2_32"
561 NO_UNDEFINED_ON_WINDOWS="-no-undefined"
562 IMPORT_LIBRARY_ON_WINDOWS='-Wl,-L$(top_builddir)/server -Wl,-lnbdkit'
564 DIR_SEPARATOR_STR='\\'
570 AC_MSG_RESULT([$is_windows])
571 AC_SUBST([NO_UNDEFINED_ON_WINDOWS])
572 AC_SUBST([IMPORT_LIBRARY_ON_WINDOWS])
574 AC_DEFINE_UNQUOTED([SOEXT],["$SOEXT"],[Extension used for shared objects/DLLs.])
575 AC_DEFINE_UNQUOTED([EXEEXT],["$EXEEXT"],[Extension used for executables.])
576 AC_DEFINE_UNQUOTED([DIR_SEPARATOR_STR],["$DIR_SEPARATOR_STR"],
577 [String that separates path elements.])
578 AM_CONDITIONAL([IS_WINDOWS],[test "x$is_windows" = "xyes"])
580 AS_IF([test "x$is_windows" = "xyes"],[
581 dnl For Windows, look for the mc/windmc utility.
582 dnl XXX Do we need to check for mc.exe as well?
583 AC_CHECK_TOOLS([MC],[windmc mc],[no])
584 AS_IF([test "x$MC" = "xno"],
585 [AC_MSG_ERROR([mc/windmc utility must be available when compiling for Windows])])
587 dnl On Windows look for dlltool.
588 AC_CHECK_TOOLS([DLLTOOL],[dlltool],[no])
589 AS_IF([test "x$DLLTOOL" = "xno"],
590 [AC_MSG_ERROR([dlltool utility must be available when compiling for Windows])])
593 AC_SEARCH_LIBS([getaddrinfo], [network socket])
595 dnl Does this platform require libc_malloc_debug.so.0 (glibc >= 2.34)?
596 AC_MSG_CHECKING([if this is glibc >= 2.34])
597 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
599 #if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 34)
600 #error "not glibc 2.34"
602 ]])], [is_glibc_234=yes], [is_glibc_234=no]
604 AC_MSG_RESULT([$is_glibc_234])
605 AM_CONDITIONAL([HAVE_GLIBC_234], [test "x$is_glibc_234" = "xyes"])
607 dnl Check for SELinux socket labelling (optional).
608 AC_ARG_WITH([selinux],
609 AS_HELP_STRING([--without-selinux], [disable SELinux support, used for socket labelling @<:@default=check@:>@]))
610 AS_IF([test "x$with_selinux" != xno], [
611 PKG_CHECK_MODULES([LIBSELINUX], [libselinux], [
612 AC_SUBST([LIBSELINUX_CFLAGS])
613 AC_SUBST([LIBSELINUX_LIBS])
614 AC_DEFINE([HAVE_LIBSELINUX],[1],[libselinux found at compile time.])
615 ], [AC_MSG_WARN([libselinux not found, sockets will not be labeled.])])
618 AS_IF([test "x$with_selinux" = xyes && test "x$LIBSELINUX_LIBS" = x], [
619 AC_MSG_ERROR([selinux requested but not found])
622 dnl Check for GnuTLS (optional, for TLS support).
623 AC_ARG_WITH([gnutls],
624 [AS_HELP_STRING([--without-gnutls], [disable TLS support via GnuTLS @<:@default=check@:>@])],
626 [: m4_divert_text([DEFAULTS], [with_manpages=check])])
628 AS_IF([test "x$with_gnutls" != xno], [
629 PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3.0], [
630 AC_SUBST([GNUTLS_CFLAGS])
631 AC_SUBST([GNUTLS_LIBS])
632 AC_DEFINE([HAVE_GNUTLS],[1],[gnutls found at compile time.])
634 AC_MSG_WARN([gnutls not found or < 3.3.0, TLS support will be disabled.])
638 AS_IF([test "x$with_gnutls" = xyes && test x"$GNUTLS_LIBS" = x], [
639 AC_MSG_ERROR([gnutls requested but not found])
642 AM_CONDITIONAL([HAVE_GNUTLS], [test "x$GNUTLS_LIBS" != "x"])
644 AS_IF([test "x$GNUTLS_LIBS" != "x"],[
645 AC_MSG_CHECKING([for default TLS session priority string])
646 AC_ARG_WITH([tls-priority],
647 [AS_HELP_STRING([--with-tls-priority=...],
648 [default TLS session priority string @<:@default=NORMAL@:>@])],
649 [tls_priority=$withval],
650 [tls_priority=NORMAL])
651 AC_MSG_RESULT([$tls_priority])
652 AC_DEFINE_UNQUOTED([TLS_PRIORITY],["$tls_priority"],
653 [Default TLS session priority string])
655 # Check for APIs which may not be present.
657 LIBS="$GNUTLS_LIBS $LIBS"
659 gnutls_base64_decode2 \
660 gnutls_certificate_set_known_dh_params \
662 gnutls_group_get_name \
664 gnutls_session_set_verify_cert \
665 gnutls_srp_server_get_username \
666 gnutls_transport_is_ktls_enabled \
668 AC_CHECK_HEADERS([gnutls/socket.h])
671 dnl macOS has its own program called certtool and packages the
672 dnl GnuTLS tool as "gnutls-certtool".
673 AC_CHECK_PROGS([CERTTOOL],[gnutls-certtool certtool],[certtool])
675 AM_CONDITIONAL([HAVE_GNUTLS_PBKDF2],
676 [test "x$GNUTLS_LIBS" != "x" && test "x$ac_cv_func_gnutls_pbkdf2" = xyes])
678 dnl Check for some commands used by the tests which should be the GNU
679 dnl coreutils variants. On macOS these are prefixed with 'g' or 'gnu'.
680 AC_CHECK_PROGS([CUT],[gnucut cut],[cut])
681 AC_CHECK_PROGS([STAT],[gstat stat],[stat])
682 AC_CHECK_PROGS([TRUNCATE],[gtruncate truncate],[truncate])
684 AC_ARG_ENABLE([linuxdisk],
685 [AS_HELP_STRING([--disable-linuxdisk],
686 [disable linuxdisk plugin @<:@default=check@:>@])],
688 [enable_linuxdisk=check])
689 dnl Check for mke2fs -d (used by linuxdisk plugin). There are two
690 dnl possible outcomes that we care about: (1) We have mke2fs and
691 dnl it supports the -d option. (2) We either don't have mke2fs
692 dnl or it's too old to support the -d option (eg. on RHEL 7).
694 AS_IF([test "$enable_linuxdisk" != "no"], [
695 AC_MSG_CHECKING([for mke2fs supporting the -d option])
696 AS_IF([mke2fs -V >/dev/null 2>&1], [
697 AS_IF([LANG=C mke2fs -d 2>&1 | grep -sq "option requires an argument"], [
701 AC_MSG_RESULT([$mke2fs_with_d])
703 AM_CONDITIONAL([HAVE_MKE2FS_WITH_D],[test "x$mke2fs_with_d" = "xyes"])
705 dnl Check for valgrind.
706 AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind],[no])
708 dnl If valgrind headers are available (optional).
709 dnl Although the runtime check adds only a trivial amount of code, you can
710 dnl avoid it with explicit --disable-valgrind.
711 AC_ARG_ENABLE([valgrind],
712 [AS_HELP_STRING([--disable-valgrind],
713 [disable Valgrind probe])],
715 [enable_valgrind=check])
716 AS_IF([test "x$enable_valgrind" != "xno"],[
717 PKG_CHECK_MODULES([VALGRIND], [valgrind], [
718 AC_SUBST([VALGRIND_CFLAGS])
719 AC_SUBST([VALGRIND_LIBS])
720 AC_DEFINE([HAVE_VALGRIND],[1],[Valgrind headers found at compile time])
722 AS_IF([test "x$enable_valgrind" = "xyes"], [
723 AC_MSG_ERROR([--enable-valgrind given, but Valgrind headers are not available])
728 dnl Build the special libFuzzer version of nbdkit. DO NOT USE THIS for
729 dnl normal builds. See fuzzing/README.
730 AC_ARG_ENABLE([libfuzzer],
731 [AS_HELP_STRING([--enable-libfuzzer],
732 [build libFuzzer test binary (developers only)])],
734 [enable_libfuzzer=no])
735 AS_IF([test "x$enable_libfuzzer" = "xyes"],[
736 AC_DEFINE([ENABLE_LIBFUZZER],[1],[Enable special libFuzzer binary])
737 # We have to disable the linker script for libFuzzer because Clang
738 # adds loads of fuzzer and ASAN-related symbols that are required
739 # by the plugins but which our linker script tries to hide.
742 AM_CONDITIONAL([ENABLE_LIBFUZZER],[test "x$enable_libfuzzer" = "xyes"])
744 dnl Should we use the linker script (ld --version-script)? Note
745 dnl some tests above may set this variable.
746 AC_ARG_ENABLE([linker-script],
747 [AS_HELP_STRING([--disable-linker-script],
748 [disable linker script for server (developers only)])],
749 [use_linker_script=$enableval],
751 AM_CONDITIONAL([USE_LINKER_SCRIPT],
752 [test "x$use_linker_script" = "xyes"])
755 AC_ARG_WITH([bash-completions],
756 [AS_HELP_STRING([--without-bash-completions], [disable installing bash completions @<:@default=check@:>@])],
758 [: m4_divert_text([DEFAULTS], [with_readline=check])])
760 AS_IF([test "x$with_bash_completions" != xno], [
761 PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [
763 AC_MSG_CHECKING([for bash-completions directory])
764 m4_ifdef([PKG_CHECK_VAR],[
765 PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir])
767 AS_IF([test -z "$bashcompdir"], [
768 bashcompdir="${sysconfdir}/bash_completion.d"
770 AC_MSG_RESULT([$bashcompdir])
771 AC_SUBST([bashcompdir])
774 AC_MSG_WARN([bash-completion not installed])
778 AS_IF([test "x$bash_completion" = xno && test "x$with_bash_completions" = xyes], [
779 AC_MSG_ERROR([bash-completions requested but required packages not found])
782 AM_CONDITIONAL([HAVE_BASH_COMPLETION],[test "x$bash_completion" = "xyes"])
784 dnl Check we have enough to run podwrapper.
786 AC_ARG_WITH([manpages],
787 [AS_HELP_STRING([--without-manpages], [Do not build man pages @<:@default=check@:>@])],
789 [: m4_divert_text([DEFAULTS], [with_manpages=check])])
792 AC_CHECK_PROGS([PERL], [perl], [])
794 AS_IF([test "x$enable_manpages" != xno], [
795 AS_IF([test "x$PERL" != "x"],[
796 AC_MSG_CHECKING([if we have perl Pod::Man and Pod::Simple])
797 AS_IF([$PERL -MPod::Man -MPod::Simple -e 1 >&AS_MESSAGE_LOG_FD 2>&1],[
800 AC_MSG_RESULT([$enable_pod])
804 AS_IF([test "x$enable_pod" = xno && test "x$enable_manpages" = xyes], [
805 AC_MSG_ERROR([man-pages requested but required packages not found])
808 AM_CONDITIONAL([HAVE_POD],
809 [test "x$PERL" != "xno" && test "x$enable_pod" = "xyes"])
811 dnl Define the path to the podwrapper program.
812 PODWRAPPER="$PERL $(pwd)/podwrapper.pl"
813 AC_SUBST([PODWRAPPER])
815 dnl Allow all plugins and filters to be disabled.
816 AC_ARG_ENABLE([plugins],
817 [AS_HELP_STRING([--disable-plugins],
818 [disable all bundled plugins and filters])])
819 AM_CONDITIONAL([HAVE_PLUGINS], [test "x$enable_plugins" != "xno"])
821 dnl Check for Perl, for embedding in the perl plugin.
822 dnl Note that the perl binary is checked above.
823 AC_ARG_ENABLE([perl],
824 [AS_HELP_STRING([--disable-perl], [disable Perl embed plugin])],
827 AS_IF([test "x$PERL" != "xno" && test "x$enable_perl" != "xno"],[
828 dnl Check for Perl archlib.
829 AC_MSG_CHECKING([for Perl embed archlib])
830 PERL_ARCHLIB="$($PERL -MConfig -e 'print $Config{archlib}')"
831 AS_IF([ test -n "$PERL_ARCHLIB" ],[
832 AC_MSG_RESULT([$PERL_ARCHLIB])
834 AC_MSG_NOTICE([Perl embed module disabled])
838 dnl Check for Perl CFLAGS.
839 AC_MSG_CHECKING([for Perl embed CFLAGS])
840 PERL_CFLAGS="$($PERL -MExtUtils::Embed -e 'ccflags')"
841 AS_IF([ test -n "$PERL_CFLAGS" ],[
842 AC_MSG_RESULT([$PERL_CFLAGS])
844 AC_MSG_NOTICE([Perl embed module disabled])
848 dnl Check for Perl LDOPTS.
849 AC_MSG_CHECKING([for Perl embed LDOPTS])
850 PERL_LDOPTS="$($PERL -MExtUtils::Embed -e 'ldopts')"
851 AC_MSG_RESULT([$PERL_LDOPTS])
853 dnl Check these actually work.
854 AC_MSG_CHECKING([whether Perl modules will compile])
857 CFLAGS="$PERL_CFLAGS -I$PERL_ARCHLIB/CORE $CFLAGS"
858 LIBS="$PERL_LDOPTS $LIBS"
859 AC_CHECK_FUNCS([perl_alloc])
862 if test "x$ac_cv_func_perl_alloc" != xyes; then
866 AM_CONDITIONAL([HAVE_PERL],[test "x$enable_perl" != "xno" && test "x$PERL" != "xno"])
867 AC_SUBST([PERL_ARCHLIB])
868 AC_SUBST([PERL_CFLAGS])
869 AC_SUBST([PERL_LDOPTS])
871 dnl Check for Python 3, for embedding in the python plugin.
872 AC_PATH_PROGS([PYTHON],[python3 python],[no])
873 AC_ARG_ENABLE([python],
874 [AS_HELP_STRING([--disable-python], [disable Python embed plugin])],
877 AS_IF([test "x$PYTHON" != "xno" && test "x$enable_python" != "xno"],[
878 AC_MSG_CHECKING([version of $PYTHON])
879 PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info@<:@0@:>@)"`
880 PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info@<:@1@:>@)"`
881 PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR"
882 AS_IF([test -n "$PYTHON_VERSION"],[
883 AC_MSG_RESULT([$PYTHON_VERSION])
885 AC_MSG_NOTICE([Python embed module disabled])
889 AC_MSG_CHECKING([Python major version is 3])
890 AS_IF([test "x$PYTHON_VERSION_MAJOR" = "x3"],[
894 AC_MSG_ERROR([Python $PYTHON_VERSION_MAJOR <> 3 is no longer supported.
896 Python 2 end of life is 2020-01-01 and nbdkit >= 1.16 no longer
899 If you want to use Python 2, you will need to use nbdkit 1.14.])
902 dnl Check for Python CFLAGS, libraries.
903 dnl For Python >= 3.8 we have to use python-<VERSION>-embed.pc, see:
904 dnl https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
905 dnl The python.pc is called python-<VERSION>.pc on Debian and
906 dnl later versions of Fedora, and python.pc on older versions
908 PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"-embed], [
909 AC_SUBST([PYTHON_CFLAGS])
910 AC_SUBST([PYTHON_LIBS])
911 AC_SUBST([PYTHON_VERSION])
912 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
914 PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"], [
915 AC_SUBST([PYTHON_CFLAGS])
916 AC_SUBST([PYTHON_LIBS])
917 AC_SUBST([PYTHON_VERSION])
918 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
920 PKG_CHECK_MODULES([PYTHON], [python], [
921 AC_SUBST([PYTHON_CFLAGS])
922 AC_SUBST([PYTHON_LIBS])
923 AC_SUBST([PYTHON_VERSION])
924 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
926 AC_MSG_WARN([python $PYTHON_VERSION not found])
930 AM_CONDITIONAL([HAVE_PYTHON],[test "x$enable_python" != "xno" && test "x$PYTHON" != "xno"])
931 AC_SUBST([PYTHON_CFLAGS])
932 AC_SUBST([PYTHON_LIBS])
933 AC_SUBST([PYTHON_LDFLAGS])
935 dnl For the OCaml plugin, you can set OCAMLOPTFLAGS before running
936 dnl ./configure to specify any extra flags you want to pass to
937 dnl ocamlopt. For example to enable OCaml warnings:
938 dnl OCAMLOPTFLAGS="-warn-error +A-3"
939 AC_SUBST([OCAMLOPTFLAGS])
941 dnl Check for OCaml, for embedding in the ocaml plugin.
943 AC_ARG_ENABLE([ocaml],
944 [AS_HELP_STRING([--disable-ocaml], [disable OCaml embed plugin])],
947 AS_IF([test "x$OCAMLOPT" != "xno" && test "x$enable_ocaml" != "xno"],[
948 dnl Check OCaml can create a shared library (see README for details).
949 AC_MSG_CHECKING([if $OCAMLOPT can create a shared library])
950 echo 'print_endline "test"' > conftest.ml
951 AS_IF([$OCAMLOPT $OCAMLOPTFLAGS -output-obj -runtime-variant _pic -o conftest.so conftest.ml >&AS_MESSAGE_LOG_FD 2>&1],[
953 ocaml_link_shared=yes
957 rm -f conftest.ml conftest.cmi conftest.cmx conftest.so conftest.o
959 AM_CONDITIONAL([HAVE_OCAML],[test "x$OCAMLOPT" != "xno" &&
960 test "x$ocaml_link_shared" = "xyes"])
961 AM_CONDITIONAL([HAVE_OCAMLDOC],[test "x$OCAMLDOC" != "xno"])
963 dnl Check if OCaml has caml_alloc_initialized_string (added 2017).
964 AS_IF([test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && \
965 test "x$enable_ocaml" = "xyes"],[
966 AC_MSG_CHECKING([for caml_alloc_initialized_string])
967 cat >conftest.c <<'EOF'
968 #include <caml/alloc.h>
969 int main () { char *p = (void *) caml_alloc_initialized_string; return 0; }
971 AS_IF([$OCAMLC conftest.c >&AS_MESSAGE_LOG_FD 2>&1],[
973 AC_DEFINE([HAVE_CAML_ALLOC_INITIALIZED_STRING],[1],
974 [caml_alloc_initialized_string found at compile time.])
978 rm -f conftest.c conftest.o
981 dnl Check if OCaml has caml_shutdown (added 2014).
982 AS_IF([test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && \
983 test "x$enable_ocaml" = "xyes"],[
984 AC_MSG_CHECKING([for caml_shutdown])
985 cat >conftest.c <<'EOF'
986 #include <caml/callback.h>
987 int main () { char *p = (void *) caml_shutdown; return 0; }
989 AS_IF([$OCAMLC conftest.c >&AS_MESSAGE_LOG_FD 2>&1],[
991 AC_DEFINE([HAVE_CAML_SHUTDOWN],[1],
992 [caml_shutdown found at compile time.])
996 rm -f conftest.c conftest.o
999 dnl For developing plugins in Rust, optional.
1000 dnl Rust does not play nicely with VPATH builds
1001 AC_CHECK_PROG([CARGO],[cargo],[cargo],[no])
1002 AC_CHECK_PROG([RUSTC],[rustc],[rustc],[no])
1003 AC_ARG_ENABLE([rust],
1004 [AS_HELP_STRING([--disable-rust], [disable Rust plugin])],
1006 [if test "x$(realpath $srcdir)" = "x$(realpath .)"; then
1011 AS_IF([test "x$enable_rust" != "xno" && test "x$CARGO" != "xno" && test "x$RUSTC" != "xno"],
1012 [have_rust=yes], [have_rust=no])
1013 AM_CONDITIONAL([HAVE_RUST], [test "x$have_rust" = "xyes"])
1014 AS_IF([test "x$have_rust" = "xyes"], [
1015 printf "cargo version: "; $CARGO --version
1016 printf "rustc version: "; $RUSTC --version
1019 dnl Check for Ruby, for embedding in the Ruby plugin.
1020 AC_CHECK_PROG([RUBY],[ruby],[ruby],[no])
1021 AC_ARG_ENABLE([ruby],
1022 [AS_HELP_STRING([--disable-ruby], [disable Ruby plugin])],
1025 AS_IF([test "x$RUBY" != "xno" && test "x$enable_ruby" != "xno"],[
1026 PKG_CHECK_MODULES([RUBY], [ruby], [
1027 AC_SUBST([RUBY_CFLAGS])
1028 AC_SUBST([RUBY_LIBS])
1030 AC_MSG_WARN([ruby not found])
1034 AM_CONDITIONAL([HAVE_RUBY],[test "x$RUBY" != "xno" &&
1035 test "x$enable_ruby" = "xyes"])
1037 dnl Check for Tcl, for embedding in the Tcl plugin.
1038 AC_ARG_ENABLE([tcl],
1039 [AS_HELP_STRING([--disable-tcl], [disable Tcl plugin])],
1042 AS_IF([test "x$enable_tcl" != "xno"],[
1043 PKG_CHECK_MODULES([TCL], [tcl], [
1044 AC_SUBST([TCL_CFLAGS])
1045 AC_SUBST([TCL_LIBS])
1047 AC_MSG_WARN([Tcl not found])
1051 AM_CONDITIONAL([HAVE_TCL],[test "x$enable_tcl" = "xyes"])
1053 dnl Check for Lua, for embedding in the Lua plugin.
1054 AC_ARG_ENABLE([lua],
1055 [AS_HELP_STRING([--disable-lua], [disable Lua plugin])],
1058 AS_IF([test "x$enable_lua" != "xno"],[
1059 PKG_CHECK_MODULES([LUA], [lua], [
1060 AC_SUBST([LUA_CFLAGS])
1061 AC_SUBST([LUA_LIBS])
1063 dnl Lua 5.1 used by RHEL 7 does not have lua_isinteger.
1065 LIBS="$LUA_LIBS $LIBS"
1066 AC_CHECK_FUNCS([lua_isinteger])
1069 AC_MSG_WARN([Lua not found])
1073 AM_CONDITIONAL([HAVE_LUA],[test "x$enable_lua" = "xyes"])
1075 dnl Check for golang.
1076 AC_ARG_ENABLE([golang],
1077 AS_HELP_STRING([--disable-golang], [disable Go language plugin]),
1079 [enable_golang=yes])
1080 AS_IF([test "x$enable_golang" != "xno"],[
1081 AC_CHECK_PROG([GOLANG],[go],[go],[no])
1082 AS_IF([test "x$GOLANG" != "xno"],[
1083 AC_MSG_CHECKING([if $GOLANG is usable])
1084 AS_IF([$GOLANG run $srcdir/plugins/golang/config-test.go 2>&AS_MESSAGE_LOG_FD && \
1085 $GOLANG help modules 2>&AS_MESSAGE_LOG_FD 1>&2],[
1086 AC_MSG_RESULT([yes])
1088 # Substitute some golang environment.
1089 GOOS=`$GOLANG env GOOS`
1090 GOARCH=`$GOLANG env GOARCH`
1091 GOROOT=`$GOLANG env GOROOT`
1097 AC_MSG_WARN([golang ($GOLANG) is installed but not usable])
1102 AM_CONDITIONAL([HAVE_GOLANG],[test "x$GOLANG" != "xno"])
1104 dnl Check for libblkio (only if you want to compile the blkio plugin).
1105 AC_ARG_WITH([libblkio],
1106 [AS_HELP_STRING([--without-libblkio],
1107 [disable blkio plugin @<:@default=check@:>@])],
1109 [with_libblkio=check])
1110 AS_IF([test "$with_libblkio" != "no"],[
1111 PKG_CHECK_MODULES([LIBBLKIO], [blkio],[
1112 printf "libblkio version is "; $PKG_CONFIG --modversion blkio
1113 AC_SUBST([LIBBLKIO_CFLAGS])
1114 AC_SUBST([LIBBLKIO_LIBS])
1115 AC_DEFINE([HAVE_LIBBLKIO],[1],[libblkio found at compile time.])
1117 [AC_MSG_WARN([libblkio not found, blkio plugin will be disabled])])
1119 AM_CONDITIONAL([HAVE_LIBBLKIO],[test "x$LIBBLKIO_LIBS" != "x"])
1121 dnl Check for curl (only if you want to compile the curl plugin).
1123 [AS_HELP_STRING([--without-curl],
1124 [disable curl plugin @<:@default=check@:>@])],
1127 AS_IF([test "$with_curl" != "no"],[
1128 PKG_CHECK_MODULES([CURL], [libcurl],[
1129 printf "libcurl version is "; $PKG_CONFIG --modversion libcurl
1130 AC_SUBST([CURL_CFLAGS])
1131 AC_SUBST([CURL_LIBS])
1132 AC_DEFINE([HAVE_CURL],[1],[curl found at compile time.])
1133 AC_CHECK_DECL([CURLOPT_UNIX_SOCKET_PATH], [
1134 AC_DEFINE([HAVE_CURLOPT_UNIX_SOCKET_PATH],[1],
1135 [CURLOPT_UNIX_SOCKET_PATH found at compile time.])
1136 ], [], [#include <curl/curl.h>])
1138 [AC_MSG_WARN([curl not found, curl plugin will be disabled])])
1140 AM_CONDITIONAL([HAVE_CURL],[test "x$CURL_LIBS" != "x"])
1142 dnl Check for libssh (only if you want to compile the ssh plugin).
1144 [AS_HELP_STRING([--without-ssh],
1145 [disable ssh plugin @<:@default=check@:>@])],
1148 AS_IF([test "$with_ssh" != "no"],[
1149 PKG_CHECK_MODULES([SSH], [libssh >= 0.8.0],[
1150 printf "libssh version is "; $PKG_CONFIG --modversion libssh
1151 # Ubuntu 18.04 shipped prerelease of libssh-0.8.0 without
1152 # SSH_OPTIONS_NODELAY
1153 old_CFLAGS="$CFLAGS"
1154 CFLAGS="$CFLAGS $SSH_CFLAGS"
1155 AC_CHECK_DECL([SSH_OPTIONS_NODELAY], [
1156 AC_SUBST([SSH_CFLAGS])
1157 AC_SUBST([SSH_LIBS])
1158 # We don't need this in the code, just in this configure
1159 HAVE_SSH_OPTIONS_NODELAY=1
1161 #include <libssh/libssh.h>
1163 CFLAGS="$old_CFLAGS"
1165 [AC_MSG_WARN([libssh not found, ssh plugin will be disabled])])
1167 AM_CONDITIONAL([HAVE_SSH],[test "x$HAVE_SSH_OPTIONS_NODELAY" != "x"])
1169 dnl Check for xorriso or genisoimage or mkisofs
1170 dnl (only if you want to compile the iso plugin).
1174 [AS_HELP_STRING([--without-iso],
1175 [disable iso plugin @<:@default=check@:>@])],
1178 AS_IF([test "$with_iso" != "no"],[
1179 AC_CHECK_PROG([XORRISO],[xorriso],[xorriso],[no])
1180 AC_CHECK_PROG([GENISOIMAGE],[genisoimage],[genisoimage],[no])
1181 AC_CHECK_PROG([MKISOFS],[mkisofs],[mkisofs],[no])
1182 AS_IF([test "x$XORRISO" != "xno"],[
1186 AS_IF([test "x$GENISOIMAGE" != "xno"],[
1187 ISOPROG="$GENISOIMAGE"
1189 AS_IF([test "x$MKISOFS" != "xno"],[
1194 AS_IF([test "x$ISOPROG" != "xno"],[
1195 printf "picked %s for nbdkit-iso-plugin\n" "$ISOPROG"
1196 AC_DEFINE_UNQUOTED([ISOPROG],["$ISOPROG"],
1197 [Program used by iso plugin to make ISOs.])
1198 AS_IF([test "x$is_xorriso" = "x1"], [
1199 AC_DEFINE([ISOPROG_IS_XORRISO],[1],
1200 [ISO program behaves like xorriso.])
1205 AM_CONDITIONAL([HAVE_ISO],[test "x$ISOPROG" != "xno"])
1207 dnl Check for libvirt (only if you want to compile the libvirt plugin).
1208 AC_ARG_WITH([libvirt],
1209 [AS_HELP_STRING([--without-libvirt],
1210 [disable libvirt plugin @<:@default=check@:>@])],
1212 [with_libvirt=check])
1213 AS_IF([test "$with_libvirt" != "no"],[
1214 PKG_CHECK_MODULES([LIBVIRT], [libvirt],[
1215 AC_SUBST([LIBVIRT_CFLAGS])
1216 AC_SUBST([LIBVIRT_LIBS])
1217 AC_DEFINE([HAVE_LIBVIRT],[1],[libvirt found at compile time.])
1219 [AC_MSG_WARN([libvirt not found, libvirt plugin will be disabled])])
1221 AM_CONDITIONAL([HAVE_LIBVIRT],[test "x$LIBVIRT_LIBS" != "x"])
1223 dnl Check for zlib (only if you want to compile the gzip filter).
1225 [AS_HELP_STRING([--without-zlib],
1226 [disable gzip filter @<:@default=check@:>@])],
1229 AS_IF([test "$with_zlib" != "no"],[
1230 PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3.5],[
1231 AC_SUBST([ZLIB_CFLAGS])
1232 AC_SUBST([ZLIB_LIBS])
1233 AC_DEFINE([HAVE_ZLIB],[1],[zlib found at compile time.])
1235 [AC_MSG_WARN([zlib >= 1.2.3.5 not found, gzip filter will be disabled])])
1237 AM_CONDITIONAL([HAVE_ZLIB],[test "x$ZLIB_LIBS" != "x"])
1239 dnl Check for libnbd (only if you want to compile the nbd plugin).
1240 AC_ARG_WITH([libnbd],
1241 [AS_HELP_STRING([--without-libnbd],
1242 [disable nbd plugin @<:@default=check@:>@])],
1244 [with_libnbd=check])
1245 AS_IF([test "$with_libnbd" != "no"],[
1246 PKG_CHECK_MODULES([LIBNBD], [libnbd >= 0.9.8],[
1247 printf "libnbd version is "; $PKG_CONFIG --modversion libnbd
1248 AC_SUBST([LIBNBD_CFLAGS])
1249 AC_SUBST([LIBNBD_LIBS])
1250 AC_DEFINE([HAVE_LIBNBD],[1],[libnbd found at compile time.])
1252 [AC_MSG_WARN([libnbd >= 0.9.8 not found, nbd plugin will be crippled])])
1255 dnl For backwards compatibilty, we have a second way to disable the nbd plugin.
1256 AC_ARG_ENABLE([nbd-plugin],
1257 [AS_HELP_STRING([--disable-nbd-plugin], [disable nbd plugin (deprecated, use --without-libnbd)])],
1259 [enable_nbd_plugin=yes])
1260 AM_CONDITIONAL([HAVE_LIBNBD],
1261 [test "x$LIBNBD_LIBS" != "x" && test "x$enable_nbd_plugin" = "xyes"])
1263 dnl Check for liblzma (only if you want to compile the xz filter).
1264 AC_ARG_WITH([liblzma],
1265 [AS_HELP_STRING([--without-liblzma],
1266 [disable xz filter @<:@default=check@:>@])],
1268 [with_liblzma=check])
1269 AS_IF([test "$with_liblzma" != "no"],[
1270 PKG_CHECK_MODULES([LIBLZMA], [liblzma],[
1271 AC_SUBST([LIBLZMA_CFLAGS])
1272 AC_SUBST([LIBLZMA_LIBS])
1273 AC_DEFINE([HAVE_LIBLZMA],[1],[liblzma found at compile time.])
1275 [AC_MSG_WARN([liblzma not found, xz filter will be disabled])])
1277 AM_CONDITIONAL([HAVE_LIBLZMA],[test "x$LIBLZMA_LIBS" != "x"])
1279 dnl Check for zstd (only if you want to compile allocator=zstd).
1280 AC_ARG_WITH([libzstd],
1281 [AS_HELP_STRING([--without-libzstd],
1282 [disable allocator=zstd @<:@default=check@:>@])],
1284 [with_libzstd=check])
1285 AS_IF([test "$with_libzstd" != "no"],[
1286 PKG_CHECK_MODULES([LIBZSTD], [libzstd],[
1287 AC_SUBST([LIBZSTD_CFLAGS])
1288 AC_SUBST([LIBZSTD_LIBS])
1289 AC_DEFINE([HAVE_LIBZSTD],[1],[libzstd found at compile time.])
1291 [AC_MSG_WARN([libzstd not found, allocator=zstd will be disabled])])
1293 AM_CONDITIONAL([HAVE_LIBZSTD],[test "x$LIBZSTD_LIBS" != "x"])
1295 dnl Check for libguestfs (only for the guestfs plugin and parts of
1296 dnl the test suite).
1297 AC_ARG_WITH([libguestfs],
1298 [AS_HELP_STRING([--without-libguestfs],
1299 [disable guestfs plugin and tests @<:@default=check@:>@])],
1301 [with_libguestfs=check])
1302 AS_IF([test "$with_libguestfs" != "no"],[
1303 PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs],[
1304 # Although the library was found, we want to make sure it supports nbd
1305 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1306 #include <guestfs.h>
1308 #ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL
1312 AC_SUBST([LIBGUESTFS_CFLAGS])
1313 AC_SUBST([LIBGUESTFS_LIBS])
1314 AC_DEFINE([HAVE_LIBGUESTFS],[1],[libguestfs found at compile time.])
1317 AC_MSG_WARN([libguestfs too old, guestfs plugin and tests will be disabled])])
1319 [AC_MSG_WARN([libguestfs not found, guestfs plugin and tests will be disabled])])
1321 AM_CONDITIONAL([HAVE_LIBGUESTFS],[test "x$LIBGUESTFS_LIBS" != "x"])
1323 dnl Disable tests which need libguestfs.
1324 AC_ARG_ENABLE([libguestfs-tests],
1325 [AS_HELP_STRING([--disable-libguestfs-tests],
1326 [disable tests which need libguestfs])],
1328 [enable_libguestfs_tests=check]
1330 AM_CONDITIONAL([USE_LIBGUESTFS_FOR_TESTS],
1331 [test "x$LIBGUESTFS_LIBS" != "x" && \
1332 test "x$enable_libguestfs_tests" != "xno"])
1334 dnl Check for ext2fs and com_err, for the ext2 filter.
1336 [AS_HELP_STRING([--without-ext2],
1337 [disable ext2 filter @<:@default=check@:>@])],
1340 AS_IF([test "$with_ext2" != "no"], [
1341 PKG_CHECK_MODULES([EXT2FS], [ext2fs], [
1342 AC_SUBST([EXT2FS_CFLAGS])
1343 AC_SUBST([EXT2FS_LIBS])
1344 AC_DEFINE([HAVE_EXT2FS],[1],[ext2fs found at compile time.])
1346 [AC_MSG_WARN([ext2fs not found, ext2 filter will be disabled])])
1347 PKG_CHECK_MODULES([COM_ERR], [com_err], [
1348 AC_SUBST([COM_ERR_CFLAGS])
1349 AC_SUBST([COM_ERR_LIBS])
1350 AC_DEFINE([HAVE_COM_ERR],[1],[com_err found at compile time.])
1352 [AC_MSG_WARN([com_err not found, ext2 filter will be disabled])])
1354 AC_CHECK_MEMBERS([struct struct_io_manager.cache_readahead,
1355 struct struct_io_manager.zeroout])
1357 AM_CONDITIONAL([HAVE_EXT2],
1358 [test "x$EXT2FS_LIBS" != "x" && test "x$COM_ERR_LIBS" != "x"])
1360 dnl libtorrent-rasterbar for the bittorrent plugin.
1361 AC_ARG_ENABLE([torrent],
1362 [AS_HELP_STRING([--disable-torrent],
1363 [disable bittorrent plugin])],
1365 [enable_torrent=check]
1367 AS_IF([test "x$enable_torrent" != "xno"], [
1368 PKG_CHECK_MODULES([LIBTORRENT], [libtorrent-rasterbar], [
1369 AC_SUBST([LIBTORRENT_CFLAGS])
1370 AC_SUBST([LIBTORRENT_LIBS])
1372 [AC_MSG_WARN([libtorrent-rasterbar not found, bittorrent plugin will be disabled])])
1374 AM_CONDITIONAL([HAVE_TORRENT],
1375 [test "x$have_cxx" = "xyes" && test "x$LIBTORRENT_LIBS" != "x"])
1377 dnl Check if the user wants to disable VDDK support.
1378 dnl See plugins/vddk/README.VDDK.
1379 AC_ARG_ENABLE([vddk],
1380 [AS_HELP_STRING([--disable-vddk],
1381 [disable VMware VDDK plugin])],
1384 dnl While VDDK was available on i686 in 5.1.1, we only support
1385 dnl newer versions which are supported only on x86-64. Don't
1386 dnl compile on other platforms.
1387 AC_MSG_CHECKING([if the host CPU is compatible with VDDK])
1388 AS_IF([test "$host_cpu" = "x86_64" && test "$host_os" = "linux-gnu"],[
1389 AC_MSG_RESULT([yes ($host)])
1392 AC_MSG_RESULT([no ($host)])
1396 AM_CONDITIONAL([HAVE_VDDK], [test "x$enable_vddk" = "xyes"])
1398 dnl Expose version information to the public headers
1399 [NBDKIT_]VERSION_MAJOR=NBDKIT_VERSION_MAJOR
1400 [NBDKIT_]VERSION_MINOR=NBDKIT_VERSION_MINOR
1401 [NBDKIT_]VERSION_MICRO=NBDKIT_VERSION_MICRO
1402 AC_SUBST([NBDKIT_VERSION_MAJOR])
1403 AC_SUBST([NBDKIT_VERSION_MINOR])
1404 AC_SUBST([NBDKIT_VERSION_MICRO])
1406 dnl Produce output files.
1407 AC_CONFIG_HEADERS([config.h])
1408 AC_CONFIG_FILES([podwrapper.pl],
1409 [chmod +x,-w podwrapper.pl])
1410 AC_CONFIG_FILES([common/protocol/generate-protostrings.sh],
1411 [chmod +x,-w common/protocol/generate-protostrings.sh])
1412 AC_CONFIG_FILES([tests/make-pki.sh],
1413 [chmod +x,-w tests/make-pki.sh])
1414 AC_CONFIG_FILES([Makefile
1415 bash-completion/Makefile
1416 common/allocators/Makefile
1417 common/bitmap/Makefile
1419 common/include/Makefile
1420 common/protocol/Makefile
1421 common/regions/Makefile
1422 common/replacements/Makefile
1423 common/replacements/win32/Makefile
1424 common/utils/Makefile
1427 include/nbdkit-version.h
1429 plugins/blkio/Makefile
1431 plugins/cdi/Makefile
1432 plugins/curl/Makefile
1433 plugins/data/Makefile
1434 plugins/eval/Makefile
1435 plugins/example1/Makefile
1436 plugins/example2/Makefile
1437 plugins/example3/Makefile
1438 plugins/example4/Makefile
1439 plugins/file/Makefile
1440 plugins/floppy/Makefile
1441 plugins/full/Makefile
1442 plugins/golang/Makefile
1443 plugins/guestfs/Makefile
1444 plugins/info/Makefile
1445 plugins/iso/Makefile
1446 plugins/libvirt/Makefile
1447 plugins/linuxdisk/Makefile
1448 plugins/lua/Makefile
1449 plugins/memory/Makefile
1450 plugins/nbd/Makefile
1451 plugins/null/Makefile
1452 plugins/ocaml/Makefile
1453 plugins/ondemand/Makefile
1454 plugins/partitioning/Makefile
1455 plugins/pattern/Makefile
1456 plugins/perl/Makefile
1457 plugins/python/Makefile
1458 plugins/random/Makefile
1459 plugins/ruby/Makefile
1460 plugins/rust/Makefile
1463 plugins/ssh/Makefile
1464 plugins/sparse-random/Makefile
1465 plugins/split/Makefile
1466 plugins/tcl/Makefile
1467 plugins/tmpdisk/Makefile
1468 plugins/torrent/Makefile
1469 plugins/vddk/Makefile
1470 plugins/zero/Makefile
1472 filters/blocksize/Makefile
1473 filters/blocksize-policy/Makefile
1474 filters/cache/Makefile
1475 filters/cacheextents/Makefile
1476 filters/checkwrite/Makefile
1477 filters/cow/Makefile
1478 filters/ddrescue/Makefile
1479 filters/delay/Makefile
1480 filters/error/Makefile
1481 filters/exitlast/Makefile
1482 filters/exitwhen/Makefile
1483 filters/exportname/Makefile
1484 filters/ext2/Makefile
1485 filters/extentlist/Makefile
1486 filters/fua/Makefile
1487 filters/gzip/Makefile
1489 filters/limit/Makefile
1490 filters/log/Makefile
1491 filters/luks/Makefile
1492 filters/multi-conn/Makefile
1493 filters/nocache/Makefile
1494 filters/noextents/Makefile
1495 filters/nofilter/Makefile
1496 filters/noparallel/Makefile
1497 filters/nozero/Makefile
1498 filters/offset/Makefile
1499 filters/partition/Makefile
1500 filters/pause/Makefile
1501 filters/protect/Makefile
1502 filters/rate/Makefile
1503 filters/readahead/Makefile
1504 filters/retry/Makefile
1505 filters/retry-request/Makefile
1506 filters/scan/Makefile
1507 filters/stats/Makefile
1508 filters/swab/Makefile
1509 filters/tar/Makefile
1510 filters/tls-fallback/Makefile
1511 filters/truncate/Makefile
1514 server/local/nbdkit.pc
1526 echo "----------------------------------------------------------------------"
1527 echo "Thank you for downloading $PACKAGE_STRING"
1529 echo "This is how we have configured the optional components for you today:"
1534 printf ' %.40s %s\n' \
1535 "$1 ........................................" "$2"
1549 echo "Optional server features:"
1551 feature "bash-completion" test "x$HAVE_BASH_COMPLETION_TRUE" = "x"
1552 feature "libfuzzer" test "x$ENABLE_LIBFUZZER_TRUE" = "x"
1553 feature "linker script" test "x$USE_LINKER_SCRIPT" = "x"
1554 feature "manual pages" test "x$HAVE_POD_TRUE" = "x"
1555 feature "SELinux" test "x$LIBSELINUX_LIBS" != "x"
1556 feature "TLS" test "x$GNUTLS_LIBS" != "x"
1559 echo "Optional plugins:"
1561 feature "blkio" test "x$HAVE_LIBBLKIO_TRUE" = "x"
1562 feature "curl" test "x$HAVE_CURL_TRUE" = "x"
1563 feature "example4" test "x$HAVE_PERL_TRUE" = "x"
1564 feature "floppy" test "x$HAVE_ICONV_TRUE" = "x"
1565 feature "guestfs" test "x$HAVE_LIBGUESTFS_TRUE" = "x"
1566 feature "iso" test "x$HAVE_ISO_TRUE" = "x"
1567 feature "libvirt" test "x$HAVE_LIBVIRT_TRUE" = "x"
1568 feature "linuxdisk" test "x$HAVE_MKE2FS_WITH_D_TRUE" = "x"
1569 feature "nbd" test "x$HAVE_LIBNBD_TRUE" = "x"
1570 feature "S3" test "x$HAVE_PYTHON_TRUE" = "x"
1571 feature "ssh" test "x$HAVE_SSH_TRUE" = "x"
1572 feature "torrent" test "x$HAVE_TORRENT_TRUE" = "x"
1573 feature "vddk" test "x$HAVE_VDDK_TRUE" = "x"
1578 feature "go" test "x$HAVE_GOLANG_TRUE" = "x"
1579 feature "lua" test "x$HAVE_LUA_TRUE" = "x"
1580 feature "ocaml" test "x$HAVE_OCAML_TRUE" = "x"
1581 feature "perl" test "x$HAVE_PERL_TRUE" = "x"
1582 feature "python" test "x$HAVE_PYTHON_TRUE" = "x"
1583 feature "ruby" test "x$HAVE_RUBY_TRUE" = "x"
1584 feature "rust" test "x$HAVE_RUST_TRUE" = "x"
1585 feature "tcl" test "x$HAVE_TCL_TRUE" = "x"
1588 echo "Optional filters:"
1590 feature "ext2" test "x$HAVE_EXT2_TRUE" = "x"
1591 feature "gzip" test "x$HAVE_ZLIB_TRUE" = "x"
1592 feature "luks" test "x$HAVE_GNUTLS_PBKDF2_TRUE" = "x"
1593 feature "stats" test "x$HAVE_CXX_TRUE" = "x"
1594 feature "xz" test "x$HAVE_LIBLZMA_TRUE" = "x"
1597 echo "Other optional features:"
1599 feature "allocator=zstd" test "x$HAVE_LIBZSTD_TRUE" = "x"
1600 feature "tests using libguestfs" \
1601 test "x$HAVE_LIBGUESTFS_TRUE" = "x" -a \
1602 "x$USE_LIBGUESTFS_FOR_TESTS_TRUE" = "x"
1605 echo "If any optional component is configured ‘no’ when you expected ‘yes’"
1606 echo "then you should check the preceding messages and README."
1608 echo "Please report bugs back to the mailing list:"
1609 echo "http://www.redhat.com/mailman/listinfo/libguestfs"
1611 echo "Next you should type 'make' to build the package,"
1612 echo "then 'make check' to run the tests."