152a38012Sejakowatz#!/bin/sh 252a38012Sejakowatz# 3022fa244SIngo Weinhold# configure [ --floppy <floppy location> ] 452a38012Sejakowatz# 552a38012Sejakowatz# No parameters for now. 652a38012Sejakowatz 7022fa244SIngo Weinhold# usage 8022fa244SIngo Weinhold# 9022fa244SIngo Weinhold# Prints usage. 10022fa244SIngo Weinhold# 11022fa244SIngo Weinholdusage() 12022fa244SIngo Weinhold{ 13022fa244SIngo Weinhold cat << EOF 14022fa244SIngo Weinhold 15022fa244SIngo WeinholdUsage: $0 <options> 16022fa244SIngo Weinholdoptions: 17022fa244SIngo Weinhold --floppy <floppy location> Specifies the location of the floppy 18022fa244SIngo Weinhold (device or image). 192b94bc7bSlillo --bochs-debug Activates bochs serial debug emulation. 20022fa244SIngo Weinhold --help Prints out this help. 21022fa244SIngo WeinholdEOF 22022fa244SIngo Weinhold} 23022fa244SIngo Weinhold 24022fa244SIngo Weinhold# assertparam 25022fa244SIngo Weinhold# 26022fa244SIngo Weinhold# Checks whether at least one parameter is left. 27022fa244SIngo Weinhold# 28022fa244SIngo Weinholdassertparam() 29022fa244SIngo Weinhold{ 30022fa244SIngo Weinhold if [ $2 \< 2 ]; then 31022fa244SIngo Weinhold echo $0: \`$1\': Parameter expected. 32022fa244SIngo Weinhold exit 1 33022fa244SIngo Weinhold fi 34022fa244SIngo Weinhold} 35022fa244SIngo Weinhold 36*09c5682dSIngo Weinhold# standard_gcc_settings 37*09c5682dSIngo Weinhold# 38*09c5682dSIngo Weinhold# Sets the variables for a GCC platform. 39*09c5682dSIngo Weinhold# 40*09c5682dSIngo Weinholdstandard_gcc_settings() 41*09c5682dSIngo Weinhold{ 42*09c5682dSIngo Weinhold # PLATFORM_LINKLIBS 43*09c5682dSIngo Weinhold gcclib=`gcc -print-libgcc-file-name` 44*09c5682dSIngo Weinhold gccdir=`dirname ${gcclib}` 45*09c5682dSIngo Weinhold if [ "x${PLATFORM_LINKLIBS}" == "x" ] ; then 46*09c5682dSIngo Weinhold PLATFORM_LINKLIBS="-L ${gccdir} -lgcc" 47*09c5682dSIngo Weinhold fi 48*09c5682dSIngo Weinhold if [ "x${PLATFORM_HEADERS}" == "x" ] ; then 49*09c5682dSIngo Weinhold PLATFORM_HEADERS="${gccdir}/include" 50*09c5682dSIngo Weinhold fi 51*09c5682dSIngo Weinhold} 52*09c5682dSIngo Weinhold 53022fa244SIngo Weinhold# default parameter values 54022fa244SIngo Weinhold# 5552a38012Sejakowatzplatform=`uname` 56022fa244SIngo Weinholdfloppy= 572b94bc7bSlillobochs_debug=0 58022fa244SIngo Weinhold 59022fa244SIngo Weinhold# parse parameters 60022fa244SIngo Weinhold# 61022fa244SIngo Weinholdwhile [ $# \> 0 ] ; do 62022fa244SIngo Weinhold case "$1" in 63022fa244SIngo Weinhold --floppy) assertparam "$1" $#; floppy=$2; shift 2;; 642b94bc7bSlillo --bochs-debug) bochs_debug=1; shift 1;; 65022fa244SIngo Weinhold --help | -h) usage; exit 0;; 66022fa244SIngo Weinhold *) echo Invalid argument: \`$1\'; exit 1;; 67022fa244SIngo Weinhold esac 68022fa244SIngo Weinholddone 69022fa244SIngo Weinhold 70022fa244SIngo Weinhold# check parameters 71022fa244SIngo Weinhold# 72022fa244SIngo Weinholdif [ -n "$floppy" ]; then 73022fa244SIngo Weinhold case "$floppy" in 74022fa244SIngo Weinhold /*) ;; 75022fa244SIngo Weinhold *) echo "Warning: non-absolute floppy path. Parameter ignored."; 76022fa244SIngo Weinhold floppy=;; 77022fa244SIngo Weinhold esac 78022fa244SIngo Weinholdfi 7952a38012Sejakowatz 8052a38012Sejakowatz# BeOS 8152a38012Sejakowatzif [ "${platform}" == "BeOS" ] ; then 82*09c5682dSIngo Weinhold standard_gcc_settings 8352a38012Sejakowatz 8452a38012Sejakowatz# Linux 8552a38012Sejakowatzelse if [ "${platform}" == "Linux" ] ; then 86*09c5682dSIngo Weinhold standard_gcc_settings 8752a38012Sejakowatz 8852a38012Sejakowatz# Unknown platform 8952a38012Sejakowatzelse 9052a38012Sejakowatz echo Unsupported platform: ${platform} 9152a38012Sejakowatz exit 1 9252a38012Sejakowatzfi; fi 9352a38012Sejakowatz 9452a38012Sejakowatz# Generate BuildConfig 957209d830SIngo Weinholdcat << EOF > build/BuildConfig 9652a38012Sejakowatz# BuildConfig 9752a38012Sejakowatz# Note: This file has been automatically generated by configure. 9852a38012Sejakowatz 99*09c5682dSIngo WeinholdFLOPPY_PATH ?= "${floppy}" ; 100*09c5682dSIngo WeinholdPLATFORM_LINKLIBS ?= ${PLATFORM_LINKLIBS} ; 101*09c5682dSIngo WeinholdPLATFORM_HEADERS ?= ${PLATFORM_HEADERS} ; 102*09c5682dSIngo WeinholdBOCHS_DEBUG_HACK ?= ${bochs_debug} ; 103c4786ea6SlilloEOF 104c4786ea6Slillo 105