#!/bin/sh # # 'configure' script for Parenthetcl # # Copyright (c) 2004-2006 Henry Strickland # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # (* http://www.opensource.org/licenses/mit-license.php *) PREFIX=${PREFIX:-/usr/local} TCLSH=${TCLSH:-tclsh8.4} CC=${CC:-gcc} for x do case "$x" in --prefix=* ) PREFIX=`expr "X$x" : 'X--prefix=\(.*\)'` ;; --tclsh=* ) TCLSH=`expr "X$x" : 'X--tclsh=\(.*\)'` ;; --cc=* ) CC=`expr "X$x" : 'X--cc=\(.*\)'` ;; * ) echo "This is a very simple configure script, not the usual one." >&2 echo "The --prefix= option specifies the install location, as usual." >&2 echo "Use --tclsh= and --cc= options to specify your tclsh and gcc commands" >&2 echo "if 'tclsh8.4' and 'gcc' are not correct in your PATH." >&2 echo "" >&2 echo "Usage: $0 --prefix=/usr/local --tclsh=tclsh8.4 --cc=gcc " >&2 echo "" >&2 exit 1 ;; esac done echo " ... prefix = $PREFIX" echo " ... tclsh = $TCLSH" echo " ... cc = $CC" test -d "$PREFIX" || { echo "ERROR: Prefix directory does not exist: $PREFIX" >&2 ; exit 1 ; } $TCLSH &2 ; exit 1 ; } case "$TCLSH" in /* ) # absolute path tclbin=`dirname $TCLSH` TCLROOT=`dirname $tclbin` ;; * ) # relative path tcllib=`echo 'puts [info library]' | $TCLSH` uplib=`dirname $tcllib` TCLROOT=`dirname $uplib` ;; esac echo " ... TCLROOT = $TCLROOT" test ! -z "$TCLROOT" || { echo "ERROR: Empty TCLROOT; try using --tclsh=/path/to/tclsh" >&2 ; exit 1 ; } test -d "$TCLROOT" || { echo "ERROR: TCLROOT does not exist; try using --tclsh=/path/to/tclsh" >&2 ; exit 1 ; } for z in Makefile p7c tests/mk-makefile.sh do echo "Creating $z" >&2 rm -f $z sed -e "s,@CC@,$CC,g" -e "s,@TCLROOT@,$TCLROOT,g" -e "s,@TCLSH@,$TCLSH,g" -e "s,@PREFIX@,$PREFIX,g" < $z.in > $z # so we dont forget and edit the product: chmod -w $z done echo "Creating tests/Makefile" >&2 ( cd tests && rm -f Makefile && sh mk-makefile.sh > Makefile && chmod -w Makefile ) || exit $? chmod +x p7c rm -f .config.sh echo $0 $* > .config.sh echo "" echo "OKAY. Now run make clean all test install" >&2