2017-09-10 15:39:55 +00:00
|
|
|
# stdlib_h.m4 serial 44
|
2017-01-01 09:32:27 +00:00
|
|
|
dnl Copyright (C) 2007-2017 Free Software Foundation, Inc.
|
2011-02-16 00:33:44 +00:00
|
|
|
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
|
|
|
|
# include <sys/loadavg.h>
|
|
|
|
#endif
|
|
|
|
#if HAVE_RANDOM_H
|
|
|
|
# include <random.h>
|
|
|
|
#endif
|
2012-05-26 23:14:36 +00:00
|
|
|
]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
|
|
|
|
initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps
|
Merge from Gnulib; use ‘open’ for O_CLOEXEC
This incorporates:
2017-08-15 renameat: ensure declaration in <stdio.h> on NetBSD
2017-08-15 extensions: enable NetBSD specific extensions
2017-08-14 open: support O_CLOEXEC
2017-08-13 reallocarray: new module
* admin/merge-gnulib (AVOIDED_MODULES): Remove ‘open’, since
it now supports O_CLOEXEC and this simplifies Emacs.
* build-aux/config.guess, lib/fcntl.in.h, lib/stdio.in.h:
* lib/stdlib.in.h, m4/extensions.m4, m4/stdlib_h.m4:
Copy from Gnulib.
* lib/cloexec.c, lib/cloexec.h, lib/open.c:
* m4/mode_t.m4, m4/open-cloexec.m4, m4/open.m4:
New files, copied from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib-src/etags.c (O_CLOEXEC) [WINDOWSNT]:
Remove, as Gnulib does this for us.
* src/filelock.c (create_lock_file):
* src/sysdep.c (emacs_open, emacs_pipe):
Don’t worry about O_CLOEXEC == 0, as Gnulib no longer sets it to 0.
2017-08-16 20:55:46 +00:00
|
|
|
posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray
|
|
|
|
realpath rpmatch secure_getenv setenv setstate setstate_r srandom
|
|
|
|
srandom_r strtod strtoll strtoull unlockpt unsetenv])
|
2011-02-16 00:33:44 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
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])
|
2011-02-25 07:23:41 +00:00
|
|
|
GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC])
|
2011-02-16 00:33:44 +00:00
|
|
|
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])
|
2012-05-26 23:14:36 +00:00
|
|
|
GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT])
|
2011-02-16 00:33:44 +00:00
|
|
|
GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME])
|
2012-05-26 23:14:36 +00:00
|
|
|
GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R])
|
2011-02-16 00:33:44 +00:00
|
|
|
GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
|
Vector-sorting fixes.
It's not safe to call qsort or qsort_r, since they have undefined
behavior if the user-specified predicate is not a total order.
Also, watch out for garbage-collection while sorting vectors.
* admin/merge-gnulib (GNULIB_MODULES): Add vla.
* configure.ac (qsort_r): Remove, as we no longer use qsort-like
functions.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/vla.h, m4/vararrays.m4: New files, copied from gnulib.
* lib/stdlib.in.h, m4/stdlib_h.m4: Sync from gnulib, incorporating:
2014-08-29 qsort_r: new module, for GNU-style qsort_r
The previous two files' changes are boilerplate generated by
admin/merge-gnulib, and should not affect Emacs.
* src/fns.c: Include <vla.h>.
(sort_vector_predicate) [!HAVE_QSORT_R]: Remove.
(sort_vector_compare): Remove, replacing with ....
(inorder, merge_vectors, sort_vector_inplace, sort_vector_copy):
... these new functions.
(sort_vector): Rewrite to use the new functions.
GCPRO locals, since the predicate can invoke the GC.
Since it's in-place return void; caller changed.
(merge): Use 'inorder', for clarity.
Fixes: debbugs:18361
2014-08-30 22:59:39 +00:00
|
|
|
GNULIB_QSORT_R=0; AC_SUBST([GNULIB_QSORT_R])
|
2012-05-26 23:14:36 +00:00
|
|
|
GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM])
|
2011-02-16 00:33:44 +00:00
|
|
|
GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R])
|
Merge from Gnulib; use ‘open’ for O_CLOEXEC
This incorporates:
2017-08-15 renameat: ensure declaration in <stdio.h> on NetBSD
2017-08-15 extensions: enable NetBSD specific extensions
2017-08-14 open: support O_CLOEXEC
2017-08-13 reallocarray: new module
* admin/merge-gnulib (AVOIDED_MODULES): Remove ‘open’, since
it now supports O_CLOEXEC and this simplifies Emacs.
* build-aux/config.guess, lib/fcntl.in.h, lib/stdio.in.h:
* lib/stdlib.in.h, m4/extensions.m4, m4/stdlib_h.m4:
Copy from Gnulib.
* lib/cloexec.c, lib/cloexec.h, lib/open.c:
* m4/mode_t.m4, m4/open-cloexec.m4, m4/open.m4:
New files, copied from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib-src/etags.c (O_CLOEXEC) [WINDOWSNT]:
Remove, as Gnulib does this for us.
* src/filelock.c (create_lock_file):
* src/sysdep.c (emacs_open, emacs_pipe):
Don’t worry about O_CLOEXEC == 0, as Gnulib no longer sets it to 0.
2017-08-16 20:55:46 +00:00
|
|
|
GNULIB_REALLOCARRAY=0; AC_SUBST([GNULIB_REALLOCARRAY])
|
2011-02-16 00:33:44 +00:00
|
|
|
GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
|
|
|
|
GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH])
|
|
|
|
GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH])
|
2013-02-08 23:37:17 +00:00
|
|
|
GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV])
|
2011-02-16 00:33:44 +00:00
|
|
|
GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV])
|
|
|
|
GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
|
|
|
|
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])
|
2011-02-25 07:23:41 +00:00
|
|
|
GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB])
|
2011-02-16 00:33:44 +00:00
|
|
|
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])
|
2017-09-10 15:39:55 +00:00
|
|
|
HAVE_DECL_INITSTATE=1; AC_SUBST([HAVE_DECL_INITSTATE])
|
2011-02-16 00:33:44 +00:00
|
|
|
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])
|
2012-05-26 23:14:36 +00:00
|
|
|
HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT])
|
2011-02-16 00:33:44 +00:00
|
|
|
HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
|
2012-05-26 23:14:36 +00:00
|
|
|
HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R])
|
2016-10-27 15:27:13 +00:00
|
|
|
HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R])
|
2012-05-26 23:14:36 +00:00
|
|
|
HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM])
|
2011-02-16 00:33:44 +00:00
|
|
|
HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
|
|
|
|
HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
|
Merge from Gnulib; use ‘open’ for O_CLOEXEC
This incorporates:
2017-08-15 renameat: ensure declaration in <stdio.h> on NetBSD
2017-08-15 extensions: enable NetBSD specific extensions
2017-08-14 open: support O_CLOEXEC
2017-08-13 reallocarray: new module
* admin/merge-gnulib (AVOIDED_MODULES): Remove ‘open’, since
it now supports O_CLOEXEC and this simplifies Emacs.
* build-aux/config.guess, lib/fcntl.in.h, lib/stdio.in.h:
* lib/stdlib.in.h, m4/extensions.m4, m4/stdlib_h.m4:
Copy from Gnulib.
* lib/cloexec.c, lib/cloexec.h, lib/open.c:
* m4/mode_t.m4, m4/open-cloexec.m4, m4/open.m4:
New files, copied from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib-src/etags.c (O_CLOEXEC) [WINDOWSNT]:
Remove, as Gnulib does this for us.
* src/filelock.c (create_lock_file):
* src/sysdep.c (emacs_open, emacs_pipe):
Don’t worry about O_CLOEXEC == 0, as Gnulib no longer sets it to 0.
2017-08-16 20:55:46 +00:00
|
|
|
HAVE_REALLOCARRAY=1; AC_SUBST([HAVE_REALLOCARRAY])
|
2011-02-16 00:33:44 +00:00
|
|
|
HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
|
|
|
|
HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
|
2013-02-08 23:37:17 +00:00
|
|
|
HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV])
|
2011-02-16 00:33:44 +00:00
|
|
|
HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
|
|
|
|
HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV])
|
2017-09-10 15:39:55 +00:00
|
|
|
HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE])
|
2011-02-16 00:33:44 +00:00
|
|
|
HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD])
|
|
|
|
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])
|
|
|
|
REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC])
|
2011-02-25 07:23:41 +00:00
|
|
|
REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC])
|
2011-02-16 00:33:44 +00:00
|
|
|
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
|
2012-10-04 07:15:42 +00:00
|
|
|
REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME])
|
2012-05-26 23:14:36 +00:00
|
|
|
REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R])
|
2011-02-16 00:33:44 +00:00
|
|
|
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
|
Vector-sorting fixes.
It's not safe to call qsort or qsort_r, since they have undefined
behavior if the user-specified predicate is not a total order.
Also, watch out for garbage-collection while sorting vectors.
* admin/merge-gnulib (GNULIB_MODULES): Add vla.
* configure.ac (qsort_r): Remove, as we no longer use qsort-like
functions.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/vla.h, m4/vararrays.m4: New files, copied from gnulib.
* lib/stdlib.in.h, m4/stdlib_h.m4: Sync from gnulib, incorporating:
2014-08-29 qsort_r: new module, for GNU-style qsort_r
The previous two files' changes are boilerplate generated by
admin/merge-gnulib, and should not affect Emacs.
* src/fns.c: Include <vla.h>.
(sort_vector_predicate) [!HAVE_QSORT_R]: Remove.
(sort_vector_compare): Remove, replacing with ....
(inorder, merge_vectors, sort_vector_inplace, sort_vector_copy):
... these new functions.
(sort_vector): Rewrite to use the new functions.
GCPRO locals, since the predicate can invoke the GC.
Since it's in-place return void; caller changed.
(merge): Use 'inorder', for clarity.
Fixes: debbugs:18361
2014-08-30 22:59:39 +00:00
|
|
|
REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R])
|
2012-05-26 23:14:36 +00:00
|
|
|
REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R])
|
2011-02-16 00:33:44 +00:00
|
|
|
REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC])
|
|
|
|
REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
|
|
|
|
REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV])
|
|
|
|
REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD])
|
|
|
|
REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV])
|
2011-02-25 07:23:41 +00:00
|
|
|
REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB])
|
2011-02-16 00:33:44 +00:00
|
|
|
])
|