# Only build iconv on Solaris, HP-UX and Cygwin. See
#     http://trac.sagemath.org/sage_trac/ticket/8567 and
#     http://trac.sagemath.org/sage_trac/ticket/9603
# for details.

case "$UNAME" in
CYGWIN|HP-UX|SunOS)
    echo "iconv will be installed as the operating system is Cygwin, HP-UX or Solaris."
    echo "These systems either lack iconv, or do not have a sufficiently capable"
    echo "version of iconv. See:"
    echo "    http://trac.sagemath.org/sage_trac/ticket/8567"
    echo "    http://trac.sagemath.org/sage_trac/ticket/9603"

    # Disable NLS on Cygwin to be able to build libiconv without the Cygwin
    # libiconv package.
    if [ "$UNAME" = "CYGWIN" ]; then
        ICONV_CONFIGURE="--disable-nls $ICONV_CONFIGURE"
    fi

    cd src

    sdh_configure $ICONV_CONFIGURE
    sdh_make
    sdh_make_install
    exit 0
    ;;
*)  # Not CYGWIN, HP-UX or SunOS (Solaris)
    echo "iconv will not be installed, as we only need to build it on"
    echo "Solaris, HP-UX and Cygwin, as the system's iconv will be used"
    echo "on other platforms, rather than the one shipped with Sage."
    echo "See:"
    echo "    http://trac.sagemath.org/sage_trac/ticket/8567"
    echo "    http://trac.sagemath.org/sage_trac/ticket/9603"
    exit 0
esac

# NOT REACHED
