1254721Semaste#! /bin/sh 2254721Semaste# Update the local files from GNULIB. Currently assumes that the current 3254721Semaste# GNULIB sources are in a directory parallel with this one. 4254721Semaste# 5254721Semaste# This program is free software; you can redistribute it and/or modify 6254721Semaste# it under the terms of the GNU General Public License as published by 7254721Semaste# the Free Software Foundation; either version 2, or (at your option) 8254721Semaste# any later version. 9254721Semaste# 10254721Semaste# This program is distributed in the hope that it will be useful, 11254721Semaste# but WITHOUT ANY WARRANTY; without even the implied warranty of 12254721Semaste# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13254721Semaste# GNU General Public License for more details. 14254721Semaste# 15254721Semaste# You should have received a copy of the GNU General Public License 16254721Semaste# along with this program; if not, write to the Free Software Foundation, 17254721Semaste# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18254721Semaste 19254721Semasteif test -f maint-aux/gnulib-modules; then :; else 20254721Semaste >&2 echo \ 21254721Semaste"This script expects to be run from the top level of the CVS source tree." 22254721Semaste exit 2 23254721Semastefi 24254721Semaste 25254721Semasteif test -f maint-aux/gnulib-modules; then :; else 26254721Semaste >&2 echo \ 27254721Semaste"Failed to find the modules list (\`maint-aux/gnulib-modules')." 28254721Semaste exit 2 29254721Semastefi 30254721Semaste 31254721Semaste# Where to find the GNULIB sources. 32254721Semaste: ${GNULIB="../gnulib"} 33254721SemasteGNULIB_TOOL=$GNULIB/gnulib-tool 34254721Semaste 35254721Semaste# Which modules to update. 36254721SemasteMODULES=`cat maint-aux/gnulib-modules` 37254721Semaste 38254721Semaste# Are the GNULIB sources really where we expect them? 39254721Semasteif test -r $GNULIB && test -d $GNULIB \ 40254721Semaste && test -r $GNULIB_TOOL && test -f $GNULIB_TOOL; then :; else 41254721Semaste echo GNULIB sources not found. >&2 42254721Semaste exit 1 43254721Semastefi 44254721Semaste 45254721Semastetrap \ 46254721Semaste'status=$? 47254721Semaste# Restore lib/Makefile.am. 48254721Semasteif test -f lib/Makefile.am.save; then 49254721Semaste mv lib/Makefile.am.save lib/Makefile.am 50254721Semastefi 51254721Semaste# Restore m4/error.m4. 52254721Semasteif test -f m4/error.m4.save; then 53254721Semaste mv m4/error.m4.save m4/error.m4 54254721Semastefi 55254721Semasteexit $status' EXIT 56254721Semaste 57254721Semaste# Prevent lib/Makefile.am from being overwritten. 58254721Semastemv lib/Makefile.am lib/Makefile.am.save 59254721Semaste# Prevent m4/error.m4 from being overwritten unless necessary. 60254721Semastemv m4/error.m4 m4/error.m4.save 61254721Semaste 62254721Semaste# Run the update. 63254721Semasteif $GNULIB_TOOL --import $MODULES >/dev/null; then :; else 64254721Semaste exit $? 65254721Semastefi 66254721Semaste 67254721Semaste# Correct this file for our purposes, but try to avoid munging timestamps 68254721Semaste# unless necessary. 69254721Semastesed '/AC_FUNC_ERROR_AT_LINE/d' <m4/error.m4 >tmp 70254721Semasteif cmp tmp m4/error.m4.save >/dev/null 2>&1; then 71280031Sdim mv m4/error.m4.save m4/error.m4 72254721Semaste rm tmp 73254721Semasteelse 74254721Semaste mv tmp m4/error.m4 75254721Semaste rm m4/error.m4.save 76254721Semastefi 77254721Semaste 78254721Semaste# Extract the names of the files we imported. 79254721Semaste$GNULIB_TOOL --extract-filelist $MODULES |sort |uniq |sed '/^$/d' \ 80254721Semaste >maint-aux/gnulib-filelist.new 81254721Semaste 82254721Semaste# Warn the user if the filelist has changed. 83if cmp maint-aux/gnulib-filelist.txt maint-aux/gnulib-filelist.new >/dev/null 84then 85 # Avoid munging timestamps when nothing's changed. 86 rm maint-aux/gnulib-filelist.new 87else 88 cat >&2 <<\EOF 89******************************************************************** 90The file list has changed. You may need to add or remove files from 91CVS. Use `cvs diff maint-aux/gnulib-filelist.txt' to view changes. 92******************************************************************** 93EOF 94 # Save the file list for next time. 95 mv maint-aux/gnulib-filelist.new maint-aux/gnulib-filelist.txt 96fi 97 98 99# Warn the user if changes have been made to the Makefile.am. 100if cmp lib/Makefile.am lib/Makefile.gnulib >/dev/null; then 101 # Avoid munging timestamps when nothing's changed. 102 rm lib/Makefile.am 103else 104 cat >&2 <<\EOF 105******************************************************************** 106Makefile.am needs updating. Use `cvs diff lib/Makefile.gnulib' to 107view changes. 108******************************************************************** 109EOF 110 # Save the generated lib/Makefile.am for next time. 111 mv lib/Makefile.am lib/Makefile.gnulib 112fi 113