xref: /haiku/configure (revision 9b0dd52858e2b0e79ccc1f9a9319d90dd91e5f39)
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".
30*9b0dd528SIngo Weinhold  --alternative-gcc-output-dir <dir>
31*9b0dd528SIngo Weinhold                              Build a Haiku installation that supports running
32*9b0dd528SIngo Weinhold                              executables built with a gcc version incompatible
33*9b0dd528SIngo Weinhold                              with the primary gcc (e.g. gcc 2 executables under
34*9b0dd528SIngo Weinhold                              a gcc 4 Haiku or vice versa). <dir> specifies the
35*9b0dd528SIngo Weinhold                              output directory of the other gcc. The directory
36*9b0dd528SIngo Weinhold                              must already be fully configured.
37eccc7665SIngo Weinhold  --cross-tools-prefix <prefix>
38eccc7665SIngo Weinhold                              Assume cross compilation. <prefix> should be a
39eccc7665SIngo Weinhold                              path to the directory where the cross
40eccc7665SIngo Weinhold                              compilation tools are located, plus the platform
410da9c208SIngo Weinhold                              prefix, e.g. "/path/to/tools/i586-pc-haiku-".
42eccc7665SIngo Weinhold                              This overrides the HAIKU_* tool variables.
43a66c32ddSIngo Weinhold  --distro-compatibility <level>
44a66c32ddSIngo Weinhold                              The distribution's level of compatibility with
45a66c32ddSIngo Weinhold                              the official Haiku distribution. The generated
46a66c32ddSIngo Weinhold                              files will contain the respective trademarks
47a66c32ddSIngo Weinhold                              accordingly.
48a66c32ddSIngo Weinhold                              official -- the official Haiku distribution.
49a66c32ddSIngo Weinhold                              compatible -- a Haiku Compatible (tm) distro.
50a66c32ddSIngo Weinhold                              default -- any other distro (default value).
51eccc7665SIngo Weinhold  --help                      Prints out this help.
52eccc7665SIngo Weinhold  --include-gpl-addons        Include GPL licensed add-ons.
531974210fSFrançois Revol  --include-3rdparty          Include 3rdparty/ in the build system.
54f1b9c086SFrançois Revol  --enable-multiuser          Enable experimental multiuser support.
55614026d7Sshatty  --target=TARGET             Select build target platform. [default=${target}]
56a17b9c0cSshatty                              valid targets=r5,bone,dano,haiku
57eccc7665SIngo Weinhold  --use-gcc-pipe              Build with GCC option -pipe. Speeds up the build
585a34a443SFrançois Revol                              process, but uses more memory.
590385b065SIngo Weinhold  --use-32bit                 Use -m32 flag on 64bit host gcc compiler.
604f4e5272SIngo Weinhold  --use-xattr                 Use Linux xattr support for BeOS attribute
614f4e5272SIngo Weinhold                              emulation. Warning: Make sure your file system
624f4e5272SIngo Weinhold                              supports sufficient attribute sizes (4 KB per
634f4e5272SIngo Weinhold                              file for all attributes won't suffice).
64338b8dc3SIngo Weinhold
65338b8dc3SIngo Weinholdenvironment variables:
66338b8dc3SIngo Weinhold  HAIKU_AR                    The static library archiver. Defaults to "ar".
67338b8dc3SIngo Weinhold  HAIKU_CC                    The compiler. Defaults to "gcc".
68338b8dc3SIngo Weinhold  HAIKU_LD                    The linker. Defaults to "ld".
69338b8dc3SIngo Weinhold  HAIKU_OBJCOPY               The objcopy to be used. Defaults to "objcopy".
70338b8dc3SIngo Weinhold  HAIKU_RANLIB                The static library indexer. Defaults to "ranlib".
71338b8dc3SIngo Weinhold  HAIKU_CPPFLAGS              The preprocessor flags. Defaults to "".
72338b8dc3SIngo Weinhold  HAIKU_CCFLAGS               The C flags. Defaults to "".
73338b8dc3SIngo Weinhold  HAIKU_CXXFLAGS              The C++ flags. Defaults to "".
74338b8dc3SIngo Weinhold  HAIKU_LDFLAGS               The linker flags. Defaults to "".
75338b8dc3SIngo Weinhold  HAIKU_ARFLAGS               The flags passed to HAIKU_AR for archiving.
76338b8dc3SIngo Weinhold                              Defaults to "ru".
77338b8dc3SIngo Weinhold  HAIKU_UNARFLAGS             The flags passed to HAIKU_AR for unarchiving.
78338b8dc3SIngo Weinhold                              Defaults to "x".
79022fa244SIngo WeinholdEOF
80022fa244SIngo Weinhold}
81022fa244SIngo Weinhold
82022fa244SIngo Weinhold# assertparam
83022fa244SIngo Weinhold#
84022fa244SIngo Weinhold# Checks whether at least one parameter is left.
85022fa244SIngo Weinhold#
86022fa244SIngo Weinholdassertparam()
87022fa244SIngo Weinhold{
8820ab75e6SIngo Weinhold	if [ $2 -lt 2 ]; then
89022fa244SIngo Weinhold		echo $0: \`$1\': Parameter expected.
90022fa244SIngo Weinhold		exit 1
91022fa244SIngo Weinhold	fi
92022fa244SIngo Weinhold}
93022fa244SIngo Weinhold
9420ab75e6SIngo Weinhold# assertparams
9520ab75e6SIngo Weinhold#
9620ab75e6SIngo Weinhold# Checks whether at least a certain number of parameters is left.
9720ab75e6SIngo Weinhold#
9820ab75e6SIngo Weinholdassertparams()
9920ab75e6SIngo Weinhold{
10020ab75e6SIngo Weinhold	if [ $3 -le $2 ]; then
10120ab75e6SIngo Weinhold		echo $0: \`$1\': Not enough parameters.
10220ab75e6SIngo Weinhold		exit 1
10320ab75e6SIngo Weinhold	fi
10420ab75e6SIngo Weinhold}
10520ab75e6SIngo Weinhold
10609c5682dSIngo Weinhold# standard_gcc_settings
10709c5682dSIngo Weinhold#
10809c5682dSIngo Weinhold# Sets the variables for a GCC platform.
10909c5682dSIngo Weinhold#
11009c5682dSIngo Weinholdstandard_gcc_settings()
11109c5682dSIngo Weinhold{
11209c5682dSIngo Weinhold	# PLATFORM_LINKLIBS
113338b8dc3SIngo Weinhold	gcclib=`$HAIKU_CC -print-libgcc-file-name`
11409c5682dSIngo Weinhold	gccdir=`dirname ${gcclib}`
1155b0f7b1bSOliver Tappe
116338b8dc3SIngo Weinhold	haikuGCCVersion=`$HAIKU_CC -dumpversion`
117338b8dc3SIngo Weinhold	haikuGCCMachine=`$HAIKU_CC -dumpmachine`
118338b8dc3SIngo Weinhold
119338b8dc3SIngo Weinhold	HAIKU_GCC_LIB_DIR=${gccdir}
120338b8dc3SIngo Weinhold	HAIKU_GCC_LIBGCC=${gccdir}/libgcc.a
121338b8dc3SIngo Weinhold	HAIKU_GCC_GLUE_CODE="crtbegin.o crtend.o"
122338b8dc3SIngo Weinhold	HAIKU_GCC_HEADERS_DIR=${gccdir}/include
1235d978968SIngo Weinhold	HAIKU_GCC_LIBGCC_OBJECTS=`$HAIKU_AR t ${HAIKU_GCC_LIBGCC} | grep -v eabi.o`
1245d978968SIngo Weinhold		# Note: We filter out eabi.o. It's present in gcc's libgcc for PPC and
1255d978968SIngo Weinhold		# neither needed nor wanted.
1268b5934c9SIngo Weinhold
1278b5934c9SIngo Weinhold	case $haikuGCCVersion in
1288b5934c9SIngo Weinhold		4.*)
1295b0f7b1bSOliver Tappe			# for gcc 4 we use the libstdc++ and libsupc++ that come with the
1305b0f7b1bSOliver Tappe			# compiler
1318b5934c9SIngo Weinhold			haikuStaticLibStdCxx=`$HAIKU_CC -print-file-name=libstdc++.a`
1328b5934c9SIngo Weinhold			haikuSharedLibStdCxx=`$HAIKU_CC -print-file-name=libstdc++.so`
133c89fc875SIngo Weinhold			haikuStaticLibSupCxx=`$HAIKU_CC -print-file-name=libsupc++.a`
134c89fc875SIngo Weinhold			haikuSharedLibSupCxx=`$HAIKU_CC -print-file-name=libsupc++.so`
1358b5934c9SIngo Weinhold			local headers=$gccdir/../../../../include/c++/$haikuGCCVersion
1368b5934c9SIngo Weinhold			haikuCxxHeadersDir=$headers
13729ef597dSIngo Weinhold			for d in $haikuGCCMachine backward ext; do
13829ef597dSIngo Weinhold				# Note: We need the line break, otherwise the line might become
13929ef597dSIngo Weinhold				# too long for jam (512 bytes max).
14029ef597dSIngo Weinhold				haikuCxxHeadersDir="$haikuCxxHeadersDir
14129ef597dSIngo Weinhold					$headers/$d"
1428b5934c9SIngo Weinhold			done
143274b450aSMarcus Overhagen
144dad36002SMarcus Overhagen
145dad36002SMarcus Overhagen			# when not building the crosscompiler, to use cpp headers from
146274b450aSMarcus Overhagen			# tree first, but fallback to local C++ system headers (like <new>)
147dad36002SMarcus Overhagen			# if [ "$buildCrossTools" = "" ]; then
148dad36002SMarcus Overhagen			#	haikuCxxHeadersDir="headers/cpp $haikuCxxHeadersDir"
149dad36002SMarcus Overhagen			# fi
1508b5934c9SIngo Weinhold
1518b5934c9SIngo Weinhold			if [ $haikuStaticLibStdCxx = libstdc++.a ]; then
1528b5934c9SIngo Weinhold				haikuStaticLibStdCxx=
1538b5934c9SIngo Weinhold			fi
1548b5934c9SIngo Weinhold			if [ $haikuSharedLibStdCxx = libstdc++.so ]; then
1558b5934c9SIngo Weinhold				haikuSharedLibStdCxx=
1568b5934c9SIngo Weinhold			fi
157c89fc875SIngo Weinhold			if [ $haikuStaticLibSupCxx = libsupc++.a ]; then
158c89fc875SIngo Weinhold				haikuStaticLibSupCxx=
159c89fc875SIngo Weinhold			fi
160c89fc875SIngo Weinhold			if [ $haikuSharedLibSupCxx = libsupc++.so ]; then
161c89fc875SIngo Weinhold				haikuSharedLibSupCxx=
162c89fc875SIngo Weinhold			fi
1638b5934c9SIngo Weinhold		;;
1646cc8eecfSOliver Tappe		2.9*)
1655b0f7b1bSOliver Tappe			# check for correct (most up-to-date) legacy compiler and complain
1665b0f7b1bSOliver Tappe			# if an older one is installed
1675b0f7b1bSOliver Tappe			if [ $haikuGCCVersion != $haikuRequiredLegacyGCCVersion ]; then
1685b0f7b1bSOliver Tappe				echo "GCC version $haikuRequiredLegacyGCCVersion is required!";
1695b0f7b1bSOliver Tappe				echo "Please download it from www.haiku-os.org...";
1705b0f7b1bSOliver Tappe				exit 1;
1715b0f7b1bSOliver Tappe			fi
1725b0f7b1bSOliver Tappe		;;
1738b5934c9SIngo Weinhold	esac
17409c5682dSIngo Weinhold}
17509c5682dSIngo Weinhold
176338b8dc3SIngo Weinhold# set_default_value
177338b8dc3SIngo Weinhold#
178338b8dc3SIngo Weinhold# Set the value for a variable, if no value is set yet.
179338b8dc3SIngo Weinhold#
180338b8dc3SIngo Weinholdset_default_value()
181338b8dc3SIngo Weinhold{
1820838a930SJérôme Duval	eval "$1=\${$1-$2}"
183338b8dc3SIngo Weinhold}
184338b8dc3SIngo Weinhold
185338b8dc3SIngo Weinhold# get_build_tool_path
186338b8dc3SIngo Weinhold#
187338b8dc3SIngo Weinhold# Gets a usable absolute path of a build tool.
188338b8dc3SIngo Weinhold#
189338b8dc3SIngo Weinholdget_build_tool_path()
190338b8dc3SIngo Weinhold{
191338b8dc3SIngo Weinhold	local var="HAIKU_$1"
192338b8dc3SIngo Weinhold	local tool=$2
193338b8dc3SIngo Weinhold	local path="${crossToolsPrefix}$tool"
194338b8dc3SIngo Weinhold
195338b8dc3SIngo Weinhold	if [ -f "$path" ]; then
196338b8dc3SIngo Weinhold		# get absolute path
197a559f87aSFrançois Revol		local oldPwd="`pwd`"
198a559f87aSFrançois Revol		cd "`dirname "$path"`"
199a559f87aSFrançois Revol		path="`pwd`/`basename "$path"`"
200338b8dc3SIngo Weinhold		cd $oldPwd
201338b8dc3SIngo Weinhold	else
202338b8dc3SIngo Weinhold		which "$path" &> /dev/null || {
203338b8dc3SIngo Weinhold			echo "Build tool \"$path\" not found." >&2
204338b8dc3SIngo Weinhold			exit 1
205338b8dc3SIngo Weinhold		}
206338b8dc3SIngo Weinhold	fi
207338b8dc3SIngo Weinhold
208338b8dc3SIngo Weinhold	eval "$var=$path"
209338b8dc3SIngo Weinhold}
210338b8dc3SIngo Weinhold
211338b8dc3SIngo Weinhold# get cwd and the source directory
212338b8dc3SIngo WeinholdcurrentDir=`pwd`
2136e7c6fe5SIngo Weinholdcd `dirname "$0"`
214338b8dc3SIngo WeinholdsourceDir=`pwd`
2156e7c6fe5SIngo Weinholdcd "$currentDir"
216338b8dc3SIngo Weinhold
217022fa244SIngo Weinhold# default parameter values
218022fa244SIngo Weinhold#
21952a38012Sejakowatzplatform=`uname`
220338b8dc3SIngo WeinholdhaikuGCCVersion=
2210da9c208SIngo WeinholdhaikuGCCMachine=i586-pc-haiku
2228b5934c9SIngo WeinholdhaikuStaticLibStdCxx=
2238b5934c9SIngo WeinholdhaikuSharedLibStdCxx=
224c89fc875SIngo WeinholdhaikuStaticLibSupCxx=
225c89fc875SIngo WeinholdhaikuSharedLibSupCxx=
2268b5934c9SIngo WeinholdhaikuCxxHeadersDir=
227db63fe67SAxel DörflerhostGCCVersion=`gcc -dumpversion`
2282b94bc7bSlillobochs_debug=0
229e91f3ca1Sbeveloperinclude_gpl_addons=0
2301974210fSFrançois Revolinclude_3rdparty=0
231f1b9c086SFrançois Revolenable_multiuser=0
232a66c32ddSIngo WeinholddistroCompatibility=default
23362339647SAxel Dörflertarget=haiku
234eccc7665SIngo Weinholduse_gcc_pipe=0
2350385b065SIngo Weinholduse_32bit=0
2364f4e5272SIngo Weinholduse_xattr=0
237338b8dc3SIngo WeinholdcrossToolsPrefix=
238338b8dc3SIngo WeinholdbuildCrossTools=
23929ef597dSIngo WeinholdbuildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
24020ab75e6SIngo WeinholdbuildCrossToolsMachine=
241*9b0dd528SIngo WeinholdalternativeGCCOutputDir=
242338b8dc3SIngo Weinhold
243a559f87aSFrançois RevolhaikuRequiredLegacyGCCVersion="2.95.3-haiku-080323"
244a559f87aSFrançois Revolexport haikuRequiredLegacyGCCVersion
245af4bf973SOliver Tappe	# version of legacy gcc required to build haiku
246af4bf973SOliver Tappe
247338b8dc3SIngo Weinholdset_default_value HAIKU_AR			ar
248338b8dc3SIngo Weinholdset_default_value HAIKU_CC			gcc
249338b8dc3SIngo Weinholdset_default_value HAIKU_LD			ld
250338b8dc3SIngo Weinholdset_default_value HAIKU_OBJCOPY		objcopy
251338b8dc3SIngo Weinholdset_default_value HAIKU_RANLIB		ranlib
252338b8dc3SIngo Weinholdset_default_value HAIKU_CPPFLAGS	""
253338b8dc3SIngo Weinholdset_default_value HAIKU_CCFLAGS		""
254338b8dc3SIngo Weinholdset_default_value HAIKU_CXXFLAGS	""
255338b8dc3SIngo Weinholdset_default_value HAIKU_LDFLAGS		""
256338b8dc3SIngo Weinholdset_default_value HAIKU_ARFLAGS		ru
257338b8dc3SIngo Weinholdset_default_value HAIKU_UNARFLAGS	x
25862339647SAxel Dörfler
259022fa244SIngo Weinhold# parse parameters
260022fa244SIngo Weinhold#
26120ab75e6SIngo Weinholdwhile [ $# -gt 0 ] ; do
262022fa244SIngo Weinhold	case "$1" in
2632b94bc7bSlillo		--bochs-debug)	bochs_debug=1; shift 1;;
264a5b60fa8SOliver Tappe		--build-cross-tools) assertparam "$1" $#; buildCrossTools=$2; shift 2;;
265*9b0dd528SIngo Weinhold		--build-cross-tools-gcc4)
266*9b0dd528SIngo Weinhold			assertparams "$1" 2 $#
267*9b0dd528SIngo Weinhold			buildCrossTools=$3
268*9b0dd528SIngo Weinhold			buildCrossToolsScript="${buildCrossToolsScript}_gcc4"
26920ab75e6SIngo Weinhold			case "$2" in
27020ab75e6SIngo Weinhold				x86)	haikuGCCMachine=i586-pc-haiku;;
27120ab75e6SIngo Weinhold				ppc)	haikuGCCMachine=powerpc-apple-haiku;;
2728074e217SFrançois Revol				m68k)	haikuGCCMachine=m68k-unknown-haiku;;
27320ab75e6SIngo Weinhold				*)		echo "Unsupported target architecture: $2"
27420ab75e6SIngo Weinhold						exit 1;;
27520ab75e6SIngo Weinhold			esac
276a5b60fa8SOliver Tappe			buildCrossToolsMachine=$haikuGCCMachine
277*9b0dd528SIngo Weinhold			shift 3
278*9b0dd528SIngo Weinhold			;;
279*9b0dd528SIngo Weinhold		--alternative-gcc-output-dir)
280*9b0dd528SIngo Weinhold			assertparam "$1" $#
281*9b0dd528SIngo Weinhold			cd $2 || exit 1
282*9b0dd528SIngo Weinhold			alternativeGCCOutputDir=`pwd`
283*9b0dd528SIngo Weinhold			cd $currentDir
284*9b0dd528SIngo Weinhold			shift 2
285*9b0dd528SIngo Weinhold			;;
286*9b0dd528SIngo Weinhold		--cross-tools-prefix)
287*9b0dd528SIngo Weinhold			assertparam "$1" $#
288*9b0dd528SIngo Weinhold			crossToolsPrefix=$2
289*9b0dd528SIngo Weinhold			shift 2
290*9b0dd528SIngo Weinhold			;;
291022fa244SIngo Weinhold		--help | -h)	usage; exit 0;;
292eccc7665SIngo Weinhold		--include-gpl-addons)	include_gpl_addons=1; shift 1;;
2931974210fSFrançois Revol		--include-3rdparty)	include_3rdparty=1; shift 1;;
294f1b9c086SFrançois Revol		--enable-multiuser)	enable_multiuser=1; shift 1;;
295a66c32ddSIngo Weinhold		--distro-compatibility)
296*9b0dd528SIngo Weinhold			assertparam "$1" $#
297*9b0dd528SIngo Weinhold			distroCompatibility=$2
298a66c32ddSIngo Weinhold			case "$distroCompatibility" in
299a66c32ddSIngo Weinhold				official)	;;
300a66c32ddSIngo Weinhold				compatible)	;;
301a66c32ddSIngo Weinhold				default)	;;
302a66c32ddSIngo Weinhold				*)			echo "Invalid distro compatibility" \
303a66c32ddSIngo Weinhold								"level: $distroCompatibility"
304a66c32ddSIngo Weinhold							exit 1;;
305a66c32ddSIngo Weinhold			esac
306*9b0dd528SIngo Weinhold			shift 2
307*9b0dd528SIngo Weinhold			;;
308eccc7665SIngo Weinhold		--target=*)     target=`echo $1 | cut -d'=' -f2-`; shift 1;;
309eccc7665SIngo Weinhold		--use-gcc-pipe)	use_gcc_pipe=1; shift 1;;
3100385b065SIngo Weinhold		--use-32bit)	use_32bit=1; shift 1;;
3114f4e5272SIngo Weinhold		--use-xattr)	use_xattr=1; shift 1;;
312022fa244SIngo Weinhold		*)				echo Invalid argument: \`$1\'; exit 1;;
313022fa244SIngo Weinhold	esac
314022fa244SIngo Weinholddone
315022fa244SIngo Weinhold
3160df3cc9cSIngo Weinhold# detect the build platform
317338b8dc3SIngo Weinholdcase "${platform}" in
3180df3cc9cSIngo Weinhold	BeOS)	revision=`uname -r`
3190df3cc9cSIngo Weinhold			case "$revision" in
32014998c8bSIngo Weinhold				6.*)	buildPlatform=dano ;;
3210df3cc9cSIngo Weinhold				5.1)	buildPlatform=dano ;;
3220df3cc9cSIngo Weinhold				5.0.4)	buildPlatform=bone ;;
3230df3cc9cSIngo Weinhold				5.0*)	buildPlatform=r5 ;;
3240df3cc9cSIngo Weinhold				*)		echo Unknown BeOS version: $revision
3250df3cc9cSIngo Weinhold						exit 1 ;;
3260df3cc9cSIngo Weinhold			esac
3270df3cc9cSIngo Weinhold			;;
3286dcd0ccfSIngo Weinhold	Darwin)	buildPlatform=darwin ;;
329da0f9ae0SIngo Weinhold	FreeBSD) buildPlatform=freebsd ;;
330da0f9ae0SIngo Weinhold	Haiku)	buildPlatform=haiku_host ;;
331da0f9ae0SIngo Weinhold	Linux)	buildPlatform=linux ;;
332a559f87aSFrançois Revol	SunOS)	buildPlatform=sunos ;;
333338b8dc3SIngo Weinhold	*)		echo Unsupported platform: ${platform}
3344cbe4925SAxel Dörfler			exit 1 ;;
3354cbe4925SAxel Dörfleresac
33652a38012Sejakowatz
337338b8dc3SIngo Weinhold# create output directory
338338b8dc3SIngo Weinholdif [ "$currentDir" = "$sourceDir" ]; then
339338b8dc3SIngo Weinhold	outputDir=$currentDir/generated
340338b8dc3SIngo Weinholdelse
341338b8dc3SIngo Weinhold	outputDir=$currentDir
342338b8dc3SIngo Weinholdfi
3436e7c6fe5SIngo WeinholdbuildOutputDir="$outputDir/build"
3446e7c6fe5SIngo WeinholdbuildAttributesDir="$outputDir/attributes"
3456e7c6fe5SIngo Weinholdmkdir -p "$buildOutputDir" || exit 1
346338b8dc3SIngo Weinhold
347338b8dc3SIngo Weinhold# build cross tools from sources
348338b8dc3SIngo Weinholdif [ -n "$buildCrossTools" ]; then
34920ab75e6SIngo Weinhold	"$buildCrossToolsScript" $buildCrossToolsMachine "$sourceDir" \
3506e7c6fe5SIngo Weinhold		"$buildCrossTools" "$outputDir" || exit 1
351a5b60fa8SOliver Tappe	crossToolsPrefix="$outputDir/cross-tools/bin/${haikuGCCMachine}-"
352338b8dc3SIngo Weinholdfi
353338b8dc3SIngo Weinhold
354338b8dc3SIngo Weinhold# cross tools
355338b8dc3SIngo Weinholdif [ -n "$crossToolsPrefix" ]; then
356338b8dc3SIngo Weinhold	get_build_tool_path AR ar
357338b8dc3SIngo Weinhold	get_build_tool_path CC gcc
358338b8dc3SIngo Weinhold	get_build_tool_path LD ld
359338b8dc3SIngo Weinhold	get_build_tool_path OBJCOPY objcopy
360338b8dc3SIngo Weinhold	get_build_tool_path RANLIB ranlib
361338b8dc3SIngo Weinholdfi
362338b8dc3SIngo Weinhold
363338b8dc3SIngo Weinhold# prepare gcc settings
364338b8dc3SIngo Weinholdstandard_gcc_settings
365338b8dc3SIngo Weinhold
366eedc3d0bSIngo Weinhold# check whether the Haiku compiler really targets Haiku or BeOS
367eedc3d0bSIngo Weinholdcase "$haikuGCCMachine" in
368eedc3d0bSIngo Weinhold	*-*-haiku)	;;
369eedc3d0bSIngo Weinhold	*-*-beos)	;;
370eedc3d0bSIngo Weinhold	*) echo The compiler specified as Haiku target compiler is not a valid \
371eedc3d0bSIngo Weinhold			Haiku cross-compiler. Please see ReadMe.cross-compile. >&2
372eedc3d0bSIngo Weinhold	   echo compiler: $HAIKU_CC
373eedc3d0bSIngo Weinhold	   echo compiler is configured for target: $haikuGCCMachine
374eedc3d0bSIngo Weinhold	   exit 1 ;;
375eedc3d0bSIngo Weinholdesac
376eedc3d0bSIngo Weinhold
37752a38012Sejakowatz# Generate BuildConfig
3786e7c6fe5SIngo Weinholdcat << EOF > "$buildOutputDir/BuildConfig"
37952a38012Sejakowatz# BuildConfig
38052a38012Sejakowatz# Note: This file has been automatically generated by configure.
38152a38012Sejakowatz
3826e7c6fe5SIngo WeinholdTARGET_PLATFORM 			?= "${target}" ;
3836e7c6fe5SIngo WeinholdHOST_PLATFORM				?= "${buildPlatform}" ;
384338b8dc3SIngo Weinhold
385eccc7665SIngo WeinholdBOCHS_DEBUG_HACK					?= "${bochs_debug}" ;
386eccc7665SIngo WeinholdINCLUDE_GPL_ADDONS					?= "${include_gpl_addons}" ;
3871974210fSFrançois RevolHAIKU_INCLUDE_3RDPARTY				?= "${include_3rdparty}" ;
388f1b9c086SFrançois RevolHAIKU_ENABLE_MULTIUSER				?= "${enable_multiuser}" ;
389a66c32ddSIngo WeinholdHAIKU_DISTRO_COMPATIBILITY			?= "${distroCompatibility}" ;
390eccc7665SIngo WeinholdHAIKU_USE_GCC_PIPE					?= "${use_gcc_pipe}" ;
3910385b065SIngo WeinholdHAIKU_HOST_USE_32BIT				?= "${use_32bit}" ;
3924f4e5272SIngo WeinholdHAIKU_HOST_USE_XATTR				?= "${use_xattr}" ;
393*9b0dd528SIngo WeinholdHAIKU_ALTERNATIVE_GCC_OUTPUT_DIR	?= ${alternativeGCCOutputDir} ;
394eccc7665SIngo Weinhold
395338b8dc3SIngo WeinholdHAIKU_GCC_RAW_VERSION		?= ${haikuGCCVersion} ;
396338b8dc3SIngo WeinholdHAIKU_GCC_MACHINE			?= ${haikuGCCMachine} ;
397338b8dc3SIngo WeinholdHAIKU_GCC_LIB_DIR			?= ${HAIKU_GCC_LIB_DIR} ;
398338b8dc3SIngo WeinholdHAIKU_GCC_HEADERS_DIR		?= ${HAIKU_GCC_HEADERS_DIR} ;
399338b8dc3SIngo WeinholdHAIKU_GCC_LIBGCC			?= ${HAIKU_GCC_LIBGCC} ;
400338b8dc3SIngo Weinhold
4018b5934c9SIngo WeinholdHAIKU_STATIC_LIBSTDC++		?= ${haikuStaticLibStdCxx} ;
4028b5934c9SIngo WeinholdHAIKU_SHARED_LIBSTDC++		?= ${haikuSharedLibStdCxx} ;
403c89fc875SIngo WeinholdHAIKU_STATIC_LIBSUPC++		?= ${haikuStaticLibSupCxx} ;
404c89fc875SIngo WeinholdHAIKU_SHARED_LIBSUPC++		?= ${haikuSharedLibSupCxx} ;
4058b5934c9SIngo WeinholdHAIKU_C++_HEADERS_DIR		?= ${haikuCxxHeadersDir} ;
4068b5934c9SIngo Weinhold
407338b8dc3SIngo WeinholdHAIKU_BUILD_ATTRIBUTES_DIR	?= ${buildAttributesDir} ;
408338b8dc3SIngo Weinhold
409338b8dc3SIngo WeinholdHAIKU_AR					?= ${HAIKU_AR} ;
410338b8dc3SIngo WeinholdHAIKU_CC					?= ${HAIKU_CC} ;
411338b8dc3SIngo WeinholdHAIKU_LD					?= ${HAIKU_LD} ;
412338b8dc3SIngo WeinholdHAIKU_OBJCOPY				?= ${HAIKU_OBJCOPY} ;
413338b8dc3SIngo WeinholdHAIKU_RANLIB				?= ${HAIKU_RANLIB} ;
414338b8dc3SIngo WeinholdHAIKU_CPPFLAGS				?= ${HAIKU_CPPFLAGS} ;
415338b8dc3SIngo WeinholdHAIKU_CCFLAGS				?= ${HAIKU_CCFLAGS} ;
416338b8dc3SIngo WeinholdHAIKU_CXXFLAGS				?= ${HAIKU_CXXFLAGS} ;
417338b8dc3SIngo WeinholdHAIKU_LDFLAGS				?= ${HAIKU_LDFLAGS} ;
418338b8dc3SIngo WeinholdHAIKU_ARFLAGS				?= ${HAIKU_ARFLAGS} ;
419338b8dc3SIngo WeinholdHAIKU_UNARFLAGS				?= ${HAIKU_UNARFLAGS} ;
420338b8dc3SIngo Weinhold
4218b5934c9SIngo WeinholdHOST_GCC_RAW_VERSION		?= ${hostGCCVersion} ;
4228b5934c9SIngo Weinhold
423c4786ea6SlilloEOF
424c4786ea6Slillo
425b1e5b60cSAxel Dörfler# Libgcc.a objects
426b1e5b60cSAxel Dörfler
4276e7c6fe5SIngo Weinholdcat << EOF > "$buildOutputDir/libgccObjects"
428b1e5b60cSAxel Dörfler# libgcc.a objects to be linked against libroot.so
429b1e5b60cSAxel Dörfler# Note: This file has been automatically generated by configure.
430b1e5b60cSAxel Dörfler
431338b8dc3SIngo WeinholdHAIKU_GCC_LIBGCC_OBJECTS	?= ${HAIKU_GCC_LIBGCC_OBJECTS} ;
432b1e5b60cSAxel DörflerEOF
433b1e5b60cSAxel Dörfler
4344c74bde8SJérôme Duval# Generate Timezones binaries bindings
4354c74bde8SJérôme Duval
436338b8dc3SIngo WeinholdtimezoneSources="africa antarctica asia australasia europe northamerica
437338b8dc3SIngo Weinhold	southamerica pacificnew etcetera factory backward"
438338b8dc3SIngo Weinhold
4396e7c6fe5SIngo Weinholdcat << EOF > "$buildOutputDir/Timezones"
440b1e5b60cSAxel Dörfler# Timezones used for the build
441b1e5b60cSAxel Dörfler# Note: This file has been automatically generated by configure.
442b1e5b60cSAxel Dörfler
443338b8dc3SIngo WeinholdHAIKU_TIME_ZONE_SOURCES = ${timezoneSources} ;
444338b8dc3SIngo Weinhold
445b1e5b60cSAxel DörflerEOF
446b1e5b60cSAxel Dörfler
447338b8dc3SIngo Weinholdfor source in ${timezoneSources}; do
448338b8dc3SIngo Weinhold	f=$sourceDir/src/data/etc/timezones/$source
4494c74bde8SJérôme Duval
4506e7c6fe5SIngo WeinholdTZOBJECTS=`gawk '/^Zone/ { print $2 } /^Link/ { print $3 } ' "$f" `
4514c74bde8SJérôme Duval
4526e7c6fe5SIngo Weinholdcat << EOF >> "$buildOutputDir/Timezones"
453338b8dc3SIngo WeinholdTZ_OBJECTS on <timezone-source>${source} ?= $TZOBJECTS ;
4544c74bde8SJérôme DuvalEOF
4554c74bde8SJérôme Duvaldone
456338b8dc3SIngo Weinhold
457*9b0dd528SIngo Weinhold# Generate a boot strap Jamfile in the output directory.
458338b8dc3SIngo Weinhold
459338b8dc3SIngo Weinholdcat << EOF > $outputDir/Jamfile
460338b8dc3SIngo Weinhold# automatically generated Jamfile
461338b8dc3SIngo Weinhold
462338b8dc3SIngo WeinholdHAIKU_TOP			= ${sourceDir} ;
463338b8dc3SIngo WeinholdHAIKU_OUTPUT_DIR	= ${outputDir} ;
464338b8dc3SIngo Weinhold
465338b8dc3SIngo Weinholdinclude [ FDirName \$(HAIKU_TOP) Jamfile ] ;
466338b8dc3SIngo Weinhold
467338b8dc3SIngo WeinholdEOF
468