summaryrefslogtreecommitdiff
path: root/m4/ax_prog_splint.m4
diff options
context:
space:
mode:
authorHenrik Uhrenholt <henrik.uhrenholt.gpl@gmail.com>2011-02-03 12:08:08 -0800
committerPeter Simons <simons@cryp.to>2011-02-03 21:55:37 +0100
commit3d38b2f4cf512334b678afa0ba492b8dd897ddec (patch)
treea55e7ffcd5f568e922f81308cffb43e75ae3ab75 /m4/ax_prog_splint.m4
parent4dfbee9579e1931e411238844564f26c06658e9f (diff)
downloadautoconf-archive-3d38b2f4cf512334b678afa0ba492b8dd897ddec.tar.gz
AX_PROG_SPLINT: initial version
Further details at <http://savannah.gnu.org/patch/?7453>.
Diffstat (limited to 'm4/ax_prog_splint.m4')
-rw-r--r--m4/ax_prog_splint.m495
1 files changed, 95 insertions, 0 deletions
diff --git a/m4/ax_prog_splint.m4 b/m4/ax_prog_splint.m4
new file mode 100644
index 0000000..f14dfae
--- /dev/null
+++ b/m4/ax_prog_splint.m4
@@ -0,0 +1,95 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_prog_splint.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PROG_SPLINT([AX_SPLINTFLAGS])
+#
+# DESCRIPTION
+#
+# Check for program splint. This macro should be use together with
+# automake.
+#
+# Enables following environment variables:
+#
+# SPLINT
+# SPLINTFLAGS
+#
+# and AX_SPLINTFLAGS is given by AC_SUBST. If AX_SPLINTFLAGS is not given
+# by AX_PROG_SPLINT it defaults to "-weak".
+#
+# Enables the following make target:
+#
+# splint-check
+#
+# which runs splint per PROGRAMS and LIBRARIES. Output from splint run is
+# collected in file ***_splint.log where *** is given by the PROGRAMS or
+# LIBRARIES name.
+#
+# The following line is required in Makefile.am:
+#
+# include aminclude_static.am
+#
+# LICENSE
+#
+# Copyright (c) 2011 Henrik Uhrenholt
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 1
+
+AC_DEFUN([AX_PROG_SPLINT],
+[
+AC_ARG_VAR([SPLINT], [splint executable])
+AC_ARG_VAR([SPLINTFLAGS], [splint flags])
+if test "x$SPLINT" = "x"; then
+ AC_CHECK_PROGS([SPLINT], [splint])
+fi
+if test "x$SPLINT" != "x"; then
+ ax_splintflags=$1
+ if test "x$1" = "x"; then
+ ax_splintflags=-weak
+ fi
+ AC_SUBST([AX_SPLINTFLAGS], [$ax_splintflags])
+ ax_prog_splint_enable=yes
+else
+ AC_MSG_WARN([splint support disabled])
+ ax_prog_splint_enable=no
+fi
+AM_CONDITIONAL([ax_prog_splint_enable], [test x"$ax_prog_splint_enable" = x"yes"])
+
+AX_ADD_AM_MACRO_STATIC([
+if ax_prog_splint_enable
+
+define splint_rules
+\$(1)_splint.log: \$${AX_DOLLAR}(\$(1)_OBJECTS)
+ -\$(SPLINT) \$(AX_SPLINTFLAGS) \$(SPLINTFLAGS) \$(AM_SPLINTFLAGS) \$(DEFAULT_INCLUDES) \$(AM_CPPFLAGS) +error-stream-stdout +warning-stream-stdout \$${AX_DOLLAR}(addprefix \$(srcdir)/,\$${AX_DOLLAR}(\$(1)_SOURCES)) > \$${AX_DOLLAR}@
+endef
+
+
+SPLINT_BIN=\$(subst /,_,\$(PROGRAMS:\$(EXEEXT)=))
+SPLINT_LIB=\$(subst /,_,\$(LIBRARIES:.a=_a))
+SPLINTFILES=\$(addsuffix _splint.log,\$(SPLINT_LIB) \$(SPLINT_BIN))
+
+splint-check: all \$(SPLINTFILES)
+
+\$(foreach bin, \$(SPLINT_BIN) \$(SPLINT_LIB),\$(eval \$(call splint_rules,\$(bin))))
+
+
+
+
+endif
+
+.PHONY: clean-local-splint distclean-local-splint
+clean-local: clean-local-splint
+clean-local-splint:
+ -test -z \"\$(SPLINTFILES)\" || rm -f \$(SPLINTFILES)
+
+distclean-local: distclean-local-splint
+distclean-local-splint: clean-local-splint
+])
+])