commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1194902 - in /commons/proper/daemon/trunk/src/native/unix: Makedefs.in configure.in support/apjava.m4 support/apsupport.m4
Date Sat, 29 Oct 2011 15:19:18 GMT
Author: mturk
Date: Sat Oct 29 15:19:18 2011
New Revision: 1194902

URL: http://svn.apache.org/viewvc?rev=1194902&view=rev
Log:
DAEMON-220, DAEMON-223 Cleanup configure system. Axe archaic JVM's and improove JVM detection

Modified:
    commons/proper/daemon/trunk/src/native/unix/Makedefs.in
    commons/proper/daemon/trunk/src/native/unix/configure.in
    commons/proper/daemon/trunk/src/native/unix/support/apjava.m4
    commons/proper/daemon/trunk/src/native/unix/support/apsupport.m4

Modified: commons/proper/daemon/trunk/src/native/unix/Makedefs.in
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/Makedefs.in?rev=1194902&r1=1194901&r2=1194902&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/Makedefs.in (original)
+++ commons/proper/daemon/trunk/src/native/unix/Makedefs.in Sat Oct 29 15:19:18 2011
@@ -19,14 +19,11 @@
 # @version $Id$
 
 CC = @CC@
-JAVAC = @JAVAC@
-JAR = @JAR@
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CPPFLAGS@
 INCLUDES = @INCLUDES@
 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
-JAVACFLAGS = @JAVACFLAGS@
 RANLIB = @RANLIB@
 LDCMD = @LDCMD@
 STRIP = @STRIP@

Modified: commons/proper/daemon/trunk/src/native/unix/configure.in
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/configure.in?rev=1194902&r1=1194901&r2=1194902&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/configure.in (original)
+++ commons/proper/daemon/trunk/src/native/unix/configure.in Sat Oct 29 15:19:18 2011
@@ -80,13 +80,20 @@ dnl ------------------------------------
 dnl Check JAVA environment
 dnl -------------------------------------------------------------------------
 AP_MSG_HEADER([Java compilation tools])
-AP_JAVA()
-AP_SABLEVM()
-AP_KAFFE()
-AP_PROG_JAVAC()
-AP_PROG_JAR()
-if test "$supported_os" != "darwin"
+AP_FIND_JAVA()
+dnl MAC OS X does not used include but Headers
+if test -d $JAVA_HOME/Headers
 then
+  JAVA_INC=Headers
+else
+  JAVA_INC=include
+fi
+AP_FIND_JAVA_OS()
+if test -z "${JAVA_OS}"
+then
+  AC_MSG_RESULT([jni_md.h found in $JAVA_HOME/$JAVA_INC])
+  INCLUDES="$INCLUDES -I$JAVA_HOME/include -I$JAVA_HOME/$JAVA_INC"
+else
   INCLUDES="$INCLUDES -I$JAVA_HOME/include -I$JAVA_HOME/include/$supported_os"
 fi
 

Modified: commons/proper/daemon/trunk/src/native/unix/support/apjava.m4
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/support/apjava.m4?rev=1194902&r1=1194901&r2=1194902&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/support/apjava.m4 (original)
+++ commons/proper/daemon/trunk/src/native/unix/support/apjava.m4 Sat Oct 29 15:19:18 2011
@@ -16,76 +16,12 @@ dnl limitations under the License.
 dnl
 
 dnl -------------------------------------------------------------------------
-dnl Author  Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
+dnl Author  Pier Fumagalli
+dnl Author  Mladen Turk
 dnl Version $Id$
 dnl -------------------------------------------------------------------------
 
-AC_DEFUN([AP_PROG_JAVAC_WORKS],[
-  AC_CACHE_CHECK([wether the Java compiler ($JAVAC) works],ap_cv_prog_javac_works,[
-    echo "public class Test {}" > Test.java
-    $JAVAC $JAVACFLAGS Test.java > /dev/null 2>&1
-    if test $? -eq 0
-    then
-      rm -f Test.java Test.class
-      ap_cv_prog_javac_works=yes
-    else
-      rm -f Test.java Test.class
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([installation or configuration problem: javac cannot compile])
-    fi
-  ])
-])
-
-dnl Check for JAVA compilers.
-AC_DEFUN([AP_PROG_JAVAC],[
-  if test "$SABLEVM" != "NONE"
-  then
-    AC_PATH_PROG(JAVACSABLE,javac-sablevm,NONE,$JAVA_HOME/bin)
-  else
-    JAVACSABLE="NONE"
-  fi
-  if test "$JAVACSABLE" = "NONE"
-  then
-    XPATH="$JAVA_HOME/bin:$JAVA_HOME/Commands:$PATH"
-    AC_PATH_PROG(JAVAC,javac,NONE,$XPATH)
-  else
-    AC_PATH_PROG(JAVAC,javac-sablevm,NONE,$JAVA_HOME/bin)
-  fi
-  AC_MSG_RESULT([$JAVAC])
-  if test "$JAVAC" = "NONE"
-  then
-    AC_MSG_ERROR([javac not found])
-  fi
-  AP_PROG_JAVAC_WORKS()
-  AC_PROVIDE([$0])
-  AC_SUBST(JAVAC)
-  AC_SUBST(JAVACFLAGS)
-])
-
-dnl Check for jar archivers.
-AC_DEFUN([AP_PROG_JAR],[
-  if test "$SABLEVM" != "NONE"
-  then
-    AC_PATH_PROG(JARSABLE,jar-sablevm,NONE,$JAVA_HOME/bin)
-  else
-    JARSABLE="NONE"
-  fi
-  if test "$JARSABLE" = "NONE"
-  then
-    XPATH="$JAVA_HOME/bin:$JAVA_HOME/Commands:$PATH"
-    AC_PATH_PROG(JAR,jar,NONE,$XPATH)
-  else
-    AC_PATH_PROG(JAR,jar-sablevm,NONE,$JAVA_HOME/bin)
-  fi
-  if test "$JAR" = "NONE"
-  then
-    AC_MSG_ERROR([jar not found])
-  fi
-  AC_PROVIDE([$0])
-  AC_SUBST(JAR)
-])
-
-AC_DEFUN([AP_JAVA],[
+AC_DEFUN([AP_FIND_JAVA],[
   AC_ARG_WITH(java,[  --with-java=DIR         Specify the location of your JDK installation],[
     AC_MSG_CHECKING([JAVA_HOME])
     if test -d "$withval"
@@ -98,45 +34,100 @@ AC_DEFUN([AP_JAVA],[
     fi
     AC_SUBST(JAVA_HOME)
   ])
-  if test x"$JAVA_HOME" = x
-  then
-    AC_MSG_ERROR([Java Home not defined. Rerun with --with-java=[...] parameter])
-  fi
-])
-
-dnl check if the JVM in JAVA_HOME is sableVM
-dnl $JAVA_HOME/bin/sablevm and /opt/java/lib/sablevm/bin are tested.
-AC_DEFUN([AP_SABLEVM],[
-  if test x"$JAVA_HOME" != x
+  if test "x$JAVA_HOME" = x
   then
-    AC_PATH_PROG(SABLEVM,sablevm,NONE,$JAVA_HOME/bin)
-    if test "$SABLEVM" = "NONE"
+    AC_MSG_CHECKING([for JDK location])
+    # Oh well, nobody set JAVA_HOME, have to guess
+    # Check if we have java in the PATH.
+    java_prog="`which java 2>/dev/null || true`"
+    if test "x$java_prog" != x
     then
-      dnl java may be SableVM.
-      if $JAVA_HOME/bin/java -version 2> /dev/null | grep SableVM > /dev/null
+      java_bin="`dirname $java_prog`"
+      java_top="`dirname $java_bin`"
+      if test -d "$java_top/include"
       then
-        SABLEVM=$JAVA_HOME/bin/java
+        JAVA_HOME="$java_top"
+        AC_MSG_RESULT([${java_top}])
       fi
     fi
-    if test "$SABLEVM" != "NONE"
-    then
-      AC_MSG_RESULT([Using sableVM: $SABLEVM])
-      CFLAGS="$CFLAGS -DHAVE_SABLEVM"
-    fi
+  fi
+  if test "x$JAVA_HOME" = x
+  then
+    # Oh well, nobody set JAVA_HOME, have to guess
+    for java_prefix in /usr/local /usr/local/lib /usr /usr/lib /usr/lib/jvm /opt /usr/java
/System/Library/Frameworks/JavaVM.framework/Versions/
+    do
+      for subversion in 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2
+      do
+        for variant in IBMJava2- java java- jdk jdk-
+        do
+          for guess in $java_prefix/$variant$subversion*
+          do
+            if test -d "${guess}/bin" & test -d "${guess}/include"
+            then
+              JAVA_HOME="${guess}"
+              AC_MSG_RESULT([${guess}])
+              break
+            fi
+            if test -d "${guess}/Commands" & test -d "${guess}/Headers"
+            then
+              JAVA_HOME="$guess"
+              AC_MSG_RESULT([${guess}])
+              break
+            fi
+          done
+          if test -n "$JAVA_HOME"
+          then
+            break;
+          fi
+        done
+        if test -n "$JAVA_HOME"
+        then
+          break;
+        fi
+      done
+      if test -n "$JAVA_HOME"
+      then
+        break;
+      fi
+    done
+  fi  
+  if test x"$JAVA_HOME" = x
+  then
+    AC_MSG_ERROR([Java Home not defined. Rerun with --with-java=[...] parameter])
   fi
 ])
 
-dnl check if the JVM in JAVA_HOME is kaffe
-dnl $JAVA_HOME/bin/kaffe is tested.
-AC_DEFUN([AP_KAFFE],[
-  if test x"$JAVA_HOME" != x
-  then
-    AC_PATH_PROG(KAFFEVM,kaffe,NONE,$JAVA_HOME/bin)
-    if test "$KAFFEVM" != "NONE"
+AC_DEFUN([AP_FIND_JAVA_OS],[
+  tempval=""
+  JAVA_OS=""
+  AC_ARG_WITH(os-type,[  --with-os-type[=SUBDIR]   Location of JDK os-type subdirectory.],
+  [
+    tempval=$withval
+    if test ! -d "$JAVA_HOME/$tempval"
     then
-      AC_MSG_RESULT([Using kaffe: $KAFFEVM])
-      CFLAGS="$CFLAGS -DHAVE_KAFFEVM"
-      LDFLAGS="$LDFLAGS -Wl,-rpath $JAVA_HOME/jre/lib/$HOST_CPU -L $JAVA_HOME/jre/lib/$HOST_CPU
-lkaffevm"
+      AC_MSG_ERROR(Not a directory: ${JAVA_HOME}/${tempval})
     fi
-  fi
+    JAVA_OS=$tempval
+  ],
+  [
+    AC_MSG_CHECKING(for JDK os include directory)
+    JAVA_OS=NONE
+    if test -f $JAVA_HOME/$JAVA_INC/jni_md.h
+    then
+      JAVA_OS=""
+    else
+      for f in $JAVA_HOME/$JAVA_INC/*/jni_md.h
+      do
+        if test -f $f; then
+            JAVA_OS=`dirname $f`
+            JAVA_OS=`basename $JAVA_OS`
+            echo " $JAVA_OS"
+        fi
+      done
+      if test "x$JAVA_OS" = "xNONE"; then
+        AC_MSG_RESULT(Cannot find jni_md.h in ${JAVA_HOME}/${OS})
+        AC_MSG_ERROR(You should retry --with-os-type=SUBDIR)
+      fi
+    fi
+  ])
 ])

Modified: commons/proper/daemon/trunk/src/native/unix/support/apsupport.m4
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/support/apsupport.m4?rev=1194902&r1=1194901&r2=1194902&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/support/apsupport.m4 (original)
+++ commons/proper/daemon/trunk/src/native/unix/support/apsupport.m4 Sat Oct 29 15:19:18 2011
@@ -64,6 +64,7 @@ AC_DEFUN(AP_SUPPORTED_HOST,[
     CFLAGS="$CFLAGS -pthread -DOS_HPUX -DDSO_DLFCN"
     LDFLAGS="$LDFLAGS -pthread"
     LIBS="$LIBS -lpthread"
+    supported_os="hp-ux"
     ;;
   aix5*)
     CFLAGS="$CFLAGS -DOS_AIX -DDSO_DLFCN"
@@ -104,11 +105,9 @@ AC_DEFUN(AP_SUPPORTED_HOST,[
     HOST_CPU=alpha;;
   hppa2.0w)
     CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0W\\\""
-    supported_os="hp-ux"
     HOST_CPU=PA_RISC2.0W;;
   hppa2.0)
     CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0\\\""
-    supported_os="hp-ux"
     HOST_CPU=PA_RISC2.0;;
   mipsel)
     CFLAGS="$CFLAGS -DCPU=\\\"mipsel\\\""
@@ -116,7 +115,6 @@ AC_DEFUN(AP_SUPPORTED_HOST,[
     HOST_CPU=mipsel;;
   ia64)
     CFLAGS="$CFLAGS -DCPU=\\\"ia64\\\""
-    supported_os="ia64"
     HOST_CPU=ia64;;
   s390)
     CFLAGS="$CFLAGS -DCPU=\\\"s390\\\""



Mime
View raw message