Blame configure

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