Blame project/config/cfgdefs.sh

38a7e3
# in projects where [ $mb_use_custom_cfgdefs = yes ],
38a7e3
# cfgdefs.sh is invoked from within ./configure via
38a7e3
# . $mb_project_dir/project/cfgdefs.sh
38a7e3
38a7e3
# this file is covered by COPYING.BAUTOMAKE.
38a7e3
38a7e3
# a successful return from cfgdefs.sh will be followed
38a7e3
# by a second invocation of the config_copy() function,
38a7e3
# reflecting any changes to common config variables
38a7e3
# made by cfgdefs.sh.
38a7e3
38a7e3
# finally, cfgdefs.sh may update the contents of the
38a7e3
# config-time generated cfgdefs.mk.
38a7e3
38a7e3
38a7e3
for arg ; do
38a7e3
	case "$arg" in
eeb091
		--with-host-perl=*)
eeb091
			mb_host_perl=${arg#*=}
eeb091
			;;
eeb091
eeb091
		--with-host-sh=*)
eeb091
			mb_host_sh=${arg#*=}
eeb091
			;;
eeb091
38a7e3
		*)
38a7e3
			error_msg ${arg#}: "unsupported config argument."
38a7e3
			exit 2
38a7e3
	esac
38a7e3
done
38a7e3
38a7e3
38a7e3
cfgdefs_detect_automake_version()
38a7e3
{
38a7e3
	automake_ver=$(grep 'VERSION' "$mb_source_dir/doc/version.texi")
38a7e3
	automake_ver=${automake_ver##* }
38a7e3
38a7e3
	automake_year=$(grep 'UPDATED-MONTH' "$mb_source_dir/doc/version.texi")
38a7e3
	automake_year=${automake_year##* }
38a7e3
38a7e3
	automake_major=$(printf '%s' "$automake_ver" | cut -d'.' -f1)
38a7e3
	automake_minor=$(printf '%s' "$automake_ver" | cut -d'.' -f2)
38a7e3
	automake_micro=$(printf '%s' "$automake_ver" | cut -d'.' -f3)
38a7e3
38a7e3
	if [ -z "$automake_major" ] || [ -z "$automake_minor" ]; then
38a7e3
		error_msg "Could not properly parse automake's version.texi"
38a7e3
		exit 2
38a7e3
	fi
38a7e3
}
38a7e3
38a7e3
38a7e3
cfgdefs_output_custom_defs()
38a7e3
{
eeb091
	mb_host_perl=${mb_host_perl:-/usr/bin/perl}
eeb091
	mb_host_sh=${mb_host_sh:-/usr/bin/sh}
eeb091
38a7e3
	sed \
38a7e3
			-e 's/@automake_ver@/'"$automake_ver"'/g'       \
38a7e3
			-e 's/@automake_year@/'"$automake_year"'/g'     \
38a7e3
			-e 's/@automake_major@/'"$automake_major"'/g'   \
38a7e3
			-e 's/@automake_minor@/'"$automake_minor"'/g'   \
38a7e3
			-e 's/@automake_micro@/'"$automake_micro"'/g'   \
eeb091
			-e 's!@host_perl@!'"$mb_host_perl"'!g'          \
eeb091
			-e 's!@host_sh@!'"$mb_host_sh"'!g'              \
38a7e3
		"$mb_project_dir/project/config/cfgdefs.in"         \
38a7e3
	| sed -e 's/[ \t]*$//g'                                     \
38a7e3
			>> "$mb_pwd/cfgdefs.mk"
38a7e3
}
38a7e3
38a7e3
38a7e3
# automake version info
38a7e3
cfgdefs_detect_automake_version
38a7e3
38a7e3
# cfgdefs.in --> cfgdefs.mk
38a7e3
cfgdefs_output_custom_defs
38a7e3
38a7e3
# all done
38a7e3
return 0