1#!/bin/sh 2# 3# configure [ --floppy <floppy location> ] 4# 5# No parameters for now. 6 7# usage 8# 9# Prints usage. 10# 11usage() 12{ 13 cat << EOF 14 15Usage: $0 <options> 16options: 17 --floppy <floppy location> Specifies the location of the floppy 18 (device or image). 19 --bochs-debug Activates bochs serial debug emulation. 20 --help Prints out this help. 21EOF 22} 23 24# assertparam 25# 26# Checks whether at least one parameter is left. 27# 28assertparam() 29{ 30 if [ $2 \< 2 ]; then 31 echo $0: \`$1\': Parameter expected. 32 exit 1 33 fi 34} 35 36# standard_gcc_settings 37# 38# Sets the variables for a GCC platform. 39# 40standard_gcc_settings() 41{ 42 # PLATFORM_LINKLIBS 43 gcclib=`gcc -print-libgcc-file-name` 44 gccdir=`dirname ${gcclib}` 45 gcc_version=`gcc -dumpversion` 46 if [ "x${PLATFORM_LINKLIBS}" == "x" ] ; then 47 PLATFORM_LINKLIBS="-L ${gccdir} -lgcc" 48 fi 49 if [ "x${PLATFORM_HEADERS}" == "x" ] ; then 50 PLATFORM_HEADERS="${gccdir}/include" 51 fi 52} 53 54# default parameter values 55# 56platform=`uname` 57gcc_version= 58floppy= 59bochs_debug=0 60 61# parse parameters 62# 63while [ $# \> 0 ] ; do 64 case "$1" in 65 --floppy) assertparam "$1" $#; floppy=$2; shift 2;; 66 --bochs-debug) bochs_debug=1; shift 1;; 67 --help | -h) usage; exit 0;; 68 *) echo Invalid argument: \`$1\'; exit 1;; 69 esac 70done 71 72# check parameters 73# 74if [ -n "$floppy" ]; then 75 case "$floppy" in 76 /*) ;; 77 *) echo "Warning: non-absolute floppy path. Parameter ignored."; 78 floppy=;; 79 esac 80fi 81 82# BeOS 83if [ "${platform}" == "BeOS" ] ; then 84 standard_gcc_settings 85 86# Linux 87else if [ "${platform}" == "Linux" ] ; then 88 standard_gcc_settings 89 90# Unknown platform 91else 92 echo Unsupported platform: ${platform} 93 exit 1 94fi; fi 95 96# Generate BuildConfig 97cat << EOF > build/BuildConfig 98# BuildConfig 99# Note: This file has been automatically generated by configure. 100 101FLOPPY_PATH ?= "${floppy}" ; 102PLATFORM_LINKLIBS ?= ${PLATFORM_LINKLIBS} ; 103PLATFORM_HEADERS ?= ${PLATFORM_HEADERS} ; 104GCC_RAW_VERSION ?= ${gcc_version} ; 105BOCHS_DEBUG_HACK ?= ${bochs_debug} ; 106EOF 107 108