AC_CHECK_PROG([RAKE],[rake],[rake],[no])
AM_CONDITIONAL([HAVE_RUBY],
- [test "x$RAKE" != "xno" -a -n "x$HAVE_LIBRUBY"])
+ [test "x$RAKE" != "xno" -a -n "$HAVE_LIBRUBY"])
+
+dnl Check for Java.
+AC_ARG_WITH(java_home,
+ [AS_HELP_STRING([--with-java-home],
+ [specify path to JDK directory @<:@default=check@:>@])],
+ [],
+ [with_java_home=check])
+
+if test "x$with_java_home" != "xno"; then
+ if test "x$with_java_home" != "xyes" -a "x$with_java_home" != "xcheck"
+ then
+ if test -d "$with_java_home"; then
+ JAVA_HOME="$with_java_home"
+ else
+ AC_MSG_FAILURE([$with_java_home is not a directory])
+ fi
+ fi
+ if test "x$JAVA_HOME" = "x"; then
+ JAVA_HOME=/usr/lib/jvm/java
+ fi
+ AC_MSG_CHECKING(for JDK in $JAVA_HOME)
+ if test ! -x "$JAVA_HOME/bin/java"; then
+ AC_MSG_ERROR([missing $JAVA_HOME/bin/java binary])
+ else
+ JAVA="$JAVA_HOME/bin/java"
+ fi
+ if test ! -x "$JAVA_HOME/bin/javac"; then
+ AC_MSG_ERROR([missing $JAVA_HOME/bin/javac binary])
+ else
+ JAVAC="$JAVA_HOME/bin/javac"
+ fi
+ if test ! -x "$JAVA_HOME/bin/javah"; then
+ AC_MSG_ERROR([missing $JAVA_HOME/bin/javah binary])
+ else
+ JAVAH="$JAVA_HOME/bin/javah"
+ fi
+ if test ! -x "$JAVA_HOME/bin/javadoc"; then
+ AC_MSG_ERROR([missing $JAVA_HOME/bin/javadoc binary])
+ else
+ JAVADOC="$JAVA_HOME/bin/javadoc"
+ fi
+ if test ! -x "$JAVA_HOME/bin/jar"; then
+ AC_MSG_ERROR([missing $JAVA_HOME/bin/jar binary])
+ else
+ JAR="$JAVA_HOME/bin/jar"
+ fi
+ java_version=`$JAVA -version 2>&1 | grep "java version"`
+ AC_MSG_RESULT(found $java_version in $JAVA_HOME)
+
+ dnl Find jni.h.
+ AC_MSG_CHECKING([for jni.h])
+ if test -f "$JAVA_HOME/include/jni.h"; then
+ JNI_CFLAGS="-I$JAVA_HOME/include"
+ else
+ if test "`find $JAVA_HOME -name jni.h`" != ""; then
+ head=`find $JAVA_HOME -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_HOME/include/$system/jni_md.h"; then
+ JNI_CFLAGS="$JNI_CFLAGS -I$JAVA_HOME/include/$system"
+ else
+ if test "`find $JAVA_HOME -name jni_md.h`" != ""; then
+ head=`find $JAVA_HOME -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])
+ JAVAC_FLAGS=
+ javac_version=`$JAVAC -version 2>&1`
+ case "$javac_version" in
+ *Eclipse*)
+ JAVAC_FLAGS="-source 1.5" ;;
+ esac
+ AC_MSG_RESULT([$JAVAC_FLAGS])
+fi
+
+AC_SUBST(JAVA_HOME)
+AC_SUBST(JAVA)
+AC_SUBST(JAVAC)
+AC_SUBST(JAVAH)
+AC_SUBST(JAVADOC)
+AC_SUBST(JAR)
+AC_SUBST(JNI_CFLAGS)
+AC_SUBST(JAVAC_FLAGS)
+
+AM_CONDITIONAL([HAVE_JAVA],[test -n "$JAVAC"])
dnl Run in subdirs.
AC_CONFIG_SUBDIRS([daemon])
perl/Makefile
python/Makefile
ruby/Makefile ruby/Rakefile
+ java/Makefile
make-initramfs.sh update-initramfs.sh
libguestfs.spec
ocaml/META perl/Makefile.PL])
--- /dev/null
+# libguestfs Java bindings
+# Copyright (C) 2009 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+EXTRA_DIST =
+
+CLEANFILES = *~
+
+if HAVE_JAVA
+
+
+endif
\ No newline at end of file
BuildRequires: python-devel
BuildRequires: ruby-devel
BuildRequires: rubygem-rake
+BuildRequires: java >= 1.5.0
+BuildRequires: jpackage-utils
+BuildRequires: java-devel
# Runtime requires:
Requires: qemu >= 0.10-7
For Ruby bindings, see 'ruby-libguestfs'.
+For Java bindings, see 'libguestfs-java-devel'.
+
%package devel
Summary: Development tools and libraries for %{name}
ruby-%{name} contains Ruby bindings for %{name}.
+%package java
+Summary: Java bindings for %{name}
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: java >= 1.5.0
+Requires: jpackage-utils
+
+%description java
+%{name}-java contains Java bindings for %{name}.
+
+If you want to develop software in Java which uses %{name}, then
+you will also need %{name}-java-devel.
+
+
+%package java-devel
+Summary: Java development package for %{name}
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: %{name}-java = %{version}-%{release}
+
+%description java-devel
+%{name}-java-devel contains the tools for developing Java software
+using %{name}.
+
+See also %{name}-javadoc.
+
+
+%package javadoc
+Summary: Java documentation for %{name}
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: %{name}-java = %{version}-%{release}
+Requires: jpackage-utils
+
+%description javadoc
+%{name}-javadoc contains the Java documentation for %{name}.
+
+
%prep
%setup -q
%define extra %nil
%endif
-./configure --prefix=%{_prefix} --libdir=%{_libdir} %{extra}
+./configure \
+ --prefix=%{_prefix} --libdir=%{_libdir} \
+ --with-java-home=%{java_home} \
+ %{extra}
# 'INSTALLDIRS' ensures that perl libs are installed in the vendor dir
# not the site dir.
+# Uses javac which is incompatible with parallel make.
make INSTALLDIRS=vendor
%{ruby_sitearch}/_guestfs.so
+%files java
+%defattr(-,root,root,-)
+%doc README
+%{_libdir}/libguestfs_jni*.so.*
+%{_datadir}/java/*.jar
+
+
+%files java-devel
+%defattr(-,root,root,-)
+%doc java/
+%{_libdir}/libguestfs_jni*.so
+
+
+%files java
+%defattr(-,root,root,-)
+%doc README
+/usr/share/javadoc/%{name}-java-%{version}
+
+
%changelog
* Mon Apr 20 2009 Richard Jones <rjones@redhat.com> - @VERSION@-1
- New upstream version @VERSION@.