xref: /haiku/configure (revision db10640de90f7f9519ba2da9577b7c1af3c64f6b)
1#!/bin/sh
2#
3# configure [ --floppy <floppy location> ]
4#
5# No parameters for now.
6
7# usage
8#
9# Prints usage.
10#
11usage()
12{
13	cat << EOF
14
15Usage: $0 <options>
16options:
17  --floppy <floppy location>    Specifies the location of the floppy
18                                (device or image).
19  --bochs-debug                 Activates bochs serial debug emulation.
20  --include-gpl-addons		Include GPL licensed add-ons.
21  --help                        Prints out this help.
22EOF
23}
24
25# assertparam
26#
27# Checks whether at least one parameter is left.
28#
29assertparam()
30{
31	if [ $2 \< 2 ]; then
32		echo $0: \`$1\': Parameter expected.
33		exit 1
34	fi
35}
36
37# standard_gcc_settings
38#
39# Sets the variables for a GCC platform.
40#
41standard_gcc_settings()
42{
43	# PLATFORM_LINKLIBS
44	gcclib=`gcc -print-libgcc-file-name`
45	gccdir=`dirname ${gcclib}`
46	gcc_version=`gcc -dumpversion`
47	if [ "x${PLATFORM_LINKLIBS}" == "x" ] ; then
48		PLATFORM_LINKLIBS="-L ${gccdir} -lgcc"
49	fi
50	if [ "x${PLATFORM_HEADERS}" == "x" ] ; then
51		PLATFORM_HEADERS="${gccdir}/include"
52	fi
53	if [ "${LIBGCC_DIR}" == "" ] ; then
54		LIBGCC_DIR="${gccdir}"
55	fi
56	if [ "${LIBGCC_OBJECTS}" == "" ] ; then
57		LIBGCC_OBJECTS=`ar t ${gccdir}/libgcc.a`
58	fi
59}
60
61# default parameter values
62#
63platform=`uname`
64gcc_version=
65floppy=
66bochs_debug=0
67include_gpl_addons=0
68
69# parse parameters
70#
71while [ $# \> 0 ] ; do
72	case "$1" in
73		--include-gpl-addons)	include_gpl_addons=1; shift 1;;
74		--floppy)		assertparam "$1" $#; floppy=$2; shift 2;;
75		--bochs-debug)	bochs_debug=1; shift 1;;
76		--help | -h)	usage; exit 0;;
77		*)				echo Invalid argument: \`$1\'; exit 1;;
78	esac
79done
80
81# check parameters
82#
83if [ -n "$floppy" ]; then
84	case "$floppy" in
85		/*)	;;
86		*)	echo "Warning: non-absolute floppy path. Parameter ignored.";
87			floppy=;;
88	esac
89fi
90
91# BeOS
92if [ "${platform}" = "BeOS" ] ; then
93	standard_gcc_settings
94
95# Linux
96else if [ "${platform}" = "Linux" ] ; then
97	standard_gcc_settings
98
99# Unknown platform
100else
101	echo Unsupported platform: ${platform}
102	exit 1
103fi; fi
104
105# Generate BuildConfig
106cat << EOF > build/BuildConfig
107# BuildConfig
108# Note: This file has been automatically generated by configure.
109
110FLOPPY_PATH			?= "${floppy}" ;
111PLATFORM_LINKLIBS	?= ${PLATFORM_LINKLIBS} ;
112PLATFORM_HEADERS	?= ${PLATFORM_HEADERS} ;
113GCC_RAW_VERSION		?= ${gcc_version} ;
114LIBGCC_DIR			?= ${LIBGCC_DIR} ;
115LIBGCC_OBJECTS		?= ${LIBGCC_OBJECTS} ;
116BOCHS_DEBUG_HACK	?= ${bochs_debug} ;
117INCLUDE_GPL_ADDONS	?= ${include_gpl_addons} ;
118EOF
119
120