From 378c18e5f024ac5a8aef4cb40d7c9aa9633d144c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 16:30:35 +0200 Subject: Adding upstream version 2.38.1. Signed-off-by: Daniel Baumann --- tools/checkconfig.sh | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 tools/checkconfig.sh (limited to 'tools/checkconfig.sh') diff --git a/tools/checkconfig.sh b/tools/checkconfig.sh new file mode 100755 index 0000000..5f2063a --- /dev/null +++ b/tools/checkconfig.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +# +# This script checks for HAVE_ and ENABLE_ macros which are +# not included in config.h.in +# +# Usage: checkconfig.sh [ ...] +# +# Copyright (C) 2007 Matthias Koenig +# Copyright (C) 2008 Karel Zak +# + + +die() { + echo "error: $1" + exit 1 +} + +usage() { + echo "Usage:" + echo " $0 [ ...]" + echo "Example:" + echo " find . -name '*.c' | xargs $0 \$(git rev-parse --show-toplevel)" +} + +if [ $# -eq 0 ]; then + usage + exit 1 +fi +srcdir=$1 +config="$srcdir/config.h.in" + +[ -d "$srcdir" ] || die "$srcdir: not such directory." +[ -f "$config" ] || die "$config: not such file." + +shift + +while [ "$#" -ne 0 ]; do + srcfile=$1 + shift + + [ ! -f "$srcfile" ] && continue; + + # Note that we use HAVE_ macros since util-linux-ng-2.14. The + # previous version also have used ENABLE_ too. + # + # ENABLE_ and HAVE_ macros shouldn't be used for any other pupose that + # for config/build options. + # + DEFINES=$(sed -n -e 's/.*[ \t(]\+\(HAVE_[[:alnum:]]\+[^ \t);]*\).*/\1/p' \ + -e 's/.*[ \t(]\+\(ENABLE_[[:alnum:]]\+[^ \t);]*\).*/\1/p' \ + $srcfile | sort -u) + [ -z "$DEFINES" ] && continue + + for d in $DEFINES; do + case $d in + HAVE_CONFIG_H) continue + ;; + *) grep -q "$d\( \|\>\)" $config || \ + echo $(echo $srcfile | sed 's:\\'$srcdir/'::') ": $d" + ;; + esac + done +done -- cgit v1.2.3