Browse Source

Another fix to stop infinite loops when detecting javac.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@559 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 18 years ago
parent
commit
dd810cadd3
  1. 22
      prism/Makefile
  2. 26
      prism/src/scripts/findjavac.sh

22
prism/Makefile

@ -77,28 +77,8 @@ endif
# either set the variable yourself by uncommenting and/or modifying one of the lines below # either set the variable yourself by uncommenting and/or modifying one of the lines below
# or pass a value to make directly, e.g.: make JAVA_DIR=/usr/java # or pass a value to make directly, e.g.: make JAVA_DIR=/usr/java
# The detection of javac below can handle cases:
# - where javac is a symbolic link
# - where there is actually a chain of symbolic links
# - where there are relative symbolic links
# - where there are directory names including spaces
# Note: The code would be simpler if we could rely on
# the existence of "readlink -f" but we can't.
# Find javac # Find javac
DETECT_JAVAC = $(shell \
(DETECT_JAVAC=`which javac`; \
if [ -f "$$DETECT_JAVAC" ]; then \
DETECT_JAVAC_DIR=`dirname "$$DETECT_JAVAC"`; \
cd "$$DETECT_JAVAC_DIR"; \
while [ -h ./javac ]; do \
DETECT_JAVAC=`readlink ./javac`; \
DETECT_JAVAC_DIR=`dirname "$$DETECT_JAVAC"`; \
cd "$$DETECT_JAVAC_DIR"; \
DETECT_JAVAC_DIR=`pwd`; \
done; \
echo $$DETECT_JAVAC_DIR/javac; \
fi) 2> /dev/null)
DETECT_JAVAC = $(shell src/findjavac.sh 2> /dev/null)
# Find directory containing javac # Find directory containing javac
ifeq ("$(DETECT_JAVAC)","") ifeq ("$(DETECT_JAVAC)","")

26
prism/src/scripts/findjavac.sh

@ -0,0 +1,26 @@
#!/bin/sh
# The detection of javac below can handle cases:
# - where javac is a symbolic link
# - where there is actually a chain of symbolic links
# - where there are relative symbolic links
# - where some links/files are not called javac (e.g. ecj)
# - where there are directory names including spaces
# Note: The code would be simpler if we could rely on
# the existence of "readlink -f" but we can't.
DETECT_JAVAC=`which javac`
if [ -f "$DETECT_JAVAC" ]; then
DETECT_JAVAC_DIR=`dirname "$DETECT_JAVAC"`
DETECT_JAVAC_EXE=`basename "$DETECT_JAVAC"`
cd "$DETECT_JAVAC_DIR"
while [ -h ./"$DETECT_JAVAC_EXE" ]; do
DETECT_JAVAC=`readlink ./javac`
DETECT_JAVAC_DIR=`dirname "$DETECT_JAVAC"`
DETECT_JAVAC_EXE=`basename "$DETECT_JAVAC"`
cd "$DETECT_JAVAC_DIR"
DETECT_JAVAC_DIR=`pwd`
#pwd
done
echo "$DETECT_JAVAC_DIR"/"$DETECT_JAVAC_EXE"
fi
Loading…
Cancel
Save