#!/bin/sh # (C) 2007, Robert Bradshaw, William Hart, William Stein, Michael Abshoff # (C) 2011, William Hart PREFIX="/usr/local" GMP_DIR="/usr/local" MPFR_DIR="/usr/local" FLINT_DIR="/usr/local" SHARED=1 STATIC=1 usage() { echo "Usage: ./configure " echo " where may be" echo " -h display usage information" echo " where may be:" echo " --with-gmp= Specify location of GMP" echo " --with-mpfr= Specify location of MPFR" echo " --with-flint= Specify location of FLINT" echo " --prefix= 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= Use the C compiler with the given name" echo " AR= Use the AR library builder with the given name" echo " CFLAGS= Pass the given flags to the compiler" } until [ -z "$1" ]; do case $1 in "-h") usage exit 0 ;; "--with-gmp="*) GMP_DIR=`expr substr $1 13 length $1` ;; "--with-mpfr="*) MPFR_DIR=`expr substr $1 13 length $1` ;; "--with-flint="*) FLINT_DIR=`expr substr $1 14 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 "${GMP_DIR}/lib" ]; then GMP_LIB_DIR="${GMP_DIR}/lib" GMP_INCLUDE_DIR="${GMP_DIR}/include" elif [ -d "${MPIR_DIR}/.libs" ]; then GMP_LIB_DIR="${MPIR_DIR}/.libs" GMP_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 if [ -d "${FLINT_DIR}/lib" ]; then FLINT_LIB_DIR="${FLINT_DIR}/lib" FLINT_INCLUDE_DIR="${FLINT_DIR}/include" elif [ -d "${FLINT_DIR}/.libs" ]; then FLINT_LIB_DIR="${FLINT_DIR}/.libs" FLINT_INCLUDE_DIR="${FLINT_DIR}" elif [ -e "${FLINT_DIR}/flint.h" ]; then FLINT_LIB_DIR="${FLINT_DIR}" FLINT_INCLUDE_DIR="${FLINT_DIR}" else echo "${FLINT_DIR}" echo "Invalid FLINT directory?" exit 1 fi if [ -d "${FLINT_INCLUDE_DIR}/flint" ]; then FLINT_INCLUDE_DIR="${FLINT_INCLUDE_DIR}/flint" fi 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_GMP_LIB_DIR=$GMP_LIB_DIR" >> Makefile echo "ARB_GMP_INCLUDE_DIR=$GMP_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