diff options
author | Noah Watkins <noahwatkins@gmail.com> | 2012-09-01 10:26:41 -0700 |
---|---|---|
committer | Noah Watkins <noahwatkins@gmail.com> | 2012-10-19 09:59:10 -0700 |
commit | 68e01649ff1e6e197bc4ad6dfa24f93912dd87cc (patch) | |
tree | 6bb10b2574664961b6c3f13aaf1659a9a4ac0d15 /configure.ac | |
parent | 350433530fb13f219ed528f0327429d17c38de47 (diff) | |
download | ceph-68e01649ff1e6e197bc4ad6dfa24f93912dd87cc.tar.gz |
automake: setup autotools to build cephfs-java
Adds --enable-cephfs-java and --with-jdk to build
the libcephfs Java bindings and specify the default
JDK directory, respectively.
Also adds default JDK paths to avoid --with-jdk in
the common case. Currently setup for the default
provided by Debian's default-jdk package, but other
default search paths can easily be added.
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 5096c9db72a..eed9752d40f 100644 --- a/configure.ac +++ b/configure.ac @@ -244,7 +244,80 @@ AS_IF([test "x$with_tcmalloc" != xno], [no tcmalloc found (use --without-tcmalloc to disable)])])]) AM_CONDITIONAL(WITH_TCMALLOC, [test "$HAVE_LIBTCMALLOC" = "1"]) +# +# Java is painful +# - adapted from OMPI wrappers package +# - this might become bigger. maybe should be own m4 file +# +AC_ARG_ENABLE(cephfs-java, + AC_HELP_STRING([--enable-cephfs-java], [build libcephfs Java bindings]), + [], [enable_cephfs_java=no]) + +AM_CONDITIONAL(ENABLE_CEPHFS_JAVA, test "x$enable_cephfs_java" = "xyes") + +AC_ARG_WITH(jdk-dir, + AC_HELP_STRING([--with-jdk-dir(=DIR)], [Path to JDK directory])) + +AC_DEFUN([JAVA_DNE], + AC_MSG_ERROR([Cannot find $1 '$2'. Try setting --with-jdk-dir])) + +AS_IF([test "x$enable_cephfs_java" = "xyes"], [ + + # setup bin/include dirs from --with-jdk-dir (search for jni.h, javac) + AS_IF([test -n "$with_jdk_dir"], [ + javac_prog=`find $with_jdk_dir/ -name javac | head -n 1` + AS_IF([test -x "$javac_prog"], [ + EXTRA_JDK_BIN_DIR=`dirname $javac_prog`]) + jnih=`find $with_jdk_dir/ -name jni.h | head -n 1` + AS_IF([test -r "$jnih"], [ + EXTRA_JDK_INC_DIR=`dirname $jnih`])]) + + # setup defaults for Debian default-jdk package (without --with-jdk-dir) + AS_IF([test -z "$with_jdk_dir"], [ + # This works with Debian's default-jdk package + dir='/usr/lib/jvm/default-java/' + javac_prog=`find $dir -name javac | head -n 1` + AS_IF([test -x "$javac_prog"], [ + EXTRA_JDK_BIN_DIR=`dirname $javac_prog`]) + jnih=`find $dir -name jni.h | head -n 1` + AS_IF([test -r "$jnih"], [ + EXTRA_JDK_INC_DIR=`dirname $jnih`])]) + + # Check for Java programs: javac, javah, jar + PATH_save=$PATH + PATH="$PATH:$EXTRA_JDK_BIN_DIR" + AC_PATH_PROG(JAVAC, javac) + AC_PATH_PROG(JAVAH, javah) + AC_PATH_PROG(JAR, jar) + PATH=$PATH_save + + # Ensure we have them... + AS_IF([test -z "$JAVAC"], JAVA_DNE(program, javac)) + AS_IF([test -z "$JAVAH"], JAVA_DNE(program, javah)) + AS_IF([test -z "$JAR"], JAVA_DNE(program, jar)) + + # Check for jni.h + CPPFLAGS_save=$CPPFLAGS + + AS_IF([test -n "$EXTRA_JDK_INC_DIR"], + [JDK_CPPFLAGS="-I$EXTRA_JDK_INC_DIR" + AS_IF([test -d "$EXTRA_JDK_INC_DIR/linux"], + [JDK_CPPFLAGS="$JDK_CPPFLAGS -I$EXTRA_JDK_INC_DIR/linux"]) + CPPFLAGS="$CPPFLAGS $JDK_CPPFLAGS"]) + + AC_CHECK_HEADER([jni.h], [], JAVA_DNE(header, jni.h)) + + CPPFLAGS=$CPPFLAGS_save + + # Setup output var + AC_SUBST(JDK_CPPFLAGS) +]) + # jni? +# clear cache (from java above) -- this whole thing will get +# folded into the bigger java package later -- for now maintain +# backward compat +AS_UNSET(ac_cv_header_jni_h) AC_ARG_WITH([hadoop], [AS_HELP_STRING([--with-hadoop], [build hadoop client])], [], @@ -443,6 +516,7 @@ AC_CONFIG_FILES([Makefile src/ocf/Makefile src/ocf/ceph src/ocf/rbd + src/java/Makefile man/Makefile ceph.spec]) AC_OUTPUT |