xref: /haiku/configure (revision 022fa244720f5fbe7cc63fd1c64658e411bf8c05)
152a38012Sejakowatz#!/bin/sh
252a38012Sejakowatz#
3*022fa244SIngo Weinhold# configure [ --floppy <floppy location> ]
452a38012Sejakowatz#
552a38012Sejakowatz# No parameters for now.
652a38012Sejakowatz
7*022fa244SIngo Weinhold# usage
8*022fa244SIngo Weinhold#
9*022fa244SIngo Weinhold# Prints usage.
10*022fa244SIngo Weinhold#
11*022fa244SIngo Weinholdusage()
12*022fa244SIngo Weinhold{
13*022fa244SIngo Weinhold	cat << EOF
14*022fa244SIngo Weinhold
15*022fa244SIngo WeinholdUsage: $0 <options>
16*022fa244SIngo Weinholdoptions:
17*022fa244SIngo Weinhold  --floppy <floppy location>    Specifies the location of the floppy
18*022fa244SIngo Weinhold                                (device or image).
19*022fa244SIngo Weinhold  --help                        Prints out this help.
20*022fa244SIngo WeinholdEOF
21*022fa244SIngo Weinhold}
22*022fa244SIngo Weinhold
23*022fa244SIngo Weinhold# assertparam
24*022fa244SIngo Weinhold#
25*022fa244SIngo Weinhold# Checks whether at least one parameter is left.
26*022fa244SIngo Weinhold#
27*022fa244SIngo Weinholdassertparam()
28*022fa244SIngo Weinhold{
29*022fa244SIngo Weinhold	if [ $2 \< 2 ]; then
30*022fa244SIngo Weinhold		echo $0: \`$1\': Parameter expected.
31*022fa244SIngo Weinhold		exit 1
32*022fa244SIngo Weinhold	fi
33*022fa244SIngo Weinhold}
34*022fa244SIngo Weinhold
35*022fa244SIngo Weinhold# default parameter values
36*022fa244SIngo Weinhold#
3752a38012Sejakowatzplatform=`uname`
38*022fa244SIngo Weinholdfloppy=
39*022fa244SIngo Weinhold
40*022fa244SIngo Weinhold# parse parameters
41*022fa244SIngo Weinhold#
42*022fa244SIngo Weinholdwhile [ $# \> 0 ] ; do
43*022fa244SIngo Weinhold	case "$1" in
44*022fa244SIngo Weinhold		--floppy)		assertparam "$1" $#; floppy=$2; shift 2;;
45*022fa244SIngo Weinhold		--help | -h)	usage; exit 0;;
46*022fa244SIngo Weinhold		*)				echo Invalid argument: \`$1\'; exit 1;;
47*022fa244SIngo Weinhold	esac
48*022fa244SIngo Weinholddone
49*022fa244SIngo Weinhold
50*022fa244SIngo Weinhold# check parameters
51*022fa244SIngo Weinhold#
52*022fa244SIngo Weinholdif [ -n "$floppy" ]; then
53*022fa244SIngo Weinhold	case "$floppy" in
54*022fa244SIngo Weinhold		/*)	;;
55*022fa244SIngo Weinhold		*)	echo "Warning: non-absolute floppy path. Parameter ignored.";
56*022fa244SIngo Weinhold			floppy=;;
57*022fa244SIngo Weinhold	esac
58*022fa244SIngo Weinholdfi
5952a38012Sejakowatz
6052a38012Sejakowatz# BeOS
6152a38012Sejakowatzif [ "${platform}" == "BeOS" ] ; then
6252a38012Sejakowatz	# GGC_PATH
6352a38012Sejakowatz	if [ "x${GCC_PATH}" == "x" ] ; then
6452a38012Sejakowatz		gcclib=`gcc -print-libgcc-file-name`
6552a38012Sejakowatz		GCC_PATH=`dirname ${gcclib}`
6652a38012Sejakowatz	fi
6752a38012Sejakowatz
6852a38012Sejakowatz# Linux
6952a38012Sejakowatzelse if [ "${platform}" == "Linux" ] ; then
7052a38012Sejakowatz	# GGC_PATH
7152a38012Sejakowatz	if [ "x${GCC_PATH}" == "x" ] ; then
7252a38012Sejakowatz		gcclib=`gcc -print-libgcc-file-name`
7352a38012Sejakowatz		GCC_PATH=`dirname ${gcclib}`
7452a38012Sejakowatz	fi
7552a38012Sejakowatz
7652a38012Sejakowatz# Unknown platform
7752a38012Sejakowatzelse
7852a38012Sejakowatz	echo Unsupported platform: ${platform}
7952a38012Sejakowatz	exit 1
8052a38012Sejakowatzfi; fi
8152a38012Sejakowatz
8252a38012Sejakowatz# Generate BuildConfig
8352a38012Sejakowatzcat << EOF > BuildConfig
8452a38012Sejakowatz# BuildConfig
8552a38012Sejakowatz# Note: This file has been automatically generated by configure.
8652a38012Sejakowatz
87*022fa244SIngo WeinholdFLOPPY_PATH	= "$floppy" ;
8852a38012SejakowatzGCC_PATH	= ${GCC_PATH} ;
8952a38012SejakowatzEOF
90