#!/bin/sh # # $Id$ # . ./config.functions package=rfpc version_major=0 version_minor=0 version_micro=0 version=$version_major.$version_minor.$version_micro install_dir=/usr/local test "$CXX" && cxx="$CXX" || cxx=g++ wflags="-W -Wall" dflags="-g -DDEBUG -DPARANOIA" #oflags="-O0" lgmp="-lgmp" help () { cat < install directory [$install_dir] -cxx path to C++ compiler [$cxx] -gmp_inc directory containing GNU MP headers -gmp_lib directory containing GNU MP library -wflags C++ compiler warning options [$wflags] -dflags debugging options [$dflags] -oflags C++ compiler optimization options [$oflags] -cflags additional C++ compiler options [$cflags] -name shows package name -version shows package version EOF exit 1 } while true; do if [ -z "$1" ]; then break; fi case $1 in -prefix) shift if [ -z "$1" ]; then help; fi install_dir="`absolute_path $1`" ;; -cxx) shift if [ -z "$1" ]; then help; fi cxx="$1" ;; -gmp_inc) shift if [ -z "$1" ]; then help; fi gmp_inc="-I'`absolute_path $1`'" ;; -gmp_lib) shift if [ -z "$1" ]; then help; fi gmp_dir="`absolute_path $1`" gmp_lib="-L'$gmp_dir'" ;; -wflags) shift if [ -z "$1" ]; then help; fi wflags="$1" ;; -dflags) shift if [ -z "$1" ]; then help; fi dflags="$1" ;; -oflags) shift if [ -z "$1" ]; then help; fi oflags="$1" ;; -cflags) shift if [ -z "$1" ]; then help; fi cflags="$1" ;; -name) echo $package exit 0 ;; -version) echo $version exit 0 ;; -help|*) help ;; esac shift done echon "Checking for operating system... " os="`(uname | tr A-Z a-z) 2>/dev/null`" echo "$os" case "$os" in cygwin*) os='cygwin' main_dir='$(TOPDIR)/cygwin/' rfpc='$(TOPDIR)/bootstrap/compiler/rfpc.exe' rfp='ldflags=-Wl,--stack,0x800000 $(TOPDIR)/rfp.sh' exe_suffix='.exe' ;; *) main_dir='$(TOPDIR)' rfpc='$(TOPDIR)/bootstrap/compiler/rfpc' rfp='$(TOPDIR)/rfp.sh' exe_suffix='' ;; esac echon "Checking for working C++ compiler... " cat >cfgtest.cc </dev/null 2>&1" ./cfgtest >/dev/null 2>&1 if [ $? != 0 ]; then echo echo "***" echo "*** Fatal error - $cxx is not working C++ compiler." echo "*** Specify other one with -cxx option." echo "***" exit 1 fi echo $cxx rm -f cfgtest* echo "Checking whether C++ compiler ($cxx)" echon " supports statements inside expressions... " cat >cfgtest.cc </dev/null 2>&1" ./cfgtest >/dev/null 2>&1 if [ $? != 0 ]; then echo no else echo yes cpp_additional="-DRFRT_USE_STATEMENT_EXPR" fi rm -f cfgtest* echon "Checking for gmp library... " if [ -n "$gmp_dir" -a -f "$gmp_dir/libgmp.a" ]; then gmp_lib="" lgmp="$gmp_dir/libgmp.a" fi cat >cfgtest.cc < #include int main(void) { mpz_t i; mpz_init (i); return 0; } EOF eval "$cxx $cflags $gmp_inc $gmp_lib -o cfgtest cfgtest.cc $lgmp >/dev/null 2>&1" ./cfgtest >/dev/null 2>&1 if [ $? != 0 ]; then echo echo "***" echo "*** Error: GNU MP not found, see http://swox.com/gmp" echo "*** If it has been installed to a non-standard location" echo "*** then use -gmp_inc and -gmp_lib options (see configure -h)." echo "***" echo "*** Meanwhile, Refal is configured to work without multiprecision arithmetic." echo "***" cpp_additional="$cpp_additional -DRFRT_WITHOUT_GMP" lgmp="" fi rm -f cfgtest* if [ -n "$lgmp" ]; then cat >cfgtest.cc < #include int main(void) { mpz_t i; mpz_init_set_str (i, "18446744073709551617", 0); if (gmp_printf("%Zd\n", i) == -1) return -1; return 0; } EOF eval "$cxx $cflags $gmp_inc $gmp_lib -o cfgtest cfgtest.cc $lgmp >/dev/null 2>&1" if [ "`./cfgtest`" != "18446744073709551617" ]; then echo echo "***" echo "*** Error: GNU MP is not working." echo "*** Please, install fresh version, see http://swox.com/gmp" echo "*** If it has been installed to a non-standard location" echo "*** then use -gmp_inc and -gmp_lib options (see configure -h)." echo "***" echo "*** Meanwhile, Refal is configured to work without multiprecision arithmetic." echo "***" cpp_additional="$cpp_additional -DRFRT_WITHOUT_GMP" lgmp="" else rm -f cfgtest* echo OK fi fi config_mk=config.mk #subdirs_mk=subdirs.mk if [ -e "$config_mk" ] ; then rm $config_mk fi cat >>$config_mk <rfp.sh <>rfp.sh