# in projects where [ $mb_use_custom_cfgdefs = yes ],
# cfgdefs.sh is invoked from within ./configure via
# . $mb_project_dir/project/cfgdefs.sh

# a successful return from cfgdefs.sh will be followed
# by a second invocation of the config_copy() function,
# reflecting any changes to common config variables
# made by cfgdefs.sh.

# finally, cfgdefs.sh may update the contents of the
# build-time-generated cfgdefs.mk.


# no custom switches yet
for arg ; do
	case "$arg" in
		*)
			error_msg ${arg#}: "unsupported config argument."
			exit 2
	esac
done


# cfghost: target
if [ -z "$mb_cfghost" ]; then
	case "$mb_cchost" in
		x86_64-*-linux | x86_64-*-linux-* | x86_64-linux-* )
			mb_cfghost=x86_64-linux ;;

		x86_64-*-midipix | x86_64-*-midipix-* | x86_64-midipix-* )
			mb_cfghost=x86_64-midipix ;;
	esac
fi


# cfghost: (native) pycompile
mb_pycompile_cfghost=$($mb_native_cc -dumpmachine)

case "$mb_pycompile_cfghost" in
	x86_64-*-linux | x86_64-*-linux-* | x86_64-linux-* )
		mb_pycompile_cfghost=x86_64-linux ;;

	x86_64-*-midipix | x86_64-*-midipix-* | x86_64-midipix-* )
		mb_pycompile_cfghost=x86_64-midipix ;;
esac


# update cfgdefs.mk
sed -e 's^@pycompile_cfghost@^'"$mb_pycompile_cfghost"'^g' \
	$mb_project_dir/project/config/cfgdefs.in          \
		> $mb_pwd/cfgdefs.mk || exit 2


# all done
return 0
