aboutsummaryrefslogtreecommitdiff
path: root/tools/ck-copyright-notice
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ck-copyright-notice')
-rwxr-xr-xtools/ck-copyright-notice54
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/ck-copyright-notice b/tools/ck-copyright-notice
new file mode 100755
index 0000000..aec5831
--- /dev/null
+++ b/tools/ck-copyright-notice
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# Copyright 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This script is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# ck-copyright-notice can be run from the tools directory
+dir=`pwd`
+[ -d src ] || [ "`basename "$dir"`" != tools ] || cd ..
+
+# Note: if paragraphs are reformatted, this may need to be updated.
+
+lgpl="`sed -n '/version [0-9.]* or any later version/ {
+ s/.*version //
+ s/ or.*//
+ p
+ q
+ }' doc/mpfr.texi`"
+
+# Do not use "find ... | while read file do ... done" because the "do"
+# part needs to be run in the current shell, and some shells behave in
+# a different way.
+srctests=`find src tests -name '*.[ch]'`
+
+err=0
+for file in $srctests
+do
+ y=""
+ case $file in
+ tests/RRTest.c)
+ # This file doesn't have a copyright notice, but isn't distributed.
+ continue ;;
+ src/mpfr-longlong.h)
+ # This file (which comes from GMP) has a specific copyright notice.
+ continue ;;
+ src/get_patches.c)
+ file="tools/get_patches.sh" ;;
+ */mparam.h)
+ y="2005," ;;
+ esac
+ grep -q "Copyright $y.* Free Software Foundation" "$file" && \
+ grep -q "GNU MPFR Library" "$file" && \
+ grep -q "either version $lgpl of the License" "$file" && continue
+ echo "Possibly missing or incorrect copyright notice in $file"
+ err=1
+done
+
+exit $err