Blame configure

d40d13
#!/bin/sh
d40d13
# we are no longer lazy.
d40d13
d40d13
# this script respects both CFLAGS and CFLAGS_CMDLINE,
d40d13
# as well as both LDFLAGS and LDFLAGS_CMDLINE, however
d40d13
# the latter variable of each pair should be preferred.
d40d13
a554c2
usage()
a554c2
{
785495
	cat "$mb_project_dir"/config.usage
a554c2
	exit $?
a554c2
}
a554c2
d40d13
error_msg()
d40d13
{
f0c1ad
	echo "$@" >&2
d40d13
}
d40d13
d40d13
d40d13
init_vars()
d40d13
{
d37b77
	mb_project_dir=$(cd `dirname $0` ; pwd)
d40d13
	mb_pwd=`pwd`
d40d13
47b1b5
	if [ -z "$mb_config" ]; then
d40d13
		. $mb_project_dir/config.project || exit 2
d40d13
	else
d40d13
		. "$mb_config" || exit 2
d40d13
	fi
d40d13
ed1185
	# git
ed1185
	if [ -d "$mb_project_dir/.git" ]; then
ed1185
		mb_git_reference_dir="\$(PROJECT_DIR)/.git"
ed1185
	fi
ed1185
9c6a0f
	# project
9c6a0f
	mb_nickname=$NICKNAME
9c6a0f
d40d13
	# dirs
d40d13
	mb_prefix=$PREFIX
58536c
	mb_exec_prefix=$EXEC_PREFIX
b023b2
	mb_bindir=$BINDIR
b023b2
	mb_libdir=$LIBDIR
b023b2
	mb_includedir=$INCLUDEDIR
b023b2
	mb_mandir=$MANDIR
b023b2
	mb_docdir=$DOCDIR
b023b2
	mb_libexecdir=$LIBEXECDIR
d40d13
d40d13
d40d13
	# build
d40d13
	mb_build=$BUILD
d40d13
	mb_host=$HOST
d40d13
	mb_target=$TARGET
d40d13
	mb_arch=$ARCH
aee992
	mb_compiler=$COMPILER
e5d4bb
	mb_toolchain=$TOOLCHAIN
d40d13
	mb_sysroot=$SYSROOT
d40d13
	mb_cross_compile=$CROSS_COMPILE
d40d13
	mb_shell=$SHELL
d40d13
d40d13
	# switches
d40d13
	mb_cflags=$CFLAGS
d40d13
	mb_cflags_debug=$CFLAGS_DEBUG
d40d13
	mb_cflags_common=$CFLAGS_COMMON
d40d13
	mb_cflags_cmdline=$CFLAGS_CMDLINE
d40d13
	mb_cflags_config=$CFLAGS_CONFIG
d40d13
	mb_cflags_sysroot=$CFLAGS_SYSROOT
596f2f
	mb_cflags_os=$CFLAGS_OS
596f2f
	mb_cflags_site=$CFLAGS_SITE
d40d13
	mb_cflags_path=$CFLAGS_PATH
598fb4
	mb_cflags_strict=$CFLAGS_STRICT
54173a
	mb_cflags_util=$CFLAGS_UTIL
d40d13
d40d13
	mb_ldflags=$LDFLAGS
d40d13
	mb_ldflags_debug=$LDFLAGS_DEBUG
d40d13
	mb_ldflags_common=$LDFLAGS_COMMON
d40d13
	mb_ldflags_cmdline=$LDFLAGS_CMDLINE
d40d13
	mb_ldflags_config=$LDFLAGS_CONFIG
d40d13
	mb_ldflags_sysroot=$LDFLAGS_SYSROOT
d40d13
	mb_ldflags_path=$LDFLAGS_PATH
598fb4
	mb_ldflags_strict=$LDFLAGS_STRICT
54173a
	mb_ldflags_util=$LDFLAGS_UTIL
d40d13
d40d13
	mb_pe_subsystem=$PE_SUBSYSTEM
d40d13
	mb_pe_image_base=$PE_IMAGE_BASE
d40d13
	mb_pe_config_defs=$PE_CONFIG_DEFS
d40d13
d40d13
	mb_elf_eh_frame=$ELF_EH_FRAME
d40d13
	mb_elf_hash_style=$ELF_HASH_STYLE
d40d13
	mb_elf_config_defs=$ELF_CONFIG_DEFS
d40d13
d40d13
	# overrides
1857dc
	mb_native_cc=$NATIVE_CC
1857dc
	mb_native_os=$NATIVE_OS
1857dc
	mb_native_os_bits=$NATIVE_OS_BITS
1857dc
	mb_native_os_underscore=$NATIVE_OS_UNDERSCORE
7f572b
7f572b
	mb_user_cc=$CC
7f572b
	mb_user_cpp=$CPP
7f572b
	mb_user_cxx=$CXX
d40d13
}
d40d13
d40d13
d40d13
verify_build_directory()
d40d13
{
47b1b5
	if [ "$mb_project_dir" = "$mb_pwd" ]; then
47b1b5
		if [ "$mb_require_out_of_tree" = yes ]; then
d40d13
			error_msg "$mb_package: out-of-tree builds are required."
d40d13
			error_msg "please invoke configure again from a clean build directory."
d40d13
			exit 2
d40d13
		else
d40d13
			mb_project_dir='.'
d40d13
		fi
d40d13
	fi
d40d13
}
d40d13
d40d13
d40d13
common_defaults()
d40d13
{
9c6a0f
	# project
9c6a0f
	[ -z "$mb_nickname" ] 		&& mb_nickname=$mb_package
9c6a0f
d40d13
	# dirs
be9f3e
	[ -z "$mb_prefix" ] 		&& [ -z "$mb_prefix_set" ] \
be9f3e
					&& mb_prefix='/usr/local'
be9f3e
be9f3e
	[ -z "$mb_exec_prefix" ] 	&& [ -z "$mb_exec_prefix_set" ]	\
be9f3e
					&& mb_exec_prefix=$mb_prefix
be9f3e
a1d4a9
	[ -z "$mb_bindir" ] 		&& mb_bindir=$mb_exec_prefix/bin
a1d4a9
	[ -z "$mb_libdir" ] 		&& mb_libdir=$mb_exec_prefix/lib
a1d4a9
	[ -z "$mb_includedir" ]		&& mb_includedir=$mb_prefix/include
a1d4a9
	[ -z "$mb_datarootdir" ] 	&& mb_datarootdir=$mb_prefix/share
a1d4a9
	[ -z "$mb_mandir" ] 		&& mb_mandir=$mb_datarootdir/man
a1d4a9
	[ -z "$mb_docdir" ] 		&& mb_docdir=$mb_datarootdir/doc
a1d4a9
	[ -z "$mb_libexecdir" ]		&& mb_libexecdir=$mb_exec_prefix/libexec
d40d13
d40d13
	# build
d40d13
	[ -z "$mb_build" ] 		&& mb_build=$mb_default_build
d40d13
	[ -z "$mb_host" ] 		&& mb_host=$mb_default_host
d40d13
	[ -z "$mb_target" ] 		&& mb_target=$mb_default_target
d40d13
	[ -z "$mb_arch" ] 		&& mb_arch=$mb_default_arch
aee992
	[ -z "$mb_compiler" ] 		&& mb_compiler=$mb_default_compiler
e5d4bb
	[ -z "$mb_toolchain" ] 		&& mb_toolchain=$mb_default_toolchain
d40d13
	[ -z "$mb_sysroot" ] 		&& mb_sysroot=$mb_default_sysroot
d40d13
	[ -z "$mb_cross_compile" ] 	&& mb_cross_compile=$mb_default_cross_compile
d40d13
	[ -z "$mb_shell" ] 		&& mb_shell=$mb_default_shell
d40d13
d40d13
	# switches
d40d13
	[ -z "$mb_cflags_debug" ]	&& mb_cflags_debug=$mb_default_cflags_debug
d40d13
	[ -z "$mb_cflags_common" ]	&& mb_cflags_common=$mb_default_cflags_common
d40d13
	[ -z "$mb_cflags_cmdline" ]	&& mb_cflags_cmdline=$mb_default_cflags_cmdline
d40d13
	[ -z "$mb_cflags_config" ]	&& mb_cflags_config=$mb_default_cflags_config
d40d13
	[ -z "$mb_cflags_sysroot" ]	&& mb_cflags_sysroot=$mb_default_cflags_sysroot
596f2f
	[ -z "$mb_cflags_os" ]		&& mb_cflags_os=$mb_default_cflags_os
596f2f
	[ -z "$mb_cflags_site" ]	&& mb_cflags_site=$mb_default_cflags_site
d40d13
	[ -z "$mb_cflags_path" ]	&& mb_cflags_path=$mb_default_cflags_path
598fb4
	[ -z "$mb_cflags_strict" ]	&& mb_cflags_strict=$mb_default_cflags_strict
54173a
	[ -z "$mb_cflags_util" ]	&& mb_cflags_util=$mb_default_cflags_util
d40d13
d40d13
	[ -z "$mb_ldflags_debug" ]	&& mb_ldflags_debug=$mb_default_ldflags_debug
d40d13
	[ -z "$mb_ldflags_common" ]	&& mb_ldflags_common=$mb_default_ldflags_common
d40d13
	[ -z "$mb_ldflags_cmdline" ]	&& mb_ldflags_cmdline=$mb_default_ldflags_cmdline
d40d13
	[ -z "$mb_ldflags_config" ]	&& mb_ldflags_config=$mb_default_ldflags_config
d40d13
	[ -z "$mb_ldflags_sysroot" ]	&& mb_ldflags_sysroot=$mb_default_ldflags_sysroot
d40d13
	[ -z "$mb_ldflags_path" ]	&& mb_ldflags_path=$mb_default_ldflags_path
598fb4
	[ -z "$mb_ldflags_strict" ]	&& mb_ldflags_strict=$mb_default_ldflags_strict
54173a
	[ -z "$mb_ldflags_util" ]	&& mb_ldflags_util=$mb_default_ldflags_util
d40d13
d40d13
	[ -z "$mb_pe_subsystem" ]	&& mb_pe_subsystem=$mb_default_pe_subsystem
d40d13
	[ -z "$mb_pe_image_base" ]	&& mb_pe_image_base=$mb_default_pe_image_base
d40d13
	[ -z "$mb_pe_config_defs" ]	&& mb_pe_config_defs=$mb_default_pe_config_defs
d40d13
d40d13
	[ -z "$mb_elf_eh_frame" ]	&& mb_elf_eh_frame=$mb_default_elf_eh_frame
d40d13
	[ -z "$mb_elf_hash_style" ]	&& mb_elf_hash_style=$mb_default_elf_hash_style
d40d13
	[ -z "$mb_elf_config_defs" ]	&& mb_elf_config_defs=$mb_default_elf_config_defs
d40d13
dbc5ee
	# config
dbc5ee
	[ -z "$mb_all_static" ]		&& mb_all_static='no'
dbc5ee
	[ -z "$mb_all_shared" ]		&& mb_all_shared='no'
dbc5ee
	[ -z "$mb_disable_static" ]	&& mb_disable_static='no'
dbc5ee
	[ -z "$mb_disable_shared" ]	&& mb_disable_shared='no'
dbc5ee
d40d13
	# host/target
d40d13
	[ -z "$mb_host" ] 		&& mb_host=$mb_target
efecbd
	[ -z "$mb_target" ] 		&& mb_target=$mb_host
d40d13
d40d13
	# sysroot
47b1b5
	if [ -n "$mb_sysroot" ]; then
47b1b5
		if [ -z "$mb_cflags_sysroot" ]; then
d40d13
			mb_cflags_sysroot="--sysroot=$mb_sysroot"
d40d13
		fi
d40d13
47b1b5
		if [ -z "$mb_ldflags_sysroot" ]; then
d40d13
			mb_ldflags_sysroot="-Wl,--sysroot,$mb_sysroot"
d40d13
		fi
d40d13
	fi
d40d13
d40d13
	# debug
47b1b5
	if [ "$mb_debug" = yes ]; then
47b1b5
		if [ -z "$mb_cflags_debug" ]; then
d40d13
			mb_cflags_debug='-g3 -O0'
d40d13
		fi
d40d13
	fi
b59520
aee992
	# compiler
47b1b5
	if [ -n "$mb_compiler" ]; then
47b1b5
		if [ -z "$mb_native_cc" ]; then
aee992
			mb_native_cc=$mb_compiler
b59520
		fi
b59520
	fi
e5d4bb
e5d4bb
	# toolchain
47b1b5
	if [ -z "$mb_toolchain" ]; then
e5d4bb
		mb_toolchain='binutils'
e5d4bb
	fi
c6e141
c6e141
	# fallback host recipe
47b1b5
	if [ -n "$mb_host" ]; then
c6e141
		if ! [ -f $mb_project_dir/sysinfo/host/$mb_host.mk ]; then
c6e141
			if [ -z "$mb_cross_compile" ]; then
c6e141
				mb_cross_compile=$mb_host-
c6e141
			fi
c6e141
c6e141
			mb_host='any-host';
c6e141
		fi
c6e141
	fi
9f1faf
9f1faf
	# fallback compiler recipe
9f1faf
	if [ -n "$mb_compiler" ]; then
9f1faf
		if ! [ -f $mb_project_dir/sysinfo/compiler/$mb_compiler.mk ]; then
9f1faf
			mb_compiler='any-compiler'
9f1faf
		fi
9f1faf
	fi
d40d13
}
d40d13
d40d13
d40d13
native_defaults()
d40d13
{
b3dff5
	# CC (when set, must be valid)
47b1b5
	if [ -n "$CC" ]; then
193e5b
		$CC -dM -E - < /dev/null > /dev/null || exit 2
193e5b
	fi
193e5b
aee992
	# compiler
1857dc
	[ -z "$mb_native_cc" ] && mb_native_cc=$CC
1857dc
	[ -z "$mb_native_cc" ] && mb_native_cc='cc'
1857dc
	$mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
d40d13
1857dc
	[ -z "$mb_native_cc" ] && mb_native_cc='gcc'
1857dc
	$mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
d40d13
1857dc
	[ -z "$mb_native_cc" ] && mb_native_cc='clang'
1857dc
	$mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
d40d13
cdbf52
	[ -z "$mb_native_cc" ] && mb_native_cc='cparser'
cdbf52
	$mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
cdbf52
47b1b5
	if [ -z "$mb_native_cc" ]; then
ab44e3
		echo "configure: info: could not find a working native compiler."
ab44e3
		mb_native_cc='false'
d40d13
	fi
d40d13
47b1b5
	if [ -z "$mb_compiler" ]; then
aee992
		$mb_native_cc -dM -E - < /dev/null | grep '__clang__' > /dev/null && mb_compiler='clang'
d40d13
	fi
d40d13
47b1b5
	if [ -z "$mb_compiler" ]; then
aee992
		$mb_native_cc -dM -E - < /dev/null | grep '__GCC' > /dev/null && mb_compiler='gcc'
d40d13
	fi
d40d13
47b1b5
	if [ -z "$mb_compiler" ]; then
aee992
		$mb_native_cc -dM -E - < /dev/null | grep '__CPARSER__' > /dev/null && mb_compiler='cparser'
cdbf52
	fi
cdbf52
47b1b5
	if [ -z "$mb_compiler" ]; then
ab44e3
		echo "configure: info: could not identify the native compiler."
ab44e3
		mb_compiler='any-compiler'
d40d13
	fi
d40d13
d40d13
d40d13
	# host
47b1b5
	if [ -z "$mb_host" ]; then
d40d13
		mb_host='native'
d40d13
	fi
d40d13
d40d13
063052
	# target
47b1b5
	if [ -z "$mb_target" ]; then
063052
		mb_target='native'
063052
	fi
063052
063052
d40d13
	# os
d40d13
	mb_native_os=`uname | tr '[:upper:]' '[:lower:]'`
d40d13
1857dc
	mb_native_os_sizeof_pointer=`$mb_native_cc -dM -E - < /dev/null \
d40d13
			| grep __SIZEOF_POINTER__  \
d40d13
			| cut -d ' ' -f3`
d40d13
d40d13
	mb_native_os_bits=`expr '8' '*' '0'"$mb_native_os_sizeof_pointer"`
d40d13
d40d13
	if [ $mb_native_os_bits = 32 ]; then
d40d13
		mb_native_os_underscore='_'
d40d13
	else
d40d13
		mb_native_os_underscore=''
d40d13
	fi
d40d13
47b1b5
	if [ -z "$mb_native_os_sizeof_pointer" ]; then
d40d13
		error_msg "config error: could not determine size of pointer on native system."
d40d13
		exit 2
d40d13
	fi
69a683
69a683
	# fallback os recipe
69a683
	if ! [ -f $mb_project_dir/sysinfo/os/$mb_native_os.mk ]; then
69a683
		mb_native_os='any-os';
69a683
	fi
d40d13
}
d40d13
d40d13
d40d13
cross_defaults()
d40d13
{
47b1b5
	if [ -z "$mb_cross_compile" ] && [ "$mb_host" != native ]; then
d40d13
		mb_cross_compile=$mb_host'-'
d40d13
	fi
d40d13
}
d40d13
d40d13
591339
config_flags()
591339
{
591339
	mb_ldflags_tmp=" $mb_ldflags "
591339
	mb_ldflags_libs=`echo "$mb_ldflags_tmp" | sed 's/ -static / /g'`
591339
591339
	if [ "$mb_ldflags_tmp" != "$mb_ldflags_libs" ]; then
591339
		mb_ldflags="$mb_ldflags_libs"
591339
		mb_ldflags_util="$mb_ldflags_util -static"
591339
	fi
598fb4
598fb4
	# ccstrict
598fb4
	if [ "$mb_ccstrict" = 'yes' ]; then
598fb4
		mb_cflags_strict='-Wall -Werror -Wextra -Wundef'
598fb4
	fi
598fb4
598fb4
	# ldstrict
598fb4
	if [ "$mb_ldstrict" = 'yes' ]; then
598fb4
		mb_ldflags_strict='-Wl,--no-undefined'
598fb4
	fi
591339
}
591339
591339
d40d13
config_copy()
d40d13
{
d40d13
	sed 		-e 's^@package@^'"$mb_package"'^g' 				\
9c6a0f
			-e 's^@nickname@^'"$mb_nickname"'^g'				\
d40d13
			-e 's^@project_dir@^'"$mb_project_dir"'^g'			\
ed1185
			-e 's^@git_reference_dir@^'"$mb_git_reference_dir"'^g'		\
0804e2
			-e 's^@custom_install_headers@^'"$mb_custom_install_headers"'^g' \
d40d13
											\
d40d13
			-e 's^@build@^'"$mb_build"'^g'					\
d40d13
			-e 's^@host@^'"$mb_host"'^g'					\
d40d13
			-e 's^@target@^'"$mb_target"'^g'				\
d40d13
			-e 's^@arch@^'"$mb_arch"'^g'					\
aee992
			-e 's^@compiler@^'"$mb_compiler"'^g'				\
e5d4bb
			-e 's^@toolchain@^'"$mb_toolchain"'^g'				\
d40d13
			-e 's^@sysroot@^'"$mb_sysroot"'^g'				\
d40d13
			-e 's^@cross_compile@^'"$mb_cross_compile"'^g'			\
d40d13
			-e 's^@shell@^'"$mb_shell"'^g'					\
d40d13
											\
d40d13
			-e 's^@cflags@^'"$mb_cflags"'^g'				\
d40d13
			-e 's^@cflags_debug@^'"$mb_cflags_debug"'^g'			\
d40d13
			-e 's^@cflags_common@^'"$mb_cflags_common"'^g'			\
d40d13
			-e 's^@cflags_cmdline@^'"$mb_cflags $mb_cflags_cmdline"'^g'	\
d40d13
			-e 's^@cflags_config@^'"$mb_cflags_config"'^g'			\
d40d13
			-e 's^@cflags_sysroot@^'"$mb_cflags_sysroot"'^g'		\
596f2f
			-e 's^@cflags_os@^'"$mb_cflags_os"'^g'				\
596f2f
			-e 's^@cflags_site@^'"$mb_cflags_site"'^g'			\
d40d13
			-e 's^@cflags_path@^'"$mb_cflags_path"'^g'			\
598fb4
			-e 's^@cflags_strict@^'"$mb_cflags_strict"'^g'			\
54173a
			-e 's^@cflags_util@^'"$mb_cflags_util"'^g'			\
d40d13
											\
d40d13
			-e 's^@ldflags@^'"$mb_ldflags"'^g'				\
d40d13
			-e 's^@ldflags_debug@^'"$mb_ldflags_debug"'^g'			\
d40d13
			-e 's^@ldflags_common@^'"$mb_ldflags_common"'^g'		\
d40d13
			-e 's^@ldflags_cmdline@^'"$mb_ldflags $mb_ldflags_cmdline"'^g'	\
d40d13
			-e 's^@ldflags_config@^'"$mb_ldflags_config"'^g'		\
d40d13
			-e 's^@ldflags_sysroot@^'"$mb_ldflags_sysroot"'^g'		\
d40d13
			-e 's^@ldflags_path@^'"$mb_ldflags_path"'^g'			\
598fb4
			-e 's^@ldflags_strict@^'"$mb_ldflags_strict"'^g'		\
54173a
			-e 's^@ldflags_util@^'"$mb_ldflags_util"'^g'			\
d40d13
											\
d40d13
			-e 's^@pe_subsystem@^'"$mb_pe_subsystem"'^g'			\
d40d13
			-e 's^@pe_image\_base@^'"$mb_pe_image_base"'^g'			\
d40d13
			-e 's^@pe_config\_defs@^'"$mb_pe_config_defs"'^g'		\
d40d13
											\
d40d13
			-e 's^@elf_eh\_frame@^'"$mb_elf_eh_frame"'^g'			\
d40d13
			-e 's^@elf_hash\_style@^'"$mb_elf_hash_style"'^g'		\
d40d13
			-e 's^@elf_config\_defs@^'"$mb_elf_config_defs"'^g'		\
d40d13
											\
d40d13
			-e 's^@prefix@^'"$mb_prefix"'^g'				\
58536c
			-e 's^@exec_prefix@^'"$mb_exec_prefix"'^g'			\
d40d13
			-e 's^@bindir@^'"$mb_bindir"'^g'				\
d40d13
			-e 's^@libdir@^'"$mb_libdir"'^g'				\
d40d13
			-e 's^@includedir@^'"$mb_includedir"'^g'			\
d40d13
			-e 's^@mandir@^'"$mb_mandir"'^g'				\
d40d13
			-e 's^@docdir@^'"$mb_docdir"'^g'				\
d40d13
			-e 's^@libexecdir@^'"$mb_libexecdir"'^g'			\
d40d13
											\
1857dc
			-e 's^@native_cc@^'"$mb_native_cc"'^g'				\
1857dc
			-e 's^@native_os@^'"$mb_native_os"'^g'				\
97a363
			-e 's^@native_os_bits@^'"$mb_native_os_bits"'^g'		\
1857dc
			-e 's^@native_os_underscore@^'"$mb_native_os_underscore"'^g'	\
7f572b
											\
7f572b
			-e 's^@user_cc@^'"$mb_user_cc"'^g'				\
7f572b
			-e 's^@user_cpp@^'"$mb_user_cpp"'^g'				\
7f572b
			-e 's^@user_cxx@^'"$mb_user_cxx"'^g'				\
dbc5ee
											\
dbc5ee
			-e 's^@all_static@^'"$mb_all_static"'^g'			\
dbc5ee
			-e 's^@all_shared@^'"$mb_all_shared"'^g'			\
dbc5ee
			-e 's^@disable_static@^'"$mb_disable_static"'^g'		\
dbc5ee
			-e 's^@disable_shared@^'"$mb_disable_shared"'^g'		\
d40d13
		$mb_project_dir/Makefile.in > $mb_pwd/Makefile
d40d13
}
d40d13
d40d13
25984f
config_support()
25984f
{
25984f
	[ "$mb_disable_shared" = 'yes' ] && return 0
25984f
25984f
	mbt_cc=`make .display-cc`
25984f
	mbt_cflags=`make .display-cflags`
25984f
	mbt_source='int foo(int x){return ++x;}'
25984f
	mbt_result='no'
25984f
25984f
	rm -f a.out
25984f
	echo "$mbt_source" | "$mbt_cc" -shared -o a.out -xc -
25984f
	stat a.out >/dev/null 2>&1 && mbt_result='yes'
25984f
	rm -f a.out
25984f
25984f
	if [ "$mbt_result" = 'no' ]; then
25984f
		mb_disable_shared='yes'
25984f
		config_copy
25984f
	fi
25984f
}
25984f
25984f
e61178
config_host()
e61178
{
951ee8
	make -s host.tag && return 0
e61178
e61178
	error_msg "configure was able to generate a Makefile for the selected host,"
aee992
	error_msg "however the host-targeting compiler was found to be missing"
e61178
	error_msg "at least one of the required headers or features."
e61178
	exit 2
e61178
}
e61178
d40d13
b8b59f
config_status()
b8b59f
{
b8b59f
	printf "\n\n"
b8b59f
	make .display
b8b59f
	printf "\nconfiguration completed successfully.\n\n"
b8b59f
}
b8b59f
d40d13
# one: init
d40d13
init_vars
d40d13
verify_build_directory
d40d13
d40d13
d40d13
# two: args
d40d13
for arg ; do
d40d13
	case "$arg" in
d40d13
		--help)	usage
d40d13
			;;
d40d13
d40d13
		# dirs
d40d13
		--prefix=*)
be9f3e
			mb_prefix_set=yes
d40d13
			mb_prefix=${arg#*=}
d40d13
			;;
58536c
		--exec-prefix=*)
be9f3e
			mb_exec_prefix_set=yes
58536c
			mb_exec_prefix=${arg#*=}
58536c
			;;
d40d13
		--bindir=*)
d40d13
			mb_bindir=${arg#*=}
d40d13
			;;
d40d13
		--libdir=*)
d40d13
			mb_libdir=${arg#*=}
d40d13
			;;
d40d13
		--includedir=*)
d40d13
			mb_includedir=${arg#*=}
d40d13
			;;
d40d13
		--mandir=*)
d40d13
			mb_mandir=${arg#*=}
d40d13
			;;
d40d13
		--libexecdir=*)
d40d13
			mb_libexecdir=${arg#*=}
d40d13
			;;
d40d13
d40d13
d40d13
		# build
d40d13
		--build=*)
d40d13
			mb_build=${arg#*=}
d40d13
			;;
d40d13
		--host=*)
d40d13
			mb_host=${arg#*=}
d40d13
			;;
d40d13
		--target=*)
d40d13
			mb_target=${arg#*=}
d40d13
			;;
d40d13
		--arch=*)
d40d13
			mb_arch=${arg#*=}
d40d13
			;;
aee992
		--compiler=*)
aee992
			mb_compiler=${arg#*=}
d40d13
			;;
e5d4bb
		--toolchain=*)
e5d4bb
			mb_toolchain=${arg#*=}
e5d4bb
			;;
d40d13
		--sysroot=*)
d40d13
			mb_sysroot=${arg#*=}
d40d13
			;;
d40d13
		--cross-compile=*)
d40d13
			mb_cross_compile=${arg#*=}
d40d13
			;;
d40d13
		--shell=*)
d40d13
			mb_shell=${arg#*=}
d40d13
			;;
d40d13
		--debug)
d40d13
			mb_debug='yes'
d40d13
			;;
9c6a0f
dbc5ee
		# config
dbc5ee
		--all-static)
dbc5ee
			mb_all_static='yes'
dbc5ee
			;;
dbc5ee
		--all-shared)
dbc5ee
			mb_all_shared='yes'
dbc5ee
			;;
dbc5ee
		--disable-static)
dbc5ee
			mb_disable_static='yes'
dbc5ee
			;;
dbc5ee
		--disable-shared)
dbc5ee
			mb_disable_shared='yes'
dbc5ee
			;;
dbc5ee
		--enable-static)
dbc5ee
			mb_disable_static='no'
dbc5ee
			;;
dbc5ee
		--enable-shared)
dbc5ee
			mb_disable_shared='no'
dbc5ee
			;;
dbc5ee
598fb4
		# convenience
598fb4
		--strict)
598fb4
			mb_ccstrict='yes'
598fb4
			mb_ldstrict='yes'
598fb4
			;;
598fb4
		--ccstrict)
598fb4
			mb_ccstrict='yes'
598fb4
			;;
598fb4
		--ldstrict)
598fb4
			mb_ldstrict='yes'
598fb4
			;;
598fb4
9c6a0f
		# project
9c6a0f
		--nickname=*)
9c6a0f
			mb_nickname=${arg#*=}
9c6a0f
			;;
9c6a0f
d40d13
		*)
d40d13
			error_msg ${arg#}: "unsupported config argument."
d40d13
			exit 2
d40d13
			;;
d40d13
	esac
d40d13
done
d40d13
d40d13
d40d13
d40d13
# three: defaults
d40d13
common_defaults
d40d13
native_defaults
d40d13
cross_defaults
d40d13
d40d13
d40d13
d40d13
# four: config
591339
config_flags
d40d13
config_copy
25984f
config_support
e61178
config_host
b8b59f
config_status
d40d13
d40d13
d40d13
# all done
d40d13
exit 0