xref: /haiku/configure (revision 4afae676ad98b8f1e219f704dfc9c8507bce106e)
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# default parameter values
37#
38platform=`uname`
39floppy=
40bochs_debug=0
41
42# parse parameters
43#
44while [ $# \> 0 ] ; do
45	case "$1" in
46		--floppy)		assertparam "$1" $#; floppy=$2; shift 2;;
47		--bochs-debug)	bochs_debug=1; shift 1;;
48		--help | -h)	usage; exit 0;;
49		*)				echo Invalid argument: \`$1\'; exit 1;;
50	esac
51done
52
53# check parameters
54#
55if [ -n "$floppy" ]; then
56	case "$floppy" in
57		/*)	;;
58		*)	echo "Warning: non-absolute floppy path. Parameter ignored.";
59			floppy=;;
60	esac
61fi
62
63# BeOS
64if [ "${platform}" == "BeOS" ] ; then
65	# GGC_PATH
66	if [ "x${GCC_PATH}" == "x" ] ; then
67		gcclib=`gcc -print-libgcc-file-name`
68		GCC_PATH=`dirname ${gcclib}`
69	fi
70
71# Linux
72else if [ "${platform}" == "Linux" ] ; then
73	# GGC_PATH
74	if [ "x${GCC_PATH}" == "x" ] ; then
75		gcclib=`gcc -print-libgcc-file-name`
76		GCC_PATH=`dirname ${gcclib}`
77	fi
78
79# Unknown platform
80else
81	echo Unsupported platform: ${platform}
82	exit 1
83fi; fi
84
85# Generate BuildConfig
86cat << EOF > build/BuildConfig
87# BuildConfig
88# Note: This file has been automatically generated by configure.
89
90FLOPPY_PATH		?= "$floppy" ;
91GCC_PATH		?= ${GCC_PATH} ;
92BOCHS_DEBUG_HACK	?= $bochs_debug ;
93EOF
94
95