The extra files don't have to be added to EXTRA_DIST, as it appears
that autotools already knows that it has to add them.
---
configure.ac | 560 ++------------------------------------------------
m4/guestfs_erlang.m4 | 35 ++++
m4/guestfs_gobject.m4 | 68 ++++++
m4/guestfs_golang.m4 | 44 ++++
m4/guestfs_haskell.m4 | 28 +++
m4/guestfs_java.m4 | 174 ++++++++++++++++
m4/guestfs_lua.m4 | 47 +++++
m4/guestfs_ocaml.m4 | 104 ++++++++++
m4/guestfs_perl.m4 | 41 ++++
m4/guestfs_php.m4 | 29 +++
m4/guestfs_python.m4 | 104 ++++++++++
m4/guestfs_ruby.m4 | 51 +++++
12 files changed, 737 insertions(+), 548 deletions(-)
create mode 100644 m4/guestfs_erlang.m4
create mode 100644 m4/guestfs_gobject.m4
create mode 100644 m4/guestfs_golang.m4
create mode 100644 m4/guestfs_haskell.m4
create mode 100644 m4/guestfs_java.m4
create mode 100644 m4/guestfs_lua.m4
create mode 100644 m4/guestfs_ocaml.m4
create mode 100644 m4/guestfs_perl.m4
create mode 100644 m4/guestfs_php.m4
create mode 100644 m4/guestfs_python.m4
create mode 100644 m4/guestfs_ruby.m4
diff --git a/configure.ac b/configure.ac
index 637f2f1..5a3ba96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1081,502 +1081,18 @@ AS_IF([test "x$VALGRIND" != "xno"],[
AC_SUBST([VG])
AM_SUBST_NOTMAKE([VG])
-dnl Check for OCaml (optional, for OCaml bindings and OCaml tools).
-OCAMLC=no
-OCAMLFIND=no
-AC_ARG_ENABLE([ocaml],
- AS_HELP_STRING([--disable-ocaml], [disable OCaml language bindings]),
- [],
- [enable_ocaml=yes])
-AS_IF([test "x$enable_ocaml" != "xno"],[
- dnl OCAMLC and OCAMLFIND have to be unset first, otherwise
- dnl AC_CHECK_TOOL (inside AC_PROG_OCAML) will not look.
- OCAMLC=
- OCAMLFIND=
- AC_PROG_OCAML
- AC_PROG_FINDLIB
-
- dnl OCaml >= 3.11 is required.
- AC_MSG_CHECKING([if OCaml version >= 3.11])
- ocaml_major="`echo $OCAMLVERSION | $AWK -F. '{print $1}'`"
- ocaml_minor="`echo $OCAMLVERSION | $AWK -F. '{print $2}'`"
- AS_IF([test "$ocaml_major" -ge 4 || ( test "$ocaml_major" -eq 3
&& test "$ocaml_minor" -ge 11 )],[
- AC_MSG_RESULT([yes])
- ],[
- AC_MSG_RESULT([no])
- AC_MSG_FAILURE([OCaml compiler is not new enough. At least OCaml 3.11 is
required])
- ])
-])
-AM_CONDITIONAL([HAVE_OCAML],
- [test "x$OCAMLC" != "xno" && test
"x$OCAMLFIND" != "xno"])
-AM_CONDITIONAL([HAVE_OCAMLOPT],
- [test "x$OCAMLOPT" != "xno" && test
"x$OCAMLFIND" != "xno"])
-AM_CONDITIONAL([HAVE_OCAMLDOC],
- [test "x$OCAMLDOC" != "xno"])
-
-dnl OCaml is required if we need to run the generator.
-AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" =
"xno"],[
- AS_IF([! test -f $srcdir/src/guestfs_protocol.x],[
- AC_MSG_FAILURE([OCaml compiler and findlib is required to build from git.
-If you don't have OCaml available, you should build from a tarball from
-http://libguestfs.org/download])
- ])
-])
-
-AS_IF([test "x$OCAMLC" != "xno"],[
- dnl Check for <caml/unixsupport.h> header.
- old_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS -I`$OCAMLC -where`"
- AC_CHECK_HEADERS([caml/unixsupport.h],[],[],[#include <caml/mlvalues.h>])
- CPPFLAGS="$old_CPPFLAGS"
-])
-
-OCAML_PKG_gettext=no
-OCAML_PKG_libvirt=no
-OCAML_PKG_oUnit=no
-ounit_is_v2=no
-AS_IF([test "x$OCAMLC" != "xno"],[
- # Create mllib/common_gettext.ml, gettext functions or stubs.
-
- # If we're building in a different directory, then mllib/ might
- # not exist yet, so create it:
- mkdir -p mllib
-
- GUESTFS_CREATE_COMMON_GETTEXT_ML([mllib/common_gettext.ml])
-
- AC_CHECK_OCAML_PKG(libvirt)
- AC_CHECK_OCAML_PKG(oUnit)
-
- # oUnit >= 2 is required, so check that it has OUnit2.
- if test "x$OCAML_PKG_oUnit" != "xno"; then
- AC_CHECK_OCAML_MODULE(ounit_is_v2,[OUnit.OUnit2],OUnit2,[+oUnit])
- fi
-])
-AM_CONDITIONAL([HAVE_OCAML_PKG_GETTEXT],
- [test "x$OCAMLC" != "xno" && test "x$OCAMLFIND"
!= "xno" && test "x$OCAML_PKG_gettext" != "xno"])
-AM_CONDITIONAL([HAVE_OCAML_PKG_LIBVIRT],
- [test "x$OCAMLC" != "xno" && test "x$OCAMLFIND"
!= "xno" && test "x$OCAML_PKG_libvirt" != "xno"])
-AM_CONDITIONAL([HAVE_OCAML_PKG_OUNIT],
- [test "x$OCAMLC" != "xno" && test "x$OCAMLFIND"
!= "xno" && test "x$OCAML_PKG_oUnit" != "xno"
&& test "x$ounit_is_v2" != "xno"])
-
-AC_CHECK_PROG([OCAML_GETTEXT],[ocaml-gettext],[ocaml-gettext],[no])
-AM_CONDITIONAL([HAVE_OCAML_GETTEXT],
- [test "x$OCAMLC" != "xno" && test "x$OCAMLFIND"
!= "xno" && test "x$OCAML_PKG_gettext" != "xno"
&& test "x$OCAML_GETTEXT" != "xno"])
-
-dnl Flags we want to pass to every OCaml compiler call.
-OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX-3"
-AC_SUBST([OCAML_WARN_ERROR])
-OCAML_FLAGS="-g -annot"
-AC_SUBST([OCAML_FLAGS])
-
-dnl Check for Perl (optional, for Perl bindings and Perl tools).
-AC_ARG_ENABLE([perl],
- AS_HELP_STRING([--disable-perl], [disable Perl language bindings]),
- [],
- [enable_perl=yes])
-AS_IF([test "x$enable_perl" != "xno"],[
- dnl Check for Perl modules that must be present to compile and
- dnl test the Perl bindings.
- missing_perl_modules=no
- for pm in Test::More Module::Build; do
- AC_MSG_CHECKING([for $pm])
- if ! $PERL -M$pm -e1 >&AS_MESSAGE_LOG_FD 2>&1; then
- AC_MSG_RESULT([no])
- missing_perl_modules=yes
- else
- AC_MSG_RESULT([yes])
- fi
- done
- if test "x$missing_perl_modules" = "xyes"; then
- AC_MSG_WARN([some Perl modules required to compile or test the Perl bindings are
missing])
- fi
-])
-AM_CONDITIONAL([HAVE_PERL],
- [test "x$enable_perl" != "xno" && test "x$PERL"
!= "xno" && test "x$missing_perl_modules" !=
"xyes"])
-
-dnl Check for Python (optional, for Python bindings).
-PYTHON_PREFIX=
-PYTHON_VERSION=
-PYTHON_INSTALLDIR=
-
-AC_ARG_ENABLE([python],
- AS_HELP_STRING([--disable-python], [disable Python language bindings]),
- [],
- [enable_python=yes])
-AS_IF([test "x$enable_python" != "xno"],[
- AC_CHECK_PROG([PYTHON],[python],[python],[no])
-
- if test "x$PYTHON" != "xno"; then
- AC_MSG_CHECKING([Python version])
- PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print
(sys.version_info@<:@0@:>@)"`
- PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print
(sys.version_info@<:@1@:>@)"`
- PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR"
- AC_MSG_RESULT([$PYTHON_VERSION])
- # Debian: python-2.7.pc, python-3.2.pc
- PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"],[
- AC_SUBST([PYTHON_CFLAGS])
- AC_SUBST([PYTHON_LIBS])
- AC_SUBST([PYTHON_VERSION])
- AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
- ],[
- PKG_CHECK_MODULES([PYTHON], [python],[
- AC_SUBST([PYTHON_CFLAGS])
- AC_SUBST([PYTHON_LIBS])
- AC_SUBST([PYTHON_VERSION])
- AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
- ],[
- AC_MSG_WARN([python $PYTHON_VERSION not found])
- ])
- ])
- AC_MSG_CHECKING([Python prefix])
- PYTHON_PREFIX=`$PYTHON -c "import sys; print (sys.prefix)"`
- AC_MSG_RESULT([$PYTHON_PREFIX])
-
- AC_ARG_WITH([python-installdir],
- [AS_HELP_STRING([--with-python-installdir],
- [directory to install python modules @<:@default=check@:>@])],
- [PYTHON_INSTALLDIR="$withval"
- AC_MSG_NOTICE([Python install dir $PYTHON_INSTALLDIR])],
- [PYTHON_INSTALLDIR=check])
-
- if test "x$PYTHON_INSTALLDIR" = "xcheck"; then
- PYTHON_INSTALLDIR=
- AC_MSG_CHECKING([for Python site-packages path])
- if test -z "$PYTHON_INSTALLDIR"; then
- PYTHON_INSTALLDIR=`$PYTHON -c "import distutils.sysconfig; \
- print
(distutils.sysconfig.get_python_lib(1,0));"`
- fi
- AC_MSG_RESULT([$PYTHON_INSTALLDIR])
- fi
-
- AC_MSG_CHECKING([for Python extension suffix (PEP-3149)])
- if test -z "$PYTHON_EXT_SUFFIX"; then
- python_ext_suffix=`$PYTHON -c "import distutils.sysconfig; \
- print
(distutils.sysconfig.get_config_var('EXT_SUFFIX') or
distutils.sysconfig.get_config_var('SO'))"`
- PYTHON_EXT_SUFFIX=$python_ext_suffix
- fi
- AC_MSG_RESULT([$PYTHON_EXT_SUFFIX])
-
- dnl Look for some optional symbols in libpython.
- old_LIBS="$LIBS"
-
- PYTHON_BLDLIBRARY=`$PYTHON -c "import distutils.sysconfig; \
- print
(distutils.sysconfig.get_config_var('BLDLIBRARY'))"`
- AC_CHECK_LIB([c],[PyCapsule_New],
- [AC_DEFINE([HAVE_PYCAPSULE_NEW],1,
- [Found PyCapsule_New in libpython.])],
- [],[$PYTHON_BLDLIBRARY])
- AC_CHECK_LIB([c],[PyString_AsString],
- [AC_DEFINE([HAVE_PYSTRING_ASSTRING],1,
- [Found PyString_AsString in libpython.])],
- [],[$PYTHON_BLDLIBRARY])
-
- LIBS="$old_LIBS"
- fi
-
- AC_SUBST(PYTHON_PREFIX)
- AC_SUBST(PYTHON_VERSION)
- AC_SUBST(PYTHON_INSTALLDIR)
- AC_SUBST(PYTHON_EXT_SUFFIX)
-])
-AM_CONDITIONAL([HAVE_PYTHON],
- [test "x$PYTHON" != "xno" && test
"x$PYTHON_LIBS" != "x" ])
-
-dnl Check for Ruby and rake (optional, for Ruby bindings).
-AC_ARG_ENABLE([ruby],
- AS_HELP_STRING([--disable-ruby], [disable Ruby language bindings]),
- [],
- [enable_ruby=yes])
-AS_IF([test "x$enable_ruby" != "xno"],[
- AC_CHECK_PROG([RUBY],[ruby],[ruby],[no])
- AC_CHECK_PROG([RAKE],[rake],[rake],[no])
-
- AS_IF([test -n "$RUBY" && test -n "$RAKE"],[
- dnl Find the library. Note on Debian it's not -lruby.
- AC_MSG_CHECKING([for C library for Ruby extensions])
- ruby_cmd='puts RbConfig::CONFIG@<:@"RUBY_SO_NAME"@:>@'
- echo running: $RUBY -rrbconfig -e \'$ruby_cmd\'
>&AS_MESSAGE_LOG_FD
- $RUBY -rrbconfig -e "$ruby_cmd" >conftest
2>&AS_MESSAGE_LOG_FD
- libruby="$(cat conftest)"
- rm conftest
- AS_IF([test -n "$libruby"],[
- ruby_cmd='puts RbConfig::CONFIG@<:@"libdir"@:>@'
- echo running: $RUBY -rrbconfig -e \'$ruby_cmd\'
>&AS_MESSAGE_LOG_FD
- $RUBY -rrbconfig -e "$ruby_cmd" >conftest
2>&AS_MESSAGE_LOG_FD
- libruby_libdir="$(cat conftest)"
- rm conftest
- test -n "$libruby_libdir" &&
libruby_libdir="-L$libruby_libdir"
- AC_MSG_RESULT([-l$libruby])
- AC_CHECK_LIB([$libruby],[ruby_init],
- [have_libruby=1],[have_libruby=],[$libruby_libdir])
- ],[
- AC_MSG_RESULT([not found])
- ])
- ])
-])
-AM_CONDITIONAL([HAVE_RUBY],
- [test -n "$RUBY" && test -n "$RAKE" && test -n
"$have_libruby"])
-
-dnl Check for Java.
-AC_ARG_WITH(java,
- [AS_HELP_STRING([--with-java],
- [specify path to JDK directory (for the Java language bindings)
@<:@default=check@:>@])],
- [],
- [with_java=check])
-
-if test "x$with_java" != "xno"; then
- if test "x$with_java" != "xyes" && test
"x$with_java" != "xcheck"
- then
- # Reject unsafe characters in $JAVA
- jh_lf='
-'
- case $JAVA in
- *[\\\"\#\$\&\'\`$jh_lf\ \ ]*)
- AC_MSG_FAILURE([unsafe \$JAVA directory (use --without-java to disable Java
support)]);;
- esac
- if test -d "$with_java"; then
- JAVA="$with_java"
- else
- AC_MSG_FAILURE([$with_java is not a directory (use --without-java to disable
Java support)])
- fi
- fi
-
- if test "x$JAVA" = "x"; then
- # Look for Java in some likely locations.
- for d in \
- /usr/lib/jvm/java \
- /usr/lib64/jvm/java \
- /usr/lib/jvm/default-java \
- /usr/lib/jvm/default \
- /usr/lib/jvm/java-8-openjdk \
- /usr/lib/jvm/java-7-openjdk \
- /usr/lib/jvm/java-6-openjdk
- do
- if test -d $d && test -f $d/bin/java; then
- JAVA=$d
- break
- fi
- done
- fi
-
- if test "x$JAVA" != "x"; then
- AC_MSG_CHECKING(for JDK in $JAVA)
- if test ! -x "$JAVA/bin/java"; then
- AC_MSG_ERROR([missing $JAVA/bin/java binary (use --without-java to disable
Java support)])
- else
- JAVA_EXE="$JAVA/bin/java"
- fi
- if test ! -x "$JAVA/bin/javac"; then
- AC_MSG_ERROR([missing $JAVA/bin/javac binary])
- else
- JAVAC="$JAVA/bin/javac"
- fi
- if test ! -x "$JAVA/bin/javah"; then
- AC_MSG_ERROR([missing $JAVA/bin/javah binary])
- else
- JAVAH="$JAVA/bin/javah"
- fi
- if test ! -x "$JAVA/bin/javadoc"; then
- AC_MSG_ERROR([missing $JAVA/bin/javadoc binary])
- else
- JAVADOC="$JAVA/bin/javadoc"
- fi
- if test ! -x "$JAVA/bin/jar"; then
- AC_MSG_ERROR([missing $JAVA/bin/jar binary])
- else
- JAR="$JAVA/bin/jar"
- fi
- java_version=`$JAVA_EXE -version 2>&1 | grep "java version"`
- AC_MSG_RESULT(found $java_version in $JAVA)
-
- dnl Find jni.h.
- AC_MSG_CHECKING([for jni.h])
- if test -f "$JAVA/include/jni.h"; then
- JNI_CFLAGS="-I$JAVA/include"
- else
- if test "`find $JAVA -name jni.h`" != ""; then
- head=`find $JAVA -name jni.h | tail -1`
- dir=`dirname "$head"`
- JNI_CFLAGS="-I$dir"
- else
- AC_MSG_FAILURE([missing jni.h header file])
- fi
- fi
- AC_MSG_RESULT([$JNI_CFLAGS])
-
- dnl Find jni_md.h.
- AC_MSG_CHECKING([for jni_md.h])
- case "$build_os" in
- *linux*) system="linux" ;;
- *SunOS*) system="solaris" ;;
- *cygwin*) system="win32" ;;
- *) system="$build_os" ;;
- esac
- if test -f "$JAVA/include/$system/jni_md.h"; then
- JNI_CFLAGS="$JNI_CFLAGS -I$JAVA/include/$system"
- else
- if test "`find $JAVA -name jni_md.h`" != ""; then
- head=`find $JAVA -name jni_md.h | tail -1`
- dir=`dirname "$head"`
- JNI_CFLAGS="$JNI_CFLAGS -I$dir"
- else
- AC_MSG_FAILURE([missing jni_md.h header file])
- fi
- fi
- AC_MSG_RESULT([$JNI_CFLAGS])
-
- dnl Need extra version flag?
- AC_MSG_CHECKING([extra javac flags])
- EXTRA_JAVAC_FLAGS=
- javac_version=`$JAVAC -version 2>&1`
- case "$javac_version" in
- *Eclipse*)
- EXTRA_JAVAC_FLAGS="-source 1.5" ;;
- esac
- AC_MSG_RESULT([$EXTRA_JAVAC_FLAGS])
-
- dnl Extra lint flags?
- AC_MSG_CHECKING([extra javac lint flags])
- if $JAVAC -X >/dev/null 2>&1 && \
- $JAVAC -X 2>&1 | grep -q -- '-Xlint:.*all'; then
- AC_MSG_RESULT([-Xlint:all])
- EXTRA_JAVAC_FLAGS="$EXTRA_JAVAC_FLAGS -Xlint:all"
- else
- AC_MSG_RESULT([no])
- fi
-
- dnl Where to install jarfiles, jnifiles
- if test -z $JAR_INSTALL_DIR; then
- JAR_INSTALL_DIR=\${prefix}/share/java
- fi
- if test -z $JNI_INSTALL_DIR; then
- JNI_INSTALL_DIR=\${libdir}
- fi
-
- dnl JNI version.
- jni_major_version=`echo "$VERSION" | $AWK -F. '{print $1}'`
- jni_minor_version=`echo "$VERSION" | $AWK -F. '{print $2}'`
- jni_micro_version=`echo "$VERSION" | $AWK -F. '{print $3}'`
- JNI_VERSION_INFO=`expr "$jni_major_version" +
"$jni_minor_version"`":$jni_micro_version:$jni_minor_version"
- fi
-
- AC_SUBST(JAVA)
- AC_SUBST(JAVA_EXE)
- AC_SUBST(JAVAC)
- AC_SUBST(JAVAH)
- AC_SUBST(JAVADOC)
- AC_SUBST(JAR)
- AC_SUBST(JNI_CFLAGS)
- AC_SUBST(EXTRA_JAVAC_FLAGS)
- AC_SUBST(JAR_INSTALL_DIR)
- AC_SUBST(JNI_INSTALL_DIR)
- AC_SUBST(JNI_VERSION_INFO)
-fi
-
-AM_CONDITIONAL([HAVE_JAVA],[test "x$with_java" != "xno" &&
test -n "$JAVAC"])
-
-dnl Check for Haskell (GHC).
-GHC=no
-AC_ARG_ENABLE([haskell],
- AS_HELP_STRING([--disable-haskell], [disable Haskell language bindings]),
- [],
- [enable_haskell=yes])
-AS_IF([test "x$enable_haskell" != "xno"],[
- GHC=
- AC_CHECK_PROG([GHC],[ghc],[ghc],[no])
-])
-AM_CONDITIONAL([HAVE_HASKELL],[test "x$GHC" != "xno"])
-
-dnl PHP
-PHP=no
-AC_ARG_ENABLE([php],
- AS_HELP_STRING([--disable-php], [disable PHP language bindings]),
- [],
- [enable_php=yes])
-AS_IF([test "x$enable_php" != "xno"],[
- PHP=
- AC_CHECK_PROG([PHP],[php],[php],[no])
- AC_CHECK_PROG([PHPIZE],[phpize],[phpize],[no])
-])
-AM_CONDITIONAL([HAVE_PHP], [test "x$PHP" != "xno" && test
"x$PHPIZE" != "xno"])
-
-dnl Erlang
-ERLANG=no
-AC_ARG_ENABLE([erlang],
- AS_HELP_STRING([--disable-erlang], [disable Erlang language bindings]),
- [],
- [enable_erlang=yes])
-# NB: Don't use AS_IF here: it doesn't work.
-if test "x$enable_erlang" != "xno"; then
- ERLANG=
- AC_ERLANG_PATH_ERLC([no])
-
- if test "x$ERLC" != "xno"; then
- AC_ERLANG_CHECK_LIB([erl_interface], [],
- [AC_MSG_FAILURE([Erlang erl_interface library not
installed. Use --disable-erlang to disable.])])
- AC_ERLANG_SUBST_LIB_DIR
- fi
-fi
-AM_CONDITIONAL([HAVE_ERLANG], [test "x$ERLANG" != "xno" &&
test "x$ERLC" != "xno"])
-
-dnl Lua
-AC_ARG_ENABLE([lua],
- AS_HELP_STRING([--disable-lua], [disable Lua language bindings]),
- [],
- [enable_lua=yes])
-AS_IF([test "x$enable_lua" != "xno"],[
- AC_CHECK_PROG([LUA],[lua],[lua],[no])
- AS_IF([test "x$LUA" != "xno"],[
- AC_MSG_CHECKING([for Lua version])
- LUA_VERSION=`$LUA -e 'print(_VERSION)' | $AWK '{print $2}'`
- AC_MSG_RESULT([$LUA_VERSION])
- dnl On Debian it's 'lua5.1', 'lua5.2' etc. On Fedora, just
'lua'.
- PKG_CHECK_MODULES([LUA], [lua$LUA_VERSION],[
- AC_SUBST([LUA_CFLAGS])
- AC_SUBST([LUA_LIBS])
- AC_SUBST([LUA_VERSION])
- AC_DEFINE([HAVE_LUA],[1],[Lua library found at compile time])
- ],[
- PKG_CHECK_MODULES([LUA], [lua],[
- AC_SUBST([LUA_CFLAGS])
- AC_SUBST([LUA_LIBS])
- AC_SUBST([LUA_VERSION])
- AC_DEFINE([HAVE_LUA],[1],[Lua library found at compile time])
- ],[
- AC_MSG_WARN([lua $LUA_VERSION not found])
- ])
- ])
- ])
-])
-AM_CONDITIONAL([HAVE_LUA],[test "x$LUA_LIBS" != "x"])
-
-dnl Golang
-AC_ARG_ENABLE([golang],
- AS_HELP_STRING([--disable-golang], [disable Go language bindings]),
- [],
- [enable_golang=yes])
-AS_IF([test "x$enable_golang" != "xno"],[
- AC_CHECK_PROG([GOLANG],[go],[go],[no])
- AS_IF([test "x$GOLANG" != "xno"],[
- AC_MSG_CHECKING([if $GOLANG is usable])
- AS_IF([$GOLANG run $srcdir/golang/config-test.go 2>&AS_MESSAGE_LOG_FD],[
- AC_MSG_RESULT([yes])
-
- # Substitute some golang environment.
- GOOS=`$GOLANG env GOOS`
- GOARCH=`$GOLANG env GOARCH`
- GOROOT=`$GOLANG env GOROOT`
- AC_SUBST([GOOS])
- AC_SUBST([GOARCH])
- AC_SUBST([GOROOT])
- ],[
- AC_MSG_RESULT([no])
- AC_MSG_WARN([golang ($GOLANG) is installed but not usable])
- GOLANG=no
- ])
- ])
-],[GOLANG=no])
-AM_CONDITIONAL([HAVE_GOLANG],[test "x$GOLANG" != "xno"])
+dnl Check for language bindings.
+m4_include([m4/guestfs_ocaml.m4])
+m4_include([m4/guestfs_perl.m4])
+m4_include([m4/guestfs_python.m4])
+m4_include([m4/guestfs_ruby.m4])
+m4_include([m4/guestfs_java.m4])
+m4_include([m4/guestfs_haskell.m4])
+m4_include([m4/guestfs_php.m4])
+m4_include([m4/guestfs_erlang.m4])
+m4_include([m4/guestfs_lua.m4])
+m4_include([m4/guestfs_golang.m4])
+m4_include([m4/guestfs_gobject.m4])
dnl Check for Perl modules needed by Perl virt tools (virt-df, etc.)
AS_IF([test "x$PERL" != "xno"],[
@@ -1598,58 +1114,6 @@ AS_IF([test "x$PERL" != "xno"],[
AM_CONDITIONAL([HAVE_TOOLS],
[test "x$PERL" != "xno" && test
"x$missing_perl_modules" != "xyes"])
-dnl gobject library
-AC_ARG_ENABLE([gobject],
- AS_HELP_STRING([--disable-gobject], [disable GObject bindings]),
- [],
- [enable_gobject=yes])
-AS_IF([test "x$enable_gobject" != "xno"],[
- PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.26.0],[
- AC_SUBST([GOBJECT_CFLAGS])
- AC_SUBST([GOBJECT_LIBS])
- AC_DEFINE([HAVE_GOBJECT],[1],
- [GObject library found at compile time.])
- ],
- [AC_MSG_WARN([gobject library not found, gobject binding will be disabled])])
-
- PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26.0],[
- AC_SUBST([GIO_CFLAGS])
- AC_SUBST([GIO_LIBS])
- AC_DEFINE([HAVE_GIO],[1],
- [gio library found at compile time.])
- ],
- [AC_MSG_WARN([gio library not found, gobject binding will be disabled])])
-])
-AM_CONDITIONAL([HAVE_GOBJECT],
- [test "x$GOBJECT_LIBS" != "x" -a
"x$GIO_LIBS" != "x"])
-
-AC_CHECK_PROG([GJS],[gjs],[gjs])
-AS_IF([test "x$GJS" = "x"],
- [AC_MSG_WARN([gjs not found, gobject bindtests will not run])])
-
-dnl gobject introspection
-m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
- GOBJECT_INTROSPECTION_CHECK([1.30.0])
-
- dnl The above check automatically sets HAVE_INTROSPECTION, but we
- dnl want this to be conditional on gobject also being
- dnl available. We can't move the above check inside the gobject if
- dnl block above or HAVE_INTROSPECTION ends up undefined, so we
- dnl recheck it here.
- AM_CONDITIONAL([HAVE_INTROSPECTION],
- [test "x$HAVE_INTROSPECTION_TRUE" = "x"
&&
- test "x$HAVE_GOBJECT_TRUE" = "x"])
-],[
- AM_CONDITIONAL([HAVE_INTROSPECTION], [false])
-])
-
-# check for gtk-doc
-m4_ifdef([GTK_DOC_CHECK], [
- GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
-],[
- AM_CONDITIONAL([ENABLE_GTK_DOC], false)
-])
-
dnl Bash completion.
PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [
bash_completion=yes
diff --git a/m4/guestfs_erlang.m4 b/m4/guestfs_erlang.m4
new file mode 100644
index 0000000..018f391
--- /dev/null
+++ b/m4/guestfs_erlang.m4
@@ -0,0 +1,35 @@
+# libguestfs
+# Copyright (C) 2009-2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl Erlang
+ERLANG=no
+AC_ARG_ENABLE([erlang],
+ AS_HELP_STRING([--disable-erlang], [disable Erlang language bindings]),
+ [],
+ [enable_erlang=yes])
+# NB: Don't use AS_IF here: it doesn't work.
+if test "x$enable_erlang" != "xno"; then
+ ERLANG=
+ AC_ERLANG_PATH_ERLC([no])
+
+ if test "x$ERLC" != "xno"; then
+ AC_ERLANG_CHECK_LIB([erl_interface], [],
+ [AC_MSG_FAILURE([Erlang erl_interface library not
installed. Use --disable-erlang to disable.])])
+ AC_ERLANG_SUBST_LIB_DIR
+ fi
+fi
+AM_CONDITIONAL([HAVE_ERLANG], [test "x$ERLANG" != "xno" &&
test "x$ERLC" != "xno"])
diff --git a/m4/guestfs_gobject.m4 b/m4/guestfs_gobject.m4
new file mode 100644
index 0000000..a845b8d
--- /dev/null
+++ b/m4/guestfs_gobject.m4
@@ -0,0 +1,68 @@
+# libguestfs
+# Copyright (C) 2009-2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl gobject library
+AC_ARG_ENABLE([gobject],
+ AS_HELP_STRING([--disable-gobject], [disable GObject bindings]),
+ [],
+ [enable_gobject=yes])
+AS_IF([test "x$enable_gobject" != "xno"],[
+ PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.26.0],[
+ AC_SUBST([GOBJECT_CFLAGS])
+ AC_SUBST([GOBJECT_LIBS])
+ AC_DEFINE([HAVE_GOBJECT],[1],
+ [GObject library found at compile time.])
+ ],
+ [AC_MSG_WARN([gobject library not found, gobject binding will be disabled])])
+
+ PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26.0],[
+ AC_SUBST([GIO_CFLAGS])
+ AC_SUBST([GIO_LIBS])
+ AC_DEFINE([HAVE_GIO],[1],
+ [gio library found at compile time.])
+ ],
+ [AC_MSG_WARN([gio library not found, gobject binding will be disabled])])
+])
+AM_CONDITIONAL([HAVE_GOBJECT],
+ [test "x$GOBJECT_LIBS" != "x" -a
"x$GIO_LIBS" != "x"])
+
+AC_CHECK_PROG([GJS],[gjs],[gjs])
+AS_IF([test "x$GJS" = "x"],
+ [AC_MSG_WARN([gjs not found, gobject bindtests will not run])])
+
+dnl gobject introspection
+m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
+ GOBJECT_INTROSPECTION_CHECK([1.30.0])
+
+ dnl The above check automatically sets HAVE_INTROSPECTION, but we
+ dnl want this to be conditional on gobject also being
+ dnl available. We can't move the above check inside the gobject if
+ dnl block above or HAVE_INTROSPECTION ends up undefined, so we
+ dnl recheck it here.
+ AM_CONDITIONAL([HAVE_INTROSPECTION],
+ [test "x$HAVE_INTROSPECTION_TRUE" = "x"
&&
+ test "x$HAVE_GOBJECT_TRUE" = "x"])
+],[
+ AM_CONDITIONAL([HAVE_INTROSPECTION], [false])
+])
+
+# check for gtk-doc
+m4_ifdef([GTK_DOC_CHECK], [
+ GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
+],[
+ AM_CONDITIONAL([ENABLE_GTK_DOC], false)
+])
diff --git a/m4/guestfs_golang.m4 b/m4/guestfs_golang.m4
new file mode 100644
index 0000000..961d982
--- /dev/null
+++ b/m4/guestfs_golang.m4
@@ -0,0 +1,44 @@
+# libguestfs
+# Copyright (C) 2009-2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl Golang
+AC_ARG_ENABLE([golang],
+ AS_HELP_STRING([--disable-golang], [disable Go language bindings]),
+ [],
+ [enable_golang=yes])
+AS_IF([test "x$enable_golang" != "xno"],[
+ AC_CHECK_PROG([GOLANG],[go],[go],[no])
+ AS_IF([test "x$GOLANG" != "xno"],[
+ AC_MSG_CHECKING([if $GOLANG is usable])
+ AS_IF([$GOLANG run $srcdir/golang/config-test.go 2>&AS_MESSAGE_LOG_FD],[
+ AC_MSG_RESULT([yes])
+
+ # Substitute some golang environment.
+ GOOS=`$GOLANG env GOOS`
+ GOARCH=`$GOLANG env GOARCH`
+ GOROOT=`$GOLANG env GOROOT`
+ AC_SUBST([GOOS])
+ AC_SUBST([GOARCH])
+ AC_SUBST([GOROOT])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([golang ($GOLANG) is installed but not usable])
+ GOLANG=no
+ ])
+ ])
+],[GOLANG=no])
+AM_CONDITIONAL([HAVE_GOLANG],[test "x$GOLANG" != "xno"])
diff --git a/m4/guestfs_haskell.m4 b/m4/guestfs_haskell.m4
new file mode 100644
index 0000000..8f62c10
--- /dev/null
+++ b/m4/guestfs_haskell.m4
@@ -0,0 +1,28 @@
+# libguestfs
+# Copyright (C) 2009-2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl Check for Haskell (GHC).
+GHC=no
+AC_ARG_ENABLE([haskell],
+ AS_HELP_STRING([--disable-haskell], [disable Haskell language bindings]),
+ [],
+ [enable_haskell=yes])
+AS_IF([test "x$enable_haskell" != "xno"],[
+ GHC=
+ AC_CHECK_PROG([GHC],[ghc],[ghc],[no])
+])
+AM_CONDITIONAL([HAVE_HASKELL],[test "x$GHC" != "xno"])
diff --git a/m4/guestfs_java.m4 b/m4/guestfs_java.m4
new file mode 100644
index 0000000..ac7159a
--- /dev/null
+++ b/m4/guestfs_java.m4
@@ -0,0 +1,174 @@
+# libguestfs
+# Copyright (C) 2009-2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl Check for Java.
+AC_ARG_WITH(java,
+ [AS_HELP_STRING([--with-java],
+ [specify path to JDK directory (for the Java language bindings)
@<:@default=check@:>@])],
+ [],
+ [with_java=check])
+
+if test "x$with_java" != "xno"; then
+ if test "x$with_java" != "xyes" && test
"x$with_java" != "xcheck"
+ then
+ # Reject unsafe characters in $JAVA
+ jh_lf='
+'
+ case $JAVA in
+ *[\\\"\#\$\&\'\`$jh_lf\ \ ]*)
+ AC_MSG_FAILURE([unsafe \$JAVA directory (use --without-java to disable Java
support)]);;
+ esac
+ if test -d "$with_java"; then
+ JAVA="$with_java"
+ else
+ AC_MSG_FAILURE([$with_java is not a directory (use --without-java to disable
Java support)])
+ fi
+ fi
+
+ if test "x$JAVA" = "x"; then
+ # Look for Java in some likely locations.
+ for d in \
+ /usr/lib/jvm/java \
+ /usr/lib64/jvm/java \
+ /usr/lib/jvm/default-java \
+ /usr/lib/jvm/default \
+ /usr/lib/jvm/java-8-openjdk \
+ /usr/lib/jvm/java-7-openjdk \
+ /usr/lib/jvm/java-6-openjdk
+ do
+ if test -d $d && test -f $d/bin/java; then
+ JAVA=$d
+ break
+ fi
+ done
+ fi
+
+ if test "x$JAVA" != "x"; then
+ AC_MSG_CHECKING(for JDK in $JAVA)
+ if test ! -x "$JAVA/bin/java"; then
+ AC_MSG_ERROR([missing $JAVA/bin/java binary (use --without-java to disable
Java support)])
+ else
+ JAVA_EXE="$JAVA/bin/java"
+ fi
+ if test ! -x "$JAVA/bin/javac"; then
+ AC_MSG_ERROR([missing $JAVA/bin/javac binary])
+ else
+ JAVAC="$JAVA/bin/javac"
+ fi
+ if test ! -x "$JAVA/bin/javah"; then
+ AC_MSG_ERROR([missing $JAVA/bin/javah binary])
+ else
+ JAVAH="$JAVA/bin/javah"
+ fi
+ if test ! -x "$JAVA/bin/javadoc"; then
+ AC_MSG_ERROR([missing $JAVA/bin/javadoc binary])
+ else
+ JAVADOC="$JAVA/bin/javadoc"
+ fi
+ if test ! -x "$JAVA/bin/jar"; then
+ AC_MSG_ERROR([missing $JAVA/bin/jar binary])
+ else
+ JAR="$JAVA/bin/jar"
+ fi
+ java_version=`$JAVA_EXE -version 2>&1 | grep "java version"`
+ AC_MSG_RESULT(found $java_version in $JAVA)
+
+ dnl Find jni.h.
+ AC_MSG_CHECKING([for jni.h])
+ if test -f "$JAVA/include/jni.h"; then
+ JNI_CFLAGS="-I$JAVA/include"
+ else
+ if test "`find $JAVA -name jni.h`" != ""; then
+ head=`find $JAVA -name jni.h | tail -1`
+ dir=`dirname "$head"`
+ JNI_CFLAGS="-I$dir"
+ else
+ AC_MSG_FAILURE([missing jni.h header file])
+ fi
+ fi
+ AC_MSG_RESULT([$JNI_CFLAGS])
+
+ dnl Find jni_md.h.
+ AC_MSG_CHECKING([for jni_md.h])
+ case "$build_os" in
+ *linux*) system="linux" ;;
+ *SunOS*) system="solaris" ;;
+ *cygwin*) system="win32" ;;
+ *) system="$build_os" ;;
+ esac
+ if test -f "$JAVA/include/$system/jni_md.h"; then
+ JNI_CFLAGS="$JNI_CFLAGS -I$JAVA/include/$system"
+ else
+ if test "`find $JAVA -name jni_md.h`" != ""; then
+ head=`find $JAVA -name jni_md.h | tail -1`
+ dir=`dirname "$head"`
+ JNI_CFLAGS="$JNI_CFLAGS -I$dir"
+ else
+ AC_MSG_FAILURE([missing jni_md.h header file])
+ fi
+ fi
+ AC_MSG_RESULT([$JNI_CFLAGS])
+
+ dnl Need extra version flag?
+ AC_MSG_CHECKING([extra javac flags])
+ EXTRA_JAVAC_FLAGS=
+ javac_version=`$JAVAC -version 2>&1`
+ case "$javac_version" in
+ *Eclipse*)
+ EXTRA_JAVAC_FLAGS="-source 1.5" ;;
+ esac
+ AC_MSG_RESULT([$EXTRA_JAVAC_FLAGS])
+
+ dnl Extra lint flags?
+ AC_MSG_CHECKING([extra javac lint flags])
+ if $JAVAC -X >/dev/null 2>&1 && \
+ $JAVAC -X 2>&1 | grep -q -- '-Xlint:.*all'; then
+ AC_MSG_RESULT([-Xlint:all])
+ EXTRA_JAVAC_FLAGS="$EXTRA_JAVAC_FLAGS -Xlint:all"
+ else
+ AC_MSG_RESULT([no])
+ fi
+
+ dnl Where to install jarfiles, jnifiles
+ if test -z $JAR_INSTALL_DIR; then
+ JAR_INSTALL_DIR=\${prefix}/share/java
+ fi
+ if test -z $JNI_INSTALL_DIR; then
+ JNI_INSTALL_DIR=\${libdir}
+ fi
+
+ dnl JNI version.
+ jni_major_version=`echo "$VERSION" | $AWK -F. '{print $1}'`
+ jni_minor_version=`echo "$VERSION" | $AWK -F. '{print $2}'`
+ jni_micro_version=`echo "$VERSION" | $AWK -F. '{print $3}'`
+ JNI_VERSION_INFO=`expr "$jni_major_version" +
"$jni_minor_version"`":$jni_micro_version:$jni_minor_version"
+ fi
+
+ AC_SUBST(JAVA)
+ AC_SUBST(JAVA_EXE)
+ AC_SUBST(JAVAC)
+ AC_SUBST(JAVAH)
+ AC_SUBST(JAVADOC)
+ AC_SUBST(JAR)
+ AC_SUBST(JNI_CFLAGS)
+ AC_SUBST(EXTRA_JAVAC_FLAGS)
+ AC_SUBST(JAR_INSTALL_DIR)
+ AC_SUBST(JNI_INSTALL_DIR)
+ AC_SUBST(JNI_VERSION_INFO)
+fi
+
+AM_CONDITIONAL([HAVE_JAVA],[test "x$with_java" != "xno" &&
test -n "$JAVAC"])
diff --git a/m4/guestfs_lua.m4 b/m4/guestfs_lua.m4
new file mode 100644
index 0000000..a07cb51
--- /dev/null
+++ b/m4/guestfs_lua.m4
@@ -0,0 +1,47 @@
+# libguestfs
+# Copyright (C) 2009-2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl Lua
+AC_ARG_ENABLE([lua],
+ AS_HELP_STRING([--disable-lua], [disable Lua language bindings]),
+ [],
+ [enable_lua=yes])
+AS_IF([test "x$enable_lua" != "xno"],[
+ AC_CHECK_PROG([LUA],[lua],[lua],[no])
+ AS_IF([test "x$LUA" != "xno"],[
+ AC_MSG_CHECKING([for Lua version])
+ LUA_VERSION=`$LUA -e 'print(_VERSION)' | $AWK '{print $2}'`
+ AC_MSG_RESULT([$LUA_VERSION])
+ dnl On Debian it's 'lua5.1', 'lua5.2' etc. On Fedora, just
'lua'.
+ PKG_CHECK_MODULES([LUA], [lua$LUA_VERSION],[
+ AC_SUBST([LUA_CFLAGS])
+ AC_SUBST([LUA_LIBS])
+ AC_SUBST([LUA_VERSION])
+ AC_DEFINE([HAVE_LUA],[1],[Lua library found at compile time])
+ ],[
+ PKG_CHECK_MODULES([LUA], [lua],[
+ AC_SUBST([LUA_CFLAGS])
+ AC_SUBST([LUA_LIBS])
+ AC_SUBST([LUA_VERSION])
+ AC_DEFINE([HAVE_LUA],[1],[Lua library found at compile time])
+ ],[
+ AC_MSG_WARN([lua $LUA_VERSION not found])
+ ])
+ ])
+ ])
+])
+AM_CONDITIONAL([HAVE_LUA],[test "x$LUA_LIBS" != "x"])
diff --git a/m4/guestfs_ocaml.m4 b/m4/guestfs_ocaml.m4
new file mode 100644
index 0000000..b3e9387
--- /dev/null
+++ b/m4/guestfs_ocaml.m4
@@ -0,0 +1,104 @@
+# libguestfs
+# Copyright (C) 2009-2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl Check for OCaml (optional, for OCaml bindings and OCaml tools).
+OCAMLC=no
+OCAMLFIND=no
+AC_ARG_ENABLE([ocaml],
+ AS_HELP_STRING([--disable-ocaml], [disable OCaml language bindings]),
+ [],
+ [enable_ocaml=yes])
+AS_IF([test "x$enable_ocaml" != "xno"],[
+ dnl OCAMLC and OCAMLFIND have to be unset first, otherwise
+ dnl AC_CHECK_TOOL (inside AC_PROG_OCAML) will not look.
+ OCAMLC=
+ OCAMLFIND=
+ AC_PROG_OCAML
+ AC_PROG_FINDLIB
+
+ dnl OCaml >= 3.11 is required.
+ AC_MSG_CHECKING([if OCaml version >= 3.11])
+ ocaml_major="`echo $OCAMLVERSION | $AWK -F. '{print $1}'`"
+ ocaml_minor="`echo $OCAMLVERSION | $AWK -F. '{print $2}'`"
+ AS_IF([test "$ocaml_major" -ge 4 || ( test "$ocaml_major" -eq 3
&& test "$ocaml_minor" -ge 11 )],[
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_FAILURE([OCaml compiler is not new enough. At least OCaml 3.11 is
required])
+ ])
+])
+AM_CONDITIONAL([HAVE_OCAML],
+ [test "x$OCAMLC" != "xno" && test
"x$OCAMLFIND" != "xno"])
+AM_CONDITIONAL([HAVE_OCAMLOPT],
+ [test "x$OCAMLOPT" != "xno" && test
"x$OCAMLFIND" != "xno"])
+AM_CONDITIONAL([HAVE_OCAMLDOC],
+ [test "x$OCAMLDOC" != "xno"])
+
+dnl OCaml is required if we need to run the generator.
+AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" =
"xno"],[
+ AS_IF([! test -f $srcdir/src/guestfs_protocol.x],[
+ AC_MSG_FAILURE([OCaml compiler and findlib is required to build from git.
+If you don't have OCaml available, you should build from a tarball from
+http://libguestfs.org/download])
+ ])
+])
+
+AS_IF([test "x$OCAMLC" != "xno"],[
+ dnl Check for <caml/unixsupport.h> header.
+ old_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -I`$OCAMLC -where`"
+ AC_CHECK_HEADERS([caml/unixsupport.h],[],[],[#include <caml/mlvalues.h>])
+ CPPFLAGS="$old_CPPFLAGS"
+])
+
+OCAML_PKG_gettext=no
+OCAML_PKG_libvirt=no
+OCAML_PKG_oUnit=no
+ounit_is_v2=no
+AS_IF([test "x$OCAMLC" != "xno"],[
+ # Create mllib/common_gettext.ml, gettext functions or stubs.
+
+ # If we're building in a different directory, then mllib/ might
+ # not exist yet, so create it:
+ mkdir -p mllib
+
+ GUESTFS_CREATE_COMMON_GETTEXT_ML([mllib/common_gettext.ml])
+
+ AC_CHECK_OCAML_PKG(libvirt)
+ AC_CHECK_OCAML_PKG(oUnit)
+
+ # oUnit >= 2 is required, so check that it has OUnit2.
+ if test "x$OCAML_PKG_oUnit" != "xno"; then
+ AC_CHECK_OCAML_MODULE(ounit_is_v2,[OUnit.OUnit2],OUnit2,[+oUnit])
+ fi
+])
+AM_CONDITIONAL([HAVE_OCAML_PKG_GETTEXT],
+ [test "x$OCAMLC" != "xno" && test "x$OCAMLFIND"
!= "xno" && test "x$OCAML_PKG_gettext" != "xno"])
+AM_CONDITIONAL([HAVE_OCAML_PKG_LIBVIRT],
+ [test "x$OCAMLC" != "xno" && test "x$OCAMLFIND"
!= "xno" && test "x$OCAML_PKG_libvirt" != "xno"])
+AM_CONDITIONAL([HAVE_OCAML_PKG_OUNIT],
+ [test "x$OCAMLC" != "xno" && test "x$OCAMLFIND"
!= "xno" && test "x$OCAML_PKG_oUnit" != "xno"
&& test "x$ounit_is_v2" != "xno"])
+
+AC_CHECK_PROG([OCAML_GETTEXT],[ocaml-gettext],[ocaml-gettext],[no])
+AM_CONDITIONAL([HAVE_OCAML_GETTEXT],
+ [test "x$OCAMLC" != "xno" && test "x$OCAMLFIND"
!= "xno" && test "x$OCAML_PKG_gettext" != "xno"
&& test "x$OCAML_GETTEXT" != "xno"])
+
+dnl Flags we want to pass to every OCaml compiler call.
+OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX-3"
+AC_SUBST([OCAML_WARN_ERROR])
+OCAML_FLAGS="-g -annot"
+AC_SUBST([OCAML_FLAGS])
diff --git a/m4/guestfs_perl.m4 b/m4/guestfs_perl.m4
new file mode 100644
index 0000000..1306dd2
--- /dev/null
+++ b/m4/guestfs_perl.m4
@@ -0,0 +1,41 @@
+# libguestfs
+# Copyright (C) 2009-2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl Check for Perl (optional, for Perl bindings and Perl tools).
+AC_ARG_ENABLE([perl],
+ AS_HELP_STRING([--disable-perl], [disable Perl language bindings]),
+ [],
+ [enable_perl=yes])
+AS_IF([test "x$enable_perl" != "xno"],[
+ dnl Check for Perl modules that must be present to compile and
+ dnl test the Perl bindings.
+ missing_perl_modules=no
+ for pm in Test::More Module::Build; do
+ AC_MSG_CHECKING([for $pm])
+ if ! $PERL -M$pm -e1 >&AS_MESSAGE_LOG_FD 2>&1; then
+ AC_MSG_RESULT([no])
+ missing_perl_modules=yes
+ else
+ AC_MSG_RESULT([yes])
+ fi
+ done
+ if test "x$missing_perl_modules" = "xyes"; then
+ AC_MSG_WARN([some Perl modules required to compile or test the Perl bindings are
missing])
+ fi
+])
+AM_CONDITIONAL([HAVE_PERL],
+ [test "x$enable_perl" != "xno" && test "x$PERL"
!= "xno" && test "x$missing_perl_modules" !=
"xyes"])
diff --git a/m4/guestfs_php.m4 b/m4/guestfs_php.m4
new file mode 100644
index 0000000..e88c6e6
--- /dev/null
+++ b/m4/guestfs_php.m4
@@ -0,0 +1,29 @@
+# libguestfs
+# Copyright (C) 2009-2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl PHP
+PHP=no
+AC_ARG_ENABLE([php],
+ AS_HELP_STRING([--disable-php], [disable PHP language bindings]),
+ [],
+ [enable_php=yes])
+AS_IF([test "x$enable_php" != "xno"],[
+ PHP=
+ AC_CHECK_PROG([PHP],[php],[php],[no])
+ AC_CHECK_PROG([PHPIZE],[phpize],[phpize],[no])
+])
+AM_CONDITIONAL([HAVE_PHP], [test "x$PHP" != "xno" && test
"x$PHPIZE" != "xno"])
diff --git a/m4/guestfs_python.m4 b/m4/guestfs_python.m4
new file mode 100644
index 0000000..3869905
--- /dev/null
+++ b/m4/guestfs_python.m4
@@ -0,0 +1,104 @@
+# libguestfs
+# Copyright (C) 2009-2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl Check for Python (optional, for Python bindings).
+PYTHON_PREFIX=
+PYTHON_VERSION=
+PYTHON_INSTALLDIR=
+
+AC_ARG_ENABLE([python],
+ AS_HELP_STRING([--disable-python], [disable Python language bindings]),
+ [],
+ [enable_python=yes])
+AS_IF([test "x$enable_python" != "xno"],[
+ AC_CHECK_PROG([PYTHON],[python],[python],[no])
+
+ if test "x$PYTHON" != "xno"; then
+ AC_MSG_CHECKING([Python version])
+ PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print
(sys.version_info@<:@0@:>@)"`
+ PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print
(sys.version_info@<:@1@:>@)"`
+ PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR"
+ AC_MSG_RESULT([$PYTHON_VERSION])
+ # Debian: python-2.7.pc, python-3.2.pc
+ PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"],[
+ AC_SUBST([PYTHON_CFLAGS])
+ AC_SUBST([PYTHON_LIBS])
+ AC_SUBST([PYTHON_VERSION])
+ AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
+ ],[
+ PKG_CHECK_MODULES([PYTHON], [python],[
+ AC_SUBST([PYTHON_CFLAGS])
+ AC_SUBST([PYTHON_LIBS])
+ AC_SUBST([PYTHON_VERSION])
+ AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
+ ],[
+ AC_MSG_WARN([python $PYTHON_VERSION not found])
+ ])
+ ])
+ AC_MSG_CHECKING([Python prefix])
+ PYTHON_PREFIX=`$PYTHON -c "import sys; print (sys.prefix)"`
+ AC_MSG_RESULT([$PYTHON_PREFIX])
+
+ AC_ARG_WITH([python-installdir],
+ [AS_HELP_STRING([--with-python-installdir],
+ [directory to install python modules @<:@default=check@:>@])],
+ [PYTHON_INSTALLDIR="$withval"
+ AC_MSG_NOTICE([Python install dir $PYTHON_INSTALLDIR])],
+ [PYTHON_INSTALLDIR=check])
+
+ if test "x$PYTHON_INSTALLDIR" = "xcheck"; then
+ PYTHON_INSTALLDIR=
+ AC_MSG_CHECKING([for Python site-packages path])
+ if test -z "$PYTHON_INSTALLDIR"; then
+ PYTHON_INSTALLDIR=`$PYTHON -c "import distutils.sysconfig; \
+ print
(distutils.sysconfig.get_python_lib(1,0));"`
+ fi
+ AC_MSG_RESULT([$PYTHON_INSTALLDIR])
+ fi
+
+ AC_MSG_CHECKING([for Python extension suffix (PEP-3149)])
+ if test -z "$PYTHON_EXT_SUFFIX"; then
+ python_ext_suffix=`$PYTHON -c "import distutils.sysconfig; \
+ print
(distutils.sysconfig.get_config_var('EXT_SUFFIX') or
distutils.sysconfig.get_config_var('SO'))"`
+ PYTHON_EXT_SUFFIX=$python_ext_suffix
+ fi
+ AC_MSG_RESULT([$PYTHON_EXT_SUFFIX])
+
+ dnl Look for some optional symbols in libpython.
+ old_LIBS="$LIBS"
+
+ PYTHON_BLDLIBRARY=`$PYTHON -c "import distutils.sysconfig; \
+ print
(distutils.sysconfig.get_config_var('BLDLIBRARY'))"`
+ AC_CHECK_LIB([c],[PyCapsule_New],
+ [AC_DEFINE([HAVE_PYCAPSULE_NEW],1,
+ [Found PyCapsule_New in libpython.])],
+ [],[$PYTHON_BLDLIBRARY])
+ AC_CHECK_LIB([c],[PyString_AsString],
+ [AC_DEFINE([HAVE_PYSTRING_ASSTRING],1,
+ [Found PyString_AsString in libpython.])],
+ [],[$PYTHON_BLDLIBRARY])
+
+ LIBS="$old_LIBS"
+ fi
+
+ AC_SUBST(PYTHON_PREFIX)
+ AC_SUBST(PYTHON_VERSION)
+ AC_SUBST(PYTHON_INSTALLDIR)
+ AC_SUBST(PYTHON_EXT_SUFFIX)
+])
+AM_CONDITIONAL([HAVE_PYTHON],
+ [test "x$PYTHON" != "xno" && test
"x$PYTHON_LIBS" != "x" ])
diff --git a/m4/guestfs_ruby.m4 b/m4/guestfs_ruby.m4
new file mode 100644
index 0000000..9b22b95
--- /dev/null
+++ b/m4/guestfs_ruby.m4
@@ -0,0 +1,51 @@
+# libguestfs
+# Copyright (C) 2009-2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl Check for Ruby and rake (optional, for Ruby bindings).
+AC_ARG_ENABLE([ruby],
+ AS_HELP_STRING([--disable-ruby], [disable Ruby language bindings]),
+ [],
+ [enable_ruby=yes])
+AS_IF([test "x$enable_ruby" != "xno"],[
+ AC_CHECK_PROG([RUBY],[ruby],[ruby],[no])
+ AC_CHECK_PROG([RAKE],[rake],[rake],[no])
+
+ AS_IF([test -n "$RUBY" && test -n "$RAKE"],[
+ dnl Find the library. Note on Debian it's not -lruby.
+ AC_MSG_CHECKING([for C library for Ruby extensions])
+ ruby_cmd='puts RbConfig::CONFIG@<:@"RUBY_SO_NAME"@:>@'
+ echo running: $RUBY -rrbconfig -e \'$ruby_cmd\'
>&AS_MESSAGE_LOG_FD
+ $RUBY -rrbconfig -e "$ruby_cmd" >conftest
2>&AS_MESSAGE_LOG_FD
+ libruby="$(cat conftest)"
+ rm conftest
+ AS_IF([test -n "$libruby"],[
+ ruby_cmd='puts RbConfig::CONFIG@<:@"libdir"@:>@'
+ echo running: $RUBY -rrbconfig -e \'$ruby_cmd\'
>&AS_MESSAGE_LOG_FD
+ $RUBY -rrbconfig -e "$ruby_cmd" >conftest
2>&AS_MESSAGE_LOG_FD
+ libruby_libdir="$(cat conftest)"
+ rm conftest
+ test -n "$libruby_libdir" &&
libruby_libdir="-L$libruby_libdir"
+ AC_MSG_RESULT([-l$libruby])
+ AC_CHECK_LIB([$libruby],[ruby_init],
+ [have_libruby=1],[have_libruby=],[$libruby_libdir])
+ ],[
+ AC_MSG_RESULT([not found])
+ ])
+ ])
+])
+AM_CONDITIONAL([HAVE_RUBY],
+ [test -n "$RUBY" && test -n "$RAKE" && test -n
"$have_libruby"])
--
2.5.0