Blame configure

9ca8c4
#!/bin/sh
9ca8c4
c88d44
# project-agnostic ./configure script, written by hand.
c88d44
# this file is covered by COPYING.SOFORT.
c88d44
5ca785
set -eu
5ca785
c0614b
trap config_failure 1 2 EXIT
c0614b
cb498a
# before we begin...
cb498a
mb_path="$PATH"
3dcb0d
mb_script="$0"
3dcb0d
mb_success=no
cb498a
9ca8c4
usage()
9ca8c4
{
9ca8c4
	cat "$mb_project_dir"/config.usage
d2a366
29a758
	if [ _$mb_use_custom_cfgdefs = _yes ]; then
d2a366
		printf '\n\n%s%s\n' \
d2a366
			" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" \
d2a366
			"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
d2a366
d2a366
		printf '%s%s\n' \
d2a366
			"| Listed above are configure's common switches " \
d2a366
			"and environment variables.     |"
d2a366
d2a366
		printf '%s%s\n' \
d2a366
			"| Found below are project-specific variables " \
d2a366
			"and other customization options. |"
d2a366
d2a366
		printf '%s%s\n\n\n' \
d2a366
			" ___________________________________________" \
d2a366
			"__________________________________"
d2a366
d2a366
		cat "$mb_project_dir"/project/config/cfgdefs.usage
d2a366
	fi
d2a366
d2a366
	exit 0
9ca8c4
}
9ca8c4
9ca8c4
error_msg()
9ca8c4
{
e347d0
	printf '%s\n' "$@" >&2
9ca8c4
}
9ca8c4
bd640f
warning_msg()
bd640f
{
e347d0
	printf '%s\n' "$@" >&2
bd640f
}
bd640f
54797a
output_step_prolog()
54797a
{
f23bfe
	mb_line_dots='.................................'
f23bfe
	mb_line_dots="${mb_line_dots}.${mb_line_dots}"
f23bfe
	mb_step_desc="${mb_package} : ${1##*/} : ${2}()  "
54797a
	mb_step_dlen="$((${#mb_line_dots} - ${#mb_step_desc}))"
a8f188
a8f188
	printf "configure step: ${2}()\n" >&3
f23bfe
	printf "%s%${mb_step_dlen}.${mb_step_dlen}s  " "${mb_step_desc}" "${mb_line_dots}"
54797a
}
54797a
54797a
output_step_epilog()
54797a
{
54797a
	printf 'OK.\n'
54797a
}
54797a
54797a
output_script_status()
54797a
{
54797a
	mb_step_name="${1##*/} : ${2}"
54797a
	mb_step_desc="${mb_package} : ${mb_step_name}"
a8f188
a8f188
	printf "configure info: ${2}\n" >&3
54797a
	printf "%s\n" "${mb_step_desc}"
54797a
}
54797a
54797a
output_section_break()
54797a
{
2f82db
	printf ' ..\n'
54797a
}
54797a
8d201c
verify_safe_path()
8d201c
{
8d201c
	case "$mb_safe_path_name" in
8d201c
		-*)
8d201c
			error_msg "$mb_safe_path_desc may not begin with a hyphen."
8d201c
			exit 2
8d201c
			;;
8d201c
8d201c
		*\ *)
8d201c
			error_msg "$mb_safe_path_desc may not contain spaces."
8d201c
			exit 2
8d201c
			;;
8d201c
	esac
8d201c
}
9ca8c4
a8f188
init_log()
a8f188
{
a8f188
	exec 3> config.log
a8f188
a8f188
	printf "This is config.log, generated by sofort's configure script.\n\n" >&3
a8f188
	printf '$ %s' "$mb_script" >&3
a8f188
}
a8f188
9ca8c4
init_vars()
9ca8c4
{
ee0864
	mb_project_dir=$(cd -- "${mb_script%/*}/" ; pwd -P)
28bf9c
	mb_pwd=$(pwd -P)
9ca8c4
8d201c
	mb_safe_path_desc='project directory'
8d201c
	mb_safe_path_name="$mb_project_dir"
8d201c
	verify_safe_path
8d201c
8d201c
	mb_safe_path_desc='working directory'
8d201c
	mb_safe_path_name="$mb_pwd"
8d201c
	verify_safe_path
8d201c
43dbe7
	mb_custom_cfgdefs_args=''
43dbe7
	mb_custom_cfgdefs_space=''
43dbe7
66aea9
	mb_srcinfo='$(PROJECT_DIR)/project/srcdist/srcinfo.in'
66aea9
	mb_srcsite='localhost'
66aea9
66aea9
	mb_pgprkey='!!VARIABLE_NOT_SET!!'
66aea9
	mb_pgpskey='!!VARIABLE_NOT_SET!!'
66aea9
3cdb2f
	sfrt_impl_dir=$mb_project_dir/sofort
3cdb2f
	sfrt_config_dir=$sfrt_impl_dir/config
3cdb2f
	sfrt_core_dir=$sfrt_impl_dir/core
3cdb2f
	sfrt_config_vars=$sfrt_config_dir/config.vars
3cdb2f
	sfrt_flag_vars=$sfrt_config_dir/flag.vars
db7312
	sfrt_opt_vars=$sfrt_config_dir/opt.vars
3cdb2f
	sfrt_cfgdefs_in=$sfrt_config_dir/cfgdefs.in
3cdb2f
e99ec7
	mb_make_vars=$(< "$sfrt_config_vars" \
e99ec7
		grep -v -e '^#' -e '^$' | tr '[:lower:]' '[:upper:]')
103e4c
e99ec7
	mb_impl_vars=$(< "$sfrt_config_vars" \
e99ec7
		grep -v -e '^#' -e '^$' | sed 's/^/mb_/g')
eb9c1b
e99ec7
	mb_proj_vars=$(< "$sfrt_config_vars" \
e99ec7
		grep -v -e '^#' -e '^$' | sed 's/^/mb_default_/g')
eb9c1b
e99ec7
	mb_flag_vars=$(< "$sfrt_flag_vars" \
e99ec7
		grep -v -e '^#' -e '^$')
eb9c1b
eb9c1b
	mb_vars="$mb_make_vars $mb_impl_vars $mb_proj_vars $mb_flag_vars"
eb9c1b
7cf81c
	for mb_var in $(printf '%s' "$mb_vars") ; do
103e4c
		mb_expr=$mb_var='${'$mb_var':-}'
103e4c
		eval "$mb_expr"
103e4c
	done
103e4c
f7f887
	# ccenv
f7f887
	. $mb_project_dir/sofort/ccenv/ccenv.sh
f7f887
890075
	if ! [ -L ./ccenv ]; then
f7f887
		if [ -d ./ccenv ]; then
f7f887
			rm -f ./ccenv/host.mk
f7f887
			rm -f ./ccenv/native.mk
f7f887
			rmdir ./ccenv
f7f887
		fi
f7f887
	fi
f7f887
f7f887
	# config.project
9ca8c4
	if [ -z "$mb_config" ]; then
73e2f3
		mb_config="$mb_project_dir/config.project"
73e2f3
	fi
73e2f3
73e2f3
	. "$mb_config"
73e2f3
b6bce8
	# config.project make preferences
b6bce8
	if [ -z "${MAKE}" ]; then
b6bce8
		MAKE="$mb_make"
b6bce8
	fi
b6bce8
b6bce8
	if [ -z "${MAKEMODE}" ]; then
b6bce8
		MAKEMODE="$mb_makemode"
b6bce8
	fi
b6bce8
dd257b
	# project-specific initialization
dd257b
	if [ _$mb_use_custom_cfginit = _yes ]; then
dd257b
		. "$mb_project_dir/project/config/cfginit.sh"
dd257b
	fi
dd257b
73e2f3
	# package
73e2f3
	if [ -z "$mb_package" ]; then
73e2f3
		error_msg "$mb_script: incomplete information in $mb_config."
73e2f3
		error_msg "$mb_script: \$mb_package not set."
73e2f3
		exit 1
9ca8c4
	fi
9ca8c4
c7b6f6
	# srcinfo
c7b6f6
	if [ -n "$SOURCE_DIR" ]; then
c7b6f6
		mb_source_dir_set=yes
c7b6f6
	fi
c7b6f6
54797a
	# step prolog
54797a
	output_step_prolog ${mb_script} 'init_vars'
54797a
be9551
	# project
be9551
	mb_nickname=$NICKNAME
613e01
	mb_source_dir=$SOURCE_DIR
be9551
9ca8c4
	# dirs
9ca8c4
	mb_prefix=$PREFIX
4a022e
	mb_exec_prefix=$EXEC_PREFIX
9ca8c4
	mb_bindir=$BINDIR
67be49
	mb_sbindir=$SBINDIR
9ca8c4
	mb_libdir=$LIBDIR
9ca8c4
	mb_includedir=$INCLUDEDIR
aacf07
	mb_oldincludedir=$OLDINCLUDEDIR
9ca8c4
	mb_mandir=$MANDIR
9ca8c4
	mb_docdir=$DOCDIR
9ca8c4
	mb_libexecdir=$LIBEXECDIR
9ca8c4
aacf07
	mb_sysconfdir=$SYSCONFDIR
aacf07
	mb_sharedstatedir=$SHAREDSTATEDIR
aacf07
	mb_localstatedir=$LOCALSTATEDIR
aacf07
	mb_runstatedir=$RUNSTATEDIR
aacf07
	mb_datarootdir=$DATAROOTDIR
aacf07
	mb_datadir=$DATADIR
aacf07
	mb_infodir=$INFODIR
aacf07
	mb_localedir=$LOCALEDIR
aacf07
	mb_htmldir=$HTMLDIR
aacf07
	mb_dvidir=$DVIDIR
aacf07
	mb_pdfdir=$PDFDIR
aacf07
	mb_psdir=$PSDIR
aacf07
ebc6d4
	# make
ebc6d4
	mb_make=$MAKE
b4b46d
	mb_makemode=$MAKEMODE
9ca8c4
9ca8c4
	# build
9ca8c4
	mb_build=$BUILD
f83f76
	mb_cchost=$CCHOST
f9d92c
	mb_cfghost=$CFGHOST
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
1e6e10
	mb_cflags_strict=$CFLAGS_STRICT
fbb1cf
	mb_cflags_util=$CFLAGS_UTIL
c5c9ea
	mb_cflags_last=$CFLAGS_LAST
c5c9ea
	mb_cflags_once=$CFLAGS_ONCE
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
1e6e10
	mb_ldflags_strict=$LDFLAGS_STRICT
fbb1cf
	mb_ldflags_util=$LDFLAGS_UTIL
c5c9ea
	mb_ldflags_last=$LDFLAGS_LAST
c5c9ea
	mb_ldflags_once=$LDFLAGS_ONCE
9ca8c4
9ca8c4
	mb_pe_subsystem=$PE_SUBSYSTEM
9ca8c4
	mb_pe_image_base=$PE_IMAGE_BASE
9ca8c4
9ca8c4
	# overrides
9ca8c4
	mb_user_cc=$CC
9ca8c4
	mb_user_cpp=$CPP
9ca8c4
	mb_user_cxx=$CXX
f7f887
f7f887
	mb_native_cc=$NATIVE_CC
f7f887
	mb_native_cpp=$NATIVE_CPP
f7f887
	mb_native_cxx=$NATIVE_CXX
f7f887
f7f887
	mb_native_host=$NATIVE_HOST
f7f887
	mb_native_cfghost=$NATIVE_CFGHOST
f7f887
	mb_native_cflags=$NATIVE_CFLAGS
f7f887
	mb_native_ldflags=$NATIVE_LDFLAGS
fc67fb
fc67fb
	mb_native_pe_subsystem=$NATIVE_PE_SUBSYSTEM
fc67fb
	mb_native_pe_image_base=$NATIVE_PE_IMAGE_BASE
54797a
54797a
	# step epilog
54797a
	output_step_epilog
9ca8c4
}
9ca8c4
9ca8c4
9ca8c4
verify_build_directory()
9ca8c4
{
54797a
	output_step_prolog ${mb_script} 'verify_build_directory'
54797a
9ca8c4
	if [ "$mb_project_dir" = "$mb_pwd" ]; then
29a758
		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."
0d2779
			exit 1
9ca8c4
		else
9ca8c4
			mb_project_dir='.'
9ca8c4
		fi
9ca8c4
	fi
c0614b
c0614b
	rm -f Makefile Makefile.host Makefile.tmp Makefile.failed
54797a
54797a
	output_step_epilog
9ca8c4
}
9ca8c4
9ca8c4
613e01
verify_source_directory()
613e01
{
54797a
	output_step_prolog ${mb_script} 'verify_source_directory'
54797a
d69441
	if [ _"$mb_source_dir" != _${mb_source_dir##* } ]; then
d69441
		error_msg "source directory path contains spaces, aborting."
d69441
		exit 1
d69441
	fi
d69441
d69441
	eval mb_source_dir=$(printf '%s' "$mb_source_dir")
d69441
613e01
	if [ -z "$mb_source_dir" ]; then
29a758
		if [ _$mb_require_source_dir = _yes ]; then
613e01
			error_msg "$mb_package: specifying an external source directory is required."
613e01
			error_msg "you can set the source directory either via --source-dir=<path>,"
613e01
			error_msg "or by setting the SOURCE_DIR variable."
0d2779
			exit 1
613e01
		fi
613e01
	fi
54797a
54797a
	output_step_epilog
613e01
}
613e01
613e01
c7b6f6
verify_source_info()
c7b6f6
{
c7b6f6
	output_step_prolog ${mb_script} 'verify_source_info'
c7b6f6
c7b6f6
	if [ "${mb_source_dir_set:-}" = yes ]; then
c7b6f6
		if [ -n "$mb_rawball" ] || [ -n "$mb_modball" ] || [ -n "$mb_srcball" ]; then
c7b6f6
			error_msg "$mb_package: conflicting arguments: --rawball/--modball/--srcball arguments"
c7b6f6
			error_msg "may not be used together with an explicit source-dir argument or variable."
c7b6f6
			exit 1
c7b6f6
		fi
c7b6f6
	fi
c7b6f6
c7b6f6
	if [ -n "$mb_srcball" ]; then
c7b6f6
		eval mb_srcball=$(printf '%s' "$mb_srcball")
c7b6f6
c7b6f6
		if [ -n "$mb_rawball" ] || [ -n "$mb_modball" ]; then
c7b6f6
			error_msg "$mb_package: conflicting arguments: --rawball and/or --modball arguments"
c7b6f6
			error_msg "may not be used together with an explicitly --srcball argument."
c7b6f6
			exit 1
c7b6f6
		fi
c7b6f6
c7b6f6
		if [ -z "$mb_srcball_sha256" ]; then
c7b6f6
			error_msg "$mb_package: --srcball-sha256 must be provided"
c7b6f6
			error_msg "in conjunction with --srcball."
c7b6f6
			exit 1
c7b6f6
		fi
c7b6f6
c7b6f6
		mb_srcball_sha256_test=$(sha256sum "$mb_srcball")
c7b6f6
		mb_srcball_sha256_test="${mb_srcball_sha256_test%% *}"
c7b6f6
c7b6f6
		if [ "$mb_srcball_sha256_test" != "$mb_srcball_sha256" ]; then
c7b6f6
			error_msg "$mb_package: sha256 signature of srcball $mb_srcball does not match!"
c7b6f6
			exit 1
c7b6f6
		fi
c7b6f6
c7b6f6
		mb_srcball_topdir=$(xz -c -d "$mb_srcball" | pax | sed -n '1,1p')
c7b6f6
		mb_source_dir="./srctree/$mb_package/${mb_srcball_topdir%/}"
c7b6f6
c7b6f6
		mb_srcball_dirname=$(cd -- "${mb_srcball%/*}" ; pwd -P)
c7b6f6
		mb_srcball_basename=${mb_srcball##*/}
c7b6f6
		mb_srcball="$mb_srcball_dirname/$mb_srcball_basename"
c7b6f6
c7b6f6
		mkdir -p "./srctree/$mb_package"
c7b6f6
		mb_dummy=$(cd -- "./srctree/$mb_package"; xz -c -d "$mb_srcball" | pax -r)
c7b6f6
		mb_source_dir=$(cd -- $mb_source_dir; pwd -P)
c7b6f6
	fi
c7b6f6
c7b6f6
	if [ -z "$mb_rawball" ] && [ -n "$mb_modball" ]; then
c7b6f6
		error_msg "$mb_package: conflicting arguments: --modball argument may only be used"
c7b6f6
		error_msg "together with an explicit --rawball argument."
c7b6f6
		exit 1
c7b6f6
	fi
c7b6f6
c7b6f6
	if [ -n "$mb_modball" ]; then
c7b6f6
		eval mb_modball=$(printf '%s' "$mb_modball")
c7b6f6
c7b6f6
		if [ -z "$mb_modball_sha256" ]; then
c7b6f6
			error_msg "$mb_package: --modball-sha256 must be provided"
c7b6f6
			error_msg "in conjunction with --modball."
c7b6f6
			exit 1
c7b6f6
		fi
c7b6f6
c7b6f6
		mb_modball_sha256_test=$(sha256sum "$mb_modball")
c7b6f6
		mb_modball_sha256_test="${mb_modball_sha256_test%% *}"
c7b6f6
c7b6f6
		if [ "$mb_modball_sha256_test" != "$mb_modball_sha256" ]; then
c7b6f6
			error_msg "$mb_package: sha256 signature of modball $mb_modball does not match!"
c7b6f6
			exit 1
c7b6f6
		fi
c7b6f6
	fi
c7b6f6
c7b6f6
	if [ -n "$mb_rawball" ]; then
c7b6f6
		eval mb_rawball=$(printf '%s' "$mb_rawball")
c7b6f6
c7b6f6
		if [ -z "$mb_rawball_sha256" ]; then
c7b6f6
			error_msg "$mb_package: --rawball-sha256 must be provided."
c7b6f6
			error_msg "in conjunction with --rawball."
c7b6f6
			exit 1
c7b6f6
		fi
c7b6f6
c7b6f6
		mb_rawball_sha256_test=$(sha256sum "$mb_rawball")
c7b6f6
		mb_rawball_sha256_test="${mb_rawball_sha256_test%% *}"
c7b6f6
c7b6f6
		if [ "$mb_rawball_sha256_test" != "$mb_rawball_sha256" ]; then
c7b6f6
			error_msg "$mb_package: sha256 signature of rawball $mb_rawball does not match!"
c7b6f6
			exit 1
c7b6f6
		fi
c7b6f6
c7b6f6
		mb_rawball_topdir=$(xz -c -d "$mb_rawball" | pax | sed -n '1,1p')
c7b6f6
		mb_source_dir="./srctree/$mb_package/${mb_rawball_topdir%/}"
c7b6f6
c7b6f6
		mb_rawball_dirname=$(cd -- "${mb_rawball%/*}" ; pwd -P)
c7b6f6
		mb_rawball_basename=${mb_rawball##*/}
c7b6f6
		mb_rawball="$mb_rawball_dirname/$mb_rawball_basename"
c7b6f6
c7b6f6
		mkdir -p "./srctree/$mb_package"
c7b6f6
		mb_dummy=$(cd -- "./srctree/$mb_package"; xz -c -d "$mb_rawball" | pax -r)
c7b6f6
		mb_source_dir=$(cd -- $mb_source_dir; pwd -P)
c7b6f6
	fi
c7b6f6
c7b6f6
	if [ -n "$mb_modball" ]; then
c7b6f6
		mb_modball_dirname=$(cd -- "${mb_modball%/*}" ; pwd -P)
c7b6f6
		mb_modball_basename=${mb_modball##*/}
c7b6f6
		mb_modball="$mb_modball_dirname/$mb_modball_basename"
c7b6f6
c7b6f6
		mb_modball_topdir="./modtree/$mb_package/$mb_modball_sha256"
c7b6f6
		mkdir -p "$mb_modball_topdir"
c7b6f6
		mb_modball_topdir=$(cd -- $mb_modball_topdir; pwd -P)
c7b6f6
		mb_dummy=$(cd -- "$mb_modball_topdir"; xz -c -d "$mb_modball" | pax -r)
c7b6f6
c7b6f6
		if [ -d "$mb_modball_topdir/overlay" ]; then
c7b6f6
			mb_dummy=$(cd -- "$mb_modball_topdir/overlay"; \
c7b6f6
				cp -p -P -R . "$mb_source_dir")
c7b6f6
		fi
c7b6f6
c7b6f6
		if [ -d "$mb_modball_topdir/patches" ]; then
c7b6f6
			mb_dummy=$(cd -- "$mb_source_dir";                        \
c7b6f6
				for p in $mb_modball_topdir/patches/*.patch; do  \
c7b6f6
					patch -p1 < $p;                         \
c7b6f6
				done);
c7b6f6
		fi
c7b6f6
	fi
c7b6f6
c7b6f6
	output_step_epilog
c7b6f6
}
c7b6f6
c7b6f6
9ca8c4
common_defaults()
9ca8c4
{
54797a
	# step prolog
54797a
	output_step_prolog ${mb_script} 'common_defaults'
54797a
c0cca9
	# project-specific config definitions
c0cca9
	if [ _$mb_use_custom_cfgdefs = _yes ]; then
c0cca9
		cat $sfrt_cfgdefs_in > cfgdefs.mk
c0cca9
	else
c0cca9
		printf '%s %s\n\n' \
c0cca9
				'# this project does not include' \
c0cca9
				'a custom config step.'           \
c0cca9
			> cfgdefs.mk
c0cca9
		cat $sfrt_cfgdefs_in >> cfgdefs.mk
c0cca9
c0cca9
		if [ -f $mb_project_dir/project/cfgdefs.in ]; then
c0cca9
			cat $mb_project_dir/project/cfgdefs.in >> cfgdefs.mk
c0cca9
		fi
c0cca9
	fi
c0cca9
c0cca9
	# user build-time overrides
c0cca9
	touch usrdefs.mk
c0cca9
613e01
	# git
613e01
	if [ -n "$mb_source_dir" ]; then
613e01
		if [ -d "$mb_source_dir/.git" ]; then
8ad14b
			mb_git_reference_index="\$(SOURCE_DIR)/.git/index"
613e01
		fi
613e01
	elif [ -d "$mb_project_dir/.git" ]; then
8ad14b
		mb_git_reference_index="\$(PROJECT_DIR)/.git/index"
613e01
	fi
613e01
be9551
	# project
bb6565
	[ -n "$mb_nickname" ] 		|| mb_nickname=$mb_package
bb6565
	[ -n "$mb_source_dir" ] 	|| mb_source_dir=$mb_project_dir
bb6565
	[ -n "$mb_avoid_version" ] 	|| mb_avoid_version='no'
be9551
bb8747
	# pkgconfig
bb6565
	[ -n "$mb_pkgname" ]		|| mb_pkgname="$mb_default_pkgname"
bb6565
	[ -n "$mb_pkgdesc" ]		|| mb_pkgdesc="$mb_default_pkgdesc"
bb6565
	[ -n "$mb_pkgusrc" ]		|| mb_pkgusrc="$mb_default_pkgusrc"
bb6565
	[ -n "$mb_pkgrepo" ]		|| mb_pkgrepo="$mb_default_pkgrepo"
bb6565
	[ -n "$mb_pkgpsrc" ]		|| mb_pkgpsrc="$mb_default_pkgpsrc"
bb6565
	[ -n "$mb_pkgdurl" ]		|| mb_pkgdurl="$mb_default_pkgdurl"
6ba4be
	[ -n "$mb_pkgbugs" ]		|| mb_pkgbugs="$mb_default_pkgbugs"
6ba4be
	[ -n "$mb_pkghome" ]		|| mb_pkghome="$mb_default_pkghome"
bb6565
	[ -n "$mb_pkgdefs" ]		|| mb_pkgdefs="$mb_default_pkgdefs"
bb6565
	[ -n "$mb_pkglibs" ]		|| mb_pkglibs="$mb_default_pkglibs"
bb8747
c7b6f6
	# srcinfo
c7b6f6
	[ -n "$mb_rawball" ]		|| mb_rawball="$mb_default_rawball"
c7b6f6
	[ -n "$mb_rawball_url" ]	|| mb_rawball_url="$mb_default_rawball_url"
c7b6f6
	[ -n "$mb_rawball_sha256" ]	|| mb_rawball_sha256="$mb_default_rawball_sha256"
c7b6f6
	[ -n "$mb_modball" ]		|| mb_modball="$mb_default_modball"
c7b6f6
	[ -n "$mb_modball_url" ]	|| mb_modball_url="$mb_default_modball_url"
c7b6f6
	[ -n "$mb_modball_sha256" ]	|| mb_modball_sha256="$mb_default_modball_sha256"
c7b6f6
	[ -n "$mb_srcball" ]		|| mb_srcball="$mb_default_srcball"
c7b6f6
	[ -n "$mb_srcball_url" ]	|| mb_srcball_url="$mb_default_srcball_url"
c7b6f6
	[ -n "$mb_srcball_sha256" ]	|| mb_srcball_sha256="$mb_default_srcball_sha256"
c7b6f6
9ca8c4
	# dirs
bb6565
	[ -n "$mb_prefix" ] 		|| [ -n "$mb_prefix_set" ] \
bb6565
					|| mb_prefix='/usr/local'
bb6565
bb6565
	[ -n "$mb_exec_prefix" ] 	|| [ -n "$mb_exec_prefix_set" ]	\
bb6565
					|| mb_exec_prefix=$mb_prefix
bb6565
bb6565
	[ -n "$mb_bindir" ] 		|| [ -n "$mb_bindir_set" ] \
bb6565
					|| [ -n "$mb_bindir_basename" ] \
bb6565
					|| mb_bindir=$mb_exec_prefix/bin
bb6565
bb6565
	[ -n "$mb_bindir" ] 		|| [ -n "$mb_bindir_set" ] \
bb6565
					|| mb_bindir=$mb_exec_prefix/$mb_bindir_basename
bb6565
bb6565
	[ -n "$mb_sbindir" ] 		|| mb_sbindir=$mb_exec_prefix/sbin
bb6565
	[ -n "$mb_libdir" ] 		|| mb_libdir=$mb_exec_prefix/lib
bb6565
	[ -n "$mb_includedir" ]		|| mb_includedir=$mb_prefix/include
bb6565
	[ -n "$mb_oldincludedir" ]	|| mb_oldincludedir=$mb_prefix/include
bb6565
	[ -n "$mb_datarootdir" ] 	|| mb_datarootdir=$mb_prefix/share
bb6565
	[ -n "$mb_mandir" ] 		|| mb_mandir=$mb_datarootdir/man
6d8fd9
	[ -n "$mb_docdir" ] 		|| mb_docdir=$mb_datarootdir/doc/'$(PACKAGE)'
bb6565
	[ -n "$mb_libexecdir" ]		|| mb_libexecdir=$mb_exec_prefix/libexec
bb6565
bb6565
	[ -n "$mb_sysconfdir" ] 	|| mb_sysconfdir=$mb_exec_prefix/etc
bb6565
	[ -n "$mb_sharedstatedir" ] 	|| mb_sharedstatedir=$mb_prefix/com
bb6565
	[ -n "$mb_localstatedir" ] 	|| mb_localstatedir=$mb_prefix/var
bb6565
	[ -n "$mb_runstatedir" ] 	|| mb_runstatedir=$mb_localstatedir/run
bb6565
	[ -n "$mb_datarootdir" ] 	|| mb_datarootdir=$mb_prefix/share
bb6565
	[ -n "$mb_datadir" ] 		|| mb_datadir=$mb_datarootdir
bb6565
	[ -n "$mb_infodir" ] 		|| mb_infodir=$mb_datarootdir/info
bb6565
	[ -n "$mb_localedir" ] 		|| mb_localedir=$mb_datarootdir/locale
bb6565
	[ -n "$mb_htmldir" ] 		|| mb_htmldir=$mb_docdir
bb6565
	[ -n "$mb_dvidir" ] 		|| mb_dvidir=$mb_docdir
bb6565
	[ -n "$mb_pdfdir" ] 		|| mb_pdfdir=$mb_docdir
bb6565
	[ -n "$mb_psdir" ] 		|| mb_psdir=$mb_docdir
aacf07
9ca8c4
	# switches
bb6565
	[ -n "$mb_cflags_debug" ]	|| mb_cflags_debug=$mb_default_cflags_debug
bb6565
	[ -n "$mb_cflags_common" ]	|| mb_cflags_common=$mb_default_cflags_common
bb6565
	[ -n "$mb_cflags_cmdline" ]	|| mb_cflags_cmdline=$mb_default_cflags_cmdline
bb6565
	[ -n "$mb_cflags_config" ]	|| mb_cflags_config=$mb_default_cflags_config
bb6565
	[ -n "$mb_cflags_sysroot" ]	|| mb_cflags_sysroot=$mb_default_cflags_sysroot
bb6565
	[ -n "$mb_cflags_os" ]		|| mb_cflags_os=$mb_default_cflags_os
bb6565
	[ -n "$mb_cflags_site" ]	|| mb_cflags_site=$mb_default_cflags_site
bb6565
	[ -n "$mb_cflags_path" ]	|| mb_cflags_path=$mb_default_cflags_path
bb6565
	[ -n "$mb_cflags_strict" ]	|| mb_cflags_strict=$mb_default_cflags_strict
bb6565
	[ -n "$mb_cflags_util" ]	|| mb_cflags_util=$mb_default_cflags_util
bb6565
	[ -n "$mb_cflags_last" ]	|| mb_cflags_last=$mb_default_cflags_last
bb6565
	[ -n "$mb_cflags_once" ]	|| mb_cflags_once=$mb_default_cflags_once
bb6565
bb6565
	[ -n "$mb_ldflags_debug" ]	|| mb_ldflags_debug=$mb_default_ldflags_debug
bb6565
	[ -n "$mb_ldflags_common" ]	|| mb_ldflags_common=$mb_default_ldflags_common
bb6565
	[ -n "$mb_ldflags_cmdline" ]	|| mb_ldflags_cmdline=$mb_default_ldflags_cmdline
bb6565
	[ -n "$mb_ldflags_config" ]	|| mb_ldflags_config=$mb_default_ldflags_config
bb6565
	[ -n "$mb_ldflags_sysroot" ]	|| mb_ldflags_sysroot=$mb_default_ldflags_sysroot
bb6565
	[ -n "$mb_ldflags_path" ]	|| mb_ldflags_path=$mb_default_ldflags_path
bb6565
	[ -n "$mb_ldflags_strict" ]	|| mb_ldflags_strict=$mb_default_ldflags_strict
bb6565
	[ -n "$mb_ldflags_util" ]	|| mb_ldflags_util=$mb_default_ldflags_util
bb6565
	[ -n "$mb_ldflags_last" ]	|| mb_ldflags_last=$mb_default_ldflags_last
bb6565
	[ -n "$mb_ldflags_once" ]	|| mb_ldflags_once=$mb_default_ldflags_once
9ca8c4
12b021
	# native switches
bb6565
	[ -n "$mb_native_cflags" ]	|| mb_native_cflags=$mb_default_native_cflags
bb6565
	[ -n "$mb_native_ldflags" ]	|| mb_native_ldflags=$mb_default_native_ldflags
12b021
ffb3a0
	# config
bb6565
	[ -n "$mb_all_static" ]		|| mb_all_static='no'
bb6565
	[ -n "$mb_all_shared" ]		|| mb_all_shared='no'
bb6565
	[ -n "$mb_disable_frontend" ]	|| mb_disable_frontend='no'
bb6565
	[ -n "$mb_disable_static" ]	|| mb_disable_static='no'
bb6565
	[ -n "$mb_disable_shared" ]	|| mb_disable_shared='no'
ffb3a0
9ca8c4
	# host/target
bb6565
	[ -n "$mb_host" ] 		|| mb_host=$mb_target
bb6565
	[ -n "$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
d561f3
			mb_ldflags_sysroot="--sysroot=$mb_sysroot"
9ca8c4
		fi
9ca8c4
	fi
9ca8c4
9ca8c4
	# debug
29a758
	if [ _$mb_debug = _yes ]; then
9ca8c4
		if [ -z "$mb_cflags_debug" ]; then
9ca8c4
			mb_cflags_debug='-g3 -O0'
9ca8c4
		fi
9ca8c4
	fi
bdbc6b
ebc6d4
	# make
ebc6d4
	if [ -z "$mb_make" ]; then
ebc6d4
		mb_make='make'
ebc6d4
	fi
ebc6d4
b4b46d
	if [ -z "$mb_makemode" ]; then
b4b46d
		mb_makemode='posix'
0df148
0df148
		printf '%s\n%s\n%s\n\n%s\n\n'        \
0df148
				'ifeq (a,b)'          \
0df148
				'VAR = val'            \
0df148
				'endif'                 \
0df148
				'all:'                   \
0df148
			| ${mb_make} -s -f - 2>/dev/null  \
0df148
		&& mb_makemode='modern'
0df148
b4b46d
	fi
b4b46d
7e32ce
	# shell
7e32ce
	if [ -z "$mb_shell" ]; then
7e32ce
		mb_shell='/bin/sh'
7e32ce
	fi
7e32ce
bdbc6b
	# inherited cflags & ldflags
bdbc6b
	mb_cflags_cmdline="$mb_cflags_cmdline $mb_cflags"
bdbc6b
	mb_ldflags_cmdline="$mb_ldflags_cmdline $mb_ldflags"
54797a
5018e1
	# add the prefix's library directory to the linker library path
5018e1
	mb_ldflags_last="$mb_ldflags_last -L$mb_libdir"
5018e1
54797a
	# step epilog
54797a
	output_step_epilog
9ca8c4
}
9ca8c4
9ca8c4
b89c8d
config_flags()
b89c8d
{
54797a
	# step prolog
54797a
	output_step_prolog ${mb_script} 'config_flags'
54797a
b89c8d
	mb_ldflags_tmp=" $mb_ldflags "
14aaab
	mb_ldflags_libs=$(printf '%s' "$mb_ldflags_tmp" | sed 's/ -static / /g')
b89c8d
b89c8d
	if [ "$mb_ldflags_tmp" != "$mb_ldflags_libs" ]; then
b89c8d
		mb_ldflags="$mb_ldflags_libs"
b89c8d
		mb_ldflags_util="$mb_ldflags_util -static"
b89c8d
	fi
1e6e10
1e6e10
	# ccstrict
29a758
	if [ _$mb_ccstrict = _yes ]; then
1e6e10
		mb_cflags_strict='-Wall -Werror -Wextra -Wundef'
1e6e10
	fi
1e6e10
1e6e10
	# ldstrict
29a758
	if [ _$mb_ldstrict = _yes ]; then
1e6e10
		mb_ldflags_strict='-Wl,--no-undefined'
1e6e10
	fi
54797a
54797a
	# step epilog
54797a
	output_step_epilog
b89c8d
}
b89c8d
b89c8d
db7312
config_opts()
db7312
{
db7312
	if [ "$mb_avoid_version" = 'yes' ]; then
db7312
		mb_version_opt='none'
db7312
	else
db7312
		mb_version_opt='used'
db7312
	fi
36fbcc
36fbcc
	if [ "$mb_custom_install_headers" = 'yes' ]; then
36fbcc
		mb_install_headers_opt='custom'
36fbcc
	else
36fbcc
		mb_install_headers_opt='default'
36fbcc
	fi
36fbcc
36fbcc
	if [ "$mb_disable_static" = 'yes' ]; then
36fbcc
		mb_static_library_opt='disabled'
36fbcc
	else
36fbcc
		mb_static_library_opt='enabled'
36fbcc
	fi
36fbcc
36fbcc
	if [ "$mb_disable_shared" = 'yes' ]; then
36fbcc
		mb_shared_library_opt='disabled'
36fbcc
	else
36fbcc
		mb_shared_library_opt='enabled'
36fbcc
	fi
36fbcc
36fbcc
	if [ "$mb_disable_frontend" = 'yes' ]; then
36fbcc
		mb_app_frontend_opt='disabled'
36fbcc
	else
36fbcc
		mb_app_frontend_opt='enabled'
36fbcc
	fi
36fbcc
36fbcc
	if [ "$mb_all_static" = 'yes' ]; then
36fbcc
		mb_app_linking_opt='all_static'
36fbcc
36fbcc
	elif [ "$mb_all_shared" = 'yes' ]; then
36fbcc
		mb_app_linking_opt='all_shared'
36fbcc
36fbcc
	else
36fbcc
		mb_app_linking_opt='default'
36fbcc
	fi
db7312
}
db7312
9ca8c4
config_copy()
9ca8c4
{
54797a
	output_step_prolog ${mb_script} 'config_copy'
54797a
ed566e
	mb_var_defs=
ed566e
	mb_sed_substs=
ed566e
db7312
	mb_vars=$(cut -d'=' -f1 "$sfrt_config_vars" "$sfrt_opt_vars" \
ed566e
		| grep -v '^#');
ed566e
ed566e
	for __var in $(printf '%s' "$mb_vars"); do
ed566e
		mb_sed_subst=$(printf '%s %s%s%s'  \
ed566e
				'-e' "'s^@$__var@"  \
ed566e
				"^___${__var}___"    \
ed566e
				"^g'")
ed566e
ed566e
		mb_sed_substs="$mb_sed_substs $mb_sed_subst"
ed566e
ed566e
		mb_var_def=$(printf '%s%s="${%s}"' "-D" "___${__var}___" "mb_${__var}")
ed566e
		eval mb_var_defs='"$mb_var_defs "$mb_var_def'
ed566e
	done
ed566e
ed566e
	eval sed $mb_sed_substs $mb_project_dir/Makefile.in \
ed566e
			| eval m4 $mb_var_defs -             \
ed566e
			| sed -e 's/[[:blank:]]*$//g'         \
ed566e
		> $mb_pwd/Makefile.tmp
54797a
54797a
	output_step_epilog
f7f887
}
f83f76
4a289f
f7f887
config_ccenv()
f7f887
{
f7f887
	mkdir -p ./ccenv
f7f887
	touch ./ccenv/host.mk
f7f887
	touch ./ccenv/native.mk
d2a366
54797a
	output_section_break
f7f887
	ccenv_set_host_variables
54797a
54797a
	output_section_break
f7f887
	ccenv_set_native_variables
853512
54797a
	output_section_break
853512
	config_copy
f7f887
}
d2a366
7ed30f
config_custom_cfgdefs()
7ed30f
{
7ed30f
	. $mb_project_dir/project/config/cfgdefs.sh
7ed30f
}
7ed30f
d2a366
config_custom()
d2a366
{
29a758
	if [ _$mb_use_custom_cfgdefs = _yes ]; then
54797a
		output_section_break
54797a
		output_script_status ${mb_script} \
a8f188
			'invoking project-specific cfgdefs.sh'
54797a
7ed30f
		eval config_custom_cfgdefs "$mb_custom_cfgdefs_args"
54797a
54797a
		output_section_break
d2a366
		config_copy
d2a366
	fi
f83f76
29a758
	if [ _$mb_use_custom_usrdefs = _yes ]; then
54797a
		output_section_break
54797a
		output_script_status ${mb_scirpt} \
a8f188
			'invoking project-specific usrdefs.sh'
54797a
d2a366
		. $mb_project_dir/project/usrdefs.sh
54797a
		output_section_break
d2a366
	fi
d2a366
}
d2a366
d2a366
d2a366
config_cfghost()
d2a366
{
54797a
	output_step_prolog ${mb_script} 'config_cfghost'
54797a
f9d92c
	if [ -z "$mb_cfghost" ]; then
f9d92c
		mb_cfghost=$mb_cchost
f9d92c
	fi
f9d92c
f9d92c
	sed		-e 's^@cchost@^'"$mb_cchost"'^g'     \
f9d92c
			-e 's^@cfghost@^'"$mb_cfghost"'^g'   \
0d2779
		$mb_pwd/Makefile.tmp > $mb_pwd/Makefile.host
f83f76
0d2779
	rm  $mb_pwd/Makefile.tmp
0d2779
	mv  $mb_pwd/Makefile.host $mb_pwd/Makefile
54797a
54797a
	output_step_epilog
9ca8c4
}
9ca8c4
9ca8c4
9ca8c4
config_host()
9ca8c4
{
54797a
	output_step_prolog ${mb_script} 'config_host'
54797a
ebc6d4
	${mb_make} -s host.tag       \
54797a
		&& output_step_epilog \
54797a
		&& 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
dd257b
config_fini()
dd257b
{
e71997
	# rename Makefile as needed
e71997
	if [ -n "$mb_makefile" ]; then
e71997
		mv $mb_pwd/Makefile $mb_pwd/$mb_makefile
e71997
	fi
e71997
dd257b
	# project-specific post-configuration steps
dd257b
	if [ _$mb_use_custom_cfgfini = _yes ]; then
dd257b
		. "$mb_project_dir/project/config/cfgfini.sh"
dd257b
	fi
dd257b
}
dd257b
dd257b
9ca8c4
config_status()
9ca8c4
{
54797a
	output_script_status ${mb_script} \
54797a
		'configuration completed successfully.'
54797a
	printf '\n'
9ca8c4
}
9ca8c4
c0614b
c0614b
config_failure()
c0614b
{
7a7f40
	if [ _$mb_success = _yes ]; then
7a7f40
		return 0
7a7f40
	fi
7a7f40
a8f188
	printf 'configure info: exiting due to an error.\n' >&3
a8f188
c0614b
	exit 2
c0614b
}
c0614b
c0614b
c0614b
config_success()
c0614b
{
c0614b
	trap '' EXIT
7a7f40
	mb_success=yes
c0614b
	exit 0
c0614b
}
c0614b
c0614b
9ca8c4
# one: init
88c6a4
mb_args_defs=
88c6a4
mb_args_text=
88c6a4
mb_args_idx=0
88c6a4
88c6a4
init_log
a8f188
a8f188
for arg ; do
88c6a4
	mb_args_idx=$((mb_args_idx+1))
88c6a4
88c6a4
	mb_arg_def=$(printf '%s%s="${%s}"' "-D_" "${mb_args_idx}" "${mb_args_idx}")
88c6a4
	eval mb_args_defs='"$mb_args_defs "$mb_arg_def'
88c6a4
88c6a4
	mb_args_text="$mb_args_text '_$((mb_args_idx))'"
a8f188
done
a8f188
88c6a4
printf "$mb_args_text\n\n" | eval m4 $mb_args_defs - >&3
88c6a4
88c6a4
if [ $mb_args_idx -gt 1 ]; then
88c6a4
	printf '$ %s' "$mb_script" >&3
88c6a4
88c6a4
	mb_args_idx=0
88c6a4
	mb_args_text=
88c6a4
88c6a4
	for arg; do
88c6a4
		mb_args_idx=$((mb_args_idx+1))
88c6a4
		mb_args_text="$mb_args_text"$(printf ' \\\\\n\t%s_%d%s' "'" "$mb_args_idx" "'")
88c6a4
	done
88c6a4
88c6a4
	printf "$mb_args_text\n\n" | eval m4 $mb_args_defs - >&3
88c6a4
fi
88c6a4
9ca8c4
init_vars
9ca8c4
verify_build_directory
9ca8c4
9ca8c4
9ca8c4
# two: args
9ca8c4
for arg ; do
9ca8c4
	case "$arg" in
f7f887
		--help)
f7f887
			usage
f7f887
			;;
f7f887
		--help=ccenv)
f7f887
			ccenv_usage
f7f887
			;;
f7f887
f7f887
		# ccenv
f7f887
		--cross-compile=*)
f7f887
			mb_cross_compile=${arg#*=}
f7f887
			;;
f7f887
		--compiler=*)
f7f887
			mb_compiler=${arg#*=}
f7f887
			;;
f7f887
		--toolchain=*)
f7f887
			mb_toolchain=${arg#*=}
f7f887
			;;
f7f887
		--zealous)
f7f887
			mb_agnostic=yes
f7f887
			mb_zealous=
f7f887
			;;
f7f887
		--zealous=*)
f7f887
			mb_zealous=${arg#*=}
f7f887
			;;
f7f887
		--ccenv=*)
f7f887
			mb_ccenv=${arg#*=}
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=*)
290087
			mb_bindir_set=yes
9ca8c4
			mb_bindir=${arg#*=}
9ca8c4
			;;
67be49
		--sbindir=*)
67be49
			mb_sbindir=${arg#*=}
67be49
			;;
9ca8c4
		--libdir=*)
9ca8c4
			mb_libdir=${arg#*=}
9ca8c4
			;;
9ca8c4
		--includedir=*)
9ca8c4
			mb_includedir=${arg#*=}
9ca8c4
			;;
aacf07
		--oldincludedir=*)
aacf07
			mb_oldincludedir=${arg#*=}
aacf07
			;;
9ca8c4
		--mandir=*)
9ca8c4
			mb_mandir=${arg#*=}
9ca8c4
			;;
9ca8c4
		--libexecdir=*)
9ca8c4
			mb_libexecdir=${arg#*=}
9ca8c4
			;;
9ca8c4
9ca8c4
aacf07
		--sysconfdir=*)
aacf07
			mb_sysconfdir=${arg#*=}
aacf07
			;;
aacf07
		--sharedstatedir=*)
aacf07
			mb_sharedstatedir=${arg#*=}
aacf07
			;;
aacf07
		--localstatedir=*)
aacf07
			mb_localstatedir=${arg#*=}
aacf07
			;;
aacf07
		--runstatedir=*)
aacf07
			mb_runstatedir=${arg#*=}
aacf07
			;;
aacf07
		--datarootdir=*)
aacf07
			mb_datarootdir=${arg#*=}
aacf07
			;;
aacf07
		--datadir=*)
aacf07
			mb_datadir=${arg#*=}
aacf07
			;;
aacf07
		--infodir=*)
aacf07
			mb_infodir=${arg#*=}
aacf07
			;;
aacf07
		--localedir=*)
aacf07
			mb_localedir=${arg#*=}
aacf07
			;;
aacf07
		--htmldir=*)
aacf07
			mb_htmldir=${arg#*=}
aacf07
			;;
aacf07
		--dvidir=*)
aacf07
			mb_dvidir=${arg#*=}
aacf07
			;;
aacf07
		--pdfdir=*)
aacf07
			mb_pdfdir=${arg#*=}
aacf07
			;;
aacf07
		--psdir=*)
aacf07
			mb_psdir=${arg#*=}
aacf07
			;;
aacf07
ebc6d4
		#make
ebc6d4
		--make=*)
ebc6d4
			mb_make=${arg#*=}
ebc6d4
			;;
aacf07
b4b46d
		--makemode=*)
b4b46d
			mb_makemode=${arg#*=}
b4b46d
			;;
b4b46d
9ca8c4
		# build
9ca8c4
		--build=*)
9ca8c4
			mb_build=${arg#*=}
9ca8c4
			;;
9ca8c4
		--host=*)
9ca8c4
			mb_host=${arg#*=}
9ca8c4
			;;
f83f76
		--cchost=*)
f83f76
			mb_cchost=${arg#*=}
f83f76
			;;
f9d92c
		--cfghost=*)
f9d92c
			mb_cfghost=${arg#*=}
f9d92c
			;;
9ca8c4
		--target=*)
9ca8c4
			mb_target=${arg#*=}
9ca8c4
			;;
9ca8c4
		--arch=*)
9ca8c4
			mb_arch=${arg#*=}
9ca8c4
			;;
9ca8c4
		--sysroot=*)
9ca8c4
			mb_sysroot=${arg#*=}
9ca8c4
			;;
9ca8c4
		--shell=*)
9ca8c4
			mb_shell=${arg#*=}
9ca8c4
			;;
9ca8c4
		--debug)
29a758
			mb_debug=yes
9ca8c4
			;;
be9551
ffb3a0
		# config
ffb3a0
		--all-static)
29a758
			mb_all_static=yes
5f2aa4
			mb_all_shared=no
ffb3a0
			;;
ffb3a0
		--all-shared)
29a758
			mb_all_shared=yes
5f2aa4
			mb_all_static=no
ffb3a0
			;;
bf8bd3
		--disable-frontend)
29a758
			mb_disable_frontend=yes
bf8bd3
			;;
bf8bd3
		--disable-app)
29a758
			mb_disable_frontend=yes
bf8bd3
			;;
bf8bd3
		--enable-frontend)
bf8bd3
			mb_disable_frontend='no'
bf8bd3
			;;
bf8bd3
		--enable-app)
bf8bd3
			mb_disable_frontend='no'
bf8bd3
			;;
ffb3a0
		--disable-static)
29a758
			mb_disable_static=yes
ffb3a0
			;;
ffb3a0
		--disable-shared)
29a758
			mb_disable_shared=yes
ffb3a0
			;;
ffb3a0
		--enable-static)
ffb3a0
			mb_disable_static='no'
ffb3a0
			;;
ffb3a0
		--enable-shared)
ffb3a0
			mb_disable_shared='no'
ffb3a0
			;;
ffb3a0
1e6e10
		# convenience
1e6e10
		--strict)
29a758
			mb_ccstrict=yes
29a758
			mb_ldstrict=yes
1e6e10
			;;
1e6e10
		--ccstrict)
29a758
			mb_ccstrict=yes
1e6e10
			;;
1e6e10
		--ldstrict)
29a758
			mb_ldstrict=yes
1e6e10
			;;
1e6e10
be9551
		# project
be9551
		--nickname=*)
be9551
			mb_nickname=${arg#*=}
be9551
			;;
7e3001
		--program-prefix=*)
7e3001
			mb_program_prefix=${arg#*=}
7e3001
			;;
2c8d99
		--avoid-version)
29a758
			mb_avoid_version=yes
2c8d99
			;;
613e01
		--source-dir=*)
613e01
			mb_source_dir=${arg#*=}
c7b6f6
			mb_source_dir_set=yes
613e01
			;;
580a2a
		--srcdir=*)
580a2a
			mb_source_dir=${arg#*=}
c7b6f6
			mb_source_dir_set=yes
580a2a
			;;
be9551
bb8747
		# pkgconfig
bb8747
		--pkgname=*)
bb8747
			mb_pkgname=${arg#*=}
bb8747
			;;
bb8747
bb8747
		--pkgdesc=*)
bb8747
			mb_pkgdesc=${arg#*=}
bb8747
			;;
bb8747
bb8747
		--pkgusrc=*)
bb8747
			mb_pkgusrc=${arg#*=}
bb8747
			;;
bb8747
bb8747
		--pkgrepo=*)
bb8747
			mb_pkgrepo=${arg#*=}
bb8747
			;;
bb8747
bb8747
		--pkgpsrc=*)
bb8747
			mb_pkgpsrc=${arg#*=}
bb8747
			;;
bb8747
bb8747
		--pkgdurl=*)
bb8747
			mb_pkgdurl=${arg#*=}
bb8747
			;;
bb8747
6ba4be
		--pkgbugs=*)
6ba4be
			mb_pkgbugs=${arg#*=}
6ba4be
			;;
6ba4be
6ba4be
		--pkghome=*)
6ba4be
			mb_pkghome=${arg#*=}
6ba4be
			;;
6ba4be
bb8747
		--pkgdefs=*)
bb8747
			mb_pkgdefs=${arg#*=}
bb8747
			;;
bb8747
bb8747
		--pkglibs=*)
bb8747
			mb_pkglibs=${arg#*=}
bb8747
			;;
bb8747
c7b6f6
		# srcinfo
66aea9
		--srcinfo=*)
66aea9
			mb_srcinfo=${arg#*=}
66aea9
			;;
66aea9
66aea9
		--srcsite=*)
66aea9
			mb_srcsite=${arg#*=}
66aea9
			;;
66aea9
66aea9
		--pgprkey=*)
66aea9
			mb_pgprkey=${arg#*=}
66aea9
			;;
66aea9
66aea9
		--pgpskey=*)
66aea9
			mb_pgpskey=${arg#*=}
66aea9
			;;
66aea9
c7b6f6
		--rawball=*)
c7b6f6
			mb_rawball=${arg#*=}
c7b6f6
			;;
c7b6f6
c7b6f6
		--rawball-url=*)
c7b6f6
			mb_rawball_url=${arg#*=}
c7b6f6
			;;
c7b6f6
c7b6f6
		--rawball-sha256=*)
c7b6f6
			mb_rawball_sha256=${arg#*=}
c7b6f6
			;;
c7b6f6
c7b6f6
		--modball=*)
c7b6f6
			mb_modball=${arg#*=}
c7b6f6
			;;
c7b6f6
c7b6f6
		--modball-url=*)
c7b6f6
			mb_modball_url=${arg#*=}
c7b6f6
			;;
c7b6f6
c7b6f6
		--modball-sha256=*)
c7b6f6
			mb_modball_sha256=${arg#*=}
c7b6f6
			;;
c7b6f6
c7b6f6
		--srcball=*)
c7b6f6
			mb_srcball=${arg#*=}
c7b6f6
			;;
c7b6f6
c7b6f6
		--srcball-url=*)
c7b6f6
			mb_srcball_url=${arg#*=}
c7b6f6
			;;
c7b6f6
c7b6f6
		--srcball-sha256=*)
c7b6f6
			mb_srcball_sha256=${arg#*=}
c7b6f6
			;;
c7b6f6
25d614
		# compatibility
25d614
		--enable-dependency-tracking)
25d614
			;;
25d614
		--disable-dependency-tracking)
25d614
			;;
25d614
9ca8c4
		*)
29a758
			if [ _$mb_use_custom_cfgdefs = _yes ]; then
43dbe7
				mb_escaped_arg=\'$(printf '%s\n' "$arg" | sed -e "s/'/'\\\\''/g")\'
43dbe7
				mb_escaped_arg="$mb_custom_cfgdefs_space$mb_escaped_arg"
43dbe7
				mb_custom_cfgdefs_args="$mb_custom_cfgdefs_args$mb_escaped_arg"
43dbe7
				mb_custom_cfgdefs_space=' '
d2a366
			else
d2a366
				error_msg ${arg#}: "unsupported config argument."
d2a366
				exit 2
d2a366
			fi
9ca8c4
			;;
9ca8c4
	esac
8d201c
8d201c
	mb_safe_path_desc='source directory'
8d201c
	mb_safe_path_name="$mb_source_dir"
8d201c
	verify_safe_path
9ca8c4
done
9ca8c4
9ca8c4
9ca8c4
613e01
# three: validation
613e01
verify_source_directory
c7b6f6
verify_source_info
613e01
7e3001
if ! [ -z "$mb_program_prefix" ]; then
7e3001
	error_msg "--program-prefix is not yet fully support (must be null)."
7e3001
fi
7e3001
613e01
613e01
613e01
# four: defaults
9ca8c4
common_defaults
9ca8c4
9ca8c4
613e01
# five: config
b89c8d
config_flags
db7312
config_opts
9ca8c4
config_copy
f7f887
config_ccenv
d2a366
config_custom
d2a366
config_cfghost
9ca8c4
config_host
dd257b
config_fini
9ca8c4
config_status
9ca8c4
9ca8c4
9ca8c4
# all done
c0614b
config_success