summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2003-09-02 08:07:16 +0000
committerjlam <jlam@pkgsrc.org>2003-09-02 08:07:16 +0000
commitdf790619d3944e4d3a8599f5dbbf9579efc22944 (patch)
tree9916d62be2b03659a13945e3e24bb70b71ac68e2 /pkgtools
parentf858f1804501b53bed1f3862bd5a5f4f7c90e79e (diff)
downloadpkgsrc-df790619d3944e4d3a8599f5dbbf9579efc22944.tar.gz
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.
Diffstat (limited to 'pkgtools')
-rwxr-xr-xpkgtools/pkg_install/files/src2nbcompat19
1 files changed, 12 insertions, 7 deletions
diff --git a/pkgtools/pkg_install/files/src2nbcompat b/pkgtools/pkg_install/files/src2nbcompat
index c43feb13da2..3c4489e362b 100755
--- a/pkgtools/pkg_install/files/src2nbcompat
+++ b/pkgtools/pkg_install/files/src2nbcompat
@@ -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; \