ax_assert.m4 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # ===========================================================================
  2. # https://github.com/BrianAker/ddm4/
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_ASSERT()
  8. #
  9. # DESCRIPTION
  10. #
  11. # --enable-assert
  12. #
  13. # LICENSE
  14. #
  15. # Copyright (C) 2012 Brian Aker
  16. # All rights reserved.
  17. #
  18. # Redistribution and use in source and binary forms, with or without
  19. # modification, are permitted provided that the following conditions are
  20. # met:
  21. #
  22. # * Redistributions of source code must retain the above copyright
  23. # notice, this list of conditions and the following disclaimer.
  24. #
  25. # * Redistributions in binary form must reproduce the above
  26. # copyright notice, this list of conditions and the following disclaimer
  27. # in the documentation and/or other materials provided with the
  28. # distribution.
  29. #
  30. # * The names of its contributors may not be used to endorse or
  31. # promote products derived from this software without specific prior
  32. # written permission.
  33. #
  34. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  35. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  36. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  37. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  38. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  39. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  40. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  41. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  42. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  43. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  44. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  45. #serial 6
  46. AC_DEFUN([AX_ASSERT],
  47. [AC_PREREQ([2.63])dnl
  48. AC_REQUIRE([AX_DEBUG])
  49. AC_REQUIRE([AX_VCS_CHECKOUT])
  50. AC_ARG_ENABLE([assert],
  51. [AS_HELP_STRING([--enable-assert],
  52. [Enable assert, this will be overridden by --enable-debug (yes|no) @<:@default=no@:>@])],
  53. [ax_enable_assert=yes],
  54. [ax_enable_assert=no])
  55. AS_IF([ test "$ax_enable_assert" = "yes" -o "$ax_enable_debug" = "yes" -o "$ac_cv_vcs_checkout" = "yes" ],
  56. [ax_enable_assert="yes"],
  57. [ax_enable_assert="no"
  58. AC_DEFINE(NDEBUG,[1],[Define to 1 to disable assert'ing code.])])
  59. AC_MSG_CHECKING([for assert])
  60. AC_MSG_RESULT([$ax_enable_assert])
  61. ])