| 1 |
# assert.m4 |
| 2 |
# serial 8 |
| 3 |
dnl Copyright (C) 1998-1999, 2001, 2004, 2008-2025 Free Software Foundation, |
| 4 |
dnl Inc. |
| 5 |
dnl This file is free software; the Free Software Foundation |
| 6 |
dnl gives unlimited permission to copy and/or distribute it, |
| 7 |
dnl with or without modifications, as long as this notice is preserved. |
| 8 |
dnl This file is offered as-is, without any warranty. |
| 9 |
|
| 10 |
dnl based on code from Eleftherios Gkioulekas |
| 11 |
dnl Autoconf 2.60 provides AC_HEADER_ASSERT for the same purpose, but |
| 12 |
dnl it has broken semantics for --enable-assert until 2.64. |
| 13 |
AC_DEFUN([gl_ASSERT], |
| 14 |
[ |
| 15 |
AC_MSG_CHECKING([whether to enable assertions]) |
| 16 |
AC_ARG_ENABLE([assert], |
| 17 |
[AS_HELP_STRING([[--disable-assert]], [turn off assertions])], |
| 18 |
[AS_IF([test "x$enableval" = xno], |
| 19 |
[AC_DEFINE([NDEBUG], [1], |
| 20 |
[Define to 1 if assertions should be disabled.])], |
| 21 |
[test "x$enableval" != xyes], |
| 22 |
[AC_MSG_WARN([invalid argument supplied to --enable-assert]) |
| 23 |
enable_assert=yes])], |
| 24 |
[enable_assert=yes]) |
| 25 |
AC_MSG_RESULT([$enable_assert]) |
| 26 |
]) |