# Normally for a 64-bit build, the -m64 option is added to
# gcc, but other compilers will not accept that, so
# allow it to be configured as something different if need
# be.

if [ -z $CFLAG64 ] ; then
    CFLAG64=-m64
fi

if [ "x$SAGE64" = xyes ]; then
    echo "64 bit build of cddlib"
    CFLAGS="$CFLAGS $CFLAG64"; export CFLAGS
fi
export CPPFLAGS="-I$SAGE_LOCAL/include $CPPFLAGS"

cd src

# A portable random number generator
cp ../patches/random.{c,h} lib-src/
cp ../patches/random.{c,h} lib-src-gmp/

# Required by sage.geometry.polyhedron
cp ../patches/cdd_both_reps.c src/
cp ../patches/cdd_both_reps.c src-gmp/cdd_both_reps.c

# Use newer version of config.guess and config.sub (see Trac #19718)
cp "$SAGE_ROOT"/config/config.* .

sdh_configure
sdh_make
sdh_make_install
