#!/bin/sh
# These are important for tools built by the Makefile for execution on host
export CC_FOR_BUILD=`which gcc`
AS_FOR_BUILD=`which as`
gcc_dir=${CC_FOR_BUILD/%\/gcc/}
as_dir=${AS_FOR_BUILD/%\/as/}
export CFLAGS_FOR_BUILD="-B$gcc_dir -B$as_dir"
export LDFLAGS_FOR_BUILD="-L/lib -L/usr/lib"

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

# These parameters can not be determined by configure in cross-compile
env  bash_cv_func_ctype_nonascii=no  \
     bash_cv_dup2_broken=no \
     bash_cv_pgrp_pipe=no \
     bash_cv_sys_siglist=yes \
     bash_cv_under_sys_siglist=yes \
     bash_cv_opendir_not_robust=no \
     bash_cv_ulimit_maxfds=yes \
     bash_cv_getenv_redef=yes \
     bash_cv_getcwd_malloc=yes \
     bash_cv_func_sigsetjmp=present \
     bash_cv_func_strcoll_broken=no \
     bash_cv_printf_a_format=yes \
     bash_cv_must_reinstall_sighandlers=no \
     bash_cv_job_control_missing=present \
     bash_cv_sys_named_pipes=present \
     bash_cv_wcontinued_broken=no \
     bash_cv_unusable_rtsigs=no \
     ac_cv_prog_EMACS=no \
./configure --prefix=/. --libdir=/lib \
            --includedir=/include \
            --localedir=$TARGET_DATA/locale \
            --datarootdir=$TARGET_DATA \
            --host=powerpc-linux-gnu

make
make DESTDIR=$PACKAGE install

