xref: /haiku/configure (revision 0da9c20813c3b3fbf681c1517675de0860f5a063)
152a38012Sejakowatz#!/bin/sh
252a38012Sejakowatz#
3338b8dc3SIngo Weinhold# configure [ <options> ]
4614026d7Sshatty
5022fa244SIngo Weinhold# usage
6022fa244SIngo Weinhold#
7022fa244SIngo Weinhold# Prints usage.
8022fa244SIngo Weinhold#
9022fa244SIngo Weinholdusage()
10022fa244SIngo Weinhold{
11022fa244SIngo Weinhold	cat << EOF
12022fa244SIngo Weinhold
13022fa244SIngo WeinholdUsage: $0 <options>
14022fa244SIngo Weinholdoptions:
156f9587ddSAxel Dörfler  --bochs-debug               Enables bochs serial debug emulation (activated
166f9587ddSAxel Dörfler                              via kernel settings file).
17338b8dc3SIngo Weinhold  --build-cross-tools <build tools dir>
18338b8dc3SIngo Weinhold                              Assume cross compilation. <build tools dir>
19338b8dc3SIngo Weinhold                              defines the location of the build tools sources.
20338b8dc3SIngo Weinhold                              They will be compiled and placed in the output
21a5b60fa8SOliver Tappe                              directory under "cross-tools". The HAIKU_* tools
22a5b60fa8SOliver Tappe                              variables will be set accordingly.
2320ab75e6SIngo Weinhold  --build-cross-tools-gcc4 <arch> <build tools dir>
2429ef597dSIngo Weinhold                              Like "--build-cross-tools" just that gcc 4 will
25a5b60fa8SOliver Tappe                              be used for cross-compilation. Note, that the
26a5b60fa8SOliver Tappe                              resulting Haiku installation built with gcc 4
27a5b60fa8SOliver Tappe                              will not be binary compatible with BeOS R5.
2820ab75e6SIngo Weinhold                              <arch> specifies the target architecture, either
2920ab75e6SIngo Weinhold                              "x86" or "ppc".
30eccc7665SIngo Weinhold  --cross-tools-prefix <prefix>
31eccc7665SIngo Weinhold                              Assume cross compilation. <prefix> should be a
32eccc7665SIngo Weinhold                              path to the directory where the cross
33eccc7665SIngo Weinhold                              compilation tools are located, plus the platform
34*0da9c208SIngo Weinhold                              prefix, e.g. "/path/to/tools/i586-pc-haiku-".
35eccc7665SIngo Weinhold                              This overrides the HAIKU_* tool variables.
36a66c32ddSIngo Weinhold  --distro-compatibility <level>
37a66c32ddSIngo Weinhold                              The distribution's level of compatibility with
38a66c32ddSIngo Weinhold                              the official Haiku distribution. The generated
39a66c32ddSIngo Weinhold                              files will contain the respective trademarks
40a66c32ddSIngo Weinhold                              accordingly.
41a66c32ddSIngo Weinhold                              official -- the official Haiku distribution.
42a66c32ddSIngo Weinhold                              compatible -- a Haiku Compatible (tm) distro.
43a66c32ddSIngo Weinhold                              default -- any other distro (default value).
44eccc7665SIngo Weinhold  --help                      Prints out this help.
45eccc7665SIngo Weinhold  --include-gpl-addons        Include GPL licensed add-ons.
461974210fSFrançois Revol  --include-3rdparty          Include 3rdparty/ in the build system.
47f1b9c086SFrançois Revol  --enable-multiuser          Enable experimental multiuser support.
48614026d7Sshatty  --target=TARGET             Select build target platform. [default=${target}]
49a17b9c0cSshatty                              valid targets=r5,bone,dano,haiku
50eccc7665SIngo Weinhold  --use-gcc-pipe              Build with GCC option -pipe. Speeds up the build
515a34a443SFrançois Revol                              process, but uses more memory.
520385b065SIngo Weinhold  --use-32bit                 Use -m32 flag on 64bit host gcc compiler.
534f4e5272SIngo Weinhold  --use-xattr                 Use Linux xattr support for BeOS attribute
544f4e5272SIngo Weinhold                              emulation. Warning: Make sure your file system
554f4e5272SIngo Weinhold                              supports sufficient attribute sizes (4 KB per
564f4e5272SIngo Weinhold                              file for all attributes won't suffice).
57338b8dc3SIngo Weinhold
58338b8dc3SIngo Weinholdenvironment variables:
59338b8dc3SIngo Weinhold  HAIKU_AR                    The static library archiver. Defaults to "ar".
60338b8dc3SIngo Weinhold  HAIKU_CC                    The compiler. Defaults to "gcc".
61338b8dc3SIngo Weinhold  HAIKU_LD                    The linker. Defaults to "ld".
62338b8dc3SIngo Weinhold  HAIKU_OBJCOPY               The objcopy to be used. Defaults to "objcopy".
63338b8dc3SIngo Weinhold  HAIKU_RANLIB                The static library indexer. Defaults to "ranlib".
64338b8dc3SIngo Weinhold  HAIKU_CPPFLAGS              The preprocessor flags. Defaults to "".
65338b8dc3SIngo Weinhold  HAIKU_CCFLAGS               The C flags. Defaults to "".
66338b8dc3SIngo Weinhold  HAIKU_CXXFLAGS              The C++ flags. Defaults to "".
67338b8dc3SIngo Weinhold  HAIKU_LDFLAGS               The linker flags. Defaults to "".
68338b8dc3SIngo Weinhold  HAIKU_ARFLAGS               The flags passed to HAIKU_AR for archiving.
69338b8dc3SIngo Weinhold                              Defaults to "ru".
70338b8dc3SIngo Weinhold  HAIKU_UNARFLAGS             The flags passed to HAIKU_AR for unarchiving.
71338b8dc3SIngo Weinhold                              Defaults to "x".
72022fa244SIngo WeinholdEOF
73022fa244SIngo Weinhold}
74022fa244SIngo Weinhold
75022fa244SIngo Weinhold# assertparam
76022fa244SIngo Weinhold#
77022fa244SIngo Weinhold# Checks whether at least one parameter is left.
78022fa244SIngo Weinhold#
79022fa244SIngo Weinholdassertparam()
80022fa244SIngo Weinhold{
8120ab75e6SIngo Weinhold	if [ $2 -lt 2 ]; then
82022fa244SIngo Weinhold		echo $0: \`$1\': Parameter expected.
83022fa244SIngo Weinhold		exit 1
84022fa244SIngo Weinhold	fi
85022fa244SIngo Weinhold}
86022fa244SIngo Weinhold
8720ab75e6SIngo Weinhold# assertparams
8820ab75e6SIngo Weinhold#
8920ab75e6SIngo Weinhold# Checks whether at least a certain number of parameters is left.
9020ab75e6SIngo Weinhold#
9120ab75e6SIngo Weinholdassertparams()
9220ab75e6SIngo Weinhold{
9320ab75e6SIngo Weinhold	if [ $3 -le $2 ]; then
9420ab75e6SIngo Weinhold		echo $0: \`$1\': Not enough parameters.
9520ab75e6SIngo Weinhold		exit 1
9620ab75e6SIngo Weinhold	fi
9720ab75e6SIngo Weinhold}
9820ab75e6SIngo Weinhold
9909c5682dSIngo Weinhold# standard_gcc_settings
10009c5682dSIngo Weinhold#
10109c5682dSIngo Weinhold# Sets the variables for a GCC platform.
10209c5682dSIngo Weinhold#
10309c5682dSIngo Weinholdstandard_gcc_settings()
10409c5682dSIngo Weinhold{
10509c5682dSIngo Weinhold	# PLATFORM_LINKLIBS
106338b8dc3SIngo Weinhold	gcclib=`$HAIKU_CC -print-libgcc-file-name`
10709c5682dSIngo Weinhold	gccdir=`dirname ${gcclib}`
1085b0f7b1bSOliver Tappe
109338b8dc3SIngo Weinhold	haikuGCCVersion=`$HAIKU_CC -dumpversion`
110338b8dc3SIngo Weinhold	haikuGCCMachine=`$HAIKU_CC -dumpmachine`
111338b8dc3SIngo Weinhold
112338b8dc3SIngo Weinhold	HAIKU_GCC_LIB_DIR=${gccdir}
113338b8dc3SIngo Weinhold	HAIKU_GCC_LIBGCC=${gccdir}/libgcc.a
114338b8dc3SIngo Weinhold	HAIKU_GCC_GLUE_CODE="crtbegin.o crtend.o"
115338b8dc3SIngo Weinhold	HAIKU_GCC_HEADERS_DIR=${gccdir}/include
1165d978968SIngo Weinhold	HAIKU_GCC_LIBGCC_OBJECTS=`$HAIKU_AR t ${HAIKU_GCC_LIBGCC} | grep -v eabi.o`
1175d978968SIngo Weinhold		# Note: We filter out eabi.o. It's present in gcc's libgcc for PPC and
1185d978968SIngo Weinhold		# neither needed nor wanted.
1198b5934c9SIngo Weinhold
1208b5934c9SIngo Weinhold	case $haikuGCCVersion in
1218b5934c9SIngo Weinhold		4.*)
1225b0f7b1bSOliver Tappe			# for gcc 4 we use the libstdc++ and libsupc++ that come with the
1235b0f7b1bSOliver Tappe			# compiler
1248b5934c9SIngo Weinhold			haikuStaticLibStdCxx=`$HAIKU_CC -print-file-name=libstdc++.a`
1258b5934c9SIngo Weinhold			haikuSharedLibStdCxx=`$HAIKU_CC -print-file-name=libstdc++.so`
126c89fc875SIngo Weinhold			haikuStaticLibSupCxx=`$HAIKU_CC -print-file-name=libsupc++.a`
127c89fc875SIngo Weinhold			haikuSharedLibSupCxx=`$HAIKU_CC -print-file-name=libsupc++.so`
1288b5934c9SIngo Weinhold			local headers=$gccdir/../../../../include/c++/$haikuGCCVersion
1298b5934c9SIngo Weinhold			haikuCxxHeadersDir=$headers
13029ef597dSIngo Weinhold			for d in $haikuGCCMachine backward ext; do
13129ef597dSIngo Weinhold				# Note: We need the line break, otherwise the line might become
13229ef597dSIngo Weinhold				# too long for jam (512 bytes max).
13329ef597dSIngo Weinhold				haikuCxxHeadersDir="$haikuCxxHeadersDir
13429ef597dSIngo Weinhold					$headers/$d"
1358b5934c9SIngo Weinhold			done
136274b450aSMarcus Overhagen
137dad36002SMarcus Overhagen
138dad36002SMarcus Overhagen			# when not building the crosscompiler, to use cpp headers from
139274b450aSMarcus Overhagen			# tree first, but fallback to local C++ system headers (like <new>)
140dad36002SMarcus Overhagen			# if [ "$buildCrossTools" = "" ]; then
141dad36002SMarcus Overhagen			#	haikuCxxHeadersDir="headers/cpp $haikuCxxHeadersDir"
142dad36002SMarcus Overhagen			# fi
1438b5934c9SIngo Weinhold
1448b5934c9SIngo Weinhold			if [ $haikuStaticLibStdCxx = libstdc++.a ]; then
1458b5934c9SIngo Weinhold				haikuStaticLibStdCxx=
1468b5934c9SIngo Weinhold			fi
1478b5934c9SIngo Weinhold			if [ $haikuSharedLibStdCxx = libstdc++.so ]; then
1488b5934c9SIngo Weinhold				haikuSharedLibStdCxx=
1498b5934c9SIngo Weinhold			fi
150c89fc875SIngo Weinhold			if [ $haikuStaticLibSupCxx = libsupc++.a ]; then
151c89fc875SIngo Weinhold				haikuStaticLibSupCxx=
152c89fc875SIngo Weinhold			fi
153c89fc875SIngo Weinhold			if [ $haikuSharedLibSupCxx = libsupc++.so ]; then
154c89fc875SIngo Weinhold				haikuSharedLibSupCxx=
155c89fc875SIngo Weinhold			fi
1568b5934c9SIngo Weinhold		;;
1576cc8eecfSOliver Tappe		2.9*)
1585b0f7b1bSOliver Tappe			# check for correct (most up-to-date) legacy compiler and complain
1595b0f7b1bSOliver Tappe			# if an older one is installed
1605b0f7b1bSOliver Tappe			if [ $haikuGCCVersion != $haikuRequiredLegacyGCCVersion ]; then
1615b0f7b1bSOliver Tappe				echo "GCC version $haikuRequiredLegacyGCCVersion is required!";
1625b0f7b1bSOliver Tappe				echo "Please download it from www.haiku-os.org...";
1635b0f7b1bSOliver Tappe				exit 1;
1645b0f7b1bSOliver Tappe			fi
1655b0f7b1bSOliver Tappe		;;
1668b5934c9SIngo Weinhold	esac
16709c5682dSIngo Weinhold}
16809c5682dSIngo Weinhold
169338b8dc3SIngo Weinhold# set_default_value
170338b8dc3SIngo Weinhold#
171338b8dc3SIngo Weinhold# Set the value for a variable, if no value is set yet.
172338b8dc3SIngo Weinhold#
173338b8dc3SIngo Weinholdset_default_value()
174338b8dc3SIngo Weinhold{
1750838a930SJérôme Duval	eval "$1=\${$1-$2}"
176338b8dc3SIngo Weinhold}
177338b8dc3SIngo Weinhold
178338b8dc3SIngo Weinhold# get_build_tool_path
179338b8dc3SIngo Weinhold#
180338b8dc3SIngo Weinhold# Gets a usable absolute path of a build tool.
181338b8dc3SIngo Weinhold#
182338b8dc3SIngo Weinholdget_build_tool_path()
183338b8dc3SIngo Weinhold{
184338b8dc3SIngo Weinhold	local var="HAIKU_$1"
185338b8dc3SIngo Weinhold	local tool=$2
186338b8dc3SIngo Weinhold	local path="${crossToolsPrefix}$tool"
187338b8dc3SIngo Weinhold
188338b8dc3SIngo Weinhold	if [ -f "$path" ]; then
189338b8dc3SIngo Weinhold		# get absolute path
190338b8dc3SIngo Weinhold		local oldPwd=$(pwd)
191338b8dc3SIngo Weinhold		cd $(dirname "$path")
192338b8dc3SIngo Weinhold		path="$(pwd)/$(basename "$path")"
193338b8dc3SIngo Weinhold		cd $oldPwd
194338b8dc3SIngo Weinhold	else
195338b8dc3SIngo Weinhold		which "$path" &> /dev/null || {
196338b8dc3SIngo Weinhold			echo "Build tool \"$path\" not found." >&2
197338b8dc3SIngo Weinhold			exit 1
198338b8dc3SIngo Weinhold		}
199338b8dc3SIngo Weinhold	fi
200338b8dc3SIngo Weinhold
201338b8dc3SIngo Weinhold	eval "$var=$path"
202338b8dc3SIngo Weinhold}
203338b8dc3SIngo Weinhold
204338b8dc3SIngo Weinhold# get cwd and the source directory
205338b8dc3SIngo WeinholdcurrentDir=`pwd`
2066e7c6fe5SIngo Weinholdcd `dirname "$0"`
207338b8dc3SIngo WeinholdsourceDir=`pwd`
2086e7c6fe5SIngo Weinholdcd "$currentDir"
209338b8dc3SIngo Weinhold
210022fa244SIngo Weinhold# default parameter values
211022fa244SIngo Weinhold#
21252a38012Sejakowatzplatform=`uname`
213338b8dc3SIngo WeinholdhaikuGCCVersion=
214*0da9c208SIngo WeinholdhaikuGCCMachine=i586-pc-haiku
2158b5934c9SIngo WeinholdhaikuStaticLibStdCxx=
2168b5934c9SIngo WeinholdhaikuSharedLibStdCxx=
217c89fc875SIngo WeinholdhaikuStaticLibSupCxx=
218c89fc875SIngo WeinholdhaikuSharedLibSupCxx=
2198b5934c9SIngo WeinholdhaikuCxxHeadersDir=
220db63fe67SAxel DörflerhostGCCVersion=`gcc -dumpversion`
2212b94bc7bSlillobochs_debug=0
222e91f3ca1Sbeveloperinclude_gpl_addons=0
2231974210fSFrançois Revolinclude_3rdparty=0
224f1b9c086SFrançois Revolenable_multiuser=0
225a66c32ddSIngo WeinholddistroCompatibility=default
22662339647SAxel Dörflertarget=haiku
227eccc7665SIngo Weinholduse_gcc_pipe=0
2280385b065SIngo Weinholduse_32bit=0
2294f4e5272SIngo Weinholduse_xattr=0
230338b8dc3SIngo WeinholdcrossToolsPrefix=
231338b8dc3SIngo WeinholdbuildCrossTools=
23229ef597dSIngo WeinholdbuildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
23320ab75e6SIngo WeinholdbuildCrossToolsMachine=
234338b8dc3SIngo Weinhold
235*0da9c208SIngo Weinholdexport haikuRequiredLegacyGCCVersion="2.95.3-haiku-080323"
236af4bf973SOliver Tappe	# version of legacy gcc required to build haiku
237af4bf973SOliver Tappe
238338b8dc3SIngo Weinholdset_default_value HAIKU_AR			ar
239338b8dc3SIngo Weinholdset_default_value HAIKU_CC			gcc
240338b8dc3SIngo Weinholdset_default_value HAIKU_LD			ld
241338b8dc3SIngo Weinholdset_default_value HAIKU_OBJCOPY		objcopy
242338b8dc3SIngo Weinholdset_default_value HAIKU_RANLIB		ranlib
243338b8dc3SIngo Weinholdset_default_value HAIKU_CPPFLAGS	""
244338b8dc3SIngo Weinholdset_default_value HAIKU_CCFLAGS		""
245338b8dc3SIngo Weinholdset_default_value HAIKU_CXXFLAGS	""
246338b8dc3SIngo Weinholdset_default_value HAIKU_LDFLAGS		""
247338b8dc3SIngo Weinholdset_default_value HAIKU_ARFLAGS		ru
248338b8dc3SIngo Weinholdset_default_value HAIKU_UNARFLAGS	x
24962339647SAxel Dörfler
250022fa244SIngo Weinhold# parse parameters
251022fa244SIngo Weinhold#
25220ab75e6SIngo Weinholdwhile [ $# -gt 0 ] ; do
253022fa244SIngo Weinhold	case "$1" in
2542b94bc7bSlillo		--bochs-debug)	bochs_debug=1; shift 1;;
255a5b60fa8SOliver Tappe		--build-cross-tools) assertparam "$1" $#; buildCrossTools=$2; shift 2;;
25620ab75e6SIngo Weinhold		--build-cross-tools-gcc4) assertparams "$1" 2 $#; buildCrossTools=$3;
25729ef597dSIngo Weinhold						buildCrossToolsScript="${buildCrossToolsScript}_gcc4";
25820ab75e6SIngo Weinhold						case "$2" in
25920ab75e6SIngo Weinhold							x86)	haikuGCCMachine=i586-pc-haiku;;
26020ab75e6SIngo Weinhold							ppc)	haikuGCCMachine=powerpc-apple-haiku;;
2618074e217SFrançois Revol							m68k)	haikuGCCMachine=m68k-unknown-haiku;;
26220ab75e6SIngo Weinhold							*)		echo "Unsupported target architecture: $2"
26320ab75e6SIngo Weinhold									exit 1;;
26420ab75e6SIngo Weinhold						esac
265a5b60fa8SOliver Tappe						buildCrossToolsMachine=$haikuGCCMachine
26620ab75e6SIngo Weinhold						shift 3;;
267eccc7665SIngo Weinhold		--cross-tools-prefix) assertparam "$1" $#; crossToolsPrefix=$2; shift 2;;
268022fa244SIngo Weinhold		--help | -h)	usage; exit 0;;
269eccc7665SIngo Weinhold		--include-gpl-addons)	include_gpl_addons=1; shift 1;;
2701974210fSFrançois Revol		--include-3rdparty)	include_3rdparty=1; shift 1;;
271f1b9c086SFrançois Revol		--enable-multiuser)	enable_multiuser=1; shift 1;;
272a66c32ddSIngo Weinhold		--distro-compatibility)
273a66c32ddSIngo Weinhold						assertparam "$1" $#; distroCompatibility=$2;
274a66c32ddSIngo Weinhold						case "$distroCompatibility" in
275a66c32ddSIngo Weinhold							official)	;;
276a66c32ddSIngo Weinhold							compatible)	;;
277a66c32ddSIngo Weinhold							default)	;;
278a66c32ddSIngo Weinhold							*)			echo "Invalid distro compatibility" \
279a66c32ddSIngo Weinhold											"level: $distroCompatibility"
280a66c32ddSIngo Weinhold										exit 1;;
281a66c32ddSIngo Weinhold						esac
282a66c32ddSIngo Weinhold						shift 2;;
283eccc7665SIngo Weinhold		--target=*)     target=`echo $1 | cut -d'=' -f2-`; shift 1;;
284eccc7665SIngo Weinhold		--use-gcc-pipe)	use_gcc_pipe=1; shift 1;;
2850385b065SIngo Weinhold		--use-32bit)	use_32bit=1; shift 1;;
2864f4e5272SIngo Weinhold		--use-xattr)	use_xattr=1; shift 1;;
287022fa244SIngo Weinhold		*)				echo Invalid argument: \`$1\'; exit 1;;
288022fa244SIngo Weinhold	esac
289022fa244SIngo Weinholddone
290022fa244SIngo Weinhold
2910df3cc9cSIngo Weinhold# detect the build platform
292338b8dc3SIngo Weinholdcase "${platform}" in
2930df3cc9cSIngo Weinhold	BeOS)	revision=`uname -r`
2940df3cc9cSIngo Weinhold			case "$revision" in
29514998c8bSIngo Weinhold				6.*)	buildPlatform=dano ;;
2960df3cc9cSIngo Weinhold				5.1)	buildPlatform=dano ;;
2970df3cc9cSIngo Weinhold				5.0.4)	buildPlatform=bone ;;
2980df3cc9cSIngo Weinhold				5.0*)	buildPlatform=r5 ;;
2990df3cc9cSIngo Weinhold				*)		echo Unknown BeOS version: $revision
3000df3cc9cSIngo Weinhold						exit 1 ;;
3010df3cc9cSIngo Weinhold			esac
3020df3cc9cSIngo Weinhold			;;
3036dcd0ccfSIngo Weinhold	Darwin)	buildPlatform=darwin ;;
304da0f9ae0SIngo Weinhold	FreeBSD) buildPlatform=freebsd ;;
305da0f9ae0SIngo Weinhold	Haiku)	buildPlatform=haiku_host ;;
306da0f9ae0SIngo Weinhold	Linux)	buildPlatform=linux ;;
307338b8dc3SIngo Weinhold	*)		echo Unsupported platform: ${platform}
3084cbe4925SAxel Dörfler			exit 1 ;;
3094cbe4925SAxel Dörfleresac
31052a38012Sejakowatz
311338b8dc3SIngo Weinhold# create output directory
312338b8dc3SIngo Weinholdif [ "$currentDir" = "$sourceDir" ]; then
313338b8dc3SIngo Weinhold	outputDir=$currentDir/generated
314338b8dc3SIngo Weinholdelse
315338b8dc3SIngo Weinhold	outputDir=$currentDir
316338b8dc3SIngo Weinholdfi
3176e7c6fe5SIngo WeinholdbuildOutputDir="$outputDir/build"
3186e7c6fe5SIngo WeinholdbuildAttributesDir="$outputDir/attributes"
3196e7c6fe5SIngo Weinholdmkdir -p "$buildOutputDir" || exit 1
320338b8dc3SIngo Weinhold
321338b8dc3SIngo Weinhold# build cross tools from sources
322338b8dc3SIngo Weinholdif [ -n "$buildCrossTools" ]; then
32320ab75e6SIngo Weinhold	"$buildCrossToolsScript" $buildCrossToolsMachine "$sourceDir" \
3246e7c6fe5SIngo Weinhold		"$buildCrossTools" "$outputDir" || exit 1
325a5b60fa8SOliver Tappe	crossToolsPrefix="$outputDir/cross-tools/bin/${haikuGCCMachine}-"
326338b8dc3SIngo Weinholdfi
327338b8dc3SIngo Weinhold
328338b8dc3SIngo Weinhold# cross tools
329338b8dc3SIngo Weinholdif [ -n "$crossToolsPrefix" ]; then
330338b8dc3SIngo Weinhold	get_build_tool_path AR ar
331338b8dc3SIngo Weinhold	get_build_tool_path CC gcc
332338b8dc3SIngo Weinhold	get_build_tool_path LD ld
333338b8dc3SIngo Weinhold	get_build_tool_path OBJCOPY objcopy
334338b8dc3SIngo Weinhold	get_build_tool_path RANLIB ranlib
335338b8dc3SIngo Weinholdfi
336338b8dc3SIngo Weinhold
337338b8dc3SIngo Weinhold# prepare gcc settings
338338b8dc3SIngo Weinholdstandard_gcc_settings
339338b8dc3SIngo Weinhold
340eedc3d0bSIngo Weinhold# check whether the Haiku compiler really targets Haiku or BeOS
341eedc3d0bSIngo Weinholdcase "$haikuGCCMachine" in
342eedc3d0bSIngo Weinhold	*-*-haiku)	;;
343eedc3d0bSIngo Weinhold	*-*-beos)	;;
344eedc3d0bSIngo Weinhold	*) echo The compiler specified as Haiku target compiler is not a valid \
345eedc3d0bSIngo Weinhold			Haiku cross-compiler. Please see ReadMe.cross-compile. >&2
346eedc3d0bSIngo Weinhold	   echo compiler: $HAIKU_CC
347eedc3d0bSIngo Weinhold	   echo compiler is configured for target: $haikuGCCMachine
348eedc3d0bSIngo Weinhold	   exit 1 ;;
349eedc3d0bSIngo Weinholdesac
350eedc3d0bSIngo Weinhold
35152a38012Sejakowatz# Generate BuildConfig
3526e7c6fe5SIngo Weinholdcat << EOF > "$buildOutputDir/BuildConfig"
35352a38012Sejakowatz# BuildConfig
35452a38012Sejakowatz# Note: This file has been automatically generated by configure.
35552a38012Sejakowatz
3566e7c6fe5SIngo WeinholdTARGET_PLATFORM 			?= "${target}" ;
3576e7c6fe5SIngo WeinholdHOST_PLATFORM				?= "${buildPlatform}" ;
358338b8dc3SIngo Weinhold
359eccc7665SIngo WeinholdBOCHS_DEBUG_HACK			?= "${bochs_debug}" ;
360eccc7665SIngo WeinholdINCLUDE_GPL_ADDONS			?= "${include_gpl_addons}" ;
3611974210fSFrançois RevolHAIKU_INCLUDE_3RDPARTY			?= "${include_3rdparty}" ;
362f1b9c086SFrançois RevolHAIKU_ENABLE_MULTIUSER			?= "${enable_multiuser}" ;
363a66c32ddSIngo WeinholdHAIKU_DISTRO_COMPATIBILITY	?= "${distroCompatibility}" ;
364eccc7665SIngo WeinholdHAIKU_USE_GCC_PIPE			?= "${use_gcc_pipe}" ;
3650385b065SIngo WeinholdHAIKU_HOST_USE_32BIT		?= "${use_32bit}" ;
3664f4e5272SIngo WeinholdHAIKU_HOST_USE_XATTR		?= "${use_xattr}" ;
367eccc7665SIngo Weinhold
368338b8dc3SIngo WeinholdHAIKU_GCC_RAW_VERSION		?= ${haikuGCCVersion} ;
369338b8dc3SIngo WeinholdHAIKU_GCC_MACHINE			?= ${haikuGCCMachine} ;
370338b8dc3SIngo WeinholdHAIKU_GCC_LIB_DIR			?= ${HAIKU_GCC_LIB_DIR} ;
371338b8dc3SIngo WeinholdHAIKU_GCC_HEADERS_DIR		?= ${HAIKU_GCC_HEADERS_DIR} ;
372338b8dc3SIngo WeinholdHAIKU_GCC_LIBGCC			?= ${HAIKU_GCC_LIBGCC} ;
373338b8dc3SIngo Weinhold
3748b5934c9SIngo WeinholdHAIKU_STATIC_LIBSTDC++		?= ${haikuStaticLibStdCxx} ;
3758b5934c9SIngo WeinholdHAIKU_SHARED_LIBSTDC++		?= ${haikuSharedLibStdCxx} ;
376c89fc875SIngo WeinholdHAIKU_STATIC_LIBSUPC++		?= ${haikuStaticLibSupCxx} ;
377c89fc875SIngo WeinholdHAIKU_SHARED_LIBSUPC++		?= ${haikuSharedLibSupCxx} ;
3788b5934c9SIngo WeinholdHAIKU_C++_HEADERS_DIR		?= ${haikuCxxHeadersDir} ;
3798b5934c9SIngo Weinhold
380338b8dc3SIngo WeinholdHAIKU_BUILD_ATTRIBUTES_DIR	?= ${buildAttributesDir} ;
381338b8dc3SIngo Weinhold
382338b8dc3SIngo WeinholdHAIKU_AR					?= ${HAIKU_AR} ;
383338b8dc3SIngo WeinholdHAIKU_CC					?= ${HAIKU_CC} ;
384338b8dc3SIngo WeinholdHAIKU_LD					?= ${HAIKU_LD} ;
385338b8dc3SIngo WeinholdHAIKU_OBJCOPY				?= ${HAIKU_OBJCOPY} ;
386338b8dc3SIngo WeinholdHAIKU_RANLIB				?= ${HAIKU_RANLIB} ;
387338b8dc3SIngo WeinholdHAIKU_CPPFLAGS				?= ${HAIKU_CPPFLAGS} ;
388338b8dc3SIngo WeinholdHAIKU_CCFLAGS				?= ${HAIKU_CCFLAGS} ;
389338b8dc3SIngo WeinholdHAIKU_CXXFLAGS				?= ${HAIKU_CXXFLAGS} ;
390338b8dc3SIngo WeinholdHAIKU_LDFLAGS				?= ${HAIKU_LDFLAGS} ;
391338b8dc3SIngo WeinholdHAIKU_ARFLAGS				?= ${HAIKU_ARFLAGS} ;
392338b8dc3SIngo WeinholdHAIKU_UNARFLAGS				?= ${HAIKU_UNARFLAGS} ;
393338b8dc3SIngo Weinhold
3948b5934c9SIngo WeinholdHOST_GCC_RAW_VERSION		?= ${hostGCCVersion} ;
3958b5934c9SIngo Weinhold
396c4786ea6SlilloEOF
397c4786ea6Slillo
398b1e5b60cSAxel Dörfler# Libgcc.a objects
399b1e5b60cSAxel Dörfler
4006e7c6fe5SIngo Weinholdcat << EOF > "$buildOutputDir/libgccObjects"
401b1e5b60cSAxel Dörfler# libgcc.a objects to be linked against libroot.so
402b1e5b60cSAxel Dörfler# Note: This file has been automatically generated by configure.
403b1e5b60cSAxel Dörfler
404338b8dc3SIngo WeinholdHAIKU_GCC_LIBGCC_OBJECTS	?= ${HAIKU_GCC_LIBGCC_OBJECTS} ;
405b1e5b60cSAxel DörflerEOF
406b1e5b60cSAxel Dörfler
4074c74bde8SJérôme Duval# Generate Timezones binaries bindings
4084c74bde8SJérôme Duval
409338b8dc3SIngo WeinholdtimezoneSources="africa antarctica asia australasia europe northamerica
410338b8dc3SIngo Weinhold	southamerica pacificnew etcetera factory backward"
411338b8dc3SIngo Weinhold
4126e7c6fe5SIngo Weinholdcat << EOF > "$buildOutputDir/Timezones"
413b1e5b60cSAxel Dörfler# Timezones used for the build
414b1e5b60cSAxel Dörfler# Note: This file has been automatically generated by configure.
415b1e5b60cSAxel Dörfler
416338b8dc3SIngo WeinholdHAIKU_TIME_ZONE_SOURCES = ${timezoneSources} ;
417338b8dc3SIngo Weinhold
418b1e5b60cSAxel DörflerEOF
419b1e5b60cSAxel Dörfler
420338b8dc3SIngo Weinholdfor source in ${timezoneSources}; do
421338b8dc3SIngo Weinhold	f=$sourceDir/src/data/etc/timezones/$source
4224c74bde8SJérôme Duval
4236e7c6fe5SIngo WeinholdTZOBJECTS=`gawk '/^Zone/ { print $2 } /^Link/ { print $3 } ' "$f" `
4244c74bde8SJérôme Duval
4256e7c6fe5SIngo Weinholdcat << EOF >> "$buildOutputDir/Timezones"
426338b8dc3SIngo WeinholdTZ_OBJECTS on <timezone-source>${source} ?= $TZOBJECTS ;
4274c74bde8SJérôme DuvalEOF
4284c74bde8SJérôme Duvaldone
429338b8dc3SIngo Weinhold
430338b8dc3SIngo Weinhold# Generate a boot strap Jamfile in the output directory, if it is not in
431338b8dc3SIngo Weinhold# the source dir.
432338b8dc3SIngo Weinhold
433338b8dc3SIngo Weinholdif [ "$currentDir" != "$sourceDir" ]; then
434338b8dc3SIngo Weinhold
435338b8dc3SIngo Weinholdcat << EOF > $outputDir/Jamfile
436338b8dc3SIngo Weinhold# automatically generated Jamfile
437338b8dc3SIngo Weinhold
438338b8dc3SIngo WeinholdHAIKU_TOP			= ${sourceDir} ;
439338b8dc3SIngo WeinholdHAIKU_OUTPUT_DIR	= ${outputDir} ;
440338b8dc3SIngo Weinhold
441338b8dc3SIngo Weinholdinclude [ FDirName \$(HAIKU_TOP) Jamfile ] ;
442338b8dc3SIngo Weinhold
443338b8dc3SIngo WeinholdEOF
444338b8dc3SIngo Weinhold
445338b8dc3SIngo Weinholdfi
446338b8dc3SIngo Weinhold
447