Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.8KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_prog_splint.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_PROG_SPLINT([AX_SPLINTFLAGS])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Check for program splint, the static C code checking tool. The splint
  12. # URL is given by http://www.splint.org. This macro should be use together
  13. # with automake.
  14. #
  15. # Enables following environment variables:
  16. #
  17. # SPLINT
  18. # SPLINTFLAGS
  19. #
  20. # and AX_SPLINTFLAGS is given by AC_SUBST. If AX_SPLINTFLAGS is not given
  21. # by AX_PROG_SPLINT it defaults to "-weak".
  22. #
  23. # Enables the following make target:
  24. #
  25. # splint-check
  26. #
  27. # which runs splint per PROGRAMS and LIBRARIES. Output from splint run is
  28. # collected in file ***_splint.log where *** is given by the PROGRAMS or
  29. # LIBRARIES name.
  30. #
  31. # The following line is required in Makefile.am:
  32. #
  33. # include aminclude_static.am
  34. #
  35. # LICENSE
  36. #
  37. # Copyright (c) 2011 Henrik Uhrenholt
  38. #
  39. # Copying and distribution of this file, with or without modification, are
  40. # permitted in any medium without royalty provided the copyright notice
  41. # and this notice are preserved. This file is offered as-is, without any
  42. # warranty.
  43. #serial 3
  44. AC_DEFUN([AX_PROG_SPLINT],
  45. [
  46. AC_REQUIRE([AX_ADD_AM_MACRO_STATIC])
  47. AC_ARG_VAR([SPLINT], [splint executable])
  48. AC_ARG_VAR([SPLINTFLAGS], [splint flags])
  49. if test "x$SPLINT" = "x"; then
  50. AC_CHECK_PROGS([SPLINT], [splint])
  51. fi
  52. if test "x$SPLINT" != "x"; then
  53. ax_splintflags=$1
  54. if test "x$1" = "x"; then
  55. ax_splintflags=-weak
  56. fi
  57. AC_SUBST([AX_SPLINTFLAGS], [$ax_splintflags])
  58. ax_prog_splint_enable=yes
  59. else
  60. AC_MSG_WARN([splint support disabled])
  61. ax_prog_splint_enable=no
  62. fi
  63. AM_CONDITIONAL([ax_prog_splint_enable], [test x"$ax_prog_splint_enable" = x"yes"])
  64. AX_ADD_AM_MACRO_STATIC([
  65. if ax_prog_splint_enable
  66. define splint_rules
  67. \$(1)_splint.log: \$${AX_DOLLAR}(\$(1)_OBJECTS)
  68. -\$(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}@
  69. endef
  70. SPLINT_BIN=\$(subst /,_,\$(PROGRAMS:\$(EXEEXT)=))
  71. SPLINT_LIB=\$(subst /,_,\$(LIBRARIES:.a=_a))
  72. SPLINT_LTLIB=\$(subst /,_,\$(LTLIBRARIES:.la=_la))
  73. SPLINTFILES=\$(addsuffix _splint.log,\$(SPLINT_LIB) \$(SPLINT_BIN) \$(SPLINT_LTLIB))
  74. splint-check: all \$(SPLINTFILES)
  75. \$(foreach bin, \$(SPLINT_BIN) \$(SPLINT_LIB) \$(SPLINT_LTLIB),\$(eval \$(call splint_rules,\$(bin))))
  76. endif
  77. .PHONY: clean-local-splint distclean-local-splint
  78. clean-local: clean-local-splint
  79. clean-local-splint:
  80. -test -z \"\$(SPLINTFILES)\" || rm -f \$(SPLINTFILES)
  81. distclean-local: distclean-local-splint
  82. distclean-local-splint: clean-local-splint
  83. ])
  84. ])