Blame configure

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