#!/bin/sh

function hook_preconfigure {
	configure_opts="${configure_opts} --prefix=${INSTALL_ROOT_nto}/${cpudir} --disable-vi --enable-history=simple"
}

function hook_premake {
	if [ ${SYSNAME} = linux ]; then
	    # Make sure sort understands +2n option
	    export _POSIX2_VERSION=199209
	fi
	if [ ${TARGET_SYSNAME} = nto ]; then
	    export CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
	fi
	unset make_CC
}

function hook_postmake {
	# On the ARM, mark the executable as needing 512K of stack since
	# the default is smaller than normal due to cramped virtual space
	case ${cpu} in
		arm) ldrel -L -S 512K ksh ;;
	esac
}

function hook_pinfo {
	case ${TARGET_SYSNAME} in
		nto) loc="bin SYMLINK=sh" ;;
		win32) loc="usr/bin SYMLINK=sh.exe" ;;
		*) loc="usr/bin" ;;
	esac
	gen_pinfo -e ksh ${loc} USE=../ksh.use DESCRIPTION="Public Domain Korn Shell" 
}
