Fix Savannah bug #19980, by avoiding the non-POSIX function putw() (and in previous...
[findutils.git] / lib / gnulib-version.sh
blobb9494b9034dfa2cb54e7449330753e0cf18221cd
1 #! /bin/sh
3 # gnulib-version.sh -- creates gnulib-version.c (from ../import-gnulib.config)
4 # Copyright (C) 2007 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 # USA.
22 topsrcdir="$1"
23 srcdir="$2"
24 configfile="$3"
26 outfile="${srcdir}"/gnulib-version.c
28 source $configfile
30 if [ -z "$gnulib_version" ]
31 then
32 echo "Error: There should be a gnulib_version setting in $configfile, but there is not." >&2
33 exit 1
37 cat > "${outfile}".new <<EOF
38 /* This file is automatically generated by $0 and simply records which version of gnulib we used. */
39 const char * const gnulib_version = "$gnulib_version";
40 EOF
42 if test -f "$outfile" ; then
43 if diff "${outfile}".new "${outfile}" > /dev/null
44 then
45 # nothing to do
46 rm "${outfile}".new
47 exit 0
50 mv "${outfile}".new "${outfile}"