xref: /haiku/configure (revision e9e00b80c07ebad2f0a5b1e9365047044c762933)
1#!/bin/sh
2#
3# configure [ <options> ]
4
5# usage
6#
7# Prints usage.
8#
9usage()
10{
11	cat << EOF
12
13Usage: $0 <options>
14options:
15  --help                      Prints out this help.
16  --update                    Re-runs last configure invocation [must be given
17                              as first option!]
18  --bootstrap <haikuporter> <HaikuPorts cross repo> <HaikuPorts repo>
19                              Prepare for a bootstrap build. No pre-built
20                              packages will be used, instead they will be built
21                              from the sources (in several phases).
22                              <haikuporter> is the path to the haikuporter tool
23                              suitable for the host platform.
24                              <HaikuPorts cross repo> is the path to a checked
25                              out HaikuPorts cross-compilation repository.
26                              <HaikuPorts repo> is the path to a checked out
27                              HaikuPorts repository.
28  --build-cross-tools <arch>
29                              Assume cross compilation.
30                              Toolchain will be compiled and placed in the
31                              output directory under "cross-tools". The
32                              HAIKU_* tools variables will be set accordingly.
33                              <arch> specifies the target architecture, either
34                              "x86_gcc2", "x86", "x86_64", "ppc", "m68k",
35                              "arm", "arm64", "riscv64", "sparc"
36                              This option and --cross-tools-prefix can be
37                              specified multiple times. The first cross tools
38                              specify the primary tools, the subsequent ones the
39                              secondary tools (for "hybrid" images).
40  --cross-tools-prefix <prefix>
41                              Assume cross compilation. <prefix> should be a
42                              path to the directory where the cross
43                              compilation tools are located, plus the platform
44                              prefix, e.g. "/path/to/tools/i586-pc-haiku-".
45                              This overrides the HAIKU_* tool variables.
46  --cross-tools-source <buildtools dir>
47                              Toolchain sources for cross compilation.
48                              <buildtools dir> defines the location of the
49                              buildtools sources.
50  --distro-compatibility <level>
51                              The distribution's level of compatibility with
52                              the official Haiku distribution. The generated
53                              files will contain the respective trademarks
54                              accordingly.
55                              official -- the official Haiku distribution.
56                              compatible -- a Haiku Compatible (tm) distro.
57                              default -- any other distro (default value).
58  --host-only                 Configure for building tools for the build host
59                              only. Haiku cannot be built when configured like
60                              this.
61  --include-sources           Includes the source code of projects that require
62                              either an offer of source code or a copy of the
63                              patched sources. This is preferable when
64                              distributing on physical mediums.
65  --include-3rdparty          Include 3rdparty/ in the build system.
66  -j<n>                       Only relevant for --build-cross-tools. Is passed
67                              on to the make building the build tools.
68  --no-downloads              Do not download anything. Useful when trying to
69                              bootstrap and build Haiku from source only.
70  --sysroot                   The location of the cross-compiler sysroot,
71                              primarily for CI environments or cross-compilers
72                              used outside of the Haiku build system.
73  --target-arch <arch>        Haiku only: Specify the target architecture to
74                              build for. Must be one of the architectures of the
75                              host system. The installed build tools for that
76                              architecture will be used.
77                              This option can be specified multiple times. The
78                              first occurrence specifies the primary
79                              architecture of the Haiku to build, subsequent
80                              ones the secondary architectures.
81  --use-clang <arch>          Build with host Clang instead of GCC cross
82                              compiler, targeting <arch>
83  --use-gcc-pipe              Build with GCC option -pipe. Speeds up the build
84                              process, but uses more memory.
85  --use-gcc-graphite          Build with GCC Graphite engine for loop
86                              optimizations. (Only for GCC 4+.)
87  --use-32bit                 Use -m32 flag on 64bit host gcc compiler.
88  --no-full-xattr             Do not use Linux/*BSD/Darwin's native extended file
89                              attributes as Haiku attributes. If they are still
90                              available, they will be used to store hashes for
91                              the attribute emulation layer.
92  --no-xattr                  Do not use Linux/*BSD/Darwin's native extended file
93                              attributes for Haiku extended attributes at all,
94                              even if they are available.
95  --with-gdb <gdb sources dir>
96                              specify the path to a GDB source dir, to build
97                              GDB for each arch we build the cross-tools for.
98  --use-stack-protector       Build with stack protection enabled
99  --efi-signing-key           Private keyfile to sign any EFI bootloaders
100
101environment variables:
102  CC                          The host compiler. Defaults to "gcc".
103  HAIKU_AR_<arch>             The static library archiver for <arch>.
104                              Defaults to "ar".
105  HAIKU_CC_<arch>             The compiler for <arch>. Defaults to "gcc".
106  HAIKU_LD_<arch>             The <arch> linker. Defaults to "ld".
107  HAIKU_OBJCOPY_<arch>        The <arch> objcopy to be used. Defaults to
108                              "objcopy".
109  HAIKU_RANLIB_<arch>         The static library indexer for <arch>. Defaults
110                              to "ranlib".
111  HAIKU_STRIP_<arch>          The <arch> strip command. Defaults to "strip".
112  HAIKU_NASM                  The nasm assembler (x86 and x86_64 only).
113  HAIKU_CPPFLAGS_<arch>       The preprocessor flags for target architecture
114                              <arch>. Defaults to "".
115  HAIKU_CCFLAGS_<arch>        The C flags for target architecture <arch>.
116                              Defaults to "".
117  HAIKU_CXXFLAGS_<arch>       The C++ flags for target architecture <arch>.
118                              Defaults to "".
119  HAIKU_LINKFLAGS_<arch>      The flags passed to the compiler when linking for
120                              target architecture <arch>. Defaults to "".
121  HAIKU_LDFLAGS_<arch>        The linker flags for target architecture <arch>.
122                              Defaults to "".
123  HAIKU_ARFLAGS_<arch>        The flags passed to HAIKU_AR for target
124                              architecture <arch> for archiving. Defaults to
125                              "cru".
126  HAIKU_UNARFLAGS_<arch>      The flags passed to HAIKU_AR for target
127                              architecture <arch> for unarchiving. Defaults to
128                              "x".
129
130Non-default output directories:
131  By default all objects, build configuration, and other related files are
132  stored in /path/to/haiku_source/generated.  To store objects in a non-default
133  location, run "../../relative/path/to/haiku_source/configure <options>" from
134  within your non-default location.  "jam [ options ] targets" can then be run
135  directly inside your non-default location.  Another option is to invoke "jam
136  [ options ] targets" from within haiku_source.  This can be accomplished by
137  either "export HAIKU_OUTPUT_DIR=your non-default location" before invoking
138  jam or by creating a symlink of haiku_source/generated pointing to your
139  non-default location and running jam.
140
141
142EOF
143}
144
145# assertparam
146#
147# Checks whether at least one parameter is left.
148#
149assertparam()
150{
151	if [ $2 -lt 2 ]; then
152		echo $0: \`$1\': Parameter expected.
153		exit 1
154	fi
155}
156
157# assertparams
158#
159# Checks whether at least a certain number of parameters is left.
160#
161assertparams()
162{
163	if [ $3 -le $2 ]; then
164		echo $0: \`$1\': Not enough parameters.
165		exit 1
166	fi
167}
168
169# absolute_path
170#
171# returns the absolute path of a given path.
172#
173absolute_path()
174{
175	if [ "x$1" != "x${1#/}" ]; then
176		echo "$1"
177	else
178		echo "`pwd`/$1"
179	fi
180}
181
182# check_dir_exists
183#
184# check if a directory exists or not
185#
186check_dir_exists()
187{
188	if [ -d "$1" ]; then
189		return 0
190	else
191		return 1
192	fi
193}
194
195# check_file_exists
196#
197# check if a file exists or not
198#
199check_file_exists()
200{
201	if [ -f "$1" ]; then
202		return 0
203	else
204		return 1
205	fi
206}
207
208# real_path
209#
210# returns the realpath of a symbolic link.
211#
212real_path()
213{
214	perl -MCwd=realpath -e'print realpath($ARGV[0]), "\n"' "$1"
215}
216
217# relative_to
218#
219# returns $1 relative to $2
220#
221relative_to()
222{
223	perl -e 'use File::Spec; print File::Spec->abs2rel(@ARGV) . "\n"' \
224		"$1" "$2"
225}
226
227# valid_toolchain
228#
229# check if a toolchain is valid
230#
231valid_toolchain()
232{
233	TRIPLET="$1"
234	BASE="$2"
235	SOURCE="$3"
236	if [ ! -d "$BASE" ]; then
237		return 1
238	fi
239	if [ -f "$BASE/bin/$TRIPLET-gcc" ]; then
240		[ "$BASE/bin/$TRIPLET-gcc" -nt "$SOURCE/legacy/gcc/configure" ] && \
241			[ "$BASE/bin/$TRIPLET-gcc" -nt "$SOURCE/gcc/gcc/configure" ]
242		return $?
243	fi
244	return 1
245}
246
247# is_legacy_gcc
248#
249# Determines if the specified GCC version is a "legacy" (i.e. GCC < 4) one.
250#
251is_legacy_gcc()
252{
253	if [ `echo $1 | cut -d'.' -f1` -lt 4 ]; then
254		echo 1
255	else
256		echo 0
257	fi
258}
259
260# standard_gcc_settings
261#
262# Sets the variables for a GCC platform.
263#
264standard_gcc_settings()
265{
266	local gcc="$1"
267
268	if which greadlink > /dev/null 2>&1; then
269		readlink="greadlink -e"
270	elif which realpath > /dev/null 2>&1; then
271		readlink=realpath
272	elif readlink -e / > /dev/null 2>&1; then
273		readlink="readlink -e"
274	else
275		readlink=real_path
276	fi
277
278	# PLATFORM_LINKLIBS
279	local gcclib=`$gcc -print-libgcc-file-name`
280	local gccdir=`dirname ${gcclib}`
281
282	local gccRawVersion=`$gcc -dumpversion`
283	local gccMachine=`$gcc -dumpmachine`
284
285	# determine architecture from machine triple
286	case $gccMachine in
287		arm-*)		targetCpu=arm;;
288		aarch64-*)	targetCpu=arm64;;
289		i?86-*)		targetCpu=x86;;
290		m68k-*)		targetCpu=m68k;;
291		powerpc-*)	targetCpu=ppc;;
292		riscv64-*)	targetCpu=riscv64;;
293		sparc64-*)	targetCpu=sparc;;
294		x86_64-*)	targetCpu=x86_64;;
295		*)
296			echo "Unsupported gcc target machine: $gccMachine" >&2
297			exit 1
298			;;
299	esac
300
301	local targetArch=$targetCpu
302
303	case $gccRawVersion in
304		2.9*)
305			# check for correct (most up-to-date) legacy compiler and complain
306			# if an older one is installed
307			if [ $gccRawVersion != $haikuRequiredLegacyGCCVersion ]; then
308				echo "GCC version $haikuRequiredLegacyGCCVersion is required!";
309				echo "Please download it from www.haiku-os.org...";
310				exit 1;
311			fi
312
313			targetArch=x86_gcc2
314			;;
315	esac
316
317	local bootLibgcc
318	local bootLibSupCxx
319	local bootCxxHeaders
320	local boot32Libgcc
321	local boot32LibSupCxx
322	local boot32CxxHeaders
323	case $gccMachine in
324		x86_64-*)
325			# Boot loader is 32-bit, need the 32-bit libs and c++ config
326			boot32Libgcc=`$gcc -m32 -print-file-name=libgcc.a`
327			boot32LibSupCxx=`$gcc -m32 -print-file-name=libsupc++.a`
328			bootLibgcc=`$gcc -print-file-name=libgcc.a`
329			bootLibSupCxx=`$gcc -print-file-name=libsupc++.a`
330
331			local headersBase=$gccdir/../../../..
332			local headers=$headersBase/$gccMachine/include/c++/$gccRawVersion
333			if [ ! -d $headers ]; then
334				headers=$headersBase/include/c++/$gccRawVersion
335			fi
336			boot32CxxHeaders="$headers/$gccMachine/32"
337			bootCxxHeaders="$headers/$gccMachine"
338			;;
339	esac
340
341	# determine whether graphite loop optimization should/can be used
342	local useGraphite=`get_variable HAIKU_USE_GCC_GRAPHITE_$targetCpu`
343	if [ -z "$useGraphite" ]; then
344		useGraphite=$useGccGraphiteDefault
345	fi
346
347	if [ "$useGraphite" != 0 ]; then
348		UNUSED=`echo "int main() {}" | $gcc -xc -c -floop-block - 2>&1`
349		if [ $? != 0 ]; then
350			echo "GCC Graphite loop optimizations cannot be used on $targetArch"
351			useGraphite=0
352		fi
353	fi
354
355	set_variable HAIKU_CPU_$targetArch $targetCpu
356
357	get_build_tool_path CC_$targetArch "$gcc"
358	set_variable HAIKU_CC_IS_LEGACY_GCC_$targetArch \
359		`is_legacy_gcc $gccRawVersion`
360	set_variable HAIKU_CC_IS_CLANG_$targetArch $useClang
361	set_variable HAIKU_GCC_RAW_VERSION_$targetArch $gccRawVersion
362	set_variable HAIKU_GCC_MACHINE_$targetArch $gccMachine
363	set_variable HAIKU_GCC_LIB_DIR_$targetArch $gccdir
364	set_variable HAIKU_BOOT_CXX_HEADERS_DIR_$targetArch "$bootCxxHeaders"
365	set_variable HAIKU_BOOT_LIBSUPCXX_$targetArch "$bootLibSupCxx"
366	set_variable HAIKU_BOOT_LIBGCC_$targetArch $bootLibgcc
367	set_variable HAIKU_BOOT_32_CXX_HEADERS_DIR_$targetArch "$boot32CxxHeaders"
368	set_variable HAIKU_BOOT_32_LIBSUPCXX_$targetArch "$boot32LibSupCxx"
369	set_variable HAIKU_BOOT_32_LIBGCC_$targetArch $boot32Libgcc
370	set_variable HAIKU_USE_GCC_GRAPHITE_$targetArch $useGraphite
371
372	standard_gcc_settings_targetArch=$targetArch
373}
374
375# set_variable
376#
377# Set the value of a variable.
378#
379set_variable()
380{
381	eval "$1=\"$2\""
382}
383
384# get_variable
385#
386# Echo the value of a variable.
387#
388get_variable()
389{
390	eval "echo \${$1}"
391}
392
393# set_default_value
394#
395# Set the value for a variable, if no value is set yet.
396#
397set_default_value()
398{
399	eval "$1=\${$1-$2}"
400}
401
402# get_build_tool_path
403#
404# Gets a usable absolute path of a build tool.
405#
406get_build_tool_path()
407{
408	local var="HAIKU_$1"
409	local varval="`get_variable $var`"
410	local cmd="$2"
411
412	if [ ! -z "$varval" ]; then
413		# this variable is already set (probably by user) so grab its contents
414		cmd=$varval
415	fi
416
417	local path=${cmd%% *}
418
419	if [ -f "$path" ]; then
420		# get absolute path from relative path
421		local oldPwd="`pwd`"
422		cd "`dirname "$path"`"
423		path="`pwd`/`basename "$path"`"
424		cd $oldPwd
425	else
426		which "$path" > /dev/null 2>&1 || {
427			echo "Build tool \"$path\" not found (maybe specify it in $var?)" >&2
428			exit 1
429		}
430	fi
431
432	if test "${cmd#* }" != "$cmd"; then
433		# $cmd contains arguments, so preserve them (and only them)
434		cmd=${cmd#* }
435	else
436		# $cmd does not contain arguments, so unset it
437		cmd=
438	fi
439	eval "$var=\"$path $cmd\""
440}
441
442# check_native_xattrs
443#
444# Checks the host platform's support for extended attributes.
445# 0: no support, 1: only enough for xattr-ref, 2: full support
446#
447check_native_xattrs()
448{
449	local xattr_set=
450	local xattr_set_args=
451	local xattr_get=
452	local xattr_get_args=
453	case $HOST_PLATFORM in
454		haiku_host)
455			xattr_set="addattr"; xattr_set_args="\$NAME \"\$VALUE\""
456			xattr_get="catattr"; xattr_get_args="\$NAME"
457			;;
458		darwin)
459			xattr_set="xattr"; xattr_set_args="-w \$NAME \"\$VALUE\""
460			xattr_get="xattr"; xattr_get_args="-p \$NAME"
461			;;
462		freebsd)
463			xattr_set="setextattr"; xattr_set_args="user \$NAME \"\$VALUE\""
464			xattr_get="getextattr"; xattr_get_args="user \$NAME"
465			;;
466		linux)
467			xattr_set="setfattr"; xattr_set_args="-n user.\$NAME -v \"\$VALUE\""
468			xattr_get="getfattr"; xattr_get_args="-n user.\$NAME"
469			;;
470		*)
471			return 0
472			;;
473	esac
474	if ! type $xattr_set >/dev/null 2>&1; then
475		echo "$0: could not find $xattr_set, assuming host has no extended attributes"
476		return 0
477	elif ! type $xattr_get >/dev/null 2>&1; then
478		echo "$0: could not find $xattr_get, assuming host has no extended attributes"
479		return 0
480	fi
481
482	mkdir -p "$outputDir"
483	echo "xattr test file" >"$outputDir/xattrtest"
484	local i=0
485	# on round 0, we test if we can set 3 attrs of 1K each (enough for xattr-ref)
486	# on round 1, we test if we can set 3 attrs of 45K each (enough for full xattr)
487	while [ $i -lt 2 ]; do
488		local j=0
489		while [ $j -lt 3 ]; do
490			NAME=attr$j
491			VALUE=`printf '%*s' $((1024 + $i * 45056)) "" | tr ' ' x`
492			if [ `echo -n $VALUE | wc -c` -lt $((1024 + $i * 45056)) ]; then
493				echo "$0: warning: could not generate test data for extended attributes"
494				rm "$outputDir/xattrtest"
495				return $i
496			elif ! $xattr_set `eval echo \"$xattr_set_args\"` \
497					"$outputDir/xattrtest" >/dev/null 2>&1 ; then
498				rm "$outputDir/xattrtest"
499				return $i
500			fi
501			j=$((j+1))
502		done
503		i=$((i+1))
504	done
505	rm "$outputDir/xattrtest"
506	return 2
507}
508
509is_in_list()
510{
511	local element
512	for element in $2; do
513		if [ "$1" = "$element" ]; then
514			return 0
515		fi
516	done
517	return 1
518}
519
520# check for --help or -h and show usage immediately
521if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
522	usage; exit 0;
523fi
524
525# get cwd and the source directory
526currentDir=`pwd`
527cd `dirname "$0"`
528sourceDir=`pwd`
529cd "$currentDir"
530
531# determine output directory
532if [ "$currentDir" = "$sourceDir" ]; then
533	outputDir=$currentDir/generated
534else
535	outputDir=$currentDir
536fi
537buildOutputDir="$outputDir/build"
538HAIKU_BUILD_ATTRIBUTES_DIR="$outputDir/attributes"
539buildConfigFile="$buildOutputDir/BuildConfig"
540
541# check for update request
542if [ "$1" = "--update" ]; then
543	if ! [ -e "$buildConfigFile" ]; then
544		echo $0 --update: \'$buildConfigFile\' not found - updating not possible.
545		exit 1
546	fi
547	# get last configure invocation and flags from BuildConfig and call ourselves with it
548	lastPwd=`grep "#d " "$buildConfigFile" | cut -c 4-`
549	lastConfig=`grep "#c " "$buildConfigFile" | cut -c 4-`
550	lastEnv=`grep "#e " "$buildConfigFile" | cut -c 4-`
551	lastArgs=`grep "#a " "$buildConfigFile" | cut -c 4-`
552	if [ -z "$lastConfig" ]; then
553		echo "$0 --update: The previous configure invocation was not properly" \
554			"encoded into '$buildConfigFile' - updating not possible."
555		exit 1
556	fi
557	cd "$lastPwd"
558	if [ -n "$lastEnv" ]; then
559		export $lastEnv
560	fi
561	$lastConfig $lastArgs
562	exit $?
563fi
564
565# backup the passed arguments
566configureArgs="$@"
567configurePath=$0
568
569# backup relevant environs
570configureEnvirons=
571for var in `env`; do
572	case "$var" in
573		CC\=*|HAIKU*\=*|JAMSHELL\=*)
574			configureEnvirons="$configureEnvirons $var"
575			;;
576	esac
577done
578
579# ensure umask is not too restrictive
580if [ `umask` -gt 22 ]; then
581	echo Your umask is too restrictive "(should be <= 0022;" is actually `umask`")"
582	echo
583	echo Additionally, if the source tree was cloned with a too-restrictive umask,
584	echo you will need to run \"git checkout\" again to fix this.
585	exit 1
586fi
587
588# internal default parameter values
589#
590platform=`uname`
591platformMachine=`uname  -m`
592targetArchs=
593buildCrossTools=
594buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
595buildCrossToolsJobs=
596useClang=0
597useGccGraphiteDefault=0
598unknownArchIndex=1
599haikuTargetArchs=
600gdbSources=
601
602if [ -z "$CC" ]; then
603	CC=gcc
604fi
605
606# detect the build platform
607case "${platform}" in
608	Darwin)  HOST_PLATFORM=darwin ;;
609	FreeBSD) HOST_PLATFORM=freebsd
610	         if [ "$HAIKU_HOST_USE_32BIT" = 1 ] ; then
611	         	echo Unsupported platform: FreeBSD ${platformMachine}
612	         	exit 1
613	         fi ;;
614	Haiku)   HOST_PLATFORM=haiku_host ;;
615	Linux)   HOST_PLATFORM=linux ;;
616	OpenBSD) HOST_PLATFORM=openbsd ;;
617	*)       echo Unsupported platform: ${platform}
618	         exit 1 ;;
619esac
620
621case $HOST_PLATFORM in
622	darwin|freebsd|openbsd) statCmd='stat -f' ;;
623	*)                      statCmd='stat -c' ;;
624esac
625
626# ensure git checkout was not done with a restrictive umask
627if [ `$statCmd '%a' "$sourceDir/data/system/boot/SetupEnvironment"` -lt 644 ]; then
628	echo "The source tree was cloned with a umask > 0022. It seems you"
629	echo have already corrected your umask, but not re-checked-out the
630	echo source tree. Try running:
631	echo "	git checkout --force"
632	echo to fix this problem.
633	exit 1
634fi
635
636# exported (BuildSetup) default parameter values
637#
638HOST_GCC_RAW_VERSION=`$CC -dumpversion`
639HOST_CC_IS_LEGACY_GCC=`is_legacy_gcc $HOST_GCC_RAW_VERSION`
640HOST_GCC_MACHINE=`$CC -dumpmachine`
641HAIKU_INCLUDE_SOURCES=0
642HAIKU_INCLUDE_3RDPARTY=0
643HAIKU_DISTRO_COMPATIBILITY=default
644TARGET_PLATFORM=haiku
645HAIKU_USE_GCC_PIPE=0
646HAIKU_HOST_USE_32BIT=0
647HAIKU_HOST_USE_XATTR=
648HAIKU_HOST_USE_XATTR_REF=
649HAIKU_HOST_BUILD_ONLY=0
650HOST_EXTENDED_REGEX_SED="sed -r"
651HOST_GCC_LD=`$CC -print-prog-name=ld`
652HOST_GCC_OBJCOPY=`$CC -print-prog-name=objcopy`
653HOST_SHA256=
654HOST_HAIKU_PORTER=
655HAIKU_PORTS=
656HAIKU_PORTS_CROSS=
657HAIKU_IS_BOOTSTRAP=0
658HAIKU_NO_DOWNLOADS=0
659
660HAIKU_PACKAGING_ARCHS=
661
662set_default_value HAIKU_NASM		nasm
663
664if sha256sum < /dev/null > /dev/null 2>&1; then
665	HOST_SHA256=sha256sum
666elif sha256 < /dev/null > /dev/null 2>&1; then
667	HOST_SHA256="sha256 -q"
668elif shasum < /dev/null > /dev/null 2>&1; then
669	HOST_SHA256="shasum -a 256"
670else
671	echo "Error: Neither sha256sum nor sha256 seem to be available!" >&2
672	exit 1
673fi
674
675haikuRequiredLegacyGCCVersion="2.95.3-haiku-2017_07_20"
676export haikuRequiredLegacyGCCVersion
677	# version of legacy gcc required to build haiku
678supportedTargetArchs="
679	arm
680	arm64
681	m68k
682	ppc
683	riscv64
684	sparc
685	x86
686	x86_64
687	x86_gcc2
688	"
689
690# parse parameters
691#
692while [ $# -gt 0 ] ; do
693	case "$1" in
694		--sysroot)
695			assertparam "$1" $#
696			crossToolsSysroot=$2
697			shift 2
698			;;
699		--bootstrap)
700			assertparams "$1" 3 $#
701			HOST_HAIKU_PORTER="`absolute_path $2`"
702			HAIKU_PORTS_CROSS="`absolute_path $3`"
703			HAIKU_PORTS="`absolute_path $4`"
704			HAIKU_IS_BOOTSTRAP=1
705			HAIKU_NO_DOWNLOADS=1
706			check_file_exists "$HOST_HAIKU_PORTER" || (
707				echo "Invalid path to haikuporter: $HOST_HAIKU_PORTER" >&2
708				exit 1
709			)
710			check_dir_exists "$HAIKU_PORTS" || (
711				echo "Non-existent directory $HAIKU_PORTS" >&2
712				exit 1
713			)
714			check_dir_exists "$HAIKU_PORTS_CROSS" || (
715				echo "Non-existent directory $HAIKU_PORTS_CROSS" >&2
716				exit 1
717			)
718			shift 4
719			;;
720		--cross-tools-source)
721			assertparam "$1" $#
722			buildCrossTools=$2
723			shift 2
724			;;
725		--build-cross-tools)
726			assertparam "$1" $#
727			targetArch=$2
728			shift 2
729			case "$targetArch" in
730				x86_gcc2)	targetMachine=i586-pc-haiku;;
731				x86)		targetMachine=i586-pc-haiku;;
732				x86_64)		targetMachine=x86_64-unknown-haiku;;
733				ppc)		targetMachine=powerpc-apple-haiku;;
734				m68k)		targetMachine=m68k-unknown-haiku;;
735				arm)		targetMachine=arm-unknown-haiku;;
736				arm64)		targetMachine=aarch64-unknown-haiku;;
737				riscv64)	targetMachine=riscv64-unknown-haiku;;
738				sparc)		targetMachine=sparc64-unknown-haiku;;
739				*)
740					echo "Unsupported target architecture: $targetArch" >&2
741					exit 1
742					;;
743			esac
744			set_variable buildCrossToolsMachine_$targetArch $targetMachine
745			targetArchs="$targetArchs $targetArch"
746			;;
747		--cross-tools-prefix)
748			assertparam "$1" $#
749			targetArch=unknown${unknownArchIndex}
750			set_variable crossToolsPrefix_$targetArch "$2"
751			targetArchs="$targetArchs $targetArch"
752			unknownArchIndex=$(($unknownArchIndex + 1))
753			shift 2
754			;;
755		--distro-compatibility)
756			assertparam "$1" $#
757			HAIKU_DISTRO_COMPATIBILITY=$2
758			case "$HAIKU_DISTRO_COMPATIBILITY" in
759				official)	;;
760				compatible)	;;
761				default)	;;
762				*)			echo "Invalid distro compatibility" \
763								"level: $HAIKU_DISTRO_COMPATIBILITY"
764							exit 1;;
765			esac
766			shift 2
767			;;
768		--host-only)	HAIKU_HOST_BUILD_ONLY=1; shift 1;;
769		--include-sources)	HAIKU_INCLUDE_SOURCES=1; shift 1;;
770		--include-3rdparty)	HAIKU_INCLUDE_3RDPARTY=1; shift 1;;
771        -j*)				buildCrossToolsJobs="$1"; shift 1;;
772		--no-downloads)	HAIKU_NO_DOWNLOADS=1; shift 1;;
773		--target-arch)
774			assertparam "$1" $#
775			targetArch=$2
776			shift 2
777			if [ ! "$platform" = Haiku ]; then
778				echo "--target-arch can only be specified on Haiku." >&2
779				exit 1
780			fi
781			is_in_list "$targetArch" "$supportedTargetArchs" || (
782				echo "Unsupported target architecture: \"$targetArch\"" >&2
783				exit 1
784			)
785			haikuTargetArchs="$haikuTargetArchs $targetArch"
786			;;
787		--use-clang)
788			assertparam "$1" $#
789			targetArch=$2
790			useClang=1
791			case "$targetArch" in
792				x86)		targetMachine=i586-pc-haiku;;
793				x86_64)		targetMachine=x86_64-unknown-haiku;;
794				ppc)		targetMachine=powerpc-apple-haiku;;
795				arm)		targetMachine=arm-unknown-haiku;;
796				arm64)		targetMachine=aarch64-unknown-haiku;;
797				riscv64)	targetMachine=riscv64-unknown-haiku;;
798				sparc)		targetMachine=sparc64-unknown-haiku;;
799				*)
800					echo "Unsupported target architecture: $2" >&2
801					exit 1
802					;;
803			esac
804			get_build_tool_path clang clang
805			if [ -z `get_variable "crossToolsPrefix_$targetArch"` ] \
806					&& [ -z `get_variable buildCrossToolsMachine_$targetArch` ]; then
807				set_variable crossToolsPrefix_$targetArch llvm-
808			fi
809			clangVersion=`$HAIKU_clang -v 2>&1 | head -1 | cut -d " " -f3`
810			if [ `echo $clangVersion | cut -d'.' -f1` -lt 7 ]; then
811				echo "Haiku requires Clang 7 or better to build, but you have $clangVersion."
812				echo "Please install a newer version."
813				exit 1
814			fi
815			targetArchs="$targetArchs $targetArch"
816			shift 2
817			;;
818		--use-gcc-pipe)	HAIKU_USE_GCC_PIPE=1; shift 1;;
819		--use-gcc-graphite)	useGccGraphiteDefault=1; shift 1;;
820		--use-32bit)	HAIKU_HOST_USE_32BIT=1; shift 1;;
821		--no-full-xattr)HAIKU_HOST_USE_XATTR=0; shift 1;;
822		--no-xattr)		HAIKU_HOST_USE_XATTR_REF=0; shift 1;;
823		--with-gdb)	gdbSources=$2; shift 2;;
824		--use-stack-protector)	HAIKU_USE_STACK_PROTECTOR=1; shift 1;;
825		--efi-signing-key)
826			assertparam "$1" $#
827			HAIKU_EFI_SIGNING_KEY="$2"
828			shift 2
829			;;
830		*)				echo Invalid argument: \`$1\'; exit 1;;
831	esac
832done
833
834# check for case-sensitive filesystem
835mkdir haikuCaseTest 2>/dev/null
836mkdir haikucasetest 2>/dev/null
837caseInsensitive=$?
838rmdir haikuCaseTest haikucasetest 2>/dev/null
839if [ $caseInsensitive != 0 ]; then
840	echo "You need a case-sensitive file-system to build Haiku."
841	if [ $HOST_PLATFORM = "darwin" ]; then
842		echo "You can create a case-sensitive disk image using Disk Utility."
843	fi
844	exit 1
845fi
846
847# check xattr support
848if [ -z $HAIKU_HOST_USE_XATTR_REF ]; then
849	check_native_xattrs
850	attrSupport=$?
851	if [ $attrSupport = 2 ] && [ -z $HAIKU_HOST_USE_XATTR ]; then
852		HAIKU_HOST_USE_XATTR=1
853	elif [ $attrSupport = 1 ]; then
854		HAIKU_HOST_USE_XATTR_REF=1
855	fi
856fi
857if [ -z $HAIKU_HOST_USE_XATTR ]; then HAIKU_HOST_USE_XATTR=0; fi
858if [ -z $HAIKU_HOST_USE_XATTR_REF ]; then HAIKU_HOST_USE_XATTR_REF=0; fi
859
860# determine how to invoke sed with extended regexp support for non-GNU sed
861if [ $HOST_PLATFORM = "darwin" ]; then
862	HOST_EXTENDED_REGEX_SED="sed -E"
863fi
864
865# pick a JAMSHELL
866if [ "$JAMSHELL" = "" ]; then
867	if check_file_exists /bin/dash; then
868		JAMSHELL=/bin/dash
869	else
870		JAMSHELL=/bin/sh
871	fi
872fi
873if ! $JAMSHELL -c true; then
874	echo "$JAMSHELL does not work! Please specify a working JAMSHELL."
875	exit 1
876fi
877
878# locate python
879if python3 --version < /dev/null > /dev/null 2>&1; then
880	HOST_PYTHON="python3"
881elif python --version < /dev/null > /dev/null 2>&1; then
882	HOST_PYTHON="python"
883else
884	echo "a python interpreter is required"
885	exit 1
886fi
887
888# check if nasm can actually output ELF files
889# (the stock version in OSX can't)
890# XXX: should probably only test for x86* arch
891if [ "$("$HAIKU_NASM" -hf | grep -c elf'[36][24] ')" -ne "2" ]; then
892	echo "$HAIKU_NASM cannot generate ELF files. Please install a working version."
893	if [ $HOST_PLATFORM = "darwin" ]; then
894		echo "You can install it from Mac Ports."
895		echo "Mac Ports is available at: http://www.macports.org/"
896	fi
897	exit 1
898fi
899
900# create output directory
901mkdir -p "$buildOutputDir" || exit 1
902
903if [ "$HAIKU_HOST_BUILD_ONLY" = 1 ]; then
904	invalidCommand=$sourceDir/build/scripts/host_build_only
905	HAIKU_AR=$invalidCommand
906	HAIKU_CC=$invalidCommand
907	HAIKU_LD=$invalidCommand
908	HAIKU_OBJCOPY=$invalidCommand
909	HAIKU_RANLIB=$invalidCommand
910	HAIKU_ELFEDIT=$invalidCommand
911	HAIKU_NASM=$invalidCommand
912	HAIKU_STRIP=$invalidCommand
913else
914	# On Haiku determine target architectures and tools automatically.
915	if [ -z "$targetArchs" ]; then
916		if [ $HOST_PLATFORM != haiku_host ]; then
917			echo "Please specify the build tools to use or build (via" \
918				"--cross-tools-prefix or --build-cross-tools) or specify a" \
919				"host-only build (--host-only)." >&2
920			echo "For more info, invoke $0 --help"
921			exit 1
922		fi
923
924		# determine primary architecture
925		targetArch=`package list -i /system/packages/haiku-*.hpkg \
926			| sed '/^\s*architecture:/!d; s,^\s*architecture:\s*,,'`
927		is_in_list "$targetArch" "$supportedTargetArchs" || (
928			echo "Unsupported target architecture: \"$targetArch\"" >&2
929			exit 1
930		)
931		targetArchs=$targetArch
932
933		set_default_value HAIKU_AR_$targetArch			ar
934		set_default_value HAIKU_CC_$targetArch			gcc
935		set_default_value HAIKU_LD_$targetArch			ld
936		set_default_value HAIKU_OBJCOPY_$targetArch		objcopy
937		set_default_value HAIKU_RANLIB_$targetArch		ranlib
938		set_default_value HAIKU_ELFEDIT_$targetArch		elfedit
939		set_default_value HAIKU_STRIP_$targetArch		strip
940
941		# determine secondary architectures
942		for targetArch in $supportedTargetArchs; do
943			if [ -e /system/packages/haiku_$targetArch-*.hpkg ]; then
944				targetArchs="$targetArchs $targetArch"
945				set_default_value HAIKU_AR_$targetArch		ar-$targetArch
946				set_default_value HAIKU_CC_$targetArch		gcc-$targetArch
947				set_default_value HAIKU_LD_$targetArch		ld-$targetArch
948				set_default_value HAIKU_OBJCOPY_$targetArch	objcopy-$targetArch
949				set_default_value HAIKU_RANLIB_$targetArch	ranlib-$targetArch
950				set_default_value HAIKU_ELFEDIT_$targetArch	elfedit-$targetArch
951				set_default_value HAIKU_STRIP_$targetArch	strip-$targetArch
952			fi
953		done
954
955		# The target architectures might have been specified explicitly.
956		if [ -n "$haikuTargetArchs" ]; then
957			for targetArch in $haikuTargetArchs; do
958				is_in_list "$targetArch" "$targetArchs" || (
959					echo "Unsupported target architecture: \"$targetArch\"." \
960						"Only native architectures of the host platform can" \
961						"be specified." >&2
962					exit 1
963				)
964			done
965			targetArchs="$haikuTargetArchs"
966		fi
967	fi
968
969	if [ "$targetArchs" = " x86_gcc2" ]; then
970		echo "Building a GCC2-only Haiku is no longer supported."
971		echo "Please configure the secondary architecture."
972		exit 1
973	fi
974
975	isPrimaryArch=1
976	for targetArch in $targetArchs; do
977		# Note: targetArch is "unknown<n>" at this point if a cross-tools
978		# prefix was specified. The standard_gcc_settings call below will get
979		# the actual architecture.
980
981		if test "${HAIKU_PACKAGING_ARCHS#*$targetArch\b}" != "$HAIKU_PACKAGING_ARCHS"; then
982			# somehow we wound up with a duplicate arch; skip this one
983			continue
984		fi
985
986		crossToolsPrefix=`get_variable crossToolsPrefix_$targetArch`
987
988		# build cross tools from sources
989		if [ -n "$buildCrossTools" -a -z "$crossToolsPrefix" ]; then
990			crossToolsDir="$outputDir/cross-tools-$targetArch"
991			targetMachine=`get_variable buildCrossToolsMachine_$targetArch`
992			script="$buildCrossToolsScript"
993			scriptArgs=
994			if [ $targetArch != x86_gcc2 ]; then
995				script="${script}_gcc4"
996				scriptArgs="$targetMachine"
997				set_default_value HAIKU_USE_GCC_GRAPHITE_$targetArch	\
998					$useGccGraphiteDefault
999			fi
1000			secondaryArch=
1001			if [ -z "$isPrimaryArch" ]; then
1002				secondaryArch=$targetArch
1003			fi
1004
1005			case $HOST_PLATFORM in
1006				freebsd|openbsd)	MAKE=gmake;;
1007				*)					MAKE=make;;
1008			esac
1009
1010			if ! valid_toolchain "${targetMachine}" "${crossToolsDir}" "${buildCrossTools}"; then
1011				MAKE=$MAKE \
1012				SECONDARY_ARCH=$secondaryArch \
1013				HAIKU_USE_GCC_GRAPHITE=`get_variable \
1014					HAIKU_USE_GCC_GRAPHITE_$targetArch` \
1015				HAIKU_USE_GCC_PIPE=$HAIKU_USE_GCC_PIPE \
1016				HAIKU_USE_GDB="$gdbSources" \
1017				HAIKU_USE_SYSROOT="$crossToolsSysroot" \
1018				"$script" $scriptArgs "$sourceDir" "$buildCrossTools" \
1019					"$crossToolsDir" $buildCrossToolsJobs || exit 1
1020			else
1021				echo "$targetArch crosstools already exist in $crossToolsDir; skipping build"
1022			fi
1023			crossToolsPrefix="$crossToolsDir/bin/${targetMachine}-"
1024		fi
1025
1026		# prepare gcc settings and get the actual target architecture
1027		if [ $useClang = 1 ]; then
1028			gcc="$HAIKU_clang -target ${targetMachine}"
1029			if [ ! -z "${crossToolsPrefix}" ]; then
1030				gcc="$gcc -B ${crossToolsPrefix}"
1031			fi
1032
1033			# Clang's compiler intrinsics are not compatible with GCC's or even
1034			# across versions of Clang, so we must collect them for use in the build.
1035			mkdir -p "$outputDir/clang_headers" || exit 1
1036			clangHeadersDir=`$gcc -print-resource-dir`/include/
1037			case $targetArch in
1038				x86*) cp $clangHeadersDir/*intrin* $clangHeadersDir/mm3* "$outputDir/clang_headers" || exit 1 ;;
1039				ppc*) cp $clangHeadersDir/*altivec* "$outputDir/clang_headers" || exit 1 ;;
1040				arm*) cp $clangHeadersDir/*arm* "$outputDir/clang_headers" || exit 1 ;;
1041			esac
1042		elif [ -z "${crossToolsPrefix}" ]; then
1043			gcc=`get_variable HAIKU_CC_$targetArch`
1044		else
1045			gcc="${crossToolsPrefix}gcc"
1046		fi
1047		standard_gcc_settings "$gcc"
1048		targetArch=$standard_gcc_settings_targetArch
1049
1050		# set default values for flags
1051		set_default_value HAIKU_CPPFLAGS_$targetArch	""
1052		set_default_value HAIKU_CCFLAGS_$targetArch		""
1053		set_default_value HAIKU_CXXFLAGS_$targetArch	""
1054		set_default_value HAIKU_LINKFLAGS_$targetArch	""
1055		set_default_value HAIKU_LDFLAGS_$targetArch		""
1056		set_default_value HAIKU_ARFLAGS_$targetArch		cru
1057		set_default_value HAIKU_UNARFLAGS_$targetArch	x
1058
1059		# Override the cross tools variables, if the tools were built or a
1060		# prefix was specified.
1061		if [ $useClang = 1 ]; then
1062			get_build_tool_path LD_$targetArch ld.lld
1063			get_build_tool_path ELFEDIT_$targetArch elfedit
1064		elif [ -n "$crossToolsPrefix" ]; then
1065			get_build_tool_path LD_$targetArch ${crossToolsPrefix}ld
1066			if [ `get_variable HAIKU_CC_IS_LEGACY_GCC_$targetArch` -eq 0 ]; then
1067				get_build_tool_path ELFEDIT_$targetArch ${crossToolsPrefix}elfedit
1068			fi
1069		fi
1070		if [ -n "$crossToolsPrefix" ]; then
1071			get_build_tool_path AR_$targetArch ${crossToolsPrefix}ar
1072			get_build_tool_path OBJCOPY_$targetArch ${crossToolsPrefix}objcopy
1073			get_build_tool_path RANLIB_$targetArch ${crossToolsPrefix}ranlib
1074			get_build_tool_path STRIP_$targetArch ${crossToolsPrefix}strip
1075		fi
1076
1077		# check whether the Haiku compiler really targets Haiku
1078		targetMachine=`get_variable HAIKU_GCC_MACHINE_$targetArch`
1079		case "$targetMachine" in
1080			*-*-haiku)	;;
1081			*)
1082				echo The compiler specified as Haiku target compiler is not a \
1083				valid Haiku cross-compiler. Please see ReadMe.cross-compile. >&2
1084				echo compiler: $HAIKU_CC
1085				echo compiler is configured for target: $targetMachine
1086				exit 1 ;;
1087		esac
1088
1089		HAIKU_PACKAGING_ARCHS="$HAIKU_PACKAGING_ARCHS $targetArch"
1090		isPrimaryArch=
1091	done
1092fi
1093
1094# Generate BuildConfig
1095cat << EOF > "$buildConfigFile"
1096# -- WARNING --
1097# This file was AUTOMATICALLY GENERATED by configure, and will be completely
1098# overwritten the next time configure is run.
1099#
1100#d ${currentDir}
1101#c ${configurePath}
1102#e ${configureEnvirons}
1103#a ${configureArgs}
1104
1105HOST_PLATFORM				?= "${HOST_PLATFORM}" ;
1106TARGET_PLATFORM 			?= "${TARGET_PLATFORM}" ;
1107HAIKU_PACKAGING_ARCHS		?= ${HAIKU_PACKAGING_ARCHS} ;
1108
1109HAIKU_NO_DOWNLOADS			?= "${HAIKU_NO_DOWNLOADS}" ;
1110HAIKU_INCLUDE_SOURCES		?= "${HAIKU_INCLUDE_SOURCES}" ;
1111HAIKU_INCLUDE_3RDPARTY		?= "${HAIKU_INCLUDE_3RDPARTY}" ;
1112HAIKU_DISTRO_COMPATIBILITY	?= "${HAIKU_DISTRO_COMPATIBILITY}" ;
1113
1114HAIKU_USE_GCC_PIPE			?= "${HAIKU_USE_GCC_PIPE}" ;
1115HAIKU_HOST_USE_32BIT		?= "${HAIKU_HOST_USE_32BIT}" ;
1116HAIKU_HOST_USE_XATTR		?= "${HAIKU_HOST_USE_XATTR}" ;
1117HAIKU_HOST_USE_XATTR_REF	?= "${HAIKU_HOST_USE_XATTR_REF}" ;
1118HAIKU_HOST_BUILD_ONLY		?= "${HAIKU_HOST_BUILD_ONLY}" ;
1119
1120JAMSHELL					?= ${JAMSHELL} -e -c ;
1121
1122HOST_CC						?= ${CC} ;
1123HOST_CC_IS_LEGACY_GCC		?= ${HOST_CC_IS_LEGACY_GCC} ;
1124HOST_GCC_MACHINE			?= ${HOST_GCC_MACHINE} ;
1125HOST_LD						?= ${HOST_GCC_LD} ;
1126HOST_OBJCOPY				?= ${HOST_GCC_OBJCOPY} ;
1127HOST_EXTENDED_REGEX_SED		?= ${HOST_EXTENDED_REGEX_SED} ;
1128HOST_SHA256					?= ${HOST_SHA256} ;
1129HOST_PYTHON					?= ${HOST_PYTHON} ;
1130HAIKU_NASM					?= ${HAIKU_NASM} ;
1131
1132HAIKU_BUILD_ATTRIBUTES_DIR	?= "${HAIKU_BUILD_ATTRIBUTES_DIR}" ;
1133
1134HOST_HAIKU_PORTER			?= ${HOST_HAIKU_PORTER} ;
1135HAIKU_PORTS					?= ${HAIKU_PORTS} ;
1136HAIKU_PORTS_CROSS			?= ${HAIKU_PORTS_CROSS} ;
1137HAIKU_IS_BOOTSTRAP			?= ${HAIKU_IS_BOOTSTRAP} ;
1138
1139HAIKU_BOOT_EFI_PRIVATE_KEYFILE	?= ${HAIKU_EFI_SIGNING_KEY} ;
1140EOF
1141
1142for targetArch in $HAIKU_PACKAGING_ARCHS; do
1143	variables="
1144		HAIKU_CC					HAIKU_CC
1145		HAIKU_CC_IS_LEGACY_GCC		HAIKU_CC_IS_LEGACY_GCC
1146		HAIKU_CC_IS_CLANG			HAIKU_CC_IS_CLANG
1147		HAIKU_USE_GCC_GRAPHITE		HAIKU_USE_GCC_GRAPHITE
1148		HAIKU_CPU					HAIKU_CPU
1149		HAIKU_GCC_MACHINE			HAIKU_GCC_MACHINE
1150		HAIKU_GCC_LIB_DIR			HAIKU_GCC_LIB_DIR
1151		HAIKU_BOOT_LIBGCC			HAIKU_BOOT_LIBGCC
1152		HAIKU_BOOT_LIBSUPC++		HAIKU_BOOT_LIBSUPCXX
1153		HAIKU_BOOT_32_LIBGCC		HAIKU_BOOT_32_LIBGCC
1154		HAIKU_BOOT_32_LIBSUPC++		HAIKU_BOOT_32_LIBSUPCXX
1155		HAIKU_AR					HAIKU_AR
1156		HAIKU_LD					HAIKU_LD
1157		HAIKU_OBJCOPY				HAIKU_OBJCOPY
1158		HAIKU_RANLIB				HAIKU_RANLIB
1159		HAIKU_ELFEDIT				HAIKU_ELFEDIT
1160		HAIKU_STRIP					HAIKU_STRIP
1161		HAIKU_CPPFLAGS				HAIKU_CPPFLAGS
1162		HAIKU_CCFLAGS				HAIKU_CCFLAGS
1163		HAIKU_C++FLAGS				HAIKU_CXXFLAGS
1164		HAIKU_LINKFLAGS				HAIKU_LINKFLAGS
1165		HAIKU_LDFLAGS				HAIKU_LDFLAGS
1166		HAIKU_ARFLAGS				HAIKU_ARFLAGS
1167		HAIKU_UNARFLAGS				HAIKU_UNARFLAGS
1168		"
1169	set -- $variables
1170	while [ $# -ge 2 ]; do
1171		value=`get_variable ${2}_$targetArch`
1172		echo "${1}_${targetArch} ?= $value ;" >> "$buildConfigFile"
1173		shift 2
1174	done
1175
1176	# For variables that may have long values, distribute them over multiple
1177	# lines so that jam doesn't hit the maximum line length.
1178	variables="
1179		HAIKU_BOOT_C++_HEADERS_DIR	HAIKU_BOOT_CXX_HEADERS_DIR
1180		HAIKU_BOOT_32_C++_HEADERS_DIR	HAIKU_BOOT_32_CXX_HEADERS_DIR
1181		"
1182	set -- $variables
1183	while [ $# -ge 2 ]; do
1184		echo "${1}_${targetArch} ?= " >> "$buildConfigFile"
1185		get_variable ${2}_$targetArch | xargs -n 1 echo "   " \
1186			>> "$buildConfigFile"
1187		echo "    ;" >> "$buildConfigFile"
1188		shift 2
1189	done
1190done
1191
1192
1193# Generate a Jamfile in the output directory.
1194
1195cat << EOF > $outputDir/Jamfile
1196# -- WARNING --
1197# This file was AUTOMATICALLY GENERATED by configure, and will be completely
1198# overwritten the next time configure is run.
1199
1200HAIKU_TOP			= $(relative_to "${sourceDir}" "${outputDir}") ;
1201HAIKU_OUTPUT_DIR	= . ;
1202
1203include [ FDirName \$(HAIKU_TOP) Jamfile ] ;
1204
1205EOF
1206
1207echo "Configured successfully!"
1208