annotate m4/stddef_h.m4 @ 40196:e63f5d3edab5

relocatable-prog: Update documentation. * doc/relocatable-maint.texi (Supporting Relocation): Update to match the recent changes.
author Bruno Haible <bruno@clisp.org>
date Sun, 24 Feb 2019 01:49:15 +0100
parents b06060465f09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17830
06d818b9ca43 stddef: support C11's max_align_t
Paul Eggert <eggert@cs.ucla.edu>
parents: 17576
diff changeset
1 dnl A placeholder for <stddef.h>, for platforms that have issues.
39826
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
2 # stddef_h.m4 serial 6
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 39826
diff changeset
3 dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
4 dnl This file is free software; the Free Software Foundation
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
5 dnl gives unlimited permission to copy and/or distribute it,
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
6 dnl with or without modifications, as long as this notice is preserved.
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
7
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
8 AC_DEFUN([gl_STDDEF_H],
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
9 [
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
10 AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
11 AC_REQUIRE([gt_TYPE_WCHAR_T])
14528
662ae53d8d37 Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents: 14181
diff changeset
12 STDDEF_H=
39826
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
13
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
14 dnl Test whether the type max_align_t exists and whether its alignment
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
15 dnl "is as great as is supported by the implementation in all contexts".
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
16 AC_CACHE_CHECK([for good max_align_t],
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
17 [gl_cv_type_max_align_t],
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
18 [AC_COMPILE_IFELSE(
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
19 [AC_LANG_PROGRAM(
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
20 [[#include <stddef.h>
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
21 unsigned int s = sizeof (max_align_t);
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
22 #if defined __GNUC__ || defined __IBM__ALIGNOF__
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
23 int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1];
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
24 int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1];
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
25 #endif
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
26 ]])],
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
27 [gl_cv_type_max_align_t=yes],
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
28 [gl_cv_type_max_align_t=no])
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
29 ])
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
30 if test $gl_cv_type_max_align_t = no; then
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
31 HAVE_MAX_ALIGN_T=0
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
32 STDDEF_H=stddef.h
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
33 fi
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
34
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
35 if test $gt_cv_c_wchar_t = no; then
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
36 HAVE_WCHAR_T=0
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
37 STDDEF_H=stddef.h
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
38 fi
39826
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
39
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
40 AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
41 [gl_cv_decl_null_works],
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
42 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
43 int test[2 * (sizeof NULL == sizeof (void *)) -1];
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
44 ]])],
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
45 [gl_cv_decl_null_works=yes],
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
46 [gl_cv_decl_null_works=no])])
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
47 if test $gl_cv_decl_null_works = no; then
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
48 REPLACE_NULL=1
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
49 STDDEF_H=stddef.h
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
50 fi
39826
4bc6c3133bdd stddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
51
14528
662ae53d8d37 Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents: 14181
diff changeset
52 AC_SUBST([STDDEF_H])
662ae53d8d37 Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents: 14181
diff changeset
53 AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"])
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
54 if test -n "$STDDEF_H"; then
14181
bceb1351a723 include_next: do not check for standard headers like stddef.h
Paul Eggert <eggert@cs.ucla.edu>
parents: 14079
diff changeset
55 gl_NEXT_HEADERS([stddef.h])
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
56 fi
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
57 ])
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
58
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
59 AC_DEFUN([gl_STDDEF_MODULE_INDICATOR],
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
60 [
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
61 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
62 AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
13066
fc8c984b0733 Factorize common .m4 code.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
63 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
64 ])
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
65
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
66 AC_DEFUN([gl_STDDEF_H_DEFAULTS],
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
67 [
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
68 dnl Assume proper GNU behavior unless another module says otherwise.
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
69 REPLACE_NULL=0; AC_SUBST([REPLACE_NULL])
17830
06d818b9ca43 stddef: support C11's max_align_t
Paul Eggert <eggert@cs.ucla.edu>
parents: 17576
diff changeset
70 HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T])
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
71 HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T])
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
72 ])