On 05/12/10 23:05, Wols Lists wrote:
> Another configure to test ...
>
Cheers,
Wol
>From 456c58cc44c68978facbdbc57e680758705a337c Mon Sep 17 00:00:00 2001
From: Wol <anth...@youngman.org.uk>
Date: Mon, 6 Dec 2010 00:27:16 +0000
Subject: [PATCH] Fix configure to work on gentoo

---
 configure.in |   79 +++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 45 insertions(+), 34 deletions(-)

diff --git a/configure.in b/configure.in
index d875950..09b7135 100644
--- a/configure.in
+++ b/configure.in
@@ -3673,9 +3673,51 @@ if test "$SOLAR_JAVA" != ""; then
 fi
 
 if test "$SOLAR_JAVA" != ""; then
-    dnl first check if we have been asked to autodetect JAVA_HOME with a 
recent gij
-    if test "$JDK" = "gcj" -a -z "$JAVA_HOME"; then
-      if test "x$with_jdk_home" = "x" -a "$_gij_longver" -ge "40200"; then
+
+echo '$JAVA_HOME '$JAVA_HOME
+
+      # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
+      if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
+
+         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 
2>/dev/null; then
+          # try to recover first by looking whether we have a alternatives
+          # system as in Debian or newer SuSEs where following /usr/bin/javac
+          # over /etc/alternatives/javac leads to the right bindir where we
+          # just need to strip a bit away to get a valid JAVA_HOME
+            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
+         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
+            # maybe only one level of symlink (e.g. on Mac)
+            JAVA_HOME=$(readlink $JAVACOMPILER)
+            if test "$(dirname $JAVA_HOME)" = "."; then
+              # we've got no path to trim back
+              JAVA_HOME=""
+            fi
+         else
+          # else warn
+          AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be 
incorrect])
+          AC_MSG_WARN([if this is the case, please inform the correct 
JAVA_HOME with --with-jdk-home])
+          echo "JAVA_HOME is set to /usr - this is very likely to be 
incorrect" >> warn
+          echo "if this is the case, please inform the correct JAVA_HOME with 
--with-jdk-home" >> warn
+          fi
+         dnl now that we have the path to the real javac, make a JAVA_HOME out 
of it..
+         if test "$JAVA_HOME" != "/usr"; then
+            if test "$_os" = "Darwin"; then
+               dnl Leopard returns a non-suitable path with readlink - points 
to "Current" only
+               JAVA_HOME=$(echo $JAVA_HOME | $SED -e 
s,/Current/Commands/javac$,/CurrentJDK/Home,)
+               dnl Tiger already returns a JDK path..
+               JAVA_HOME=$(echo $JAVA_HOME | $SED -e 
s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
+            else
+               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
+            fi
+         fi
+      fi
+      # as we drop out of this, JAVA_HOME may have been set to the empty 
string by readlink
+
+#    dnl first check if we have been asked to autodetect JAVA_HOME with a 
recent gij
+echo '$JAVA_HOME '$JAVA_HOME
+    dnl now if JAVA_HOME has been set to empty, then call findhome to find it
+    if test -z "$JAVA_HOME"; then
+      if test "x$with_jdk_home" = "x"; then
         cat > findhome.java <<_ACEOF
 [import java.io.File;
 
@@ -3716,37 +3758,6 @@ _ACEOF
 
     dnl second sanity check JAVA_HOME if possible
     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
-      # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
-      if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
-
-         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 
2>/dev/null; then
-          # try to recover first by looking whether we have a alternatives
-          # system as in Debian or newer SuSEs where following /usr/bin/javac
-          # over /etc/alternatives/javac leads to the right bindir where we
-          # just need to strip a bit away to get a valid JAVA_HOME
-            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
-         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
-            # maybe only one level of symlink (e.g. on Mac)
-            JAVA_HOME=$(readlink $JAVACOMPILER)
-         else
-          # else warn
-          AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be 
incorrect])
-          AC_MSG_WARN([if this is the case, please inform the correct 
JAVA_HOME with --with-jdk-home])
-          echo "JAVA_HOME is set to /usr - this is very likely to be 
incorrect" >> warn
-          echo "if this is the case, please inform the correct JAVA_HOME with 
--with-jdk-home" >> warn
-          fi
-         dnl now that we have the path to the real javac, make a JAVA_HOME out 
of it..
-         if test "$JAVA_HOME" != "/usr"; then
-            if test "$_os" = "Darwin"; then
-               dnl Leopard returns a non-suitable path with readlink - points 
to "Current" only
-               JAVA_HOME=$(echo $JAVA_HOME | $SED -e 
s,/Current/Commands/javac$,/CurrentJDK/Home,)
-               dnl Tiger already returns a JDK path..
-               JAVA_HOME=$(echo $JAVA_HOME | $SED -e 
s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
-            else
-               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
-            fi
-         fi
-      fi
       # now check if $JAVA_HOME is really valid
       if test "$_os" = "Darwin"; then
          if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
-- 
1.7.2.2

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to