#!/bin/sh

CROSS_COMPILE=/opt/hardhat/devkit/ppc/8xx/bin/ppc_8xx
CC=$CROSS_COMPILE-gcc
CXX=$CROSS_COMPILE-g++

# use '-Os' optimization if available, else use -O2
OPTIMIZATION=`if $CC -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
then echo "-Os"; else echo "-O2" ; fi`

CFLAGS="-Wall $OPTIMIZATION -fomit-frame-pointer -D_GNU_SOURCE" 
LDFLAGS=-s
AS=$CROSS_COMPILE-as
LD=$CROSS_COMPILE-ld
CPP="$CC -E"
AR=$CROSS_COMPILE-ar
NM=$CROSS_COMPILE-nm
STRIP="$CROSS_COMPILE-strip --remove-section=.note --remove-section=.comment"
OBJCOPY=$CROSS_COMPILE-objcopy
OBJDUMP=$CROSS_COMPILE-objdump
RANLIB=$CROSS_COMPILE-ranlib
MAKE=make

rm -f config.cache
rm -f config.log
rm -f config.status

autoconf

. ./configure	--prefix=/ \
		--with-mailspool=no \
		--enable-read-both-confs \
		--enable-fakeroot=../target_ppc \
		--host=powerpc-hardhat-linux
