#!/bin/sh
BASE=~/src/crosstool/gcc-3.4.3-glibc-2.3.2/powerpc-linux-gnu
export CC=powerpc-linux-gnu-gcc
export AR=powerpc-linux-gnu-ar
export PATH=$BASE/bin:$BASE/powerpc-linux-gnu/bin:$PATH
PACKAGE=`pwd`/../plugin/tools/TOOLS
TARGET_DATA=/data/usr/share

patch -N Makefile.in <<"EOF"
--- Makefile.in	2008-09-25 04:40:35.000000000 -1000
+++ Makefile.in.new	2009-04-28 17:22:35.000000000 -1000
@@ -366,9 +366,7 @@
 gethost:  gethost.c sh.err.h tc.const.h sh.h
-	rm -f gethost
-	${CC} -o gethost ${LDFLAGS} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} $(srcdir)/gethost.c ${LIBES} ${EXTRALIBS}
+	touch gethost
 
-tc.defs.c:	gethost host.defs
+tc.defs.c:	gethost host.defs ns4300.defs
 	@rm -f $@.tmp
-	@echo "/* Do not edit this file, make creates it */" > $@.tmp
-	./gethost $(srcdir)/host.defs >> $@.tmp
+	cp ns4300.defs $@.tmp
 	@if [ -f $@ ] && cmp -s $@.tmp $@; then echo $@ unchanged.; rm -f $@.tmp; else mv -f $@.tmp $@; echo $@ recreated.; fi
EOF

env ac_cv_func_getpgrp_void=yes  \
    ac_cv_func_setpgrp_void=yes \
./configure --prefix=/ --libdir=/lib \
            --includedir=/include \
            --mandir=$TARGET_DATA/man \
            --host=powerpc-linux-gnu  \
            --with-regex=regcomp-local 
make 
make DESTDIR=$PACKAGE install install.man

