xref: /netbsd-src/external/lgpl3/mpfr/dist/tools/ck-copyright-notice (revision fdd524d4ccd2bb0c6f67401e938dabf773eb0372)
1#!/bin/sh
2
3# Copyright 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
4# This script is free software; the Free Software Foundation
5# gives unlimited permission to copy and/or distribute it,
6# with or without modifications, as long as this notice is preserved.
7
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11# PARTICULAR PURPOSE.
12
13# ck-copyright-notice can be run from the tools directory
14dir=`pwd`
15[ -d src ] || [ "`basename "$dir"`" != tools ] || cd ..
16
17# Note: if paragraphs are reformatted, this may need to be updated.
18
19lgpl="`sed -n '/version [0-9.]* or any later version/ {
20  s/.*version //
21  s/ or.*//
22  p
23  q
24  }' doc/mpfr.texi`"
25
26# Do not use "find ... | while read file do ... done" because the "do"
27# part needs to be run in the current shell, and some shells behave in
28# a different way.
29srctests=`find src tests -name '*.[ch]'`
30
31err=0
32for file in $srctests
33do
34  y=""
35  case $file in
36    tests/RRTest.c)
37      # This file doesn't have a copyright notice, but isn't distributed.
38      continue ;;
39    src/mpfr-longlong.h)
40      # This file (which comes from GMP) has a specific copyright notice.
41      continue ;;
42    src/get_patches.c)
43      file="tools/get_patches.sh" ;;
44    */mparam.h)
45      y="2005," ;;
46  esac
47  grep -q "Copyright $y.* Free Software Foundation" "$file" && \
48  grep -q "GNU MPFR Library" "$file" && \
49  grep -q "either version $lgpl of the License" "$file" && continue
50  echo "Possibly missing or incorrect copyright notice in $file"
51  err=1
52done
53
54exit $err
55