2 # Update the local files from GNULIB. Currently assumes that the current
3 # GNULIB sources are in a directory parallel with this one.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 if test -f maint-aux
/gnulib-modules
; then :; else
21 "This script expects to be run from the top level of the CVS source tree."
25 if test -f maint-aux
/gnulib-modules
; then :; else
27 "Failed to find the modules list (\`maint-aux/gnulib-modules')."
31 # Where to find the GNULIB sources.
32 : ${GNULIB="../gnulib"}
33 GNULIB_TOOL
=$GNULIB/gnulib-tool
35 # Which modules to update.
36 MODULES
=`cat maint-aux/gnulib-modules`
38 # Are the GNULIB sources really where we expect them?
39 if test -r $GNULIB && test -d $GNULIB \
40 && test -r $GNULIB_TOOL && test -f $GNULIB_TOOL; then :; else
41 echo GNULIB sources not found.
>&2
47 # Restore lib/Makefile.am.
48 if test -f lib/Makefile.am.save; then
49 mv lib/Makefile.am.save lib/Makefile.am
51 # Restore m4/error.m4.
52 if test -f m4/error.m4.save; then
53 mv m4/error.m4.save m4/error.m4
57 # Prevent lib/Makefile.am from being overwritten.
58 mv lib
/Makefile.am lib
/Makefile.am.save
59 # Prevent m4/error.m4 from being overwritten unless necessary.
60 mv m
4/error.
m4 m
4/error.
m4.save
63 if $GNULIB_TOOL --import $MODULES >/dev
/null
; then :; else
67 # Correct this file for our purposes, but try to avoid munging timestamps
69 sed '/AC_FUNC_ERROR_AT_LINE/d' <m
4/error.
m4 >tmp
70 if cmp tmp m
4/error.
m4.save
>/dev
/null
2>&1; then
71 mv m
4/error.
m4.save m
4/error.
m4
78 # Extract the names of the files we imported.
79 $GNULIB_TOOL --extract-filelist $MODULES |
sort |
uniq |
sed '/^$/d' \
80 >maint-aux
/gnulib-filelist.new
82 # Warn the user if the filelist has changed.
83 if cmp maint-aux
/gnulib-filelist.txt maint-aux
/gnulib-filelist.new
>/dev
/null
85 # Avoid munging timestamps when nothing's changed.
86 rm maint-aux
/gnulib-filelist.new
89 ********************************************************************
90 The
file list has changed. You may need to add or remove files from
91 CVS. Use
`cvs diff maint-aux/gnulib-filelist.txt' to view changes.
92 ********************************************************************
94 # Save the file list for next time.
95 mv maint-aux/gnulib-filelist.new maint-aux/gnulib-filelist.txt
99 # Warn the user if changes have been made to the Makefile.am.
100 if cmp lib/Makefile.am lib/Makefile.gnulib >/dev/null; then
101 # Avoid munging timestamps when nothing's changed.
105 ********************************************************************
106 Makefile.am needs updating. Use `cvs
diff lib
/Makefile.gnulib
' to
108 ********************************************************************
110 # Save the generated lib/Makefile.am for next time.
111 mv lib/Makefile.am lib/Makefile.gnulib