Comment on amaya-src-2.0a

On several different UNIX architectures, I'm building the
amaya-src-2.0a distribution fetched from

	http://www.w3.org/Amaya/User/SourceDist.html 

on Saturday, 15-May-1999.

On HP HP-UX 10.01, with CC=c89, I ran into a problem that arises
because of misplaced config.h includes, raising exactly the error
noted in the GNU autoconfig documentation in node
(autoconf.info)Configuration Headers, which says

	   The package should `#include' the configuration header file before
	any other header files, to prevent inconsistencies in declarations (for
	example, if it redefines `const').  Use `#include <config.h>' instead
	of `#include "config.h"', and pass the C compiler a `-I.' option (or
	`-I..'; whichever directory contains `config.h').  That way, even if
	the source directory is configured itself (perhaps to make a
	distribution), other build directories can also be configured without
	finding the `config.h' from the source directory.

A manual patch to the config.h file to remove the "#define const" line
let the build continue, and it is still in progress.  If it is of
interest, I can provide binary distributions of Amaya for the
architectures on which I've built it.

Since this problem may come up in other packages (including my own,
which I'm about to check), I wrote the script attached at the end of
this message, and here is its output on the latest Amaya source
release:

% ~/bin/find-misplaced-config-h-files.sh
./cpp/cppalloc.c:25:use <config.h> instead of "config.h"
./cpp/cpperror.c:26:use <config.h> instead of "config.h"
./cpp/cppexp.c:28:use <config.h> instead of "config.h"
./cpp/cppexp.c:28:misplaced config.h
./cpp/cpplib.c:41:use <config.h> instead of "config.h"
./cpp/cpplib.c:41:misplaced config.h
./cpp/cppmain.c:36:use <config.h> instead of "config.h"
./cpp/cppmain.c:36:misplaced config.h
./cpp/i386/i386.c:24:use <config.h> instead of "config.h"
./cpp/i386/i386.c:24:misplaced config.h
./cpp/i386/winnt.c:23:use <config.h> instead of "config.h"
./cpp/i386/winnt.c:23:misplaced config.h
./cpp/winnt/ld.c:22:use <config.h> instead of "config.h"
./thotlib/base/alloca.c:35:use <config.h> instead of "config.h"
./thotlib/base/alloca.c:35:misplaced config.h
./tools/mkdep/mkdep.c:10:use <config.h> instead of "config.h"
./tools/mkdep/mkdep.c:10:misplaced config.h

#! /bin/sh
# Search the current file tree for C and C++ source files, looking for
# ones that include <config.h> after others.  This is in violation of
# the GNU Project documentation in (autoconf.info)Configuration Headers,
# which says:
#
#	The package should `#include' the configuration header file
#	before any other header files, to prevent inconsistencies in
#	declarations (for example, if it redefines `const').  Use
#	`#include <config.h>' instead of `#include "config.h"', and
#	pass the C compiler a `-I.' option (or `-I..'; whichever
#	directory contains `config.h').  That way, even if the
#	source directory is configured itself (perhaps to make a
#	distribution), other build directories can also be
#	configured without finding the `config.h' from the source
#	directory.
#
# [17-May-1999]

AWKPROG='
FILENAME != LAST_FILENAME \
	{
		Include_Count = 0
		LAST_FILENAME = FILENAME
	}
/^[ \t]*#[ \t]*include/	\
	{
		Include_Count++
		if (match($0,/[<"]config[.]h[">]/))
		{
			if (match($0,/"config[.]h"/))
				print FILENAME ":" FNR ":use <config.h> instead of \"config.h\""
			if (Include_Count > 1)
				print FILENAME ":" FNR ":misplaced config.h"
			nextfile
		}
	}				
'

gawk "$AWKPROG" `find . -name '*.[cHcC]' -o -name '*.cxx' -o -name '*.c++' -o -name '*.cc' -o -name '*.CC' | sort `

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- Center for Scientific Computing       FAX: +1 801 585 1640, +1 801 581 4148 -
- University of Utah                    Internet e-mail: beebe@math.utah.edu  -
- Department of Mathematics, 322 INSCC                   beebe@acm.org        -
- 155 S 1400 E RM 233                                    beebe@ieee.org       -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe  -
-------------------------------------------------------------------------------

Received on Tuesday, 18 May 1999 05:04:31 UTC