Blame configure

d40d13
#!/bin/sh
d40d13
83e725
set -eu
83e725
c55050
trap config_failure 1 2 EXIT
c55050
a554c2
usage()
a554c2
{
785495
	cat "$mb_project_dir"/config.usage
45b33c
ba54a5
	if [ _$mb_use_custom_cfgdefs = _yes ]; then
45b33c
		printf '\n\n%s%s\n' \
45b33c
			" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" \
45b33c
			"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
45b33c
45b33c
		printf '%s%s\n' \
45b33c
			"| Listed above are configure's common switches " \
45b33c
			"and environment variables.     |"
45b33c
45b33c
		printf '%s%s\n' \
45b33c
			"| Found below are project-specific variables " \
45b33c
			"and other customization options. |"
45b33c
45b33c
		printf '%s%s\n\n\n' \
45b33c
			" ___________________________________________" \
45b33c
			"__________________________________"
45b33c
45b33c
		cat "$mb_project_dir"/project/config/cfgdefs.usage
45b33c
	fi
45b33c
45b33c
	exit 0
a554c2
}
a554c2
d40d13
error_msg()
d40d13
{
f0c1ad
	echo "$@" >&2
d40d13
}
d40d13
d93341
warning_msg()
d93341
{
d93341
	echo "$@" >&2
d93341
}
d93341
d40d13
d40d13
init_vars()
d40d13
{
db3db2
	mb_project_dir=$(cd "$(dirname $0)" ; pwd)
df9e62
	mb_pwd=$(pwd)
d40d13
fd8eb5
	mb_custom_cfgdefs_args=''
fd8eb5
	mb_custom_cfgdefs_space=''
fd8eb5
de823d
	sfrt_impl_dir=$mb_project_dir/sofort
de823d
	sfrt_config_dir=$sfrt_impl_dir/config
de823d
	sfrt_core_dir=$sfrt_impl_dir/core
de823d
	sfrt_config_vars=$sfrt_config_dir/config.vars
de823d
	sfrt_flag_vars=$sfrt_config_dir/flag.vars
de823d
	sfrt_cfgdefs_in=$sfrt_config_dir/cfgdefs.in
de823d
de823d
	mb_make_vars=$(cat $sfrt_config_vars \
16681e
		| grep -v -e '^#' -e '^$' | tr '[:lower:]' '[:upper:]')
548c78
de823d
	mb_impl_vars=$(cat $sfrt_config_vars \
16681e
		| grep -v -e '^#' -e '^$' | sed 's/^/mb_/g')
16681e
de823d
	mb_proj_vars=$(cat $sfrt_config_vars \
16681e
		| grep -v -e '^#' -e '^$' | sed 's/^/mb_default_/g')
16681e
de823d
	mb_flag_vars=$(cat $sfrt_flag_vars \
16681e
		| grep -v -e '^#' -e '^$')
16681e
16681e
	mb_vars="$mb_make_vars $mb_impl_vars $mb_proj_vars $mb_flag_vars"
16681e
16681e
	for mb_var in $mb_vars ; do
548c78
		mb_expr=$mb_var='${'$mb_var':-}'
548c78
		eval "$mb_expr"
548c78
	done
548c78
711507
	# ccenv
711507
	. $mb_project_dir/sofort/ccenv/ccenv.sh
711507
ce8e9e
	if ! [ -L ./ccenv ]; then
711507
		if [ -d ./ccenv ]; then
711507
			rm -f ./ccenv/host.mk
711507
			rm -f ./ccenv/native.mk
711507
			rmdir ./ccenv
711507
		fi
711507
	fi
711507
711507
	# config.project
47b1b5
	if [ -z "$mb_config" ]; then
fb2052
		. $mb_project_dir/config.project
d40d13
	else
fb2052
		. "$mb_config"
d40d13
	fi
d40d13
88054e
	# project-specific config definitions
ba54a5
	if [ _$mb_use_custom_cfgdefs = _yes ]; then
de823d
		cat $sfrt_cfgdefs_in > cfgdefs.mk
61b1fe
	else
61b1fe
		printf '%s %s\n\n' \
61b1fe
				'# this project does not include' \
61b1fe
				'a custom config step.'           \
61b1fe
			> cfgdefs.mk
de823d
		cat $sfrt_cfgdefs_in >> cfgdefs.mk
18aad4
18aad4
		if [ -f $mb_project_dir/project/cfgdefs.in ]; then
18aad4
			cat $mb_project_dir/project/cfgdefs.in >> cfgdefs.mk
18aad4
		fi
88054e
	fi
88054e
88054e
	# user build-time overrides
61b1fe
	touch usrdefs.mk
88054e
9c6a0f
	# project
9c6a0f
	mb_nickname=$NICKNAME
694972
	mb_source_dir=$SOURCE_DIR
9c6a0f
d40d13
	# dirs
d40d13
	mb_prefix=$PREFIX
58536c
	mb_exec_prefix=$EXEC_PREFIX
b023b2
	mb_bindir=$BINDIR
698a3c
	mb_sbindir=$SBINDIR
b023b2
	mb_libdir=$LIBDIR
b023b2
	mb_includedir=$INCLUDEDIR
47362f
	mb_oldincludedir=$OLDINCLUDEDIR
b023b2
	mb_mandir=$MANDIR
b023b2
	mb_docdir=$DOCDIR
b023b2
	mb_libexecdir=$LIBEXECDIR
d40d13
47362f
	mb_sysconfdir=$SYSCONFDIR
47362f
	mb_sharedstatedir=$SHAREDSTATEDIR
47362f
	mb_localstatedir=$LOCALSTATEDIR
47362f
	mb_runstatedir=$RUNSTATEDIR
47362f
	mb_datarootdir=$DATAROOTDIR
47362f
	mb_datadir=$DATADIR
47362f
	mb_infodir=$INFODIR
47362f
	mb_localedir=$LOCALEDIR
47362f
	mb_htmldir=$HTMLDIR
47362f
	mb_dvidir=$DVIDIR
47362f
	mb_pdfdir=$PDFDIR
47362f
	mb_psdir=$PSDIR
47362f
d40d13
d40d13
	# build
d40d13
	mb_build=$BUILD
1cc0e3
	mb_cchost=$CCHOST
15f27a
	mb_cfghost=$CFGHOST
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
b35cf1
	mb_cflags_last=$CFLAGS_LAST
b35cf1
	mb_cflags_once=$CFLAGS_ONCE
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
b35cf1
	mb_ldflags_last=$LDFLAGS_LAST
b35cf1
	mb_ldflags_once=$LDFLAGS_ONCE
d40d13
d40d13
	mb_pe_subsystem=$PE_SUBSYSTEM
d40d13
	mb_pe_image_base=$PE_IMAGE_BASE
d40d13
d40d13
	# overrides
7f572b
	mb_user_cc=$CC
7f572b
	mb_user_cpp=$CPP
7f572b
	mb_user_cxx=$CXX
711507
711507
	mb_native_cc=$NATIVE_CC
711507
	mb_native_cpp=$NATIVE_CPP
711507
	mb_native_cxx=$NATIVE_CXX
711507
711507
	mb_native_host=$NATIVE_HOST
711507
	mb_native_cfghost=$NATIVE_CFGHOST
711507
	mb_native_cflags=$NATIVE_CFLAGS
711507
	mb_native_ldflags=$NATIVE_LDFLAGS
ad1be2
ad1be2
	mb_native_pe_subsystem=$NATIVE_PE_SUBSYSTEM
ad1be2
	mb_native_pe_image_base=$NATIVE_PE_IMAGE_BASE
d40d13
}
d40d13
d40d13
d40d13
verify_build_directory()
d40d13
{
47b1b5
	if [ "$mb_project_dir" = "$mb_pwd" ]; then
ba54a5
		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."
fb2052
			exit 1
d40d13
		else
d40d13
			mb_project_dir='.'
d40d13
		fi
d40d13
	fi
c55050
c55050
	rm -f Makefile Makefile.host Makefile.tmp Makefile.failed
d40d13
}
d40d13
d40d13
694972
verify_source_directory()
694972
{
694972
	if [ -z "$mb_source_dir" ]; then
ba54a5
		if [ _$mb_require_source_dir = _yes ]; then
694972
			error_msg "$mb_package: specifying an external source directory is required."
694972
			error_msg "you can set the source directory either via --source-dir=<path>,"
694972
			error_msg "or by setting the SOURCE_DIR variable."
fb2052
			exit 1
694972
		fi
694972
	fi
694972
}
694972
694972
d40d13
common_defaults()
d40d13
{
694972
	# git
694972
	if [ -n "$mb_source_dir" ]; then
694972
		if [ -d "$mb_source_dir/.git" ]; then
414a20
			mb_git_reference_index="\$(SOURCE_DIR)/.git/index"
694972
		fi
694972
	elif [ -d "$mb_project_dir/.git" ]; then
414a20
		mb_git_reference_index="\$(PROJECT_DIR)/.git/index"
694972
	fi
694972
9c6a0f
	# project
9c6a0f
	[ -z "$mb_nickname" ] 		&& mb_nickname=$mb_package
694972
	[ -z "$mb_source_dir" ] 	&& mb_source_dir=$mb_project_dir
d564ee
	[ -z "$mb_avoid_version" ] 	&& mb_avoid_version='no'
9c6a0f
f6311b
	# pkgconfig
f6311b
	[ -z "$mb_pkgname" ]		&& mb_pkgname="$mb_default_pkgname"
f6311b
	[ -z "$mb_pkgdesc" ]		&& mb_pkgdesc="$mb_default_pkgdesc"
f6311b
	[ -z "$mb_pkgusrc" ]		&& mb_pkgusrc="$mb_default_pkgusrc"
f6311b
	[ -z "$mb_pkgrepo" ]		&& mb_pkgrepo="$mb_default_pkgrepo"
f6311b
	[ -z "$mb_pkgpsrc" ]		&& mb_pkgpsrc="$mb_default_pkgpsrc"
f6311b
	[ -z "$mb_pkgdurl" ]		&& mb_pkgdurl="$mb_default_pkgdurl"
f6311b
	[ -z "$mb_pkgdefs" ]		&& mb_pkgdefs="$mb_default_pkgdefs"
f6311b
	[ -z "$mb_pkglibs" ]		&& mb_pkglibs="$mb_default_pkglibs"
f6311b
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
5ed577
	[ -z "$mb_bindir" ] 		&& [ -z "$mb_bindir_set" ] \
5ed577
					&& [ -z "$mb_bindir_basename" ] \
5ed577
					&& mb_bindir=$mb_exec_prefix/bin
5ed577
5ed577
	[ -z "$mb_bindir" ] 		&& [ -z "$mb_bindir_set" ] \
5ed577
					&& mb_bindir=$mb_exec_prefix/$mb_bindir_basename
5ed577
698a3c
	[ -z "$mb_sbindir" ] 		&& mb_sbindir=$mb_exec_prefix/sbin
a1d4a9
	[ -z "$mb_libdir" ] 		&& mb_libdir=$mb_exec_prefix/lib
a1d4a9
	[ -z "$mb_includedir" ]		&& mb_includedir=$mb_prefix/include
47362f
	[ -z "$mb_oldincludedir" ]	&& mb_oldincludedir=$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
47362f
	[ -z "$mb_sysconfdir" ] 	&& mb_sysconfdir=$mb_exec_prefix/etc
47362f
	[ -z "$mb_sharedstatedir" ] 	&& mb_sharedstatedir=$mb_prefix/com
47362f
	[ -z "$mb_localstatedir" ] 	&& mb_localstatedir=$mb_prefix/var
47362f
	[ -z "$mb_runstatedir" ] 	&& mb_runstatedir=$mb_localstatedir/run
47362f
	[ -z "$mb_datarootdir" ] 	&& mb_datarootdir=$mb_prefix/share
47362f
	[ -z "$mb_datadir" ] 		&& mb_datadir=$mb_datarootdir
47362f
	[ -z "$mb_infodir" ] 		&& mb_infodir=$mb_datarootdir/info
47362f
	[ -z "$mb_localedir" ] 		&& mb_localedir=$mb_datarootdir/locale
47362f
	[ -z "$mb_htmldir" ] 		&& mb_htmldir=$mb_docdir
47362f
	[ -z "$mb_dvidir" ] 		&& mb_dvidir=$mb_docdir
47362f
	[ -z "$mb_pdfdir" ] 		&& mb_pdfdir=$mb_docdir
47362f
	[ -z "$mb_psdir" ] 		&& mb_psdir=$mb_docdir
47362f
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
b35cf1
	[ -z "$mb_cflags_last" ]	&& mb_cflags_last=$mb_default_cflags_last
b35cf1
	[ -z "$mb_cflags_once" ]	&& mb_cflags_once=$mb_default_cflags_once
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
b35cf1
	[ -z "$mb_ldflags_last" ]	&& mb_ldflags_last=$mb_default_ldflags_last
b35cf1
	[ -z "$mb_ldflags_once" ]	&& mb_ldflags_once=$mb_default_ldflags_once
d40d13
895cbe
	# native switches
895cbe
	[ -z "$mb_native_cflags" ]	&& mb_native_cflags=$mb_default_native_cflags
895cbe
	[ -z "$mb_native_ldflags" ]	&& mb_native_ldflags=$mb_default_native_ldflags
895cbe
dbc5ee
	# config
dbc5ee
	[ -z "$mb_all_static" ]		&& mb_all_static='no'
dbc5ee
	[ -z "$mb_all_shared" ]		&& mb_all_shared='no'
ad42d8
	[ -z "$mb_disable_frontend" ]	&& mb_disable_frontend='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
85ef28
			mb_ldflags_sysroot="--sysroot=$mb_sysroot"
d40d13
		fi
d40d13
	fi
d40d13
d40d13
	# debug
ba54a5
	if [ _$mb_debug = _yes ]; then
47b1b5
		if [ -z "$mb_cflags_debug" ]; then
d40d13
			mb_cflags_debug='-g3 -O0'
d40d13
		fi
d40d13
	fi
7f7098
11cdd4
	# shell
11cdd4
	if [ -z "$mb_shell" ]; then
11cdd4
		mb_shell='/bin/sh'
11cdd4
	fi
11cdd4
7f7098
	# inherited cflags & ldflags
7f7098
	mb_cflags_cmdline="$mb_cflags_cmdline $mb_cflags"
7f7098
	mb_ldflags_cmdline="$mb_ldflags_cmdline $mb_ldflags"
d40d13
}
d40d13
d40d13
591339
config_flags()
591339
{
591339
	mb_ldflags_tmp=" $mb_ldflags "
df9e62
	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
ba54a5
	if [ _$mb_ccstrict = _yes ]; then
598fb4
		mb_cflags_strict='-Wall -Werror -Wextra -Wundef'
598fb4
	fi
598fb4
598fb4
	# ldstrict
ba54a5
	if [ _$mb_ldstrict = _yes ]; then
598fb4
		mb_ldflags_strict='-Wl,--no-undefined'
598fb4
	fi
591339
}
591339
591339
d40d13
config_copy()
d40d13
{
de823d
	mb_vars=$(cut -d'=' -f1 $sfrt_config_vars \
16681e
			| grep -v '^#')
16681e
16681e
	mb_sed_substs=" \
16681e
		$(for __var in $mb_vars; do                  \
16681e
			printf '%s"$%s"%s' "-e 's^@$__var@^'" \
16681e
				"mb_$__var" "'^g' ";           \
16681e
		done)"
16681e
16681e
	eval sed $mb_sed_substs \
16681e
		$mb_project_dir/Makefile.in    \
e4cf2f
			| sed -e 's/[[:blank:]]*$//g' \
16681e
			> $mb_pwd/Makefile.tmp
711507
}
1cc0e3
c68106
711507
config_ccenv()
711507
{
711507
	mkdir -p ./ccenv
711507
	touch ./ccenv/host.mk
711507
	touch ./ccenv/native.mk
45b33c
711507
	ccenv_set_host_variables
711507
	ccenv_set_native_variables
2b5dd6
2b5dd6
	config_copy
711507
}
45b33c
45b33c
config_custom()
45b33c
{
ba54a5
	if [ _$mb_use_custom_cfgdefs = _yes ]; then
fd8eb5
		eval . $mb_project_dir/project/config/cfgdefs.sh \
fd8eb5
			"$mb_custom_cfgdefs_args"
45b33c
		config_copy
45b33c
	fi
1cc0e3
ba54a5
	if [ _$mb_use_custom_usrdefs = _yes ]; then
45b33c
		. $mb_project_dir/project/usrdefs.sh
45b33c
	fi
45b33c
}
45b33c
45b33c
45b33c
config_cfghost()
45b33c
{
15f27a
	if [ -z "$mb_cfghost" ]; then
15f27a
		mb_cfghost=$mb_cchost
15f27a
	fi
15f27a
15f27a
	sed		-e 's^@cchost@^'"$mb_cchost"'^g'     \
15f27a
			-e 's^@cfghost@^'"$mb_cfghost"'^g'   \
fb2052
		$mb_pwd/Makefile.tmp > $mb_pwd/Makefile.host
1cc0e3
fb2052
	rm  $mb_pwd/Makefile.tmp
fb2052
	mv  $mb_pwd/Makefile.host $mb_pwd/Makefile
d40d13
}
d40d13
d40d13
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
c55050
c55050
config_failure()
c55050
{
c55050
	if [ -f Makefile ]; then
c55050
		mb_error='failed to use the generated Makefile.'
c55050
		printf '\n%s: error: %s\n' "${0}" "$mb_error" >&2
c55050
		mv Makefile Makefile.failed
c55050
	fi
c55050
c55050
	exit 2
c55050
}
c55050
c55050
c55050
config_success()
c55050
{
c55050
	trap '' EXIT
c55050
	exit 0
c55050
}
c55050
c55050
d40d13
# one: init
d40d13
init_vars
d40d13
verify_build_directory
d40d13
d40d13
d40d13
# two: args
d40d13
for arg ; do
d40d13
	case "$arg" in
711507
		--help)
711507
			usage
711507
			;;
711507
		--help=ccenv)
711507
			ccenv_usage
711507
			;;
711507
711507
		# ccenv
711507
		--cross-compile=*)
711507
			mb_cross_compile=${arg#*=}
711507
			;;
711507
		--compiler=*)
711507
			mb_compiler=${arg#*=}
711507
			;;
711507
		--toolchain=*)
711507
			mb_toolchain=${arg#*=}
711507
			;;
711507
		--zealous)
711507
			mb_agnostic=yes
711507
			mb_zealous=
711507
			;;
711507
		--zealous=*)
711507
			mb_zealous=${arg#*=}
711507
			;;
711507
		--ccenv=*)
711507
			mb_ccenv=${arg#*=}
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=*)
5ed577
			mb_bindir_set=yes
d40d13
			mb_bindir=${arg#*=}
d40d13
			;;
698a3c
		--sbindir=*)
698a3c
			mb_sbindir=${arg#*=}
698a3c
			;;
d40d13
		--libdir=*)
d40d13
			mb_libdir=${arg#*=}
d40d13
			;;
d40d13
		--includedir=*)
d40d13
			mb_includedir=${arg#*=}
d40d13
			;;
47362f
		--oldincludedir=*)
47362f
			mb_oldincludedir=${arg#*=}
47362f
			;;
d40d13
		--mandir=*)
d40d13
			mb_mandir=${arg#*=}
d40d13
			;;
d40d13
		--libexecdir=*)
d40d13
			mb_libexecdir=${arg#*=}
d40d13
			;;
d40d13
d40d13
47362f
		--sysconfdir=*)
47362f
			mb_sysconfdir=${arg#*=}
47362f
			;;
47362f
		--sharedstatedir=*)
47362f
			mb_sharedstatedir=${arg#*=}
47362f
			;;
47362f
		--localstatedir=*)
47362f
			mb_localstatedir=${arg#*=}
47362f
			;;
47362f
		--runstatedir=*)
47362f
			mb_runstatedir=${arg#*=}
47362f
			;;
47362f
		--datarootdir=*)
47362f
			mb_datarootdir=${arg#*=}
47362f
			;;
47362f
		--datadir=*)
47362f
			mb_datadir=${arg#*=}
47362f
			;;
47362f
		--infodir=*)
47362f
			mb_infodir=${arg#*=}
47362f
			;;
47362f
		--localedir=*)
47362f
			mb_localedir=${arg#*=}
47362f
			;;
47362f
		--htmldir=*)
47362f
			mb_htmldir=${arg#*=}
47362f
			;;
47362f
		--dvidir=*)
47362f
			mb_dvidir=${arg#*=}
47362f
			;;
47362f
		--pdfdir=*)
47362f
			mb_pdfdir=${arg#*=}
47362f
			;;
47362f
		--psdir=*)
47362f
			mb_psdir=${arg#*=}
47362f
			;;
47362f
47362f
d40d13
		# build
d40d13
		--build=*)
d40d13
			mb_build=${arg#*=}
d40d13
			;;
d40d13
		--host=*)
d40d13
			mb_host=${arg#*=}
d40d13
			;;
1cc0e3
		--cchost=*)
1cc0e3
			mb_cchost=${arg#*=}
1cc0e3
			;;
15f27a
		--cfghost=*)
15f27a
			mb_cfghost=${arg#*=}
15f27a
			;;
d40d13
		--target=*)
d40d13
			mb_target=${arg#*=}
d40d13
			;;
d40d13
		--arch=*)
d40d13
			mb_arch=${arg#*=}
d40d13
			;;
d40d13
		--sysroot=*)
d40d13
			mb_sysroot=${arg#*=}
d40d13
			;;
d40d13
		--shell=*)
d40d13
			mb_shell=${arg#*=}
d40d13
			;;
d40d13
		--debug)
ba54a5
			mb_debug=yes
d40d13
			;;
9c6a0f
dbc5ee
		# config
dbc5ee
		--all-static)
ba54a5
			mb_all_static=yes
57b45a
			mb_all_shared=no
dbc5ee
			;;
dbc5ee
		--all-shared)
ba54a5
			mb_all_shared=yes
57b45a
			mb_all_static=no
dbc5ee
			;;
ad42d8
		--disable-frontend)
ba54a5
			mb_disable_frontend=yes
ad42d8
			;;
ad42d8
		--disable-app)
ba54a5
			mb_disable_frontend=yes
ad42d8
			;;
ad42d8
		--enable-frontend)
ad42d8
			mb_disable_frontend='no'
ad42d8
			;;
ad42d8
		--enable-app)
ad42d8
			mb_disable_frontend='no'
ad42d8
			;;
dbc5ee
		--disable-static)
ba54a5
			mb_disable_static=yes
dbc5ee
			;;
dbc5ee
		--disable-shared)
ba54a5
			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)
ba54a5
			mb_ccstrict=yes
ba54a5
			mb_ldstrict=yes
598fb4
			;;
598fb4
		--ccstrict)
ba54a5
			mb_ccstrict=yes
598fb4
			;;
598fb4
		--ldstrict)
ba54a5
			mb_ldstrict=yes
598fb4
			;;
598fb4
9c6a0f
		# project
9c6a0f
		--nickname=*)
9c6a0f
			mb_nickname=${arg#*=}
9c6a0f
			;;
aa17d2
		--program-prefix=*)
aa17d2
			mb_program_prefix=${arg#*=}
aa17d2
			;;
d564ee
		--avoid-version)
ba54a5
			mb_avoid_version=yes
d564ee
			;;
694972
		--source-dir=*)
694972
			mb_source_dir=${arg#*=}
694972
			;;
9c6a0f
f6311b
		# pkgconfig
f6311b
		--pkgname=*)
f6311b
			mb_pkgname=${arg#*=}
f6311b
			;;
f6311b
f6311b
		--pkgdesc=*)
f6311b
			mb_pkgdesc=${arg#*=}
f6311b
			;;
f6311b
f6311b
		--pkgusrc=*)
f6311b
			mb_pkgusrc=${arg#*=}
f6311b
			;;
f6311b
f6311b
		--pkgrepo=*)
f6311b
			mb_pkgrepo=${arg#*=}
f6311b
			;;
f6311b
f6311b
		--pkgpsrc=*)
f6311b
			mb_pkgpsrc=${arg#*=}
f6311b
			;;
f6311b
f6311b
		--pkgdurl=*)
f6311b
			mb_pkgdurl=${arg#*=}
f6311b
			;;
f6311b
f6311b
		--pkgdefs=*)
f6311b
			mb_pkgdefs=${arg#*=}
f6311b
			;;
f6311b
f6311b
		--pkglibs=*)
f6311b
			mb_pkglibs=${arg#*=}
f6311b
			;;
f6311b
93c49a
		# compatibility
93c49a
		--enable-dependency-tracking)
93c49a
			;;
93c49a
		--disable-dependency-tracking)
93c49a
			;;
93c49a
d40d13
		*)
ba54a5
			if [ _$mb_use_custom_cfgdefs = _yes ]; then
fd8eb5
				mb_escaped_arg=\'$(printf '%s\n' "$arg" | sed -e "s/'/'\\\\''/g")\'
fd8eb5
				mb_escaped_arg="$mb_custom_cfgdefs_space$mb_escaped_arg"
fd8eb5
				mb_custom_cfgdefs_args="$mb_custom_cfgdefs_args$mb_escaped_arg"
fd8eb5
				mb_custom_cfgdefs_space=' '
45b33c
			else
45b33c
				error_msg ${arg#}: "unsupported config argument."
45b33c
				exit 2
45b33c
			fi
d40d13
			;;
d40d13
	esac
d40d13
done
d40d13
d40d13
d40d13
694972
# three: validation
694972
verify_source_directory
694972
aa17d2
if ! [ -z "$mb_program_prefix" ]; then
aa17d2
	error_msg "--program-prefix is not yet fully support (must be null)."
aa17d2
fi
aa17d2
694972
694972
694972
# four: defaults
d40d13
common_defaults
d40d13
d40d13
694972
# five: config
591339
config_flags
d40d13
config_copy
711507
config_ccenv
45b33c
config_custom
45b33c
config_cfghost
e61178
config_host
b8b59f
config_status
d40d13
d40d13
d40d13
# all done
c55050
config_success