Blame configure

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