Blame configure

944e2b
#!/bin/sh
944e2b
944e2b
# project-agnostic ./configure script, written by hand.
944e2b
# this file is covered by COPYING.SOFORT.
944e2b
944e2b
set -eu
944e2b
944e2b
trap config_failure 1 2 EXIT
944e2b
944e2b
# before we begin...
944e2b
mb_path="$PATH"
944e2b
mb_script="$0"
944e2b
mb_success=no
944e2b
944e2b
usage()
944e2b
{
944e2b
	cat "$mb_project_dir"/config.usage
944e2b
944e2b
	if [ _$mb_use_custom_cfgdefs = _yes ]; then
944e2b
		printf '\n\n%s%s\n' \
944e2b
			" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" \
944e2b
			"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
944e2b
944e2b
		printf '%s%s\n' \
944e2b
			"| Listed above are configure's common switches " \
944e2b
			"and environment variables.     |"
944e2b
944e2b
		printf '%s%s\n' \
944e2b
			"| Found below are project-specific variables " \
944e2b
			"and other customization options. |"
944e2b
944e2b
		printf '%s%s\n\n\n' \
944e2b
			" ___________________________________________" \
944e2b
			"__________________________________"
944e2b
944e2b
		cat "$mb_project_dir"/project/config/cfgdefs.usage
944e2b
	fi
944e2b
944e2b
	exit 0
944e2b
}
944e2b
944e2b
error_msg()
944e2b
{
944e2b
	printf '%s\n' "$@" >&2
944e2b
}
944e2b
944e2b
warning_msg()
944e2b
{
944e2b
	printf '%s\n' "$@" >&2
944e2b
}
944e2b
944e2b
output_step_prolog()
944e2b
{
944e2b
	mb_line_dots='.................................'
944e2b
	mb_line_dots="${mb_line_dots}.${mb_line_dots}"
944e2b
	mb_step_desc="${mb_package} : ${1##*/} : ${2}()  "
944e2b
	mb_step_dlen="$((${#mb_line_dots} - ${#mb_step_desc}))"
944e2b
944e2b
	printf "configure step: ${2}()\n" >&3
944e2b
	printf "%s%${mb_step_dlen}.${mb_step_dlen}s  " "${mb_step_desc}" "${mb_line_dots}"
944e2b
}
944e2b
944e2b
output_step_epilog()
944e2b
{
944e2b
	printf 'OK.\n'
944e2b
}
944e2b
944e2b
output_script_status()
944e2b
{
944e2b
	mb_step_name="${1##*/} : ${2}"
944e2b
	mb_step_desc="${mb_package} : ${mb_step_name}"
944e2b
944e2b
	printf "configure info: ${2}\n" >&3
944e2b
	printf "%s\n" "${mb_step_desc}"
944e2b
}
944e2b
944e2b
output_section_break()
944e2b
{
944e2b
	printf ' ..\n'
944e2b
}
944e2b
944e2b
verify_safe_path()
944e2b
{
944e2b
	case "$mb_safe_path_name" in
944e2b
		-*)
944e2b
			error_msg "$mb_safe_path_desc may not begin with a hyphen."
944e2b
			exit 2
944e2b
			;;
944e2b
944e2b
		*\ *)
944e2b
			error_msg "$mb_safe_path_desc may not contain spaces."
944e2b
			exit 2
944e2b
			;;
944e2b
	esac
944e2b
}
944e2b
944e2b
init_log()
944e2b
{
944e2b
	exec 3> config.log
944e2b
944e2b
	printf "This is config.log, generated by sofort's configure script.\n\n" >&3
944e2b
	printf '$ %s' "$mb_script" >&3
944e2b
}
944e2b
944e2b
init_vars()
944e2b
{
944e2b
	mb_project_dir=$(cd -- "${mb_script%/*}/" ; pwd -P)
944e2b
	mb_pwd=$(pwd -P)
944e2b
944e2b
	mb_safe_path_desc='project directory'
944e2b
	mb_safe_path_name="$mb_project_dir"
944e2b
	verify_safe_path
944e2b
944e2b
	mb_safe_path_desc='working directory'
944e2b
	mb_safe_path_name="$mb_pwd"
944e2b
	verify_safe_path
944e2b
944e2b
	mb_custom_cfgdefs_args=''
944e2b
	mb_custom_cfgdefs_space=''
944e2b
944e2b
	mb_srcinfo='$(PROJECT_DIR)/project/srcdist/srcinfo.in'
944e2b
	mb_srcsite='localhost'
944e2b
944e2b
	mb_pgprkey='!!VARIABLE_NOT_SET!!'
944e2b
	mb_pgpskey='!!VARIABLE_NOT_SET!!'
944e2b
944e2b
	sfrt_impl_dir=$mb_project_dir/sofort
944e2b
	sfrt_config_dir=$sfrt_impl_dir/config
944e2b
	sfrt_core_dir=$sfrt_impl_dir/core
944e2b
	sfrt_config_vars=$sfrt_config_dir/config.vars
944e2b
	sfrt_flag_vars=$sfrt_config_dir/flag.vars
c58391
	sfrt_opt_vars=$sfrt_config_dir/opt.vars
944e2b
	sfrt_cfgdefs_in=$sfrt_config_dir/cfgdefs.in
944e2b
944e2b
	mb_make_vars=$(< "$sfrt_config_vars" \
944e2b
		grep -v -e '^#' -e '^$' | tr '[:lower:]' '[:upper:]')
944e2b
944e2b
	mb_impl_vars=$(< "$sfrt_config_vars" \
944e2b
		grep -v -e '^#' -e '^$' | sed 's/^/mb_/g')
944e2b
944e2b
	mb_proj_vars=$(< "$sfrt_config_vars" \
944e2b
		grep -v -e '^#' -e '^$' | sed 's/^/mb_default_/g')
944e2b
944e2b
	mb_flag_vars=$(< "$sfrt_flag_vars" \
944e2b
		grep -v -e '^#' -e '^$')
944e2b
944e2b
	mb_vars="$mb_make_vars $mb_impl_vars $mb_proj_vars $mb_flag_vars"
944e2b
944e2b
	for mb_var in $(printf '%s' "$mb_vars") ; do
944e2b
		mb_expr=$mb_var='${'$mb_var':-}'
944e2b
		eval "$mb_expr"
944e2b
	done
944e2b
d03fdc
	# cfgtest
d03fdc
	. $mb_project_dir/sofort/cfgtest/cfgtest.sh
d03fdc
944e2b
	# ccenv
944e2b
	. $mb_project_dir/sofort/ccenv/ccenv.sh
944e2b
944e2b
	if ! [ -L ./ccenv ]; then
944e2b
		if [ -d ./ccenv ]; then
944e2b
			rm -f ./ccenv/host.mk
944e2b
			rm -f ./ccenv/native.mk
944e2b
			rmdir ./ccenv
944e2b
		fi
944e2b
	fi
944e2b
944e2b
	# config.project
944e2b
	if [ -z "$mb_config" ]; then
416862
		mb_config="$mb_project_dir/config.project"
416862
	fi
416862
416862
	. "$mb_config"
416862
5c2617
	# config.project make preferences
5c2617
	if [ -z "${MAKE}" ]; then
5c2617
		MAKE="$mb_make"
5c2617
	fi
5c2617
5c2617
	if [ -z "${MAKEMODE}" ]; then
5c2617
		MAKEMODE="$mb_makemode"
5c2617
	fi
5c2617
02bf70
02bf70
	if [ -z "$mb_makefile" ]; then
02bf70
		mb_makefile='Makefile'
02bf70
	fi
02bf70
727b3f
	# project-specific initialization
727b3f
	if [ _$mb_use_custom_cfginit = _yes ]; then
727b3f
		. "$mb_project_dir/project/config/cfginit.sh"
727b3f
	fi
727b3f
416862
	# package
416862
	if [ -z "$mb_package" ]; then
416862
		error_msg "$mb_script: incomplete information in $mb_config."
416862
		error_msg "$mb_script: \$mb_package not set."
416862
		exit 1
944e2b
	fi
944e2b
6097fd
	if [ -z "${NICKNAME}" ]; then
6097fd
		NICKNAME="$mb_nickname"
6097fd
	fi
6097fd
944e2b
	# srcinfo
944e2b
	if [ -n "$SOURCE_DIR" ]; then
944e2b
		mb_source_dir_set=yes
944e2b
	fi
944e2b
944e2b
	# step prolog
944e2b
	output_step_prolog ${mb_script} 'init_vars'
944e2b
944e2b
	# project
944e2b
	mb_nickname=$NICKNAME
944e2b
	mb_source_dir=$SOURCE_DIR
944e2b
944e2b
	# dirs
944e2b
	mb_prefix=$PREFIX
944e2b
	mb_exec_prefix=$EXEC_PREFIX
944e2b
	mb_bindir=$BINDIR
944e2b
	mb_sbindir=$SBINDIR
944e2b
	mb_libdir=$LIBDIR
944e2b
	mb_includedir=$INCLUDEDIR
944e2b
	mb_oldincludedir=$OLDINCLUDEDIR
944e2b
	mb_mandir=$MANDIR
944e2b
	mb_docdir=$DOCDIR
944e2b
	mb_libexecdir=$LIBEXECDIR
944e2b
944e2b
	mb_sysconfdir=$SYSCONFDIR
944e2b
	mb_sharedstatedir=$SHAREDSTATEDIR
944e2b
	mb_localstatedir=$LOCALSTATEDIR
944e2b
	mb_runstatedir=$RUNSTATEDIR
944e2b
	mb_datarootdir=$DATAROOTDIR
944e2b
	mb_datadir=$DATADIR
944e2b
	mb_infodir=$INFODIR
944e2b
	mb_localedir=$LOCALEDIR
944e2b
	mb_htmldir=$HTMLDIR
944e2b
	mb_dvidir=$DVIDIR
944e2b
	mb_pdfdir=$PDFDIR
944e2b
	mb_psdir=$PSDIR
944e2b
1b3d58
	# make
1b3d58
	mb_make=$MAKE
3e7080
	mb_makemode=$MAKEMODE
944e2b
944e2b
	# build
944e2b
	mb_build=$BUILD
944e2b
	mb_cchost=$CCHOST
944e2b
	mb_cfghost=$CFGHOST
944e2b
	mb_arch=$ARCH
944e2b
	mb_compiler=$COMPILER
944e2b
	mb_toolchain=$TOOLCHAIN
944e2b
	mb_sysroot=$SYSROOT
944e2b
	mb_cross_compile=$CROSS_COMPILE
944e2b
	mb_shell=$SHELL
944e2b
944e2b
	# switches
944e2b
	mb_cflags=$CFLAGS
944e2b
	mb_cflags_debug=$CFLAGS_DEBUG
944e2b
	mb_cflags_common=$CFLAGS_COMMON
944e2b
	mb_cflags_cmdline=$CFLAGS_CMDLINE
944e2b
	mb_cflags_config=$CFLAGS_CONFIG
944e2b
	mb_cflags_sysroot=$CFLAGS_SYSROOT
944e2b
	mb_cflags_os=$CFLAGS_OS
944e2b
	mb_cflags_site=$CFLAGS_SITE
944e2b
	mb_cflags_path=$CFLAGS_PATH
944e2b
	mb_cflags_strict=$CFLAGS_STRICT
944e2b
	mb_cflags_util=$CFLAGS_UTIL
944e2b
	mb_cflags_last=$CFLAGS_LAST
944e2b
	mb_cflags_once=$CFLAGS_ONCE
944e2b
944e2b
	mb_ldflags=$LDFLAGS
944e2b
	mb_ldflags_debug=$LDFLAGS_DEBUG
944e2b
	mb_ldflags_common=$LDFLAGS_COMMON
944e2b
	mb_ldflags_cmdline=$LDFLAGS_CMDLINE
944e2b
	mb_ldflags_config=$LDFLAGS_CONFIG
944e2b
	mb_ldflags_sysroot=$LDFLAGS_SYSROOT
944e2b
	mb_ldflags_path=$LDFLAGS_PATH
944e2b
	mb_ldflags_strict=$LDFLAGS_STRICT
944e2b
	mb_ldflags_util=$LDFLAGS_UTIL
944e2b
	mb_ldflags_last=$LDFLAGS_LAST
944e2b
	mb_ldflags_once=$LDFLAGS_ONCE
944e2b
944e2b
	mb_pe_subsystem=$PE_SUBSYSTEM
944e2b
	mb_pe_image_base=$PE_IMAGE_BASE
944e2b
944e2b
	# overrides
944e2b
	mb_user_cc=$CC
944e2b
	mb_user_cpp=$CPP
944e2b
	mb_user_cxx=$CXX
944e2b
944e2b
	mb_native_cc=$NATIVE_CC
944e2b
	mb_native_cpp=$NATIVE_CPP
944e2b
	mb_native_cxx=$NATIVE_CXX
944e2b
944e2b
	mb_native_host=$NATIVE_HOST
944e2b
	mb_native_cfghost=$NATIVE_CFGHOST
944e2b
	mb_native_cflags=$NATIVE_CFLAGS
944e2b
	mb_native_ldflags=$NATIVE_LDFLAGS
944e2b
944e2b
	mb_native_pe_subsystem=$NATIVE_PE_SUBSYSTEM
944e2b
	mb_native_pe_image_base=$NATIVE_PE_IMAGE_BASE
944e2b
944e2b
	# step epilog
944e2b
	output_step_epilog
944e2b
}
944e2b
944e2b
944e2b
verify_build_directory()
944e2b
{
944e2b
	output_step_prolog ${mb_script} 'verify_build_directory'
944e2b
944e2b
	if [ "$mb_project_dir" = "$mb_pwd" ]; then
944e2b
		if [ _$mb_require_out_of_tree = _yes ]; then
944e2b
			error_msg "$mb_package: out-of-tree builds are required."
944e2b
			error_msg "please invoke configure again from a clean build directory."
944e2b
			exit 1
944e2b
		else
944e2b
			mb_project_dir='.'
944e2b
		fi
944e2b
	fi
944e2b
0d8e2a
	if [ -f "$mb_pwd/Makefile.common" ]; then
0d8e2a
		error_msg
0d8e2a
		error_msg "$mb_package: the file-name Makefile.common is reserved for bootstrapping projects."
0d8e2a
		error_msg "$mb_package: please remove or rename the file manually and then re-run configure."
0d8e2a
		exit 1
0d8e2a
	fi
0d8e2a
02bf70
	rm -f Makefile Makefile.host Makefile.tmp Makefile.failed $mb_makefile
944e2b
944e2b
	output_step_epilog
944e2b
}
944e2b
944e2b
944e2b
verify_source_directory()
944e2b
{
944e2b
	output_step_prolog ${mb_script} 'verify_source_directory'
944e2b
944e2b
	if [ _"$mb_source_dir" != _${mb_source_dir##* } ]; then
944e2b
		error_msg "source directory path contains spaces, aborting."
944e2b
		exit 1
944e2b
	fi
944e2b
944e2b
	eval mb_source_dir=$(printf '%s' "$mb_source_dir")
944e2b
944e2b
	if [ -z "$mb_source_dir" ]; then
944e2b
		if [ _$mb_require_source_dir = _yes ]; then
944e2b
			error_msg "$mb_package: specifying an external source directory is required."
944e2b
			error_msg "you can set the source directory either via --source-dir=<path>,"
944e2b
			error_msg "or by setting the SOURCE_DIR variable."
944e2b
			exit 1
944e2b
		fi
944e2b
	fi
944e2b
944e2b
	output_step_epilog
944e2b
}
944e2b
944e2b
944e2b
verify_source_info()
944e2b
{
944e2b
	output_step_prolog ${mb_script} 'verify_source_info'
944e2b
944e2b
	if [ "${mb_source_dir_set:-}" = yes ]; then
944e2b
		if [ -n "$mb_rawball" ] || [ -n "$mb_modball" ] || [ -n "$mb_srcball" ]; then
944e2b
			error_msg "$mb_package: conflicting arguments: --rawball/--modball/--srcball arguments"
944e2b
			error_msg "may not be used together with an explicit source-dir argument or variable."
944e2b
			exit 1
944e2b
		fi
944e2b
	fi
944e2b
944e2b
	if [ -n "$mb_srcball" ]; then
944e2b
		eval mb_srcball=$(printf '%s' "$mb_srcball")
944e2b
944e2b
		if [ -n "$mb_rawball" ] || [ -n "$mb_modball" ]; then
944e2b
			error_msg "$mb_package: conflicting arguments: --rawball and/or --modball arguments"
944e2b
			error_msg "may not be used together with an explicitly --srcball argument."
944e2b
			exit 1
944e2b
		fi
944e2b
944e2b
		if [ -z "$mb_srcball_sha256" ]; then
944e2b
			error_msg "$mb_package: --srcball-sha256 must be provided"
944e2b
			error_msg "in conjunction with --srcball."
944e2b
			exit 1
944e2b
		fi
944e2b
944e2b
		mb_srcball_sha256_test=$(sha256sum "$mb_srcball")
944e2b
		mb_srcball_sha256_test="${mb_srcball_sha256_test%% *}"
944e2b
944e2b
		if [ "$mb_srcball_sha256_test" != "$mb_srcball_sha256" ]; then
944e2b
			error_msg "$mb_package: sha256 signature of srcball $mb_srcball does not match!"
944e2b
			exit 1
944e2b
		fi
944e2b
944e2b
		mb_srcball_topdir=$(xz -c -d "$mb_srcball" | pax | sed -n '1,1p')
944e2b
		mb_source_dir="./srctree/$mb_package/${mb_srcball_topdir%/}"
944e2b
944e2b
		mb_srcball_dirname=$(cd -- "${mb_srcball%/*}" ; pwd -P)
944e2b
		mb_srcball_basename=${mb_srcball##*/}
944e2b
		mb_srcball="$mb_srcball_dirname/$mb_srcball_basename"
944e2b
944e2b
		mkdir -p "./srctree/$mb_package"
944e2b
		mb_dummy=$(cd -- "./srctree/$mb_package"; xz -c -d "$mb_srcball" | pax -r)
944e2b
		mb_source_dir=$(cd -- $mb_source_dir; pwd -P)
944e2b
	fi
944e2b
944e2b
	if [ -z "$mb_rawball" ] && [ -n "$mb_modball" ]; then
944e2b
		error_msg "$mb_package: conflicting arguments: --modball argument may only be used"
944e2b
		error_msg "together with an explicit --rawball argument."
944e2b
		exit 1
944e2b
	fi
944e2b
944e2b
	if [ -n "$mb_modball" ]; then
944e2b
		eval mb_modball=$(printf '%s' "$mb_modball")
944e2b
944e2b
		if [ -z "$mb_modball_sha256" ]; then
944e2b
			error_msg "$mb_package: --modball-sha256 must be provided"
944e2b
			error_msg "in conjunction with --modball."
944e2b
			exit 1
944e2b
		fi
944e2b
944e2b
		mb_modball_sha256_test=$(sha256sum "$mb_modball")
944e2b
		mb_modball_sha256_test="${mb_modball_sha256_test%% *}"
944e2b
944e2b
		if [ "$mb_modball_sha256_test" != "$mb_modball_sha256" ]; then
944e2b
			error_msg "$mb_package: sha256 signature of modball $mb_modball does not match!"
944e2b
			exit 1
944e2b
		fi
944e2b
	fi
944e2b
944e2b
	if [ -n "$mb_rawball" ]; then
944e2b
		eval mb_rawball=$(printf '%s' "$mb_rawball")
944e2b
944e2b
		if [ -z "$mb_rawball_sha256" ]; then
944e2b
			error_msg "$mb_package: --rawball-sha256 must be provided."
944e2b
			error_msg "in conjunction with --rawball."
944e2b
			exit 1
944e2b
		fi
944e2b
944e2b
		mb_rawball_sha256_test=$(sha256sum "$mb_rawball")
944e2b
		mb_rawball_sha256_test="${mb_rawball_sha256_test%% *}"
944e2b
944e2b
		if [ "$mb_rawball_sha256_test" != "$mb_rawball_sha256" ]; then
944e2b
			error_msg "$mb_package: sha256 signature of rawball $mb_rawball does not match!"
944e2b
			exit 1
944e2b
		fi
944e2b
944e2b
		mb_rawball_topdir=$(xz -c -d "$mb_rawball" | pax | sed -n '1,1p')
944e2b
		mb_source_dir="./srctree/$mb_package/${mb_rawball_topdir%/}"
944e2b
944e2b
		mb_rawball_dirname=$(cd -- "${mb_rawball%/*}" ; pwd -P)
944e2b
		mb_rawball_basename=${mb_rawball##*/}
944e2b
		mb_rawball="$mb_rawball_dirname/$mb_rawball_basename"
944e2b
944e2b
		mkdir -p "./srctree/$mb_package"
944e2b
		mb_dummy=$(cd -- "./srctree/$mb_package"; xz -c -d "$mb_rawball" | pax -r)
944e2b
		mb_source_dir=$(cd -- $mb_source_dir; pwd -P)
944e2b
	fi
944e2b
944e2b
	if [ -n "$mb_modball" ]; then
944e2b
		mb_modball_dirname=$(cd -- "${mb_modball%/*}" ; pwd -P)
944e2b
		mb_modball_basename=${mb_modball##*/}
944e2b
		mb_modball="$mb_modball_dirname/$mb_modball_basename"
944e2b
944e2b
		mb_modball_topdir="./modtree/$mb_package/$mb_modball_sha256"
944e2b
		mkdir -p "$mb_modball_topdir"
944e2b
		mb_modball_topdir=$(cd -- $mb_modball_topdir; pwd -P)
944e2b
		mb_dummy=$(cd -- "$mb_modball_topdir"; xz -c -d "$mb_modball" | pax -r)
944e2b
944e2b
		if [ -d "$mb_modball_topdir/overlay" ]; then
944e2b
			mb_dummy=$(cd -- "$mb_modball_topdir/overlay"; \
944e2b
				cp -p -P -R . "$mb_source_dir")
944e2b
		fi
944e2b
944e2b
		if [ -d "$mb_modball_topdir/patches" ]; then
944e2b
			mb_dummy=$(cd -- "$mb_source_dir";                        \
944e2b
				for p in $mb_modball_topdir/patches/*.patch; do  \
944e2b
					patch -p1 < $p;                         \
944e2b
				done);
944e2b
		fi
944e2b
	fi
944e2b
944e2b
	output_step_epilog
944e2b
}
944e2b
944e2b
944e2b
common_defaults()
944e2b
{
944e2b
	# step prolog
944e2b
	output_step_prolog ${mb_script} 'common_defaults'
944e2b
944e2b
	# project-specific config definitions
944e2b
	if [ _$mb_use_custom_cfgdefs = _yes ]; then
944e2b
		cat $sfrt_cfgdefs_in > cfgdefs.mk
944e2b
	else
944e2b
		printf '%s %s\n\n' \
944e2b
				'# this project does not include' \
944e2b
				'a custom config step.'           \
944e2b
			> cfgdefs.mk
944e2b
		cat $sfrt_cfgdefs_in >> cfgdefs.mk
944e2b
944e2b
		if [ -f $mb_project_dir/project/cfgdefs.in ]; then
944e2b
			cat $mb_project_dir/project/cfgdefs.in >> cfgdefs.mk
944e2b
		fi
944e2b
	fi
944e2b
944e2b
	# user build-time overrides
944e2b
	touch usrdefs.mk
944e2b
944e2b
	# git
944e2b
	if [ -n "$mb_source_dir" ]; then
944e2b
		if [ -d "$mb_source_dir/.git" ]; then
944e2b
			mb_git_reference_index="\$(SOURCE_DIR)/.git/index"
944e2b
		fi
944e2b
	elif [ -d "$mb_project_dir/.git" ]; then
944e2b
		mb_git_reference_index="\$(PROJECT_DIR)/.git/index"
944e2b
	fi
944e2b
944e2b
	# project
944e2b
	[ -n "$mb_nickname" ] 		|| mb_nickname=$mb_package
944e2b
	[ -n "$mb_source_dir" ] 	|| mb_source_dir=$mb_project_dir
944e2b
	[ -n "$mb_avoid_version" ] 	|| mb_avoid_version='no'
944e2b
944e2b
	# pkgconfig
944e2b
	[ -n "$mb_pkgname" ]		|| mb_pkgname="$mb_default_pkgname"
944e2b
	[ -n "$mb_pkgdesc" ]		|| mb_pkgdesc="$mb_default_pkgdesc"
944e2b
	[ -n "$mb_pkgusrc" ]		|| mb_pkgusrc="$mb_default_pkgusrc"
944e2b
	[ -n "$mb_pkgrepo" ]		|| mb_pkgrepo="$mb_default_pkgrepo"
944e2b
	[ -n "$mb_pkgpsrc" ]		|| mb_pkgpsrc="$mb_default_pkgpsrc"
944e2b
	[ -n "$mb_pkgdurl" ]		|| mb_pkgdurl="$mb_default_pkgdurl"
944e2b
	[ -n "$mb_pkgbugs" ]		|| mb_pkgbugs="$mb_default_pkgbugs"
944e2b
	[ -n "$mb_pkghome" ]		|| mb_pkghome="$mb_default_pkghome"
944e2b
	[ -n "$mb_pkgdefs" ]		|| mb_pkgdefs="$mb_default_pkgdefs"
944e2b
	[ -n "$mb_pkglibs" ]		|| mb_pkglibs="$mb_default_pkglibs"
944e2b
944e2b
	# srcinfo
944e2b
	[ -n "$mb_rawball" ]		|| mb_rawball="$mb_default_rawball"
944e2b
	[ -n "$mb_rawball_url" ]	|| mb_rawball_url="$mb_default_rawball_url"
944e2b
	[ -n "$mb_rawball_sha256" ]	|| mb_rawball_sha256="$mb_default_rawball_sha256"
944e2b
	[ -n "$mb_modball" ]		|| mb_modball="$mb_default_modball"
944e2b
	[ -n "$mb_modball_url" ]	|| mb_modball_url="$mb_default_modball_url"
944e2b
	[ -n "$mb_modball_sha256" ]	|| mb_modball_sha256="$mb_default_modball_sha256"
944e2b
	[ -n "$mb_srcball" ]		|| mb_srcball="$mb_default_srcball"
944e2b
	[ -n "$mb_srcball_url" ]	|| mb_srcball_url="$mb_default_srcball_url"
944e2b
	[ -n "$mb_srcball_sha256" ]	|| mb_srcball_sha256="$mb_default_srcball_sha256"
944e2b
944e2b
	# dirs
944e2b
	[ -n "$mb_prefix" ] 		|| [ -n "$mb_prefix_set" ] \
944e2b
					|| mb_prefix='/usr/local'
944e2b
944e2b
	[ -n "$mb_exec_prefix" ] 	|| [ -n "$mb_exec_prefix_set" ]	\
944e2b
					|| mb_exec_prefix=$mb_prefix
944e2b
944e2b
	[ -n "$mb_bindir" ] 		|| [ -n "$mb_bindir_set" ] \
944e2b
					|| [ -n "$mb_bindir_basename" ] \
944e2b
					|| mb_bindir=$mb_exec_prefix/bin
944e2b
944e2b
	[ -n "$mb_bindir" ] 		|| [ -n "$mb_bindir_set" ] \
944e2b
					|| mb_bindir=$mb_exec_prefix/$mb_bindir_basename
944e2b
944e2b
	[ -n "$mb_sbindir" ] 		|| mb_sbindir=$mb_exec_prefix/sbin
944e2b
	[ -n "$mb_libdir" ] 		|| mb_libdir=$mb_exec_prefix/lib
944e2b
	[ -n "$mb_includedir" ]		|| mb_includedir=$mb_prefix/include
944e2b
	[ -n "$mb_oldincludedir" ]	|| mb_oldincludedir=$mb_prefix/include
944e2b
	[ -n "$mb_datarootdir" ] 	|| mb_datarootdir=$mb_prefix/share
944e2b
	[ -n "$mb_mandir" ] 		|| mb_mandir=$mb_datarootdir/man
cb8e14
	[ -n "$mb_docdir" ] 		|| mb_docdir=$mb_datarootdir/doc/'$(PACKAGE)'
944e2b
	[ -n "$mb_libexecdir" ]		|| mb_libexecdir=$mb_exec_prefix/libexec
944e2b
944e2b
	[ -n "$mb_sysconfdir" ] 	|| mb_sysconfdir=$mb_exec_prefix/etc
944e2b
	[ -n "$mb_sharedstatedir" ] 	|| mb_sharedstatedir=$mb_prefix/com
944e2b
	[ -n "$mb_localstatedir" ] 	|| mb_localstatedir=$mb_prefix/var
944e2b
	[ -n "$mb_runstatedir" ] 	|| mb_runstatedir=$mb_localstatedir/run
944e2b
	[ -n "$mb_datarootdir" ] 	|| mb_datarootdir=$mb_prefix/share
944e2b
	[ -n "$mb_datadir" ] 		|| mb_datadir=$mb_datarootdir
944e2b
	[ -n "$mb_infodir" ] 		|| mb_infodir=$mb_datarootdir/info
944e2b
	[ -n "$mb_localedir" ] 		|| mb_localedir=$mb_datarootdir/locale
944e2b
	[ -n "$mb_htmldir" ] 		|| mb_htmldir=$mb_docdir
944e2b
	[ -n "$mb_dvidir" ] 		|| mb_dvidir=$mb_docdir
944e2b
	[ -n "$mb_pdfdir" ] 		|| mb_pdfdir=$mb_docdir
944e2b
	[ -n "$mb_psdir" ] 		|| mb_psdir=$mb_docdir
944e2b
944e2b
	# switches
944e2b
	[ -n "$mb_cflags_debug" ]	|| mb_cflags_debug=$mb_default_cflags_debug
944e2b
	[ -n "$mb_cflags_common" ]	|| mb_cflags_common=$mb_default_cflags_common
944e2b
	[ -n "$mb_cflags_cmdline" ]	|| mb_cflags_cmdline=$mb_default_cflags_cmdline
944e2b
	[ -n "$mb_cflags_config" ]	|| mb_cflags_config=$mb_default_cflags_config
944e2b
	[ -n "$mb_cflags_sysroot" ]	|| mb_cflags_sysroot=$mb_default_cflags_sysroot
944e2b
	[ -n "$mb_cflags_os" ]		|| mb_cflags_os=$mb_default_cflags_os
944e2b
	[ -n "$mb_cflags_site" ]	|| mb_cflags_site=$mb_default_cflags_site
944e2b
	[ -n "$mb_cflags_path" ]	|| mb_cflags_path=$mb_default_cflags_path
944e2b
	[ -n "$mb_cflags_strict" ]	|| mb_cflags_strict=$mb_default_cflags_strict
944e2b
	[ -n "$mb_cflags_util" ]	|| mb_cflags_util=$mb_default_cflags_util
944e2b
	[ -n "$mb_cflags_last" ]	|| mb_cflags_last=$mb_default_cflags_last
944e2b
	[ -n "$mb_cflags_once" ]	|| mb_cflags_once=$mb_default_cflags_once
944e2b
944e2b
	[ -n "$mb_ldflags_debug" ]	|| mb_ldflags_debug=$mb_default_ldflags_debug
944e2b
	[ -n "$mb_ldflags_common" ]	|| mb_ldflags_common=$mb_default_ldflags_common
944e2b
	[ -n "$mb_ldflags_cmdline" ]	|| mb_ldflags_cmdline=$mb_default_ldflags_cmdline
944e2b
	[ -n "$mb_ldflags_config" ]	|| mb_ldflags_config=$mb_default_ldflags_config
944e2b
	[ -n "$mb_ldflags_sysroot" ]	|| mb_ldflags_sysroot=$mb_default_ldflags_sysroot
944e2b
	[ -n "$mb_ldflags_path" ]	|| mb_ldflags_path=$mb_default_ldflags_path
944e2b
	[ -n "$mb_ldflags_strict" ]	|| mb_ldflags_strict=$mb_default_ldflags_strict
944e2b
	[ -n "$mb_ldflags_util" ]	|| mb_ldflags_util=$mb_default_ldflags_util
944e2b
	[ -n "$mb_ldflags_last" ]	|| mb_ldflags_last=$mb_default_ldflags_last
944e2b
	[ -n "$mb_ldflags_once" ]	|| mb_ldflags_once=$mb_default_ldflags_once
944e2b
944e2b
	# native switches
944e2b
	[ -n "$mb_native_cflags" ]	|| mb_native_cflags=$mb_default_native_cflags
944e2b
	[ -n "$mb_native_ldflags" ]	|| mb_native_ldflags=$mb_default_native_ldflags
944e2b
944e2b
	# config
944e2b
	[ -n "$mb_all_static" ]		|| mb_all_static='no'
944e2b
	[ -n "$mb_all_shared" ]		|| mb_all_shared='no'
944e2b
	[ -n "$mb_disable_frontend" ]	|| mb_disable_frontend='no'
944e2b
	[ -n "$mb_disable_static" ]	|| mb_disable_static='no'
944e2b
	[ -n "$mb_disable_shared" ]	|| mb_disable_shared='no'
944e2b
944e2b
	# host/target
944e2b
	[ -n "$mb_host" ] 		|| mb_host=$mb_target
944e2b
	[ -n "$mb_target" ] 		|| mb_target=$mb_host
944e2b
944e2b
	# sysroot
944e2b
	if [ -n "$mb_sysroot" ]; then
944e2b
		if [ -z "$mb_cflags_sysroot" ]; then
944e2b
			mb_cflags_sysroot="--sysroot=$mb_sysroot"
944e2b
		fi
944e2b
944e2b
		if [ -z "$mb_ldflags_sysroot" ]; then
944e2b
			mb_ldflags_sysroot="--sysroot=$mb_sysroot"
944e2b
		fi
944e2b
	fi
944e2b
944e2b
	# debug
944e2b
	if [ _$mb_debug = _yes ]; then
944e2b
		if [ -z "$mb_cflags_debug" ]; then
57acf3
			mb_cflags_debug='$(_CFLAGS_g3) $(_CFLAGS_O0)'
944e2b
		fi
944e2b
	fi
944e2b
1b3d58
	# make
1b3d58
	if [ -z "$mb_make" ]; then
1b3d58
		mb_make='make'
1b3d58
	fi
1b3d58
3e7080
	if [ -z "$mb_makemode" ]; then
3e7080
		mb_makemode='posix'
a91f6c
a91f6c
		printf '%s\n%s\n%s\n\n%s\n\n'        \
a91f6c
				'ifeq (a,b)'          \
a91f6c
				'VAR = val'            \
a91f6c
				'endif'                 \
a91f6c
				'all:'                   \
a91f6c
			| ${mb_make} -s -f - 2>/dev/null  \
a91f6c
		&& mb_makemode='modern'
a91f6c
3e7080
	fi
3e7080
944e2b
	# shell
944e2b
	if [ -z "$mb_shell" ]; then
944e2b
		mb_shell='/bin/sh'
944e2b
	fi
944e2b
944e2b
	# inherited cflags & ldflags
944e2b
	mb_cflags_cmdline="$mb_cflags_cmdline $mb_cflags"
944e2b
	mb_ldflags_cmdline="$mb_ldflags_cmdline $mb_ldflags"
944e2b
eb621d
	# add the prefix's library directory to the linker library path
eb621d
	mb_ldflags_last="$mb_ldflags_last -L$mb_libdir"
eb621d
944e2b
	# step epilog
944e2b
	output_step_epilog
944e2b
}
944e2b
944e2b
944e2b
config_flags()
944e2b
{
944e2b
	# step prolog
944e2b
	output_step_prolog ${mb_script} 'config_flags'
944e2b
944e2b
	mb_ldflags_tmp=" $mb_ldflags "
944e2b
	mb_ldflags_libs=$(printf '%s' "$mb_ldflags_tmp" | sed 's/ -static / /g')
944e2b
944e2b
	if [ "$mb_ldflags_tmp" != "$mb_ldflags_libs" ]; then
944e2b
		mb_ldflags="$mb_ldflags_libs"
944e2b
		mb_ldflags_util="$mb_ldflags_util -static"
944e2b
	fi
944e2b
944e2b
	# ccstrict
944e2b
	if [ _$mb_ccstrict = _yes ]; then
944e2b
		mb_cflags_strict='-Wall -Werror -Wextra -Wundef'
944e2b
	fi
944e2b
944e2b
	# ldstrict
944e2b
	if [ _$mb_ldstrict = _yes ]; then
944e2b
		mb_ldflags_strict='-Wl,--no-undefined'
944e2b
	fi
944e2b
944e2b
	# step epilog
944e2b
	output_step_epilog
944e2b
}
944e2b
944e2b
c58391
config_opts()
c58391
{
c58391
	if [ "$mb_avoid_version" = 'yes' ]; then
c58391
		mb_version_opt='none'
c58391
	else
c58391
		mb_version_opt='used'
c58391
	fi
89bf68
89bf68
	if [ "$mb_custom_install_headers" = 'yes' ]; then
89bf68
		mb_install_headers_opt='custom'
89bf68
	else
89bf68
		mb_install_headers_opt='default'
89bf68
	fi
89bf68
89bf68
	if [ "$mb_disable_static" = 'yes' ]; then
89bf68
		mb_static_library_opt='disabled'
89bf68
	else
89bf68
		mb_static_library_opt='enabled'
89bf68
	fi
89bf68
89bf68
	if [ "$mb_disable_shared" = 'yes' ]; then
89bf68
		mb_shared_library_opt='disabled'
89bf68
	else
89bf68
		mb_shared_library_opt='enabled'
89bf68
	fi
89bf68
89bf68
	if [ "$mb_disable_frontend" = 'yes' ]; then
89bf68
		mb_app_frontend_opt='disabled'
89bf68
	else
89bf68
		mb_app_frontend_opt='enabled'
89bf68
	fi
89bf68
89bf68
	if [ "$mb_all_static" = 'yes' ]; then
89bf68
		mb_app_linking_opt='all_static'
89bf68
89bf68
	elif [ "$mb_all_shared" = 'yes' ]; then
89bf68
		mb_app_linking_opt='all_shared'
89bf68
89bf68
	else
89bf68
		mb_app_linking_opt='default'
89bf68
	fi
c58391
}
c58391
944e2b
config_copy()
944e2b
{
944e2b
	output_step_prolog ${mb_script} 'config_copy'
944e2b
0ae63a
	mb_var_defs=
0ae63a
	mb_sed_substs=
48053a
	mb_template="${1:-$mb_project_dir/Makefile.in}"
0ae63a
c58391
	mb_vars=$(cut -d'=' -f1 "$sfrt_config_vars" "$sfrt_opt_vars" \
0ae63a
		| grep -v '^#');
0ae63a
0ae63a
	for __var in $(printf '%s' "$mb_vars"); do
0ae63a
		mb_sed_subst=$(printf '%s %s%s%s'  \
0ae63a
				'-e' "'s^@$__var@"  \
0ae63a
				"^___${__var}___"    \
0ae63a
				"^g'")
0ae63a
0ae63a
		mb_sed_substs="$mb_sed_substs $mb_sed_subst"
0ae63a
0ae63a
		mb_var_def=$(printf '%s%s="${%s}"' "-D" "___${__var}___" "mb_${__var}")
0ae63a
		eval mb_var_defs='"$mb_var_defs "$mb_var_def'
0ae63a
	done
0ae63a
48053a
	eval sed $mb_sed_substs $mb_template         \
48053a
			| eval m4 $mb_var_defs -      \
48053a
			| sed -e 's/[[:blank:]]*$//g'  \
0ae63a
		> $mb_pwd/Makefile.tmp
944e2b
944e2b
	output_step_epilog
944e2b
}
944e2b
944e2b
944e2b
config_ccenv()
944e2b
{
944e2b
	mkdir -p ./ccenv
944e2b
	touch ./ccenv/host.mk
944e2b
	touch ./ccenv/native.mk
944e2b
944e2b
	output_section_break
944e2b
	ccenv_set_host_variables
944e2b
944e2b
	output_section_break
944e2b
	ccenv_set_native_variables
944e2b
944e2b
	output_section_break
944e2b
	config_copy
944e2b
}
944e2b
944e2b
config_custom_cfgdefs()
944e2b
{
944e2b
	. $mb_project_dir/project/config/cfgdefs.sh
944e2b
}
944e2b
944e2b
config_custom()
944e2b
{
944e2b
	if [ _$mb_use_custom_cfgdefs = _yes ]; then
944e2b
		output_section_break
944e2b
		output_script_status ${mb_script} \
944e2b
			'invoking project-specific cfgdefs.sh'
944e2b
944e2b
		eval config_custom_cfgdefs "$mb_custom_cfgdefs_args"
944e2b
944e2b
		output_section_break
506c47
506c47
		if [ -f "$mb_project_dir/project/config/Makefile.in" ]; then
506c47
			config_copy "$mb_project_dir/project/config/Makefile.in"
506c47
			mv $mb_pwd/Makefile.tmp Makefile
506c47
		fi
506c47
944e2b
		config_copy
944e2b
	fi
944e2b
944e2b
	if [ _$mb_use_custom_usrdefs = _yes ]; then
944e2b
		output_section_break
944e2b
		output_script_status ${mb_scirpt} \
944e2b
			'invoking project-specific usrdefs.sh'
944e2b
944e2b
		. $mb_project_dir/project/usrdefs.sh
944e2b
		output_section_break
944e2b
	fi
944e2b
}
944e2b
944e2b
944e2b
config_cfghost()
944e2b
{
944e2b
	output_step_prolog ${mb_script} 'config_cfghost'
944e2b
944e2b
	if [ -z "$mb_cfghost" ]; then
944e2b
		mb_cfghost=$mb_cchost
944e2b
	fi
944e2b
944e2b
	sed		-e 's^@cchost@^'"$mb_cchost"'^g'     \
944e2b
			-e 's^@cfghost@^'"$mb_cfghost"'^g'   \
944e2b
		$mb_pwd/Makefile.tmp > $mb_pwd/Makefile.host
944e2b
944e2b
	rm  $mb_pwd/Makefile.tmp
02bf70
	mv  $mb_pwd/Makefile.host $mb_pwd/$mb_makefile
944e2b
944e2b
	output_step_epilog
944e2b
}
944e2b
944e2b
944e2b
config_host()
944e2b
{
ea127a
	# init
944e2b
	output_step_prolog ${mb_script} 'config_host'
944e2b
ea127a
	mb_cfghost_cc="$ccenv_host_cc"
ea127a
	mb_cfghost_tmpname='ccenv/c3RyaWN0X21vZGUK.c'
ea127a
ea127a
	mb_cfghost_cflags=$(${mb_make} -n -f "$mb_makefile" \
ea127a
		.cflags-host)
ea127a
ea127a
	mb_cfghost_cflags="${mb_cfghost_cflags#*: }"
ea127a
e8a4b3
	if [ $mb_cc_environment = 'freestanding' ]; then
e8a4b3
		if [ -z "mb_cc_underscore" ]; then
e8a4b3
			mb_cfghost_start_fn='_start'
e8a4b3
		else
e8a4b3
			mb_cfghost_start_fn='start'
e8a4b3
		fi
e8a4b3
e8a4b3
		printf 'int %s(void){return 0;}' "$mb_cfghost_start_fn" \
e8a4b3
			> "$mb_cfghost_tmpname"
e8a4b3
e8a4b3
		mb_cfghost_cflags="$mb_cfghost_cflags -ffreestanding"
e8a4b3
		mb_cfghost_cflags="$mb_cfghost_cflags -nostdlib"
e8a4b3
	else
e8a4b3
		printf 'int main(void){return 0;}' \
e8a4b3
			> "$mb_cfghost_tmpname"
e8a4b3
	fi
ea127a
ea127a
	# log
ea127a
	printf '\n' >&3
ea127a
ea127a
	printf '%s\n'                                         \
ea127a
		'#'                                           \
ea127a
		'# verify that that following combination of' \
ea127a
		'# host compiler and host cflags is working.' \
ea127a
		'#'                                           \
ea127a
		>&3
ea127a
ea127a
	printf '\n%s' "$mb_cfghost_cc $ccenv_tmpname -o a.out" >&3
ea127a
e7f859
	for mb_cfghost_cflag in $(printf '%s' "$mb_cfghost_cflags"); do
ea127a
		printf ' \\\n\t%s' "$mb_cfghost_cflag" >&3
ea127a
	done
ea127a
ea127a
	printf '\n\n' >&3
ea127a
ea127a
	# execute
ea127a
	if eval $mb_cfghost_cc "$ccenv_tmpname" -o a.out    \
ea127a
			$(printf '%s' "$mb_cfghost_cflags") \
ea127a
			2>&3; then
ea127a
		rm a.out
ea127a
		rm $mb_cfghost_tmpname
ea127a
		mb_cfghost_ret=0
ea127a
	else
ea127a
		mb_cfghost_ret=1
ea127a
	fi
ea127a
ea127a
	if [ $mb_cfghost_ret = 0 ]; then
ea127a
		output_step_epilog
ea127a
		return 0
ea127a
	fi
944e2b
02bf70
	# should never happen
ea127a
	error_msg
944e2b
	error_msg "configure was able to generate a Makefile for the selected host,"
944e2b
	error_msg "however the host-targeting compiler was found to be missing"
944e2b
	error_msg "at least one of the required headers or features."
944e2b
	exit 2
944e2b
}
944e2b
944e2b
727b3f
config_fini()
727b3f
{
727b3f
	# project-specific post-configuration steps
727b3f
	if [ _$mb_use_custom_cfgfini = _yes ]; then
727b3f
		. "$mb_project_dir/project/config/cfgfini.sh"
727b3f
	fi
727b3f
}
727b3f
727b3f
944e2b
config_status()
944e2b
{
944e2b
	output_script_status ${mb_script} \
944e2b
		'configuration completed successfully.'
944e2b
	printf '\n'
944e2b
}
944e2b
944e2b
944e2b
config_failure()
944e2b
{
944e2b
	if [ _$mb_success = _yes ]; then
944e2b
		return 0
944e2b
	fi
944e2b
944e2b
	printf 'configure info: exiting due to an error.\n' >&3
944e2b
944e2b
	exit 2
944e2b
}
944e2b
944e2b
944e2b
config_success()
944e2b
{
944e2b
	trap '' EXIT
944e2b
	mb_success=yes
944e2b
	exit 0
944e2b
}
944e2b
944e2b
944e2b
# one: init
31d7ec
mb_args_defs=
31d7ec
mb_args_text=
31d7ec
mb_args_idx=0
31d7ec
31d7ec
init_log
944e2b
944e2b
for arg ; do
31d7ec
	mb_args_idx=$((mb_args_idx+1))
31d7ec
31d7ec
	mb_arg_def=$(printf '%s%s="${%s}"' "-D_" "${mb_args_idx}" "${mb_args_idx}")
31d7ec
	eval mb_args_defs='"$mb_args_defs "$mb_arg_def'
31d7ec
31d7ec
	mb_args_text="$mb_args_text '_$((mb_args_idx))'"
944e2b
done
944e2b
31d7ec
printf "$mb_args_text\n\n" | eval m4 $mb_args_defs - >&3
31d7ec
31d7ec
if [ $mb_args_idx -gt 1 ]; then
31d7ec
	printf '$ %s' "$mb_script" >&3
31d7ec
31d7ec
	mb_args_idx=0
31d7ec
	mb_args_text=
31d7ec
31d7ec
	for arg; do
31d7ec
		mb_args_idx=$((mb_args_idx+1))
31d7ec
		mb_args_text="$mb_args_text"$(printf ' \\\\\n\t%s_%d%s' "'" "$mb_args_idx" "'")
31d7ec
	done
31d7ec
31d7ec
	printf "$mb_args_text\n\n" | eval m4 $mb_args_defs - >&3
31d7ec
fi
31d7ec
944e2b
init_vars
944e2b
verify_build_directory
944e2b
944e2b
944e2b
# two: args
944e2b
for arg ; do
944e2b
	case "$arg" in
944e2b
		--help)
944e2b
			usage
944e2b
			;;
944e2b
		--help=ccenv)
944e2b
			ccenv_usage
944e2b
			;;
944e2b
944e2b
		# ccenv
944e2b
		--cross-compile=*)
944e2b
			mb_cross_compile=${arg#*=}
944e2b
			;;
944e2b
		--compiler=*)
944e2b
			mb_compiler=${arg#*=}
944e2b
			;;
944e2b
		--toolchain=*)
944e2b
			mb_toolchain=${arg#*=}
944e2b
			;;
944e2b
		--zealous)
944e2b
			mb_agnostic=yes
944e2b
			mb_zealous=
944e2b
			;;
944e2b
		--zealous=*)
944e2b
			mb_zealous=${arg#*=}
944e2b
			;;
944e2b
		--ccenv=*)
944e2b
			mb_ccenv=${arg#*=}
944e2b
			;;
944e2b
944e2b
		# dirs
944e2b
		--prefix=*)
944e2b
			mb_prefix_set=yes
944e2b
			mb_prefix=${arg#*=}
944e2b
			;;
944e2b
		--exec-prefix=*)
944e2b
			mb_exec_prefix_set=yes
944e2b
			mb_exec_prefix=${arg#*=}
944e2b
			;;
944e2b
		--bindir=*)
944e2b
			mb_bindir_set=yes
944e2b
			mb_bindir=${arg#*=}
944e2b
			;;
944e2b
		--sbindir=*)
944e2b
			mb_sbindir=${arg#*=}
944e2b
			;;
944e2b
		--libdir=*)
944e2b
			mb_libdir=${arg#*=}
944e2b
			;;
944e2b
		--includedir=*)
944e2b
			mb_includedir=${arg#*=}
944e2b
			;;
944e2b
		--oldincludedir=*)
944e2b
			mb_oldincludedir=${arg#*=}
944e2b
			;;
944e2b
		--mandir=*)
944e2b
			mb_mandir=${arg#*=}
944e2b
			;;
944e2b
		--libexecdir=*)
944e2b
			mb_libexecdir=${arg#*=}
944e2b
			;;
944e2b
944e2b
944e2b
		--sysconfdir=*)
944e2b
			mb_sysconfdir=${arg#*=}
944e2b
			;;
944e2b
		--sharedstatedir=*)
944e2b
			mb_sharedstatedir=${arg#*=}
944e2b
			;;
944e2b
		--localstatedir=*)
944e2b
			mb_localstatedir=${arg#*=}
944e2b
			;;
944e2b
		--runstatedir=*)
944e2b
			mb_runstatedir=${arg#*=}
944e2b
			;;
944e2b
		--datarootdir=*)
944e2b
			mb_datarootdir=${arg#*=}
944e2b
			;;
944e2b
		--datadir=*)
944e2b
			mb_datadir=${arg#*=}
944e2b
			;;
944e2b
		--infodir=*)
944e2b
			mb_infodir=${arg#*=}
944e2b
			;;
944e2b
		--localedir=*)
944e2b
			mb_localedir=${arg#*=}
944e2b
			;;
944e2b
		--htmldir=*)
944e2b
			mb_htmldir=${arg#*=}
944e2b
			;;
944e2b
		--dvidir=*)
944e2b
			mb_dvidir=${arg#*=}
944e2b
			;;
944e2b
		--pdfdir=*)
944e2b
			mb_pdfdir=${arg#*=}
944e2b
			;;
944e2b
		--psdir=*)
944e2b
			mb_psdir=${arg#*=}
944e2b
			;;
944e2b
1b3d58
		#make
1b3d58
		--make=*)
1b3d58
			mb_make=${arg#*=}
1b3d58
			;;
944e2b
3e7080
		--makemode=*)
3e7080
			mb_makemode=${arg#*=}
3e7080
			;;
3e7080
944e2b
		# build
944e2b
		--build=*)
944e2b
			mb_build=${arg#*=}
944e2b
			;;
944e2b
		--host=*)
944e2b
			mb_host=${arg#*=}
944e2b
			;;
944e2b
		--cchost=*)
944e2b
			mb_cchost=${arg#*=}
944e2b
			;;
944e2b
		--cfghost=*)
944e2b
			mb_cfghost=${arg#*=}
944e2b
			;;
944e2b
		--target=*)
944e2b
			mb_target=${arg#*=}
944e2b
			;;
944e2b
		--arch=*)
944e2b
			mb_arch=${arg#*=}
944e2b
			;;
944e2b
		--sysroot=*)
944e2b
			mb_sysroot=${arg#*=}
944e2b
			;;
944e2b
		--shell=*)
944e2b
			mb_shell=${arg#*=}
944e2b
			;;
944e2b
		--debug)
944e2b
			mb_debug=yes
944e2b
			;;
944e2b
944e2b
		# config
944e2b
		--all-static)
944e2b
			mb_all_static=yes
944e2b
			mb_all_shared=no
944e2b
			;;
944e2b
		--all-shared)
944e2b
			mb_all_shared=yes
944e2b
			mb_all_static=no
944e2b
			;;
944e2b
		--disable-frontend)
944e2b
			mb_disable_frontend=yes
944e2b
			;;
944e2b
		--disable-app)
944e2b
			mb_disable_frontend=yes
944e2b
			;;
944e2b
		--enable-frontend)
944e2b
			mb_disable_frontend='no'
944e2b
			;;
944e2b
		--enable-app)
944e2b
			mb_disable_frontend='no'
944e2b
			;;
944e2b
		--disable-static)
944e2b
			mb_disable_static=yes
944e2b
			;;
944e2b
		--disable-shared)
944e2b
			mb_disable_shared=yes
944e2b
			;;
944e2b
		--enable-static)
944e2b
			mb_disable_static='no'
944e2b
			;;
944e2b
		--enable-shared)
944e2b
			mb_disable_shared='no'
944e2b
			;;
944e2b
944e2b
		# convenience
944e2b
		--strict)
944e2b
			mb_ccstrict=yes
944e2b
			mb_ldstrict=yes
944e2b
			;;
944e2b
		--ccstrict)
944e2b
			mb_ccstrict=yes
944e2b
			;;
944e2b
		--ldstrict)
944e2b
			mb_ldstrict=yes
944e2b
			;;
944e2b
944e2b
		# project
944e2b
		--nickname=*)
944e2b
			mb_nickname=${arg#*=}
944e2b
			;;
944e2b
		--program-prefix=*)
944e2b
			mb_program_prefix=${arg#*=}
944e2b
			;;
944e2b
		--avoid-version)
944e2b
			mb_avoid_version=yes
944e2b
			;;
944e2b
		--source-dir=*)
944e2b
			mb_source_dir=${arg#*=}
944e2b
			mb_source_dir_set=yes
944e2b
			;;
944e2b
		--srcdir=*)
944e2b
			mb_source_dir=${arg#*=}
944e2b
			mb_source_dir_set=yes
944e2b
			;;
944e2b
944e2b
		# pkgconfig
944e2b
		--pkgname=*)
944e2b
			mb_pkgname=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--pkgdesc=*)
944e2b
			mb_pkgdesc=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--pkgusrc=*)
944e2b
			mb_pkgusrc=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--pkgrepo=*)
944e2b
			mb_pkgrepo=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--pkgpsrc=*)
944e2b
			mb_pkgpsrc=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--pkgdurl=*)
944e2b
			mb_pkgdurl=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--pkgbugs=*)
944e2b
			mb_pkgbugs=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--pkghome=*)
944e2b
			mb_pkghome=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--pkgdefs=*)
944e2b
			mb_pkgdefs=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--pkglibs=*)
944e2b
			mb_pkglibs=${arg#*=}
944e2b
			;;
944e2b
944e2b
		# srcinfo
944e2b
		--srcinfo=*)
944e2b
			mb_srcinfo=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--srcsite=*)
944e2b
			mb_srcsite=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--pgprkey=*)
944e2b
			mb_pgprkey=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--pgpskey=*)
944e2b
			mb_pgpskey=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--rawball=*)
944e2b
			mb_rawball=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--rawball-url=*)
944e2b
			mb_rawball_url=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--rawball-sha256=*)
944e2b
			mb_rawball_sha256=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--modball=*)
944e2b
			mb_modball=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--modball-url=*)
944e2b
			mb_modball_url=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--modball-sha256=*)
944e2b
			mb_modball_sha256=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--srcball=*)
944e2b
			mb_srcball=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--srcball-url=*)
944e2b
			mb_srcball_url=${arg#*=}
944e2b
			;;
944e2b
944e2b
		--srcball-sha256=*)
944e2b
			mb_srcball_sha256=${arg#*=}
944e2b
			;;
944e2b
944e2b
		# compatibility
944e2b
		--enable-dependency-tracking)
944e2b
			;;
944e2b
		--disable-dependency-tracking)
944e2b
			;;
944e2b
944e2b
		*)
944e2b
			if [ _$mb_use_custom_cfgdefs = _yes ]; then
944e2b
				mb_escaped_arg=\'$(printf '%s\n' "$arg" | sed -e "s/'/'\\\\''/g")\'
944e2b
				mb_escaped_arg="$mb_custom_cfgdefs_space$mb_escaped_arg"
944e2b
				mb_custom_cfgdefs_args="$mb_custom_cfgdefs_args$mb_escaped_arg"
944e2b
				mb_custom_cfgdefs_space=' '
944e2b
			else
944e2b
				error_msg ${arg#}: "unsupported config argument."
944e2b
				exit 2
944e2b
			fi
944e2b
			;;
944e2b
	esac
944e2b
944e2b
	mb_safe_path_desc='source directory'
944e2b
	mb_safe_path_name="$mb_source_dir"
944e2b
	verify_safe_path
944e2b
done
944e2b
944e2b
944e2b
944e2b
# three: validation
944e2b
verify_source_directory
944e2b
verify_source_info
944e2b
944e2b
if ! [ -z "$mb_program_prefix" ]; then
944e2b
	error_msg "--program-prefix is not yet fully support (must be null)."
944e2b
fi
944e2b
944e2b
944e2b
944e2b
# four: defaults
944e2b
common_defaults
944e2b
944e2b
944e2b
# five: config
944e2b
config_flags
c58391
config_opts
944e2b
config_copy
944e2b
config_ccenv
944e2b
config_custom
944e2b
config_cfghost
944e2b
config_host
727b3f
config_fini
944e2b
config_status
944e2b
944e2b
944e2b
# all done
944e2b
config_success