grantpt: Remove unnecessary dependency.
[gnulib.git] / m4 / assert_h.m4
blobe3fd4d3de953e2070583fe0ad6533747fe86c7b2
1 # assert-h.m4
2 dnl Copyright (C) 2011-2018 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 dnl From Paul Eggert.
9 AC_DEFUN([gl_ASSERT_H],
11   ASSERT_H=
12   AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert],
13     [AC_COMPILE_IFELSE(
14        [AC_LANG_PROGRAM(
15           [[#include <assert.h>
16             static_assert (2 + 2 == 4, "arithmetic doesn't work");
17           ]],
18           [[
19             static_assert (sizeof (char) == 1, "sizeof doesn't work");
20           ]])],
21        [gl_cv_static_assert=yes],
22        [gl_cv_static_assert=no])])
23   if test $gl_cv_static_assert = no; then
24     ASSERT_H=assert.h
25     gl_NEXT_HEADERS([assert.h])
26   fi
27   AC_SUBST([ASSERT_H])
28   AM_CONDITIONAL([GL_GENERATE_ASSERT_H], [test -n "$ASSERT_H"])