xref: /haiku/configure (revision b45cb282a9f417f84a6c69cb3275525be9cafddd)
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.
20e91f3ca1Sbeveloper  --include-gpl-addons		Include GPL licensed add-ons.
21022fa244SIngo Weinhold  --help                        Prints out this help.
22022fa244SIngo WeinholdEOF
23022fa244SIngo Weinhold}
24022fa244SIngo Weinhold
25022fa244SIngo Weinhold# assertparam
26022fa244SIngo Weinhold#
27022fa244SIngo Weinhold# Checks whether at least one parameter is left.
28022fa244SIngo Weinhold#
29022fa244SIngo Weinholdassertparam()
30022fa244SIngo Weinhold{
31022fa244SIngo Weinhold	if [ $2 \< 2 ]; then
32022fa244SIngo Weinhold		echo $0: \`$1\': Parameter expected.
33022fa244SIngo Weinhold		exit 1
34022fa244SIngo Weinhold	fi
35022fa244SIngo Weinhold}
36022fa244SIngo Weinhold
3709c5682dSIngo Weinhold# standard_gcc_settings
3809c5682dSIngo Weinhold#
3909c5682dSIngo Weinhold# Sets the variables for a GCC platform.
4009c5682dSIngo Weinhold#
4109c5682dSIngo Weinholdstandard_gcc_settings()
4209c5682dSIngo Weinhold{
4309c5682dSIngo Weinhold	# PLATFORM_LINKLIBS
4409c5682dSIngo Weinhold	gcclib=`gcc -print-libgcc-file-name`
4509c5682dSIngo Weinhold	gccdir=`dirname ${gcclib}`
461bf10fafSAxel Dörfler	gcc_version=`gcc -dumpversion`
4709c5682dSIngo Weinhold	if [ "x${PLATFORM_LINKLIBS}" == "x" ] ; then
4809c5682dSIngo Weinhold		PLATFORM_LINKLIBS="-L ${gccdir} -lgcc"
4909c5682dSIngo Weinhold	fi
5009c5682dSIngo Weinhold	if [ "x${PLATFORM_HEADERS}" == "x" ] ; then
5109c5682dSIngo Weinhold		PLATFORM_HEADERS="${gccdir}/include"
5209c5682dSIngo Weinhold	fi
53*b45cb282SAxel Dörfler	if [ "${LIBGCC_DIR}" == "" ] ; then
54*b45cb282SAxel Dörfler		LIBGCC_DIR="${gccdir}"
55*b45cb282SAxel Dörfler	fi
56*b45cb282SAxel Dörfler	if [ "${LIBGCC_OBJECTS}" == "" ] ; then
57*b45cb282SAxel Dörfler		LIBGCC_OBJECTS=`ar t ${gccdir}/libgcc.a`
58*b45cb282SAxel Dörfler	fi
5909c5682dSIngo Weinhold}
6009c5682dSIngo Weinhold
61022fa244SIngo Weinhold# default parameter values
62022fa244SIngo Weinhold#
6352a38012Sejakowatzplatform=`uname`
648c17a26bSIngo Weinholdgcc_version=
65022fa244SIngo Weinholdfloppy=
662b94bc7bSlillobochs_debug=0
67e91f3ca1Sbeveloperinclude_gpl_addons=0
68022fa244SIngo Weinhold
69022fa244SIngo Weinhold# parse parameters
70022fa244SIngo Weinhold#
71022fa244SIngo Weinholdwhile [ $# \> 0 ] ; do
72022fa244SIngo Weinhold	case "$1" in
73e91f3ca1Sbeveloper		--include-gpl-addons)	include_gpl_addons=1; shift 1;;
74022fa244SIngo Weinhold		--floppy)		assertparam "$1" $#; floppy=$2; shift 2;;
752b94bc7bSlillo		--bochs-debug)	bochs_debug=1; shift 1;;
76022fa244SIngo Weinhold		--help | -h)	usage; exit 0;;
77022fa244SIngo Weinhold		*)				echo Invalid argument: \`$1\'; exit 1;;
78022fa244SIngo Weinhold	esac
79022fa244SIngo Weinholddone
80022fa244SIngo Weinhold
81022fa244SIngo Weinhold# check parameters
82022fa244SIngo Weinhold#
83022fa244SIngo Weinholdif [ -n "$floppy" ]; then
84022fa244SIngo Weinhold	case "$floppy" in
85022fa244SIngo Weinhold		/*)	;;
86022fa244SIngo Weinhold		*)	echo "Warning: non-absolute floppy path. Parameter ignored.";
87022fa244SIngo Weinhold			floppy=;;
88022fa244SIngo Weinhold	esac
89022fa244SIngo Weinholdfi
9052a38012Sejakowatz
9152a38012Sejakowatz# BeOS
9254d94d39SAxel Dörflerif [ "${platform}" = "BeOS" ] ; then
9309c5682dSIngo Weinhold	standard_gcc_settings
9452a38012Sejakowatz
9552a38012Sejakowatz# Linux
9654d94d39SAxel Dörflerelse if [ "${platform}" = "Linux" ] ; then
9709c5682dSIngo Weinhold	standard_gcc_settings
9852a38012Sejakowatz
9952a38012Sejakowatz# Unknown platform
10052a38012Sejakowatzelse
10152a38012Sejakowatz	echo Unsupported platform: ${platform}
10252a38012Sejakowatz	exit 1
10352a38012Sejakowatzfi; fi
10452a38012Sejakowatz
10552a38012Sejakowatz# Generate BuildConfig
1067209d830SIngo Weinholdcat << EOF > build/BuildConfig
10752a38012Sejakowatz# BuildConfig
10852a38012Sejakowatz# Note: This file has been automatically generated by configure.
10952a38012Sejakowatz
11009c5682dSIngo WeinholdFLOPPY_PATH			?= "${floppy}" ;
11109c5682dSIngo WeinholdPLATFORM_LINKLIBS	?= ${PLATFORM_LINKLIBS} ;
11209c5682dSIngo WeinholdPLATFORM_HEADERS	?= ${PLATFORM_HEADERS} ;
1131bf10fafSAxel DörflerGCC_RAW_VERSION		?= ${gcc_version} ;
114*b45cb282SAxel DörflerLIBGCC_DIR			?= ${LIBGCC_DIR} ;
115*b45cb282SAxel DörflerLIBGCC_OBJECTS		?= ${LIBGCC_OBJECTS} ;
11609c5682dSIngo WeinholdBOCHS_DEBUG_HACK	?= ${bochs_debug} ;
117e91f3ca1SbeveloperINCLUDE_GPL_ADDONS	?= ${include_gpl_addons} ;
118c4786ea6SlilloEOF
119c4786ea6Slillo
120