xref: /netbsd-src/external/lgpl3/mpfr/dist/tools/ck-clz_tab (revision 7330f729ccf0bd976a06f95fad452fe774fc7fd1)
1#!/bin/sh
2
3# Copyright 2016-2018 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-clz_tab can be run from the tools directory
14dir=$(pwd)
15[ -d src ] || [ "$(basename "$dir")" != tools ] || cd ..
16
17size1=$(sed -n 's/^extern .* __clz_tab\[\([0-9]\+\)\].*/\1/p' \
18        src/mpfr-longlong.h)
19
20size2=$(sed -n 's/^.* __clz_tab\[\([0-9]\+\)\].*/\1/p' \
21        src/mp_clz_tab.c)
22
23if [ -n "$size1" ] && [ -n "$size2" ] && [ "$size1" != "$size2" ]; then
24  cat >&2 <<EOF
25The __clz_tab sizes do not match.
26  mpfr-longlong.h  $size1
27  mp_clz_tab.c     $size2
28EOF
29  exit 1
30fi
31