2 # Copyright (C) 2013-2019 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], [14])
34 m4_define([NBDKIT_VERSION_MICRO], [0])
36 NBDKIT_VERSION_MAJOR.NBDKIT_VERSION_MINOR.NBDKIT_VERSION_MICRO)
37 AC_CONFIG_MACRO_DIR([m4])
38 m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],[],
39 [m4_define([AC_USE_SYSTEM_EXTENSIONS],[])])
40 AC_USE_SYSTEM_EXTENSIONS
43 dnl NB: Do not [quote] this parameter.
44 AM_INIT_AUTOMAKE(foreign)
52 dnl Expose version information to the public headers
53 [NBDKIT_]VERSION_MAJOR=NBDKIT_VERSION_MAJOR
54 [NBDKIT_]VERSION_MINOR=NBDKIT_VERSION_MINOR
55 [NBDKIT_]VERSION_MICRO=NBDKIT_VERSION_MICRO
56 AC_SUBST([NBDKIT_VERSION_MAJOR])
57 AC_SUBST([NBDKIT_VERSION_MINOR])
58 AC_SUBST([NBDKIT_VERSION_MICRO])
60 dnl Check for basic C environment.
67 test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
71 dnl Check for C++ (optional, we just use this to test the header
72 dnl can be included from C++ code).
75 dnl The C++ compiler test is pretty useless because even if it fails
76 dnl it sets CXX=g++. So test the compiler actually works.
77 AC_MSG_CHECKING([if the C++ compiler really really works])
78 AS_IF([$CXX --version >&AS_MESSAGE_LOG_FD 2>&1],[have_cxx=yes],[have_cxx=no])
79 AC_MSG_RESULT([$have_cxx])
80 AM_CONDITIONAL([HAVE_CXX], [test "$have_cxx" = "yes"])
82 AC_ARG_ENABLE([gcc-warnings],
83 [AS_HELP_STRING([--enable-gcc-warnings],
84 [turn on lots of GCC warnings (for developers)])],
87 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
89 gcc_warnings=$enableval],
92 if test "x$gcc_warnings" = "xyes"; then
93 WARNINGS_CFLAGS="-Wall -Wshadow -Wvla -Werror"
94 AC_SUBST([WARNINGS_CFLAGS])
97 dnl Check if the compiler supports -std=c90 flag. This is only used
98 dnl during a test. OpenBSD GCC does not support this flag so we skip
100 AC_MSG_CHECKING([if the compiler supports -std=c90 for ANSI C test])
102 CFLAGS="$CFLAGS -std=c90"
103 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
104 [supports_std_c90=yes],
105 [supports_std_c90=no])
107 AC_MSG_RESULT([$supports_std_c90])
108 AM_CONDITIONAL([CAN_TEST_ANSI_C], [test "x$supports_std_c90" = "xyes"])
110 dnl On Haiku we must use BSD-compatibility headers to get the endian
112 AC_MSG_CHECKING(whether OS-dependent include paths are required)
114 [haiku*], [CFLAGS="$CFLAGS -I`findpaths -p /system B_FIND_PATH_HEADERS_DIRECTORY`/bsd"; AC_MSG_RESULT(yes)],
118 dnl On Linux /tmp is often tmpfs which is not large enough, so use /var/tmp.
119 dnl But Haiku only has /tmp.
120 AC_MSG_CHECKING([for temporary directory for large files])
122 [haiku*], [LARGE_TMPDIR=/tmp],
123 [LARGE_TMPDIR=/var/tmp]
125 AC_MSG_RESULT([$LARGE_TMPDIR])
126 AC_DEFINE_UNQUOTED([LARGE_TMPDIR],["$LARGE_TMPDIR"],
127 [Temporary directory for large files])
129 dnl Check if libc has program_invocation_short_name.
130 AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
134 dnl Check if __attribute__((cleanup(...))) works.
135 dnl Set -Werror, otherwise gcc will only emit a warning for attributes
136 dnl that it doesn't understand.
137 acx_nbdkit_save_CFLAGS="${CFLAGS}"
138 CFLAGS="${CFLAGS} -Werror"
139 AC_MSG_CHECKING([if __attribute__((cleanup(...))) works with this compiler])
154 __attribute__((cleanup(freep))) char *ptr = malloc (100);
158 main (int argc, char *argv[])
169 ['__attribute__((cleanup(...)))' does not work.
171 You may not be using a sufficiently recent version of GCC or CLANG, or
172 you may be using a C compiler which does not support this attribute,
173 or the configure test may be wrong.
175 This code requires the attribute to work for proper locking between threads.])])
176 CFLAGS="${acx_nbdkit_save_CFLAGS}"
178 dnl Check for __auto_type (GCC extension).
179 AC_MSG_CHECKING([if __auto_type is available in this compiler])
191 AC_DEFINE([HAVE_AUTO_TYPE],[1],[__auto_type is available])
197 dnl Check for other headers, all optional.
206 dnl Check for functions in libc, all optional.
210 get_current_dir_name \
216 dnl Check whether printf("%m") works
217 AC_CACHE_CHECK([whether the printf family supports %m],
218 [nbdkit_cv_func_printf_percent_m],
227 snprintf(buf, sizeof buf, "%m");
228 return !!strcmp (buf, strerror (EINVAL));
230 [nbdkit_cv_func_printf_percent_m=yes],
231 [nbdkit_cv_func_printf_percent_m=no],
234 *-gnu* | gnu*) nbdkit_cv_func_printf_percent_m=yes;;
235 *) nbdkit_cv_func_printf_percent_m="guessing no";;
238 AS_IF([test "x$nbdkit_cv_func_printf_percent_m" = xyes],
239 [AC_DEFINE([HAVE_VFPRINTF_PERCENT_M],[1],
240 [Define to 1 if vfprintf supports %m.])])
243 AC_SEARCH_LIBS([dlsym], [dl dld], [
244 AS_IF([test "x$ac_cv_search_dlsym" != "xnone required"],
245 [DL_LIBS="$ac_cv_search_dlsym"], [DL_LIBS=])
247 ], [AC_MSG_ERROR([unable to find the dlsym() function])
251 dnl Test if <iconv.h> header can build working binaries.
253 dnl On FreeBSD: iconv and libiconv both exist, both can be installed
254 dnl simultaneously, <iconv.h> can exist in two separate places, and
255 dnl if you get the wrong header/library mix everything breaks.
257 dnl On Haiku: libiconv is required to link to iconv_* functions.
259 [AS_HELP_STRING([--without-iconv],
260 [don't try to link against iconv @<:@default=check@:>@])],
263 AS_IF([test "x$with_iconv" != "xno"],[
264 AC_CHECK_HEADER([iconv.h],[
265 AC_MSG_CHECKING([if <iconv.h> can be used to link a program])
272 main (int argc, char *argv[])
274 iconv_t ic = iconv_open ("", "");
287 AM_CONDITIONAL([HAVE_ICONV], [test "x$iconv_working" = "xyes"])
289 dnl Don't use linker script for the server on FreeBSD because
290 dnl FreeBSD's linker is broken. See eg:
291 dnl https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190851
292 AC_MSG_CHECKING([if we should use a linker script for the server])
294 [freebsd*], [use_linker_script_for_server=no],
295 [use_linker_script_for_server=yes]
297 AC_MSG_RESULT([$use_linker_script_for_server])
298 AM_CONDITIONAL([USE_LINKER_SCRIPT_FOR_SERVER],
299 [test "x$use_linker_script_for_server" = "xyes"])
301 dnl Check if -rdynamic linker flag works.
302 acx_nbdkit_save_LDFLAGS="${LDFLAGS}"
303 LDFLAGS="${LDFLAGS} -rdynamic"
304 AC_MSG_CHECKING([if linker supports -rdynamic])
309 main (int argc, char *argv[])
321 LDFLAGS="${acx_nbdkit_save_LDFLAGS}"
322 AC_SUBST([DL_LDFLAGS])
324 dnl Check for dladdr in -ldl, optional. This is a glibc extension.
326 LIBS="$DL_LIBS $LIBS"
327 AC_CHECK_FUNCS([dladdr])
330 AC_SEARCH_LIBS([getaddrinfo], [network socket])
332 dnl Check for SELinux socket labelling (optional).
333 PKG_CHECK_MODULES([LIBSELINUX], [libselinux], [
334 AC_SUBST([LIBSELINUX_CFLAGS])
335 AC_SUBST([LIBSELINUX_LIBS])
336 AC_DEFINE([HAVE_LIBSELINUX],[1],[libselinux found at compile time.])
338 AC_MSG_WARN([libselinux not found, SELinux socket labelling support will be disabled.])
341 dnl Check for GnuTLS (optional, for TLS support).
342 PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3.0], [
343 AC_SUBST([GNUTLS_CFLAGS])
344 AC_SUBST([GNUTLS_LIBS])
345 AC_DEFINE([HAVE_GNUTLS],[1],[gnutls found at compile time.])
347 AC_MSG_WARN([gnutls not found or < 3.3.0, TLS support will be disabled.])
350 AS_IF([test "$GNUTLS_LIBS" != ""],[
351 AC_MSG_CHECKING([for default TLS session priority string])
352 AC_ARG_WITH([tls-priority],
353 [AS_HELP_STRING([--with-tls-priority],
354 [default TLS session priority string @<:@default=NORMAL@:>@])],
355 [tls_priority=$withval],
356 [tls_priority=NORMAL])
357 AC_MSG_RESULT([$tls_priority])
358 AC_DEFINE_UNQUOTED([TLS_PRIORITY],["$tls_priority"],
359 [Default TLS session priority string])
361 # Check for APIs which may not be present.
363 LIBS="$GNUTLS_LIBS $LIBS"
365 gnutls_base64_decode2 \
366 gnutls_certificate_set_known_dh_params \
367 gnutls_session_set_verify_cert])
371 dnl Check for valgrind.
372 AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind],[no])
374 dnl If valgrind headers are available (optional).
375 dnl Since this is only useful for developers, you have to enable
376 dnl it explicitly using --enable-valgrind.
377 AC_ARG_ENABLE([valgrind],
378 [AS_HELP_STRING([--enable-valgrind],
379 [enable Valgrind extensions (for developers)])],
380 [enable_valgrind=yes],
381 [enable_valgrind=no])
382 AS_IF([test "x$enable_valgrind" = "xyes"],[
383 PKG_CHECK_MODULES([VALGRIND], [valgrind], [
384 AC_SUBST([VALGRIND_CFLAGS])
385 AC_SUBST([VALGRIND_LIBS])
386 AC_DEFINE([HAVE_VALGRIND],[1],[Valgrind headers found at compile time])
388 AC_MSG_ERROR([--enable-valgrind given, but Valgrind headers are not available])
393 PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [
395 AC_MSG_CHECKING([for bash-completions directory])
396 m4_ifdef([PKG_CHECK_VAR],[
397 PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir])
399 AS_IF([test -z "$bashcompdir"], [
400 bashcompdir="${sysconfdir}/bash_completion.d"
402 AC_MSG_RESULT([$bashcompdir])
403 AC_SUBST([bashcompdir])
406 AC_MSG_WARN([bash-completion not installed])
408 AM_CONDITIONAL([HAVE_BASH_COMPLETION],[test "x$bash_completion" = "xyes"])
410 dnl Check we have enough to run podwrapper.
411 AC_CHECK_PROG([PERL],[perl],[perl],[no])
412 AS_IF([test "x$PERL" != "xno"],[
413 AC_MSG_CHECKING([if we have perl Pod::Man and Pod::Simple])
414 AS_IF([$PERL -MPod::Man -MPod::Simple -e 1 >&AS_MESSAGE_LOG_FD 2>&1],[
419 AC_MSG_RESULT([$enable_pod])
421 AM_CONDITIONAL([HAVE_POD],
422 [test "x$PERL" != "xno" && test "x$enable_pod" = "xyes"])
424 dnl Define the path to the podwrapper program.
425 PODWRAPPER="$PERL $(pwd)/podwrapper.pl"
426 AC_SUBST([PODWRAPPER])
428 dnl Allow all plugins and filters to be disabled.
429 AC_ARG_ENABLE([plugins],
430 [AS_HELP_STRING([--disable-plugins],
431 [disable all bundled plugins and filters])])
432 AM_CONDITIONAL([HAVE_PLUGINS], [test "x$enable_plugins" != "xno"])
434 dnl Check for Perl, for embedding in the perl plugin.
435 dnl Note that the perl binary is checked above.
436 AC_ARG_ENABLE([perl],
437 [AS_HELP_STRING([--disable-perl], [disable Perl embed plugin])],
440 AS_IF([test "x$PERL" != "xno" && test "x$enable_perl" != "xno"],[
441 dnl Check for Perl archlib.
442 AC_MSG_CHECKING([for Perl embed archlib])
443 PERL_ARCHLIB="$($PERL -MConfig -e 'print $Config{archlib}')"
444 AS_IF([ test -n "$PERL_ARCHLIB" ],[
445 AC_MSG_RESULT([$PERL_ARCHLIB])
447 AC_MSG_NOTICE([Perl embed module disabled])
451 dnl Check for Perl CFLAGS.
452 AC_MSG_CHECKING([for Perl embed CFLAGS])
453 PERL_CFLAGS="$($PERL -MExtUtils::Embed -e 'ccflags')"
454 AS_IF([ test -n "$PERL_CFLAGS" ],[
455 AC_MSG_RESULT([$PERL_CFLAGS])
457 AC_MSG_NOTICE([Perl embed module disabled])
461 dnl Check for Perl LDOPTS.
462 AC_MSG_CHECKING([for Perl embed LDOPTS])
463 PERL_LDOPTS="$($PERL -MExtUtils::Embed -e 'ldopts')"
464 AC_MSG_RESULT([$PERL_LDOPTS])
466 dnl XXX Could check these actually work.
468 AM_CONDITIONAL([HAVE_PERL],[test "x$enable_perl" != "xno" && test "x$PERL" != "xno"])
469 AC_SUBST([PERL_ARCHLIB])
470 AC_SUBST([PERL_CFLAGS])
471 AC_SUBST([PERL_LDOPTS])
473 dnl Check for Python, for embedding in the python plugin.
474 AC_CHECK_PROG([PYTHON],[python],[python],[no])
475 AC_ARG_ENABLE([python],
476 [AS_HELP_STRING([--disable-python], [disable Python embed plugin])],
479 AS_IF([test "x$PYTHON" != "xno" && test "x$enable_python" != "xno"],[
480 AC_MSG_CHECKING([version of $PYTHON])
481 PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info@<:@0@:>@)"`
482 PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info@<:@1@:>@)"`
483 PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR"
484 AS_IF([test -n "$PYTHON_VERSION"],[
485 AC_MSG_RESULT([$PYTHON_VERSION])
487 AC_MSG_NOTICE([Python embed module disabled])
491 dnl Check for Python CFLAGS, libraries.
492 dnl For Python >= 3.8 we have to use python-<VERSION>-embed.pc, see:
493 dnl https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
494 dnl The python.pc is called python-<VERSION>.pc on Debian and
495 dnl later versions of Fedora, and python.pc on older versions
497 PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"-embed], [
498 AC_SUBST([PYTHON_CFLAGS])
499 AC_SUBST([PYTHON_LIBS])
500 AC_SUBST([PYTHON_VERSION])
501 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
503 PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"], [
504 AC_SUBST([PYTHON_CFLAGS])
505 AC_SUBST([PYTHON_LIBS])
506 AC_SUBST([PYTHON_VERSION])
507 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
509 PKG_CHECK_MODULES([PYTHON], [python], [
510 AC_SUBST([PYTHON_CFLAGS])
511 AC_SUBST([PYTHON_LIBS])
512 AC_SUBST([PYTHON_VERSION])
513 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
515 AC_MSG_WARN([python $PYTHON_VERSION not found])
519 dnl Check for various functions needed by the bindings.
522 PYTHON_BLDLIBRARY=`$PYTHON -c "import distutils.sysconfig; \
523 print (distutils.sysconfig.get_config_var('BLDLIBRARY'))"`
524 AC_CHECK_LIB([c],[PyString_FromString],
525 [AC_DEFINE([HAVE_PYSTRING_FROMSTRING],1,
526 [Found PyString_FromString in libpython.])],
527 [],[$PYTHON_BLDLIBRARY])
528 AC_CHECK_LIB([c],[PyString_AsString],
529 [AC_DEFINE([HAVE_PYSTRING_ASSTRING],1,
530 [Found PyString_AsString in libpython.])],
531 [],[$PYTHON_BLDLIBRARY])
532 AC_CHECK_LIB([c],[PyUnicode_AsUTF8],
533 [AC_DEFINE([HAVE_PYUNICODE_ASUTF8],1,
534 [Found PyUnicode_AsUTF8 in libpython.])],
535 [],[$PYTHON_BLDLIBRARY])
540 AM_CONDITIONAL([HAVE_PYTHON],[test "x$enable_python" != "xno" && test "x$PYTHON" != "xno"])
541 AC_SUBST([PYTHON_CFLAGS])
542 AC_SUBST([PYTHON_LIBS])
543 AC_SUBST([PYTHON_LDFLAGS])
545 dnl For the OCaml plugin, you can set OCAMLOPTFLAGS before running
546 dnl ./configure to specify any extra flags you want to pass to
548 AC_SUBST([OCAMLOPTFLAGS])
550 dnl Check for OCaml, for embedding in the ocaml plugin.
552 AC_ARG_ENABLE([ocaml],
553 [AS_HELP_STRING([--disable-ocaml], [disable OCaml embed plugin])],
556 AS_IF([test "x$OCAMLOPT" != "xno" && test "x$enable_ocaml" != "xno"],[
557 dnl Check OCaml can create a shared library (see README for details).
558 AC_MSG_CHECKING([if $OCAMLOPT can create a shared library])
559 echo 'print_endline "test"' > conftest.ml
560 AS_IF([$OCAMLOPT $OCAMLOPTFLAGS -output-obj -runtime-variant _pic -o conftest.so conftest.ml >&AS_MESSAGE_LOG_FD 2>&1],[
562 ocaml_link_shared=yes
566 rm -f conftest.ml conftest.cmi conftest.cmx conftest.so conftest.o
568 AM_CONDITIONAL([HAVE_OCAML],[test "x$OCAMLOPT" != "xno" &&
569 test "x$ocaml_link_shared" = "xyes"])
571 dnl For developing plugins in Rust, optional.
572 AC_CHECK_PROG([CARGO],[cargo],[cargo],[no])
573 AC_ARG_ENABLE([rust],
574 [AS_HELP_STRING([--disable-rust], [disable Rust plugin])],
577 AM_CONDITIONAL([HAVE_RUST],
578 [test "x$CARGO" != "xno" && test "x$enable_rust" != "xno"])
580 dnl Check for Ruby, for embedding in the Ruby plugin.
581 AC_CHECK_PROG([RUBY],[ruby],[ruby],[no])
582 AC_ARG_ENABLE([ruby],
583 [AS_HELP_STRING([--disable-ruby], [disable Ruby plugin])],
586 AS_IF([test "x$RUBY" != "xno" && test "x$enable_ruby" != "xno"],[
587 PKG_CHECK_MODULES([RUBY], [ruby], [
588 AC_SUBST([RUBY_CFLAGS])
589 AC_SUBST([RUBY_LIBS])
591 AC_MSG_WARN([ruby not found])
595 AM_CONDITIONAL([HAVE_RUBY],[test "x$RUBY" != "xno" &&
596 test "x$enable_ruby" = "xyes"])
598 dnl Check for Tcl, for embedding in the Tcl plugin.
600 [AS_HELP_STRING([--disable-tcl], [disable Tcl plugin])],
603 AS_IF([test "x$enable_tcl" != "xno"],[
604 PKG_CHECK_MODULES([TCL], [tcl], [
605 AC_SUBST([TCL_CFLAGS])
608 AC_MSG_WARN([Tcl not found])
612 AM_CONDITIONAL([HAVE_TCL],[test "x$enable_tcl" = "xyes"])
614 dnl Check for Lua, for embedding in the Lua plugin.
616 [AS_HELP_STRING([--disable-lua], [disable Lua plugin])],
619 AS_IF([test "x$enable_lua" != "xno"],[
620 PKG_CHECK_MODULES([LUA], [lua], [
621 AC_SUBST([LUA_CFLAGS])
624 dnl Lua 5.1 used by RHEL 7 does not have lua_isinteger.
626 LIBS="$LUA_LIBS $LIBS"
627 AC_CHECK_FUNCS([lua_isinteger])
630 AC_MSG_WARN([Lua not found])
634 AM_CONDITIONAL([HAVE_LUA],[test "x$enable_lua" = "xyes"])
636 dnl Check for curl (only if you want to compile the curl plugin).
638 [AS_HELP_STRING([--without-curl],
639 [disable curl plugin @<:@default=check@:>@])],
642 AS_IF([test "$with_curl" != "no"],[
643 PKG_CHECK_MODULES([CURL], [libcurl],[
644 AC_SUBST([CURL_CFLAGS])
645 AC_SUBST([CURL_LIBS])
646 AC_DEFINE([HAVE_CURL],[1],[curl found at compile time.])
647 AC_CHECK_DECL([CURLOPT_UNIX_SOCKET_PATH], [
648 AC_DEFINE([HAVE_CURLOPT_UNIX_SOCKET_PATH],[1],
649 [CURLOPT_UNIX_SOCKET_PATH found at compile time.])
650 ], [], [#include <curl/curl.h>])
652 [AC_MSG_WARN([curl not found, curl plugin will be disabled])])
654 AM_CONDITIONAL([HAVE_CURL],[test "x$CURL_LIBS" != "x"])
656 dnl Check for libssh (only if you want to compile the ssh plugin).
658 [AS_HELP_STRING([--without-ssh],
659 [disable ssh plugin @<:@default=check@:>@])],
662 AS_IF([test "$with_ssh" != "no"],[
663 PKG_CHECK_MODULES([SSH], [libssh >= 0.8.0],[
664 AC_SUBST([SSH_CFLAGS])
667 [AC_MSG_WARN([libssh not found, ssh plugin will be disabled])])
669 AM_CONDITIONAL([HAVE_SSH],[test "x$SSH_LIBS" != "x"])
671 dnl Check for genisoimage or mkisofs
672 dnl (only if you want to compile the iso plugin).
675 [AS_HELP_STRING([--without-iso],
676 [disable iso plugin @<:@default=check@:>@])],
679 AS_IF([test "$with_iso" != "no"],[
680 AC_CHECK_PROG([GENISOIMAGE],[genisoimage],[genisoimage],[no])
681 AC_CHECK_PROG([MKISOFS],[mkisofs],[mkisofs],[no])
682 AS_IF([test "x$GENISOIMAGE" != "xno"],[
683 ISOPROG="$GENISOIMAGE"
685 AS_IF([test "x$MKISOFS" != "xno"],[
689 AS_IF([test "x$ISOPROG" != "xno"],[
690 AC_DEFINE_UNQUOTED([ISOPROG],["$ISOPROG"],
691 [Program used by iso plugin to make ISOs.])
695 AM_CONDITIONAL([HAVE_ISO],[test "x$ISOPROG" != "xno"])
697 dnl Check for libvirt (only if you want to compile the libvirt plugin).
698 AC_ARG_WITH([libvirt],
699 [AS_HELP_STRING([--without-libvirt],
700 [disable libvirt plugin @<:@default=check@:>@])],
702 [with_libvirt=check])
703 AS_IF([test "$with_libvirt" != "no"],[
704 PKG_CHECK_MODULES([LIBVIRT], [libvirt],[
705 AC_SUBST([LIBVIRT_CFLAGS])
706 AC_SUBST([LIBVIRT_LIBS])
707 AC_DEFINE([HAVE_LIBVIRT],[1],[libvirt found at compile time.])
709 [AC_MSG_WARN([libvirt not found, libvirt plugin will be disabled])])
711 AM_CONDITIONAL([HAVE_LIBVIRT],[test "x$LIBVIRT_LIBS" != "x"])
713 dnl Check for zlib (only if you want to compile the gzip plugin).
715 [AS_HELP_STRING([--without-zlib],
716 [disable gzip plugin @<:@default=check@:>@])],
719 AS_IF([test "$with_zlib" != "no"],[
720 PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3.5],[
721 AC_SUBST([ZLIB_CFLAGS])
722 AC_SUBST([ZLIB_LIBS])
723 AC_DEFINE([HAVE_ZLIB],[1],[zlib found at compile time.])
725 [AC_MSG_WARN([zlib >= 1.2.3.5 not found, gzip plugin will be disabled])])
727 AM_CONDITIONAL([HAVE_ZLIB],[test "x$ZLIB_LIBS" != "x"])
729 dnl Check for libnbd (only if you want to compile the full nbd plugin).
730 AC_ARG_WITH([libnbd],
731 [AS_HELP_STRING([--without-libnbd],
732 [disable nbd plugin @<:@default=check@:>@])],
735 AS_IF([test "$with_libnbd" != "no"],[
736 PKG_CHECK_MODULES([LIBNBD], [libnbd >= 0.9.8],[
737 AC_SUBST([LIBNBD_CFLAGS])
738 AC_SUBST([LIBNBD_LIBS])
739 AC_DEFINE([HAVE_LIBNBD],[1],[libnbd found at compile time.])
741 [AC_MSG_WARN([libnbd >= 0.9.8 not found, nbd plugin will be crippled])])
743 AM_CONDITIONAL([HAVE_LIBNBD], [test "x$LIBNBD_LIBS" != "x"])
745 dnl Check for liblzma (only if you want to compile the xz filter).
746 AC_ARG_WITH([liblzma],
747 [AS_HELP_STRING([--without-liblzma],
748 [disable xz filter @<:@default=check@:>@])],
750 [with_liblzma=check])
751 AS_IF([test "$with_liblzma" != "no"],[
752 PKG_CHECK_MODULES([LIBLZMA], [liblzma],[
753 AC_SUBST([LIBLZMA_CFLAGS])
754 AC_SUBST([LIBLZMA_LIBS])
755 AC_DEFINE([HAVE_LIBLZMA],[1],[liblzma found at compile time.])
757 [AC_MSG_WARN([liblzma not found, xz filter will be disabled])])
759 AM_CONDITIONAL([HAVE_LIBLZMA],[test "x$LIBLZMA_LIBS" != "x"])
761 dnl Check for libguestfs (only for the guestfs plugin and the test suite).
762 AC_ARG_WITH([libguestfs],
763 [AS_HELP_STRING([--without-libguestfs],
764 [disable guestfs plugin and tests @<:@default=check@:>@])],
766 [with_libguestfs=check])
767 AS_IF([test "$with_libguestfs" != "no"],[
768 PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs],[
769 # Although the library was found, we want to make sure it supports nbd
770 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
773 #ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL
777 AC_SUBST([LIBGUESTFS_CFLAGS])
778 AC_SUBST([LIBGUESTFS_LIBS])
779 AC_DEFINE([HAVE_LIBGUESTFS],[1],[libguestfs found at compile time.])
782 AC_MSG_WARN([libguestfs too old, guestfs plugin and tests will be disabled])])
784 [AC_MSG_WARN([libguestfs not found, guestfs plugin and tests will be disabled])])
786 AM_CONDITIONAL([HAVE_LIBGUESTFS],[test "x$LIBGUESTFS_LIBS" != "x"])
788 dnl Check for guestfish (only needed for some of the tests).
789 AC_CHECK_PROG([GUESTFISH], [guestfish], [guestfish], [no])
790 AM_CONDITIONAL([HAVE_GUESTFISH], [test "x$GUESTFISH" != "xno"])
792 dnl Check for ext2fs and com_err, for the ext2 plugin.
794 [AS_HELP_STRING([--without-ext2],
795 [disable ext2 plugin @<:@default=check@:>@])],
798 AS_IF([test "$with_ext2" != "no"], [
799 PKG_CHECK_MODULES([EXT2FS], [ext2fs], [
800 AC_SUBST([EXT2FS_CFLAGS])
801 AC_SUBST([EXT2FS_LIBS])
802 AC_DEFINE([HAVE_EXT2FS],[1],[ext2fs found at compile time.])
804 [AC_MSG_WARN([ext2fs not found, ext2 plugin will be disabled])])
805 PKG_CHECK_MODULES([COM_ERR], [com_err], [
806 AC_SUBST([COM_ERR_CFLAGS])
807 AC_SUBST([COM_ERR_LIBS])
808 AC_DEFINE([HAVE_COM_ERR],[1],[com_err found at compile time.])
810 [AC_MSG_WARN([com_err not found, ext2 plugin will be disabled])])
812 AM_CONDITIONAL([HAVE_EXT2],
813 [test "x$EXT2FS_LIBS" != "x" && test "x$COM_ERR_LIBS" != "x"])
815 dnl Check if the user wants to disable VDDK support.
816 dnl See plugins/vddk/README.VDDK.
817 AC_ARG_ENABLE([vddk],
818 [AS_HELP_STRING([--disable-vddk],
819 [disable VMware VDDK plugin])],
822 AM_CONDITIONAL([HAVE_VDDK], [test "x$enable_vddk" = "xyes"])
824 dnl List of plugins and filters.
864 plugins="$(echo $(printf %s\\n $lang_plugins $non_lang_plugins | sort -u))"
887 AC_SUBST([lang_plugins])
888 AC_SUBST([non_lang_plugins])
891 dnl Produce output files.
892 AC_CONFIG_HEADERS([config.h])
893 AC_CONFIG_FILES([podwrapper.pl],
894 [chmod +x,-w podwrapper.pl])
895 AC_CONFIG_FILES([Makefile
897 common/bitmap/Makefile
899 common/include/Makefile
900 common/protocol/Makefile
901 common/regions/Makefile
902 common/sparse/Makefile
903 common/utils/Makefile
906 include/nbdkit-version.h
908 plugins/curl/Makefile
909 plugins/data/Makefile
910 plugins/example1/Makefile
911 plugins/example2/Makefile
912 plugins/example3/Makefile
913 plugins/example4/Makefile
914 plugins/ext2/Makefile
915 plugins/file/Makefile
916 plugins/floppy/Makefile
917 plugins/full/Makefile
918 plugins/guestfs/Makefile
919 plugins/gzip/Makefile
921 plugins/libvirt/Makefile
922 plugins/linuxdisk/Makefile
924 plugins/memory/Makefile
926 plugins/null/Makefile
927 plugins/ocaml/Makefile
928 plugins/partitioning/Makefile
929 plugins/pattern/Makefile
930 plugins/perl/Makefile
931 plugins/python/Makefile
932 plugins/random/Makefile
933 plugins/ruby/Makefile
934 plugins/rust/Cargo.toml
935 plugins/rust/Makefile
938 plugins/split/Makefile
939 plugins/streaming/Makefile
942 plugins/vddk/Makefile
943 plugins/zero/Makefile
945 filters/blocksize/Makefile
946 filters/cache/Makefile
947 filters/cacheextents/Makefile
949 filters/delay/Makefile
950 filters/error/Makefile
953 filters/nocache/Makefile
954 filters/noextents/Makefile
955 filters/noparallel/Makefile
956 filters/nozero/Makefile
957 filters/offset/Makefile
958 filters/partition/Makefile
959 filters/rate/Makefile
960 filters/readahead/Makefile
961 filters/stats/Makefile
962 filters/truncate/Makefile
976 echo "----------------------------------------------------------------------"
977 echo "Thank you for downloading $PACKAGE_STRING"
979 echo "This is how we have configured the optional components for you today:"
986 if $@; then echo "yes"; else echo "no"; fi
989 echo "Optional server features:"
991 feature "bash-completion ........................ " \
992 test "x$HAVE_BASH_COMPLETION_TRUE" = "x"
993 feature "manual pages ........................... " \
994 test "x$HAVE_POD_TRUE" = "x"
995 feature "SELinux ................................ " \
996 test "x$LIBSELINUX_LIBS" != "x"
997 feature "TLS .................................... " \
998 test "x$GNUTLS_LIBS" != "x"
1001 echo "Optional plugins:"
1003 feature "curl ................................... " \
1004 test "x$HAVE_CURL_TRUE" = "x"
1005 feature "example4 ............................... " \
1006 test "x$HAVE_PERL_TRUE" = "x"
1007 feature "ext2 ................................... " \
1008 test "x$HAVE_EXT2_TRUE" = "x"
1009 feature "floppy ................................. " \
1010 test "x$HAVE_ICONV_TRUE" = "x"
1011 feature "guestfs ................................ " \
1012 test "x$HAVE_LIBGUESTFS_TRUE" = "x"
1013 feature "gzip ................................... " \
1014 test "x$HAVE_ZLIB_TRUE" = "x"
1015 feature "iso .................................... " \
1016 test "x$HAVE_ISO_TRUE" = "x"
1017 feature "libvirt ................................ " \
1018 test "x$HAVE_LIBVIRT_TRUE" = "x"
1019 feature "nbd .................................... " \
1020 test "x$HAVE_LIBNBD_TRUE" = "x"
1021 feature "ssh .................................... " \
1022 test "x$HAVE_SSH_TRUE" = "x"
1023 feature "tar .................................... " \
1024 test "x$HAVE_PERL_TRUE" = "x"
1025 feature "vddk ................................... " \
1026 test "x$HAVE_VDDK_TRUE" = "x"
1032 feature "lua .................................... " \
1033 test "x$HAVE_LUA_TRUE" = "x"
1034 feature "ocaml .................................. " \
1035 test "x$HAVE_OCAML_TRUE" = "x"
1036 feature "perl ................................... " \
1037 test "x$HAVE_PERL_TRUE" = "x"
1038 feature "python ................................. " \
1039 test "x$HAVE_PYTHON_TRUE" = "x"
1040 feature "ruby ................................... " \
1041 test "x$HAVE_RUBY_TRUE" = "x"
1042 feature "rust ................................... " \
1043 test "x$HAVE_RUST_TRUE" = "x"
1044 feature "tcl .................................... " \
1045 test "x$HAVE_TCL_TRUE" = "x"
1049 echo "Optional filters:"
1051 feature "xz ..................................... " \
1052 test "x$HAVE_LIBLZMA_TRUE" = "x"
1055 echo "If any optional component is configured ‘no’ when you expected ‘yes’"
1056 echo "then you should check the preceding messages and README."
1058 echo "Please report bugs back to the mailing list:"
1059 echo "http://www.redhat.com/mailman/listinfo/libguestfs"
1061 echo "Next you should type 'make' to build the package,"
1062 echo "then 'make check' to run the tests."