Blame configure

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