jdk/make/common/shared/Defs.gmk
changeset 3112 541955f1e5fa
parent 3111 fefdeafb7ab9
parent 2806 27edf81ff967
child 3288 db82a42da273
--- a/jdk/make/common/shared/Defs.gmk	Fri Jun 12 14:56:32 2009 -0400
+++ b/jdk/make/common/shared/Defs.gmk	Mon Jun 15 13:08:29 2009 -0400
@@ -94,6 +94,21 @@
   fi)
 endef
 
+# Select a directory if it exists, or the alternate 2, or the alternate 3, or the alternate 4
+define DirExists4
+$(shell \
+  if [ -d "$1" ]; then  \
+    echo "$1"; \
+  elif [ -d "$2" ]; then \
+    echo "$2"; \
+  elif [ -d "$3" ]; then \
+    echo "$3"; \
+  else \
+    echo "$4"; \
+  fi)
+endef
+
+
 # Select a writable directory if it exists and is writable, or the alternate
 define WriteDirExists
 $(shell \
@@ -357,10 +372,15 @@
 
 # BOOTDIR: Bootstrap JDK, previous released JDK.
 #   _BOOTDIR1 and _BOOTDIR2 picked by platform
+#   Platform may optionally define _BOOTDIR3 as well.
 ifdef ALT_BOOTDIR
   BOOTDIR =$(ALT_BOOTDIR)
 else
-  BOOTDIR  :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR)
+  ifdef _BOOTDIR3
+    BOOTDIR  :=$(call DirExists4,$(_BOOTDIR1),$(_BOOTDIR2),$(_BOOTDIR3),/NO_BOOTDIR)
+  else
+    BOOTDIR  :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR)
+  endif
 endif
 export BOOTDIR
 BOOTDIR:=$(call AltCheckSpaces,BOOTDIR)