Reverse the order that the config.h file and <nbcompat.h> are included,

since the latter has all sorts of checks to make sure we don't stomp on
any macros defined in config.h, but the reverse isn't true.
This commit is contained in:
jlam 2003-09-02 08:07:16 +00:00
parent f858f18045
commit df790619d3

View file

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: src2nbcompat,v 1.2 2003/09/01 22:49:42 jlam Exp $
# $NetBSD: src2nbcompat,v 1.3 2003/09/02 08:07:16 jlam Exp $
#
# Copyright (c) 2003 The NetBSD Foundation, Inc.
# All rights reserved.
@ -87,15 +87,20 @@ for f in $files; do
# "#if HAVE_FOO_H ... #endif" guards.
#
awk ' \
BEGIN { seen = 0 } \
/^\#[ ]*include[ ]+<[^ ]*>/ { \
guard = toupper(gensub("[-/.]", "_", "g", gensub("\#[ ]*include[ ]+<\([^ ]*\)>", "HAVE_\\1", "g"))); \
if (seen == 0) { \
print "\#include <nbcompat.h>"; \
BEGIN { config = 0; nbcompat = 0 } \
/^\#[ ]*include[ ]+/ { \
if (config == 0) { \
print "\#if HAVE_CONFIG_H"; \
print "\#include \"config.h\""; \
print "\#endif"; \
seen = 1; \
config = 1; \
} \
} \
/^\#[ ]*include[ ]+<[^ ]*>/ { \
guard = toupper(gensub("[-/.]", "_", "g", gensub("\#[ ]*include[ ]+<\([^ ]*\)>", "HAVE_\\1", "g"))); \
if (nbcompat == 0) { \
print "\#include <nbcompat.h>"; \
nbcompat = 1; \
}; \
print "\#if " guard; \
print $0; \