Blame configure

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