List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:December 12 2007 1:10pm
Subject:Rev 365: Added support for building with gcj. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel

------------------------------------------------------------
revno: 365
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Wed 2007-12-12 11:10:28 -0200
message:
  Added support for building with gcj.
modified:
  java/.classpath                classpath-20071116042946-npnq9g3hwm24x1ga-1
  java/.project                  project-20070521182648-uuhans84tln3f4b6-1
  java/Makefile.am               makefile.am-20070415032352-9dpe6aurqcnuwcrd-1
  m4/java.m4                     java.m4-20071024032738-xuzaza2fu10nw2lr-1
=== modified file 'java/.classpath'
--- a/java/.classpath	2007-12-07 10:03:14 +0000
+++ b/java/.classpath	2007-12-12 13:10:28 +0000
@@ -7,6 +7,6 @@
 	</classpathentry>
 	<classpathentry kind="lib" path="lib/mysql-connector-java-5.1.5-bin.jar"/>
 	<classpathentry kind="lib" path="lib/junit.jar"/>
-	<classpathentry kind="lib"
path="/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/rt.jar"/>
+	<classpathentry kind="lib" path="/usr/lib/jvm/java-6-sun/jre/lib/rt.jar"/>
 	<classpathentry kind="output" path=""/>
 </classpath>

=== modified file 'java/.project'
--- a/java/.project	2007-11-07 19:16:27 +0000
+++ b/java/.project	2007-12-12 13:10:28 +0000
@@ -6,6 +6,16 @@
 	</projects>
 	<buildSpec>
 		<buildCommand>
+			<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+			<triggers>full,incremental,</triggers>
+			<arguments>
+				<dictionary>
+					<key>LaunchConfigHandle</key>
+					<value>&lt;project&gt;/.externalToolBuilders/SWIG.launch</value>
+				</dictionary>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
 			<name>org.eclipse.jdt.core.javabuilder</name>
 			<arguments>
 			</arguments>

=== modified file 'java/Makefile.am'
--- a/java/Makefile.am	2007-12-11 17:11:43 +0000
+++ b/java/Makefile.am	2007-12-12 13:10:28 +0000
@@ -387,7 +387,7 @@
 
 .java.class:
 	@mkdir -p `dirname $*`
-	$(JAVAC) -classpath $(classpath) -sourcepath $(srcdir):$(builddir) -d $(builddir) $<
+	$(JAVAC) $(JAVAOPTS) -classpath $(classpath) -sourcepath $(srcdir):$(builddir) -d
$(builddir) $<
 
 .i.cxx: 
 
@@ -410,13 +410,13 @@
 # $(NDBAPI_JAVA_CLASSES) $(MGMAPI_JAVA_CLASSES)
 mgmj.jar: libmgmj.la $(MGMAPI_JAVA_SRC) $(MGMAPI_BUILT_J)
 	@echo "Building MGM/J java files"
-	@$(JAVAC) -classpath $(classpath) -sourcepath $(srcdir):$(builddir) -d $(builddir) 
$(MGMAPI_JAVA_SRC) $(MGMAPI_BUILT_J)
+	$(JAVAC) $(JAVAOPTS) -classpath $(classpath) -sourcepath $(srcdir):$(builddir) -d
$(builddir)  $(MGMAPI_JAVA_SRC) $(MGMAPI_BUILT_J)
 	@echo "Building mgmj.jar"
 	@$(JAR) cf $@ $(MGMAPI_JAVA_CLASSES) ${package_builddir}/ndbj/*\$$*class
 
 ndbj.jar: libndbj.la $(NDBAPI_JAVA_SRC) $(NDBAPI_BUILT_J)
 	@echo "Building NDB/J java files"
-	@$(JAVAC) -classpath $(classpath) -sourcepath $(srcdir):$(builddir) -d $(builddir) 
$(NDBAPI_JAVA_SRC) $(NDBAPI_BUILT_J) 
+	$(JAVAC) $(JAVAOPTS) -classpath $(classpath) -sourcepath $(srcdir):$(builddir) -d
$(builddir)  $(NDBAPI_JAVA_SRC) $(NDBAPI_BUILT_J) 
 	@echo "Building ndbj.jar"
 	@$(JAR) cf $@ ${NDBAPI_JAVA_CLASSES} ${package_builddir}/ndbj/*\$$*class
 

=== modified file 'm4/java.m4'
--- a/m4/java.m4	2007-12-05 07:15:13 +0000
+++ b/m4/java.m4	2007-12-12 13:10:28 +0000
@@ -53,26 +53,117 @@
         ac_cv_java_style="Sun"
       elif test -d "$JAVA_HOME/jre/bin"; then
         ac_cv_java_style="IBM"
+      else 
+
+        if test -z "$JAVAINCDIR" ; then
+          
+
+          # Add in default installation directory on Windows for Cygwin
+          case $host in
+            *-*-cygwin* | *-*-mingw*) 
+              JAVAINCDIR="c:/Program*Files/Java/jdk*/include
d:/Program*Files/Java/jdk*/include c:/j2sdk*/include d:/j2sdk*/include c:/jdk*/include
d:/jdk*/include $JAVAINCDIR"
+            ;;
+            *-*-darwin*) 
+              JAVAINCDIR="/System/Library/Frameworks/JavaVM.framework/Headers
$JAVAINCDIR"
+            ;;
+            *)
+              JAVAINCDIR="/usr/j2sdk*/include /usr/local/j2sdk*/include /usr/jdk*/include
/usr/local/jdk*/include /opt/j2sdk*/include /opt/jdk*/include /usr/java/include
/usr/java/j2sdk*/include /usr/java/jdk*/include /usr/local/java/include /opt/java/include
/usr/include/java /usr/local/include/java /usr/lib/java/include /usr/lib/jvm/java*/include
/usr/include/kaffe /usr/local/include/kaffe /usr/include"
+            ;;
+          esac
+        fi
+
+        JAVAINC=""
+        for d in $JAVAINCDIR ; do
+          if test -r "$d/jni.h" ; then
+            JAVAINCDIR=$d
+            JAVAINC=-I\"$d\"
+            break
+          fi
+        done
+        if test "x$JAVAINC" = "x" ; then
+          ac_cv_java_style=unknown
+        else
+          # now look for <arch>/jni_md.h
+          JAVAMDDIR=`find "$JAVAINCDIR" -follow -name jni_md.h -print`
+          if test "$JAVAMDDIR" = "" ; then
+            ac_cv_java_style=unknown
+	   AC_MSG_RESULT([unkown])
+          else
+            ac_cv_java_style=GCJ
+            JAVAMDDIR=`dirname "$JAVAMDDIR" | tail -1`
+            JAVAINC="${JAVAINC} -I\"$JAVAMDDIR\""
+          fi
+        fi
+
+
       fi
     fi
   ])
 
   case "$ac_cv_java_style" in
   IBM)
+    JAVAOPTS=""
     JAVA_BIN="$JAVA_HOME/bin"
     JAVA_INC="$JAVA_HOME/include"
     JAVA_LIB="$JAVA_HOME/jre/bin"
     ;;
   Sun)
+    JAVAOPTS=""
     JAVA_BIN="$JAVA_HOME/bin"
     JAVA_INC="$JAVA_HOME/include"
     JAVA_LIB="$JAVA_HOME/jre/lib"
     ;;
   Apple)
+    JAVAOPTS=""
     JAVA_BIN="$JAVA_HOME/../Commands"
     JAVA_INC="$JAVA_HOME/../Headers"
     JAVA_LIB="$JAVA_HOME/../Libraries"
     ;;
+  GCJ)	
+# java.exe on Cygwin requires the Windows standard (Pascal) calling convention as it is a
normal Windows executable and not a Cygwin built executable
+case $host in
+*-*-cygwin* | *-*-mingw*)
+    if test "$GCC" = yes; then
+        JAVADYNAMICLINKING=" -mno-cygwin -mthreads -Wl,--add-stdcall-alias"
+        JAVACFLAGS="-mno-cygwin -mthreads"
+    else
+        JAVADYNAMICLINKING=""
+        JAVACFLAGS=""
+    fi ;;
+*-*-darwin*)
+        JAVADYNAMICLINKING="-dynamiclib -framework JavaVM"
+        JAVACFLAGS=""
+        ;;
+*)
+        JAVADYNAMICLINKING=""
+        JAVACFLAGS=""
+        ;;
+esac
+
+# Java on Windows platforms including Cygwin doesn't use libname.dll, rather name.dll
when loading dlls
+case $host in
+*-*-cygwin* | *-*-mingw*) JAVALIBRARYPREFIX="";;
+*)JAVALIBRARYPREFIX="lib";;
+esac
+
+# Java on Mac OS X tweaks
+case $host in
+*-*-darwin*)
+    JAVASO=".jnilib"
+    JAVALDSHARED='$(CC)'
+    JAVACXXSHARED='$(CXX)'
+    ;;
+*)
+    JAVASO=$SO
+    JAVALDSHARED='$(LDSHARED)'
+    JAVACXXSHARED='$(CXXSHARED)'
+    ;;
+esac
+    JAVA_INC="$JAVAINCDIR"
+    JAVA_BIN="$JAVA_HOME/bin"
+    JAVA_LIB="$JAVAINC/.."
+    JAVAOPTS="-1.6"
+    ;;
   *)
     AC_MSG_WARN([Unknown or unsupported JDK])
     ;;
@@ -80,6 +171,7 @@
 
   JAVAPREFIX="$JAVA_BIN"
 
+  AC_SUBST(JAVAOPTS)
   AC_SUBST(JAVA_BIN)
   AC_SUBST(JAVA_INC)
   AC_SUBST(JAVA_LIB)
@@ -99,6 +191,8 @@
     Apple)
       ac_cv_java_ldflags="-L$JAVA_LIB -lverify -ljvm -framework JavaVM"
       ;;
+    GCI)
+      ac_cv_java_ldflags="-L$JAVA_LIB -lgcj"
     *)
       if test -d "$JAVA_HOME/jre/lib/$host_cpu"; then
         ac_cv_java_ldflags="-L$JAVA_HOME/jre/lib/$host_cpu -ljava -lverify -ljsig"
@@ -117,6 +211,8 @@
         	ac_cv_java_ldflags="$ac_cv_java_ldflags -L$JAVA_LIB/client -ljvm"
     	  elif test -d "$JAVA_LIB/classic"; then
         	ac_cv_java_ldflags="$ac_cv_java_ldflags -L$JAVA_LIB/classic -ljvm"
+          elif test "x$ac_cv_java_style" = "xGCJ" ; then
+                ac_cv_java_ldflags="$ac_cv_java_ldflags $JAVADYNAMICLINKING"
     	  else
             AC_MSG_RESULT([unknown])
             AC_MSG_WARN([Failed to identify your JVM])
@@ -147,7 +243,11 @@
       ac_cv_java_cxxflags="-I$JAVA_INC -I$JAVA_INC/freebsd"
       ;;
     *)
-      ac_cv_java_cxxflags="-I$JAVA_INC"
+      if test "x$ac_cv_java_style" = "xGCJ" ; then 
+        ac_cv_java_cxxflags="-I$JAVA_INC -IJAVAMDDIR $JAVACFLAGS"
+      else
+        ac_cv_java_cxxflags="-I$JAVA_INC"
+      fi
       ;;
     esac
   ])

Thread
Rev 365: Added support for building with gcj. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/develMonty Taylor12 Dec