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