# in projects where [ $mb_use_custom_cfgdefs = yes ],
# cfgdefs.sh is invoked from within ./configure via
# . $mb_project_dir/project/cfgdefs.sh
# this file is covered by COPYING.BAUTOMAKE.
# 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
# config-time generated cfgdefs.mk.
for arg ; do
case "$arg" in
--with-host-perl=*)
mb_host_perl=${arg#*=}
;;
--with-host-sh=*)
mb_host_sh=${arg#*=}
;;
*)
error_msg ${arg#}: "unsupported config argument."
exit 2
esac
done
cfgdefs_detect_automake_version()
{
automake_ver=$(grep 'VERSION' "$mb_source_dir/doc/version.texi")
automake_ver=${automake_ver##* }
automake_year=$(grep 'UPDATED-MONTH' "$mb_source_dir/doc/version.texi")
automake_year=${automake_year##* }
automake_major=$(printf '%s' "$automake_ver" | cut -d'.' -f1)
automake_minor=$(printf '%s' "$automake_ver" | cut -d'.' -f2)
automake_micro=$(printf '%s' "$automake_ver" | cut -d'.' -f3)
if [ -z "$automake_major" ] || [ -z "$automake_minor" ]; then
error_msg "Could not properly parse automake's version.texi"
exit 2
fi
}
cfgdefs_output_custom_defs()
{
mb_host_perl=${mb_host_perl:-/usr/bin/perl}
mb_host_sh=${mb_host_sh:-/usr/bin/sh}
sed \
-e 's/@automake_ver@/'"$automake_ver"'/g' \
-e 's/@automake_year@/'"$automake_year"'/g' \
-e 's/@automake_major@/'"$automake_major"'/g' \
-e 's/@automake_minor@/'"$automake_minor"'/g' \
-e 's/@automake_micro@/'"$automake_micro"'/g' \
-e 's!@host_perl@!'"$mb_host_perl"'!g' \
-e 's!@host_sh@!'"$mb_host_sh"'!g' \
"$mb_project_dir/project/config/cfgdefs.in" \
| sed -e 's/[ \t]*$//g' \
>> "$mb_pwd/cfgdefs.mk"
}
# automake version info
cfgdefs_detect_automake_version
# cfgdefs.in --> cfgdefs.mk
cfgdefs_output_custom_defs
# all done
return 0