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], [11])
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 sizeof long.
348 AC_CHECK_SIZEOF(long)
350 dnl Check for other headers, all optional.
379 AC_CHECK_HEADERS([linux/vm_sockets.h], [], [], [#include <sys/socket.h>])
381 dnl Check for functions in libc, all optional.
401 dnl Check for structs and members.
402 AC_CHECK_MEMBERS([struct dirent.d_type], [], [], [[#include <dirent.h>]])
403 AC_CHECK_MEMBERS([struct ucred.uid], [], [],
405 #ifdef HAVE_SYS_SOCKET_H
406 #include <sys/socket.h>
408 #ifdef HAVE_SYS_UCRED_H
409 #include <sys/ucred.h>
412 AC_CHECK_MEMBERS([struct sockpeercred.uid], [], [],
414 #ifdef HAVE_SYS_SOCKET_H
415 #include <sys/socket.h>
419 dnl Replacement functions that we provide for some platforms.
420 AC_CONFIG_LIBOBJ_DIR([common/replacements])
424 get_current_dir_name \
439 dnl Check whether printf("%m") works
440 AC_CACHE_CHECK([whether the printf family supports %m],
441 [nbdkit_cv_func_printf_percent_m],
450 snprintf(buf, sizeof buf, "%m");
451 return !!strcmp (buf, strerror (EINVAL));
453 [nbdkit_cv_func_printf_percent_m=yes],
454 [nbdkit_cv_func_printf_percent_m=no],
457 *-gnu* | gnu*) nbdkit_cv_func_printf_percent_m=yes;;
458 *) nbdkit_cv_func_printf_percent_m="guessing no";;
461 AS_IF([test "x$nbdkit_cv_func_printf_percent_m" = xyes],
462 [AC_DEFINE([HAVE_VFPRINTF_PERCENT_M],[1],
463 [Define to 1 if vfprintf supports %m.])])
466 AC_SEARCH_LIBS([dlsym], [dl dld], [
467 AS_IF([test "x$ac_cv_search_dlsym" != "xnone required"],
468 [DL_LIBS="$ac_cv_search_dlsym"], [DL_LIBS=])
470 ], [AC_MSG_ERROR([unable to find the dlsym() function])
474 dnl Test if <iconv.h> header can build working binaries.
476 dnl On FreeBSD: iconv and libiconv both exist, both can be installed
477 dnl simultaneously, <iconv.h> can exist in two separate places, and
478 dnl if you get the wrong header/library mix everything breaks.
480 dnl On Haiku: libiconv is required to link to iconv_* functions.
482 [AS_HELP_STRING([--without-iconv],
483 [don't try to link against iconv @<:@default=check@:>@])],
486 AS_IF([test "x$with_iconv" != "xno"],[
487 AC_CHECK_HEADER([iconv.h],[
488 AC_MSG_CHECKING([if <iconv.h> can be used to link a program])
495 main (int argc, char *argv[])
497 iconv_t ic = iconv_open ("", "");
510 AM_CONDITIONAL([HAVE_ICONV], [test "x$iconv_working" = "xyes"])
512 use_linker_script=yes
514 dnl Don't use linker script on FreeBSD because FreeBSD's linker is
516 dnl https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190851
517 dnl Also on macOS (darwin) which fails with:
518 dnl ld: unknown option: --version-script=./nbdkit.syms
519 dnl clang: error: linker command failed with exit code 1
520 AC_MSG_CHECKING([if we should disable the linker script (FreeBSD, macOS)])
522 [freebsd*|darwin*], [
526 [AC_MSG_RESULT([no])]
529 dnl Check if -rdynamic linker flag works.
530 acx_nbdkit_save_LDFLAGS="${LDFLAGS}"
531 LDFLAGS="${LDFLAGS} -rdynamic"
532 AC_MSG_CHECKING([if linker supports -rdynamic])
537 main (int argc, char *argv[])
549 LDFLAGS="${acx_nbdkit_save_LDFLAGS}"
550 AC_SUBST([DL_LDFLAGS])
552 dnl Check for dladdr in -ldl, optional. This is a glibc extension.
554 LIBS="$DL_LIBS $LIBS"
555 AC_CHECK_FUNCS([dladdr])
559 AC_MSG_CHECKING([if the target is Windows])
563 LIBS="$LIBS -lmsvcrt -lkernel32 -luser32 -lws2_32"
564 NO_UNDEFINED_ON_WINDOWS="-no-undefined"
565 IMPORT_LIBRARY_ON_WINDOWS='-Wl,-L$(top_builddir)/server -Wl,-lnbdkit'
567 DIR_SEPARATOR_STR='\\'
573 AC_MSG_RESULT([$is_windows])
574 AC_SUBST([NO_UNDEFINED_ON_WINDOWS])
575 AC_SUBST([IMPORT_LIBRARY_ON_WINDOWS])
577 AC_DEFINE_UNQUOTED([SOEXT],["$SOEXT"],[Extension used for shared objects/DLLs.])
578 AC_DEFINE_UNQUOTED([EXEEXT],["$EXEEXT"],[Extension used for executables.])
579 AC_DEFINE_UNQUOTED([DIR_SEPARATOR_STR],["$DIR_SEPARATOR_STR"],
580 [String that separates path elements.])
581 AM_CONDITIONAL([IS_WINDOWS],[test "x$is_windows" = "xyes"])
583 AS_IF([test "x$is_windows" = "xyes"],[
584 dnl For Windows, look for the mc/windmc utility.
585 dnl XXX Do we need to check for mc.exe as well?
586 AC_CHECK_TOOLS([MC],[windmc mc],[no])
587 AS_IF([test "x$MC" = "xno"],
588 [AC_MSG_ERROR([mc/windmc utility must be available when compiling for Windows])])
590 dnl On Windows look for dlltool.
591 AC_CHECK_TOOLS([DLLTOOL],[dlltool],[no])
592 AS_IF([test "x$DLLTOOL" = "xno"],
593 [AC_MSG_ERROR([dlltool utility must be available when compiling for Windows])])
596 AC_SEARCH_LIBS([getaddrinfo], [network socket])
598 dnl Does this platform require libc_malloc_debug.so.0 (glibc >= 2.34)?
599 AC_MSG_CHECKING([if this is glibc >= 2.34])
600 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
602 #if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 34)
603 #error "not glibc 2.34"
605 ]])], [is_glibc_234=yes], [is_glibc_234=no]
607 AC_MSG_RESULT([$is_glibc_234])
608 AM_CONDITIONAL([HAVE_GLIBC_234], [test "x$is_glibc_234" = "xyes"])
610 dnl Check for SELinux socket labelling (optional).
611 AC_ARG_WITH([selinux],
612 AS_HELP_STRING([--without-selinux], [disable SELinux support, used for socket labelling @<:@default=check@:>@]))
613 AS_IF([test "x$with_selinux" != xno], [
614 PKG_CHECK_MODULES([LIBSELINUX], [libselinux], [
615 AC_SUBST([LIBSELINUX_CFLAGS])
616 AC_SUBST([LIBSELINUX_LIBS])
617 AC_DEFINE([HAVE_LIBSELINUX],[1],[libselinux found at compile time.])
618 ], [AC_MSG_WARN([libselinux not found, sockets will not be labeled.])])
621 AS_IF([test "x$with_selinux" = xyes && test "x$LIBSELINUX_LIBS" = x], [
622 AC_MSG_ERROR([selinux requested but not found])
625 dnl Check for GnuTLS (optional, for TLS support).
626 AC_ARG_WITH([gnutls],
627 [AS_HELP_STRING([--without-gnutls], [disable TLS support via GnuTLS @<:@default=check@:>@])])
629 AS_IF([test "x$with_gnutls" != xno], [
630 PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3.0], [
631 AC_SUBST([GNUTLS_CFLAGS])
632 AC_SUBST([GNUTLS_LIBS])
633 AC_DEFINE([HAVE_GNUTLS],[1],[gnutls found at compile time.])
635 AC_MSG_WARN([gnutls not found or < 3.3.0, TLS support will be disabled.])
639 AS_IF([test "x$with_gnutls" = xyes && test x"$GNUTLS_LIBS" = x], [
640 AC_MSG_ERROR([gnutls requested but not found])
643 AM_CONDITIONAL([HAVE_GNUTLS], [test "x$GNUTLS_LIBS" != "x"])
645 AS_IF([test "x$GNUTLS_LIBS" != "x"],[
646 AC_MSG_CHECKING([for default TLS session priority string])
647 AC_ARG_WITH([tls-priority],
648 [AS_HELP_STRING([--with-tls-priority=...],
649 [default TLS session priority string @<:@default=NORMAL@:>@])],
650 [tls_priority=$withval],
651 [tls_priority=NORMAL])
652 AC_MSG_RESULT([$tls_priority])
653 AC_DEFINE_UNQUOTED([TLS_PRIORITY],["$tls_priority"],
654 [Default TLS session priority string])
656 # Check for APIs which may not be present.
658 LIBS="$GNUTLS_LIBS $LIBS"
660 gnutls_base64_decode2 \
661 gnutls_certificate_set_known_dh_params \
663 gnutls_group_get_name \
665 gnutls_session_set_verify_cert \
666 gnutls_srp_server_get_username \
667 gnutls_transport_is_ktls_enabled \
669 AC_CHECK_HEADERS([gnutls/socket.h])
672 dnl macOS has its own program called certtool and packages the
673 dnl GnuTLS tool as "gnutls-certtool".
674 AC_CHECK_PROGS([CERTTOOL],[gnutls-certtool certtool],[certtool])
676 AM_CONDITIONAL([HAVE_GNUTLS_PBKDF2],
677 [test "x$GNUTLS_LIBS" != "x" && test "x$ac_cv_func_gnutls_pbkdf2" = xyes])
679 dnl Check for some commands used by the tests which should be the GNU
680 dnl coreutils variants. On macOS these are prefixed with 'g' or 'gnu'.
681 AC_CHECK_PROGS([CUT],[gnucut cut],[cut])
682 AC_CHECK_PROGS([STAT],[gstat stat],[stat])
683 AC_CHECK_PROGS([TRUNCATE],[gtruncate truncate],[truncate])
685 AC_ARG_ENABLE([linuxdisk],
686 [AS_HELP_STRING([--disable-linuxdisk],
687 [disable linuxdisk plugin @<:@default=check@:>@])],
689 [enable_linuxdisk=check])
690 dnl Check for mke2fs -d (used by linuxdisk plugin). There are two
691 dnl possible outcomes that we care about: (1) We have mke2fs and
692 dnl it supports the -d option. (2) We either don't have mke2fs
693 dnl or it's too old to support the -d option (eg. on RHEL 7).
695 AS_IF([test "$enable_linuxdisk" != "no"], [
696 AC_MSG_CHECKING([for mke2fs supporting the -d option])
697 AS_IF([mke2fs -V >/dev/null 2>&1], [
698 AS_IF([LANG=C mke2fs -d 2>&1 | grep -sq "option requires an argument"], [
702 AC_MSG_RESULT([$mke2fs_with_d])
704 AM_CONDITIONAL([HAVE_MKE2FS_WITH_D],[test "x$mke2fs_with_d" = "xyes"])
706 dnl Check for valgrind.
707 AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind],[no])
709 dnl If valgrind headers are available (optional).
710 dnl Although the runtime check adds only a trivial amount of code, you can
711 dnl avoid it with explicit --disable-valgrind.
712 AC_ARG_ENABLE([valgrind],
713 [AS_HELP_STRING([--disable-valgrind],
714 [disable Valgrind probe])],
716 [enable_valgrind=check])
717 AS_IF([test "x$enable_valgrind" != "xno"],[
718 PKG_CHECK_MODULES([VALGRIND], [valgrind], [
719 AC_SUBST([VALGRIND_CFLAGS])
720 AC_SUBST([VALGRIND_LIBS])
721 AC_DEFINE([HAVE_VALGRIND],[1],[Valgrind headers found at compile time])
723 AS_IF([test "x$enable_valgrind" = "xyes"], [
724 AC_MSG_ERROR([--enable-valgrind given, but Valgrind headers are not available])
729 dnl Build the special libFuzzer version of nbdkit. DO NOT USE THIS for
730 dnl normal builds. See fuzzing/README.
731 AC_ARG_ENABLE([libfuzzer],
732 [AS_HELP_STRING([--enable-libfuzzer],
733 [build libFuzzer test binary (developers only)])],
735 [enable_libfuzzer=no])
736 AS_IF([test "x$enable_libfuzzer" = "xyes"],[
737 AC_DEFINE([ENABLE_LIBFUZZER],[1],[Enable special libFuzzer binary])
738 # We have to disable the linker script for libFuzzer because Clang
739 # adds loads of fuzzer and ASAN-related symbols that are required
740 # by the plugins but which our linker script tries to hide.
743 AM_CONDITIONAL([ENABLE_LIBFUZZER],[test "x$enable_libfuzzer" = "xyes"])
745 dnl Should we use the linker script (ld --version-script)? Note
746 dnl some tests above may set this variable.
747 AC_ARG_ENABLE([linker-script],
748 [AS_HELP_STRING([--disable-linker-script],
749 [disable linker script for server (developers only)])],
750 [use_linker_script=$enableval],
752 AM_CONDITIONAL([USE_LINKER_SCRIPT],
753 [test "x$use_linker_script" = "xyes"])
756 AC_ARG_WITH([bash-completions],
757 [AS_HELP_STRING([--without-bash-completions], [disable installing bash completions @<:@default=check@:>@])])
759 AS_IF([test "x$with_bash_completions" != xno], [
760 PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [
762 AC_MSG_CHECKING([for bash-completions directory])
763 m4_ifdef([PKG_CHECK_VAR],[
764 PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir])
766 AS_IF([test -z "$bashcompdir"], [
767 bashcompdir="${sysconfdir}/bash_completion.d"
769 AC_MSG_RESULT([$bashcompdir])
770 AC_SUBST([bashcompdir])
773 AC_MSG_WARN([bash-completion not installed])
777 AS_IF([test "x$bash_completion" = xno && test "x$with_bash_completions" = xyes], [
778 AC_MSG_ERROR([bash-completions requested but required packages not found])
781 AM_CONDITIONAL([HAVE_BASH_COMPLETION],[test "x$bash_completion" = "xyes"])
783 dnl Check we have enough to run podwrapper.
785 AC_ARG_WITH([manpages],
786 [AS_HELP_STRING([--without-manpages], [Do not build man pages @<:@default=check@:>@])],
788 [: m4_divert_text([DEFAULTS], [with_manpages=check])])
791 AC_CHECK_PROGS([PERL], [perl], [])
793 AS_IF([test "x$with_manpages" != xno], [
794 AS_IF([test "x$PERL" != "x"],[
795 AC_MSG_CHECKING([if we have perl Pod::Man and Pod::Simple])
796 AS_IF([$PERL -MPod::Man -MPod::Simple -e 1 >&AS_MESSAGE_LOG_FD 2>&1],[
799 AC_MSG_RESULT([$enable_pod])
803 AS_IF([test "x$enable_pod" = xno && test "x$with_manpages" = xyes], [
804 AC_MSG_ERROR([man-pages requested but required packages not found])
807 AM_CONDITIONAL([HAVE_POD],
808 [test "x$PERL" != "xno" && test "x$enable_pod" = "xyes"])
810 dnl Define the path to the podwrapper program.
811 PODWRAPPER="$PERL $(pwd)/podwrapper.pl"
812 AC_SUBST([PODWRAPPER])
814 dnl Allow all plugins and filters to be disabled.
815 AC_ARG_ENABLE([plugins],
816 [AS_HELP_STRING([--disable-plugins],
817 [disable all bundled plugins and filters])])
818 AM_CONDITIONAL([HAVE_PLUGINS], [test "x$enable_plugins" != "xno"])
820 dnl Check for Perl, for embedding in the perl plugin.
821 dnl Note that the perl binary is checked above.
822 AC_ARG_ENABLE([perl],
823 [AS_HELP_STRING([--disable-perl], [disable Perl embed plugin])],
826 AS_IF([test "x$PERL" != "xno" && test "x$enable_perl" != "xno"],[
827 dnl Check for Perl archlib.
828 AC_MSG_CHECKING([for Perl embed archlib])
829 PERL_ARCHLIB="$($PERL -MConfig -e 'print $Config{archlib}')"
830 AS_IF([ test -n "$PERL_ARCHLIB" ],[
831 AC_MSG_RESULT([$PERL_ARCHLIB])
833 AC_MSG_NOTICE([Perl embed module disabled])
837 dnl Check for Perl CFLAGS.
838 AC_MSG_CHECKING([for Perl embed CFLAGS])
839 PERL_CFLAGS="$($PERL -MExtUtils::Embed -e 'ccflags')"
840 AS_IF([ test -n "$PERL_CFLAGS" ],[
841 AC_MSG_RESULT([$PERL_CFLAGS])
843 AC_MSG_NOTICE([Perl embed module disabled])
847 dnl Check for Perl LDOPTS.
848 AC_MSG_CHECKING([for Perl embed LDOPTS])
849 PERL_LDOPTS="$($PERL -MExtUtils::Embed -e 'ldopts')"
850 AC_MSG_RESULT([$PERL_LDOPTS])
852 dnl Check these actually work.
853 AC_MSG_CHECKING([whether Perl modules will compile])
856 CFLAGS="$PERL_CFLAGS -I$PERL_ARCHLIB/CORE $CFLAGS"
857 LIBS="$PERL_LDOPTS $LIBS"
858 AC_CHECK_FUNCS([perl_alloc])
861 if test "x$ac_cv_func_perl_alloc" != xyes; then
865 AM_CONDITIONAL([HAVE_PERL],[test "x$enable_perl" != "xno" && test "x$PERL" != "xno"])
866 AC_SUBST([PERL_ARCHLIB])
867 AC_SUBST([PERL_CFLAGS])
868 AC_SUBST([PERL_LDOPTS])
870 dnl Check for Python 3, for embedding in the python plugin.
871 AC_PATH_PROGS([PYTHON],[python3 python],[no])
872 AC_ARG_ENABLE([python],
873 [AS_HELP_STRING([--disable-python], [disable Python embed plugin])],
876 AS_IF([test "x$PYTHON" != "xno" && test "x$enable_python" != "xno"],[
877 AC_MSG_CHECKING([version of $PYTHON])
878 PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info@<:@0@:>@)"`
879 PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info@<:@1@:>@)"`
880 PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR"
881 AS_IF([test -n "$PYTHON_VERSION"],[
882 AC_MSG_RESULT([$PYTHON_VERSION])
884 AC_MSG_NOTICE([Python embed module disabled])
888 AC_MSG_CHECKING([Python major version is 3])
889 AS_IF([test "x$PYTHON_VERSION_MAJOR" = "x3"],[
893 AC_MSG_ERROR([Python $PYTHON_VERSION_MAJOR <> 3 is no longer supported.
895 Python 2 end of life is 2020-01-01 and nbdkit >= 1.16 no longer
898 If you want to use Python 2, you will need to use nbdkit 1.14.])
901 dnl Check for Python CFLAGS, libraries.
902 dnl For Python >= 3.8 we have to use python-<VERSION>-embed.pc, see:
903 dnl https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
904 dnl The python.pc is called python-<VERSION>.pc on Debian and
905 dnl later versions of Fedora, and python.pc on older versions
907 PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"-embed], [
908 AC_SUBST([PYTHON_CFLAGS])
909 AC_SUBST([PYTHON_LIBS])
910 AC_SUBST([PYTHON_VERSION])
911 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
913 PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"], [
914 AC_SUBST([PYTHON_CFLAGS])
915 AC_SUBST([PYTHON_LIBS])
916 AC_SUBST([PYTHON_VERSION])
917 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
919 PKG_CHECK_MODULES([PYTHON], [python], [
920 AC_SUBST([PYTHON_CFLAGS])
921 AC_SUBST([PYTHON_LIBS])
922 AC_SUBST([PYTHON_VERSION])
923 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
925 AC_MSG_WARN([python $PYTHON_VERSION not found])
929 AM_CONDITIONAL([HAVE_PYTHON],[test "x$enable_python" != "xno" && test "x$PYTHON" != "xno"])
930 AC_SUBST([PYTHON_CFLAGS])
931 AC_SUBST([PYTHON_LIBS])
932 AC_SUBST([PYTHON_LDFLAGS])
934 dnl For the OCaml plugin, you can set OCAMLOPTFLAGS before running
935 dnl ./configure to specify any extra flags you want to pass to
936 dnl ocamlopt. For example to enable OCaml warnings:
937 dnl OCAMLOPTFLAGS="-warn-error +A-3"
938 AC_SUBST([OCAMLOPTFLAGS])
940 dnl Check for OCaml, for embedding in the ocaml plugin.
942 AC_ARG_ENABLE([ocaml],
943 [AS_HELP_STRING([--disable-ocaml], [disable OCaml embed plugin])],
946 AS_IF([test "x$OCAMLOPT" != "xno" && test "x$enable_ocaml" != "xno"],[
947 dnl Check OCaml can create a shared library (see README for details).
948 AC_MSG_CHECKING([if $OCAMLOPT can create a shared library])
949 echo 'print_endline "test"' > conftest.ml
950 AS_IF([$OCAMLOPT $OCAMLOPTFLAGS -output-obj -runtime-variant _pic -o conftest.so conftest.ml >&AS_MESSAGE_LOG_FD 2>&1],[
952 ocaml_link_shared=yes
956 rm -f conftest.ml conftest.cmi conftest.cmx conftest.so conftest.o
958 AM_CONDITIONAL([HAVE_OCAML],[test "x$OCAMLOPT" != "xno" &&
959 test "x$ocaml_link_shared" = "xyes"])
960 AM_CONDITIONAL([HAVE_OCAMLDOC],[test "x$OCAMLDOC" != "xno"])
962 dnl Check if OCaml has caml_alloc_initialized_string (added 2017).
963 AS_IF([test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && \
964 test "x$enable_ocaml" = "xyes"],[
965 AC_MSG_CHECKING([for caml_alloc_initialized_string])
966 cat >conftest.c <<'EOF'
967 #include <caml/alloc.h>
968 int main () { char *p = (void *) caml_alloc_initialized_string; return 0; }
970 AS_IF([$OCAMLC conftest.c >&AS_MESSAGE_LOG_FD 2>&1],[
972 AC_DEFINE([HAVE_CAML_ALLOC_INITIALIZED_STRING],[1],
973 [caml_alloc_initialized_string found at compile time.])
977 rm -f conftest.c conftest.o
980 dnl Check if OCaml has caml_shutdown (added 2014).
981 AS_IF([test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && \
982 test "x$enable_ocaml" = "xyes"],[
983 AC_MSG_CHECKING([for caml_shutdown])
984 cat >conftest.c <<'EOF'
985 #include <caml/callback.h>
986 int main () { char *p = (void *) caml_shutdown; return 0; }
988 AS_IF([$OCAMLC conftest.c >&AS_MESSAGE_LOG_FD 2>&1],[
990 AC_DEFINE([HAVE_CAML_SHUTDOWN],[1],
991 [caml_shutdown found at compile time.])
995 rm -f conftest.c conftest.o
998 dnl For developing plugins in Rust, optional.
999 dnl Rust does not play nicely with VPATH builds
1000 AC_CHECK_PROG([CARGO],[cargo],[cargo],[no])
1001 AC_CHECK_PROG([RUSTC],[rustc],[rustc],[no])
1002 AC_ARG_ENABLE([rust],
1003 [AS_HELP_STRING([--disable-rust], [disable Rust plugin])],
1005 [if test "x$(realpath $srcdir)" = "x$(realpath .)"; then
1010 AS_IF([test "x$enable_rust" != "xno" && test "x$CARGO" != "xno" && test "x$RUSTC" != "xno"],
1011 [have_rust=yes], [have_rust=no])
1012 AM_CONDITIONAL([HAVE_RUST], [test "x$have_rust" = "xyes"])
1013 AS_IF([test "x$have_rust" = "xyes"], [
1014 printf "cargo version: "; $CARGO --version
1015 printf "rustc version: "; $RUSTC --version
1018 dnl Check for Ruby, for embedding in the Ruby plugin.
1019 AC_CHECK_PROG([RUBY],[ruby],[ruby],[no])
1020 AC_ARG_ENABLE([ruby],
1021 [AS_HELP_STRING([--disable-ruby], [disable Ruby plugin])],
1024 AS_IF([test "x$RUBY" != "xno" && test "x$enable_ruby" != "xno"],[
1025 PKG_CHECK_MODULES([RUBY], [ruby], [
1026 AC_SUBST([RUBY_CFLAGS])
1027 AC_SUBST([RUBY_LIBS])
1029 AC_MSG_WARN([ruby not found])
1033 AM_CONDITIONAL([HAVE_RUBY],[test "x$RUBY" != "xno" &&
1034 test "x$enable_ruby" = "xyes"])
1036 dnl Check for Tcl, for embedding in the Tcl plugin.
1037 AC_ARG_ENABLE([tcl],
1038 [AS_HELP_STRING([--disable-tcl], [disable Tcl plugin])],
1041 AS_IF([test "x$enable_tcl" != "xno"],[
1042 PKG_CHECK_MODULES([TCL], [tcl], [
1043 AC_SUBST([TCL_CFLAGS])
1044 AC_SUBST([TCL_LIBS])
1046 AC_MSG_WARN([Tcl not found])
1050 AM_CONDITIONAL([HAVE_TCL],[test "x$enable_tcl" = "xyes"])
1052 dnl Check for Lua, for embedding in the Lua plugin.
1053 AC_ARG_ENABLE([lua],
1054 [AS_HELP_STRING([--disable-lua], [disable Lua plugin])],
1057 AS_IF([test "x$enable_lua" != "xno"],[
1058 PKG_CHECK_MODULES([LUA], [lua], [
1059 AC_SUBST([LUA_CFLAGS])
1060 AC_SUBST([LUA_LIBS])
1062 dnl Lua 5.1 used by RHEL 7 does not have lua_isinteger.
1064 LIBS="$LUA_LIBS $LIBS"
1065 AC_CHECK_FUNCS([lua_isinteger])
1068 AC_MSG_WARN([Lua not found])
1072 AM_CONDITIONAL([HAVE_LUA],[test "x$enable_lua" = "xyes"])
1074 dnl Check for golang.
1075 AC_ARG_ENABLE([golang],
1076 AS_HELP_STRING([--disable-golang], [disable Go language plugin]),
1078 [enable_golang=yes])
1079 AS_IF([test "x$enable_golang" != "xno"],[
1080 AC_CHECK_PROG([GOLANG],[go],[go],[no])
1081 AS_IF([test "x$GOLANG" != "xno"],[
1082 AC_MSG_CHECKING([if $GOLANG is usable])
1083 AS_IF([$GOLANG run $srcdir/plugins/golang/config-test.go 2>&AS_MESSAGE_LOG_FD && \
1084 $GOLANG help modules 2>&AS_MESSAGE_LOG_FD 1>&2],[
1085 AC_MSG_RESULT([yes])
1087 # Substitute some golang environment.
1088 GOOS=`$GOLANG env GOOS`
1089 GOARCH=`$GOLANG env GOARCH`
1090 GOROOT=`$GOLANG env GOROOT`
1096 AC_MSG_WARN([golang ($GOLANG) is installed but not usable])
1101 AM_CONDITIONAL([HAVE_GOLANG],[test "x$GOLANG" != "xno"])
1103 dnl Check for libblkio (only if you want to compile the blkio plugin).
1104 AC_ARG_WITH([libblkio],
1105 [AS_HELP_STRING([--without-libblkio],
1106 [disable blkio plugin @<:@default=check@:>@])],
1108 [with_libblkio=check])
1109 AS_IF([test "$with_libblkio" != "no"],[
1110 PKG_CHECK_MODULES([LIBBLKIO], [blkio],[
1111 printf "libblkio version is "; $PKG_CONFIG --modversion blkio
1112 AC_SUBST([LIBBLKIO_CFLAGS])
1113 AC_SUBST([LIBBLKIO_LIBS])
1114 AC_DEFINE([HAVE_LIBBLKIO],[1],[libblkio found at compile time.])
1116 [AC_MSG_WARN([libblkio not found, blkio plugin will be disabled])])
1118 AM_CONDITIONAL([HAVE_LIBBLKIO],[test "x$LIBBLKIO_LIBS" != "x"])
1120 dnl Check for curl (only if you want to compile the curl plugin).
1122 [AS_HELP_STRING([--without-curl],
1123 [disable curl plugin @<:@default=check@:>@])],
1126 AS_IF([test "$with_curl" != "no"],[
1127 PKG_CHECK_MODULES([CURL], [libcurl],[
1128 printf "libcurl version is "; $PKG_CONFIG --modversion libcurl
1129 AC_SUBST([CURL_CFLAGS])
1130 AC_SUBST([CURL_LIBS])
1131 AC_DEFINE([HAVE_CURL],[1],[curl found at compile time.])
1132 AC_CHECK_DECL([CURLOPT_UNIX_SOCKET_PATH], [
1133 AC_DEFINE([HAVE_CURLOPT_UNIX_SOCKET_PATH],[1],
1134 [CURLOPT_UNIX_SOCKET_PATH found at compile time.])
1135 ], [], [#include <curl/curl.h>])
1136 dnl Detect both CURLOPT_PROTOCOLS_STR and
1137 dnl CURLOPT_REDIR_PROTOCOLS_STR. Both were added in curl
1138 dnl 7.85.0 so we assume if one exists then both do.
1139 AC_CHECK_DECL([CURLOPT_PROTOCOLS_STR], [
1140 AC_DEFINE([HAVE_CURLOPT_PROTOCOLS_STR],[1],
1141 [CURLOPT_PROTOCOLS_STR found at compile time.])
1142 ], [], [#include <curl/curl.h>])
1143 dnl Detect various HTTP version enums supported by curl.
1144 AC_CHECK_DECL([CURL_HTTP_VERSION_2_0], [
1145 AC_DEFINE([HAVE_CURL_HTTP_VERSION_2_0],[1],
1146 [CURL_HTTP_VERSION_2_0 found at compile time.])
1147 ], [], [#include <curl/curl.h>])
1148 AC_CHECK_DECL([CURL_HTTP_VERSION_2TLS], [
1149 AC_DEFINE([HAVE_CURL_HTTP_VERSION_2TLS],[1],
1150 [CURL_HTTP_VERSION_2TLS found at compile time.])
1151 ], [], [#include <curl/curl.h>])
1152 AC_CHECK_DECL([CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE], [
1153 AC_DEFINE([HAVE_CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE],[1],
1154 [CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE found at compile time.])
1155 ], [], [#include <curl/curl.h>])
1156 AC_CHECK_DECL([CURL_HTTP_VERSION_3], [
1157 AC_DEFINE([HAVE_CURL_HTTP_VERSION_3],[1],
1158 [CURL_HTTP_VERSION_3 found at compile time.])
1159 ], [], [#include <curl/curl.h>])
1160 AC_CHECK_DECL([CURL_HTTP_VERSION_3ONLY], [
1161 AC_DEFINE([HAVE_CURL_HTTP_VERSION_3ONLY],[1],
1162 [CURL_HTTP_VERSION_3ONLY found at compile time.])
1163 ], [], [#include <curl/curl.h>])
1164 dnl Detect various newer SSL versions, added in 7.54.0
1165 AC_CHECK_DECL([CURL_SSLVERSION_MAX_DEFAULT], [
1166 AC_DEFINE([HAVE_CURL_SSLVERSION_MAX_DEFAULT],[1],
1167 [CURL_SSLVERSION_MAX_DEFAULT found at compile time.])
1168 ], [], [#include <curl/curl.h>])
1169 AC_CHECK_DECL([CURL_SSLVERSION_MAX_TLSv1_0], [
1170 AC_DEFINE([HAVE_CURL_SSLVERSION_MAX_TLSv1_0],[1],
1171 [CURL_SSLVERSION_MAX_TLSv1_0 found at compile time.])
1172 ], [], [#include <curl/curl.h>])
1173 AC_CHECK_DECL([CURL_SSLVERSION_MAX_TLSv1_1], [
1174 AC_DEFINE([HAVE_CURL_SSLVERSION_MAX_TLSv1_1],[1],
1175 [CURL_SSLVERSION_MAX_TLSv1_1 found at compile time.])
1176 ], [], [#include <curl/curl.h>])
1177 AC_CHECK_DECL([CURL_SSLVERSION_MAX_TLSv1_2], [
1178 AC_DEFINE([HAVE_CURL_SSLVERSION_MAX_TLSv1_2],[1],
1179 [CURL_SSLVERSION_MAX_TLSv1_2 found at compile time.])
1180 ], [], [#include <curl/curl.h>])
1181 AC_CHECK_DECL([CURL_SSLVERSION_MAX_TLSv1_3], [
1182 AC_DEFINE([HAVE_CURL_SSLVERSION_MAX_TLSv1_3],[1],
1183 [CURL_SSLVERSION_MAX_TLSv1_3 found at compile time.])
1184 ], [], [#include <curl/curl.h>])
1186 [AC_MSG_WARN([curl not found, curl plugin will be disabled])])
1188 AM_CONDITIONAL([HAVE_CURL],[test "x$CURL_LIBS" != "x"])
1190 dnl Check for libssh (only if you want to compile the ssh plugin).
1192 [AS_HELP_STRING([--without-ssh],
1193 [disable ssh plugin @<:@default=check@:>@])],
1196 AS_IF([test "$with_ssh" != "no"],[
1197 PKG_CHECK_MODULES([SSH], [libssh >= 0.8.0],[
1198 printf "libssh version is "; $PKG_CONFIG --modversion libssh
1199 # Ubuntu 18.04 shipped prerelease of libssh-0.8.0 without
1200 # SSH_OPTIONS_NODELAY
1201 old_CFLAGS="$CFLAGS"
1202 CFLAGS="$CFLAGS $SSH_CFLAGS"
1203 AC_CHECK_DECL([SSH_OPTIONS_NODELAY], [
1204 AC_SUBST([SSH_CFLAGS])
1205 AC_SUBST([SSH_LIBS])
1206 # We don't need this in the code, just in this configure
1207 HAVE_SSH_OPTIONS_NODELAY=1
1209 #include <libssh/libssh.h>
1211 CFLAGS="$old_CFLAGS"
1213 [AC_MSG_WARN([libssh not found, ssh plugin will be disabled])])
1215 AM_CONDITIONAL([HAVE_SSH],[test "x$HAVE_SSH_OPTIONS_NODELAY" != "x"])
1217 dnl Check for xorriso or genisoimage or mkisofs
1218 dnl (only if you want to compile the iso plugin).
1222 [AS_HELP_STRING([--without-iso],
1223 [disable iso plugin @<:@default=check@:>@])],
1226 AS_IF([test "$with_iso" != "no"],[
1227 AC_CHECK_PROG([XORRISO],[xorriso],[xorriso],[no])
1228 AC_CHECK_PROG([GENISOIMAGE],[genisoimage],[genisoimage],[no])
1229 AC_CHECK_PROG([MKISOFS],[mkisofs],[mkisofs],[no])
1230 AS_IF([test "x$XORRISO" != "xno"],[
1234 AS_IF([test "x$GENISOIMAGE" != "xno"],[
1235 ISOPROG="$GENISOIMAGE"
1237 AS_IF([test "x$MKISOFS" != "xno"],[
1242 AS_IF([test "x$ISOPROG" != "xno"],[
1243 printf "picked %s for nbdkit-iso-plugin\n" "$ISOPROG"
1244 AC_DEFINE_UNQUOTED([ISOPROG],["$ISOPROG"],
1245 [Program used by iso plugin to make ISOs.])
1246 AS_IF([test "x$is_xorriso" = "x1"], [
1247 AC_DEFINE([ISOPROG_IS_XORRISO],[1],
1248 [ISO program behaves like xorriso.])
1253 AM_CONDITIONAL([HAVE_ISO],[test "x$ISOPROG" != "xno"])
1255 dnl Check for libvirt (only if you want to compile the libvirt plugin).
1256 AC_ARG_WITH([libvirt],
1257 [AS_HELP_STRING([--without-libvirt],
1258 [disable libvirt plugin @<:@default=check@:>@])],
1260 [with_libvirt=check])
1261 AS_IF([test "$with_libvirt" != "no"],[
1262 PKG_CHECK_MODULES([LIBVIRT], [libvirt],[
1263 AC_SUBST([LIBVIRT_CFLAGS])
1264 AC_SUBST([LIBVIRT_LIBS])
1265 AC_DEFINE([HAVE_LIBVIRT],[1],[libvirt found at compile time.])
1267 [AC_MSG_WARN([libvirt not found, libvirt plugin will be disabled])])
1269 AM_CONDITIONAL([HAVE_LIBVIRT],[test "x$LIBVIRT_LIBS" != "x"])
1271 dnl Check for zlib (only if you want to compile the gzip filter).
1273 [AS_HELP_STRING([--without-zlib],
1274 [disable gzip filter @<:@default=check@:>@])],
1277 AS_IF([test "$with_zlib" != "no"],[
1278 PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3.5],[
1279 AC_SUBST([ZLIB_CFLAGS])
1280 AC_SUBST([ZLIB_LIBS])
1281 AC_DEFINE([HAVE_ZLIB],[1],[zlib found at compile time.])
1283 [AC_MSG_WARN([zlib >= 1.2.3.5 not found, gzip filter will be disabled])])
1285 AM_CONDITIONAL([HAVE_ZLIB],[test "x$ZLIB_LIBS" != "x"])
1287 dnl Check for libnbd (only if you want to compile the nbd plugin).
1288 AC_ARG_WITH([libnbd],
1289 [AS_HELP_STRING([--without-libnbd],
1290 [disable nbd plugin @<:@default=check@:>@])],
1292 [with_libnbd=check])
1293 AS_IF([test "$with_libnbd" != "no"],[
1294 PKG_CHECK_MODULES([LIBNBD], [libnbd >= 0.9.8],[
1295 printf "libnbd version is "; $PKG_CONFIG --modversion libnbd
1296 AC_SUBST([LIBNBD_CFLAGS])
1297 AC_SUBST([LIBNBD_LIBS])
1298 AC_DEFINE([HAVE_LIBNBD],[1],[libnbd found at compile time.])
1300 [AC_MSG_WARN([libnbd >= 0.9.8 not found, nbd plugin will be crippled])])
1303 dnl For backwards compatibilty, we have a second way to disable the nbd plugin.
1304 AC_ARG_ENABLE([nbd-plugin],
1305 [AS_HELP_STRING([--disable-nbd-plugin], [disable nbd plugin (deprecated, use --without-libnbd)])],
1307 [enable_nbd_plugin=yes])
1308 AM_CONDITIONAL([HAVE_LIBNBD],
1309 [test "x$LIBNBD_LIBS" != "x" && test "x$enable_nbd_plugin" = "xyes"])
1311 dnl Check for liblzma (only if you want to compile the xz filter).
1312 AC_ARG_WITH([liblzma],
1313 [AS_HELP_STRING([--without-liblzma],
1314 [disable xz filter @<:@default=check@:>@])],
1316 [with_liblzma=check])
1317 AS_IF([test "$with_liblzma" != "no"],[
1318 PKG_CHECK_MODULES([LIBLZMA], [liblzma],[
1319 AC_SUBST([LIBLZMA_CFLAGS])
1320 AC_SUBST([LIBLZMA_LIBS])
1321 AC_DEFINE([HAVE_LIBLZMA],[1],[liblzma found at compile time.])
1323 [AC_MSG_WARN([liblzma not found, xz filter will be disabled])])
1325 AM_CONDITIONAL([HAVE_LIBLZMA],[test "x$LIBLZMA_LIBS" != "x"])
1327 dnl Check for zstd (only if you want to compile allocator=zstd).
1328 AC_ARG_WITH([libzstd],
1329 [AS_HELP_STRING([--without-libzstd],
1330 [disable allocator=zstd @<:@default=check@:>@])],
1332 [with_libzstd=check])
1333 AS_IF([test "$with_libzstd" != "no"],[
1334 PKG_CHECK_MODULES([LIBZSTD], [libzstd],[
1335 AC_SUBST([LIBZSTD_CFLAGS])
1336 AC_SUBST([LIBZSTD_LIBS])
1337 AC_DEFINE([HAVE_LIBZSTD],[1],[libzstd found at compile time.])
1339 [AC_MSG_WARN([libzstd not found, allocator=zstd will be disabled])])
1341 AM_CONDITIONAL([HAVE_LIBZSTD],[test "x$LIBZSTD_LIBS" != "x"])
1343 dnl Check for libguestfs (only for the guestfs plugin and parts of
1344 dnl the test suite).
1345 AC_ARG_WITH([libguestfs],
1346 [AS_HELP_STRING([--without-libguestfs],
1347 [disable guestfs plugin and tests @<:@default=check@:>@])],
1349 [with_libguestfs=check])
1350 AS_IF([test "$with_libguestfs" != "no"],[
1351 PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs],[
1352 # Although the library was found, we want to make sure it supports nbd
1353 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1354 #include <guestfs.h>
1356 #ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL
1360 AC_SUBST([LIBGUESTFS_CFLAGS])
1361 AC_SUBST([LIBGUESTFS_LIBS])
1362 AC_DEFINE([HAVE_LIBGUESTFS],[1],[libguestfs found at compile time.])
1365 AC_MSG_WARN([libguestfs too old, guestfs plugin and tests will be disabled])])
1367 [AC_MSG_WARN([libguestfs not found, guestfs plugin and tests will be disabled])])
1369 AM_CONDITIONAL([HAVE_LIBGUESTFS],[test "x$LIBGUESTFS_LIBS" != "x"])
1371 dnl Disable tests which need libguestfs.
1372 AC_ARG_ENABLE([libguestfs-tests],
1373 [AS_HELP_STRING([--disable-libguestfs-tests],
1374 [disable tests which need libguestfs])],
1376 [enable_libguestfs_tests=check]
1378 AM_CONDITIONAL([USE_LIBGUESTFS_FOR_TESTS],
1379 [test "x$LIBGUESTFS_LIBS" != "x" && \
1380 test "x$enable_libguestfs_tests" != "xno"])
1382 dnl Check for ext2fs and com_err, for the ext2 filter.
1384 [AS_HELP_STRING([--without-ext2],
1385 [disable ext2 filter @<:@default=check@:>@])],
1388 AS_IF([test "$with_ext2" != "no"], [
1389 PKG_CHECK_MODULES([EXT2FS], [ext2fs], [
1390 AC_SUBST([EXT2FS_CFLAGS])
1391 AC_SUBST([EXT2FS_LIBS])
1392 AC_DEFINE([HAVE_EXT2FS],[1],[ext2fs found at compile time.])
1394 [AC_MSG_WARN([ext2fs not found, ext2 filter will be disabled])])
1395 PKG_CHECK_MODULES([COM_ERR], [com_err], [
1396 AC_SUBST([COM_ERR_CFLAGS])
1397 AC_SUBST([COM_ERR_LIBS])
1398 AC_DEFINE([HAVE_COM_ERR],[1],[com_err found at compile time.])
1400 [AC_MSG_WARN([com_err not found, ext2 filter will be disabled])])
1402 AC_CHECK_MEMBERS([struct struct_io_manager.cache_readahead,
1403 struct struct_io_manager.zeroout])
1405 AM_CONDITIONAL([HAVE_EXT2],
1406 [test "x$EXT2FS_LIBS" != "x" && test "x$COM_ERR_LIBS" != "x"])
1408 dnl libtorrent-rasterbar for the bittorrent plugin.
1409 AC_ARG_ENABLE([torrent],
1410 [AS_HELP_STRING([--disable-torrent],
1411 [disable bittorrent plugin])],
1413 [enable_torrent=check]
1415 AS_IF([test "x$enable_torrent" != "xno"], [
1416 PKG_CHECK_MODULES([LIBTORRENT], [libtorrent-rasterbar], [
1417 AC_SUBST([LIBTORRENT_CFLAGS])
1418 AC_SUBST([LIBTORRENT_LIBS])
1420 [AC_MSG_WARN([libtorrent-rasterbar not found, bittorrent plugin will be disabled])])
1422 AM_CONDITIONAL([HAVE_TORRENT],
1423 [test "x$have_cxx" = "xyes" && test "x$LIBTORRENT_LIBS" != "x"])
1425 dnl Check if the user wants to disable VDDK support.
1426 dnl See plugins/vddk/README.VDDK.
1427 AC_ARG_ENABLE([vddk],
1428 [AS_HELP_STRING([--disable-vddk],
1429 [disable VMware VDDK plugin])],
1432 dnl While VDDK was available on i686 in 5.1.1, we only support
1433 dnl newer versions which are supported only on x86-64. Don't
1434 dnl compile on other platforms.
1435 AC_MSG_CHECKING([if the host CPU is compatible with VDDK])
1436 AS_IF([test "$host_cpu" = "x86_64" && test "$host_os" = "linux-gnu"],[
1437 AC_MSG_RESULT([yes ($host)])
1440 AC_MSG_RESULT([no ($host)])
1444 AM_CONDITIONAL([HAVE_VDDK], [test "x$enable_vddk" = "xyes"])
1446 dnl Expose version information to the public headers
1447 [NBDKIT_]VERSION_MAJOR=NBDKIT_VERSION_MAJOR
1448 [NBDKIT_]VERSION_MINOR=NBDKIT_VERSION_MINOR
1449 [NBDKIT_]VERSION_MICRO=NBDKIT_VERSION_MICRO
1450 AC_SUBST([NBDKIT_VERSION_MAJOR])
1451 AC_SUBST([NBDKIT_VERSION_MINOR])
1452 AC_SUBST([NBDKIT_VERSION_MICRO])
1454 dnl Produce output files.
1455 AC_CONFIG_HEADERS([config.h])
1456 AC_CONFIG_FILES([podwrapper.pl],
1457 [chmod +x,-w podwrapper.pl])
1458 AC_CONFIG_FILES([common/protocol/generate-protostrings.sh],
1459 [chmod +x,-w common/protocol/generate-protostrings.sh])
1460 AC_CONFIG_FILES([tests/make-pki.sh],
1461 [chmod +x,-w tests/make-pki.sh])
1462 AC_CONFIG_FILES([Makefile
1463 bash-completion/Makefile
1464 common/allocators/Makefile
1465 common/bitmap/Makefile
1467 common/include/Makefile
1468 common/protocol/Makefile
1469 common/regions/Makefile
1470 common/replacements/Makefile
1471 common/replacements/win32/Makefile
1472 common/utils/Makefile
1475 include/nbdkit-version.h
1477 plugins/blkio/Makefile
1479 plugins/cdi/Makefile
1480 plugins/curl/Makefile
1481 plugins/data/Makefile
1482 plugins/eval/Makefile
1483 plugins/example1/Makefile
1484 plugins/example2/Makefile
1485 plugins/example3/Makefile
1486 plugins/example4/Makefile
1487 plugins/file/Makefile
1488 plugins/floppy/Makefile
1489 plugins/full/Makefile
1490 plugins/golang/Makefile
1491 plugins/guestfs/Makefile
1492 plugins/info/Makefile
1493 plugins/iso/Makefile
1494 plugins/libvirt/Makefile
1495 plugins/linuxdisk/Makefile
1496 plugins/lua/Makefile
1497 plugins/memory/Makefile
1498 plugins/nbd/Makefile
1499 plugins/null/Makefile
1500 plugins/ocaml/Makefile
1501 plugins/ondemand/Makefile
1502 plugins/partitioning/Makefile
1503 plugins/pattern/Makefile
1504 plugins/perl/Makefile
1505 plugins/python/Makefile
1506 plugins/random/Makefile
1507 plugins/ruby/Makefile
1508 plugins/rust/Makefile
1511 plugins/ssh/Makefile
1512 plugins/sparse-random/Makefile
1513 plugins/split/Makefile
1514 plugins/tcl/Makefile
1515 plugins/tmpdisk/Makefile
1516 plugins/torrent/Makefile
1517 plugins/vddk/Makefile
1518 plugins/zero/Makefile
1520 filters/blocksize/Makefile
1521 filters/blocksize-policy/Makefile
1522 filters/cache/Makefile
1523 filters/cacheextents/Makefile
1524 filters/checkwrite/Makefile
1525 filters/cow/Makefile
1526 filters/ddrescue/Makefile
1527 filters/delay/Makefile
1528 filters/error/Makefile
1529 filters/exitlast/Makefile
1530 filters/exitwhen/Makefile
1531 filters/exportname/Makefile
1532 filters/ext2/Makefile
1533 filters/extentlist/Makefile
1534 filters/fua/Makefile
1535 filters/gzip/Makefile
1537 filters/limit/Makefile
1538 filters/log/Makefile
1539 filters/luks/Makefile
1540 filters/multi-conn/Makefile
1541 filters/nocache/Makefile
1542 filters/noextents/Makefile
1543 filters/nofilter/Makefile
1544 filters/noparallel/Makefile
1545 filters/nozero/Makefile
1546 filters/offset/Makefile
1547 filters/partition/Makefile
1548 filters/pause/Makefile
1549 filters/protect/Makefile
1550 filters/rate/Makefile
1551 filters/readahead/Makefile
1552 filters/retry/Makefile
1553 filters/retry-request/Makefile
1554 filters/scan/Makefile
1555 filters/stats/Makefile
1556 filters/swab/Makefile
1557 filters/tar/Makefile
1558 filters/tls-fallback/Makefile
1559 filters/truncate/Makefile
1562 server/local/nbdkit.pc
1574 echo "----------------------------------------------------------------------"
1575 echo "Thank you for downloading $PACKAGE_STRING"
1577 echo "This is how we have configured the optional components for you today:"
1582 printf ' %.40s %s\n' \
1583 "$1 ........................................" "$2"
1597 echo "Optional server features:"
1599 feature "bash-completion" test "x$HAVE_BASH_COMPLETION_TRUE" = "x"
1600 feature "libfuzzer" test "x$ENABLE_LIBFUZZER_TRUE" = "x"
1601 feature "linker script" test "x$USE_LINKER_SCRIPT" = "x"
1602 feature "manual pages" test "x$HAVE_POD_TRUE" = "x"
1603 feature "SELinux" test "x$LIBSELINUX_LIBS" != "x"
1604 feature "TLS" test "x$GNUTLS_LIBS" != "x"
1607 echo "Optional plugins:"
1609 feature "blkio" test "x$HAVE_LIBBLKIO_TRUE" = "x"
1610 feature "curl" test "x$HAVE_CURL_TRUE" = "x"
1611 feature "example4" test "x$HAVE_PERL_TRUE" = "x"
1612 feature "floppy" test "x$HAVE_ICONV_TRUE" = "x"
1613 feature "guestfs" test "x$HAVE_LIBGUESTFS_TRUE" = "x"
1614 feature "iso" test "x$HAVE_ISO_TRUE" = "x"
1615 feature "libvirt" test "x$HAVE_LIBVIRT_TRUE" = "x"
1616 feature "linuxdisk" test "x$HAVE_MKE2FS_WITH_D_TRUE" = "x"
1617 feature "nbd" test "x$HAVE_LIBNBD_TRUE" = "x"
1618 feature "S3" test "x$HAVE_PYTHON_TRUE" = "x"
1619 feature "ssh" test "x$HAVE_SSH_TRUE" = "x"
1620 feature "torrent" test "x$HAVE_TORRENT_TRUE" = "x"
1621 feature "vddk" test "x$HAVE_VDDK_TRUE" = "x"
1626 feature "go" test "x$HAVE_GOLANG_TRUE" = "x"
1627 feature "lua" test "x$HAVE_LUA_TRUE" = "x"
1628 feature "ocaml" test "x$HAVE_OCAML_TRUE" = "x"
1629 feature "perl" test "x$HAVE_PERL_TRUE" = "x"
1630 feature "python" test "x$HAVE_PYTHON_TRUE" = "x"
1631 feature "ruby" test "x$HAVE_RUBY_TRUE" = "x"
1632 feature "rust" test "x$HAVE_RUST_TRUE" = "x"
1633 feature "tcl" test "x$HAVE_TCL_TRUE" = "x"
1636 echo "Optional filters:"
1638 feature "ext2" test "x$HAVE_EXT2_TRUE" = "x"
1639 feature "gzip" test "x$HAVE_ZLIB_TRUE" = "x"
1640 feature "luks" test "x$HAVE_GNUTLS_PBKDF2_TRUE" = "x"
1641 feature "stats" test "x$HAVE_CXX_TRUE" = "x"
1642 feature "xz" test "x$HAVE_LIBLZMA_TRUE" = "x"
1645 echo "Other optional features:"
1647 feature "allocator=zstd" test "x$HAVE_LIBZSTD_TRUE" = "x"
1648 feature "tests using libguestfs" \
1649 test "x$HAVE_LIBGUESTFS_TRUE" = "x" -a \
1650 "x$USE_LIBGUESTFS_FOR_TESTS_TRUE" = "x"
1653 echo "If any optional component is configured ‘no’ when you expected ‘yes’"
1654 echo "then you should check the preceding messages and README."
1656 echo "Please report bugs back to the mailing list:"
1657 echo "http://www.redhat.com/mailman/listinfo/libguestfs"
1659 echo "Next you should type 'make' to build the package,"
1660 echo "then 'make check' to run the tests."