endian=""
function hook_preconfigure {
        currentdir=`pwd`;
        cd ..;
        ln -sf config configure
        cd $currentdir;
	configure_opts="no-camellia no-krb5 enable-shared --prefix=${INSTALL_ROOT_nto}/${cpudir}/usr/local"
	if [ ${SYSNAME} = nto ]; then
		case ${cpudir} in 
			armle) endian=L_ENDIAN;;
			mipsle) endian=L_ENDIAN;;
			shle) endian=L_ENDIAN;;
			x86) endian=L_ENDIAN;;
			armbe) endian=B_ENDIAN;;
			mipsbe) endian=B_ENDIAN;;
			ppcbe) endian=B_ENDIAN;;
		esac;
	fi
}

function hook_premake {
	if [ ${SYSNAME} = nto ]; then
	    make_CC="${make_CC} -D${endian} -DOPENSSL_NO_CAMELLIA -lsocket"
		case ${cpudir} in
		mips*)
			# mips compiler generates REL16 relocs then _warns_
			# about truncating during link?
			make_CC="${make_CC} -Wc,-mlong-calls"
			;;
		*)
			;;
		esac
	fi
	strip_r_switch
}

crypto_suffix=""
crypto_loc=""
ssl_suffix=""
ssl_loc=""
function hook_pinfo {
	case ${SYSNAME} in
	win32)	exe_suffix=".exe" 	;;
	*)	exe_suffix=""		;;
	esac
	if [ ${SYSNAME} = nto ]; then
		loc="bin";
		crypto_suffix=".so";
		ssl_suffix=".so";
	elif [ ${SYSNAME} = win32 ]; then
		loc="usr/bin";
	else
		loc="usr/bin";
	fi
	gen_pinfo -napps/openssl openssl${exe_suffix} ${loc} DESCRIPTION="OPENSSL" 
	gen_pinfo -nlibcrypto.so libcrypto${crypto_suffix} ${loc} DESCRIPTION="OPENSSL Crypto library"
	gen_pinfo -nlibssl.so libssl${ssl_suffix} ${loc} DESCRIPTION="OPENSSL SSL library"

 	usemsg -f apps/openssl.pinfo apps/openssl
	for i in libcrypto.so.*
	do
		if [ ! -h $i ]; then
			usemsg -f libcrypto.so.pinfo $i;
			break;
		fi
	done
	for i in libssl.so.*
	do
		if [ ! -h $i ]; then
			usemsg -f libssl.so.pinfo $i;
			break;
		fi
	done
}

function hook_postmake {
	    # Add usage message
	    if [ ${SYSNAME} = nto ]; then
			echo
	    fi
}
