Blame configure

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