#! /bin/sh
if test -f maint-aux/gnulib-modules; then :; else
>&2 echo \
"This script expects to be run from the top level of the CVS source tree."
exit 2
fi
if test -f maint-aux/gnulib-modules; then :; else
>&2 echo \
"Failed to find the modules list (\`maint-aux/gnulib-modules')."
exit 2
fi
: ${GNULIB="../gnulib"}
GNULIB_TOOL=$GNULIB/gnulib-tool
MODULES=`cat maint-aux/gnulib-modules`
if test -r $GNULIB && test -d $GNULIB \
&& test -r $GNULIB_TOOL && test -f $GNULIB_TOOL; then :; else
echo GNULIB sources not found. >&2
exit 1
fi
trap \
'status=$?
if test -f lib/Makefile.am.save; then
mv lib/Makefile.am.save lib/Makefile.am
fi
if test -f m4/error.m4.save; then
mv m4/error.m4.save m4/error.m4
fi
exit $status' EXIT
mv lib/Makefile.am lib/Makefile.am.save
mv m4/error.m4 m4/error.m4.save
if $GNULIB_TOOL --import $MODULES >/dev/null; then :; else
exit $?
fi
sed '/AC_FUNC_ERROR_AT_LINE/d' <m4/error.m4 >tmp
if cmp tmp m4/error.m4.save >/dev/null 2>&1; then
mv m4/error.m4.save m4/error.m4
rm tmp
else
mv tmp m4/error.m4
rm m4/error.m4.save
fi
$GNULIB_TOOL --extract-filelist $MODULES |sort |uniq |sed '/^$/d' \
>maint-aux/gnulib-filelist.new
if cmp maint-aux/gnulib-filelist.txt maint-aux/gnulib-filelist.new >/dev/null
then
rm maint-aux/gnulib-filelist.new
else
cat >&2 <<\EOF
********************************************************************
The file list has changed. You may need to add or remove files from
CVS. Use `cvs diff maint-aux/gnulib-filelist.txt' to view changes.
********************************************************************
EOF
mv maint-aux/gnulib-filelist.new maint-aux/gnulib-filelist.txt
fi
if cmp lib/Makefile.am lib/Makefile.gnulib >/dev/null; then
rm lib/Makefile.am
else
cat >&2 <<\EOF
********************************************************************
Makefile.am needs updating. Use `cvs diff lib/Makefile.gnulib' to
view changes.
********************************************************************
EOF
mv lib/Makefile.am lib/Makefile.gnulib
fi