xref: /haiku/configure (revision b1e5b60ccffa844d663fbca95f61156b90d360e3)
152a38012Sejakowatz#!/bin/sh
252a38012Sejakowatz#
3022fa244SIngo Weinhold# configure [ --floppy <floppy location> ]
4614026d7Sshatty
5614026d7Sshattytarget=unknown
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).
196f9587ddSAxel Dörfler  --bochs-debug               Enables bochs serial debug emulation (activated 
206f9587ddSAxel Dörfler                              via kernel settings file).
21614026d7Sshatty  --target=TARGET             Select build target platform. [default=${target}]
22a17b9c0cSshatty                              valid targets=r5,bone,dano,haiku
23e91f3ca1Sbeveloper  --include-gpl-addons        Include GPL licensed add-ons.
24022fa244SIngo Weinhold  --help                      Prints out this help.
25022fa244SIngo WeinholdEOF
26022fa244SIngo Weinhold}
27022fa244SIngo Weinhold
28022fa244SIngo Weinhold# assertparam
29022fa244SIngo Weinhold#
30022fa244SIngo Weinhold# Checks whether at least one parameter is left.
31022fa244SIngo Weinhold#
32022fa244SIngo Weinholdassertparam()
33022fa244SIngo Weinhold{
34022fa244SIngo Weinhold	if [ $2 \< 2 ]; then
35022fa244SIngo Weinhold		echo $0: \`$1\': Parameter expected.
36022fa244SIngo Weinhold		exit 1
37022fa244SIngo Weinhold	fi
38022fa244SIngo Weinhold}
39022fa244SIngo Weinhold
4009c5682dSIngo Weinhold# standard_gcc_settings
4109c5682dSIngo Weinhold#
4209c5682dSIngo Weinhold# Sets the variables for a GCC platform.
4309c5682dSIngo Weinhold#
4409c5682dSIngo Weinholdstandard_gcc_settings()
4509c5682dSIngo Weinhold{
4609c5682dSIngo Weinhold	# PLATFORM_LINKLIBS
4709c5682dSIngo Weinhold	gcclib=`gcc -print-libgcc-file-name`
4809c5682dSIngo Weinhold	gccdir=`dirname ${gcclib}`
491bf10fafSAxel Dörfler	gcc_version=`gcc -dumpversion`
5009c5682dSIngo Weinhold	if [ "x${PLATFORM_LINKLIBS}" == "x" ] ; then
5109c5682dSIngo Weinhold		PLATFORM_LINKLIBS="-L ${gccdir} -lgcc"
5209c5682dSIngo Weinhold	fi
5309c5682dSIngo Weinhold	if [ "x${PLATFORM_HEADERS}" == "x" ] ; then
5409c5682dSIngo Weinhold		PLATFORM_HEADERS="${gccdir}/include"
5509c5682dSIngo Weinhold	fi
56b45cb282SAxel Dörfler	if [ "${LIBGCC_DIR}" == "" ] ; then
57b45cb282SAxel Dörfler		LIBGCC_DIR="${gccdir}"
58b45cb282SAxel Dörfler	fi
59b45cb282SAxel Dörfler	if [ "${LIBGCC_OBJECTS}" == "" ] ; then
60b45cb282SAxel Dörfler		LIBGCC_OBJECTS=`ar t ${gccdir}/libgcc.a`
61b45cb282SAxel Dörfler	fi
6209c5682dSIngo Weinhold}
6309c5682dSIngo Weinhold
64022fa244SIngo Weinhold# default parameter values
65022fa244SIngo Weinhold#
6652a38012Sejakowatzplatform=`uname`
678c17a26bSIngo Weinholdgcc_version=
68022fa244SIngo Weinholdfloppy=
692b94bc7bSlillobochs_debug=0
70e91f3ca1Sbeveloperinclude_gpl_addons=0
71a17b9c0cSshattyrevision=`uname -r`
72a17b9c0cSshattycase "$revision" in
73a17b9c0cSshatty  5.1)   target=dano ;;
74a17b9c0cSshatty  5.0.4) target=bone ;;
75a17b9c0cSshatty  5.0*)  target=r5 ;;
766f9587ddSAxel Dörfler  *)     target=haiku ;;
77a17b9c0cSshattyesac
78022fa244SIngo Weinhold
79022fa244SIngo Weinhold# parse parameters
80022fa244SIngo Weinhold#
81022fa244SIngo Weinholdwhile [ $# \> 0 ] ; do
82022fa244SIngo Weinhold	case "$1" in
83e91f3ca1Sbeveloper		--include-gpl-addons)	include_gpl_addons=1; shift 1;;
84022fa244SIngo Weinhold		--floppy)		assertparam "$1" $#; floppy=$2; shift 2;;
852b94bc7bSlillo		--bochs-debug)	bochs_debug=1; shift 1;;
867c8bb86fSIngo Weinhold		--target=*)     target=`echo $1 | cut -d'=' -f2-`; shift 1;;
87022fa244SIngo Weinhold		--help | -h)	usage; exit 0;;
88022fa244SIngo Weinhold		*)				echo Invalid argument: \`$1\'; exit 1;;
89022fa244SIngo Weinhold	esac
90022fa244SIngo Weinholddone
91022fa244SIngo Weinhold
92022fa244SIngo Weinhold# check parameters
93022fa244SIngo Weinhold#
94022fa244SIngo Weinholdif [ -n "$floppy" ]; then
95022fa244SIngo Weinhold	case "$floppy" in
96022fa244SIngo Weinhold		/*)	;;
97022fa244SIngo Weinhold		*)	echo "Warning: non-absolute floppy path. Parameter ignored.";
98022fa244SIngo Weinhold			floppy=;;
99022fa244SIngo Weinhold	esac
100022fa244SIngo Weinholdfi
10152a38012Sejakowatz
10252a38012Sejakowatz# BeOS
10354d94d39SAxel Dörflerif [ "${platform}" = "BeOS" ] ; then
10409c5682dSIngo Weinhold	standard_gcc_settings
10552a38012Sejakowatz
10652a38012Sejakowatz# Linux
10754d94d39SAxel Dörflerelse if [ "${platform}" = "Linux" ] ; then
10809c5682dSIngo Weinhold	standard_gcc_settings
10952a38012Sejakowatz
11052a38012Sejakowatz# Unknown platform
11152a38012Sejakowatzelse
11252a38012Sejakowatz	echo Unsupported platform: ${platform}
11352a38012Sejakowatz	exit 1
11452a38012Sejakowatzfi; fi
11552a38012Sejakowatz
11652a38012Sejakowatz# Generate BuildConfig
1177209d830SIngo Weinholdcat << EOF > build/BuildConfig
11852a38012Sejakowatz# BuildConfig
11952a38012Sejakowatz# Note: This file has been automatically generated by configure.
12052a38012Sejakowatz
12109c5682dSIngo WeinholdFLOPPY_PATH			?= "${floppy}" ;
12209c5682dSIngo WeinholdPLATFORM_LINKLIBS	?= ${PLATFORM_LINKLIBS} ;
12309c5682dSIngo WeinholdPLATFORM_HEADERS	?= ${PLATFORM_HEADERS} ;
1241bf10fafSAxel DörflerGCC_RAW_VERSION		?= ${gcc_version} ;
125b45cb282SAxel DörflerLIBGCC_DIR			?= ${LIBGCC_DIR} ;
12609c5682dSIngo WeinholdBOCHS_DEBUG_HACK	?= ${bochs_debug} ;
127e91f3ca1SbeveloperINCLUDE_GPL_ADDONS	?= ${include_gpl_addons} ;
128614026d7SshattyTARGET_PLATFORM 	?= ${target} ;
129c4786ea6SlilloEOF
130c4786ea6Slillo
131*b1e5b60cSAxel Dörfler# Libgcc.a objects
132*b1e5b60cSAxel Dörfler
133*b1e5b60cSAxel Dörflercat << EOF > build/libgccObjects
134*b1e5b60cSAxel Dörfler# libgcc.a objects to be linked against libroot.so
135*b1e5b60cSAxel Dörfler# Note: This file has been automatically generated by configure.
136*b1e5b60cSAxel Dörfler
137*b1e5b60cSAxel DörflerLIBGCC_OBJECTS ?= ${LIBGCC_OBJECTS} ;
138*b1e5b60cSAxel DörflerEOF
139*b1e5b60cSAxel Dörfler
1404c74bde8SJérôme Duval# Generate Timezones binaries bindings
1414c74bde8SJérôme Duval
142*b1e5b60cSAxel Dörflercat << EOF > build/Timezones
143*b1e5b60cSAxel Dörfler# Timezones used for the build
144*b1e5b60cSAxel Dörfler# Note: This file has been automatically generated by configure.
145*b1e5b60cSAxel Dörfler
146*b1e5b60cSAxel DörflerEOF
147*b1e5b60cSAxel Dörfler
1484d5737d0SIngo Weinholdtimezones=`echo src/data/etc/timezones/* | sed -e s@src/data/etc/timezones/CVS@@`
1494d5737d0SIngo Weinholdfor f in ${timezones};
1504c74bde8SJérôme Duvaldo
1514c74bde8SJérôme Duval
152d2ab012dSJérôme DuvalTZOBJECTS=`gawk '/^Zone/ { print $2 } /^Link/ { print $3 } ' $f `
1534c74bde8SJérôme Duval
154*b1e5b60cSAxel Dörflercat << EOF >> build/Timezones
1554c74bde8SJérôme DuvalTZ_OBJECTS on <src!data!etc!timezones>${f##src/data/etc/timezones/} ?= $TZOBJECTS ;
1564c74bde8SJérôme DuvalEOF
1574c74bde8SJérôme Duvaldone
158