#! /bin/sh -e

# DP: Adjust libjava extra_ldflags for armel.

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        cd ${dir}libjava && autoconf
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        rm -f ${dir}libjava/configure
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

--- libjava/configure.ac~	2008-01-14 15:45:26.698717101 +0100
+++ libjava/configure.ac	2008-01-14 15:47:37.460689616 +0100
@@ -807,7 +807,7 @@
     # Some of the ARM unwinder code is actually in libstdc++.  We
     # could in principle replicate it in libgcj, but it's better to
     # have a dependency on libstdc++.
-    extra_ldflags='-L$(here)/../libstdc++-v3/src/.libs -lstdc++'
+    extra_ldflags='-L$(here)/../libstdc++-v3/src -L$(here)/../libstdc++-v3/src/.libs -lstdc++'
     LIBSTDCXXSPEC=-lstdc++
     LIBGCJTESTSPEC="-L`${PWDCMD-pwd}`/.libs -L`${PWDCMD-pwd}`/../libstdc++-v3/src/.libs -rpath `${PWDCMD-pwd}`/.libs:`${PWDCMD-pwd}`/../libstdc++-v3/src/.libs -lstdc++"
     ;;
