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 AC_INIT([nbdkit], [1.13.9])
33 AC_CONFIG_MACRO_DIR([m4])
34 m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],[],
35 [m4_define([AC_USE_SYSTEM_EXTENSIONS],[])])
36 AC_USE_SYSTEM_EXTENSIONS
39 dnl NB: Do not [quote] this parameter.
40 AM_INIT_AUTOMAKE(foreign)
48 dnl Check for basic C environment.
55 test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
59 dnl Check for C++ (optional, we just use this to test the header
60 dnl can be included from C++ code).
63 dnl The C++ compiler test is pretty useless because even if it fails
64 dnl it sets CXX=g++. So test the compiler actually works.
65 AC_MSG_CHECKING([if the C++ compiler really really works])
66 AS_IF([$CXX --version >&AS_MESSAGE_LOG_FD 2>&1],[have_cxx=yes],[have_cxx=no])
67 AC_MSG_RESULT([$have_cxx])
68 AM_CONDITIONAL([HAVE_CXX], [test "$have_cxx" = "yes"])
70 AC_ARG_ENABLE([gcc-warnings],
71 [AS_HELP_STRING([--enable-gcc-warnings],
72 [turn on lots of GCC warnings (for developers)])],
75 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
77 gcc_warnings=$enableval],
80 if test "x$gcc_warnings" = "xyes"; then
81 WARNINGS_CFLAGS="-Wall -Werror"
82 AC_SUBST([WARNINGS_CFLAGS])
85 dnl Check if the compiler supports -std=c90 flag. This is only used
86 dnl during a test. OpenBSD GCC does not support this flag so we skip
88 AC_MSG_CHECKING([if the compiler supports -std=c90 for ANSI C test])
90 CFLAGS="$CFLAGS -std=c90"
91 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
92 [supports_std_c90=yes],
93 [supports_std_c90=no])
95 AC_MSG_RESULT([$supports_std_c90])
96 AM_CONDITIONAL([CAN_TEST_ANSI_C], [test "x$supports_std_c90" = "xyes"])
98 dnl On Haiku we must use BSD-compatibility headers to get the endian
100 AC_MSG_CHECKING(whether OS-dependent include paths are required)
102 [haiku*], [CFLAGS="$CFLAGS -I`findpaths -p /system B_FIND_PATH_HEADERS_DIRECTORY`/bsd"; AC_MSG_RESULT(yes)],
106 dnl On Linux /tmp is often tmpfs which is not large enough, so use /var/tmp.
107 dnl But Haiku only has /tmp.
108 AC_MSG_CHECKING([for temporary directory for large files])
110 [haiku*], [LARGE_TMPDIR=/tmp],
111 [LARGE_TMPDIR=/var/tmp]
113 AC_MSG_RESULT([$LARGE_TMPDIR])
114 AC_DEFINE_UNQUOTED([LARGE_TMPDIR],["$LARGE_TMPDIR"],
115 [Temporary directory for large files])
117 dnl Check if libc has program_invocation_short_name.
118 AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
122 dnl Check if __attribute__((cleanup(...))) works.
123 dnl Set -Werror, otherwise gcc will only emit a warning for attributes
124 dnl that it doesn't understand.
125 acx_nbdkit_save_CFLAGS="${CFLAGS}"
126 CFLAGS="${CFLAGS} -Werror"
127 AC_MSG_CHECKING([if __attribute__((cleanup(...))) works with this compiler])
142 __attribute__((cleanup(freep))) char *ptr = malloc (100);
146 main (int argc, char *argv[])
157 ['__attribute__((cleanup(...)))' does not work.
159 You may not be using a sufficiently recent version of GCC or CLANG, or
160 you may be using a C compiler which does not support this attribute,
161 or the configure test may be wrong.
163 This code requires the attribute to work for proper locking between threads.])])
164 CFLAGS="${acx_nbdkit_save_CFLAGS}"
166 dnl Check for __auto_type (GCC extension).
167 AC_MSG_CHECKING([if __auto_type is available in this compiler])
179 AC_DEFINE([HAVE_AUTO_TYPE],[1],[__auto_type is available])
185 dnl Check for other headers, all optional.
194 dnl Check for functions in libc, all optional.
198 get_current_dir_name \
204 dnl Check whether printf("%m") works
205 AC_CACHE_CHECK([whether the printf family supports %m],
206 [nbdkit_cv_func_printf_percent_m],
215 snprintf(buf, sizeof buf, "%m");
216 return !!strcmp (buf, strerror (EINVAL));
218 [nbdkit_cv_func_printf_percent_m=yes],
219 [nbdkit_cv_func_printf_percent_m=no],
222 *-gnu* | gnu*) nbdkit_cv_func_printf_percent_m=yes;;
223 *) nbdkit_cv_func_printf_percent_m="guessing no";;
226 AS_IF([test "x$nbdkit_cv_func_printf_percent_m" = xyes],
227 [AC_DEFINE([HAVE_VFPRINTF_PERCENT_M],[1],
228 [Define to 1 if vfprintf supports %m.])])
231 AC_SEARCH_LIBS([dlsym], [dl dld], [
232 AS_IF([test "x$ac_cv_search_dlsym" != "xnone required"],
233 [DL_LIBS="$ac_cv_search_dlsym"], [DL_LIBS=])
235 ], [AC_MSG_ERROR([unable to find the dlsym() function])
239 dnl Test if <iconv.h> header can build working binaries.
241 dnl On FreeBSD: iconv and libiconv both exist, both can be installed
242 dnl simultaneously, <iconv.h> can exist in two separate places, and
243 dnl if you get the wrong header/library mix everything breaks.
245 dnl On Haiku: libiconv is required to link to iconv_* functions.
247 [AS_HELP_STRING([--without-iconv],
248 [don't try to link against iconv @<:@default=check@:>@])],
251 AS_IF([test "x$with_iconv" != "xno"],[
252 AC_CHECK_HEADER([iconv.h],[
253 AC_MSG_CHECKING([if <iconv.h> can be used to link a program])
260 main (int argc, char *argv[])
262 iconv_t ic = iconv_open ("", "");
275 AM_CONDITIONAL([HAVE_ICONV], [test "x$iconv_working" = "xyes"])
277 dnl Don't use linker script for the server on FreeBSD because
278 dnl FreeBSD's linker is broken. See eg:
279 dnl https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190851
280 AC_MSG_CHECKING([if we should use a linker script for the server])
282 [freebsd*], [use_linker_script_for_server=no],
283 [use_linker_script_for_server=yes]
285 AC_MSG_RESULT([$use_linker_script_for_server])
286 AM_CONDITIONAL([USE_LINKER_SCRIPT_FOR_SERVER],
287 [test "x$use_linker_script_for_server" = "xyes"])
289 dnl Check if -rdynamic linker flag works.
290 acx_nbdkit_save_LDFLAGS="${LDFLAGS}"
291 LDFLAGS="${LDFLAGS} -rdynamic"
292 AC_MSG_CHECKING([if linker supports -rdynamic])
297 main (int argc, char *argv[])
309 LDFLAGS="${acx_nbdkit_save_LDFLAGS}"
310 AC_SUBST([DL_LDFLAGS])
312 dnl Check for dladdr in -ldl, optional. This is a glibc extension.
314 LIBS="$DL_LIBS $LIBS"
315 AC_CHECK_FUNCS([dladdr])
318 AC_SEARCH_LIBS([getaddrinfo], [network socket])
320 dnl Check for SELinux socket labelling (optional).
321 PKG_CHECK_MODULES([LIBSELINUX], [libselinux], [
322 AC_SUBST([LIBSELINUX_CFLAGS])
323 AC_SUBST([LIBSELINUX_LIBS])
324 AC_DEFINE([HAVE_LIBSELINUX],[1],[libselinux found at compile time.])
326 AC_MSG_WARN([libselinux not found, SELinux socket labelling support will be disabled.])
329 dnl Check for GnuTLS (optional, for TLS support).
330 PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3.0], [
331 AC_SUBST([GNUTLS_CFLAGS])
332 AC_SUBST([GNUTLS_LIBS])
333 AC_DEFINE([HAVE_GNUTLS],[1],[gnutls found at compile time.])
335 AC_MSG_WARN([gnutls not found or < 3.3.0, TLS support will be disabled.])
338 AS_IF([test "$GNUTLS_LIBS" != ""],[
339 AC_MSG_CHECKING([for default TLS session priority string])
340 AC_ARG_WITH([tls-priority],
341 [AS_HELP_STRING([--with-tls-priority],
342 [default TLS session priority string @<:@default=NORMAL@:>@])],
343 [tls_priority=$withval],
344 [tls_priority=NORMAL])
345 AC_MSG_RESULT([$tls_priority])
346 AC_DEFINE_UNQUOTED([TLS_PRIORITY],["$tls_priority"],
347 [Default TLS session priority string])
349 # Check for APIs which may not be present.
351 LIBS="$GNUTLS_LIBS $LIBS"
353 gnutls_base64_decode2 \
354 gnutls_certificate_set_known_dh_params \
355 gnutls_session_set_verify_cert])
359 dnl Check for valgrind.
360 AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind],[no])
362 dnl If valgrind headers are available (optional).
363 dnl Since this is only useful for developers, you have to enable
364 dnl it explicitly using --enable-valgrind.
365 AC_ARG_ENABLE([valgrind],
366 [AS_HELP_STRING([--enable-valgrind],
367 [enable Valgrind extensions (for developers)])],
368 [enable_valgrind=yes],
369 [enable_valgrind=no])
370 AS_IF([test "x$enable_valgrind" = "xyes"],[
371 PKG_CHECK_MODULES([VALGRIND], [valgrind], [
372 AC_SUBST([VALGRIND_CFLAGS])
373 AC_SUBST([VALGRIND_LIBS])
374 AC_DEFINE([HAVE_VALGRIND],[1],[Valgrind headers found at compile time])
376 AC_MSG_ERROR([--enable-valgrind given, but Valgrind headers are not available])
381 PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [
383 AC_MSG_CHECKING([for bash-completions directory])
384 m4_ifdef([PKG_CHECK_VAR],[
385 PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir])
387 AS_IF([test -z "$bashcompdir"], [
388 bashcompdir="${sysconfdir}/bash_completion.d"
390 AC_MSG_RESULT([$bashcompdir])
391 AC_SUBST([bashcompdir])
394 AC_MSG_WARN([bash-completion not installed])
396 AM_CONDITIONAL([HAVE_BASH_COMPLETION],[test "x$bash_completion" = "xyes"])
398 dnl Check we have enough to run podwrapper.
399 AC_CHECK_PROG([PERL],[perl],[perl],[no])
400 AS_IF([test "x$PERL" != "xno"],[
401 AC_MSG_CHECKING([if we have perl Pod::Man and Pod::Simple])
402 AS_IF([$PERL -MPod::Man -MPod::Simple -e 1 >&AS_MESSAGE_LOG_FD 2>&1],[
407 AC_MSG_RESULT([$enable_pod])
409 AM_CONDITIONAL([HAVE_POD],
410 [test "x$PERL" != "xno" && test "x$enable_pod" = "xyes"])
412 dnl Define the path to the podwrapper program.
413 PODWRAPPER="$PERL $(pwd)/podwrapper.pl"
414 AC_SUBST([PODWRAPPER])
416 dnl Allow all plugins and filters to be disabled.
417 AC_ARG_ENABLE([plugins],
418 [AS_HELP_STRING([--disable-plugins],
419 [disable all bundled plugins and filters])])
420 AM_CONDITIONAL([HAVE_PLUGINS], [test "x$enable_plugins" != "xno"])
422 dnl Check for Perl, for embedding in the perl plugin.
423 dnl Note that the perl binary is checked above.
424 AC_ARG_ENABLE([perl],
425 [AS_HELP_STRING([--disable-perl], [disable Perl embed plugin])],
428 AS_IF([test "x$PERL" != "xno" && test "x$enable_perl" != "xno"],[
429 dnl Check for Perl archlib.
430 AC_MSG_CHECKING([for Perl embed archlib])
431 PERL_ARCHLIB="$($PERL -MConfig -e 'print $Config{archlib}')"
432 AS_IF([ test -n "$PERL_ARCHLIB" ],[
433 AC_MSG_RESULT([$PERL_ARCHLIB])
435 AC_MSG_NOTICE([Perl embed module disabled])
439 dnl Check for Perl CFLAGS.
440 AC_MSG_CHECKING([for Perl embed CFLAGS])
441 PERL_CFLAGS="$($PERL -MExtUtils::Embed -e 'ccflags')"
442 AS_IF([ test -n "$PERL_CFLAGS" ],[
443 AC_MSG_RESULT([$PERL_CFLAGS])
445 AC_MSG_NOTICE([Perl embed module disabled])
449 dnl Check for Perl LDOPTS.
450 AC_MSG_CHECKING([for Perl embed LDOPTS])
451 PERL_LDOPTS="$($PERL -MExtUtils::Embed -e 'ldopts')"
452 AC_MSG_RESULT([$PERL_LDOPTS])
454 dnl XXX Could check these actually work.
456 AM_CONDITIONAL([HAVE_PERL],[test "x$enable_perl" != "xno" && test "x$PERL" != "xno"])
457 AC_SUBST([PERL_ARCHLIB])
458 AC_SUBST([PERL_CFLAGS])
459 AC_SUBST([PERL_LDOPTS])
461 dnl Check for Python, for embedding in the python plugin.
462 AC_CHECK_PROG([PYTHON],[python],[python],[no])
463 AC_ARG_ENABLE([python],
464 [AS_HELP_STRING([--disable-python], [disable Python embed plugin])],
467 AS_IF([test "x$PYTHON" != "xno" && test "x$enable_python" != "xno"],[
468 AC_MSG_CHECKING([version of $PYTHON])
469 PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info@<:@0@:>@)"`
470 PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info@<:@1@:>@)"`
471 PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR"
472 AS_IF([test -n "$PYTHON_VERSION"],[
473 AC_MSG_RESULT([$PYTHON_VERSION])
475 AC_MSG_NOTICE([Python embed module disabled])
479 dnl Check for Python CFLAGS, libraries.
480 dnl For Python >= 3.8 we have to use python-<VERSION>-embed.pc, see:
481 dnl https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
482 dnl The python.pc is called python-<VERSION>.pc on Debian and
483 dnl later versions of Fedora, and python.pc on older versions
485 PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"-embed], [
486 AC_SUBST([PYTHON_CFLAGS])
487 AC_SUBST([PYTHON_LIBS])
488 AC_SUBST([PYTHON_VERSION])
489 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
491 PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"], [
492 AC_SUBST([PYTHON_CFLAGS])
493 AC_SUBST([PYTHON_LIBS])
494 AC_SUBST([PYTHON_VERSION])
495 AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
497 PKG_CHECK_MODULES([PYTHON], [python], [
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 AC_MSG_WARN([python $PYTHON_VERSION not found])
507 dnl Check for various functions needed by the bindings.
510 PYTHON_BLDLIBRARY=`$PYTHON -c "import distutils.sysconfig; \
511 print (distutils.sysconfig.get_config_var('BLDLIBRARY'))"`
512 AC_CHECK_LIB([c],[PyString_FromString],
513 [AC_DEFINE([HAVE_PYSTRING_FROMSTRING],1,
514 [Found PyString_FromString in libpython.])],
515 [],[$PYTHON_BLDLIBRARY])
516 AC_CHECK_LIB([c],[PyString_AsString],
517 [AC_DEFINE([HAVE_PYSTRING_ASSTRING],1,
518 [Found PyString_AsString in libpython.])],
519 [],[$PYTHON_BLDLIBRARY])
520 AC_CHECK_LIB([c],[PyUnicode_AsUTF8],
521 [AC_DEFINE([HAVE_PYUNICODE_ASUTF8],1,
522 [Found PyUnicode_AsUTF8 in libpython.])],
523 [],[$PYTHON_BLDLIBRARY])
528 AM_CONDITIONAL([HAVE_PYTHON],[test "x$enable_python" != "xno" && test "x$PYTHON" != "xno"])
529 AC_SUBST([PYTHON_CFLAGS])
530 AC_SUBST([PYTHON_LIBS])
531 AC_SUBST([PYTHON_LDFLAGS])
533 dnl For the OCaml plugin, you can set OCAMLOPTFLAGS before running
534 dnl ./configure to specify any extra flags you want to pass to
536 AC_SUBST([OCAMLOPTFLAGS])
538 dnl Check for OCaml, for embedding in the ocaml plugin.
540 AC_ARG_ENABLE([ocaml],
541 [AS_HELP_STRING([--disable-ocaml], [disable OCaml embed plugin])],
544 AS_IF([test "x$OCAMLOPT" != "xno" && test "x$enable_ocaml" != "xno"],[
545 dnl Check OCaml can create a shared library (see README for details).
546 AC_MSG_CHECKING([if $OCAMLOPT can create a shared library])
547 echo 'print_endline "test"' > conftest.ml
548 AS_IF([$OCAMLOPT $OCAMLOPTFLAGS -output-obj -runtime-variant _pic -o conftest.so conftest.ml >&AS_MESSAGE_LOG_FD 2>&1],[
550 ocaml_link_shared=yes
554 rm -f conftest.ml conftest.cmi conftest.cmx conftest.so conftest.o
556 AM_CONDITIONAL([HAVE_OCAML],[test "x$OCAMLOPT" != "xno" &&
557 test "x$ocaml_link_shared" = "xyes"])
559 dnl For developing plugins in Rust, optional.
560 AC_CHECK_PROG([CARGO],[cargo],[cargo],[no])
561 AC_ARG_ENABLE([rust],
562 [AS_HELP_STRING([--disable-rust], [disable Rust plugin])],
565 AM_CONDITIONAL([HAVE_RUST],
566 [test "x$CARGO" != "xno" && test "x$enable_rust" != "xno"])
568 dnl Check for Ruby, for embedding in the Ruby plugin.
569 AC_CHECK_PROG([RUBY],[ruby],[ruby],[no])
570 AC_ARG_ENABLE([ruby],
571 [AS_HELP_STRING([--disable-ruby], [disable Ruby plugin])],
574 AS_IF([test "x$RUBY" != "xno" && test "x$enable_ruby" != "xno"],[
575 PKG_CHECK_MODULES([RUBY], [ruby], [
576 AC_SUBST([RUBY_CFLAGS])
577 AC_SUBST([RUBY_LIBS])
579 AC_MSG_WARN([ruby not found])
583 AM_CONDITIONAL([HAVE_RUBY],[test "x$RUBY" != "xno" &&
584 test "x$enable_ruby" = "xyes"])
586 dnl Check for Tcl, for embedding in the Tcl plugin.
588 [AS_HELP_STRING([--disable-tcl], [disable Tcl plugin])],
591 AS_IF([test "x$enable_tcl" != "xno"],[
592 PKG_CHECK_MODULES([TCL], [tcl], [
593 AC_SUBST([TCL_CFLAGS])
596 AC_MSG_WARN([Tcl not found])
600 AM_CONDITIONAL([HAVE_TCL],[test "x$enable_tcl" = "xyes"])
602 dnl Check for Lua, for embedding in the Lua plugin.
604 [AS_HELP_STRING([--disable-lua], [disable Lua plugin])],
607 AS_IF([test "x$enable_lua" != "xno"],[
608 PKG_CHECK_MODULES([LUA], [lua], [
609 AC_SUBST([LUA_CFLAGS])
612 dnl Lua 5.1 used by RHEL 7 does not have lua_isinteger.
614 LIBS="$LUA_LIBS $LIBS"
615 AC_CHECK_FUNCS([lua_isinteger])
618 AC_MSG_WARN([Lua not found])
622 AM_CONDITIONAL([HAVE_LUA],[test "x$enable_lua" = "xyes"])
624 dnl Check for curl (only if you want to compile the curl plugin).
626 [AS_HELP_STRING([--without-curl],
627 [disable curl plugin @<:@default=check@:>@])],
630 AS_IF([test "$with_curl" != "no"],[
631 PKG_CHECK_MODULES([CURL], [libcurl],[
632 AC_SUBST([CURL_CFLAGS])
633 AC_SUBST([CURL_LIBS])
634 AC_DEFINE([HAVE_CURL],[1],[curl found at compile time.])
635 AC_CHECK_DECL([CURLOPT_UNIX_SOCKET_PATH], [
636 AC_DEFINE([HAVE_CURLOPT_UNIX_SOCKET_PATH],[1],
637 [CURLOPT_UNIX_SOCKET_PATH found at compile time.])
638 ], [], [#include <curl/curl.h>])
640 [AC_MSG_WARN([curl not found, curl plugin will be disabled])])
642 AM_CONDITIONAL([HAVE_CURL],[test "x$CURL_LIBS" != "x"])
644 dnl Check for libssh (only if you want to compile the ssh plugin).
646 [AS_HELP_STRING([--without-ssh],
647 [disable ssh plugin @<:@default=check@:>@])],
650 AS_IF([test "$with_ssh" != "no"],[
651 PKG_CHECK_MODULES([SSH], [libssh >= 0.8.0],[
652 AC_SUBST([SSH_CFLAGS])
655 [AC_MSG_WARN([libssh not found, ssh plugin will be disabled])])
657 AM_CONDITIONAL([HAVE_SSH],[test "x$SSH_LIBS" != "x"])
659 dnl Check for genisoimage or mkisofs
660 dnl (only if you want to compile the iso plugin).
663 [AS_HELP_STRING([--without-iso],
664 [disable iso plugin @<:@default=check@:>@])],
667 AS_IF([test "$with_iso" != "no"],[
668 AC_CHECK_PROG([GENISOIMAGE],[genisoimage],[genisoimage],[no])
669 AC_CHECK_PROG([MKISOFS],[mkisofs],[mkisofs],[no])
670 AS_IF([test "x$GENISOIMAGE" != "xno"],[
671 ISOPROG="$GENISOIMAGE"
673 AS_IF([test "x$MKISOFS" != "xno"],[
677 AS_IF([test "x$ISOPROG" != "xno"],[
678 AC_DEFINE_UNQUOTED([ISOPROG],["$ISOPROG"],
679 [Program used by iso plugin to make ISOs.])
683 AM_CONDITIONAL([HAVE_ISO],[test "x$ISOPROG" != "xno"])
685 dnl Check for libvirt (only if you want to compile the libvirt plugin).
686 AC_ARG_WITH([libvirt],
687 [AS_HELP_STRING([--without-libvirt],
688 [disable libvirt plugin @<:@default=check@:>@])],
690 [with_libvirt=check])
691 AS_IF([test "$with_libvirt" != "no"],[
692 PKG_CHECK_MODULES([LIBVIRT], [libvirt],[
693 AC_SUBST([LIBVIRT_CFLAGS])
694 AC_SUBST([LIBVIRT_LIBS])
695 AC_DEFINE([HAVE_LIBVIRT],[1],[libvirt found at compile time.])
697 [AC_MSG_WARN([libvirt not found, libvirt plugin will be disabled])])
699 AM_CONDITIONAL([HAVE_LIBVIRT],[test "x$LIBVIRT_LIBS" != "x"])
701 dnl Check for zlib (only if you want to compile the gzip plugin).
703 [AS_HELP_STRING([--without-zlib],
704 [disable gzip plugin @<:@default=check@:>@])],
707 AS_IF([test "$with_zlib" != "no"],[
708 PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3.5],[
709 AC_SUBST([ZLIB_CFLAGS])
710 AC_SUBST([ZLIB_LIBS])
711 AC_DEFINE([HAVE_ZLIB],[1],[zlib found at compile time.])
713 [AC_MSG_WARN([zlib >= 1.2.3.5 not found, gzip plugin will be disabled])])
715 AM_CONDITIONAL([HAVE_ZLIB],[test "x$ZLIB_LIBS" != "x"])
717 dnl Check for libnbd (only if you want to compile the full nbd plugin).
718 AC_ARG_WITH([libnbd],
719 [AS_HELP_STRING([--without-libnbd],
720 [disable nbd plugin @<:@default=check@:>@])],
723 AS_IF([test "$with_libnbd" != "no"],[
724 PKG_CHECK_MODULES([LIBNBD], [libnbd >= 0.9.8],[
725 AC_SUBST([LIBNBD_CFLAGS])
726 AC_SUBST([LIBNBD_LIBS])
727 AC_DEFINE([HAVE_LIBNBD],[1],[libnbd found at compile time.])
729 [AC_MSG_WARN([libnbd >= 0.9.8 not found, nbd plugin will be crippled])])
731 AM_CONDITIONAL([HAVE_LIBNBD], [test "x$LIBNBD_LIBS" != "x"])
733 dnl Check for liblzma (only if you want to compile the xz filter).
734 AC_ARG_WITH([liblzma],
735 [AS_HELP_STRING([--without-liblzma],
736 [disable xz filter @<:@default=check@:>@])],
738 [with_liblzma=check])
739 AS_IF([test "$with_liblzma" != "no"],[
740 PKG_CHECK_MODULES([LIBLZMA], [liblzma],[
741 AC_SUBST([LIBLZMA_CFLAGS])
742 AC_SUBST([LIBLZMA_LIBS])
743 AC_DEFINE([HAVE_LIBLZMA],[1],[liblzma found at compile time.])
745 [AC_MSG_WARN([liblzma not found, xz filter will be disabled])])
747 AM_CONDITIONAL([HAVE_LIBLZMA],[test "x$LIBLZMA_LIBS" != "x"])
749 dnl Check for libguestfs (only for the guestfs plugin and the test suite).
750 AC_ARG_WITH([libguestfs],
751 [AS_HELP_STRING([--without-libguestfs],
752 [disable guestfs plugin and tests @<:@default=check@:>@])],
754 [with_libguestfs=check])
755 AS_IF([test "$with_libguestfs" != "no"],[
756 PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs],[
757 # Although the library was found, we want to make sure it supports nbd
758 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
761 #ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL
765 AC_SUBST([LIBGUESTFS_CFLAGS])
766 AC_SUBST([LIBGUESTFS_LIBS])
767 AC_DEFINE([HAVE_LIBGUESTFS],[1],[libguestfs found at compile time.])
770 AC_MSG_WARN([libguestfs too old, guestfs plugin and tests will be disabled])])
772 [AC_MSG_WARN([libguestfs not found, guestfs plugin and tests will be disabled])])
774 AM_CONDITIONAL([HAVE_LIBGUESTFS],[test "x$LIBGUESTFS_LIBS" != "x"])
776 dnl Check for guestfish (only needed for some of the tests).
777 AC_CHECK_PROG([GUESTFISH], [guestfish], [guestfish], [no])
778 AM_CONDITIONAL([HAVE_GUESTFISH], [test "x$GUESTFISH" != "xno"])
780 dnl Check for ext2fs and com_err, for the ext2 plugin.
782 [AS_HELP_STRING([--without-ext2],
783 [disable ext2 plugin @<:@default=check@:>@])],
786 AS_IF([test "$with_ext2" != "no"], [
787 PKG_CHECK_MODULES([EXT2FS], [ext2fs], [
788 AC_SUBST([EXT2FS_CFLAGS])
789 AC_SUBST([EXT2FS_LIBS])
790 AC_DEFINE([HAVE_EXT2FS],[1],[ext2fs found at compile time.])
792 [AC_MSG_WARN([ext2fs not found, ext2 plugin will be disabled])])
793 PKG_CHECK_MODULES([COM_ERR], [com_err], [
794 AC_SUBST([COM_ERR_CFLAGS])
795 AC_SUBST([COM_ERR_LIBS])
796 AC_DEFINE([HAVE_COM_ERR],[1],[com_err found at compile time.])
798 [AC_MSG_WARN([com_err not found, ext2 plugin will be disabled])])
800 AM_CONDITIONAL([HAVE_EXT2],
801 [test "x$EXT2FS_LIBS" != "x" && test "x$COM_ERR_LIBS" != "x"])
803 dnl Check if the user wants to disable VDDK support.
804 dnl See plugins/vddk/README.VDDK.
805 AC_ARG_ENABLE([vddk],
806 [AS_HELP_STRING([--disable-vddk],
807 [disable VMware VDDK plugin])],
810 AM_CONDITIONAL([HAVE_VDDK], [test "x$enable_vddk" = "xyes"])
812 dnl List of plugins and filters.
852 plugins="$(echo $(printf %s\\n $lang_plugins $non_lang_plugins | sort -u))"
875 AC_SUBST([lang_plugins])
876 AC_SUBST([non_lang_plugins])
879 dnl Produce output files.
880 AC_CONFIG_HEADERS([config.h])
881 AC_CONFIG_FILES([podwrapper.pl],
882 [chmod +x,-w podwrapper.pl])
883 AC_CONFIG_FILES([Makefile
885 common/bitmap/Makefile
887 common/include/Makefile
888 common/protocol/Makefile
889 common/regions/Makefile
890 common/sparse/Makefile
891 common/utils/Makefile
895 plugins/curl/Makefile
896 plugins/data/Makefile
897 plugins/example1/Makefile
898 plugins/example2/Makefile
899 plugins/example3/Makefile
900 plugins/example4/Makefile
901 plugins/ext2/Makefile
902 plugins/file/Makefile
903 plugins/floppy/Makefile
904 plugins/full/Makefile
905 plugins/guestfs/Makefile
906 plugins/gzip/Makefile
908 plugins/libvirt/Makefile
909 plugins/linuxdisk/Makefile
911 plugins/memory/Makefile
913 plugins/null/Makefile
914 plugins/ocaml/Makefile
915 plugins/partitioning/Makefile
916 plugins/pattern/Makefile
917 plugins/perl/Makefile
918 plugins/python/Makefile
919 plugins/random/Makefile
920 plugins/ruby/Makefile
921 plugins/rust/Cargo.toml
922 plugins/rust/Makefile
925 plugins/split/Makefile
926 plugins/streaming/Makefile
929 plugins/vddk/Makefile
930 plugins/zero/Makefile
932 filters/blocksize/Makefile
933 filters/cache/Makefile
934 filters/cacheextents/Makefile
936 filters/delay/Makefile
937 filters/error/Makefile
940 filters/nocache/Makefile
941 filters/noextents/Makefile
942 filters/noparallel/Makefile
943 filters/nozero/Makefile
944 filters/offset/Makefile
945 filters/partition/Makefile
946 filters/rate/Makefile
947 filters/readahead/Makefile
948 filters/stats/Makefile
949 filters/truncate/Makefile
963 echo "----------------------------------------------------------------------"
964 echo "Thank you for downloading $PACKAGE_STRING"
966 echo "This is how we have configured the optional components for you today:"
973 if $@; then echo "yes"; else echo "no"; fi
976 echo "Optional server features:"
978 feature "bash-completion ........................ " \
979 test "x$HAVE_BASH_COMPLETION_TRUE" = "x"
980 feature "manual pages ........................... " \
981 test "x$HAVE_POD_TRUE" = "x"
982 feature "SELinux ................................ " \
983 test "x$LIBSELINUX_LIBS" != "x"
984 feature "TLS .................................... " \
985 test "x$GNUTLS_LIBS" != "x"
988 echo "Optional plugins:"
990 feature "curl ................................... " \
991 test "x$HAVE_CURL_TRUE" = "x"
992 feature "example4 ............................... " \
993 test "x$HAVE_PERL_TRUE" = "x"
994 feature "ext2 ................................... " \
995 test "x$HAVE_EXT2_TRUE" = "x"
996 feature "floppy ................................. " \
997 test "x$HAVE_ICONV_TRUE" = "x"
998 feature "guestfs ................................ " \
999 test "x$HAVE_LIBGUESTFS_TRUE" = "x"
1000 feature "gzip ................................... " \
1001 test "x$HAVE_ZLIB_TRUE" = "x"
1002 feature "iso .................................... " \
1003 test "x$HAVE_ISO_TRUE" = "x"
1004 feature "libvirt ................................ " \
1005 test "x$HAVE_LIBVIRT_TRUE" = "x"
1006 feature "nbd .................................... " \
1007 test "x$HAVE_LIBNBD_TRUE" = "x"
1008 feature "ssh .................................... " \
1009 test "x$HAVE_SSH_TRUE" = "x"
1010 feature "tar .................................... " \
1011 test "x$HAVE_PERL_TRUE" = "x"
1012 feature "vddk ................................... " \
1013 test "x$HAVE_VDDK_TRUE" = "x"
1019 feature "lua .................................... " \
1020 test "x$HAVE_LUA_TRUE" = "x"
1021 feature "ocaml .................................. " \
1022 test "x$HAVE_OCAML_TRUE" = "x"
1023 feature "perl ................................... " \
1024 test "x$HAVE_PERL_TRUE" = "x"
1025 feature "python ................................. " \
1026 test "x$HAVE_PYTHON_TRUE" = "x"
1027 feature "ruby ................................... " \
1028 test "x$HAVE_RUBY_TRUE" = "x"
1029 feature "rust ................................... " \
1030 test "x$HAVE_RUST_TRUE" = "x"
1031 feature "tcl .................................... " \
1032 test "x$HAVE_TCL_TRUE" = "x"
1036 echo "Optional filters:"
1038 feature "xz ..................................... " \
1039 test "x$HAVE_LIBLZMA_TRUE" = "x"
1042 echo "If any optional component is configured ‘no’ when you expected ‘yes’"
1043 echo "then you should check the preceding messages and README."
1045 echo "Please report bugs back to the mailing list:"
1046 echo "http://www.redhat.com/mailman/listinfo/libguestfs"
1048 echo "Next you should type 'make' to build the package,"
1049 echo "then 'make check' to run the tests."