# This script discovers various parameters of a GAP installation,
# such as host architecture, location of the GMP library used for GAP,
# compile and link flags, etc., and writes that information to the
# file config.carat, which is then used by the Makefile.
#
# Usage: ./configure [<path to GAP root directory>]
# ./configure [--with-gaproot=<path to GAP root directory>]
# [--with-gmp=<path to GMP installation directory]
#
# The default path to the GAP root directory is ../..
error() { printf "ERROR: %s\n""$@" ; exit 1 ; }
# get hold of $GAPROOT, and possibly $GMPDIR
GMPDIR=
GAPROOT="$(cd ../.. && pwd)"
while [[ "$#" -ge 1 ]]; do
option="$1" ; shift
case "$option" in
--with-gmp=*) GMPDIR="${option#--with-gmp=}"; ;;
--with-gaproot) GAPROOT="$1"; shift; ;;
--with-gaproot=*) GAPROOT="${option#--with-gaproot=}"; ;;
*) GAPROOT="$option"; ;;
esac
done
# we need an absolute path
GAPROOT="$(cd $GAPROOT && pwd)"
# check whether $GAPROOT is valid
if [[ ! -f "$GAPROOT/sysinfo.gap" ]]; then
error "$GAPROOT is not the root of a gap installation (no sysinfo.gap)" \ "Please provide the absolute path of your GAP root directory as" \ "first argument with '--with-gaproot=' to this script."
fi
# read in sysinfo
source "$GAPROOT/sysinfo.gap"
# where is the GMP library?
if test -n "$GMPDIR"; then
# if the user supplied an explicit path to this configure script, use that
: # do nothing
elif test -n "${GMP_PREFIX+1}"; then
# GAP >= 4.12.1 provides GMP_PREFIX, use that
GMPDIR="$GMP_PREFIX"
elif [[ -d "$GAPROOT/extern/install/gmp" ]]; then
# GAP can be built with a bundled GMP; if we see that, use it
# (only works if the user has a self-compiled GAP)
GMPDIR="$GAPROOT/extern/install/gmp"
fi
# if still no GMP, as a final resort scan GAP's config.log file to figure out
# where it found GMP (but this only works if the user self-compiled GAP)
if test -z "$GMPDIR"; then
if [[ -f "$GAPROOT/config.log" ]]; then
for word in $(grep '\-\-with-gmp='"$GAPROOT/config.log"); do
pp="${word#--with-gmp=}"
if [[ "$word" != "$pp" ]]; then
case "$pp" in
yes|no|system|builtin) ;;
*) GMPDIR="$pp"; ;;
esac
fi
done
fi
fi
# GMP directory to hand over to CARAT configure
WITHGMP=
if test -n "$GMPDIR"; then
WITHGMP="--with-gmp=$GMPDIR"
fi
# write out everything, so that we can include it in Makefile
echo "GAPROOT=$GAPROOT" > config.carat
echo "ARCHDIR=$GAParch" >> config.carat
echo "CC=$GAP_CC" >> config.carat
echo "FLAGS=$GAP_CFLAGS $CFLAGS" >> config.carat
echo "WITHGMP=$WITHGMP" >> config.carat
[ zur Elbe Produktseite wechseln0.21Quellennavigators
Analyse erneut starten
]