summaryrefslogtreecommitdiffstats
path: root/tools/checkconfig.sh
diff options
context:
space:
mode:
authorKarel Zak2008-11-26 12:48:37 +0100
committerKarel Zak2008-11-26 12:59:41 +0100
commit685758e852db5ad1c50116725662741433298e7b (patch)
tree31bd353cc43799c1a3ada18d7c4429aed87780ac /tools/checkconfig.sh
parenttools: add checkincludes.pl (from linux kernel) (diff)
downloadkernel-qcow2-util-linux-685758e852db5ad1c50116725662741433298e7b.tar.gz
kernel-qcow2-util-linux-685758e852db5ad1c50116725662741433298e7b.tar.xz
kernel-qcow2-util-linux-685758e852db5ad1c50116725662741433298e7b.zip
tools: rename codecheck-config to checkconfig.sh
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tools/checkconfig.sh')
-rwxr-xr-xtools/checkconfig.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/checkconfig.sh b/tools/checkconfig.sh
new file mode 100755
index 000000000..ff38bac7d
--- /dev/null
+++ b/tools/checkconfig.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+#
+# This script checks for HAVE_ and ENABLE_ macros which are
+# not included in config.h.in
+#
+# Copyright (C) 2007 Matthias Koenig <mkoenig@suse.de>
+#
+
+srcdir=$1
+
+if [ ! "$srcdir" ]; then
+ srcdir=$PWD
+fi
+
+CONFIG="$srcdir/config.h.in"
+if [ ! -f "$CONFIG" ]; then
+ echo "config.h.in is needed"
+ exit 1
+fi
+
+SOURCES=$(find $srcdir -name "*.c")
+
+for f in $SOURCES; do
+ DEFINES=$(sed -n -e 's/.*[ \t(]\+\(HAVE_[[:alnum:]]\+[^ \t);]*\).*/\1/p' \
+ -e 's/.*[ \t(]\+\(ENABLE_[[:alnum:]]\+[^ \t);]*\).*/\1/p' \
+ $f | sort -u)
+ [ -z "$DEFINES" ] && continue
+
+ for d in $DEFINES; do
+ case $d in
+ HAVE_CONFIG_H) continue;;
+ *) grep -q "$d\( \|\>\)" $CONFIG || echo $(echo $f | sed 's:'$srcdir/'::') ": $d"
+
+ ;;
+ esac
+ done
+done