Release coccinelle-0.1.10
[bpt/coccinelle.git] / env.sh
diff --git a/env.sh b/env.sh
index 1286178..8ecd651 100644 (file)
--- a/env.sh
+++ b/env.sh
@@ -4,6 +4,8 @@
 
 #!!!!You need to source me with "source env.sh" from the good directory!!!!
 
+# 14 Aug 2009 Try likely locations for support files
+
 if [ "$1" ] ; then
        DIR=$1
 else
@@ -11,9 +13,24 @@ else
 fi
 
 if [ ! -r $DIR/standard.iso ]
-    then echo "There is no standard.iso in '$DIR'. 
-Are you sure you run this script from the coccinelle directory ?
-Alternatively, provide the coccinelle directory as the first argument.
+then
+   if [ -r /usr/local/share/coccinelle/standard.iso ]
+   then
+      echo "standard.iso not found in '$DIR' using /usr/local/share/coccinelle"
+      DIR="/usr/local/share/coccinelle"
+   else
+# The following won't work with "source env.sh" under bash
+      if [ -r `dirname $0`/standard.iso ]
+      then
+         echo "standard.iso not found in '$DIR' using `dirname $0`"
+        DIR=`dirname $0`
+      fi
+   fi
+fi
+
+if [ ! -r $DIR/standard.iso ]
+    then echo "standard.iso not found in '$DIR'. 
+Give its directory as the first argument.
 ";
 else
 
@@ -28,15 +45,16 @@ else
 
 # To find the data/ files such as the default standard.h file.
 # Cf also globals/config.ml
-echo setting COCCINELLE_HOME=${COCCINELLE_HOME:=$DIR}
+echo setting COCCINELLE_HOME=$DIR
+COCCINELLE_HOME=$DIR                           ; export COCCINELLE_HOME
 
 # To find pycaml dynamic library
-echo setting LD_LIBRARY_PATH=${LD_LIBRARY_PATH:=$COCCINELLE_HOME:$LD_LIBRARY_PATH}
+echo adding $COCCINELLE_HOME to LD_LIBRARY_PATH
+LD_LIBRARY_PATH=$COCCINELLE_HOME:$LD_LIBRARY_PATH ; export LD_LIBRARY_PATH
 
 # To find .py files like the one in python/coccib
-echo setting PYTHONPATH=${PYTHONPATH:=$COCCINELLE_HOME/python:$PYTHONPATH}
-
-export COCCINELLE_HOME LD_LIBRARY_PATH PYTHONPATH
+echo adding $COCCINELLE_HOME/python to PYTHONPATH
+PYTHONPATH=$COCCINELLE_HOME/python:PYTHONPATH  ; export PYTHONPATH
 
 fi