Blame configure

9ca8c4
#!/bin/sh
9ca8c4
# we are no longer lazy.
9ca8c4
9ca8c4
# this script respects both CFLAGS and CFLAGS_CMDLINE,
9ca8c4
# as well as both LDFLAGS and LDFLAGS_CMDLINE, however
9ca8c4
# the latter variable of each pair should be preferred.
9ca8c4
9ca8c4
usage()
9ca8c4
{
9ca8c4
	cat "$mb_project_dir"/config.usage
9ca8c4
	exit $?
9ca8c4
}
9ca8c4
9ca8c4
error_msg()
9ca8c4
{
9ca8c4
	echo $@ >&2
9ca8c4
}
9ca8c4
9ca8c4
9ca8c4
init_vars()
9ca8c4
{
9ca8c4
	mb_project_dir=$(cd `dirname $0` ; pwd)
9ca8c4
	mb_pwd=`pwd`
9ca8c4
9ca8c4
	if [ -z "$mb_config" ]; then
9ca8c4
		. $mb_project_dir/config.project || exit 2
9ca8c4
	else
9ca8c4
		. "$mb_config" || exit 2
9ca8c4
	fi
9ca8c4
3d89b8
	# git
3d89b8
	if [ -d "$mb_project_dir/.git" ]; then
3d89b8
		mb_git_reference_dir="\$(PROJECT_DIR)/.git"
3d89b8
	fi
3d89b8
be9551
	# project
be9551
	mb_nickname=$NICKNAME
be9551
9ca8c4
	# dirs
9ca8c4
	mb_prefix=$PREFIX
4a022e
	mb_exec_prefix=$EXEC_PREFIX
9ca8c4
	mb_bindir=$BINDIR
9ca8c4
	mb_libdir=$LIBDIR
9ca8c4
	mb_includedir=$INCLUDEDIR
9ca8c4
	mb_mandir=$MANDIR
9ca8c4
	mb_docdir=$DOCDIR
9ca8c4
	mb_libexecdir=$LIBEXECDIR
9ca8c4
9ca8c4
9ca8c4
	# build
9ca8c4
	mb_build=$BUILD
9ca8c4
	mb_host=$HOST
9ca8c4
	mb_target=$TARGET
9ca8c4
	mb_arch=$ARCH
9ca8c4
	mb_compiler=$COMPILER
9ca8c4
	mb_toolchain=$TOOLCHAIN
9ca8c4
	mb_sysroot=$SYSROOT
9ca8c4
	mb_cross_compile=$CROSS_COMPILE
9ca8c4
	mb_shell=$SHELL
9ca8c4
9ca8c4
	# switches
9ca8c4
	mb_cflags=$CFLAGS
9ca8c4
	mb_cflags_debug=$CFLAGS_DEBUG
9ca8c4
	mb_cflags_common=$CFLAGS_COMMON
9ca8c4
	mb_cflags_cmdline=$CFLAGS_CMDLINE
9ca8c4
	mb_cflags_config=$CFLAGS_CONFIG
9ca8c4
	mb_cflags_sysroot=$CFLAGS_SYSROOT
9ca8c4
	mb_cflags_os=$CFLAGS_OS
9ca8c4
	mb_cflags_site=$CFLAGS_SITE
9ca8c4
	mb_cflags_path=$CFLAGS_PATH
9ca8c4
9ca8c4
	mb_ldflags=$LDFLAGS
9ca8c4
	mb_ldflags_debug=$LDFLAGS_DEBUG
9ca8c4
	mb_ldflags_common=$LDFLAGS_COMMON
9ca8c4
	mb_ldflags_cmdline=$LDFLAGS_CMDLINE
9ca8c4
	mb_ldflags_config=$LDFLAGS_CONFIG
9ca8c4
	mb_ldflags_sysroot=$LDFLAGS_SYSROOT
9ca8c4
	mb_ldflags_path=$LDFLAGS_PATH
9ca8c4
9ca8c4
	mb_pe_subsystem=$PE_SUBSYSTEM
9ca8c4
	mb_pe_image_base=$PE_IMAGE_BASE
9ca8c4
	mb_pe_config_defs=$PE_CONFIG_DEFS
9ca8c4
9ca8c4
	mb_elf_eh_frame=$ELF_EH_FRAME
9ca8c4
	mb_elf_hash_style=$ELF_HASH_STYLE
9ca8c4
	mb_elf_config_defs=$ELF_CONFIG_DEFS
9ca8c4
9ca8c4
	# overrides
9ca8c4
	mb_native_cc=$NATIVE_CC
9ca8c4
	mb_native_os=$NATIVE_OS
9ca8c4
	mb_native_os_bits=$NATIVE_OS_BITS
9ca8c4
	mb_native_os_underscore=$NATIVE_OS_UNDERSCORE
9ca8c4
9ca8c4
	mb_user_cc=$CC
9ca8c4
	mb_user_cpp=$CPP
9ca8c4
	mb_user_cxx=$CXX
9ca8c4
}
9ca8c4
9ca8c4
9ca8c4
verify_build_directory()
9ca8c4
{
9ca8c4
	if [ "$mb_project_dir" = "$mb_pwd" ]; then
9ca8c4
		if [ "$mb_require_out_of_tree" = yes ]; then
9ca8c4
			error_msg "$mb_package: out-of-tree builds are required."
9ca8c4
			error_msg "please invoke configure again from a clean build directory."
9ca8c4
			exit 2
9ca8c4
		else
9ca8c4
			mb_project_dir='.'
9ca8c4
		fi
9ca8c4
	fi
9ca8c4
}
9ca8c4
9ca8c4
9ca8c4
common_defaults()
9ca8c4
{
be9551
	# project
be9551
	[ -z "$mb_nickname" ] 		&& mb_nickname=$mb_package
be9551
9ca8c4
	# dirs
250816
	[ -z "$mb_prefix" ] 		&& [ -z "$mb_prefix_set" ] \
250816
					&& mb_prefix='/usr/local'
250816
250816
	[ -z "$mb_exec_prefix" ] 	&& [ -z "$mb_exec_prefix_set" ]	\
250816
					&& mb_exec_prefix=$mb_prefix
250816
664484
	[ -z "$mb_bindir" ] 		&& mb_bindir=$mb_exec_prefix/bin
664484
	[ -z "$mb_libdir" ] 		&& mb_libdir=$mb_exec_prefix/lib
664484
	[ -z "$mb_includedir" ]		&& mb_includedir=$mb_prefix/include
664484
	[ -z "$mb_datarootdir" ] 	&& mb_datarootdir=$mb_prefix/share
664484
	[ -z "$mb_mandir" ] 		&& mb_mandir=$mb_datarootdir/man
664484
	[ -z "$mb_docdir" ] 		&& mb_docdir=$mb_datarootdir/doc
664484
	[ -z "$mb_libexecdir" ]		&& mb_libexecdir=$mb_exec_prefix/libexec
9ca8c4
9ca8c4
	# build
9ca8c4
	[ -z "$mb_build" ] 		&& mb_build=$mb_default_build
9ca8c4
	[ -z "$mb_host" ] 		&& mb_host=$mb_default_host
9ca8c4
	[ -z "$mb_target" ] 		&& mb_target=$mb_default_target
9ca8c4
	[ -z "$mb_arch" ] 		&& mb_arch=$mb_default_arch
9ca8c4
	[ -z "$mb_compiler" ] 		&& mb_compiler=$mb_default_compiler
9ca8c4
	[ -z "$mb_toolchain" ] 		&& mb_toolchain=$mb_default_toolchain
9ca8c4
	[ -z "$mb_sysroot" ] 		&& mb_sysroot=$mb_default_sysroot
9ca8c4
	[ -z "$mb_cross_compile" ] 	&& mb_cross_compile=$mb_default_cross_compile
9ca8c4
	[ -z "$mb_shell" ] 		&& mb_shell=$mb_default_shell
9ca8c4
9ca8c4
	# switches
9ca8c4
	[ -z "$mb_cflags_debug" ]	&& mb_cflags_debug=$mb_default_cflags_debug
9ca8c4
	[ -z "$mb_cflags_common" ]	&& mb_cflags_common=$mb_default_cflags_common
9ca8c4
	[ -z "$mb_cflags_cmdline" ]	&& mb_cflags_cmdline=$mb_default_cflags_cmdline
9ca8c4
	[ -z "$mb_cflags_config" ]	&& mb_cflags_config=$mb_default_cflags_config
9ca8c4
	[ -z "$mb_cflags_sysroot" ]	&& mb_cflags_sysroot=$mb_default_cflags_sysroot
9ca8c4
	[ -z "$mb_cflags_os" ]		&& mb_cflags_os=$mb_default_cflags_os
9ca8c4
	[ -z "$mb_cflags_site" ]	&& mb_cflags_site=$mb_default_cflags_site
9ca8c4
	[ -z "$mb_cflags_path" ]	&& mb_cflags_path=$mb_default_cflags_path
9ca8c4
9ca8c4
	[ -z "$mb_ldflags_debug" ]	&& mb_ldflags_debug=$mb_default_ldflags_debug
9ca8c4
	[ -z "$mb_ldflags_common" ]	&& mb_ldflags_common=$mb_default_ldflags_common
9ca8c4
	[ -z "$mb_ldflags_cmdline" ]	&& mb_ldflags_cmdline=$mb_default_ldflags_cmdline
9ca8c4
	[ -z "$mb_ldflags_config" ]	&& mb_ldflags_config=$mb_default_ldflags_config
9ca8c4
	[ -z "$mb_ldflags_sysroot" ]	&& mb_ldflags_sysroot=$mb_default_ldflags_sysroot
9ca8c4
	[ -z "$mb_ldflags_path" ]	&& mb_ldflags_path=$mb_default_ldflags_path
9ca8c4
9ca8c4
	[ -z "$mb_pe_subsystem" ]	&& mb_pe_subsystem=$mb_default_pe_subsystem
9ca8c4
	[ -z "$mb_pe_image_base" ]	&& mb_pe_image_base=$mb_default_pe_image_base
9ca8c4
	[ -z "$mb_pe_config_defs" ]	&& mb_pe_config_defs=$mb_default_pe_config_defs
9ca8c4
9ca8c4
	[ -z "$mb_elf_eh_frame" ]	&& mb_elf_eh_frame=$mb_default_elf_eh_frame
9ca8c4
	[ -z "$mb_elf_hash_style" ]	&& mb_elf_hash_style=$mb_default_elf_hash_style
9ca8c4
	[ -z "$mb_elf_config_defs" ]	&& mb_elf_config_defs=$mb_default_elf_config_defs
9ca8c4
ffb3a0
	# config
ffb3a0
	[ -z "$mb_all_static" ]		&& mb_all_static='no'
ffb3a0
	[ -z "$mb_all_shared" ]		&& mb_all_shared='no'
ffb3a0
	[ -z "$mb_disable_static" ]	&& mb_disable_static='no'
ffb3a0
	[ -z "$mb_disable_shared" ]	&& mb_disable_shared='no'
ffb3a0
9ca8c4
	# host/target
9ca8c4
	[ -z "$mb_host" ] 		&& mb_host=$mb_target
9ca8c4
	[ -z "$mb_target" ] 		&& mb_target=$mb_host
9ca8c4
9ca8c4
	# sysroot
9ca8c4
	if [ -n "$mb_sysroot" ]; then
9ca8c4
		if [ -z "$mb_cflags_sysroot" ]; then
9ca8c4
			mb_cflags_sysroot="--sysroot=$mb_sysroot"
9ca8c4
		fi
9ca8c4
9ca8c4
		if [ -z "$mb_ldflags_sysroot" ]; then
9ca8c4
			mb_ldflags_sysroot="-Wl,--sysroot,$mb_sysroot"
9ca8c4
		fi
9ca8c4
	fi
9ca8c4
9ca8c4
	# debug
9ca8c4
	if [ "$mb_debug" = yes ]; then
9ca8c4
		if [ -z "$mb_cflags_debug" ]; then
9ca8c4
			mb_cflags_debug='-g3 -O0'
9ca8c4
		fi
9ca8c4
	fi
9ca8c4
9ca8c4
	# compiler
9ca8c4
	if [ -n "$mb_compiler" ]; then
9ca8c4
		if [ -z "$mb_native_cc" ]; then
9ca8c4
			mb_native_cc=$mb_compiler
9ca8c4
		fi
9ca8c4
	fi
9ca8c4
9ca8c4
	# toolchain
9ca8c4
	if [ -z "$mb_toolchain" ]; then
9ca8c4
		mb_toolchain='binutils'
9ca8c4
	fi
9ca8c4
9ca8c4
	# fallback host recipe
9ca8c4
	if [ -n "$mb_host" ]; then
9ca8c4
		if ! [ -f $mb_project_dir/sysinfo/host/$mb_host.mk ]; then
9ca8c4
			if [ -z "$mb_cross_compile" ]; then
9ca8c4
				mb_cross_compile=$mb_host-
9ca8c4
			fi
9ca8c4
9ca8c4
			mb_host='any-host';
9ca8c4
		fi
9ca8c4
	fi
9ca8c4
9ca8c4
	# fallback compiler recipe
9ca8c4
	if [ -n "$mb_compiler" ]; then
9ca8c4
		if ! [ -f $mb_project_dir/sysinfo/compiler/$mb_compiler.mk ]; then
9ca8c4
			mb_compiler='any-compiler'
9ca8c4
		fi
9ca8c4
	fi
9ca8c4
}
9ca8c4
9ca8c4
9ca8c4
native_defaults()
9ca8c4
{
9ca8c4
	# CC (when set, must be valid)
9ca8c4
	if [ -n "$CC" ]; then
9ca8c4
		$CC -dM -E - < /dev/null > /dev/null || exit 2
9ca8c4
	fi
9ca8c4
9ca8c4
	# compiler
9ca8c4
	[ -z "$mb_native_cc" ] && mb_native_cc=$CC
9ca8c4
	[ -z "$mb_native_cc" ] && mb_native_cc='cc'
9ca8c4
	$mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
9ca8c4
9ca8c4
	[ -z "$mb_native_cc" ] && mb_native_cc='gcc'
9ca8c4
	$mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
9ca8c4
9ca8c4
	[ -z "$mb_native_cc" ] && mb_native_cc='clang'
9ca8c4
	$mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
9ca8c4
9ca8c4
	[ -z "$mb_native_cc" ] && mb_native_cc='cparser'
9ca8c4
	$mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
9ca8c4
9ca8c4
	if [ -z "$mb_native_cc" ]; then
9ca8c4
		echo "configure: info: could not find a working native compiler."
9ca8c4
		mb_native_cc='false'
9ca8c4
	fi
9ca8c4
9ca8c4
	if [ -z "$mb_compiler" ]; then
9ca8c4
		$mb_native_cc -dM -E - < /dev/null | grep '__clang__' > /dev/null && mb_compiler='clang'
9ca8c4
	fi
9ca8c4
9ca8c4
	if [ -z "$mb_compiler" ]; then
9ca8c4
		$mb_native_cc -dM -E - < /dev/null | grep '__GCC' > /dev/null && mb_compiler='gcc'
9ca8c4
	fi
9ca8c4
9ca8c4
	if [ -z "$mb_compiler" ]; then
9ca8c4
		$mb_native_cc -dM -E - < /dev/null | grep '__CPARSER__' > /dev/null && mb_compiler='cparser'
9ca8c4
	fi
9ca8c4
9ca8c4
	if [ -z "$mb_compiler" ]; then
9ca8c4
		echo "configure: info: could not identify the native compiler."
9ca8c4
		mb_compiler='any-compiler'
9ca8c4
	fi
9ca8c4
9ca8c4
9ca8c4
	# host
9ca8c4
	if [ -z "$mb_host" ]; then
9ca8c4
		mb_host='native'
9ca8c4
	fi
9ca8c4
9ca8c4
9ca8c4
	# target
9ca8c4
	if [ -z "$mb_target" ]; then
9ca8c4
		mb_target='native'
9ca8c4
	fi
9ca8c4
9ca8c4
9ca8c4
	# os
9ca8c4
	mb_native_os=`uname | tr '[:upper:]' '[:lower:]'`
9ca8c4
9ca8c4
	mb_native_os_sizeof_pointer=`$mb_native_cc -dM -E - < /dev/null \
9ca8c4
			| grep __SIZEOF_POINTER__  \
9ca8c4
			| cut -d ' ' -f3`
9ca8c4
9ca8c4
	mb_native_os_bits=`expr '8' '*' '0'"$mb_native_os_sizeof_pointer"`
9ca8c4
9ca8c4
	if [ $mb_native_os_bits = 32 ]; then
9ca8c4
		mb_native_os_underscore='_'
9ca8c4
	else
9ca8c4
		mb_native_os_underscore=''
9ca8c4
	fi
9ca8c4
9ca8c4
	if [ -z "$mb_native_os_sizeof_pointer" ]; then
9ca8c4
		error_msg "config error: could not determine size of pointer on native system."
9ca8c4
		exit 2
9ca8c4
	fi
51838d
51838d
	# fallback os recipe
51838d
	if ! [ -f $mb_project_dir/sysinfo/os/$mb_native_os.mk ]; then
51838d
		mb_native_os='any-os';
51838d
	fi
9ca8c4
}
9ca8c4
9ca8c4
9ca8c4
cross_defaults()
9ca8c4
{
9ca8c4
	if [ -z "$mb_cross_compile" ] && [ "$mb_host" != native ]; then
9ca8c4
		mb_cross_compile=$mb_host'-'
9ca8c4
	fi
9ca8c4
}
9ca8c4
9ca8c4
9ca8c4
config_copy()
9ca8c4
{
9ca8c4
	sed 		-e 's^@package@^'"$mb_package"'^g' 				\
be9551
			-e 's^@nickname@^'"$mb_nickname"'^g'				\
9ca8c4
			-e 's^@project_dir@^'"$mb_project_dir"'^g'			\
3d89b8
			-e 's^@git_reference_dir@^'"$mb_git_reference_dir"'^g'		\
9ca8c4
											\
9ca8c4
			-e 's^@build@^'"$mb_build"'^g'					\
9ca8c4
			-e 's^@host@^'"$mb_host"'^g'					\
9ca8c4
			-e 's^@target@^'"$mb_target"'^g'				\
9ca8c4
			-e 's^@arch@^'"$mb_arch"'^g'					\
9ca8c4
			-e 's^@compiler@^'"$mb_compiler"'^g'				\
9ca8c4
			-e 's^@toolchain@^'"$mb_toolchain"'^g'				\
9ca8c4
			-e 's^@sysroot@^'"$mb_sysroot"'^g'				\
9ca8c4
			-e 's^@cross_compile@^'"$mb_cross_compile"'^g'			\
9ca8c4
			-e 's^@shell@^'"$mb_shell"'^g'					\
9ca8c4
											\
9ca8c4
			-e 's^@cflags@^'"$mb_cflags"'^g'				\
9ca8c4
			-e 's^@cflags_debug@^'"$mb_cflags_debug"'^g'			\
9ca8c4
			-e 's^@cflags_common@^'"$mb_cflags_common"'^g'			\
9ca8c4
			-e 's^@cflags_cmdline@^'"$mb_cflags $mb_cflags_cmdline"'^g'	\
9ca8c4
			-e 's^@cflags_config@^'"$mb_cflags_config"'^g'			\
9ca8c4
			-e 's^@cflags_sysroot@^'"$mb_cflags_sysroot"'^g'		\
9ca8c4
			-e 's^@cflags_os@^'"$mb_cflags_os"'^g'				\
9ca8c4
			-e 's^@cflags_site@^'"$mb_cflags_site"'^g'			\
9ca8c4
			-e 's^@cflags_path@^'"$mb_cflags_path"'^g'			\
9ca8c4
											\
9ca8c4
			-e 's^@ldflags@^'"$mb_ldflags"'^g'				\
9ca8c4
			-e 's^@ldflags_debug@^'"$mb_ldflags_debug"'^g'			\
9ca8c4
			-e 's^@ldflags_common@^'"$mb_ldflags_common"'^g'		\
9ca8c4
			-e 's^@ldflags_cmdline@^'"$mb_ldflags $mb_ldflags_cmdline"'^g'	\
9ca8c4
			-e 's^@ldflags_config@^'"$mb_ldflags_config"'^g'		\
9ca8c4
			-e 's^@ldflags_sysroot@^'"$mb_ldflags_sysroot"'^g'		\
9ca8c4
			-e 's^@ldflags_path@^'"$mb_ldflags_path"'^g'			\
9ca8c4
											\
9ca8c4
			-e 's^@pe_subsystem@^'"$mb_pe_subsystem"'^g'			\
9ca8c4
			-e 's^@pe_image\_base@^'"$mb_pe_image_base"'^g'			\
9ca8c4
			-e 's^@pe_config\_defs@^'"$mb_pe_config_defs"'^g'		\
9ca8c4
											\
9ca8c4
			-e 's^@elf_eh\_frame@^'"$mb_elf_eh_frame"'^g'			\
9ca8c4
			-e 's^@elf_hash\_style@^'"$mb_elf_hash_style"'^g'		\
9ca8c4
			-e 's^@elf_config\_defs@^'"$mb_elf_config_defs"'^g'		\
9ca8c4
											\
9ca8c4
			-e 's^@prefix@^'"$mb_prefix"'^g'				\
4a022e
			-e 's^@exec_prefix@^'"$mb_exec_prefix"'^g'			\
9ca8c4
			-e 's^@bindir@^'"$mb_bindir"'^g'				\
9ca8c4
			-e 's^@libdir@^'"$mb_libdir"'^g'				\
9ca8c4
			-e 's^@includedir@^'"$mb_includedir"'^g'			\
9ca8c4
			-e 's^@mandir@^'"$mb_mandir"'^g'				\
9ca8c4
			-e 's^@docdir@^'"$mb_docdir"'^g'				\
9ca8c4
			-e 's^@libexecdir@^'"$mb_libexecdir"'^g'			\
9ca8c4
											\
9ca8c4
			-e 's^@native_cc@^'"$mb_native_cc"'^g'				\
9ca8c4
			-e 's^@native_os@^'"$mb_native_os"'^g'				\
9ca8c4
			-e 's^@native_os_bits@^'"$mb_native_os_bits"'^g'		\
9ca8c4
			-e 's^@native_os_underscore@^'"$mb_native_os_underscore"'^g'	\
9ca8c4
											\
9ca8c4
			-e 's^@user_cc@^'"$mb_user_cc"'^g'				\
9ca8c4
			-e 's^@user_cpp@^'"$mb_user_cpp"'^g'				\
9ca8c4
			-e 's^@user_cxx@^'"$mb_user_cxx"'^g'				\
ffb3a0
											\
ffb3a0
			-e 's^@all_static@^'"$mb_all_static"'^g'			\
ffb3a0
			-e 's^@all_shared@^'"$mb_all_shared"'^g'			\
ffb3a0
			-e 's^@disable_static@^'"$mb_disable_static"'^g'		\
ffb3a0
			-e 's^@disable_shared@^'"$mb_disable_shared"'^g'		\
9ca8c4
		$mb_project_dir/Makefile.in > $mb_pwd/Makefile
9ca8c4
}
9ca8c4
9ca8c4
9ca8c4
config_host()
9ca8c4
{
9ca8c4
	make -s host.tag && return 0
9ca8c4
9ca8c4
	error_msg "configure was able to generate a Makefile for the selected host,"
9ca8c4
	error_msg "however the host-targeting compiler was found to be missing"
9ca8c4
	error_msg "at least one of the required headers or features."
9ca8c4
	exit 2
9ca8c4
}
9ca8c4
9ca8c4
9ca8c4
config_status()
9ca8c4
{
9ca8c4
	printf "\n\n"
9ca8c4
	make .display
9ca8c4
	printf "\nconfiguration completed successfully.\n\n"
9ca8c4
}
9ca8c4
9ca8c4
# one: init
9ca8c4
init_vars
9ca8c4
verify_build_directory
9ca8c4
9ca8c4
9ca8c4
# two: args
9ca8c4
for arg ; do
9ca8c4
	case "$arg" in
9ca8c4
		--help)	usage
9ca8c4
			;;
9ca8c4
9ca8c4
		# dirs
9ca8c4
		--prefix=*)
250816
			mb_prefix_set=yes
9ca8c4
			mb_prefix=${arg#*=}
9ca8c4
			;;
4a022e
		--exec-prefix=*)
250816
			mb_exec_prefix_set=yes
4a022e
			mb_exec_prefix=${arg#*=}
4a022e
			;;
9ca8c4
		--bindir=*)
9ca8c4
			mb_bindir=${arg#*=}
9ca8c4
			;;
9ca8c4
		--libdir=*)
9ca8c4
			mb_libdir=${arg#*=}
9ca8c4
			;;
9ca8c4
		--includedir=*)
9ca8c4
			mb_includedir=${arg#*=}
9ca8c4
			;;
9ca8c4
		--mandir=*)
9ca8c4
			mb_mandir=${arg#*=}
9ca8c4
			;;
9ca8c4
		--libexecdir=*)
9ca8c4
			mb_libexecdir=${arg#*=}
9ca8c4
			;;
9ca8c4
9ca8c4
9ca8c4
		# build
9ca8c4
		--build=*)
9ca8c4
			mb_build=${arg#*=}
9ca8c4
			;;
9ca8c4
		--host=*)
9ca8c4
			mb_host=${arg#*=}
9ca8c4
			;;
9ca8c4
		--target=*)
9ca8c4
			mb_target=${arg#*=}
9ca8c4
			;;
9ca8c4
		--arch=*)
9ca8c4
			mb_arch=${arg#*=}
9ca8c4
			;;
9ca8c4
		--compiler=*)
9ca8c4
			mb_compiler=${arg#*=}
9ca8c4
			;;
9ca8c4
		--toolchain=*)
9ca8c4
			mb_toolchain=${arg#*=}
9ca8c4
			;;
9ca8c4
		--sysroot=*)
9ca8c4
			mb_sysroot=${arg#*=}
9ca8c4
			;;
9ca8c4
		--cross-compile=*)
9ca8c4
			mb_cross_compile=${arg#*=}
9ca8c4
			;;
9ca8c4
		--shell=*)
9ca8c4
			mb_shell=${arg#*=}
9ca8c4
			;;
9ca8c4
		--debug)
9ca8c4
			mb_debug='yes'
9ca8c4
			;;
be9551
ffb3a0
		# config
ffb3a0
		--all-static)
ffb3a0
			mb_all_static='yes'
ffb3a0
			;;
ffb3a0
		--all-shared)
ffb3a0
			mb_all_shared='yes'
ffb3a0
			;;
ffb3a0
		--disable-static)
ffb3a0
			mb_disable_static='yes'
ffb3a0
			;;
ffb3a0
		--disable-shared)
ffb3a0
			mb_disable_shared='yes'
ffb3a0
			;;
ffb3a0
		--enable-static)
ffb3a0
			mb_disable_static='no'
ffb3a0
			;;
ffb3a0
		--enable-shared)
ffb3a0
			mb_disable_shared='no'
ffb3a0
			;;
ffb3a0
be9551
		# project
be9551
		--nickname=*)
be9551
			mb_nickname=${arg#*=}
be9551
			;;
be9551
9ca8c4
		*)
9ca8c4
			error_msg ${arg#}: "unsupported config argument."
9ca8c4
			exit 2
9ca8c4
			;;
9ca8c4
	esac
9ca8c4
done
9ca8c4
9ca8c4
9ca8c4
9ca8c4
# three: defaults
9ca8c4
common_defaults
9ca8c4
native_defaults
9ca8c4
cross_defaults
9ca8c4
9ca8c4
9ca8c4
9ca8c4
# four: config
9ca8c4
config_copy
9ca8c4
config_host
9ca8c4
config_status
9ca8c4
9ca8c4
9ca8c4
# all done
9ca8c4
exit 0