You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2012/01/24 21:59:10 UTC

svn commit: r1235493 - in /incubator/mesos/trunk: configure.ac src/Makefile.am

Author: benh
Date: Tue Jan 24 20:59:10 2012
New Revision: 1235493

URL: http://svn.apache.org/viewvc?rev=1235493&view=rev
Log:
Updating JAVA_LDFLAGS to link correctly on Linux and removed JNI bindings from Python egg (contributed by Charles Reiss).

Modified:
    incubator/mesos/trunk/configure.ac
    incubator/mesos/trunk/src/Makefile.am

Modified: incubator/mesos/trunk/configure.ac
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/configure.ac?rev=1235493&r1=1235492&r2=1235493&view=diff
==============================================================================
--- incubator/mesos/trunk/configure.ac (original)
+++ incubator/mesos/trunk/configure.ac Tue Jan 24 20:59:10 2012
@@ -31,10 +31,12 @@ AM_INIT_AUTOMAKE([-Wall -Werror silent-r
 # Allow less verbose output when building.
 AM_SILENT_RULES
 
-# Initialize libtool.
+# Initialize libtool (LT_OUTPUT builds ./libtool immediately, needed
+# so we can do tests with libtool during configuration).
 LT_PREREQ([2.2])
 LT_INIT
 LT_LANG([C++])
+LT_OUTPUT
 
 AC_LANG(C++)
 
@@ -111,10 +113,9 @@ AC_ARG_WITH([included-zookeeper],
 
 AC_ARG_VAR([JAVA_HOME], [location of Java Development Kit (JDK)])
 
-AC_ARG_VAR([JAVA_CPPFLAGS], [preprocessor flags for JNI])
-
-AC_ARG_VAR([JAVA_LDFLAGS], [linker flags for JNI])
+AC_ARG_VAR([JAVA_CPPFLAGS], [preprocessor flags for JDK])
 
+AC_ARG_VAR([JAVA_LDFLAGS], [linker flags for JDK])
 
 # Determine the current OS (TODO(benh): Does autotools do this for us?).
 case "${target_os}" in
@@ -219,8 +220,9 @@ __EOF__
     elif test "$OS_NAME" = "linux"; then
       JAVA_LDFLAGS=""
       for arch in amd64 i386; do
-        if test -e "$JAVA_HOME/jre/lib/$arch"; then
-          JAVA_LDFLAGS="-L$JAVA_HOME/jre/lib/$arch/server -ljvm"
+        dir="$JAVA_HOME/jre/lib/$arch/server"
+        if test -e "$dir"; then
+          JAVA_LDFLAGS="-L$dir -R$dir -Wl,-ljvm"
           break;
           fi
       done
@@ -228,11 +230,13 @@ __EOF__
   fi
 
   if test -z "$JAVA_LDFLAGS"; then
-    AC_MSG_ERROR([failed to determine linker flags for using Java (bad JAVA_HOME or missing support for your architecture?)])
+    AC_MSG_ERROR([failed to determine linker flags for using Java \
+(bad JAVA_HOME or missing support for your architecture?)])
   fi
 
-    AC_MSG_CHECKING([whether or not we can build using the JDK])
-    cat <<__EOF__ >conftest.cpp [
+  # Now check that we can build against the JDK (using libtool).
+  AC_MSG_CHECKING([whether or not we can build using the JDK])
+  cat <<__EOF__ >conftest.cpp [
 #include <jni.h>
 int main(int argc, char** argv)
 {
@@ -243,11 +247,12 @@ int main(int argc, char** argv)
 }]
 __EOF__
 
-  # Compile and link.
-  $CXX $JAVA_CPPFLAGS $JAVA_LDFLAGS -o conftest conftest.cpp >&5
+  # Try to compile and link via libtool (the one we generate).
+  ./libtool --tag=CXX --mode=link \
+    $CXX $JAVA_CPPFLAGS -o conftest conftest.cpp $JAVA_LDFLAGS >&5
 
   if test $? != 0; then
-    AC_MSG_ERROR([failed to build against JDK])
+    AC_MSG_ERROR([failed to build against JDK (using libtool)])
   else
     AC_MSG_RESULT([yes])
   fi
@@ -265,7 +270,6 @@ __EOF__
                   [chmod +x src/examples/java/test-multiple-executors-framework])
   AC_CONFIG_FILES([src/java/mesos.pom])
 
-  AC_SUBST([JAVA_LDFLAGS])
   AC_SUBST([HAS_JAVA], [1]) # Used to decide whether to run Java tests.
   has_java=yes
 fi
@@ -275,7 +279,7 @@ AM_CONDITIONAL([HAS_JAVA], [test "x$has_
 
 # Perform necessary configuration for building with Python.
 if test "x$enable_python" = "xyes"; then
-  AM_PATH_PYTHON() # A fatal error will occur if no interpreter found.
+  AM_PATH_PYTHON() # A fatal error will occur if no interpreter is found.
 
   # Determine how the generated Python egg's will get named, used in
   # the Makefile to keep the targets from being rerun.
@@ -297,7 +301,7 @@ if test "x$enable_python" = "xyes"; then
 
   AC_SUBST([PYTHON_EGG_POSTFIX])
   AC_SUBST([PYTHON_EGG_PUREPY_POSTFIX])
-  AC_SUBST([PYTHON]) # Used by the example shell scripts.
+  AC_SUBST([PYTHON]) # Used by the example shell scripts and src/Makefile.am.
   AC_SUBST([HAS_PYTHON], [1]) # Used to decide whether to run Python tests.
   has_python=yes
 fi

Modified: incubator/mesos/trunk/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/Makefile.am?rev=1235493&r1=1235492&r2=1235493&view=diff
==============================================================================
--- incubator/mesos/trunk/src/Makefile.am (original)
+++ incubator/mesos/trunk/src/Makefile.am Tue Jan 24 20:59:10 2012
@@ -401,7 +401,12 @@ libjava_la_DEPENDENCIES = $(MESOS_PROTO)
 
 libjava_la_LIBADD = $(JAVA_LDFLAGS)
 
-libmesos_no_third_party_la_LIBADD += libjava.la
+# We don't add libjava.la to libmesos_no_third_party.la so we don't
+# include the JNI bindings in the Python egg (but we might want to
+# reconsider this in the future). We also need to add the JAVA_LDFLAGS
+# to libmesos.la so on Linux we set the rpath for libmesos.so.
+libmesos_la_LIBADD += libjava.la
+libmesos_la_LIBADD += $(JAVA_LDFLAGS)
 
 # We need to generate the JNI header files before we build the sources
 # and the easiest way to do that with autotools is with the
@@ -482,15 +487,15 @@ if HAS_PYTHON
 MESOS_EGG = python/dist/mesos-$(PACKAGE_VERSION)$(PYTHON_EGG_POSTFIX).egg
 
 $(MESOS_EGG): python/setup.py $(srcdir)/python/src/mesos.py	\
-	       $(PYTHON_PROTOS) libmesos_no_third_party.la	\
-	       $(PROTOBUF_EGG)
+	      $(PYTHON_PROTOS) libmesos_no_third_party.la	\
+	      $(PROTOBUF_EGG)
 	@echo "Building Mesos Python egg ..."
 	@$(MKDIR_P) python/src
 	@cp -pf $(srcdir)/python/src/mesos.py python/src
 	@cp -pf $(PYTHON_PROTOS) python/src
 	@PYTHONPATH=../$(SETUPTOOLS) $(PYTHON) python/setup.py bdist_egg
 
-CLEANFILES += $(MESOS_EGG)
+CLEANFILES += $(MESOS_EGG) python/build/temp.*/native/*.o python/build/lib.*/*
 
 # TODO(Charles Reiss): Don't hard code this verison number.
 PROTOBUF_EGG =								\