]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tools: add small and stupid script to check HAVE_DECL_
authorKarel Zak <kzak@redhat.com>
Wed, 13 Jun 2012 09:59:29 +0000 (11:59 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 13 Jun 2012 09:59:29 +0000 (11:59 +0200)
 use 'make checkdecl' to run the script

Signed-off-by: Karel Zak <kzak@redhat.com>
Makefile.am
tools/checkdecl.sh [new file with mode: 0755]

index 055cc4d8bcd00f250f80da1d95ea1332f991c331..0f641418904e141ce798fed11364b2b2d13afd9e 100644 (file)
@@ -90,6 +90,9 @@ checkmans:
 checkxalloc:
        @ $(top_srcdir)/tools/checkxalloc.sh
 
+checkdecl:
+       @ $(top_srcdir)/tools/checkdecl.sh
+
 ENABLE_ALL = --enable-static-programs --enable-most-builds
 DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --disable-use-tty-group \
                            --disable-silent-rules $(ENABLE_ALL) \
diff --git a/tools/checkdecl.sh b/tools/checkdecl.sh
new file mode 100755 (executable)
index 0000000..bd9ee69
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+#
+# This script checkd for #ifdef HAVE_DECL_SYMBOL in code.
+#
+# Autoconf docs:
+#
+# Unlike the other autoconf â€˜AC_CHECK_*S’ macros, when a symbol is not
+# declared, HAVE_DECL_symbol is defined to â€˜0’ instead of leaving
+# HAVE_DECL_symbol undeclared. When you are sure that the check was performed,
+# use HAVE_DECL_symbol in #if.
+#
+
+if [ ! -f ./configure ]; then
+       echo "Not found configure script"
+       exit 1
+fi
+
+for decl in $(awk '/HAVE_DECL_.*ac_have_decl/ { print $2 }' configure); do 
+       git grep -nE '[[:blank:]]*#[[:blank:]]*if(ndef|def)[[:blank:]]*'$decl;
+done | sort -u