#! /bin/sh -e

# DP: Do not build libffi with debug information, although configuring
# DP: with --enable-debug

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

diff -ur gcc-3.3.5/libffi/configure src/libffi/configure
--- libffi/configure~	2004-05-12 17:13:57.000000000 +0200
+++ libffi/configure	2005-03-07 22:08:42.438788715 +0100
@@ -3639,18 +3649,6 @@
 
 
 
-# Check whether --enable-debug or --disable-debug was given.
-if test "${enable_debug+set}" = set; then
-  enableval="$enable_debug"
-  if test "$enable_debug" = "yes"; then
-    cat >> confdefs.h <<\EOF
-#define FFI_DEBUG 1
-EOF
-
-  fi
-fi
-
-
 # Check whether --enable-structs or --disable-structs was given.
 if test "${enable_structs+set}" = set; then
   enableval="$enable_structs"
diff -ur gcc-3.3.5/libffi/configure.in src/libffi/configure.in
--- libffi/configure.in~	2003-08-09 08:59:00.000000000 +0200
+++ libffi/configure.in	2005-03-07 22:08:42.436789315 +0100
@@ -154,12 +156,6 @@
 
 AC_SUBST(SHELL)
 
-AC_ARG_ENABLE(debug,
-[  --enable-debug          debugging mode],
-  if test "$enable_debug" = "yes"; then
-    AC_DEFINE(FFI_DEBUG)
-  fi)
-
 AC_ARG_ENABLE(structs,
 [  --disable-structs       omit code for struct support],
   if test "$enable_structs" = "no"; then
