xref: /netbsd-src/external/lgpl3/mpfr/dist/tools/ck-mparam (revision ba125506a622fe649968631a56eba5d42ff57863)
1#!/bin/sh
2
3# Check the mparam.h files. This script is useful as not all mparam.h
4# files may be tested by our tests.
5
6# Copyright 2011-2023 Free Software Foundation, Inc.
7# This script is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16# Note: This script must be run from a writable directory (an executable
17# check_mparam will be created in it). Moreover, the source tree that is
18# checked is the one that contains this script, not the one corresponding
19# to the current working directory (the rule for the other scripts in
20# the tools directory may be different).
21
22set -e
23
24dir=$(dirname "$0")
25files=$(cd "$dir/.." && find src/*/ -name mparam.h)
26err=0
27
28for i in $files
29do
30  #output=`echo "#include \"$i\"" | gcc -o /dev/null -c -xc - 2>&1`
31  #if [ -n "$output" ]; then
32  #  printf "Error for file '%s':\n%s\n" "$i" "$output"
33  #  err=1
34  #fi
35  rm -f check_mparam
36  ${CC:-cc} "-DMPARAM=\"../$i\"" -o check_mparam "$dir"/check_mparam.c
37  ./check_mparam
38done
39
40rm -f check_mparam
41
42exit $err
43