arb/configure

143 lines
3.7 KiB
Text
Raw Normal View History

2012-04-05 15:57:19 +02:00
#!/bin/sh
# (C) 2007, Robert Bradshaw, William Hart, William Stein, Michael Abshoff
# (C) 2011, William Hart
PREFIX="/usr/local"
MPIR_DIR="/usr/local"
MPFR_DIR="/usr/local"
FLINT_DIR="/home/fredrik/src/flint2/flint2"
2012-04-05 15:57:19 +02:00
SHARED=1
STATIC=1
usage()
{
echo "Usage: ./configure <options> <args>"
echo " where <options> may be"
echo " -h display usage information"
echo " where <args> may be:"
echo " --with-mpir=<path> Specify location of MPIR"
echo " --with-mpfr=<path> Specify location of MPFR"
echo " --prefix=<path> Specify path to installation location"
echo " --disable-shared Do not build a shared library"
echo " --disable-static Do not build a static library"
echo " CC=<name> Use the C compiler with the given name"
echo " AR=<name> Use the AR library builder with the given name"
echo " CFLAGS=<flags> Pass the given flags to the compiler"
}
until [ -z "$1" ]; do
case $1 in
"-h") usage
exit 0
;;
"--with-mpir="*)
MPIR_DIR=`expr substr $1 13 length $1`
;;
"--with-mpfr="*)
MPFR_DIR=`expr substr $1 13 length $1`
;;
"--prefix="*)
PREFIX=`expr substr $1 10 length $1`
;;
"--disable-shared")
SHARED=0
;;
"--disable-static")
STATIC=0
;;
"AR="*)
AR=`expr substr $1 4 length $1`
;;
"CC="*)
CC=`expr substr $1 4 length $1`
;;
"CFLAGS="*)
CFLAGS=`expr substr $1 8 length $1`
;;
*) usage
exit 1
;;
esac
shift
done
if [ -d "${MPIR_DIR}/lib" ]; then
MPIR_LIB_DIR="${MPIR_DIR}/lib"
MPIR_INCLUDE_DIR="${MPIR_DIR}/include"
elif [ -d "${MPIR_DIR}/.libs" ]; then
MPIR_LIB_DIR="${MPIR_DIR}/.libs"
MPIR_INCLUDE_DIR="${MPIR_DIR}"
else
echo "Invalid MPIR directory"
exit 1
fi
if [ -d "${MPFR_DIR}/lib" ]; then
MPFR_LIB_DIR="${MPFR_DIR}/lib"
MPFR_INCLUDE_DIR="${MPFR_DIR}/include"
elif [ -d "${MPFR_DIR}/.libs" ]; then
MPFR_LIB_DIR="${MPFR_DIR}/.libs"
MPFR_INCLUDE_DIR="${MPFR_DIR}"
else
echo "Invalid MPFR directory"
exit 1
fi
FLINT_LIB_DIR="${FLINT_DIR}"
FLINT_INCLUDE_DIR="${FLINT_DIR}"
if [ "`uname`" = "Linux" -a "`uname -m`" = "x86_64" ]; then
ARB_TUNE="-funroll-loops "
elif [ "`uname`" = "Darwin" -a "`uname -m`" = "Power Macintosh" ]; then
ARB_TUNE=" -funroll-loops "
elif [ "`uname -p`" = "powerpc" ]; then
ARB_TUNE="-m64 -mcpu=970 -mtune=970 -mpowerpc64 -falign-loops=16 -falign-functions=16 -falign-labels=16 -falign-jumps=16"
elif [ "`uname -m`" = "ia64" ]; then
# -funroll-loops crashes the build on itanium under GCC-4.2.1, as reported by
# Kate Minola.
ARB_TUNE=" "
else
ARB_TUNE="-funroll-loops "
fi
if [ "`uname`" = "Darwin" ]; then
ARB_LIB="libarb.dylib"
else
ARB_LIB="libarb.so"
fi
if [ -z "$CFLAGS" ]; then
CFLAGS="-O2 -g -ansi -pedantic -Wall"
fi
if [ -z "$CC" ]; then
CC=gcc
fi
CFLAGS="$CFLAGS $ARB_TUNE"
echo "# This file is autogenerated by ./configure -- do not edit!" > Makefile
echo "" >> Makefile
if [ "$STATIC" = "1" ]; then
echo "ARB_STATIC=1" >> Makefile
fi
if [ "$SHARED" = "1" ]; then
echo "ARB_SHARED=1" >> Makefile
fi
echo "ARB_MPIR_LIB_DIR=$MPIR_LIB_DIR" >> Makefile
echo "ARB_MPIR_INCLUDE_DIR=$MPIR_INCLUDE_DIR" >> Makefile
echo "ARB_MPFR_LIB_DIR=$MPFR_LIB_DIR" >> Makefile
echo "ARB_MPFR_INCLUDE_DIR=$MPFR_INCLUDE_DIR" >> Makefile
echo "ARB_FLINT_LIB_DIR=$FLINT_LIB_DIR" >> Makefile
echo "ARB_FLINT_INCLUDE_DIR=$FLINT_INCLUDE_DIR" >> Makefile
echo "" >> Makefile
echo "ARB_LIB=$ARB_LIB" >> Makefile
echo "CC=$CC" >> Makefile
echo "CFLAGS=$CFLAGS" >> Makefile
echo "PREFIX=$PREFIX" >> Makefile
echo "" >> Makefile
cat Makefile.in >> Makefile