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], [15])
34 m4_define([NBDKIT_VERSION_MICRO], [2])
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 3, 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 AC_MSG_CHECKING([Python major version is 3])
492 AS_IF([test "x$PYTHON_VERSION_MAJOR" = "x3"],[
496 AC_MSG_ERROR([Python $PYTHON_VERSION_MAJOR <> 3 is no longer supported.
498 Python 2 end of life is 2020-01-01 and nbdkit >= 1.16 no longer
501 If you want to use Python 2, you will need to use nbdkit 1.14.])
504 dnl Check for Python CFLAGS, libraries.
505 dnl For Python >= 3.8 we have to use python-<VERSION>-embed.pc, see:
506 dnl https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
507 dnl The python.pc is called python-<VERSION>.pc on Debian and
508 dnl later versions of Fedora, and python.pc on older versions
510 PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"-embed], [
511 AC_SUBST([PYTHON_CFLAGS])
512 AC_SUBST([PYTHON_LIBS])
513 AC_SUBST([PYTHON_VERSION])
514 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
516 PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"], [
517 AC_SUBST([PYTHON_CFLAGS])
518 AC_SUBST([PYTHON_LIBS])
519 AC_SUBST([PYTHON_VERSION])
520 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
522 PKG_CHECK_MODULES([PYTHON], [python], [
523 AC_SUBST([PYTHON_CFLAGS])
524 AC_SUBST([PYTHON_LIBS])
525 AC_SUBST([PYTHON_VERSION])
526 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
528 AC_MSG_WARN([python $PYTHON_VERSION not found])
532 AM_CONDITIONAL([HAVE_PYTHON],[test "x$enable_python" != "xno" && test "x$PYTHON" != "xno"])
533 AC_SUBST([PYTHON_CFLAGS])
534 AC_SUBST([PYTHON_LIBS])
535 AC_SUBST([PYTHON_LDFLAGS])
537 dnl For the OCaml plugin, you can set OCAMLOPTFLAGS before running
538 dnl ./configure to specify any extra flags you want to pass to
540 AC_SUBST([OCAMLOPTFLAGS])
542 dnl Check for OCaml, for embedding in the ocaml plugin.
544 AC_ARG_ENABLE([ocaml],
545 [AS_HELP_STRING([--disable-ocaml], [disable OCaml embed plugin])],
548 AS_IF([test "x$OCAMLOPT" != "xno" && test "x$enable_ocaml" != "xno"],[
549 dnl Check OCaml can create a shared library (see README for details).
550 AC_MSG_CHECKING([if $OCAMLOPT can create a shared library])
551 echo 'print_endline "test"' > conftest.ml
552 AS_IF([$OCAMLOPT $OCAMLOPTFLAGS -output-obj -runtime-variant _pic -o conftest.so conftest.ml >&AS_MESSAGE_LOG_FD 2>&1],[
554 ocaml_link_shared=yes
558 rm -f conftest.ml conftest.cmi conftest.cmx conftest.so conftest.o
560 AM_CONDITIONAL([HAVE_OCAML],[test "x$OCAMLOPT" != "xno" &&
561 test "x$ocaml_link_shared" = "xyes"])
563 dnl For developing plugins in Rust, optional.
564 AC_CHECK_PROG([CARGO],[cargo],[cargo],[no])
565 AC_ARG_ENABLE([rust],
566 [AS_HELP_STRING([--disable-rust], [disable Rust plugin])],
569 AM_CONDITIONAL([HAVE_RUST],
570 [test "x$CARGO" != "xno" && test "x$enable_rust" != "xno"])
572 dnl Check for Ruby, for embedding in the Ruby plugin.
573 AC_CHECK_PROG([RUBY],[ruby],[ruby],[no])
574 AC_ARG_ENABLE([ruby],
575 [AS_HELP_STRING([--disable-ruby], [disable Ruby plugin])],
578 AS_IF([test "x$RUBY" != "xno" && test "x$enable_ruby" != "xno"],[
579 PKG_CHECK_MODULES([RUBY], [ruby], [
580 AC_SUBST([RUBY_CFLAGS])
581 AC_SUBST([RUBY_LIBS])
583 AC_MSG_WARN([ruby not found])
587 AM_CONDITIONAL([HAVE_RUBY],[test "x$RUBY" != "xno" &&
588 test "x$enable_ruby" = "xyes"])
590 dnl Check for Tcl, for embedding in the Tcl plugin.
592 [AS_HELP_STRING([--disable-tcl], [disable Tcl plugin])],
595 AS_IF([test "x$enable_tcl" != "xno"],[
596 PKG_CHECK_MODULES([TCL], [tcl], [
597 AC_SUBST([TCL_CFLAGS])
600 AC_MSG_WARN([Tcl not found])
604 AM_CONDITIONAL([HAVE_TCL],[test "x$enable_tcl" = "xyes"])
606 dnl Check for Lua, for embedding in the Lua plugin.
608 [AS_HELP_STRING([--disable-lua], [disable Lua plugin])],
611 AS_IF([test "x$enable_lua" != "xno"],[
612 PKG_CHECK_MODULES([LUA], [lua], [
613 AC_SUBST([LUA_CFLAGS])
616 dnl Lua 5.1 used by RHEL 7 does not have lua_isinteger.
618 LIBS="$LUA_LIBS $LIBS"
619 AC_CHECK_FUNCS([lua_isinteger])
622 AC_MSG_WARN([Lua not found])
626 AM_CONDITIONAL([HAVE_LUA],[test "x$enable_lua" = "xyes"])
628 dnl Check for curl (only if you want to compile the curl plugin).
630 [AS_HELP_STRING([--without-curl],
631 [disable curl plugin @<:@default=check@:>@])],
634 AS_IF([test "$with_curl" != "no"],[
635 PKG_CHECK_MODULES([CURL], [libcurl],[
636 AC_SUBST([CURL_CFLAGS])
637 AC_SUBST([CURL_LIBS])
638 AC_DEFINE([HAVE_CURL],[1],[curl found at compile time.])
639 AC_CHECK_DECL([CURLOPT_UNIX_SOCKET_PATH], [
640 AC_DEFINE([HAVE_CURLOPT_UNIX_SOCKET_PATH],[1],
641 [CURLOPT_UNIX_SOCKET_PATH found at compile time.])
642 ], [], [#include <curl/curl.h>])
644 [AC_MSG_WARN([curl not found, curl plugin will be disabled])])
646 AM_CONDITIONAL([HAVE_CURL],[test "x$CURL_LIBS" != "x"])
648 dnl Check for libssh (only if you want to compile the ssh plugin).
650 [AS_HELP_STRING([--without-ssh],
651 [disable ssh plugin @<:@default=check@:>@])],
654 AS_IF([test "$with_ssh" != "no"],[
655 PKG_CHECK_MODULES([SSH], [libssh >= 0.8.0],[
656 AC_SUBST([SSH_CFLAGS])
659 [AC_MSG_WARN([libssh not found, ssh plugin will be disabled])])
661 AM_CONDITIONAL([HAVE_SSH],[test "x$SSH_LIBS" != "x"])
663 dnl Check for genisoimage or mkisofs
664 dnl (only if you want to compile the iso plugin).
667 [AS_HELP_STRING([--without-iso],
668 [disable iso plugin @<:@default=check@:>@])],
671 AS_IF([test "$with_iso" != "no"],[
672 AC_CHECK_PROG([GENISOIMAGE],[genisoimage],[genisoimage],[no])
673 AC_CHECK_PROG([MKISOFS],[mkisofs],[mkisofs],[no])
674 AS_IF([test "x$GENISOIMAGE" != "xno"],[
675 ISOPROG="$GENISOIMAGE"
677 AS_IF([test "x$MKISOFS" != "xno"],[
681 AS_IF([test "x$ISOPROG" != "xno"],[
682 AC_DEFINE_UNQUOTED([ISOPROG],["$ISOPROG"],
683 [Program used by iso plugin to make ISOs.])
687 AM_CONDITIONAL([HAVE_ISO],[test "x$ISOPROG" != "xno"])
689 dnl Check for libvirt (only if you want to compile the libvirt plugin).
690 AC_ARG_WITH([libvirt],
691 [AS_HELP_STRING([--without-libvirt],
692 [disable libvirt plugin @<:@default=check@:>@])],
694 [with_libvirt=check])
695 AS_IF([test "$with_libvirt" != "no"],[
696 PKG_CHECK_MODULES([LIBVIRT], [libvirt],[
697 AC_SUBST([LIBVIRT_CFLAGS])
698 AC_SUBST([LIBVIRT_LIBS])
699 AC_DEFINE([HAVE_LIBVIRT],[1],[libvirt found at compile time.])
701 [AC_MSG_WARN([libvirt not found, libvirt plugin will be disabled])])
703 AM_CONDITIONAL([HAVE_LIBVIRT],[test "x$LIBVIRT_LIBS" != "x"])
705 dnl Check for zlib (only if you want to compile the gzip plugin).
707 [AS_HELP_STRING([--without-zlib],
708 [disable gzip plugin @<:@default=check@:>@])],
711 AS_IF([test "$with_zlib" != "no"],[
712 PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3.5],[
713 AC_SUBST([ZLIB_CFLAGS])
714 AC_SUBST([ZLIB_LIBS])
715 AC_DEFINE([HAVE_ZLIB],[1],[zlib found at compile time.])
717 [AC_MSG_WARN([zlib >= 1.2.3.5 not found, gzip plugin will be disabled])])
719 AM_CONDITIONAL([HAVE_ZLIB],[test "x$ZLIB_LIBS" != "x"])
721 dnl Check for libnbd (only if you want to compile the full nbd plugin).
722 AC_ARG_WITH([libnbd],
723 [AS_HELP_STRING([--without-libnbd],
724 [disable nbd plugin @<:@default=check@:>@])],
727 AS_IF([test "$with_libnbd" != "no"],[
728 PKG_CHECK_MODULES([LIBNBD], [libnbd >= 0.9.8],[
729 AC_SUBST([LIBNBD_CFLAGS])
730 AC_SUBST([LIBNBD_LIBS])
731 AC_DEFINE([HAVE_LIBNBD],[1],[libnbd found at compile time.])
733 [AC_MSG_WARN([libnbd >= 0.9.8 not found, nbd plugin will be crippled])])
735 AM_CONDITIONAL([HAVE_LIBNBD], [test "x$LIBNBD_LIBS" != "x"])
737 dnl Check for liblzma (only if you want to compile the xz filter).
738 AC_ARG_WITH([liblzma],
739 [AS_HELP_STRING([--without-liblzma],
740 [disable xz filter @<:@default=check@:>@])],
742 [with_liblzma=check])
743 AS_IF([test "$with_liblzma" != "no"],[
744 PKG_CHECK_MODULES([LIBLZMA], [liblzma],[
745 AC_SUBST([LIBLZMA_CFLAGS])
746 AC_SUBST([LIBLZMA_LIBS])
747 AC_DEFINE([HAVE_LIBLZMA],[1],[liblzma found at compile time.])
749 [AC_MSG_WARN([liblzma not found, xz filter will be disabled])])
751 AM_CONDITIONAL([HAVE_LIBLZMA],[test "x$LIBLZMA_LIBS" != "x"])
753 dnl Check for libguestfs (only for the guestfs plugin and the test suite).
754 AC_ARG_WITH([libguestfs],
755 [AS_HELP_STRING([--without-libguestfs],
756 [disable guestfs plugin and tests @<:@default=check@:>@])],
758 [with_libguestfs=check])
759 AS_IF([test "$with_libguestfs" != "no"],[
760 PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs],[
761 # Although the library was found, we want to make sure it supports nbd
762 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
765 #ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL
769 AC_SUBST([LIBGUESTFS_CFLAGS])
770 AC_SUBST([LIBGUESTFS_LIBS])
771 AC_DEFINE([HAVE_LIBGUESTFS],[1],[libguestfs found at compile time.])
774 AC_MSG_WARN([libguestfs too old, guestfs plugin and tests will be disabled])])
776 [AC_MSG_WARN([libguestfs not found, guestfs plugin and tests will be disabled])])
778 AM_CONDITIONAL([HAVE_LIBGUESTFS],[test "x$LIBGUESTFS_LIBS" != "x"])
780 dnl Check for guestfish (only needed for some of the tests).
781 AC_CHECK_PROG([GUESTFISH], [guestfish], [guestfish], [no])
782 AM_CONDITIONAL([HAVE_GUESTFISH], [test "x$GUESTFISH" != "xno"])
784 dnl Check for ext2fs and com_err, for the ext2 plugin.
786 [AS_HELP_STRING([--without-ext2],
787 [disable ext2 plugin @<:@default=check@:>@])],
790 AS_IF([test "$with_ext2" != "no"], [
791 PKG_CHECK_MODULES([EXT2FS], [ext2fs], [
792 AC_SUBST([EXT2FS_CFLAGS])
793 AC_SUBST([EXT2FS_LIBS])
794 AC_DEFINE([HAVE_EXT2FS],[1],[ext2fs found at compile time.])
796 [AC_MSG_WARN([ext2fs not found, ext2 plugin will be disabled])])
797 PKG_CHECK_MODULES([COM_ERR], [com_err], [
798 AC_SUBST([COM_ERR_CFLAGS])
799 AC_SUBST([COM_ERR_LIBS])
800 AC_DEFINE([HAVE_COM_ERR],[1],[com_err found at compile time.])
802 [AC_MSG_WARN([com_err not found, ext2 plugin will be disabled])])
804 AM_CONDITIONAL([HAVE_EXT2],
805 [test "x$EXT2FS_LIBS" != "x" && test "x$COM_ERR_LIBS" != "x"])
807 dnl Check if the user wants to disable VDDK support.
808 dnl See plugins/vddk/README.VDDK.
809 AC_ARG_ENABLE([vddk],
810 [AS_HELP_STRING([--disable-vddk],
811 [disable VMware VDDK plugin])],
814 AM_CONDITIONAL([HAVE_VDDK], [test "x$enable_vddk" = "xyes"])
816 dnl List of plugins and filters.
857 plugins="$(echo $(printf %s\\n $lang_plugins $non_lang_plugins | sort -u))"
881 AC_SUBST([lang_plugins])
882 AC_SUBST([non_lang_plugins])
885 dnl Produce output files.
886 AC_CONFIG_HEADERS([config.h])
887 AC_CONFIG_FILES([podwrapper.pl],
888 [chmod +x,-w podwrapper.pl])
889 AC_CONFIG_FILES([Makefile
891 common/bitmap/Makefile
893 common/include/Makefile
894 common/protocol/Makefile
895 common/regions/Makefile
896 common/sparse/Makefile
897 common/utils/Makefile
900 include/nbdkit-version.h
902 plugins/curl/Makefile
903 plugins/data/Makefile
904 plugins/example1/Makefile
905 plugins/example2/Makefile
906 plugins/example3/Makefile
907 plugins/example4/Makefile
908 plugins/ext2/Makefile
909 plugins/file/Makefile
910 plugins/floppy/Makefile
911 plugins/full/Makefile
912 plugins/guestfs/Makefile
913 plugins/gzip/Makefile
915 plugins/libvirt/Makefile
916 plugins/linuxdisk/Makefile
918 plugins/memory/Makefile
920 plugins/null/Makefile
921 plugins/ocaml/Makefile
922 plugins/partitioning/Makefile
923 plugins/pattern/Makefile
924 plugins/perl/Makefile
925 plugins/python/Makefile
926 plugins/random/Makefile
927 plugins/reflection/Makefile
928 plugins/ruby/Makefile
929 plugins/rust/Cargo.toml
930 plugins/rust/Makefile
933 plugins/split/Makefile
934 plugins/streaming/Makefile
937 plugins/vddk/Makefile
938 plugins/zero/Makefile
940 filters/blocksize/Makefile
941 filters/cache/Makefile
942 filters/cacheextents/Makefile
944 filters/delay/Makefile
945 filters/error/Makefile
948 filters/nocache/Makefile
949 filters/noextents/Makefile
950 filters/noparallel/Makefile
951 filters/nozero/Makefile
952 filters/offset/Makefile
953 filters/partition/Makefile
954 filters/rate/Makefile
955 filters/readahead/Makefile
956 filters/retry/Makefile
957 filters/stats/Makefile
958 filters/truncate/Makefile
972 echo "----------------------------------------------------------------------"
973 echo "Thank you for downloading $PACKAGE_STRING"
975 echo "This is how we have configured the optional components for you today:"
982 if $@; then echo "yes"; else echo "no"; fi
985 echo "Optional server features:"
987 feature "bash-completion ........................ " \
988 test "x$HAVE_BASH_COMPLETION_TRUE" = "x"
989 feature "manual pages ........................... " \
990 test "x$HAVE_POD_TRUE" = "x"
991 feature "SELinux ................................ " \
992 test "x$LIBSELINUX_LIBS" != "x"
993 feature "TLS .................................... " \
994 test "x$GNUTLS_LIBS" != "x"
997 echo "Optional plugins:"
999 feature "curl ................................... " \
1000 test "x$HAVE_CURL_TRUE" = "x"
1001 feature "example4 ............................... " \
1002 test "x$HAVE_PERL_TRUE" = "x"
1003 feature "ext2 ................................... " \
1004 test "x$HAVE_EXT2_TRUE" = "x"
1005 feature "floppy ................................. " \
1006 test "x$HAVE_ICONV_TRUE" = "x"
1007 feature "guestfs ................................ " \
1008 test "x$HAVE_LIBGUESTFS_TRUE" = "x"
1009 feature "gzip ................................... " \
1010 test "x$HAVE_ZLIB_TRUE" = "x"
1011 feature "iso .................................... " \
1012 test "x$HAVE_ISO_TRUE" = "x"
1013 feature "libvirt ................................ " \
1014 test "x$HAVE_LIBVIRT_TRUE" = "x"
1015 feature "nbd .................................... " \
1016 test "x$HAVE_LIBNBD_TRUE" = "x"
1017 feature "ssh .................................... " \
1018 test "x$HAVE_SSH_TRUE" = "x"
1019 feature "tar .................................... " \
1020 test "x$HAVE_PERL_TRUE" = "x"
1021 feature "vddk ................................... " \
1022 test "x$HAVE_VDDK_TRUE" = "x"
1028 feature "lua .................................... " \
1029 test "x$HAVE_LUA_TRUE" = "x"
1030 feature "ocaml .................................. " \
1031 test "x$HAVE_OCAML_TRUE" = "x"
1032 feature "perl ................................... " \
1033 test "x$HAVE_PERL_TRUE" = "x"
1034 feature "python ................................. " \
1035 test "x$HAVE_PYTHON_TRUE" = "x"
1036 feature "ruby ................................... " \
1037 test "x$HAVE_RUBY_TRUE" = "x"
1038 feature "rust ................................... " \
1039 test "x$HAVE_RUST_TRUE" = "x"
1040 feature "tcl .................................... " \
1041 test "x$HAVE_TCL_TRUE" = "x"
1045 echo "Optional filters:"
1047 feature "xz ..................................... " \
1048 test "x$HAVE_LIBLZMA_TRUE" = "x"
1051 echo "If any optional component is configured ‘no’ when you expected ‘yes’"
1052 echo "then you should check the preceding messages and README."
1054 echo "Please report bugs back to the mailing list:"
1055 echo "http://www.redhat.com/mailman/listinfo/libguestfs"
1057 echo "Next you should type 'make' to build the package,"
1058 echo "then 'make check' to run the tests."