xref: /haiku/configure (revision 14b32de1d5efe99b4c6d4ef8c25df47eb009cf0f)
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  --alternative-gcc-output-dir <dir>
16                              Build a Haiku installation that supports running
17                              executables built with a gcc version incompatible
18                              with the primary gcc (e.g. gcc 2 executables under
19                              a gcc 4 Haiku or vice versa). <dir> specifies the
20                              output directory of the other gcc. The directory
21                              must already be fully configured.
22                              Note, that a sub-jam will be executed when
23                              building Haiku. When using a jam that is not
24                              simply invoked by "jam", the JAM build variable
25                              needs to be set accordingly.
26                              To disable building the alternative libraries
27                              the variable HAIKU_ADD_ALTERNATIVE_GCC_LIBS can be
28                              unset in the UserBuildConfig file.
29  --build-cross-tools <build tools dir>
30                              Assume cross compilation. <build tools dir>
31                              defines the location of the build tools sources.
32                              They will be compiled and placed in the output
33                              directory under "cross-tools". The HAIKU_* tools
34                              variables will be set accordingly.
35  --build-cross-tools-gcc4 <arch> <build tools dir>
36                              Like "--build-cross-tools" just that gcc 4 will
37                              be used for cross-compilation. Note, that the
38                              resulting Haiku installation built with gcc 4
39                              will not be binary compatible with BeOS R5.
40                              <arch> specifies the target architecture, either
41                              "x86", "x86_64", "ppc", "m68k", "arm" or "mipsel".
42  --cross-tools-prefix <prefix>
43                              Assume cross compilation. <prefix> should be a
44                              path to the directory where the cross
45                              compilation tools are located, plus the platform
46                              prefix, e.g. "/path/to/tools/i586-pc-haiku-".
47                              This overrides the HAIKU_* tool variables.
48  --distro-compatibility <level>
49                              The distribution's level of compatibility with
50                              the official Haiku distribution. The generated
51                              files will contain the respective trademarks
52                              accordingly.
53                              official -- the official Haiku distribution.
54                              compatible -- a Haiku Compatible (tm) distro.
55                              default -- any other distro (default value).
56  --enable-multiuser          Enable experimental multiuser support.
57  --help                      Prints out this help.
58  --include-gpl-addons        Include GPL licensed add-ons.
59  --include-patented-code     Enable code that is known to implemented patented
60                              ideas and techniques. If this option is not
61                              specified, the resulting distribution may still
62                              implement patented ideas and techniques. This
63                              option only disables code that is currently known
64                              to be problematic.
65  --include-sources           Includes the source code of projects that require
66                              either an offer of source code or a copy of the
67                              patched sources. This is preferable when
68                              distributing on physical mediums.
69  --include-3rdparty          Include 3rdparty/ in the build system.
70  -j<n>                       Only relevant for --build-cross-tools and
71                              --build-cross-tools-gcc4. Is passed on to the
72                              make building the build tools.
73  --target=TARGET             Select build target platform.
74                              [default=${TARGET_PLATFORM}]
75                              valid targets=r5,bone,dano,haiku
76  --update                    re-runs last configure invocation [must be given
77                              as first option!]
78  --use-gcc-pipe              Build with GCC option -pipe. Speeds up the build
79                              process, but uses more memory.
80  --use-gcc-graphite          Build with GCC Graphite engine for loop
81                              optimizations. Only for gcc 4.
82  --use-32bit                 Use -m32 flag on 64bit host gcc compiler.
83  --use-xattr                 Use Linux xattr support for BeOS attribute
84                              emulation. Warning: Make sure your file system
85                              supports sufficient attribute sizes (4 KB per
86                              file for all attributes won't suffice).
87
88environment variables:
89  HAIKU_AR                    The static library archiver. Defaults to "ar".
90  HAIKU_CC                    The compiler. Defaults to "gcc".
91  HAIKU_LD                    The linker. Defaults to "ld".
92  HAIKU_OBJCOPY               The objcopy to be used. Defaults to "objcopy".
93  HAIKU_RANLIB                The static library indexer. Defaults to "ranlib".
94  HAIKU_YASM                  The yasm assembler (x86 only).
95  HAIKU_STRIP                 The strip command. Defaults to "strip".
96  HAIKU_CPPFLAGS              The preprocessor flags. Defaults to "".
97  HAIKU_CCFLAGS               The C flags. Defaults to "".
98  HAIKU_CXXFLAGS              The C++ flags. Defaults to "".
99  HAIKU_LDFLAGS               The linker flags. Defaults to "".
100  HAIKU_ARFLAGS               The flags passed to HAIKU_AR for archiving.
101                              Defaults to "cru".
102  HAIKU_UNARFLAGS             The flags passed to HAIKU_AR for unarchiving.
103                              Defaults to "x".
104
105Non-standard output directories:
106  By default all objects, build configuration, and other related files are
107  stored in /path/to/haiku_source/generated.  To store objects in a non-default
108  location, run "../../relative/path/to/haiku_source/configure <options>" from
109  within your non-default location.  "jam [ options ] targets" can then be run
110  directly inside your non-default location.  Another option is to invoke "jam
111  [ options ] targets" from within haiku_source.  This can be accomplished by
112  either "export HAIKU_OUTPUT_DIR=your non-default location" before invoking
113  jam or by creating a symlink of haiku_source/generated pointing to your
114  non-default location and running jam.
115
116
117EOF
118}
119
120# assertparam
121#
122# Checks whether at least one parameter is left.
123#
124assertparam()
125{
126	if [ $2 -lt 2 ]; then
127		echo $0: \`$1\': Parameter expected.
128		exit 1
129	fi
130}
131
132# assertparams
133#
134# Checks whether at least a certain number of parameters is left.
135#
136assertparams()
137{
138	if [ $3 -le $2 ]; then
139		echo $0: \`$1\': Not enough parameters.
140		exit 1
141	fi
142}
143
144# real_path
145#
146# returns the realpath of a symbolic link.
147#
148real_path()
149{
150	perl -MCwd=realpath -e'print realpath($ARGV[0]), "\n"' "$1"
151}
152
153# standard_gcc_settings
154#
155# Sets the variables for a GCC platform.
156#
157standard_gcc_settings()
158{
159	if which greadlink > /dev/null 2>&1; then
160		readlink="greadlink -e"
161	elif which realpath > /dev/null 2>&1; then
162		readlink=realpath
163	elif readlink -e / > /dev/null 2>&1; then
164		readlink="readlink -e"
165	else
166		readlink=real_path
167	fi
168
169	# PLATFORM_LINKLIBS
170	gcclib=`$HAIKU_CC -print-libgcc-file-name`
171	gccdir=`dirname ${gcclib}`
172
173	HAIKU_GCC_RAW_VERSION=`$HAIKU_CC -dumpversion`
174	HAIKU_GCC_MACHINE=`$HAIKU_CC -dumpmachine`
175	if [ "$HAIKU_USE_GCC_GRAPHITE" != 0 ]; then
176		UNUSED=`echo "int main() {}" | $HAIKU_CC -xc -c -floop-block - 2>&1`
177		if [ $? != 0 ]; then
178			echo "GCC Graphite loop optimizations cannot be used"
179			HAIKU_USE_GCC_GRAPHITE=0
180		fi
181	fi
182
183	HAIKU_GCC_LIB_DIR=${gccdir}
184	HAIKU_GCC_LIBGCC=${gccdir}/libgcc.a
185	HAIKU_GCC_GLUE_CODE="crtbegin.o crtend.o"
186	HAIKU_GCC_HEADERS_DIR="${gccdir}/include
187		${gccdir}/include-fixed"
188	HAIKU_GCC_LIBGCC_OBJECTS=`$HAIKU_AR t ${HAIKU_GCC_LIBGCC} | grep -v eabi.o`
189		# Note: We filter out eabi.o. It's present in gcc's libgcc for PPC and
190		# neither needed nor wanted.
191
192	case $HAIKU_GCC_RAW_VERSION in
193		4.*)
194			# for gcc 4 we use the libstdc++ and libsupc++ that come with the
195			# compiler
196			HAIKU_STATIC_LIBSTDCXX=`$HAIKU_CC -print-file-name=libstdc++.a`
197			HAIKU_SHARED_LIBSTDCXX=`$HAIKU_CC -print-file-name=libstdc++.so`
198			HAIKU_STATIC_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.a`
199			HAIKU_SHARED_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.so`
200
201			# If the architecture has separate runtime libraries for the
202			# kernel, use them.
203			HAIKU_KERNEL_LIBGCC=`$HAIKU_CC -print-file-name=libgcc-kernel.a`
204			if [ $HAIKU_KERNEL_LIBGCC = libgcc-kernel.a ]; then
205				HAIKU_KERNEL_LIBGCC=$HAIKU_GCC_LIBGCC
206			fi
207			HAIKU_KERNEL_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++-kernel.a`
208			if [ $HAIKU_KERNEL_LIBSUPCXX = libsupc++-kernel.a ]; then
209				HAIKU_KERNEL_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
210			fi
211
212			local headers
213			if [ -d $gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION ]; then
214				headers=$gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION
215			else
216				headers=$gccdir/../../../../include/c++/$HAIKU_GCC_RAW_VERSION
217			fi
218
219			HAIKU_CXX_HEADERS_DIR=$headers
220			for d in $HAIKU_GCC_MACHINE backward ext; do
221				# Note: We need the line break, otherwise the line might become
222				# too long for jam (512 bytes max).
223				HAIKU_CXX_HEADERS_DIR="$HAIKU_CXX_HEADERS_DIR
224					$headers/$d"
225			done
226
227			# Unset the HAIKU_{SHARED,STATIC}_LIB{STD,SUP}CXX variables, if the
228			# compiler didn't give us actual file names. Otherwise resolve
229			# symlinks to avoid problems when copying the libraries to the
230			# image.
231
232			if [ $HAIKU_STATIC_LIBSTDCXX = libstdc++.a ]; then
233				HAIKU_STATIC_LIBSTDCXX=
234			else
235				HAIKU_STATIC_LIBSTDCXX=`$readlink $HAIKU_STATIC_LIBSTDCXX`
236			fi
237
238			if [ $HAIKU_SHARED_LIBSTDCXX = libstdc++.so ]; then
239				HAIKU_SHARED_LIBSTDCXX=
240			else
241				HAIKU_SHARED_LIBSTDCXX=`$readlink $HAIKU_SHARED_LIBSTDCXX`
242			fi
243
244			if [ $HAIKU_STATIC_LIBSUPCXX = libsupc++.a ]; then
245				HAIKU_STATIC_LIBSUPCXX=
246			else
247				HAIKU_STATIC_LIBSUPCXX=`$readlink $HAIKU_STATIC_LIBSUPCXX`
248			fi
249
250			if [ $HAIKU_SHARED_LIBSUPCXX = libsupc++.so ]; then
251				HAIKU_SHARED_LIBSUPCXX=
252			else
253				HAIKU_SHARED_LIBSUPCXX=`$readlink $HAIKU_SHARED_LIBSUPCXX`
254			fi
255		;;
256		2.9*)
257			# check for correct (most up-to-date) legacy compiler and complain
258			# if an older one is installed
259			if [ $HAIKU_GCC_RAW_VERSION != $haikuRequiredLegacyGCCVersion ]; then
260				echo "GCC version $haikuRequiredLegacyGCCVersion is required!";
261				echo "Please download it from www.haiku-os.org...";
262				exit 1;
263			fi
264
265			HAIKU_KERNEL_LIBGCC=$HAIKU_GCC_LIBGCC
266			HAIKU_KERNEL_LIBSUPCXX=
267		;;
268	esac
269
270	case $HAIKU_GCC_MACHINE in
271		x86_64-*)
272			# Boot loader is 32-bit, need the 32-bit libs.
273			HAIKU_BOOT_LIBGCC=`$HAIKU_CC -m32 -print-libgcc-file-name`
274			HAIKU_BOOT_LIBSUPCXX=`$HAIKU_CC -m32 -print-file-name=libsupc++.a`
275		;;
276		*)
277			HAIKU_BOOT_LIBGCC=$HAIKU_GCC_LIBGCC
278			HAIKU_BOOT_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
279		;;
280	esac
281}
282
283# set_default_value
284#
285# Set the value for a variable, if no value is set yet.
286#
287set_default_value()
288{
289	eval "$1=\${$1-$2}"
290}
291
292# get_build_tool_path
293#
294# Gets a usable absolute path of a build tool.
295#
296get_build_tool_path()
297{
298	local var="HAIKU_$1"
299	local tool=$2
300	local path="${crossToolsPrefix}$tool"
301
302	if [ -f "$path" ]; then
303		# get absolute path
304		local oldPwd="`pwd`"
305		cd "`dirname "$path"`"
306		path="`pwd`/`basename "$path"`"
307		cd $oldPwd
308	else
309		which "$path" > /dev/null 2>&1 || {
310			echo "Build tool \"$path\" not found." >&2
311			exit 1
312		}
313	fi
314
315	eval "$var=$path"
316}
317
318# get cwd and the source directory
319currentDir=`pwd`
320cd `dirname "$0"`
321sourceDir=`pwd`
322cd "$currentDir"
323
324# backup the passed arguments
325configureArgs="$@"
326
327# internal default parameter values
328#
329platform=`uname`
330platformMachine=`uname  -m`
331targetArch=x86
332crossToolsPrefix=
333buildCrossTools=
334buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
335buildCrossToolsMachine=
336buildCrossToolsJobs=
337
338# exported (BuildSetup) default parameter values
339#
340HAIKU_GCC_RAW_VERSION=
341HAIKU_GCC_MACHINE=i586-pc-haiku
342HAIKU_STATIC_LIBSTDCXX=
343HAIKU_SHARED_LIBSTDCXX=
344HAIKU_STATIC_LIBSUPCXX=
345HAIKU_SHARED_LIBSUPCXX=
346HAIKU_CXX_HEADERS_DIR=
347HOST_GCC_RAW_VERSION=`gcc -dumpversion`
348HOST_GCC_MACHINE=`gcc -dumpmachine`
349HAIKU_INCLUDE_GPL_ADDONS=0
350HAIKU_INCLUDE_PATENTED_CODE=0
351HAIKU_INCLUDE_SOURCES=0
352HAIKU_INCLUDE_3RDPARTY=0
353HAIKU_ENABLE_MULTIUSER=0
354HAIKU_DISTRO_COMPATIBILITY=default
355TARGET_PLATFORM=haiku
356HAIKU_USE_GCC_PIPE=0
357HAIKU_USE_GCC_GRAPHITE=0
358HAIKU_HOST_USE_32BIT=0
359HAIKU_HOST_USE_XATTR=0
360HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR=
361HAIKU_ADD_ALTERNATIVE_GCC_LIBS=0
362HOST_GCC_LD=`gcc -print-prog-name=ld`
363HOST_GCC_OBJCOPY=`gcc -print-prog-name=objcopy`
364SFDISK_BINARY=sfdisk
365HOST_SFDISK=$SFDISK_BINARY
366
367haikuRequiredLegacyGCCVersion="2.95.3-haiku-121101"
368export haikuRequiredLegacyGCCVersion
369	# version of legacy gcc required to build haiku
370
371set_default_value HAIKU_AR			ar
372set_default_value HAIKU_CC			gcc
373set_default_value HAIKU_LD			ld
374set_default_value HAIKU_OBJCOPY		objcopy
375set_default_value HAIKU_RANLIB		ranlib
376set_default_value HAIKU_ELFEDIT		elfedit
377set_default_value HAIKU_YASM		yasm
378set_default_value HAIKU_STRIP		strip
379set_default_value HAIKU_CPPFLAGS	""
380set_default_value HAIKU_CCFLAGS		""
381set_default_value HAIKU_CXXFLAGS	""
382set_default_value HAIKU_LDFLAGS		""
383set_default_value HAIKU_ARFLAGS		cru
384set_default_value HAIKU_UNARFLAGS	x
385
386# determine output directory
387if [ "$currentDir" = "$sourceDir" ]; then
388	outputDir=$currentDir/generated
389else
390	outputDir=$currentDir
391fi
392buildOutputDir="$outputDir/build"
393HAIKU_BUILD_ATTRIBUTES_DIR="$outputDir/attributes"
394buildConfigFile="$buildOutputDir/BuildConfig"
395
396# check for update request
397if [ "$1" = "--update" ]; then
398	if ! [ -e "$buildConfigFile" ]; then
399		echo $0 --update: \'$buildConfigFile\' not found - updating not possible.
400		exit 1
401	fi
402	if ! type perl >/dev/null 2>&1; then
403		echo $0 --update: \'perl\' not found - updating not possible.
404		exit 1
405	fi
406	# convert BuildConfig from jam format to shell format and evaluate it
407	shellConfigFile="${buildConfigFile}.shell"
408	perl "$sourceDir/build/scripts/convert_build_config_to_shell_format.pl" \
409		<"$buildConfigFile" >"$shellConfigFile"
410	. "$shellConfigFile"
411	rm "$shellConfigFile"
412	shift
413fi
414
415# parse parameters
416#
417while [ $# -gt 0 ] ; do
418	case "$1" in
419		--alternative-gcc-output-dir)
420			assertparam "$1" $#
421			cd $2 || exit 1
422			HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR=`pwd`
423			HAIKU_ADD_ALTERNATIVE_GCC_LIBS=1
424			cd $currentDir
425			shift 2
426			;;
427		--build-cross-tools) assertparam "$1" $#; buildCrossTools=$2; shift 2;;
428		--build-cross-tools-gcc4)
429			assertparams "$1" 2 $#
430			buildCrossTools=$3
431			buildCrossToolsScript="${buildCrossToolsScript}_gcc4"
432			case "$2" in
433				x86)	HAIKU_GCC_MACHINE=i586-pc-haiku;;
434				x86_64)	HAIKU_GCC_MACHINE=x86_64-unknown-haiku; targetArch=x86_64;;
435				ppc)	HAIKU_GCC_MACHINE=powerpc-apple-haiku; targetArch=ppc;;
436				m68k)	HAIKU_GCC_MACHINE=m68k-unknown-haiku; targetArch=m68k;;
437				arm)	HAIKU_GCC_MACHINE=arm-unknown-haiku; targetArch=arm;;
438				mipsel)	HAIKU_GCC_MACHINE=mipsel-unknown-haiku; targetArch=mips;;
439				*)		echo "Unsupported target architecture: $2"
440						exit 1;;
441			esac
442			buildCrossToolsMachine=$HAIKU_GCC_MACHINE
443			shift 3
444			;;
445		--cross-tools-prefix)
446			assertparam "$1" $#
447			crossToolsPrefix=$2
448			shift 2
449			;;
450		--distro-compatibility)
451			assertparam "$1" $#
452			HAIKU_DISTRO_COMPATIBILITY=$2
453			case "$HAIKU_DISTRO_COMPATIBILITY" in
454				official)	;;
455				compatible)	;;
456				default)	;;
457				*)			echo "Invalid distro compatibility" \
458								"level: $HAIKU_DISTRO_COMPATIBILITY"
459							exit 1;;
460			esac
461			shift 2
462			;;
463		--enable-multiuser)	HAIKU_ENABLE_MULTIUSER=1; shift 1;;
464		--help | -h)	usage; exit 0;;
465		--include-gpl-addons)	HAIKU_INCLUDE_GPL_ADDONS=1; shift 1;;
466		--include-patented-code)	HAIKU_INCLUDE_PATENTED_CODE=1; shift 1;;
467		--include-sources)	HAIKU_INCLUDE_SOURCES=1; shift 1;;
468		--include-3rdparty)	HAIKU_INCLUDE_3RDPARTY=1; shift 1;;
469        -j*)				buildCrossToolsJobs="$1"; shift 1;;
470		--target=*)     TARGET_PLATFORM=`echo $1 | cut -d'=' -f2-`; shift 1;;
471		--use-gcc-pipe)	HAIKU_USE_GCC_PIPE=1; shift 1;;
472		--use-gcc-graphite)	HAIKU_USE_GCC_GRAPHITE=1; shift 1;;
473		--use-32bit)	HAIKU_HOST_USE_32BIT=1; shift 1;;
474		--use-xattr)	HAIKU_HOST_USE_XATTR=1; shift 1;;
475		*)				echo Invalid argument: \`$1\'; exit 1;;
476	esac
477done
478
479# detect the build platform
480case "${platform}" in
481	BeOS)	revision=`uname -r`
482			case "$revision" in
483				6.*)	HOST_PLATFORM=dano ;;
484				5.1)	HOST_PLATFORM=dano ;;
485				5.0.4)	HOST_PLATFORM=bone ;;
486				5.0*)	HOST_PLATFORM=r5 ;;
487				*)		echo Unknown BeOS version: $revision
488						exit 1 ;;
489			esac
490			;;
491	Darwin)	HOST_PLATFORM=darwin ;;
492	FreeBSD)	HOST_PLATFORM=freebsd
493				SFDISK_BINARY=sfdisk-linux
494				if [ "$HAIKU_HOST_USE_32BIT" = 1 ] ; then
495					echo Unsupported platform: FreeBSD ${platformMachine}
496					exit 1
497				fi	;;
498	Haiku)	HOST_PLATFORM=haiku_host ;;
499	Linux)	HOST_PLATFORM=linux ;;
500	OpenBSD) HOST_PLATFORM=openbsd ;;
501	SunOS)	HOST_PLATFORM=sunos ;;
502	CYGWIN_NT-*) HOST_PLATFORM=cygwin ;;
503	*)		echo Unsupported platform: ${platform}
504			exit 1 ;;
505esac
506
507# check common locations for sfdisk
508for sfdiskDir in /sbin /usr/sbin /usr/local/sbin ; do
509	if [ -e ${sfdiskDir}/${SFDISK_BINARY} ]; then
510		HOST_SFDISK=${sfdiskDir}/${SFDISK_BINARY}
511	fi
512done
513
514# check for case-sensitive filesystem
515mkdir haikuCaseTest 2>/dev/null
516mkdir haikucasetest 2>/dev/null
517caseInsensitive=$?
518rmdir haikuCaseTest haikucasetest 2>/dev/null
519if [ $caseInsensitive != 0 ]; then
520	echo "You need a case-sensitive file-system to build Haiku."
521	if [ $HOST_PLATFORM = "darwin" ]; then
522		echo "You can create a case-sensitive disk image using Disk Utility and use"
523		echo "it to store the Haiku sources on."
524	fi
525	exit 1
526fi
527
528# create output directory
529mkdir -p "$buildOutputDir" || exit 1
530
531# build cross tools from sources
532if [ -n "$buildCrossTools" ]; then
533	export HAIKU_USE_GCC_GRAPHITE
534	"$buildCrossToolsScript" $buildCrossToolsMachine "$sourceDir" \
535		"$buildCrossTools" "$outputDir" $buildCrossToolsJobs || exit 1
536	crossToolsPrefix="$outputDir/cross-tools/bin/${HAIKU_GCC_MACHINE}-"
537fi
538
539# cross tools
540if [ -n "$crossToolsPrefix" ]; then
541	get_build_tool_path AR ar
542	get_build_tool_path CC gcc
543	get_build_tool_path LD ld
544	get_build_tool_path OBJCOPY objcopy
545	get_build_tool_path RANLIB ranlib
546	get_build_tool_path STRIP strip
547fi
548
549# prepare gcc settings
550standard_gcc_settings
551
552# cross tools for gcc4 builds
553if [ -n "$crossToolsPrefix" ]; then
554	case $HAIKU_GCC_RAW_VERSION in
555		4.*)
556			get_build_tool_path ELFEDIT elfedit
557		;;
558	esac
559fi
560
561# check whether the Haiku compiler really targets Haiku or BeOS
562case "$HAIKU_GCC_MACHINE" in
563	*-*-haiku)	;;
564	*-*-beos)	;;
565	*) echo The compiler specified as Haiku target compiler is not a valid \
566			Haiku cross-compiler. Please see ReadMe.cross-compile. >&2
567	   echo compiler: $HAIKU_CC
568	   echo compiler is configured for target: $HAIKU_GCC_MACHINE
569	   exit 1 ;;
570esac
571
572# Generate BuildConfig
573cat << EOF > "$buildConfigFile"
574# BuildConfig
575# Note: This file has been automatically generated by configure with the
576# following arguments:
577# ${configureArgs}
578
579TARGET_PLATFORM 			?= "${TARGET_PLATFORM}" ;
580HOST_PLATFORM				?= "${HOST_PLATFORM}" ;
581
582HAIKU_INCLUDE_GPL_ADDONS			?= "${HAIKU_INCLUDE_GPL_ADDONS}" ;
583HAIKU_INCLUDE_PATENTED_CODE			?= "${HAIKU_INCLUDE_PATENTED_CODE}" ;
584HAIKU_INCLUDE_SOURCES				?= "${HAIKU_INCLUDE_SOURCES}" ;
585HAIKU_INCLUDE_3RDPARTY				?= "${HAIKU_INCLUDE_3RDPARTY}" ;
586HAIKU_ENABLE_MULTIUSER				?= "${HAIKU_ENABLE_MULTIUSER}" ;
587HAIKU_DISTRO_COMPATIBILITY			?= "${HAIKU_DISTRO_COMPATIBILITY}" ;
588HAIKU_USE_GCC_PIPE					?= "${HAIKU_USE_GCC_PIPE}" ;
589HAIKU_USE_GCC_GRAPHITE				?= "${HAIKU_USE_GCC_GRAPHITE}" ;
590HAIKU_HOST_USE_32BIT				?= "${HAIKU_HOST_USE_32BIT}" ;
591HAIKU_HOST_USE_XATTR				?= "${HAIKU_HOST_USE_XATTR}" ;
592HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR	?= ${HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR} ;
593HAIKU_ADD_ALTERNATIVE_GCC_LIBS		?= ${HAIKU_ADD_ALTERNATIVE_GCC_LIBS} ;
594
595HAIKU_GCC_RAW_VERSION		?= ${HAIKU_GCC_RAW_VERSION} ;
596HAIKU_GCC_MACHINE			?= ${HAIKU_GCC_MACHINE} ;
597HAIKU_GCC_LIB_DIR			?= ${HAIKU_GCC_LIB_DIR} ;
598HAIKU_GCC_HEADERS_DIR		?= ${HAIKU_GCC_HEADERS_DIR} ;
599HAIKU_GCC_LIBGCC			?= ${HAIKU_GCC_LIBGCC} ;
600
601HAIKU_STATIC_LIBSTDC++		?= ${HAIKU_STATIC_LIBSTDCXX} ;
602HAIKU_SHARED_LIBSTDC++		?= ${HAIKU_SHARED_LIBSTDCXX} ;
603HAIKU_STATIC_LIBSUPC++		?= ${HAIKU_STATIC_LIBSUPCXX} ;
604HAIKU_SHARED_LIBSUPC++		?= ${HAIKU_SHARED_LIBSUPCXX} ;
605HAIKU_C++_HEADERS_DIR		?= ${HAIKU_CXX_HEADERS_DIR} ;
606
607HAIKU_KERNEL_LIBGCC			?= ${HAIKU_KERNEL_LIBGCC} ;
608HAIKU_KERNEL_LIBSUPC++		?= ${HAIKU_KERNEL_LIBSUPCXX} ;
609HAIKU_BOOT_LIBGCC			?= ${HAIKU_BOOT_LIBGCC} ;
610HAIKU_BOOT_LIBSUPC++		?= ${HAIKU_BOOT_LIBSUPCXX} ;
611
612HAIKU_BUILD_ATTRIBUTES_DIR	?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ;
613
614HAIKU_AR					?= ${HAIKU_AR} ;
615HAIKU_CC					?= ${HAIKU_CC} ;
616HAIKU_LD					?= ${HAIKU_LD} ;
617HAIKU_OBJCOPY				?= ${HAIKU_OBJCOPY} ;
618HAIKU_RANLIB				?= ${HAIKU_RANLIB} ;
619HAIKU_ELFEDIT				?= ${HAIKU_ELFEDIT} ;
620HAIKU_YASM					?= ${HAIKU_YASM} ;
621HAIKU_STRIP					?= ${HAIKU_STRIP} ;
622HAIKU_CPPFLAGS				?= ${HAIKU_CPPFLAGS} ;
623HAIKU_CCFLAGS				?= ${HAIKU_CCFLAGS} ;
624HAIKU_C++FLAGS				?= ${HAIKU_CXXFLAGS} ;
625HAIKU_LDFLAGS				?= ${HAIKU_LDFLAGS} ;
626HAIKU_ARFLAGS				?= ${HAIKU_ARFLAGS} ;
627HAIKU_UNARFLAGS				?= ${HAIKU_UNARFLAGS} ;
628
629HOST_GCC_RAW_VERSION		?= ${HOST_GCC_RAW_VERSION} ;
630HOST_GCC_MACHINE			?= ${HOST_GCC_MACHINE} ;
631HOST_LD						?= ${HOST_GCC_LD} ;
632HOST_OBJCOPY				?= ${HOST_GCC_OBJCOPY} ;
633HOST_SFDISK					?= ${HOST_SFDISK} ;
634
635EOF
636
637# Libgcc.a objects
638
639cat << EOF > "$buildOutputDir/libgccObjects"
640# libgcc.a objects to be linked against libroot.so
641# Note: This file has been automatically generated by configure.
642
643HAIKU_GCC_LIBGCC_OBJECTS	?= ${HAIKU_GCC_LIBGCC_OBJECTS} ;
644EOF
645
646# Generate a boot strap Jamfile in the output directory.
647
648cat << EOF > $outputDir/Jamfile
649# automatically generated Jamfile
650
651HAIKU_TOP			= ${sourceDir} ;
652HAIKU_OUTPUT_DIR	= ${outputDir} ;
653
654include [ FDirName \$(HAIKU_TOP) Jamfile ] ;
655
656EOF
657