stdlib_h.m4 6.59 KB
Newer Older
Paul Eggert's avatar
Paul Eggert committed
1
# stdlib_h.m4 serial 48
2
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
3 4 5 6 7 8 9 10 11 12 13 14 15 16
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

AC_DEFUN([gl_STDLIB_H],
[
  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
  gl_NEXT_HEADERS([stdlib.h])

  dnl Check for declarations of anything we want to poison if the
  dnl corresponding gnulib module is not in use, and which is not
  dnl guaranteed by C89.
  gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
#if HAVE_SYS_LOADAVG_H
Paul Eggert's avatar
Paul Eggert committed
17 18 19
/* OpenIndiana has a bug: <sys/time.h> must be included before
   <sys/loadavg.h>.  */
# include <sys/time.h>
20 21 22 23 24
# include <sys/loadavg.h>
#endif
#if HAVE_RANDOM_H
# include <random.h>
#endif
Paul Eggert's avatar
Paul Eggert committed
25
    ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
Paul Eggert's avatar
Paul Eggert committed
26
    initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps
27 28
    posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray
    realpath rpmatch secure_getenv setenv setstate setstate_r srandom
Paul Eggert's avatar
Paul Eggert committed
29
    srandom_r strtod strtold strtoll strtoull unlockpt unsetenv])
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
])

AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
[
  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  dnl Define it also as a C macro, for the benefit of the unit tests.
  gl_MODULE_INDICATOR_FOR_TESTS([$1])
])

AC_DEFUN([gl_STDLIB_H_DEFAULTS],
[
  GNULIB__EXIT=0;         AC_SUBST([GNULIB__EXIT])
  GNULIB_ATOLL=0;         AC_SUBST([GNULIB_ATOLL])
  GNULIB_CALLOC_POSIX=0;  AC_SUBST([GNULIB_CALLOC_POSIX])
  GNULIB_CANONICALIZE_FILE_NAME=0;  AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME])
  GNULIB_GETLOADAVG=0;    AC_SUBST([GNULIB_GETLOADAVG])
  GNULIB_GETSUBOPT=0;     AC_SUBST([GNULIB_GETSUBOPT])
  GNULIB_GRANTPT=0;       AC_SUBST([GNULIB_GRANTPT])
  GNULIB_MALLOC_POSIX=0;  AC_SUBST([GNULIB_MALLOC_POSIX])
Paul Eggert's avatar
Paul Eggert committed
51
  GNULIB_MBTOWC=0;        AC_SUBST([GNULIB_MBTOWC])
52 53 54 55 56
  GNULIB_MKDTEMP=0;       AC_SUBST([GNULIB_MKDTEMP])
  GNULIB_MKOSTEMP=0;      AC_SUBST([GNULIB_MKOSTEMP])
  GNULIB_MKOSTEMPS=0;     AC_SUBST([GNULIB_MKOSTEMPS])
  GNULIB_MKSTEMP=0;       AC_SUBST([GNULIB_MKSTEMP])
  GNULIB_MKSTEMPS=0;      AC_SUBST([GNULIB_MKSTEMPS])
Paul Eggert's avatar
Paul Eggert committed
57
  GNULIB_POSIX_OPENPT=0;  AC_SUBST([GNULIB_POSIX_OPENPT])
58
  GNULIB_PTSNAME=0;       AC_SUBST([GNULIB_PTSNAME])
Paul Eggert's avatar
Paul Eggert committed
59
  GNULIB_PTSNAME_R=0;     AC_SUBST([GNULIB_PTSNAME_R])
60
  GNULIB_PUTENV=0;        AC_SUBST([GNULIB_PUTENV])
Paul Eggert's avatar
Paul Eggert committed
61
  GNULIB_QSORT_R=0;       AC_SUBST([GNULIB_QSORT_R])
Paul Eggert's avatar
Paul Eggert committed
62
  GNULIB_RANDOM=0;        AC_SUBST([GNULIB_RANDOM])
63
  GNULIB_RANDOM_R=0;      AC_SUBST([GNULIB_RANDOM_R])
64
  GNULIB_REALLOCARRAY=0;  AC_SUBST([GNULIB_REALLOCARRAY])
65 66 67
  GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
  GNULIB_REALPATH=0;      AC_SUBST([GNULIB_REALPATH])
  GNULIB_RPMATCH=0;       AC_SUBST([GNULIB_RPMATCH])
Paul Eggert's avatar
Paul Eggert committed
68
  GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV])
69 70
  GNULIB_SETENV=0;        AC_SUBST([GNULIB_SETENV])
  GNULIB_STRTOD=0;        AC_SUBST([GNULIB_STRTOD])
Paul Eggert's avatar
Paul Eggert committed
71
  GNULIB_STRTOLD=0;       AC_SUBST([GNULIB_STRTOLD])
72 73 74 75 76
  GNULIB_STRTOLL=0;       AC_SUBST([GNULIB_STRTOLL])
  GNULIB_STRTOULL=0;      AC_SUBST([GNULIB_STRTOULL])
  GNULIB_SYSTEM_POSIX=0;  AC_SUBST([GNULIB_SYSTEM_POSIX])
  GNULIB_UNLOCKPT=0;      AC_SUBST([GNULIB_UNLOCKPT])
  GNULIB_UNSETENV=0;      AC_SUBST([GNULIB_UNSETENV])
Paul Eggert's avatar
Paul Eggert committed
77
  GNULIB_WCTOMB=0;        AC_SUBST([GNULIB_WCTOMB])
78 79 80 81 82 83 84
  dnl Assume proper GNU behavior unless another module says otherwise.
  HAVE__EXIT=1;              AC_SUBST([HAVE__EXIT])
  HAVE_ATOLL=1;              AC_SUBST([HAVE_ATOLL])
  HAVE_CANONICALIZE_FILE_NAME=1;  AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
  HAVE_DECL_GETLOADAVG=1;    AC_SUBST([HAVE_DECL_GETLOADAVG])
  HAVE_GETSUBOPT=1;          AC_SUBST([HAVE_GETSUBOPT])
  HAVE_GRANTPT=1;            AC_SUBST([HAVE_GRANTPT])
Paul Eggert's avatar
Paul Eggert committed
85
  HAVE_INITSTATE=1;          AC_SUBST([HAVE_INITSTATE])
Paul Eggert's avatar
Paul Eggert committed
86
  HAVE_DECL_INITSTATE=1;     AC_SUBST([HAVE_DECL_INITSTATE])
Paul Eggert's avatar
Paul Eggert committed
87
  HAVE_MBTOWC=1;             AC_SUBST([HAVE_MBTOWC])
88 89 90 91 92
  HAVE_MKDTEMP=1;            AC_SUBST([HAVE_MKDTEMP])
  HAVE_MKOSTEMP=1;           AC_SUBST([HAVE_MKOSTEMP])
  HAVE_MKOSTEMPS=1;          AC_SUBST([HAVE_MKOSTEMPS])
  HAVE_MKSTEMP=1;            AC_SUBST([HAVE_MKSTEMP])
  HAVE_MKSTEMPS=1;           AC_SUBST([HAVE_MKSTEMPS])
Paul Eggert's avatar
Paul Eggert committed
93
  HAVE_POSIX_OPENPT=1;       AC_SUBST([HAVE_POSIX_OPENPT])
94
  HAVE_PTSNAME=1;            AC_SUBST([HAVE_PTSNAME])
Paul Eggert's avatar
Paul Eggert committed
95
  HAVE_PTSNAME_R=1;          AC_SUBST([HAVE_PTSNAME_R])
Paul Eggert's avatar
Paul Eggert committed
96
  HAVE_QSORT_R=1;            AC_SUBST([HAVE_QSORT_R])
Paul Eggert's avatar
Paul Eggert committed
97
  HAVE_RANDOM=1;             AC_SUBST([HAVE_RANDOM])
98 99
  HAVE_RANDOM_H=1;           AC_SUBST([HAVE_RANDOM_H])
  HAVE_RANDOM_R=1;           AC_SUBST([HAVE_RANDOM_R])
100
  HAVE_REALLOCARRAY=1;       AC_SUBST([HAVE_REALLOCARRAY])
101 102
  HAVE_REALPATH=1;           AC_SUBST([HAVE_REALPATH])
  HAVE_RPMATCH=1;            AC_SUBST([HAVE_RPMATCH])
Paul Eggert's avatar
Paul Eggert committed
103
  HAVE_SECURE_GETENV=1;      AC_SUBST([HAVE_SECURE_GETENV])
104 105
  HAVE_SETENV=1;             AC_SUBST([HAVE_SETENV])
  HAVE_DECL_SETENV=1;        AC_SUBST([HAVE_DECL_SETENV])
Paul Eggert's avatar
Paul Eggert committed
106
  HAVE_SETSTATE=1;           AC_SUBST([HAVE_SETSTATE])
Paul Eggert's avatar
Paul Eggert committed
107
  HAVE_DECL_SETSTATE=1;      AC_SUBST([HAVE_DECL_SETSTATE])
108
  HAVE_STRTOD=1;             AC_SUBST([HAVE_STRTOD])
Paul Eggert's avatar
Paul Eggert committed
109
  HAVE_STRTOLD=1;            AC_SUBST([HAVE_STRTOLD])
110 111 112 113 114 115 116 117
  HAVE_STRTOLL=1;            AC_SUBST([HAVE_STRTOLL])
  HAVE_STRTOULL=1;           AC_SUBST([HAVE_STRTOULL])
  HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
  HAVE_SYS_LOADAVG_H=0;      AC_SUBST([HAVE_SYS_LOADAVG_H])
  HAVE_UNLOCKPT=1;           AC_SUBST([HAVE_UNLOCKPT])
  HAVE_DECL_UNSETENV=1;      AC_SUBST([HAVE_DECL_UNSETENV])
  REPLACE_CALLOC=0;          AC_SUBST([REPLACE_CALLOC])
  REPLACE_CANONICALIZE_FILE_NAME=0;  AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
Paul Eggert's avatar
Paul Eggert committed
118
  REPLACE_INITSTATE=0;       AC_SUBST([REPLACE_INITSTATE])
119
  REPLACE_MALLOC=0;          AC_SUBST([REPLACE_MALLOC])
Paul Eggert's avatar
Paul Eggert committed
120
  REPLACE_MBTOWC=0;          AC_SUBST([REPLACE_MBTOWC])
121
  REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
Paul Eggert's avatar
Paul Eggert committed
122
  REPLACE_PTSNAME=0;         AC_SUBST([REPLACE_PTSNAME])
Paul Eggert's avatar
Paul Eggert committed
123
  REPLACE_PTSNAME_R=0;       AC_SUBST([REPLACE_PTSNAME_R])
124
  REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
Paul Eggert's avatar
Paul Eggert committed
125
  REPLACE_QSORT_R=0;         AC_SUBST([REPLACE_QSORT_R])
Paul Eggert's avatar
Paul Eggert committed
126
  REPLACE_RANDOM=0;          AC_SUBST([REPLACE_RANDOM])
Paul Eggert's avatar
Paul Eggert committed
127
  REPLACE_RANDOM_R=0;        AC_SUBST([REPLACE_RANDOM_R])
128 129 130
  REPLACE_REALLOC=0;         AC_SUBST([REPLACE_REALLOC])
  REPLACE_REALPATH=0;        AC_SUBST([REPLACE_REALPATH])
  REPLACE_SETENV=0;          AC_SUBST([REPLACE_SETENV])
Paul Eggert's avatar
Paul Eggert committed
131
  REPLACE_SETSTATE=0;        AC_SUBST([REPLACE_SETSTATE])
132
  REPLACE_STRTOD=0;          AC_SUBST([REPLACE_STRTOD])
Paul Eggert's avatar
Paul Eggert committed
133
  REPLACE_STRTOLD=0;         AC_SUBST([REPLACE_STRTOLD])
134
  REPLACE_UNSETENV=0;        AC_SUBST([REPLACE_UNSETENV])
Paul Eggert's avatar
Paul Eggert committed
135
  REPLACE_WCTOMB=0;          AC_SUBST([REPLACE_WCTOMB])
136
])