lib/scripts/getsettings
author wenzelm
Thu Dec 27 16:44:29 2001 +0100 (2001-12-27)
changeset 12598 fa556d3fe5f2
parent 11553 87b585079d01
child 14981 e73f8140af78
permissions -rw-r--r--
warn for spaces in ISABELLE_HOME;
wenzelm@11553
     1
# -*- shell-script -*-
wenzelm@2307
     2
# $Id$
wenzelm@9789
     3
# Author: Markus Wenzel, TU Muenchen
wenzelm@9789
     4
# License: GPL (GNU GENERAL PUBLIC LICENSE)
wenzelm@2299
     5
#
wenzelm@2348
     6
# getsettings - bash source script to augment current env.
wenzelm@2299
     7
#
wenzelm@2299
     8
wenzelm@7770
     9
if [ -z "$ISABELLE_SETTINGS_PRESENT" ]
wenzelm@7770
    10
then
wenzelm@7770
    11
wenzelm@3185
    12
set -o allexport
wenzelm@3185
    13
wenzelm@7770
    14
ISABELLE_SETTINGS_PRESENT=true
wenzelm@7770
    15
wenzelm@2736
    16
#normalize ISABELLE_HOME as passed by caller
wenzelm@9789
    17
ISABELLE_HOME=$(cd "$ISABELLE_HOME"; echo "$PWD")
wenzelm@12598
    18
if { echo -n "$ISABELLE_HOME" | fgrep " " >/dev/null; }
wenzelm@12598
    19
then
wenzelm@12598
    20
  echo 1>&2 "### White space in ISABELLE_HOME may cause strange problems later on!"
wenzelm@12598
    21
  echo 1>&2 "### ISABELLE_HOME=\"$ISABELLE_HOME\""
wenzelm@12598
    22
fi
wenzelm@2736
    23
wenzelm@11553
    24
#key executables
wenzelm@11553
    25
ISABELLE="$ISABELLE_HOME/bin/isabelle-process"
wenzelm@9789
    26
ISATOOL="$ISABELLE_HOME/bin/isatool"
wenzelm@2299
    27
wenzelm@2643
    28
#users tend to put strange things in here ...
wenzelm@2621
    29
unset ENV
wenzelm@2621
    30
unset BASH_ENV
wenzelm@2621
    31
wenzelm@9680
    32
#support easy settings
wenzelm@9680
    33
function choosefrom ()
wenzelm@9680
    34
{
wenzelm@9680
    35
  local RESULT=""
wenzelm@9680
    36
  local FILE=""
wenzelm@9680
    37
wenzelm@9680
    38
  for FILE in "$@"
wenzelm@9680
    39
  do
wenzelm@9680
    40
    [ -z "$RESULT" -a -e "$FILE" ] && RESULT="$FILE"
wenzelm@9680
    41
  done
wenzelm@9680
    42
wenzelm@9680
    43
  [ -z "$RESULT" ] && RESULT="$FILE"
wenzelm@9680
    44
  echo "$RESULT"
wenzelm@9680
    45
}
wenzelm@9680
    46
wenzelm@2643
    47
#get actual settings
wenzelm@9789
    48
. "$ISABELLE_HOME/etc/settings" || exit 2
wenzelm@9227
    49
ISABELLE_SITE_SETTINGS_PRESENT=true
wenzelm@9789
    50
wenzelm@9789
    51
[ "$ISABELLE_HOME" -ef "$ISABELLE_HOME_USER" ] && \
wenzelm@9789
    52
  { echo >&2 "### ISABELLE_HOME and ISABELLE_HOME_USER should not be the same directory!"; }
wenzelm@9789
    53
[ -f "$ISABELLE_HOME_USER/etc/settings" ] && . "$ISABELLE_HOME_USER/etc/settings"
wenzelm@2299
    54
wenzelm@6413
    55
#append ML system identifier to paths
wenzelm@6413
    56
if [ -z "$ML_PLATFORM" ]; then
wenzelm@6413
    57
  ML_IDENTIFIER="$ML_SYSTEM"
wenzelm@6413
    58
else
wenzelm@6413
    59
  ML_IDENTIFIER="${ML_SYSTEM}_${ML_PLATFORM}"
wenzelm@6413
    60
fi
wenzelm@6413
    61
ISABELLE_OUTPUT="$ISABELLE_OUTPUT/$ML_IDENTIFIER"
wenzelm@3118
    62
wenzelm@2299
    63
set +o allexport
wenzelm@7770
    64
wenzelm@7770
    65
fi