1 # $NetBSD: check-headers.sh,v 1.9 2007/01/02 17:58:11 rillig Exp $
3 # This program checks the header files for possible problems.
5 # When a macro definition contains the characters "${", it is likely
6 # that is comes from a GNU-style configure script that didn't use the
7 # ${prefix} or ${exec_prefix} variable correctly.
12 checkdir=`dirname "$0"`
13 . "$checkdir/check-subr.sh"
16 found_unresolved_variable=no
18 # usage: check_header <fname>
20 # See the end of the loop for the redirection.
23 # Check for "${" in macro definitions.
25 "#"*define*[\":]\$\{[A-Za-z]*\}/*\"*)
26 found_unresolved_variable=yes
27 cs_error_heading "Found unresolved variable in macro:"
28 cs_error_msg "$fname: $line"
35 find * -type f -print 2>/dev/null \
40 eval "case \"\$fname\" in $SKIP_FILTER *.orig) skip=yes;; esac"
41 [ $skip = no ] || continue
44 *.h | *.hpp | *.h++ | *.hxx)
50 if [ $found_unresolved_variable = yes ]; then
52 The above macros may contain references to shell variables.
54 The cause of this problem is usually that in a configure.ac or
55 configure.in file, there is some code like
59 AC_DEFINE_UNQUOTED(FOO_DIR, "\$FOO_DIR", [Directory where foo files go])
61 You can fix this by telling the original package author not to use
62 AC_DEFINE_UNQUOTED for directories. Instead, {he,she} should do
69 # in the Makefile.am files (can be more than one):
70 AM_CPPFLAGS= -DFOO_DIR=\\"@FOO_DIR@\\"
73 http://www.gnu.org/software/autoconf/manual/html_node/Defining-Directories.html
75 If this check is wrong and the package really wants to have "\${" in the
76 macros, append the above filenames to the CHECK_HEADERS_SKIP variable in