#! /bin/sh -e

# DP: build libffi without building libgcj

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
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

--- configure.in.old	2004-06-26 07:01:06.000000000 +0200
+++ configure.in	2004-06-26 07:02:55.000000000 +0200
@@ -52,8 +52,7 @@
 host_tools="texinfo byacc flex bison binutils ld gas gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool grep diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils snavigator libtool gettext zip fastjar"
 
 # libgcj represents the runtime libraries only used by gcj.
-libgcj="target-libffi \
-	target-boehm-gc \
+libgcj="target-boehm-gc \
 	target-zlib \
 	target-qthreads \
 	target-libjava"
@@ -66,7 +65,8 @@
 		target-newlib \
 		${libstdcxx_version} \
 		target-libf2c \
-		${libgcj}
+		${libgcj} \
+		target-libffi \
 		target-libobjc"
 
 # these tools are built using the target libs, and are intended to run only
