From 413e730b3ffd6ef77ca2fe1395cefc847b641429 Mon Sep 17 00:00:00 2001 From: rillig Date: Mon, 8 Jan 2007 11:06:44 +0000 Subject: Rewrote the config.h parsing code to work with both autoconf 2.13 and 2.59. Tested with devel/libslang, which is particularly nasty because it comes without a configure.ac file and also does not use the standard config.h filename. --- mk/bsd.pkg.debug.mk | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'mk/bsd.pkg.debug.mk') diff --git a/mk/bsd.pkg.debug.mk b/mk/bsd.pkg.debug.mk index 0aec7d07204..2c67bd5ccdd 100644 --- a/mk/bsd.pkg.debug.mk +++ b/mk/bsd.pkg.debug.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.debug.mk,v 1.12 2007/01/08 02:38:42 rillig Exp $ +# $NetBSD: bsd.pkg.debug.mk,v 1.13 2007/01/08 11:06:44 rillig Exp $ # # The `debug' target outputs the values of some commonly used variables @@ -87,26 +87,26 @@ _show-dbginfo-config.status: _show-dbginfo-config.h: .if !empty(CONFIGURE_DIRS:M*) ${_PKG_SILENT}${_PKG_DEBUG} set -e; \ - if ${TEST} -d ${WRKSRC:Q}; then cd ${WRKSRC:Q}; \ + [ -d ${WRKSRC} ] || exit 0; \ + print_config_h() { \ + printf "%s:\\n" "`pwd`/$$1"; \ + awk '/^#define / { print "\t"$$0; } /^\/\* #undef / { print "\t" $$2 " " $$3; }' < "$$1"; \ + printf "\\n"; \ + }; \ for cdir in ${CONFIGURE_DIRS}; do \ - ch="$${cdir}/config.h"; \ - if ${TEST} ! -f "$${ch}"; then \ - cac="$${cdir}/configure.ac"; \ - if ${TEST} ! -f "$${cac}"; then \ - cac="$${cdir}/configure.in"; \ - fi; \ - if ${TEST} ! -f "$${cac}"; then \ - continue; \ - fi; \ - ch="$${cdir}/"`${SED} -n 's,.*AC_CONFIG_HEADERS(\[\([[:graph:]]*\)\]).*,\1,p' < "$${cac}"`; \ - if ${TEST} ! -f "$${ch}"; then \ - continue; \ - fi; \ - fi; \ - ${PRINTF} "%s:\\n" "$${ch}"; \ - ${AWK} '/^#define / { print "\t"$$0; } /^\/\* #undef / { print "\t" $$2 " " $$3; }' < "$${ch}"; \ - ${PRINTF} "\\n"; \ - done; fi + cd ${WRKSRC}; [ -d "$$cdir" ] || continue; cd "$$cdir"; \ + [ ! -f config.h ] || { print_config_h config.h; continue; }; \ + [ ! -f config.status ] || { \ + : "autoconf 2.59"; \ + chs=`sed -n 's,^config_headers="\(.*\)".*,\1,p' config.status || true`; \ + : "autoconf 2.13"; \ + [ "$$chs" ] || chs=`sed -n 's,^ CONFIG_HEADERS="\([^:"]*\).*,\1,p' config.status || true`; \ + done=no; \ + for ch in $$chs; do print_config_h "$$ch"; done=yes; done; \ + [ $$done = no ] || continue; \ + }; \ + printf "WARNING: No config header found in `pwd`.\\n\\n"; \ + done .else @${DO_NADA} .endif -- cgit v1.2.3