# Let the user set an environment variable CFLAG64 to
# indicate the C compiler flag for 64-bit builds. By
# default this will be -m64. IBM's compiler on AIX
# and HP's on HP-UX do NOT use -m64.
if [ -z "$CFLAG64" ] ; then
    CFLAG64=-m64
fi

# There is no C++ code in GSL, so no need to do likewise
# with CXXFLAG64.
if [ "$SAGE64" = "yes" ]; then
    echo "Building a 64-bit version of the GNU Scientific Library (GSL)"
    CFLAGS="$CFLAGS $CFLAG64"
    CPPFLAGS="$CPPFLAGS $CFLAG64" ; export CPPFLAGS
    LDFLAGS="$LDFLAGS $CFLAG64" ; export LDFLAGS
fi

if [ "$SAGE_DEBUG" = "yes" ] ; then
    CFLAGS="-g -O0 $CFLAGS" # No optimisation, aids debugging.
else
    CFLAGS="-g -O2 $CFLAGS" # Normal optimisation.
fi

export CFLAGS

cd src

sdh_configure LIBS="`pkg-config --libs-only-l cblas` -lm"
sdh_make
sdh_make_install
