2 # Fix struct exception in /usr/include/math.h.
4 # We expect several systems which did not need fixincludes in the past
5 # to need to fix just math.h. So we created a separate fixinc.math
6 # script to fix just that problem.
7 # See README-fixinc for more information.
9 # Directory containing the original header files.
10 # (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
11 INPUT
=${2-${INPUT-/usr/include}}
13 # Directory in which to store the results.
14 LIB
=${1?"fixincludes: output directory not specified"}
16 # Make sure it exists.
17 if [ ! -d $LIB ]; then
21 echo Building fixed headers
in ${LIB}
23 # Some math.h files define struct exception, which conflicts with
24 # the class exception defined in the C++ file std/stdexcept.h. We
25 # redefine it to __math_exception. This is not a great fix, but I
26 # haven't been able to think of anything better.
28 if [ -r $INPUT/$file ]; then
29 echo Checking
$INPUT/$file
30 if grep 'struct exception' $INPUT/$file >/dev
/null
34 cat <<'__EOF__' >$LIB/$file
35 #ifndef _MATH_H_WRAPPER
37 # define exception __math_exception
39 #include_next <math.h>
43 #define _MATH_H_WRAPPER
44 #endif /* _MATH_H_WRAPPER */
46 # Define _MATH_H_WRAPPER at the end of the wrapper, not the start,
47 # so that if #include_next gets another instance of the wrapper,
48 # this will follow the #include_next chain until we arrive at