summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2018-05-18 20:31:31 +0200
committerTim Rühsen <tim.ruehsen@gmx.de>2018-06-14 11:07:46 +0200
commit3f1dc3fe54b32b56471a3e964b840b9b46ae7e09 (patch)
treeec2dfe0d6c6e56c3482fecf0823a84c4d4235499 /src
parent0b73ac23e7e00e1bc3a0b4f1c1c21caec0c80901 (diff)
downloadgnutls-3f1dc3fe54b32b56471a3e964b840b9b46ae7e09.tar.gz
Add bootstrap + bootstrap.conf
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
Diffstat (limited to 'src')
-rw-r--r--src/gl/Makefile.am2046
-rw-r--r--src/gl/accept.c52
-rw-r--r--src/gl/alloca.c478
-rw-r--r--src/gl/alloca.in.h65
-rw-r--r--src/gl/arpa_inet.in.h140
-rw-r--r--src/gl/asnprintf.c34
-rw-r--r--src/gl/basename-lgpl.c75
-rw-r--r--src/gl/bind.c49
-rw-r--r--src/gl/c-ctype.c3
-rw-r--r--src/gl/c-ctype.h366
-rw-r--r--src/gl/close.c69
-rw-r--r--src/gl/connect.c56
-rw-r--r--src/gl/dirname-lgpl.c86
-rw-r--r--src/gl/dirname.h54
-rw-r--r--src/gl/dosname.h53
-rw-r--r--src/gl/dup2.c215
-rw-r--r--src/gl/errno.in.h279
-rw-r--r--src/gl/error.c406
-rw-r--r--src/gl/error.h75
-rw-r--r--src/gl/exitfail.c24
-rw-r--r--src/gl/exitfail.h18
-rw-r--r--src/gl/fd-hook.c116
-rw-r--r--src/gl/fd-hook.h119
-rw-r--r--src/gl/flexmember.h42
-rw-r--r--src/gl/float+.h147
-rw-r--r--src/gl/float.c33
-rw-r--r--src/gl/float.in.h188
-rw-r--r--src/gl/fseek.c30
-rw-r--r--src/gl/fseeko.c162
-rw-r--r--src/gl/fstat.c88
-rw-r--r--src/gl/ftell.c37
-rw-r--r--src/gl/ftello.c85
-rw-r--r--src/gl/gai_strerror.c92
-rw-r--r--src/gl/getaddrinfo.c443
-rw-r--r--src/gl/getdelim.c147
-rw-r--r--src/gl/getline.c27
-rw-r--r--src/gl/getpass.c231
-rw-r--r--src/gl/getpass.h30
-rw-r--r--src/gl/getpeername.c49
-rw-r--r--src/gl/getprogname.c151
-rw-r--r--src/gl/getprogname.h40
-rw-r--r--src/gl/gettext.h292
-rw-r--r--src/gl/gettime.c48
-rw-r--r--src/gl/gettimeofday.c154
-rw-r--r--src/gl/inet_ntop.c260
-rw-r--r--src/gl/inet_pton.c268
-rw-r--r--src/gl/intprops.h464
-rw-r--r--src/gl/itold.c28
-rw-r--r--src/gl/limits.in.h63
-rw-r--r--src/gl/listen.c49
-rw-r--r--src/gl/lseek.c67
-rw-r--r--src/gl/m4/00gnulib.m446
-rw-r--r--src/gl/m4/absolute-header.m4102
-rw-r--r--src/gl/m4/alloca.m4121
-rw-r--r--src/gl/m4/arpa_inet_h.m457
-rw-r--r--src/gl/m4/bison.m424
-rw-r--r--src/gl/m4/clock_time.m431
-rw-r--r--src/gl/m4/close.m433
-rw-r--r--src/gl/m4/dirname.m419
-rw-r--r--src/gl/m4/double-slash-root.m438
-rw-r--r--src/gl/m4/dup2.m4117
-rw-r--r--src/gl/m4/eealloc.m431
-rw-r--r--src/gl/m4/environ.m447
-rw-r--r--src/gl/m4/errno_h.m4137
-rw-r--r--src/gl/m4/error.m427
-rw-r--r--src/gl/m4/exponentd.m4116
-rw-r--r--src/gl/m4/extensions.m4173
-rw-r--r--src/gl/m4/extern-inline.m4102
-rw-r--r--src/gl/m4/flexmember.m443
-rw-r--r--src/gl/m4/float_h.m498
-rw-r--r--src/gl/m4/fseek.m415
-rw-r--r--src/gl/m4/fseeko.m473
-rw-r--r--src/gl/m4/fstat.m436
-rw-r--r--src/gl/m4/ftell.m415
-rw-r--r--src/gl/m4/ftello.m4140
-rw-r--r--src/gl/m4/getaddrinfo.m4209
-rw-r--r--src/gl/m4/getdelim.m490
-rw-r--r--src/gl/m4/getline.m499
-rw-r--r--src/gl/m4/getpass.m458
-rw-r--r--src/gl/m4/getprogname.m443
-rw-r--r--src/gl/m4/gettime.m413
-rw-r--r--src/gl/m4/gettimeofday.m4138
-rw-r--r--src/gl/m4/gnulib-cache.m473
-rw-r--r--src/gl/m4/gnulib-common.m4462
-rw-r--r--src/gl/m4/gnulib-comp.m4878
-rw-r--r--src/gl/m4/gnulib-tool.m457
-rw-r--r--src/gl/m4/hostent.m449
-rw-r--r--src/gl/m4/include_next.m4223
-rw-r--r--src/gl/m4/inet_ntop.m468
-rw-r--r--src/gl/m4/inet_pton.m468
-rw-r--r--src/gl/m4/intmax_t.m467
-rw-r--r--src/gl/m4/inttypes_h.m429
-rw-r--r--src/gl/m4/largefile.m4146
-rw-r--r--src/gl/m4/limits-h.m431
-rw-r--r--src/gl/m4/longlong.m4113
-rw-r--r--src/gl/m4/lseek.m471
-rw-r--r--src/gl/m4/malloc.m4101
-rw-r--r--src/gl/m4/malloca.m415
-rw-r--r--src/gl/m4/math_h.m4353
-rw-r--r--src/gl/m4/memchr.m488
-rw-r--r--src/gl/m4/minmax.m444
-rw-r--r--src/gl/m4/mktime.m4268
-rw-r--r--src/gl/m4/mmap-anon.m455
-rw-r--r--src/gl/m4/msvc-inval.m419
-rw-r--r--src/gl/m4/msvc-nothrow.m410
-rw-r--r--src/gl/m4/multiarch.m462
-rw-r--r--src/gl/m4/netdb_h.m443
-rw-r--r--src/gl/m4/netinet_in_h.m431
-rw-r--r--src/gl/m4/off_t.m418
-rw-r--r--src/gl/m4/parse-datetime.m455
-rw-r--r--src/gl/m4/printf.m41557
-rw-r--r--src/gl/m4/read-file.m48
-rw-r--r--src/gl/m4/realloc.m479
-rw-r--r--src/gl/m4/select.m4114
-rw-r--r--src/gl/m4/servent.m451
-rw-r--r--src/gl/m4/setenv.m4160
-rw-r--r--src/gl/m4/signal_h.m483
-rw-r--r--src/gl/m4/size_max.m479
-rw-r--r--src/gl/m4/snprintf.m454
-rw-r--r--src/gl/m4/socketlib.m486
-rw-r--r--src/gl/m4/sockets.m417
-rw-r--r--src/gl/m4/socklen.m477
-rw-r--r--src/gl/m4/sockpfaf.m487
-rw-r--r--src/gl/m4/ssize_t.m423
-rw-r--r--src/gl/m4/stdalign.m457
-rw-r--r--src/gl/m4/stdbool.m4108
-rw-r--r--src/gl/m4/stddef_h.m451
-rw-r--r--src/gl/m4/stdint.m4540
-rw-r--r--src/gl/m4/stdint_h.m427
-rw-r--r--src/gl/m4/stdio_h.m4225
-rw-r--r--src/gl/m4/stdlib_h.m4120
-rw-r--r--src/gl/m4/strdup.m436
-rw-r--r--src/gl/m4/strerror.m496
-rw-r--r--src/gl/m4/strftime.m428
-rw-r--r--src/gl/m4/string_h.m4120
-rw-r--r--src/gl/m4/sys_select_h.m495
-rw-r--r--src/gl/m4/sys_socket_h.m4176
-rw-r--r--src/gl/m4/sys_stat_h.m496
-rw-r--r--src/gl/m4/sys_time_h.m4111
-rw-r--r--src/gl/m4/sys_types_h.m449
-rw-r--r--src/gl/m4/sys_uio_h.m431
-rw-r--r--src/gl/m4/time_h.m4134
-rw-r--r--src/gl/m4/time_r.m458
-rw-r--r--src/gl/m4/time_rz.m421
-rw-r--r--src/gl/m4/timegm.m426
-rw-r--r--src/gl/m4/timespec.m411
-rw-r--r--src/gl/m4/tm_gmtoff.m414
-rw-r--r--src/gl/m4/unistd_h.m4189
-rw-r--r--src/gl/m4/vasnprintf.m4291
-rw-r--r--src/gl/m4/warn-on-use.m447
-rw-r--r--src/gl/m4/wchar_h.m4233
-rw-r--r--src/gl/m4/wchar_t.m424
-rw-r--r--src/gl/m4/wint_t.m432
-rw-r--r--src/gl/m4/xalloc.m47
-rw-r--r--src/gl/m4/xsize.m412
-rw-r--r--src/gl/malloc.c56
-rw-r--r--src/gl/malloca.c149
-rw-r--r--src/gl/malloca.h133
-rw-r--r--src/gl/malloca.valgrind7
-rw-r--r--src/gl/memchr.c172
-rw-r--r--src/gl/memchr.valgrind14
-rw-r--r--src/gl/minmax.h60
-rw-r--r--src/gl/mktime-internal.h37
-rw-r--r--src/gl/mktime.c630
-rw-r--r--src/gl/msvc-inval.c129
-rw-r--r--src/gl/msvc-inval.h222
-rw-r--r--src/gl/msvc-nothrow.c49
-rw-r--r--src/gl/msvc-nothrow.h43
-rw-r--r--src/gl/netdb.in.h265
-rw-r--r--src/gl/netinet_in.in.h47
-rw-r--r--src/gl/parse-datetime.h29
-rw-r--r--src/gl/parse-datetime.y2320
-rw-r--r--src/gl/printf-args.c187
-rw-r--r--src/gl/printf-args.h158
-rw-r--r--src/gl/printf-parse.c638
-rw-r--r--src/gl/printf-parse.h193
-rw-r--r--src/gl/progname.c92
-rw-r--r--src/gl/progname.h62
-rw-r--r--src/gl/read-file.c188
-rw-r--r--src/gl/read-file.h33
-rw-r--r--src/gl/realloc.c79
-rw-r--r--src/gl/recv.c49
-rw-r--r--src/gl/recvfrom.c58
-rw-r--r--src/gl/select.c575
-rw-r--r--src/gl/send.c49
-rw-r--r--src/gl/sendto.c50
-rw-r--r--src/gl/setenv.c390
-rw-r--r--src/gl/setsockopt.c65
-rw-r--r--src/gl/shutdown.c49
-rw-r--r--src/gl/signal.in.h463
-rw-r--r--src/gl/size_max.h30
-rw-r--r--src/gl/snprintf.c71
-rw-r--r--src/gl/socket.c49
-rw-r--r--src/gl/sockets.c157
-rw-r--r--src/gl/sockets.h62
-rw-r--r--src/gl/stdalign.in.h121
-rw-r--r--src/gl/stdbool.in.h132
-rw-r--r--src/gl/stddef.in.h110
-rw-r--r--src/gl/stdint.in.h698
-rw-r--r--src/gl/stdio-impl.h113
-rw-r--r--src/gl/stdio.in.h1357
-rw-r--r--src/gl/stdlib.in.h992
-rw-r--r--src/gl/strdup.c54
-rw-r--r--src/gl/strerror-override.c302
-rw-r--r--src/gl/strerror-override.h56
-rw-r--r--src/gl/strerror.c71
-rw-r--r--src/gl/strftime.c1499
-rw-r--r--src/gl/strftime.h33
-rw-r--r--src/gl/string.in.h1046
-rw-r--r--src/gl/stripslash.c45
-rw-r--r--src/gl/sys_select.in.h319
-rw-r--r--src/gl/sys_socket.c4
-rw-r--r--src/gl/sys_socket.in.h697
-rw-r--r--src/gl/sys_stat.in.h732
-rw-r--r--src/gl/sys_time.in.h220
-rw-r--r--src/gl/sys_types.in.h53
-rw-r--r--src/gl/sys_uio.in.h63
-rw-r--r--src/gl/time-internal.h49
-rw-r--r--src/gl/time.in.h297
-rw-r--r--src/gl/time_r.c44
-rw-r--r--src/gl/time_rz.c322
-rw-r--r--src/gl/timegm.c40
-rw-r--r--src/gl/timespec.c3
-rw-r--r--src/gl/timespec.h112
-rw-r--r--src/gl/unistd.c4
-rw-r--r--src/gl/unistd.in.h1586
-rw-r--r--src/gl/unsetenv.c127
-rw-r--r--src/gl/vasnprintf.c5598
-rw-r--r--src/gl/vasnprintf.h79
-rw-r--r--src/gl/verify.h279
-rw-r--r--src/gl/w32sock.h136
-rw-r--r--src/gl/wchar.in.h1041
-rw-r--r--src/gl/xalloc-die.c41
-rw-r--r--src/gl/xalloc-oversized.h63
-rw-r--r--src/gl/xalloc.h264
-rw-r--r--src/gl/xmalloc.c122
-rw-r--r--src/gl/xsize.c3
-rw-r--r--src/gl/xsize.h117
238 files changed, 0 insertions, 47074 deletions
diff --git a/src/gl/Makefile.am b/src/gl/Makefile.am
deleted file mode 100644
index 35d1779e88..0000000000
--- a/src/gl/Makefile.am
+++ /dev/null
@@ -1,2046 +0,0 @@
-## DO NOT EDIT! GENERATED AUTOMATICALLY!
-## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2016 Free Software Foundation, Inc.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This file is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this file. If not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License,
-# this file may be distributed as part of a program that
-# contains a configuration script generated by Autoconf, under
-# the same distribution terms as the rest of that program.
-#
-# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --local-dir=src/gl/override --lib=libgnu_gpl --source-base=src/gl --m4-base=src/gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=ggl --no-vc-files accept bind close connect getaddrinfo getpass gettext-h inet_ntop inet_pton listen minmax parse-datetime progname read-file recv recvfrom select send sendto servent setsockopt shutdown socket sockets socklen
-
-AUTOMAKE_OPTIONS = 1.9.6 gnits
-
-SUBDIRS =
-noinst_HEADERS =
-noinst_LIBRARIES =
-noinst_LTLIBRARIES =
-EXTRA_DIST =
-BUILT_SOURCES =
-SUFFIXES =
-MOSTLYCLEANFILES = core *.stackdump
-MOSTLYCLEANDIRS =
-CLEANFILES =
-DISTCLEANFILES =
-MAINTAINERCLEANFILES =
-EXTRA_DIST += m4/gnulib-cache.m4
-
-AM_CPPFLAGS =
-AM_CFLAGS =
-
-noinst_LTLIBRARIES += libgnu_gpl.la
-
-libgnu_gpl_la_SOURCES =
-libgnu_gpl_la_LIBADD = $(ggl_LTLIBOBJS)
-libgnu_gpl_la_DEPENDENCIES = $(ggl_LTLIBOBJS)
-EXTRA_libgnu_gpl_la_SOURCES =
-libgnu_gpl_la_LDFLAGS = $(AM_LDFLAGS)
-libgnu_gpl_la_LDFLAGS += -no-undefined
-libgnu_gpl_la_LDFLAGS += $(GETADDRINFO_LIB)
-libgnu_gpl_la_LDFLAGS += $(HOSTENT_LIB)
-libgnu_gpl_la_LDFLAGS += $(INET_NTOP_LIB)
-libgnu_gpl_la_LDFLAGS += $(INET_PTON_LIB)
-libgnu_gpl_la_LDFLAGS += $(LIBSOCKET)
-libgnu_gpl_la_LDFLAGS += $(LIB_CLOCK_GETTIME)
-libgnu_gpl_la_LDFLAGS += $(LIB_SELECT)
-libgnu_gpl_la_LDFLAGS += $(LTLIBINTL)
-libgnu_gpl_la_LDFLAGS += $(SERVENT_LIB)
-
-## begin gnulib module absolute-header
-
-# Use this preprocessor expression to decide whether #include_next works.
-# Do not rely on a 'configure'-time test for this, since the expression
-# might appear in an installed header, which is used by some other compiler.
-HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER)
-
-## end gnulib module absolute-header
-
-## begin gnulib module accept
-
-
-EXTRA_DIST += accept.c w32sock.h
-
-EXTRA_libgnu_gpl_la_SOURCES += accept.c
-
-## end gnulib module accept
-
-## begin gnulib module alloca
-
-
-libgnu_gpl_la_LIBADD += @LTALLOCA@
-libgnu_gpl_la_DEPENDENCIES += @LTALLOCA@
-EXTRA_DIST += alloca.c
-
-EXTRA_libgnu_gpl_la_SOURCES += alloca.c
-
-## end gnulib module alloca
-
-## begin gnulib module alloca-opt
-
-BUILT_SOURCES += $(ALLOCA_H)
-
-# We need the following in order to create <alloca.h> when the system
-# doesn't have one that works with the given compiler.
-if GL_GENERATE_ALLOCA_H
-alloca.h: alloca.in.h $(top_builddir)/config.status
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- cat $(srcdir)/alloca.in.h; \
- } > $@-t && \
- mv -f $@-t $@
-else
-alloca.h: $(top_builddir)/config.status
- rm -f $@
-endif
-MOSTLYCLEANFILES += alloca.h alloca.h-t
-
-EXTRA_DIST += alloca.in.h
-
-## end gnulib module alloca-opt
-
-## begin gnulib module arpa_inet
-
-BUILT_SOURCES += arpa/inet.h
-
-# We need the following in order to create <arpa/inet.h> when the system
-# doesn't have one.
-arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
- $(AM_V_at)$(MKDIR_P) arpa
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
- -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
- -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
- -e 's/@''GNULIB_INET_NTOP''@/$(GNULIB_INET_NTOP)/g' \
- -e 's/@''GNULIB_INET_PTON''@/$(GNULIB_INET_PTON)/g' \
- -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
- -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
- -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \
- -e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(srcdir)/arpa_inet.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
-MOSTLYCLEANDIRS += arpa
-
-EXTRA_DIST += arpa_inet.in.h
-
-## end gnulib module arpa_inet
-
-## begin gnulib module bind
-
-
-EXTRA_DIST += bind.c w32sock.h
-
-EXTRA_libgnu_gpl_la_SOURCES += bind.c
-
-## end gnulib module bind
-
-## begin gnulib module c-ctype
-
-libgnu_gpl_la_SOURCES += c-ctype.h c-ctype.c
-
-## end gnulib module c-ctype
-
-## begin gnulib module close
-
-
-EXTRA_DIST += close.c
-
-EXTRA_libgnu_gpl_la_SOURCES += close.c
-
-## end gnulib module close
-
-## begin gnulib module connect
-
-
-EXTRA_DIST += connect.c w32sock.h
-
-EXTRA_libgnu_gpl_la_SOURCES += connect.c
-
-## end gnulib module connect
-
-## begin gnulib module dirname-lgpl
-
-libgnu_gpl_la_SOURCES += dirname-lgpl.c basename-lgpl.c stripslash.c
-
-EXTRA_DIST += dirname.h
-
-## end gnulib module dirname-lgpl
-
-## begin gnulib module dosname
-
-
-EXTRA_DIST += dosname.h
-
-## end gnulib module dosname
-
-## begin gnulib module dup2
-
-
-EXTRA_DIST += dup2.c
-
-EXTRA_libgnu_gpl_la_SOURCES += dup2.c
-
-## end gnulib module dup2
-
-## begin gnulib module errno
-
-BUILT_SOURCES += $(ERRNO_H)
-
-# We need the following in order to create <errno.h> when the system
-# doesn't have one that is POSIX compliant.
-if GL_GENERATE_ERRNO_H
-errno.h: errno.in.h $(top_builddir)/config.status
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
- -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
- -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
- -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \
- -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \
- -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
- -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
- < $(srcdir)/errno.in.h; \
- } > $@-t && \
- mv $@-t $@
-else
-errno.h: $(top_builddir)/config.status
- rm -f $@
-endif
-MOSTLYCLEANFILES += errno.h errno.h-t
-
-EXTRA_DIST += errno.in.h
-
-## end gnulib module errno
-
-## begin gnulib module error
-
-
-EXTRA_DIST += error.c error.h
-
-EXTRA_libgnu_gpl_la_SOURCES += error.c
-
-## end gnulib module error
-
-## begin gnulib module exitfail
-
-libgnu_gpl_la_SOURCES += exitfail.c
-
-EXTRA_DIST += exitfail.h
-
-## end gnulib module exitfail
-
-## begin gnulib module fd-hook
-
-libgnu_gpl_la_SOURCES += fd-hook.c
-
-EXTRA_DIST += fd-hook.h
-
-## end gnulib module fd-hook
-
-## begin gnulib module flexmember
-
-
-EXTRA_DIST += flexmember.h
-
-## end gnulib module flexmember
-
-## begin gnulib module float
-
-BUILT_SOURCES += $(FLOAT_H)
-
-# We need the following in order to create <float.h> when the system
-# doesn't have one that works with the given compiler.
-if GL_GENERATE_FLOAT_H
-float.h: float.in.h $(top_builddir)/config.status
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
- -e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \
- < $(srcdir)/float.in.h; \
- } > $@-t && \
- mv $@-t $@
-else
-float.h: $(top_builddir)/config.status
- rm -f $@
-endif
-MOSTLYCLEANFILES += float.h float.h-t
-
-EXTRA_DIST += float.c float.in.h itold.c
-
-EXTRA_libgnu_gpl_la_SOURCES += float.c itold.c
-
-## end gnulib module float
-
-## begin gnulib module fseek
-
-
-EXTRA_DIST += fseek.c
-
-EXTRA_libgnu_gpl_la_SOURCES += fseek.c
-
-## end gnulib module fseek
-
-## begin gnulib module fseeko
-
-
-EXTRA_DIST += fseeko.c stdio-impl.h
-
-EXTRA_libgnu_gpl_la_SOURCES += fseeko.c
-
-## end gnulib module fseeko
-
-## begin gnulib module fstat
-
-
-EXTRA_DIST += fstat.c
-
-EXTRA_libgnu_gpl_la_SOURCES += fstat.c
-
-## end gnulib module fstat
-
-## begin gnulib module ftell
-
-
-EXTRA_DIST += ftell.c
-
-EXTRA_libgnu_gpl_la_SOURCES += ftell.c
-
-## end gnulib module ftell
-
-## begin gnulib module ftello
-
-
-EXTRA_DIST += ftello.c stdio-impl.h
-
-EXTRA_libgnu_gpl_la_SOURCES += ftello.c
-
-## end gnulib module ftello
-
-## begin gnulib module getaddrinfo
-
-
-EXTRA_DIST += gai_strerror.c getaddrinfo.c
-
-EXTRA_libgnu_gpl_la_SOURCES += gai_strerror.c getaddrinfo.c
-
-## end gnulib module getaddrinfo
-
-## begin gnulib module getdelim
-
-
-EXTRA_DIST += getdelim.c
-
-EXTRA_libgnu_gpl_la_SOURCES += getdelim.c
-
-## end gnulib module getdelim
-
-## begin gnulib module getline
-
-
-EXTRA_DIST += getline.c
-
-EXTRA_libgnu_gpl_la_SOURCES += getline.c
-
-## end gnulib module getline
-
-## begin gnulib module getpass
-
-
-EXTRA_DIST += getpass.c getpass.h
-
-EXTRA_libgnu_gpl_la_SOURCES += getpass.c
-
-## end gnulib module getpass
-
-## begin gnulib module getpeername
-
-
-EXTRA_DIST += getpeername.c w32sock.h
-
-EXTRA_libgnu_gpl_la_SOURCES += getpeername.c
-
-## end gnulib module getpeername
-
-## begin gnulib module getprogname
-
-libgnu_gpl_la_SOURCES += getprogname.h getprogname.c
-
-## end gnulib module getprogname
-
-## begin gnulib module gettext-h
-
-libgnu_gpl_la_SOURCES += gettext.h
-
-## end gnulib module gettext-h
-
-## begin gnulib module gettime
-
-libgnu_gpl_la_SOURCES += gettime.c
-
-## end gnulib module gettime
-
-## begin gnulib module gettimeofday
-
-
-EXTRA_DIST += gettimeofday.c
-
-EXTRA_libgnu_gpl_la_SOURCES += gettimeofday.c
-
-## end gnulib module gettimeofday
-
-## begin gnulib module inet_ntop
-
-
-EXTRA_DIST += inet_ntop.c
-
-EXTRA_libgnu_gpl_la_SOURCES += inet_ntop.c
-
-## end gnulib module inet_ntop
-
-## begin gnulib module inet_pton
-
-
-EXTRA_DIST += inet_pton.c
-
-EXTRA_libgnu_gpl_la_SOURCES += inet_pton.c
-
-## end gnulib module inet_pton
-
-## begin gnulib module intprops
-
-
-EXTRA_DIST += intprops.h
-
-## end gnulib module intprops
-
-## begin gnulib module limits-h
-
-BUILT_SOURCES += $(LIMITS_H)
-
-# We need the following in order to create <limits.h> when the system
-# doesn't have one that is compatible with GNU.
-if GL_GENERATE_LIMITS_H
-limits.h: limits.in.h $(top_builddir)/config.status
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \
- < $(srcdir)/limits.in.h; \
- } > $@-t && \
- mv $@-t $@
-else
-limits.h: $(top_builddir)/config.status
- rm -f $@
-endif
-MOSTLYCLEANFILES += limits.h limits.h-t
-
-EXTRA_DIST += limits.in.h
-
-## end gnulib module limits-h
-
-## begin gnulib module listen
-
-
-EXTRA_DIST += listen.c w32sock.h
-
-EXTRA_libgnu_gpl_la_SOURCES += listen.c
-
-## end gnulib module listen
-
-## begin gnulib module lseek
-
-
-EXTRA_DIST += lseek.c
-
-EXTRA_libgnu_gpl_la_SOURCES += lseek.c
-
-## end gnulib module lseek
-
-## begin gnulib module malloc-posix
-
-
-EXTRA_DIST += malloc.c
-
-EXTRA_libgnu_gpl_la_SOURCES += malloc.c
-
-## end gnulib module malloc-posix
-
-## begin gnulib module malloca
-
-libgnu_gpl_la_SOURCES += malloca.c
-
-EXTRA_DIST += malloca.h malloca.valgrind
-
-## end gnulib module malloca
-
-## begin gnulib module memchr
-
-
-EXTRA_DIST += memchr.c memchr.valgrind
-
-EXTRA_libgnu_gpl_la_SOURCES += memchr.c
-
-## end gnulib module memchr
-
-## begin gnulib module minmax
-
-libgnu_gpl_la_SOURCES += minmax.h
-
-## end gnulib module minmax
-
-## begin gnulib module mktime
-
-
-EXTRA_DIST += mktime-internal.h mktime.c
-
-EXTRA_libgnu_gpl_la_SOURCES += mktime.c
-
-## end gnulib module mktime
-
-## begin gnulib module mktime-internal
-
-
-EXTRA_DIST += mktime-internal.h mktime.c
-
-EXTRA_libgnu_gpl_la_SOURCES += mktime.c
-
-## end gnulib module mktime-internal
-
-## begin gnulib module msvc-inval
-
-
-EXTRA_DIST += msvc-inval.c msvc-inval.h
-
-EXTRA_libgnu_gpl_la_SOURCES += msvc-inval.c
-
-## end gnulib module msvc-inval
-
-## begin gnulib module msvc-nothrow
-
-
-EXTRA_DIST += msvc-nothrow.c msvc-nothrow.h
-
-EXTRA_libgnu_gpl_la_SOURCES += msvc-nothrow.c
-
-## end gnulib module msvc-nothrow
-
-## begin gnulib module netdb
-
-BUILT_SOURCES += netdb.h
-
-# We need the following in order to create <netdb.h> when the system
-# doesn't have one that works with the given compiler.
-netdb.h: netdb.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \
- -e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \
- -e 's/@''GNULIB_GETADDRINFO''@/$(GNULIB_GETADDRINFO)/g' \
- -e 's|@''HAVE_STRUCT_ADDRINFO''@|$(HAVE_STRUCT_ADDRINFO)|g' \
- -e 's|@''HAVE_DECL_FREEADDRINFO''@|$(HAVE_DECL_FREEADDRINFO)|g' \
- -e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \
- -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \
- -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \
- -e 's|@''REPLACE_GAI_STRERROR''@|$(REPLACE_GAI_STRERROR)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(srcdir)/netdb.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += netdb.h netdb.h-t
-
-EXTRA_DIST += netdb.in.h
-
-## end gnulib module netdb
-
-## begin gnulib module netinet_in
-
-BUILT_SOURCES += $(NETINET_IN_H)
-
-# We need the following in order to create <netinet/in.h> when the system
-# doesn't have one.
-if GL_GENERATE_NETINET_IN_H
-netinet/in.h: netinet_in.in.h $(top_builddir)/config.status
- $(AM_V_at)$(MKDIR_P) netinet
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
- -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
- < $(srcdir)/netinet_in.in.h; \
- } > $@-t && \
- mv $@-t $@
-else
-netinet/in.h: $(top_builddir)/config.status
- rm -f $@
-endif
-MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
-MOSTLYCLEANDIRS += netinet
-
-EXTRA_DIST += netinet_in.in.h
-
-## end gnulib module netinet_in
-
-## begin gnulib module parse-datetime
-
-# This rule overrides the Automake generated .y.c rule, to ensure that the
-# parse-datetime.c file gets generated in the source directory, not in the
-# build directory.
-parse-datetime.c: parse-datetime.y
- $(AM_V_GEN)$(SHELL) $(YLWRAP) $(srcdir)/parse-datetime.y \
- y.tab.c parse-datetime.c \
- y.tab.h parse-datetime.h \
- y.output parse-datetime.output \
- -- $(YACC) $(YFLAGS) $(AM_YFLAGS) && \
- mv parse-datetime.c parse-datetime.c-t && \
- mv parse-datetime.c-t $(srcdir)/parse-datetime.c
-libgnu_gpl_la_SOURCES += parse-datetime.y
-BUILT_SOURCES += parse-datetime.c
-MOSTLYCLEANFILES += parse-datetime.c-t
-MAINTAINERCLEANFILES += parse-datetime.c
-EXTRA_DIST += parse-datetime.c
-
-EXTRA_DIST += parse-datetime.h
-
-## end gnulib module parse-datetime
-
-## begin gnulib module progname
-
-libgnu_gpl_la_SOURCES += progname.h progname.c
-
-## end gnulib module progname
-
-## begin gnulib module read-file
-
-libgnu_gpl_la_SOURCES += read-file.c
-
-EXTRA_DIST += read-file.h
-
-## end gnulib module read-file
-
-## begin gnulib module realloc-posix
-
-
-EXTRA_DIST += realloc.c
-
-EXTRA_libgnu_gpl_la_SOURCES += realloc.c
-
-## end gnulib module realloc-posix
-
-## begin gnulib module recv
-
-
-EXTRA_DIST += recv.c w32sock.h
-
-EXTRA_libgnu_gpl_la_SOURCES += recv.c
-
-## end gnulib module recv
-
-## begin gnulib module recvfrom
-
-
-EXTRA_DIST += recvfrom.c w32sock.h
-
-EXTRA_libgnu_gpl_la_SOURCES += recvfrom.c
-
-## end gnulib module recvfrom
-
-## begin gnulib module select
-
-
-EXTRA_DIST += select.c
-
-EXTRA_libgnu_gpl_la_SOURCES += select.c
-
-## end gnulib module select
-
-## begin gnulib module send
-
-
-EXTRA_DIST += send.c w32sock.h
-
-EXTRA_libgnu_gpl_la_SOURCES += send.c
-
-## end gnulib module send
-
-## begin gnulib module sendto
-
-
-EXTRA_DIST += sendto.c w32sock.h
-
-EXTRA_libgnu_gpl_la_SOURCES += sendto.c
-
-## end gnulib module sendto
-
-## begin gnulib module setenv
-
-
-EXTRA_DIST += setenv.c
-
-EXTRA_libgnu_gpl_la_SOURCES += setenv.c
-
-## end gnulib module setenv
-
-## begin gnulib module setsockopt
-
-
-EXTRA_DIST += setsockopt.c w32sock.h
-
-EXTRA_libgnu_gpl_la_SOURCES += setsockopt.c
-
-## end gnulib module setsockopt
-
-## begin gnulib module shutdown
-
-
-EXTRA_DIST += shutdown.c w32sock.h
-
-EXTRA_libgnu_gpl_la_SOURCES += shutdown.c
-
-## end gnulib module shutdown
-
-## begin gnulib module signal-h
-
-BUILT_SOURCES += signal.h
-
-# We need the following in order to create <signal.h> when the system
-# doesn't have a complete one.
-signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \
- -e 's|@''GNULIB_PTHREAD_SIGMASK''@|$(GNULIB_PTHREAD_SIGMASK)|g' \
- -e 's|@''GNULIB_RAISE''@|$(GNULIB_RAISE)|g' \
- -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \
- -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \
- -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \
- -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \
- -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \
- -e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \
- -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \
- -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \
- -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \
- -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \
- -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \
- -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \
- -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \
- -e 's|@''REPLACE_RAISE''@|$(REPLACE_RAISE)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(srcdir)/signal.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += signal.h signal.h-t
-
-EXTRA_DIST += signal.in.h
-
-## end gnulib module signal-h
-
-## begin gnulib module size_max
-
-libgnu_gpl_la_SOURCES += size_max.h
-
-## end gnulib module size_max
-
-## begin gnulib module snippet/_Noreturn
-
-# Because this Makefile snippet defines a variable used by other
-# gnulib Makefile snippets, it must be present in all Makefile.am that
-# need it. This is ensured by the applicability 'all' defined above.
-
-_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h
-
-## end gnulib module snippet/_Noreturn
-
-## begin gnulib module snippet/arg-nonnull
-
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# statements but through direct file reference. Therefore this snippet must be
-# present in all Makefile.am that need it. This is ensured by the applicability
-# 'all' defined above.
-
-BUILT_SOURCES += arg-nonnull.h
-# The arg-nonnull.h that gets inserted into generated .h files is the same as
-# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut
-# off.
-arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h
- $(AM_V_GEN)rm -f $@-t $@ && \
- sed -n -e '/GL_ARG_NONNULL/,$$p' \
- < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \
- > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
-
-ARG_NONNULL_H=arg-nonnull.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h
-
-## end gnulib module snippet/arg-nonnull
-
-## begin gnulib module snippet/c++defs
-
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# statements but through direct file reference. Therefore this snippet must be
-# present in all Makefile.am that need it. This is ensured by the applicability
-# 'all' defined above.
-
-BUILT_SOURCES += c++defs.h
-# The c++defs.h that gets inserted into generated .h files is the same as
-# build-aux/snippet/c++defs.h, except that it has the copyright header cut off.
-c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h
- $(AM_V_GEN)rm -f $@-t $@ && \
- sed -n -e '/_GL_CXXDEFS/,$$p' \
- < $(top_srcdir)/build-aux/snippet/c++defs.h \
- > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += c++defs.h c++defs.h-t
-
-CXXDEFS_H=c++defs.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h
-
-## end gnulib module snippet/c++defs
-
-## begin gnulib module snippet/warn-on-use
-
-BUILT_SOURCES += warn-on-use.h
-# The warn-on-use.h that gets inserted into generated .h files is the same as
-# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut
-# off.
-warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h
- $(AM_V_GEN)rm -f $@-t $@ && \
- sed -n -e '/^.ifndef/,$$p' \
- < $(top_srcdir)/build-aux/snippet/warn-on-use.h \
- > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
-
-WARN_ON_USE_H=warn-on-use.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h
-
-## end gnulib module snippet/warn-on-use
-
-## begin gnulib module snprintf
-
-
-EXTRA_DIST += snprintf.c
-
-EXTRA_libgnu_gpl_la_SOURCES += snprintf.c
-
-## end gnulib module snprintf
-
-## begin gnulib module socket
-
-
-EXTRA_DIST += socket.c w32sock.h
-
-EXTRA_libgnu_gpl_la_SOURCES += socket.c
-
-## end gnulib module socket
-
-## begin gnulib module sockets
-
-libgnu_gpl_la_SOURCES += sockets.h sockets.c
-
-EXTRA_DIST += w32sock.h
-
-## end gnulib module sockets
-
-## begin gnulib module stdalign
-
-BUILT_SOURCES += $(STDALIGN_H)
-
-# We need the following in order to create <stdalign.h> when the system
-# doesn't have one that works.
-if GL_GENERATE_STDALIGN_H
-stdalign.h: stdalign.in.h $(top_builddir)/config.status
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- cat $(srcdir)/stdalign.in.h; \
- } > $@-t && \
- mv $@-t $@
-else
-stdalign.h: $(top_builddir)/config.status
- rm -f $@
-endif
-MOSTLYCLEANFILES += stdalign.h stdalign.h-t
-
-EXTRA_DIST += stdalign.in.h
-
-## end gnulib module stdalign
-
-## begin gnulib module stdbool
-
-BUILT_SOURCES += $(STDBOOL_H)
-
-# We need the following in order to create <stdbool.h> when the system
-# doesn't have one that works.
-if GL_GENERATE_STDBOOL_H
-stdbool.h: stdbool.in.h $(top_builddir)/config.status
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
- } > $@-t && \
- mv $@-t $@
-else
-stdbool.h: $(top_builddir)/config.status
- rm -f $@
-endif
-MOSTLYCLEANFILES += stdbool.h stdbool.h-t
-
-EXTRA_DIST += stdbool.in.h
-
-## end gnulib module stdbool
-
-## begin gnulib module stddef
-
-BUILT_SOURCES += $(STDDEF_H)
-
-# We need the following in order to create <stddef.h> when the system
-# doesn't have one that works with the given compiler.
-if GL_GENERATE_STDDEF_H
-stddef.h: stddef.in.h $(top_builddir)/config.status
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
- -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
- -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
- -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
- < $(srcdir)/stddef.in.h; \
- } > $@-t && \
- mv $@-t $@
-else
-stddef.h: $(top_builddir)/config.status
- rm -f $@
-endif
-MOSTLYCLEANFILES += stddef.h stddef.h-t
-
-EXTRA_DIST += stddef.in.h
-
-## end gnulib module stddef
-
-## begin gnulib module stdint
-
-BUILT_SOURCES += $(STDINT_H)
-
-# We need the following in order to create <stdint.h> when the system
-# doesn't have one that works with the given compiler.
-if GL_GENERATE_STDINT_H
-stdint.h: stdint.in.h $(top_builddir)/config.status
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
- -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \
- -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
- -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
- -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
- -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
- -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
- -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
- -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
- -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
- -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
- -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
- -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
- -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \
- -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
- -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
- -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
- -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
- -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
- -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
- -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
- -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
- -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
- < $(srcdir)/stdint.in.h; \
- } > $@-t && \
- mv $@-t $@
-else
-stdint.h: $(top_builddir)/config.status
- rm -f $@
-endif
-MOSTLYCLEANFILES += stdint.h stdint.h-t
-
-EXTRA_DIST += stdint.in.h
-
-## end gnulib module stdint
-
-## begin gnulib module stdio
-
-BUILT_SOURCES += stdio.h
-
-# We need the following in order to create <stdio.h> when the system
-# doesn't have one that works with the given compiler.
-stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
- -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \
- -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \
- -e 's/@''GNULIB_FDOPEN''@/$(GNULIB_FDOPEN)/g' \
- -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \
- -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \
- -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \
- -e 's/@''GNULIB_FOPEN''@/$(GNULIB_FOPEN)/g' \
- -e 's/@''GNULIB_FPRINTF''@/$(GNULIB_FPRINTF)/g' \
- -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GNULIB_FPRINTF_POSIX)/g' \
- -e 's/@''GNULIB_FPURGE''@/$(GNULIB_FPURGE)/g' \
- -e 's/@''GNULIB_FPUTC''@/$(GNULIB_FPUTC)/g' \
- -e 's/@''GNULIB_FPUTS''@/$(GNULIB_FPUTS)/g' \
- -e 's/@''GNULIB_FREAD''@/$(GNULIB_FREAD)/g' \
- -e 's/@''GNULIB_FREOPEN''@/$(GNULIB_FREOPEN)/g' \
- -e 's/@''GNULIB_FSCANF''@/$(GNULIB_FSCANF)/g' \
- -e 's/@''GNULIB_FSEEK''@/$(GNULIB_FSEEK)/g' \
- -e 's/@''GNULIB_FSEEKO''@/$(GNULIB_FSEEKO)/g' \
- -e 's/@''GNULIB_FTELL''@/$(GNULIB_FTELL)/g' \
- -e 's/@''GNULIB_FTELLO''@/$(GNULIB_FTELLO)/g' \
- -e 's/@''GNULIB_FWRITE''@/$(GNULIB_FWRITE)/g' \
- -e 's/@''GNULIB_GETC''@/$(GNULIB_GETC)/g' \
- -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \
- -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \
- -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \
- -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
- -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
- -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \
- -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \
- -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \
- -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \
- -e 's/@''GNULIB_PRINTF_POSIX''@/$(GNULIB_PRINTF_POSIX)/g' \
- -e 's/@''GNULIB_PUTC''@/$(GNULIB_PUTC)/g' \
- -e 's/@''GNULIB_PUTCHAR''@/$(GNULIB_PUTCHAR)/g' \
- -e 's/@''GNULIB_PUTS''@/$(GNULIB_PUTS)/g' \
- -e 's/@''GNULIB_REMOVE''@/$(GNULIB_REMOVE)/g' \
- -e 's/@''GNULIB_RENAME''@/$(GNULIB_RENAME)/g' \
- -e 's/@''GNULIB_RENAMEAT''@/$(GNULIB_RENAMEAT)/g' \
- -e 's/@''GNULIB_SCANF''@/$(GNULIB_SCANF)/g' \
- -e 's/@''GNULIB_SNPRINTF''@/$(GNULIB_SNPRINTF)/g' \
- -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GNULIB_SPRINTF_POSIX)/g' \
- -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GNULIB_STDIO_H_NONBLOCKING)/g' \
- -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GNULIB_STDIO_H_SIGPIPE)/g' \
- -e 's/@''GNULIB_TMPFILE''@/$(GNULIB_TMPFILE)/g' \
- -e 's/@''GNULIB_VASPRINTF''@/$(GNULIB_VASPRINTF)/g' \
- -e 's/@''GNULIB_VDPRINTF''@/$(GNULIB_VDPRINTF)/g' \
- -e 's/@''GNULIB_VFPRINTF''@/$(GNULIB_VFPRINTF)/g' \
- -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GNULIB_VFPRINTF_POSIX)/g' \
- -e 's/@''GNULIB_VFSCANF''@/$(GNULIB_VFSCANF)/g' \
- -e 's/@''GNULIB_VSCANF''@/$(GNULIB_VSCANF)/g' \
- -e 's/@''GNULIB_VPRINTF''@/$(GNULIB_VPRINTF)/g' \
- -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GNULIB_VPRINTF_POSIX)/g' \
- -e 's/@''GNULIB_VSNPRINTF''@/$(GNULIB_VSNPRINTF)/g' \
- -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \
- < $(srcdir)/stdio.in.h | \
- sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
- -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \
- -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \
- -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
- -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
- -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
- -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
- -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
- -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \
- -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \
- -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \
- -e 's|@''HAVE_PCLOSE''@|$(HAVE_PCLOSE)|g' \
- -e 's|@''HAVE_POPEN''@|$(HAVE_POPEN)|g' \
- -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \
- -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
- -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \
- -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \
- -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \
- -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \
- -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
- -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
- -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
- -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \
- -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
- -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
- -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
- -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
- -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
- -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \
- -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
- -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
- -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \
- -e 's|@''REPLACE_POPEN''@|$(REPLACE_POPEN)|g' \
- -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
- -e 's|@''REPLACE_REMOVE''@|$(REPLACE_REMOVE)|g' \
- -e 's|@''REPLACE_RENAME''@|$(REPLACE_RENAME)|g' \
- -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \
- -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
- -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
- -e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \
- -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
- -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \
- -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
- -e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \
- -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
- -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
- -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
- -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
- -e 's|@''ASM_SYMBOL_PREFIX''@|$(ASM_SYMBOL_PREFIX)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += stdio.h stdio.h-t
-
-EXTRA_DIST += stdio.in.h
-
-## end gnulib module stdio
-
-## begin gnulib module stdlib
-
-BUILT_SOURCES += stdlib.h
-
-# We need the following in order to create <stdlib.h> when the system
-# doesn't have one that works with the given compiler.
-stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
- $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
- -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \
- -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \
- -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \
- -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \
- -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \
- -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \
- -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \
- -e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \
- -e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \
- -e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \
- -e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \
- -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \
- -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \
- -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
- -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \
- -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
- -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \
- -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
- -e 's/@''GNULIB_QSORT_R''@/$(GNULIB_QSORT_R)/g' \
- -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \
- -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
- -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
- -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
- -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \
- -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \
- -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \
- -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \
- -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \
- -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \
- -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \
- -e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \
- -e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \
- -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \
- < $(srcdir)/stdlib.in.h | \
- sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
- -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
- -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
- -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
- -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
- -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
- -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
- -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
- -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
- -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
- -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
- -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
- -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
- -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
- -e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \
- -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \
- -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
- -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
- -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
- -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
- -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \
- -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
- -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
- -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
- -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
- -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \
- -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
- -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
- -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
- -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
- -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
- -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
- -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
- -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
- -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \
- -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
- -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
- -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \
- -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
- -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
- -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
- -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
- -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
- -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
- -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _Noreturn/r $(_NORETURN_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += stdlib.h stdlib.h-t
-
-EXTRA_DIST += stdlib.in.h
-
-## end gnulib module stdlib
-
-## begin gnulib module strdup-posix
-
-
-EXTRA_DIST += strdup.c
-
-EXTRA_libgnu_gpl_la_SOURCES += strdup.c
-
-## end gnulib module strdup-posix
-
-## begin gnulib module strerror
-
-
-EXTRA_DIST += strerror.c
-
-EXTRA_libgnu_gpl_la_SOURCES += strerror.c
-
-## end gnulib module strerror
-
-## begin gnulib module strerror-override
-
-
-EXTRA_DIST += strerror-override.c strerror-override.h
-
-EXTRA_libgnu_gpl_la_SOURCES += strerror-override.c
-
-## end gnulib module strerror-override
-
-## begin gnulib module strftime
-
-libgnu_gpl_la_SOURCES += strftime.c
-
-EXTRA_DIST += strftime.h
-
-## end gnulib module strftime
-
-## begin gnulib module string
-
-BUILT_SOURCES += string.h
-
-# We need the following in order to create <string.h> when the system
-# doesn't have one that works with the given compiler.
-string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
- -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \
- -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \
- -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \
- -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \
- -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \
- -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \
- -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \
- -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \
- -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \
- -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \
- -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \
- -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \
- -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \
- -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \
- -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \
- -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \
- -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \
- -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \
- -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \
- -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \
- -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \
- -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \
- -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \
- -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \
- -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \
- -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \
- -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \
- -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \
- -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \
- -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \
- -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \
- -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \
- -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \
- -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \
- -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \
- -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \
- -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \
- < $(srcdir)/string.in.h | \
- sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \
- -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \
- -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
- -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
- -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
- -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
- -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
- -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \
- -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
- -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
- -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
- -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
- -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \
- -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \
- -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \
- -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
- -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
- -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
- -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
- -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
- -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
- -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \
- -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
- -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
- -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
- -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \
- -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
- -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
- -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
- -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \
- -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \
- -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
- -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \
- -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
- -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
- -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
- < $(srcdir)/string.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += string.h string.h-t
-
-EXTRA_DIST += string.in.h
-
-## end gnulib module string
-
-## begin gnulib module sys_select
-
-BUILT_SOURCES += sys/select.h
-
-# We need the following in order to create <sys/select.h> when the system
-# doesn't have one that works with the given compiler.
-sys/select.h: sys_select.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
- $(AM_V_at)$(MKDIR_P) sys
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \
- -e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \
- -e 's/@''GNULIB_PSELECT''@/$(GNULIB_PSELECT)/g' \
- -e 's/@''GNULIB_SELECT''@/$(GNULIB_SELECT)/g' \
- -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
- -e 's|@''HAVE_PSELECT''@|$(HAVE_PSELECT)|g' \
- -e 's|@''REPLACE_PSELECT''@|$(REPLACE_PSELECT)|g' \
- -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(srcdir)/sys_select.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += sys/select.h sys/select.h-t
-MOSTLYCLEANDIRS += sys
-
-EXTRA_DIST += sys_select.in.h
-
-## end gnulib module sys_select
-
-## begin gnulib module sys_socket
-
-BUILT_SOURCES += sys/socket.h
-libgnu_gpl_la_SOURCES += sys_socket.c
-
-# We need the following in order to create <sys/socket.h> when the system
-# doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
- $(AM_V_at)$(MKDIR_P) sys
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
- -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
- -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
- -e 's/@''GNULIB_SOCKET''@/$(GNULIB_SOCKET)/g' \
- -e 's/@''GNULIB_CONNECT''@/$(GNULIB_CONNECT)/g' \
- -e 's/@''GNULIB_ACCEPT''@/$(GNULIB_ACCEPT)/g' \
- -e 's/@''GNULIB_BIND''@/$(GNULIB_BIND)/g' \
- -e 's/@''GNULIB_GETPEERNAME''@/$(GNULIB_GETPEERNAME)/g' \
- -e 's/@''GNULIB_GETSOCKNAME''@/$(GNULIB_GETSOCKNAME)/g' \
- -e 's/@''GNULIB_GETSOCKOPT''@/$(GNULIB_GETSOCKOPT)/g' \
- -e 's/@''GNULIB_LISTEN''@/$(GNULIB_LISTEN)/g' \
- -e 's/@''GNULIB_RECV''@/$(GNULIB_RECV)/g' \
- -e 's/@''GNULIB_SEND''@/$(GNULIB_SEND)/g' \
- -e 's/@''GNULIB_RECVFROM''@/$(GNULIB_RECVFROM)/g' \
- -e 's/@''GNULIB_SENDTO''@/$(GNULIB_SENDTO)/g' \
- -e 's/@''GNULIB_SETSOCKOPT''@/$(GNULIB_SETSOCKOPT)/g' \
- -e 's/@''GNULIB_SHUTDOWN''@/$(GNULIB_SHUTDOWN)/g' \
- -e 's/@''GNULIB_ACCEPT4''@/$(GNULIB_ACCEPT4)/g' \
- -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
- -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
- -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \
- -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY''@|$(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)|g' \
- -e 's|@''HAVE_SA_FAMILY_T''@|$(HAVE_SA_FAMILY_T)|g' \
- -e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(srcdir)/sys_socket.in.h; \
- } > $@-t && \
- mv -f $@-t $@
-MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
-MOSTLYCLEANDIRS += sys
-
-EXTRA_DIST += sys_socket.in.h
-
-## end gnulib module sys_socket
-
-## begin gnulib module sys_stat
-
-BUILT_SOURCES += sys/stat.h
-
-# We need the following in order to create <sys/stat.h> when the system
-# has one that is incomplete.
-sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
- $(AM_V_at)$(MKDIR_P) sys
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
- -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \
- -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
- -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
- -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
- -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \
- -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \
- -e 's/@''GNULIB_LSTAT''@/$(GNULIB_LSTAT)/g' \
- -e 's/@''GNULIB_MKDIRAT''@/$(GNULIB_MKDIRAT)/g' \
- -e 's/@''GNULIB_MKFIFO''@/$(GNULIB_MKFIFO)/g' \
- -e 's/@''GNULIB_MKFIFOAT''@/$(GNULIB_MKFIFOAT)/g' \
- -e 's/@''GNULIB_MKNOD''@/$(GNULIB_MKNOD)/g' \
- -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \
- -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \
- -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \
- -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \
- -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \
- -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \
- -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \
- -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
- -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \
- -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \
- -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \
- -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \
- -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \
- -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \
- -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \
- -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \
- -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \
- -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \
- -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
- -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \
- -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
- -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
- -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(srcdir)/sys_stat.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
-MOSTLYCLEANDIRS += sys
-
-EXTRA_DIST += sys_stat.in.h
-
-## end gnulib module sys_stat
-
-## begin gnulib module sys_time
-
-BUILT_SOURCES += sys/time.h
-
-# We need the following in order to create <sys/time.h> when the system
-# doesn't have one that works with the given compiler.
-sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
- $(AM_V_at)$(MKDIR_P) sys
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
- -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
- -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
- -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
- -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
- -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
- -e 's/@''REPLACE_STRUCT_TIMEVAL''@/$(REPLACE_STRUCT_TIMEVAL)/g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(srcdir)/sys_time.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += sys/time.h sys/time.h-t
-
-EXTRA_DIST += sys_time.in.h
-
-## end gnulib module sys_time
-
-## begin gnulib module sys_types
-
-BUILT_SOURCES += sys/types.h
-
-# We need the following in order to create <sys/types.h> when the system
-# doesn't have one that works with the given compiler.
-sys/types.h: sys_types.in.h $(top_builddir)/config.status
- $(AM_V_at)$(MKDIR_P) sys
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
- -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
- < $(srcdir)/sys_types.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += sys/types.h sys/types.h-t
-
-EXTRA_DIST += sys_types.in.h
-
-## end gnulib module sys_types
-
-## begin gnulib module sys_uio
-
-BUILT_SOURCES += sys/uio.h
-
-# We need the following in order to create <sys/uio.h> when the system
-# doesn't have one that works with the given compiler.
-sys/uio.h: sys_uio.in.h $(top_builddir)/config.status
- $(AM_V_at)$(MKDIR_P) sys
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_SYS_UIO_H''@|$(NEXT_SYS_UIO_H)|g' \
- -e 's|@''HAVE_SYS_UIO_H''@|$(HAVE_SYS_UIO_H)|g' \
- < $(srcdir)/sys_uio.in.h; \
- } > $@-t && \
- mv -f $@-t $@
-MOSTLYCLEANFILES += sys/uio.h sys/uio.h-t
-MOSTLYCLEANDIRS += sys
-
-EXTRA_DIST += sys_uio.in.h
-
-## end gnulib module sys_uio
-
-## begin gnulib module time
-
-BUILT_SOURCES += time.h
-
-# We need the following in order to create <time.h> when the system
-# doesn't have one that works with the given compiler.
-time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
- -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
- -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \
- -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \
- -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \
- -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \
- -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \
- -e 's/@''GNULIB_TIME_RZ''@/$(GNULIB_TIME_RZ)/g' \
- -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \
- -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \
- -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
- -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \
- -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \
- -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
- -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \
- -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
- -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
- -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
- -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
- -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \
- -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
- -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
- -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(srcdir)/time.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += time.h time.h-t
-
-EXTRA_DIST += time.in.h
-
-## end gnulib module time
-
-## begin gnulib module time_r
-
-
-EXTRA_DIST += time_r.c
-
-EXTRA_libgnu_gpl_la_SOURCES += time_r.c
-
-## end gnulib module time_r
-
-## begin gnulib module time_rz
-
-
-EXTRA_DIST += time-internal.h time_rz.c
-
-EXTRA_libgnu_gpl_la_SOURCES += time_rz.c
-
-## end gnulib module time_rz
-
-## begin gnulib module timegm
-
-
-EXTRA_DIST += mktime-internal.h timegm.c
-
-EXTRA_libgnu_gpl_la_SOURCES += timegm.c
-
-## end gnulib module timegm
-
-## begin gnulib module timespec
-
-libgnu_gpl_la_SOURCES += timespec.c
-
-EXTRA_DIST += timespec.h
-
-## end gnulib module timespec
-
-## begin gnulib module unistd
-
-BUILT_SOURCES += unistd.h
-libgnu_gpl_la_SOURCES += unistd.c
-
-# We need the following in order to create an empty placeholder for
-# <unistd.h> when the system doesn't have one.
-unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
- -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
- -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \
- -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
- -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
- -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \
- -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \
- -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \
- -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \
- -e 's/@''GNULIB_EUIDACCESS''@/$(GNULIB_EUIDACCESS)/g' \
- -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \
- -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \
- -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \
- -e 's/@''GNULIB_FDATASYNC''@/$(GNULIB_FDATASYNC)/g' \
- -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \
- -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \
- -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \
- -e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \
- -e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \
- -e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \
- -e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \
- -e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \
- -e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \
- -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \
- -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \
- -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \
- -e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/g' \
- -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \
- -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \
- -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \
- -e 's/@''GNULIB_LSEEK''@/$(GNULIB_LSEEK)/g' \
- -e 's/@''GNULIB_PIPE''@/$(GNULIB_PIPE)/g' \
- -e 's/@''GNULIB_PIPE2''@/$(GNULIB_PIPE2)/g' \
- -e 's/@''GNULIB_PREAD''@/$(GNULIB_PREAD)/g' \
- -e 's/@''GNULIB_PWRITE''@/$(GNULIB_PWRITE)/g' \
- -e 's/@''GNULIB_READ''@/$(GNULIB_READ)/g' \
- -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \
- -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \
- -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \
- -e 's/@''GNULIB_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/g' \
- -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \
- -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \
- -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \
- -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \
- -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_GGL_UNISTD_H_GETOPT)/g' \
- -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \
- -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \
- -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \
- -e 's/@''GNULIB_UNLINKAT''@/$(GNULIB_UNLINKAT)/g' \
- -e 's/@''GNULIB_USLEEP''@/$(GNULIB_USLEEP)/g' \
- -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \
- < $(srcdir)/unistd.in.h | \
- sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
- -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
- -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \
- -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
- -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \
- -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \
- -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \
- -e 's|@''HAVE_FDATASYNC''@|$(HAVE_FDATASYNC)|g' \
- -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
- -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
- -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
- -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \
- -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
- -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \
- -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
- -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \
- -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \
- -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \
- -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \
- -e 's|@''HAVE_PIPE''@|$(HAVE_PIPE)|g' \
- -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \
- -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \
- -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \
- -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
- -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
- -e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \
- -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
- -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
- -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
- -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
- -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
- -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
- -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \
- -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \
- -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \
- -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
- -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
- -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \
- -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \
- -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \
- -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
- -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
- | \
- sed -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
- -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
- -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
- -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
- -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
- -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
- -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
- -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
- -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \
- -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
- -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
- -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
- -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \
- -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
- -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
- -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \
- -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
- -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \
- -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \
- -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \
- -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
- -e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \
- -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
- -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
- -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \
- -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \
- -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \
- -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \
- -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \
- -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \
- -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
- -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
- -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += unistd.h unistd.h-t
-
-EXTRA_DIST += unistd.in.h
-
-## end gnulib module unistd
-
-## begin gnulib module unsetenv
-
-
-EXTRA_DIST += unsetenv.c
-
-EXTRA_libgnu_gpl_la_SOURCES += unsetenv.c
-
-## end gnulib module unsetenv
-
-## begin gnulib module vasnprintf
-
-
-EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h
-
-EXTRA_libgnu_gpl_la_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c
-
-## end gnulib module vasnprintf
-
-## begin gnulib module verify
-
-
-EXTRA_DIST += verify.h
-
-## end gnulib module verify
-
-## begin gnulib module wchar
-
-BUILT_SOURCES += wchar.h
-
-# We need the following in order to create <wchar.h> when the system
-# version does not work standalone.
-wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL_GGL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
- -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
- -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
- -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \
- -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \
- -e 's/@''GNULIB_MBSINIT''@/$(GNULIB_MBSINIT)/g' \
- -e 's/@''GNULIB_MBRTOWC''@/$(GNULIB_MBRTOWC)/g' \
- -e 's/@''GNULIB_MBRLEN''@/$(GNULIB_MBRLEN)/g' \
- -e 's/@''GNULIB_MBSRTOWCS''@/$(GNULIB_MBSRTOWCS)/g' \
- -e 's/@''GNULIB_MBSNRTOWCS''@/$(GNULIB_MBSNRTOWCS)/g' \
- -e 's/@''GNULIB_WCRTOMB''@/$(GNULIB_WCRTOMB)/g' \
- -e 's/@''GNULIB_WCSRTOMBS''@/$(GNULIB_WCSRTOMBS)/g' \
- -e 's/@''GNULIB_WCSNRTOMBS''@/$(GNULIB_WCSNRTOMBS)/g' \
- -e 's/@''GNULIB_WCWIDTH''@/$(GNULIB_WCWIDTH)/g' \
- -e 's/@''GNULIB_WMEMCHR''@/$(GNULIB_WMEMCHR)/g' \
- -e 's/@''GNULIB_WMEMCMP''@/$(GNULIB_WMEMCMP)/g' \
- -e 's/@''GNULIB_WMEMCPY''@/$(GNULIB_WMEMCPY)/g' \
- -e 's/@''GNULIB_WMEMMOVE''@/$(GNULIB_WMEMMOVE)/g' \
- -e 's/@''GNULIB_WMEMSET''@/$(GNULIB_WMEMSET)/g' \
- -e 's/@''GNULIB_WCSLEN''@/$(GNULIB_WCSLEN)/g' \
- -e 's/@''GNULIB_WCSNLEN''@/$(GNULIB_WCSNLEN)/g' \
- -e 's/@''GNULIB_WCSCPY''@/$(GNULIB_WCSCPY)/g' \
- -e 's/@''GNULIB_WCPCPY''@/$(GNULIB_WCPCPY)/g' \
- -e 's/@''GNULIB_WCSNCPY''@/$(GNULIB_WCSNCPY)/g' \
- -e 's/@''GNULIB_WCPNCPY''@/$(GNULIB_WCPNCPY)/g' \
- -e 's/@''GNULIB_WCSCAT''@/$(GNULIB_WCSCAT)/g' \
- -e 's/@''GNULIB_WCSNCAT''@/$(GNULIB_WCSNCAT)/g' \
- -e 's/@''GNULIB_WCSCMP''@/$(GNULIB_WCSCMP)/g' \
- -e 's/@''GNULIB_WCSNCMP''@/$(GNULIB_WCSNCMP)/g' \
- -e 's/@''GNULIB_WCSCASECMP''@/$(GNULIB_WCSCASECMP)/g' \
- -e 's/@''GNULIB_WCSNCASECMP''@/$(GNULIB_WCSNCASECMP)/g' \
- -e 's/@''GNULIB_WCSCOLL''@/$(GNULIB_WCSCOLL)/g' \
- -e 's/@''GNULIB_WCSXFRM''@/$(GNULIB_WCSXFRM)/g' \
- -e 's/@''GNULIB_WCSDUP''@/$(GNULIB_WCSDUP)/g' \
- -e 's/@''GNULIB_WCSCHR''@/$(GNULIB_WCSCHR)/g' \
- -e 's/@''GNULIB_WCSRCHR''@/$(GNULIB_WCSRCHR)/g' \
- -e 's/@''GNULIB_WCSCSPN''@/$(GNULIB_WCSCSPN)/g' \
- -e 's/@''GNULIB_WCSSPN''@/$(GNULIB_WCSSPN)/g' \
- -e 's/@''GNULIB_WCSPBRK''@/$(GNULIB_WCSPBRK)/g' \
- -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \
- -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \
- -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \
- < $(srcdir)/wchar.in.h | \
- sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
- -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
- -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
- -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
- -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \
- -e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \
- -e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \
- -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \
- -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \
- -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \
- -e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \
- -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \
- -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \
- -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \
- -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \
- -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \
- -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \
- -e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \
- -e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \
- -e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \
- -e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \
- -e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \
- -e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \
- -e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \
- -e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \
- -e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \
- -e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \
- -e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \
- -e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \
- -e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \
- -e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \
- -e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \
- -e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \
- -e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \
- -e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \
- -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \
- -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \
- -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \
- -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
- -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
- | \
- sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
- -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \
- -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \
- -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
- -e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \
- -e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \
- -e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \
- -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \
- -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \
- -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
- -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
- -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
- -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += wchar.h wchar.h-t
-
-EXTRA_DIST += wchar.in.h
-
-## end gnulib module wchar
-
-## begin gnulib module xalloc
-
-libgnu_gpl_la_SOURCES += xmalloc.c
-
-EXTRA_DIST += xalloc.h
-
-## end gnulib module xalloc
-
-## begin gnulib module xalloc-die
-
-libgnu_gpl_la_SOURCES += xalloc-die.c
-
-## end gnulib module xalloc-die
-
-## begin gnulib module xalloc-oversized
-
-
-EXTRA_DIST += xalloc-oversized.h
-
-## end gnulib module xalloc-oversized
-
-## begin gnulib module xsize
-
-libgnu_gpl_la_SOURCES += xsize.h xsize.c
-
-## end gnulib module xsize
-
-
-mostlyclean-local: mostlyclean-generic
- @for dir in '' $(MOSTLYCLEANDIRS); do \
- if test -n "$$dir" && test -d $$dir; then \
- echo "rmdir $$dir"; rmdir $$dir; \
- fi; \
- done; \
- :
diff --git a/src/gl/accept.c b/src/gl/accept.c
deleted file mode 100644
index bd0605eb63..0000000000
--- a/src/gl/accept.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* accept.c --- wrappers for Windows accept function
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef accept
-
-int
-rpl_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- SOCKET fh = accept (sock, addr, addrlen);
- if (fh == INVALID_SOCKET)
- {
- set_winsock_errno ();
- return -1;
- }
- else
- return SOCKET_TO_FD (fh);
- }
-}
diff --git a/src/gl/alloca.c b/src/gl/alloca.c
deleted file mode 100644
index ee0f018868..0000000000
--- a/src/gl/alloca.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/* alloca.c -- allocate automatically reclaimed memory
- (Mostly) portable public-domain implementation -- D A Gwyn
-
- This implementation of the PWB library alloca function,
- which is used to allocate space off the run-time stack so
- that it is automatically reclaimed upon procedure exit,
- was inspired by discussions with J. Q. Johnson of Cornell.
- J.Otto Tennant <jot@cray.com> contributed the Cray support.
-
- There are some preprocessor constants that can
- be defined when compiling for your specific system, for
- improved efficiency; however, the defaults should be okay.
-
- The general concept of this implementation is to keep
- track of all alloca-allocated blocks, and reclaim any
- that are found to be deeper in the stack than the current
- invocation. This heuristic does not reclaim storage as
- soon as it becomes invalid, but it will do so eventually.
-
- As a special case, alloca(0) reclaims storage without
- allocating any. It is a good idea to use alloca(0) in
- your main control loop, etc. to force garbage collection. */
-
-#include <config.h>
-
-#include <alloca.h>
-
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef emacs
-# include "lisp.h"
-# include "blockinput.h"
-# ifdef EMACS_FREE
-# undef free
-# define free EMACS_FREE
-# endif
-#else
-# define memory_full() abort ()
-#endif
-
-/* If compiling with GCC 2, this file's not needed. */
-#if !defined (__GNUC__) || __GNUC__ < 2
-
-/* If someone has defined alloca as a macro,
- there must be some other way alloca is supposed to work. */
-# ifndef alloca
-
-# ifdef emacs
-# ifdef static
-/* actually, only want this if static is defined as ""
- -- this is for usg, in which emacs must undefine static
- in order to make unexec workable
- */
-# ifndef STACK_DIRECTION
-you
-lose
--- must know STACK_DIRECTION at compile-time
-/* Using #error here is not wise since this file should work for
- old and obscure compilers. */
-# endif /* STACK_DIRECTION undefined */
-# endif /* static */
-# endif /* emacs */
-
-/* If your stack is a linked list of frames, you have to
- provide an "address metric" ADDRESS_FUNCTION macro. */
-
-# if defined (CRAY) && defined (CRAY_STACKSEG_END)
-long i00afunc ();
-# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
-# else
-# define ADDRESS_FUNCTION(arg) &(arg)
-# endif
-
-/* Define STACK_DIRECTION if you know the direction of stack
- growth for your system; otherwise it will be automatically
- deduced at run-time.
-
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-
-# ifndef STACK_DIRECTION
-# define STACK_DIRECTION 0 /* Direction unknown. */
-# endif
-
-# if STACK_DIRECTION != 0
-
-# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
-
-# else /* STACK_DIRECTION == 0; need run-time code. */
-
-static int stack_dir; /* 1 or -1 once known. */
-# define STACK_DIR stack_dir
-
-static int
-find_stack_direction (int *addr, int depth)
-{
- int dir, dummy = 0;
- if (! addr)
- addr = &dummy;
- *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
- dir = depth ? find_stack_direction (addr, depth - 1) : 0;
- return dir + dummy;
-}
-
-# endif /* STACK_DIRECTION == 0 */
-
-/* An "alloca header" is used to:
- (a) chain together all alloca'ed blocks;
- (b) keep track of stack depth.
-
- It is very important that sizeof(header) agree with malloc
- alignment chunk size. The following default should work okay. */
-
-# ifndef ALIGN_SIZE
-# define ALIGN_SIZE sizeof(double)
-# endif
-
-typedef union hdr
-{
- char align[ALIGN_SIZE]; /* To force sizeof(header). */
- struct
- {
- union hdr *next; /* For chaining headers. */
- char *deep; /* For stack depth measure. */
- } h;
-} header;
-
-static header *last_alloca_header = NULL; /* -> last alloca header. */
-
-/* Return a pointer to at least SIZE bytes of storage,
- which will be automatically reclaimed upon exit from
- the procedure that called alloca. Originally, this space
- was supposed to be taken from the current stack frame of the
- caller, but that method cannot be made to work for some
- implementations of C, for example under Gould's UTX/32. */
-
-void *
-alloca (size_t size)
-{
- auto char probe; /* Probes stack depth: */
- register char *depth = ADDRESS_FUNCTION (probe);
-
-# if STACK_DIRECTION == 0
- if (STACK_DIR == 0) /* Unknown growth direction. */
- STACK_DIR = find_stack_direction (NULL, (size & 1) + 20);
-# endif
-
- /* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
-
- {
- register header *hp; /* Traverses linked list. */
-
-# ifdef emacs
- BLOCK_INPUT;
-# endif
-
- for (hp = last_alloca_header; hp != NULL;)
- if ((STACK_DIR > 0 && hp->h.deep > depth)
- || (STACK_DIR < 0 && hp->h.deep < depth))
- {
- register header *np = hp->h.next;
-
- free (hp); /* Collect garbage. */
-
- hp = np; /* -> next header. */
- }
- else
- break; /* Rest are not deeper. */
-
- last_alloca_header = hp; /* -> last valid storage. */
-
-# ifdef emacs
- UNBLOCK_INPUT;
-# endif
- }
-
- if (size == 0)
- return NULL; /* No allocation required. */
-
- /* Allocate combined header + user data storage. */
-
- {
- /* Address of header. */
- register header *new;
-
- size_t combined_size = sizeof (header) + size;
- if (combined_size < sizeof (header))
- memory_full ();
-
- new = malloc (combined_size);
-
- if (! new)
- memory_full ();
-
- new->h.next = last_alloca_header;
- new->h.deep = depth;
-
- last_alloca_header = new;
-
- /* User storage begins just after header. */
-
- return (void *) (new + 1);
- }
-}
-
-# if defined (CRAY) && defined (CRAY_STACKSEG_END)
-
-# ifdef DEBUG_I00AFUNC
-# include <stdio.h>
-# endif
-
-# ifndef CRAY_STACK
-# define CRAY_STACK
-# ifndef CRAY2
-/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
-struct stack_control_header
- {
- long shgrow:32; /* Number of times stack has grown. */
- long shaseg:32; /* Size of increments to stack. */
- long shhwm:32; /* High water mark of stack. */
- long shsize:32; /* Current size of stack (all segments). */
- };
-
-/* The stack segment linkage control information occurs at
- the high-address end of a stack segment. (The stack
- grows from low addresses to high addresses.) The initial
- part of the stack segment linkage control information is
- 0200 (octal) words. This provides for register storage
- for the routine which overflows the stack. */
-
-struct stack_segment_linkage
- {
- long ss[0200]; /* 0200 overflow words. */
- long sssize:32; /* Number of words in this segment. */
- long ssbase:32; /* Offset to stack base. */
- long:32;
- long sspseg:32; /* Offset to linkage control of previous
- segment of stack. */
- long:32;
- long sstcpt:32; /* Pointer to task common address block. */
- long sscsnm; /* Private control structure number for
- microtasking. */
- long ssusr1; /* Reserved for user. */
- long ssusr2; /* Reserved for user. */
- long sstpid; /* Process ID for pid based multi-tasking. */
- long ssgvup; /* Pointer to multitasking thread giveup. */
- long sscray[7]; /* Reserved for Cray Research. */
- long ssa0;
- long ssa1;
- long ssa2;
- long ssa3;
- long ssa4;
- long ssa5;
- long ssa6;
- long ssa7;
- long sss0;
- long sss1;
- long sss2;
- long sss3;
- long sss4;
- long sss5;
- long sss6;
- long sss7;
- };
-
-# else /* CRAY2 */
-/* The following structure defines the vector of words
- returned by the STKSTAT library routine. */
-struct stk_stat
- {
- long now; /* Current total stack size. */
- long maxc; /* Amount of contiguous space which would
- be required to satisfy the maximum
- stack demand to date. */
- long high_water; /* Stack high-water mark. */
- long overflows; /* Number of stack overflow ($STKOFEN) calls. */
- long hits; /* Number of internal buffer hits. */
- long extends; /* Number of block extensions. */
- long stko_mallocs; /* Block allocations by $STKOFEN. */
- long underflows; /* Number of stack underflow calls ($STKRETN). */
- long stko_free; /* Number of deallocations by $STKRETN. */
- long stkm_free; /* Number of deallocations by $STKMRET. */
- long segments; /* Current number of stack segments. */
- long maxs; /* Maximum number of stack segments so far. */
- long pad_size; /* Stack pad size. */
- long current_address; /* Current stack segment address. */
- long current_size; /* Current stack segment size. This
- number is actually corrupted by STKSTAT to
- include the fifteen word trailer area. */
- long initial_address; /* Address of initial segment. */
- long initial_size; /* Size of initial segment. */
- };
-
-/* The following structure describes the data structure which trails
- any stack segment. I think that the description in 'asdef' is
- out of date. I only describe the parts that I am sure about. */
-
-struct stk_trailer
- {
- long this_address; /* Address of this block. */
- long this_size; /* Size of this block (does not include
- this trailer). */
- long unknown2;
- long unknown3;
- long link; /* Address of trailer block of previous
- segment. */
- long unknown5;
- long unknown6;
- long unknown7;
- long unknown8;
- long unknown9;
- long unknown10;
- long unknown11;
- long unknown12;
- long unknown13;
- long unknown14;
- };
-
-# endif /* CRAY2 */
-# endif /* not CRAY_STACK */
-
-# ifdef CRAY2
-/* Determine a "stack measure" for an arbitrary ADDRESS.
- I doubt that "lint" will like this much. */
-
-static long
-i00afunc (long *address)
-{
- struct stk_stat status;
- struct stk_trailer *trailer;
- long *block, size;
- long result = 0;
-
- /* We want to iterate through all of the segments. The first
- step is to get the stack status structure. We could do this
- more quickly and more directly, perhaps, by referencing the
- $LM00 common block, but I know that this works. */
-
- STKSTAT (&status);
-
- /* Set up the iteration. */
-
- trailer = (struct stk_trailer *) (status.current_address
- + status.current_size
- - 15);
-
- /* There must be at least one stack segment. Therefore it is
- a fatal error if "trailer" is null. */
-
- if (trailer == 0)
- abort ();
-
- /* Discard segments that do not contain our argument address. */
-
- while (trailer != 0)
- {
- block = (long *) trailer->this_address;
- size = trailer->this_size;
- if (block == 0 || size == 0)
- abort ();
- trailer = (struct stk_trailer *) trailer->link;
- if ((block <= address) && (address < (block + size)))
- break;
- }
-
- /* Set the result to the offset in this segment and add the sizes
- of all predecessor segments. */
-
- result = address - block;
-
- if (trailer == 0)
- {
- return result;
- }
-
- do
- {
- if (trailer->this_size <= 0)
- abort ();
- result += trailer->this_size;
- trailer = (struct stk_trailer *) trailer->link;
- }
- while (trailer != 0);
-
- /* We are done. Note that if you present a bogus address (one
- not in any segment), you will get a different number back, formed
- from subtracting the address of the first block. This is probably
- not what you want. */
-
- return (result);
-}
-
-# else /* not CRAY2 */
-/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
- Determine the number of the cell within the stack,
- given the address of the cell. The purpose of this
- routine is to linearize, in some sense, stack addresses
- for alloca. */
-
-static long
-i00afunc (long address)
-{
- long stkl = 0;
-
- long size, pseg, this_segment, stack;
- long result = 0;
-
- struct stack_segment_linkage *ssptr;
-
- /* Register B67 contains the address of the end of the
- current stack segment. If you (as a subprogram) store
- your registers on the stack and find that you are past
- the contents of B67, you have overflowed the segment.
-
- B67 also points to the stack segment linkage control
- area, which is what we are really interested in. */
-
- stkl = CRAY_STACKSEG_END ();
- ssptr = (struct stack_segment_linkage *) stkl;
-
- /* If one subtracts 'size' from the end of the segment,
- one has the address of the first word of the segment.
-
- If this is not the first segment, 'pseg' will be
- nonzero. */
-
- pseg = ssptr->sspseg;
- size = ssptr->sssize;
-
- this_segment = stkl - size;
-
- /* It is possible that calling this routine itself caused
- a stack overflow. Discard stack segments which do not
- contain the target address. */
-
- while (!(this_segment <= address && address <= stkl))
- {
-# ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-# endif
- if (pseg == 0)
- break;
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- this_segment = stkl - size;
- }
-
- result = address - this_segment;
-
- /* If you subtract pseg from the current end of the stack,
- you get the address of the previous stack segment's end.
- This seems a little convoluted to me, but I'll bet you save
- a cycle somewhere. */
-
- while (pseg != 0)
- {
-# ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o\n", pseg, size);
-# endif
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- result += size;
- }
- return (result);
-}
-
-# endif /* not CRAY2 */
-# endif /* CRAY */
-
-# endif /* no alloca */
-#endif /* not GCC 2 */
diff --git a/src/gl/alloca.in.h b/src/gl/alloca.in.h
deleted file mode 100644
index 6a25ecdb7b..0000000000
--- a/src/gl/alloca.in.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Memory allocation on the stack.
-
- Copyright (C) 1995, 1999, 2001-2004, 2006-2016 Free Software Foundation,
- Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, see
- <http://www.gnu.org/licenses/>.
- */
-
-/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
- means there is a real alloca function. */
-#ifndef _GL_ALLOCA_H
-#define _GL_ALLOCA_H
-
-/* alloca (N) returns a pointer to N bytes of memory
- allocated on the stack, which will last until the function returns.
- Use of alloca should be avoided:
- - inside arguments of function calls - undefined behaviour,
- - in inline functions - the allocation may actually last until the
- calling function returns,
- - for huge N (say, N >= 65536) - you never know how large (or small)
- the stack is, and when the stack cannot fulfill the memory allocation
- request, the program just crashes.
- */
-
-#ifndef alloca
-# ifdef __GNUC__
-# define alloca __builtin_alloca
-# elif defined _AIX
-# define alloca __alloca
-# elif defined _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# elif defined __DECC && defined __VMS
-# define alloca __ALLOCA
-# elif defined __TANDEM && defined _TNS_E_TARGET
-# ifdef __cplusplus
-extern "C"
-# endif
-void *_alloca (unsigned short);
-# pragma intrinsic (_alloca)
-# define alloca _alloca
-# elif defined __MVS__
-# include <stdlib.h>
-# else
-# include <stddef.h>
-# ifdef __cplusplus
-extern "C"
-# endif
-void *alloca (size_t);
-# endif
-#endif
-
-#endif /* _GL_ALLOCA_H */
diff --git a/src/gl/arpa_inet.in.h b/src/gl/arpa_inet.in.h
deleted file mode 100644
index 026c4dcb6d..0000000000
--- a/src/gl/arpa_inet.in.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* A GNU-like <arpa/inet.h>.
-
- Copyright (C) 2005-2006, 2008-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _@GUARD_PREFIX@_ARPA_INET_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if @HAVE_FEATURES_H@
-# include <features.h> /* for __GLIBC__ */
-#endif
-
-/* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and
- for pulling in winsock2.h etc. under MinGW.
- But avoid namespace pollution on glibc systems. */
-#ifndef __GLIBC__
-# include <sys/socket.h>
-#endif
-
-/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
- But avoid namespace pollution on glibc systems. */
-#if defined __TANDEM && !defined __GLIBC__
-# include <netdb.h>
-#endif
-
-#if @HAVE_ARPA_INET_H@
-
-/* The include_next requires a split double-inclusion guard. */
-# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
-
-#endif
-
-#ifndef _@GUARD_PREFIX@_ARPA_INET_H
-#define _@GUARD_PREFIX@_ARPA_INET_H
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-
-#if @GNULIB_INET_NTOP@
-/* Converts an internet address from internal format to a printable,
- presentable format.
- AF is an internet address family, such as AF_INET or AF_INET6.
- SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
- (for AF_INET6).
- DST points to a buffer having room for CNT bytes.
- The printable representation of the address (in numeric form, not
- surrounded by [...], no reverse DNS is done) is placed in DST, and
- DST is returned. If an error occurs, the return value is NULL and
- errno is set. If CNT bytes are not sufficient to hold the result,
- the return value is NULL and errno is set to ENOSPC. A good value
- for CNT is 46.
-
- For more details, see the POSIX:2001 specification
- <http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
-# if @REPLACE_INET_NTOP@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef inet_ntop
-# define inet_ntop rpl_inet_ntop
-# endif
-_GL_FUNCDECL_RPL (inet_ntop, const char *,
- (int af, const void *restrict src,
- char *restrict dst, socklen_t cnt)
- _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (inet_ntop, const char *,
- (int af, const void *restrict src,
- char *restrict dst, socklen_t cnt));
-# else
-# if !@HAVE_DECL_INET_NTOP@
-_GL_FUNCDECL_SYS (inet_ntop, const char *,
- (int af, const void *restrict src,
- char *restrict dst, socklen_t cnt)
- _GL_ARG_NONNULL ((2, 3)));
-# endif
-/* Need to cast, because on NonStop Kernel, the fourth parameter is
- size_t cnt. */
-_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
- (int af, const void *restrict src,
- char *restrict dst, socklen_t cnt));
-# endif
-_GL_CXXALIASWARN (inet_ntop);
-#elif defined GNULIB_POSIXCHECK
-# undef inet_ntop
-# if HAVE_RAW_DECL_INET_NTOP
-_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
- "use gnulib module inet_ntop for portability");
-# endif
-#endif
-
-#if @GNULIB_INET_PTON@
-# if @REPLACE_INET_PTON@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef inet_pton
-# define inet_pton rpl_inet_pton
-# endif
-_GL_FUNCDECL_RPL (inet_pton, int,
- (int af, const char *restrict src, void *restrict dst)
- _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (inet_pton, int,
- (int af, const char *restrict src, void *restrict dst));
-# else
-# if !@HAVE_DECL_INET_PTON@
-_GL_FUNCDECL_SYS (inet_pton, int,
- (int af, const char *restrict src, void *restrict dst)
- _GL_ARG_NONNULL ((2, 3)));
-# endif
-_GL_CXXALIAS_SYS (inet_pton, int,
- (int af, const char *restrict src, void *restrict dst));
-# endif
-_GL_CXXALIASWARN (inet_pton);
-#elif defined GNULIB_POSIXCHECK
-# undef inet_pton
-# if HAVE_RAW_DECL_INET_PTON
-_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
- "use gnulib module inet_pton for portability");
-# endif
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
-#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
diff --git a/src/gl/asnprintf.c b/src/gl/asnprintf.c
deleted file mode 100644
index f23b776786..0000000000
--- a/src/gl/asnprintf.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include "vasnprintf.h"
-
-#include <stdarg.h>
-
-char *
-asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
-{
- va_list args;
- char *result;
-
- va_start (args, format);
- result = vasnprintf (resultbuf, lengthp, format, args);
- va_end (args);
- return result;
-}
diff --git a/src/gl/basename-lgpl.c b/src/gl/basename-lgpl.c
deleted file mode 100644
index 11821096ae..0000000000
--- a/src/gl/basename-lgpl.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* basename.c -- return the last element in a file name
-
- Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software
- Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include "dirname.h"
-
-#include <string.h>
-
-/* Return the address of the last file name component of NAME. If
- NAME has no relative file name components because it is a file
- system root, return the empty string. */
-
-char *
-last_component (char const *name)
-{
- char const *base = name + FILE_SYSTEM_PREFIX_LEN (name);
- char const *p;
- bool saw_slash = false;
-
- while (ISSLASH (*base))
- base++;
-
- for (p = base; *p; p++)
- {
- if (ISSLASH (*p))
- saw_slash = true;
- else if (saw_slash)
- {
- base = p;
- saw_slash = false;
- }
- }
-
- return (char *) base;
-}
-
-/* Return the length of the basename NAME. Typically NAME is the
- value returned by base_name or last_component. Act like strlen
- (NAME), except omit all trailing slashes. */
-
-size_t
-base_len (char const *name)
-{
- size_t len;
- size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
-
- for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--)
- continue;
-
- if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1
- && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2])
- return 2;
-
- if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len
- && len == prefix_len && ISSLASH (name[prefix_len]))
- return prefix_len + 1;
-
- return len;
-}
diff --git a/src/gl/bind.c b/src/gl/bind.c
deleted file mode 100644
index 7f526e27cd..0000000000
--- a/src/gl/bind.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* bind.c --- wrappers for Windows bind function
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef bind
-
-int
-rpl_bind (int fd, const struct sockaddr *sockaddr, socklen_t len)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- int r = bind (sock, sockaddr, len);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
- }
-}
diff --git a/src/gl/c-ctype.c b/src/gl/c-ctype.c
deleted file mode 100644
index 5d9d4d87a6..0000000000
--- a/src/gl/c-ctype.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <config.h>
-#define C_CTYPE_INLINE _GL_EXTERN_INLINE
-#include "c-ctype.h"
diff --git a/src/gl/c-ctype.h b/src/gl/c-ctype.h
deleted file mode 100644
index 717ae78bb6..0000000000
--- a/src/gl/c-ctype.h
+++ /dev/null
@@ -1,366 +0,0 @@
-/* Character handling in C locale.
-
- These functions work like the corresponding functions in <ctype.h>,
- except that they have the C (POSIX) locale hardwired, whereas the
- <ctype.h> functions' behaviour depends on the current locale set via
- setlocale.
-
- Copyright (C) 2000-2003, 2006, 2008-2016 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef C_CTYPE_H
-#define C_CTYPE_H
-
-#include <stdbool.h>
-
-#ifndef _GL_INLINE_HEADER_BEGIN
- #error "Please include config.h first."
-#endif
-_GL_INLINE_HEADER_BEGIN
-#ifndef C_CTYPE_INLINE
-# define C_CTYPE_INLINE _GL_INLINE
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* The functions defined in this file assume the "C" locale and a character
- set without diacritics (ASCII-US or EBCDIC-US or something like that).
- Even if the "C" locale on a particular system is an extension of the ASCII
- character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it
- is ISO-8859-1), the functions in this file recognize only the ASCII
- characters. */
-
-
-#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
- && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
- && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
- && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
- && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
- && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
- && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
- && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
- && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
- && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
- && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
- && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
- && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
- && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
- && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
- && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
- && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
- && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
- && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
- && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
- && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
- && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
- && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)
-/* The character set is ASCII or one of its variants or extensions, not EBCDIC.
- Testing the value of '\n' and '\r' is not relevant. */
-# define C_CTYPE_ASCII 1
-#elif ! (' ' == '\x40' && '0' == '\xf0' \
- && 'A' == '\xc1' && 'J' == '\xd1' && 'S' == '\xe2' \
- && 'a' == '\x81' && 'j' == '\x91' && 's' == '\xa2')
-# error "Only ASCII and EBCDIC are supported"
-#endif
-
-#if 'A' < 0
-# error "EBCDIC and char is signed -- not supported"
-#endif
-
-/* Cases for control characters. */
-
-#define _C_CTYPE_CNTRL \
- case '\a': case '\b': case '\f': case '\n': \
- case '\r': case '\t': case '\v': \
- _C_CTYPE_OTHER_CNTRL
-
-/* ASCII control characters other than those with \-letter escapes. */
-
-#if C_CTYPE_ASCII
-# define _C_CTYPE_OTHER_CNTRL \
- case '\x00': case '\x01': case '\x02': case '\x03': \
- case '\x04': case '\x05': case '\x06': case '\x0e': \
- case '\x0f': case '\x10': case '\x11': case '\x12': \
- case '\x13': case '\x14': case '\x15': case '\x16': \
- case '\x17': case '\x18': case '\x19': case '\x1a': \
- case '\x1b': case '\x1c': case '\x1d': case '\x1e': \
- case '\x1f': case '\x7f'
-#else
- /* Use EBCDIC code page 1047's assignments for ASCII control chars;
- assume all EBCDIC code pages agree about these assignments. */
-# define _C_CTYPE_OTHER_CNTRL \
- case '\x00': case '\x01': case '\x02': case '\x03': \
- case '\x07': case '\x0e': case '\x0f': case '\x10': \
- case '\x11': case '\x12': case '\x13': case '\x18': \
- case '\x19': case '\x1c': case '\x1d': case '\x1e': \
- case '\x1f': case '\x26': case '\x27': case '\x2d': \
- case '\x2e': case '\x32': case '\x37': case '\x3c': \
- case '\x3d': case '\x3f'
-#endif
-
-/* Cases for lowercase hex letters, and lowercase letters, all offset by N. */
-
-#define _C_CTYPE_LOWER_A_THRU_F_N(n) \
- case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \
- case 'e' + (n): case 'f' + (n)
-#define _C_CTYPE_LOWER_N(n) \
- _C_CTYPE_LOWER_A_THRU_F_N(n): \
- case 'g' + (n): case 'h' + (n): case 'i' + (n): case 'j' + (n): \
- case 'k' + (n): case 'l' + (n): case 'm' + (n): case 'n' + (n): \
- case 'o' + (n): case 'p' + (n): case 'q' + (n): case 'r' + (n): \
- case 's' + (n): case 't' + (n): case 'u' + (n): case 'v' + (n): \
- case 'w' + (n): case 'x' + (n): case 'y' + (n): case 'z' + (n)
-
-/* Cases for hex letters, digits, lower, punct, and upper. */
-
-#define _C_CTYPE_A_THRU_F \
- _C_CTYPE_LOWER_A_THRU_F_N (0): \
- _C_CTYPE_LOWER_A_THRU_F_N ('A' - 'a')
-#define _C_CTYPE_DIGIT \
- case '0': case '1': case '2': case '3': \
- case '4': case '5': case '6': case '7': \
- case '8': case '9'
-#define _C_CTYPE_LOWER _C_CTYPE_LOWER_N (0)
-#define _C_CTYPE_PUNCT \
- case '!': case '"': case '#': case '$': \
- case '%': case '&': case '\'': case '(': \
- case ')': case '*': case '+': case ',': \
- case '-': case '.': case '/': case ':': \
- case ';': case '<': case '=': case '>': \
- case '?': case '@': case '[': case '\\': \
- case ']': case '^': case '_': case '`': \
- case '{': case '|': case '}': case '~'
-#define _C_CTYPE_UPPER _C_CTYPE_LOWER_N ('A' - 'a')
-
-
-/* Function definitions. */
-
-/* Unlike the functions in <ctype.h>, which require an argument in the range
- of the 'unsigned char' type, the functions here operate on values that are
- in the 'unsigned char' range or in the 'char' range. In other words,
- when you have a 'char' value, you need to cast it before using it as
- argument to a <ctype.h> function:
-
- const char *s = ...;
- if (isalpha ((unsigned char) *s)) ...
-
- but you don't need to cast it for the functions defined in this file:
-
- const char *s = ...;
- if (c_isalpha (*s)) ...
- */
-
-C_CTYPE_INLINE bool
-c_isalnum (int c)
-{
- switch (c)
- {
- _C_CTYPE_DIGIT:
- _C_CTYPE_LOWER:
- _C_CTYPE_UPPER:
- return true;
- default:
- return false;
- }
-}
-
-C_CTYPE_INLINE bool
-c_isalpha (int c)
-{
- switch (c)
- {
- _C_CTYPE_LOWER:
- _C_CTYPE_UPPER:
- return true;
- default:
- return false;
- }
-}
-
-/* The function isascii is not locale dependent.
- Its use in EBCDIC is questionable. */
-C_CTYPE_INLINE bool
-c_isascii (int c)
-{
- switch (c)
- {
- case ' ':
- _C_CTYPE_CNTRL:
- _C_CTYPE_DIGIT:
- _C_CTYPE_LOWER:
- _C_CTYPE_PUNCT:
- _C_CTYPE_UPPER:
- return true;
- default:
- return false;
- }
-}
-
-C_CTYPE_INLINE bool
-c_isblank (int c)
-{
- return c == ' ' || c == '\t';
-}
-
-C_CTYPE_INLINE bool
-c_iscntrl (int c)
-{
- switch (c)
- {
- _C_CTYPE_CNTRL:
- return true;
- default:
- return false;
- }
-}
-
-C_CTYPE_INLINE bool
-c_isdigit (int c)
-{
- switch (c)
- {
- _C_CTYPE_DIGIT:
- return true;
- default:
- return false;
- }
-}
-
-C_CTYPE_INLINE bool
-c_isgraph (int c)
-{
- switch (c)
- {
- _C_CTYPE_DIGIT:
- _C_CTYPE_LOWER:
- _C_CTYPE_PUNCT:
- _C_CTYPE_UPPER:
- return true;
- default:
- return false;
- }
-}
-
-C_CTYPE_INLINE bool
-c_islower (int c)
-{
- switch (c)
- {
- _C_CTYPE_LOWER:
- return true;
- default:
- return false;
- }
-}
-
-C_CTYPE_INLINE bool
-c_isprint (int c)
-{
- switch (c)
- {
- case ' ':
- _C_CTYPE_DIGIT:
- _C_CTYPE_LOWER:
- _C_CTYPE_PUNCT:
- _C_CTYPE_UPPER:
- return true;
- default:
- return false;
- }
-}
-
-C_CTYPE_INLINE bool
-c_ispunct (int c)
-{
- switch (c)
- {
- _C_CTYPE_PUNCT:
- return true;
- default:
- return false;
- }
-}
-
-C_CTYPE_INLINE bool
-c_isspace (int c)
-{
- switch (c)
- {
- case ' ': case '\t': case '\n': case '\v': case '\f': case '\r':
- return true;
- default:
- return false;
- }
-}
-
-C_CTYPE_INLINE bool
-c_isupper (int c)
-{
- switch (c)
- {
- _C_CTYPE_UPPER:
- return true;
- default:
- return false;
- }
-}
-
-C_CTYPE_INLINE bool
-c_isxdigit (int c)
-{
- switch (c)
- {
- _C_CTYPE_DIGIT:
- _C_CTYPE_A_THRU_F:
- return true;
- default:
- return false;
- }
-}
-
-C_CTYPE_INLINE int
-c_tolower (int c)
-{
- switch (c)
- {
- _C_CTYPE_UPPER:
- return c - 'A' + 'a';
- default:
- return c;
- }
-}
-
-C_CTYPE_INLINE int
-c_toupper (int c)
-{
- switch (c)
- {
- _C_CTYPE_LOWER:
- return c - 'a' + 'A';
- default:
- return c;
- }
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-_GL_INLINE_HEADER_END
-
-#endif /* C_CTYPE_H */
diff --git a/src/gl/close.c b/src/gl/close.c
deleted file mode 100644
index 46a7aa5176..0000000000
--- a/src/gl/close.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* close replacement.
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <unistd.h>
-
-#include <errno.h>
-
-#include "fd-hook.h"
-#include "msvc-inval.h"
-
-#undef close
-
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-static int
-close_nothrow (int fd)
-{
- int result;
-
- TRY_MSVC_INVAL
- {
- result = close (fd);
- }
- CATCH_MSVC_INVAL
- {
- result = -1;
- errno = EBADF;
- }
- DONE_MSVC_INVAL;
-
- return result;
-}
-#else
-# define close_nothrow close
-#endif
-
-/* Override close() to call into other gnulib modules. */
-
-int
-rpl_close (int fd)
-{
-#if WINDOWS_SOCKETS
- int retval = execute_all_close_hooks (close_nothrow, fd);
-#else
- int retval = close_nothrow (fd);
-#endif
-
-#if REPLACE_FCHDIR
- if (retval >= 0)
- _gl_unregister_fd (fd);
-#endif
-
- return retval;
-}
diff --git a/src/gl/connect.c b/src/gl/connect.c
deleted file mode 100644
index 1d423173e7..0000000000
--- a/src/gl/connect.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* connect.c --- wrappers for Windows connect function
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef connect
-
-int
-rpl_connect (int fd, const struct sockaddr *sockaddr, socklen_t len)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- int r = connect (sock, sockaddr, len);
- if (r < 0)
- {
- /* EINPROGRESS is not returned by WinSock 2.0; for backwards
- compatibility, connect(2) uses EWOULDBLOCK. */
- if (WSAGetLastError () == WSAEWOULDBLOCK)
- WSASetLastError (WSAEINPROGRESS);
-
- set_winsock_errno ();
- }
-
- return r;
- }
-}
diff --git a/src/gl/dirname-lgpl.c b/src/gl/dirname-lgpl.c
deleted file mode 100644
index a7aabf9416..0000000000
--- a/src/gl/dirname-lgpl.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* dirname.c -- return all but the last element in a file name
-
- Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software
- Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include "dirname.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-/* Return the length of the prefix of FILE that will be used by
- dir_name. If FILE is in the working directory, this returns zero
- even though 'dir_name (FILE)' will return ".". Works properly even
- if there are trailing slashes (by effectively ignoring them). */
-
-size_t
-dir_len (char const *file)
-{
- size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file);
- size_t length;
-
- /* Advance prefix_length beyond important leading slashes. */
- prefix_length += (prefix_length != 0
- ? (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
- && ISSLASH (file[prefix_length]))
- : (ISSLASH (file[0])
- ? ((DOUBLE_SLASH_IS_DISTINCT_ROOT
- && ISSLASH (file[1]) && ! ISSLASH (file[2])
- ? 2 : 1))
- : 0));
-
- /* Strip the basename and any redundant slashes before it. */
- for (length = last_component (file) - file;
- prefix_length < length; length--)
- if (! ISSLASH (file[length - 1]))
- break;
- return length;
-}
-
-
-/* In general, we can't use the builtin 'dirname' function if available,
- since it has different meanings in different environments.
- In some environments the builtin 'dirname' modifies its argument.
-
- Return the leading directories part of FILE, allocated with malloc.
- Works properly even if there are trailing slashes (by effectively
- ignoring them). Return NULL on failure.
-
- If lstat (FILE) would succeed, then { chdir (dir_name (FILE));
- lstat (base_name (FILE)); } will access the same file. Likewise,
- if the sequence { chdir (dir_name (FILE));
- rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE
- to "foo" in the same directory FILE was in. */
-
-char *
-mdir_name (char const *file)
-{
- size_t length = dir_len (file);
- bool append_dot = (length == 0
- || (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
- && length == FILE_SYSTEM_PREFIX_LEN (file)
- && file[2] != '\0' && ! ISSLASH (file[2])));
- char *dir = malloc (length + append_dot + 1);
- if (!dir)
- return NULL;
- memcpy (dir, file, length);
- if (append_dot)
- dir[length++] = '.';
- dir[length] = '\0';
- return dir;
-}
diff --git a/src/gl/dirname.h b/src/gl/dirname.h
deleted file mode 100644
index 875b31bae5..0000000000
--- a/src/gl/dirname.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Take file names apart into directory and base names.
-
- Copyright (C) 1998, 2001, 2003-2006, 2009-2016 Free Software Foundation,
- Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef DIRNAME_H_
-# define DIRNAME_H_ 1
-
-# include <stdbool.h>
-# include <stddef.h>
-# include "dosname.h"
-
-# ifndef DIRECTORY_SEPARATOR
-# define DIRECTORY_SEPARATOR '/'
-# endif
-
-# ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
-# define DOUBLE_SLASH_IS_DISTINCT_ROOT 0
-# endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-# if GNULIB_DIRNAME
-char *base_name (char const *file);
-char *dir_name (char const *file);
-# endif
-
-char *mdir_name (char const *file);
-size_t base_len (char const *file) _GL_ATTRIBUTE_PURE;
-size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE;
-char *last_component (char const *file) _GL_ATTRIBUTE_PURE;
-
-bool strip_trailing_slashes (char *file);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* not DIRNAME_H_ */
diff --git a/src/gl/dosname.h b/src/gl/dosname.h
deleted file mode 100644
index 83a953f3c0..0000000000
--- a/src/gl/dosname.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* File names on MS-DOS/Windows systems.
-
- Copyright (C) 2000-2001, 2004-2006, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- From Paul Eggert and Jim Meyering. */
-
-#ifndef _DOSNAME_H
-#define _DOSNAME_H
-
-#if (defined _WIN32 || defined __WIN32__ || \
- defined __MSDOS__ || defined __CYGWIN__ || \
- defined __EMX__ || defined __DJGPP__)
- /* This internal macro assumes ASCII, but all hosts that support drive
- letters use ASCII. */
-# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \
- <= 'z' - 'a')
-# define FILE_SYSTEM_PREFIX_LEN(Filename) \
- (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0)
-# ifndef __CYGWIN__
-# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
-# endif
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-#else
-# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
-# define ISSLASH(C) ((C) == '/')
-#endif
-
-#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
-# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
-#endif
-
-#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
-# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
-# else
-# define IS_ABSOLUTE_FILE_NAME(F) \
- (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0)
-#endif
-#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
-
-#endif /* DOSNAME_H_ */
diff --git a/src/gl/dup2.c b/src/gl/dup2.c
deleted file mode 100644
index 5d026f21fa..0000000000
--- a/src/gl/dup2.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/* Duplicate an open file descriptor to a specified file descriptor.
-
- Copyright (C) 1999, 2004-2007, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* written by Paul Eggert */
-
-#include <config.h>
-
-/* Specification. */
-#include <unistd.h>
-
-#include <errno.h>
-#include <fcntl.h>
-
-#if HAVE_DUP2
-
-# undef dup2
-
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-/* Get declarations of the native Windows API functions. */
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-
-# include "msvc-inval.h"
-
-/* Get _get_osfhandle. */
-# include "msvc-nothrow.h"
-
-static int
-ms_windows_dup2 (int fd, int desired_fd)
-{
- int result;
-
- /* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open,
- dup2 (fd, fd) returns 0, but all further attempts to use fd in
- future dup2 calls will hang. */
- if (fd == desired_fd)
- {
- if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE)
- {
- errno = EBADF;
- return -1;
- }
- return fd;
- }
-
- /* Wine 1.0.1 return 0 when desired_fd is negative but not -1:
- http://bugs.winehq.org/show_bug.cgi?id=21289 */
- if (desired_fd < 0)
- {
- errno = EBADF;
- return -1;
- }
-
- TRY_MSVC_INVAL
- {
- result = dup2 (fd, desired_fd);
- }
- CATCH_MSVC_INVAL
- {
- errno = EBADF;
- result = -1;
- }
- DONE_MSVC_INVAL;
-
- if (result == 0)
- result = desired_fd;
-
- return result;
-}
-
-# define dup2 ms_windows_dup2
-
-# elif defined __KLIBC__
-
-# include <InnoTekLIBC/backend.h>
-
-static int
-klibc_dup2dirfd (int fd, int desired_fd)
-{
- int tempfd;
- int dupfd;
-
- tempfd = open ("NUL", O_RDONLY);
- if (tempfd == -1)
- return -1;
-
- if (tempfd == desired_fd)
- {
- close (tempfd);
-
- char path[_MAX_PATH];
- if (__libc_Back_ioFHToPath (fd, path, sizeof (path)))
- return -1;
-
- return open(path, O_RDONLY);
- }
-
- dupfd = klibc_dup2dirfd (fd, desired_fd);
-
- close (tempfd);
-
- return dupfd;
-}
-
-static int
-klibc_dup2 (int fd, int desired_fd)
-{
- int dupfd;
- struct stat sbuf;
-
- dupfd = dup2 (fd, desired_fd);
- if (dupfd == -1 && errno == ENOTSUP \
- && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode))
- {
- close (desired_fd);
-
- return klibc_dup2dirfd (fd, desired_fd);
- }
-
- return dupfd;
-}
-
-# define dup2 klibc_dup2
-# endif
-
-int
-rpl_dup2 (int fd, int desired_fd)
-{
- int result;
-
-# ifdef F_GETFL
- /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
- On Cygwin 1.5.x, dup2 (1, 1) returns 0.
- On Cygwin 1.7.17, dup2 (1, -1) dumps core.
- On Cygwin 1.7.25, dup2 (1, 256) can dump core.
- On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */
-# if HAVE_SETDTABLESIZE
- setdtablesize (desired_fd + 1);
-# endif
- if (desired_fd < 0)
- fd = desired_fd;
- if (fd == desired_fd)
- return fcntl (fd, F_GETFL) == -1 ? -1 : fd;
-# endif
-
- result = dup2 (fd, desired_fd);
-
- /* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x. */
- if (result == -1 && errno == EMFILE)
- errno = EBADF;
-# if REPLACE_FCHDIR
- if (fd != desired_fd && result != -1)
- result = _gl_register_dup (fd, result);
-# endif
- return result;
-}
-
-#else /* !HAVE_DUP2 */
-
-/* On older platforms, dup2 did not exist. */
-
-# ifndef F_DUPFD
-static int
-dupfd (int fd, int desired_fd)
-{
- int duplicated_fd = dup (fd);
- if (duplicated_fd < 0 || duplicated_fd == desired_fd)
- return duplicated_fd;
- else
- {
- int r = dupfd (fd, desired_fd);
- int e = errno;
- close (duplicated_fd);
- errno = e;
- return r;
- }
-}
-# endif
-
-int
-dup2 (int fd, int desired_fd)
-{
- int result = fcntl (fd, F_GETFL) < 0 ? -1 : fd;
- if (result == -1 || fd == desired_fd)
- return result;
- close (desired_fd);
-# ifdef F_DUPFD
- result = fcntl (fd, F_DUPFD, desired_fd);
-# if REPLACE_FCHDIR
- if (0 <= result)
- result = _gl_register_dup (fd, result);
-# endif
-# else
- result = dupfd (fd, desired_fd);
-# endif
- if (result == -1 && (errno == EMFILE || errno == EINVAL))
- errno = EBADF;
- return result;
-}
-#endif /* !HAVE_DUP2 */
diff --git a/src/gl/errno.in.h b/src/gl/errno.in.h
deleted file mode 100644
index b8397ee465..0000000000
--- a/src/gl/errno.in.h
+++ /dev/null
@@ -1,279 +0,0 @@
-/* A POSIX-like <errno.h>.
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _@GUARD_PREFIX@_ERRNO_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* The include_next requires a split double-inclusion guard. */
-#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
-
-#ifndef _@GUARD_PREFIX@_ERRNO_H
-#define _@GUARD_PREFIX@_ERRNO_H
-
-
-/* On native Windows platforms, many macros are not defined. */
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-/* These are the same values as defined by MSVC 10, for interoperability. */
-
-# ifndef ENOMSG
-# define ENOMSG 122
-# define GNULIB_defined_ENOMSG 1
-# endif
-
-# ifndef EIDRM
-# define EIDRM 111
-# define GNULIB_defined_EIDRM 1
-# endif
-
-# ifndef ENOLINK
-# define ENOLINK 121
-# define GNULIB_defined_ENOLINK 1
-# endif
-
-# ifndef EPROTO
-# define EPROTO 134
-# define GNULIB_defined_EPROTO 1
-# endif
-
-# ifndef EBADMSG
-# define EBADMSG 104
-# define GNULIB_defined_EBADMSG 1
-# endif
-
-# ifndef EOVERFLOW
-# define EOVERFLOW 132
-# define GNULIB_defined_EOVERFLOW 1
-# endif
-
-# ifndef ENOTSUP
-# define ENOTSUP 129
-# define GNULIB_defined_ENOTSUP 1
-# endif
-
-# ifndef ENETRESET
-# define ENETRESET 117
-# define GNULIB_defined_ENETRESET 1
-# endif
-
-# ifndef ECONNABORTED
-# define ECONNABORTED 106
-# define GNULIB_defined_ECONNABORTED 1
-# endif
-
-# ifndef ECANCELED
-# define ECANCELED 105
-# define GNULIB_defined_ECANCELED 1
-# endif
-
-# ifndef EOWNERDEAD
-# define EOWNERDEAD 133
-# define GNULIB_defined_EOWNERDEAD 1
-# endif
-
-# ifndef ENOTRECOVERABLE
-# define ENOTRECOVERABLE 127
-# define GNULIB_defined_ENOTRECOVERABLE 1
-# endif
-
-# ifndef EINPROGRESS
-# define EINPROGRESS 112
-# define EALREADY 103
-# define ENOTSOCK 128
-# define EDESTADDRREQ 109
-# define EMSGSIZE 115
-# define EPROTOTYPE 136
-# define ENOPROTOOPT 123
-# define EPROTONOSUPPORT 135
-# define EOPNOTSUPP 130
-# define EAFNOSUPPORT 102
-# define EADDRINUSE 100
-# define EADDRNOTAVAIL 101
-# define ENETDOWN 116
-# define ENETUNREACH 118
-# define ECONNRESET 108
-# define ENOBUFS 119
-# define EISCONN 113
-# define ENOTCONN 126
-# define ETIMEDOUT 138
-# define ECONNREFUSED 107
-# define ELOOP 114
-# define EHOSTUNREACH 110
-# define EWOULDBLOCK 140
-# define GNULIB_defined_ESOCK 1
-# endif
-
-# ifndef ETXTBSY
-# define ETXTBSY 139
-# define ENODATA 120 /* not required by POSIX */
-# define ENOSR 124 /* not required by POSIX */
-# define ENOSTR 125 /* not required by POSIX */
-# define ETIME 137 /* not required by POSIX */
-# define EOTHER 131 /* not required by POSIX */
-# define GNULIB_defined_ESTREAMS 1
-# endif
-
-/* These are intentionally the same values as the WSA* error numbers, defined
- in <winsock2.h>. */
-# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */
-# define EPFNOSUPPORT 10046 /* not required by POSIX */
-# define ESHUTDOWN 10058 /* not required by POSIX */
-# define ETOOMANYREFS 10059 /* not required by POSIX */
-# define EHOSTDOWN 10064 /* not required by POSIX */
-# define EPROCLIM 10067 /* not required by POSIX */
-# define EUSERS 10068 /* not required by POSIX */
-# define EDQUOT 10069
-# define ESTALE 10070
-# define EREMOTE 10071 /* not required by POSIX */
-# define GNULIB_defined_EWINSOCK 1
-
-# endif
-
-
-/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros
- EMULTIHOP, ENOLINK, EOVERFLOW are not defined. */
-# if @EMULTIHOP_HIDDEN@
-# define EMULTIHOP @EMULTIHOP_VALUE@
-# define GNULIB_defined_EMULTIHOP 1
-# endif
-# if @ENOLINK_HIDDEN@
-# define ENOLINK @ENOLINK_VALUE@
-# define GNULIB_defined_ENOLINK 1
-# endif
-# if @EOVERFLOW_HIDDEN@
-# define EOVERFLOW @EOVERFLOW_VALUE@
-# define GNULIB_defined_EOVERFLOW 1
-# endif
-
-
-/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK,
- EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined.
- Likewise, on NonStop Kernel, EDQUOT is not defined.
- Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151,
- HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133.
-
- Note: When one of these systems defines some of these macros some day,
- binaries will have to be recompiled so that they recognizes the new
- errno values from the system. */
-
-# ifndef ENOMSG
-# define ENOMSG 2000
-# define GNULIB_defined_ENOMSG 1
-# endif
-
-# ifndef EIDRM
-# define EIDRM 2001
-# define GNULIB_defined_EIDRM 1
-# endif
-
-# ifndef ENOLINK
-# define ENOLINK 2002
-# define GNULIB_defined_ENOLINK 1
-# endif
-
-# ifndef EPROTO
-# define EPROTO 2003
-# define GNULIB_defined_EPROTO 1
-# endif
-
-# ifndef EMULTIHOP
-# define EMULTIHOP 2004
-# define GNULIB_defined_EMULTIHOP 1
-# endif
-
-# ifndef EBADMSG
-# define EBADMSG 2005
-# define GNULIB_defined_EBADMSG 1
-# endif
-
-# ifndef EOVERFLOW
-# define EOVERFLOW 2006
-# define GNULIB_defined_EOVERFLOW 1
-# endif
-
-# ifndef ENOTSUP
-# define ENOTSUP 2007
-# define GNULIB_defined_ENOTSUP 1
-# endif
-
-# ifndef ENETRESET
-# define ENETRESET 2011
-# define GNULIB_defined_ENETRESET 1
-# endif
-
-# ifndef ECONNABORTED
-# define ECONNABORTED 2012
-# define GNULIB_defined_ECONNABORTED 1
-# endif
-
-# ifndef ESTALE
-# define ESTALE 2009
-# define GNULIB_defined_ESTALE 1
-# endif
-
-# ifndef EDQUOT
-# define EDQUOT 2010
-# define GNULIB_defined_EDQUOT 1
-# endif
-
-# ifndef ECANCELED
-# define ECANCELED 2008
-# define GNULIB_defined_ECANCELED 1
-# endif
-
-/* On many platforms, the macros EOWNERDEAD and ENOTRECOVERABLE are not
- defined. */
-
-# ifndef EOWNERDEAD
-# if defined __sun
- /* Use the same values as defined for Solaris >= 8, for
- interoperability. */
-# define EOWNERDEAD 58
-# define ENOTRECOVERABLE 59
-# elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- /* We have a conflict here: pthreads-win32 defines these values
- differently than MSVC 10. It's hairy to decide which one to use. */
-# if defined __MINGW32__ && !defined USE_WINDOWS_THREADS
- /* Use the same values as defined by pthreads-win32, for
- interoperability. */
-# define EOWNERDEAD 43
-# define ENOTRECOVERABLE 44
-# else
- /* Use the same values as defined by MSVC 10, for
- interoperability. */
-# define EOWNERDEAD 133
-# define ENOTRECOVERABLE 127
-# endif
-# else
-# define EOWNERDEAD 2013
-# define ENOTRECOVERABLE 2014
-# endif
-# define GNULIB_defined_EOWNERDEAD 1
-# define GNULIB_defined_ENOTRECOVERABLE 1
-# endif
-
-# ifndef EILSEQ
-# define EILSEQ 2015
-# define GNULIB_defined_EILSEQ 1
-# endif
-
-#endif /* _@GUARD_PREFIX@_ERRNO_H */
-#endif /* _@GUARD_PREFIX@_ERRNO_H */
diff --git a/src/gl/error.c b/src/gl/error.c
deleted file mode 100644
index b3b1286a35..0000000000
--- a/src/gl/error.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/* Error handler for noninteractive utilities
- Copyright (C) 1990-1998, 2000-2007, 2009-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
-
-#if !_LIBC
-# include <config.h>
-#endif
-
-#include "error.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if !_LIBC && ENABLE_NLS
-# include "gettext.h"
-# define _(msgid) gettext (msgid)
-#endif
-
-#ifdef _LIBC
-# include <libintl.h>
-# include <stdbool.h>
-# include <stdint.h>
-# include <wchar.h>
-# define mbsrtowcs __mbsrtowcs
-# define USE_UNLOCKED_IO 0
-# define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b)
-# define _GL_ARG_NONNULL(a)
-#else
-# include "getprogname.h"
-#endif
-
-#if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-#endif
-
-#ifndef _
-# define _(String) String
-#endif
-
-/* If NULL, error will flush stdout, then print on stderr the program
- name, a colon and a space. Otherwise, error will call this
- function without parameters instead. */
-void (*error_print_progname) (void);
-
-/* This variable is incremented each time 'error' is called. */
-unsigned int error_message_count;
-
-#ifdef _LIBC
-/* In the GNU C library, there is a predefined variable for this. */
-
-# define program_name program_invocation_name
-# include <errno.h>
-# include <limits.h>
-# include <libio/libioP.h>
-
-/* In GNU libc we want do not want to use the common name 'error' directly.
- Instead make it a weak alias. */
-extern void __error (int status, int errnum, const char *message, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-extern void __error_at_line (int status, int errnum, const char *file_name,
- unsigned int line_number, const char *message,
- ...)
- __attribute__ ((__format__ (__printf__, 5, 6)));
-# define error __error
-# define error_at_line __error_at_line
-
-# include <libio/iolibio.h>
-# define fflush(s) _IO_fflush (s)
-# undef putc
-# define putc(c, fp) _IO_putc (c, fp)
-
-# include <bits/libc-lock.h>
-
-#else /* not _LIBC */
-
-# include <fcntl.h>
-# include <unistd.h>
-
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Get declarations of the native Windows API functions. */
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-/* Get _get_osfhandle. */
-# include "msvc-nothrow.h"
-# endif
-
-/* The gnulib override of fcntl is not needed in this file. */
-# undef fcntl
-
-# if !HAVE_DECL_STRERROR_R
-# ifndef HAVE_DECL_STRERROR_R
-"this configure-time declaration test was not run"
-# endif
-# if STRERROR_R_CHAR_P
-char *strerror_r ();
-# else
-int strerror_r ();
-# endif
-# endif
-
-#define program_name getprogname ()
-
-# if HAVE_STRERROR_R || defined strerror_r
-# define __strerror_r strerror_r
-# endif /* HAVE_STRERROR_R || defined strerror_r */
-#endif /* not _LIBC */
-
-#if !_LIBC
-/* Return non-zero if FD is open. */
-static int
-is_open (int fd)
-{
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- /* On native Windows: The initial state of unassigned standard file
- descriptors is that they are open but point to an INVALID_HANDLE_VALUE.
- There is no fcntl, and the gnulib replacement fcntl does not support
- F_GETFL. */
- return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
-# else
-# ifndef F_GETFL
-# error Please port fcntl to your platform
-# endif
- return 0 <= fcntl (fd, F_GETFL);
-# endif
-}
-#endif
-
-static void
-flush_stdout (void)
-{
-#if !_LIBC
- int stdout_fd;
-
-# if GNULIB_FREOPEN_SAFER
- /* Use of gnulib's freopen-safer module normally ensures that
- fileno (stdout) == 1
- whenever stdout is open. */
- stdout_fd = STDOUT_FILENO;
-# else
- /* POSIX states that fileno (stdout) after fclose is unspecified. But in
- practice it is not a problem, because stdout is statically allocated and
- the fd of a FILE stream is stored as a field in its allocated memory. */
- stdout_fd = fileno (stdout);
-# endif
- /* POSIX states that fflush (stdout) after fclose is unspecified; it
- is safe in glibc, but not on all other platforms. fflush (NULL)
- is always defined, but too draconian. */
- if (0 <= stdout_fd && is_open (stdout_fd))
-#endif
- fflush (stdout);
-}
-
-static void
-print_errno_message (int errnum)
-{
- char const *s;
-
-#if defined HAVE_STRERROR_R || _LIBC
- char errbuf[1024];
-# if _LIBC || STRERROR_R_CHAR_P
- s = __strerror_r (errnum, errbuf, sizeof errbuf);
-# else
- if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
- s = errbuf;
- else
- s = 0;
-# endif
-#else
- s = strerror (errnum);
-#endif
-
-#if !_LIBC
- if (! s)
- s = _("Unknown system error");
-#endif
-
-#if _LIBC
- __fxprintf (NULL, ": %s", s);
-#else
- fprintf (stderr, ": %s", s);
-#endif
-}
-
-static void _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))
-error_tail (int status, int errnum, const char *message, va_list args)
-{
-#if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- {
- size_t len = strlen (message) + 1;
- wchar_t *wmessage = NULL;
- mbstate_t st;
- size_t res;
- const char *tmp;
- bool use_malloc = false;
-
- while (1)
- {
- if (__libc_use_alloca (len * sizeof (wchar_t)))
- wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
- else
- {
- if (!use_malloc)
- wmessage = NULL;
-
- wchar_t *p = (wchar_t *) realloc (wmessage,
- len * sizeof (wchar_t));
- if (p == NULL)
- {
- free (wmessage);
- fputws_unlocked (L"out of memory\n", stderr);
- return;
- }
- wmessage = p;
- use_malloc = true;
- }
-
- memset (&st, '\0', sizeof (st));
- tmp = message;
-
- res = mbsrtowcs (wmessage, &tmp, len, &st);
- if (res != len)
- break;
-
- if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0))
- {
- /* This really should not happen if everything is fine. */
- res = (size_t) -1;
- break;
- }
-
- len *= 2;
- }
-
- if (res == (size_t) -1)
- {
- /* The string cannot be converted. */
- if (use_malloc)
- {
- free (wmessage);
- use_malloc = false;
- }
- wmessage = (wchar_t *) L"???";
- }
-
- __vfwprintf (stderr, wmessage, args);
-
- if (use_malloc)
- free (wmessage);
- }
- else
-#endif
- vfprintf (stderr, message, args);
- va_end (args);
-
- ++error_message_count;
- if (errnum)
- print_errno_message (errnum);
-#if _LIBC
- __fxprintf (NULL, "\n");
-#else
- putc ('\n', stderr);
-#endif
- fflush (stderr);
- if (status)
- exit (status);
-}
-
-
-/* Print the program name and error message MESSAGE, which is a printf-style
- format string with optional args.
- If ERRNUM is nonzero, print its corresponding system error message.
- Exit with status STATUS if it is nonzero. */
-void
-error (int status, int errnum, const char *message, ...)
-{
- va_list args;
-
-#if defined _LIBC && defined __libc_ptf_call
- /* We do not want this call to be cut short by a thread
- cancellation. Therefore disable cancellation for now. */
- int state = PTHREAD_CANCEL_ENABLE;
- __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
- 0);
-#endif
-
- flush_stdout ();
-#ifdef _LIBC
- _IO_flockfile (stderr);
-#endif
- if (error_print_progname)
- (*error_print_progname) ();
- else
- {
-#if _LIBC
- __fxprintf (NULL, "%s: ", program_name);
-#else
- fprintf (stderr, "%s: ", program_name);
-#endif
- }
-
- va_start (args, message);
- error_tail (status, errnum, message, args);
-
-#ifdef _LIBC
- _IO_funlockfile (stderr);
-# ifdef __libc_ptf_call
- __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
-# endif
-#endif
-}
-
-/* Sometimes we want to have at most one error per line. This
- variable controls whether this mode is selected or not. */
-int error_one_per_line;
-
-void
-error_at_line (int status, int errnum, const char *file_name,
- unsigned int line_number, const char *message, ...)
-{
- va_list args;
-
- if (error_one_per_line)
- {
- static const char *old_file_name;
- static unsigned int old_line_number;
-
- if (old_line_number == line_number
- && (file_name == old_file_name
- || (old_file_name != NULL
- && file_name != NULL
- && strcmp (old_file_name, file_name) == 0)))
-
- /* Simply return and print nothing. */
- return;
-
- old_file_name = file_name;
- old_line_number = line_number;
- }
-
-#if defined _LIBC && defined __libc_ptf_call
- /* We do not want this call to be cut short by a thread
- cancellation. Therefore disable cancellation for now. */
- int state = PTHREAD_CANCEL_ENABLE;
- __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
- 0);
-#endif
-
- flush_stdout ();
-#ifdef _LIBC
- _IO_flockfile (stderr);
-#endif
- if (error_print_progname)
- (*error_print_progname) ();
- else
- {
-#if _LIBC
- __fxprintf (NULL, "%s:", program_name);
-#else
- fprintf (stderr, "%s:", program_name);
-#endif
- }
-
-#if _LIBC
- __fxprintf (NULL, file_name != NULL ? "%s:%u: " : " ",
- file_name, line_number);
-#else
- fprintf (stderr, file_name != NULL ? "%s:%u: " : " ",
- file_name, line_number);
-#endif
-
- va_start (args, message);
- error_tail (status, errnum, message, args);
-
-#ifdef _LIBC
- _IO_funlockfile (stderr);
-# ifdef __libc_ptf_call
- __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
-# endif
-#endif
-}
-
-#ifdef _LIBC
-/* Make the weak alias. */
-# undef error
-# undef error_at_line
-weak_alias (__error, error)
-weak_alias (__error_at_line, error_at_line)
-#endif
diff --git a/src/gl/error.h b/src/gl/error.h
deleted file mode 100644
index 6a69db0935..0000000000
--- a/src/gl/error.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Declaration for error-reporting function
- Copyright (C) 1995-1997, 2003, 2006, 2008-2016 Free Software Foundation,
- Inc.
- This file is part of the GNU C Library.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _ERROR_H
-#define _ERROR_H 1
-
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
- The __-protected variants of the attributes 'format' and 'printf' are
- accepted by gcc versions 2.6.4 (effectively 2.7) and later.
- We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
- gnulib and libintl do '#define printf __printf__' when they override
- the 'printf' function. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
-/* On mingw, the flavor of printf depends on whether the extensions module
- * is in use; the check for <stdio.h> determines the witness macro. */
-#ifndef _GL_ATTRIBUTE_SPEC_PRINTF
-# if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
-# define _GL_ATTRIBUTE_SPEC_PRINTF __gnu_printf__
-# else
-# define _GL_ATTRIBUTE_SPEC_PRINTF __printf__
-# endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Print a message with 'fprintf (stderr, FORMAT, ...)';
- if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
- If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */
-
-extern void error (int __status, int __errnum, const char *__format, ...)
- _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 3, 4));
-
-extern void error_at_line (int __status, int __errnum, const char *__fname,
- unsigned int __lineno, const char *__format, ...)
- _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 5, 6));
-
-/* If NULL, error will flush stdout, then print on stderr the program
- name, a colon and a space. Otherwise, error will call this
- function without parameters instead. */
-extern void (*error_print_progname) (void);
-
-/* This variable is incremented each time 'error' is called. */
-extern unsigned int error_message_count;
-
-/* Sometimes we want to have at most one error per line. This
- variable controls whether this mode is selected or not. */
-extern int error_one_per_line;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* error.h */
diff --git a/src/gl/exitfail.c b/src/gl/exitfail.c
deleted file mode 100644
index 8033c22ab4..0000000000
--- a/src/gl/exitfail.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Failure exit status
-
- Copyright (C) 2002-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include "exitfail.h"
-
-#include <stdlib.h>
-
-int volatile exit_failure = EXIT_FAILURE;
diff --git a/src/gl/exitfail.h b/src/gl/exitfail.h
deleted file mode 100644
index 62311bd48c..0000000000
--- a/src/gl/exitfail.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Failure exit status
-
- Copyright (C) 2002, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-extern int volatile exit_failure;
diff --git a/src/gl/fd-hook.c b/src/gl/fd-hook.c
deleted file mode 100644
index 8676c6bdfc..0000000000
--- a/src/gl/fd-hook.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Hook for making making file descriptor functions close(), ioctl() extensible.
- Copyright (C) 2009-2016 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2009.
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include "fd-hook.h"
-
-#include <stdlib.h>
-
-/* Currently, this entire code is only needed for the handling of sockets
- on native Windows platforms. */
-#if WINDOWS_SOCKETS
-
-/* The first and last link in the doubly linked list.
- Initially the list is empty. */
-static struct fd_hook anchor = { &anchor, &anchor, NULL, NULL };
-
-int
-execute_close_hooks (const struct fd_hook *remaining_list, gl_close_fn primary,
- int fd)
-{
- if (remaining_list == &anchor)
- /* End of list reached. */
- return primary (fd);
- else
- return remaining_list->private_close_fn (remaining_list->private_next,
- primary, fd);
-}
-
-int
-execute_all_close_hooks (gl_close_fn primary, int fd)
-{
- return execute_close_hooks (anchor.private_next, primary, fd);
-}
-
-int
-execute_ioctl_hooks (const struct fd_hook *remaining_list, gl_ioctl_fn primary,
- int fd, int request, void *arg)
-{
- if (remaining_list == &anchor)
- /* End of list reached. */
- return primary (fd, request, arg);
- else
- return remaining_list->private_ioctl_fn (remaining_list->private_next,
- primary, fd, request, arg);
-}
-
-int
-execute_all_ioctl_hooks (gl_ioctl_fn primary,
- int fd, int request, void *arg)
-{
- return execute_ioctl_hooks (anchor.private_next, primary, fd, request, arg);
-}
-
-void
-register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, struct fd_hook *link)
-{
- if (close_hook == NULL)
- close_hook = execute_close_hooks;
- if (ioctl_hook == NULL)
- ioctl_hook = execute_ioctl_hooks;
-
- if (link->private_next == NULL && link->private_prev == NULL)
- {
- /* Add the link to the doubly linked list. */
- link->private_next = anchor.private_next;
- link->private_prev = &anchor;
- link->private_close_fn = close_hook;
- link->private_ioctl_fn = ioctl_hook;
- anchor.private_next->private_prev = link;
- anchor.private_next = link;
- }
- else
- {
- /* The link is already in use. */
- if (link->private_close_fn != close_hook
- || link->private_ioctl_fn != ioctl_hook)
- abort ();
- }
-}
-
-void
-unregister_fd_hook (struct fd_hook *link)
-{
- struct fd_hook *next = link->private_next;
- struct fd_hook *prev = link->private_prev;
-
- if (next != NULL && prev != NULL)
- {
- /* The link is in use. Remove it from the doubly linked list. */
- prev->private_next = next;
- next->private_prev = prev;
- /* Clear the link, to mark it unused. */
- link->private_next = NULL;
- link->private_prev = NULL;
- link->private_close_fn = NULL;
- link->private_ioctl_fn = NULL;
- }
-}
-
-#endif
diff --git a/src/gl/fd-hook.h b/src/gl/fd-hook.h
deleted file mode 100644
index 9568d07511..0000000000
--- a/src/gl/fd-hook.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Hook for making making file descriptor functions close(), ioctl() extensible.
- Copyright (C) 2009-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-
-#ifndef FD_HOOK_H
-#define FD_HOOK_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Currently, this entire code is only needed for the handling of sockets
- on native Windows platforms. */
-#if WINDOWS_SOCKETS
-
-
-/* Type of function that closes FD. */
-typedef int (*gl_close_fn) (int fd);
-
-/* Type of function that applies a control request to FD. */
-typedef int (*gl_ioctl_fn) (int fd, int request, void *arg);
-
-/* An element of the list of file descriptor hooks.
- In CLOS (Common Lisp Object System) speak, it consists of an "around"
- method for the close() function and an "around" method for the ioctl()
- function.
- The fields of this structure are considered private. */
-struct fd_hook
-{
- /* Doubly linked list. */
- struct fd_hook *private_next;
- struct fd_hook *private_prev;
- /* Function that treats the types of FD that it knows about and calls
- execute_close_hooks (REMAINING_LIST, PRIMARY, FD) as a fallback. */
- int (*private_close_fn) (const struct fd_hook *remaining_list,
- gl_close_fn primary,
- int fd);
- /* Function that treats the types of FD that it knows about and calls
- execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) as a
- fallback. */
- int (*private_ioctl_fn) (const struct fd_hook *remaining_list,
- gl_ioctl_fn primary,
- int fd, int request, void *arg);
-};
-
-/* This type of function closes FD, applying special knowledge for the FD
- types it knows about, and calls
- execute_close_hooks (REMAINING_LIST, PRIMARY, FD)
- for the other FD types.
- In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
- and PRIMARY is the "primary" method for close(). */
-typedef int (*close_hook_fn) (const struct fd_hook *remaining_list,
- gl_close_fn primary,
- int fd);
-
-/* Execute the close hooks in REMAINING_LIST, with PRIMARY as "primary" method.
- Return 0 or -1, like close() would do. */
-extern int execute_close_hooks (const struct fd_hook *remaining_list,
- gl_close_fn primary,
- int fd);
-
-/* Execute all close hooks, with PRIMARY as "primary" method.
- Return 0 or -1, like close() would do. */
-extern int execute_all_close_hooks (gl_close_fn primary, int fd);
-
-/* This type of function applies a control request to FD, applying special
- knowledge for the FD types it knows about, and calls
- execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG)
- for the other FD types.
- In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
- and PRIMARY is the "primary" method for ioctl(). */
-typedef int (*ioctl_hook_fn) (const struct fd_hook *remaining_list,
- gl_ioctl_fn primary,
- int fd, int request, void *arg);
-
-/* Execute the ioctl hooks in REMAINING_LIST, with PRIMARY as "primary" method.
- Return 0 or -1, like ioctl() would do. */
-extern int execute_ioctl_hooks (const struct fd_hook *remaining_list,
- gl_ioctl_fn primary,
- int fd, int request, void *arg);
-
-/* Execute all ioctl hooks, with PRIMARY as "primary" method.
- Return 0 or -1, like ioctl() would do. */
-extern int execute_all_ioctl_hooks (gl_ioctl_fn primary,
- int fd, int request, void *arg);
-
-/* Add a function pair to the list of file descriptor hooks.
- CLOSE_HOOK and IOCTL_HOOK may be NULL, indicating no change.
- The LINK variable points to a piece of memory which is guaranteed to be
- accessible until the corresponding call to unregister_fd_hook. */
-extern void register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook,
- struct fd_hook *link);
-
-/* Removes a hook from the list of file descriptor hooks. */
-extern void unregister_fd_hook (struct fd_hook *link);
-
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* FD_HOOK_H */
diff --git a/src/gl/flexmember.h b/src/gl/flexmember.h
deleted file mode 100644
index 62c556bae2..0000000000
--- a/src/gl/flexmember.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Sizes of structs with flexible array members.
-
- Copyright 2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- Written by Paul Eggert. */
-
-#include <stddef.h>
-
-/* Nonzero multiple of alignment of TYPE, suitable for FLEXSIZEOF below.
- On older platforms without _Alignof, use a pessimistic bound that is
- safe in practice even if FLEXIBLE_ARRAY_MEMBER is 1.
- On newer platforms, use _Alignof to get a tighter bound. */
-
-#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
-# define FLEXALIGNOF(type) (sizeof (type) & ~ (sizeof (type) - 1))
-#else
-# define FLEXALIGNOF(type) _Alignof (type)
-#endif
-
-/* Upper bound on the size of a struct of type TYPE with a flexible
- array member named MEMBER that is followed by N bytes of other data.
- This is not simply sizeof (TYPE) + N, since it may require
- alignment on unusually picky C11 platforms, and
- FLEXIBLE_ARRAY_MEMBER may be 1 on pre-C11 platforms.
- Yield a value less than N if and only if arithmetic overflow occurs. */
-
-#define FLEXSIZEOF(type, member, n) \
- ((offsetof (type, member) + FLEXALIGNOF (type) - 1 + (n)) \
- & ~ (FLEXALIGNOF (type) - 1))
diff --git a/src/gl/float+.h b/src/gl/float+.h
deleted file mode 100644
index 00fcc76322..0000000000
--- a/src/gl/float+.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Supplemental information about the floating-point formats.
- Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2007.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _FLOATPLUS_H
-#define _FLOATPLUS_H
-
-#include <float.h>
-#include <limits.h>
-
-/* Number of bits in the mantissa of a floating-point number, including the
- "hidden bit". */
-#if FLT_RADIX == 2
-# define FLT_MANT_BIT FLT_MANT_DIG
-# define DBL_MANT_BIT DBL_MANT_DIG
-# define LDBL_MANT_BIT LDBL_MANT_DIG
-#elif FLT_RADIX == 4
-# define FLT_MANT_BIT (FLT_MANT_DIG * 2)
-# define DBL_MANT_BIT (DBL_MANT_DIG * 2)
-# define LDBL_MANT_BIT (LDBL_MANT_DIG * 2)
-#elif FLT_RADIX == 16
-# define FLT_MANT_BIT (FLT_MANT_DIG * 4)
-# define DBL_MANT_BIT (DBL_MANT_DIG * 4)
-# define LDBL_MANT_BIT (LDBL_MANT_DIG * 4)
-#endif
-
-/* Bit mask that can be used to mask the exponent, as an unsigned number. */
-#define FLT_EXP_MASK ((FLT_MAX_EXP - FLT_MIN_EXP) | 7)
-#define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)
-#define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7)
-
-/* Number of bits used for the exponent of a floating-point number, including
- the exponent's sign. */
-#define FLT_EXP_BIT \
- (FLT_EXP_MASK < 0x100 ? 8 : \
- FLT_EXP_MASK < 0x200 ? 9 : \
- FLT_EXP_MASK < 0x400 ? 10 : \
- FLT_EXP_MASK < 0x800 ? 11 : \
- FLT_EXP_MASK < 0x1000 ? 12 : \
- FLT_EXP_MASK < 0x2000 ? 13 : \
- FLT_EXP_MASK < 0x4000 ? 14 : \
- FLT_EXP_MASK < 0x8000 ? 15 : \
- FLT_EXP_MASK < 0x10000 ? 16 : \
- FLT_EXP_MASK < 0x20000 ? 17 : \
- FLT_EXP_MASK < 0x40000 ? 18 : \
- FLT_EXP_MASK < 0x80000 ? 19 : \
- FLT_EXP_MASK < 0x100000 ? 20 : \
- FLT_EXP_MASK < 0x200000 ? 21 : \
- FLT_EXP_MASK < 0x400000 ? 22 : \
- FLT_EXP_MASK < 0x800000 ? 23 : \
- FLT_EXP_MASK < 0x1000000 ? 24 : \
- FLT_EXP_MASK < 0x2000000 ? 25 : \
- FLT_EXP_MASK < 0x4000000 ? 26 : \
- FLT_EXP_MASK < 0x8000000 ? 27 : \
- FLT_EXP_MASK < 0x10000000 ? 28 : \
- FLT_EXP_MASK < 0x20000000 ? 29 : \
- FLT_EXP_MASK < 0x40000000 ? 30 : \
- FLT_EXP_MASK <= 0x7fffffff ? 31 : \
- 32)
-#define DBL_EXP_BIT \
- (DBL_EXP_MASK < 0x100 ? 8 : \
- DBL_EXP_MASK < 0x200 ? 9 : \
- DBL_EXP_MASK < 0x400 ? 10 : \
- DBL_EXP_MASK < 0x800 ? 11 : \
- DBL_EXP_MASK < 0x1000 ? 12 : \
- DBL_EXP_MASK < 0x2000 ? 13 : \
- DBL_EXP_MASK < 0x4000 ? 14 : \
- DBL_EXP_MASK < 0x8000 ? 15 : \
- DBL_EXP_MASK < 0x10000 ? 16 : \
- DBL_EXP_MASK < 0x20000 ? 17 : \
- DBL_EXP_MASK < 0x40000 ? 18 : \
- DBL_EXP_MASK < 0x80000 ? 19 : \
- DBL_EXP_MASK < 0x100000 ? 20 : \
- DBL_EXP_MASK < 0x200000 ? 21 : \
- DBL_EXP_MASK < 0x400000 ? 22 : \
- DBL_EXP_MASK < 0x800000 ? 23 : \
- DBL_EXP_MASK < 0x1000000 ? 24 : \
- DBL_EXP_MASK < 0x2000000 ? 25 : \
- DBL_EXP_MASK < 0x4000000 ? 26 : \
- DBL_EXP_MASK < 0x8000000 ? 27 : \
- DBL_EXP_MASK < 0x10000000 ? 28 : \
- DBL_EXP_MASK < 0x20000000 ? 29 : \
- DBL_EXP_MASK < 0x40000000 ? 30 : \
- DBL_EXP_MASK <= 0x7fffffff ? 31 : \
- 32)
-#define LDBL_EXP_BIT \
- (LDBL_EXP_MASK < 0x100 ? 8 : \
- LDBL_EXP_MASK < 0x200 ? 9 : \
- LDBL_EXP_MASK < 0x400 ? 10 : \
- LDBL_EXP_MASK < 0x800 ? 11 : \
- LDBL_EXP_MASK < 0x1000 ? 12 : \
- LDBL_EXP_MASK < 0x2000 ? 13 : \
- LDBL_EXP_MASK < 0x4000 ? 14 : \
- LDBL_EXP_MASK < 0x8000 ? 15 : \
- LDBL_EXP_MASK < 0x10000 ? 16 : \
- LDBL_EXP_MASK < 0x20000 ? 17 : \
- LDBL_EXP_MASK < 0x40000 ? 18 : \
- LDBL_EXP_MASK < 0x80000 ? 19 : \
- LDBL_EXP_MASK < 0x100000 ? 20 : \
- LDBL_EXP_MASK < 0x200000 ? 21 : \
- LDBL_EXP_MASK < 0x400000 ? 22 : \
- LDBL_EXP_MASK < 0x800000 ? 23 : \
- LDBL_EXP_MASK < 0x1000000 ? 24 : \
- LDBL_EXP_MASK < 0x2000000 ? 25 : \
- LDBL_EXP_MASK < 0x4000000 ? 26 : \
- LDBL_EXP_MASK < 0x8000000 ? 27 : \
- LDBL_EXP_MASK < 0x10000000 ? 28 : \
- LDBL_EXP_MASK < 0x20000000 ? 29 : \
- LDBL_EXP_MASK < 0x40000000 ? 30 : \
- LDBL_EXP_MASK <= 0x7fffffff ? 31 : \
- 32)
-
-/* Number of bits used for a floating-point number: the mantissa (not
- counting the "hidden bit", since it may or may not be explicit), the
- exponent, and the sign. */
-#define FLT_TOTAL_BIT ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1)
-#define DBL_TOTAL_BIT ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1)
-#define LDBL_TOTAL_BIT ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1)
-
-/* Number of bytes used for a floating-point number.
- This can be smaller than the 'sizeof'. For example, on i386 systems,
- 'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence
- LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but
- sizeof (long double) = 12 or = 16. */
-#define SIZEOF_FLT ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
-#define SIZEOF_DBL ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
-#define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
-
-/* Verify that SIZEOF_FLT <= sizeof (float) etc. */
-typedef int verify_sizeof_flt[SIZEOF_FLT <= sizeof (float) ? 1 : -1];
-typedef int verify_sizeof_dbl[SIZEOF_DBL <= sizeof (double) ? 1 : - 1];
-typedef int verify_sizeof_ldbl[SIZEOF_LDBL <= sizeof (long double) ? 1 : - 1];
-
-#endif /* _FLOATPLUS_H */
diff --git a/src/gl/float.c b/src/gl/float.c
deleted file mode 100644
index 1bad2ee2bd..0000000000
--- a/src/gl/float.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Auxiliary definitions for <float.h>.
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2011.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <float.h>
-
-#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
-const union gl_long_double_union gl_LDBL_MAX =
- { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } };
-#elif defined __i386__
-const union gl_long_double_union gl_LDBL_MAX =
- { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } };
-#else
-/* This declaration is solely to ensure that after preprocessing
- this file is never empty. */
-typedef int dummy;
-#endif
diff --git a/src/gl/float.in.h b/src/gl/float.in.h
deleted file mode 100644
index 0b93d90087..0000000000
--- a/src/gl/float.in.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* A correct <float.h>.
-
- Copyright (C) 2007-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _@GUARD_PREFIX@_FLOAT_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* The include_next requires a split double-inclusion guard. */
-#@INCLUDE_NEXT@ @NEXT_FLOAT_H@
-
-#ifndef _@GUARD_PREFIX@_FLOAT_H
-#define _@GUARD_PREFIX@_FLOAT_H
-
-/* 'long double' properties. */
-
-#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
-/* Number of mantissa units, in base FLT_RADIX. */
-# undef LDBL_MANT_DIG
-# define LDBL_MANT_DIG 64
-/* Number of decimal digits that is sufficient for representing a number. */
-# undef LDBL_DIG
-# define LDBL_DIG 18
-/* x-1 where x is the smallest representable number > 1. */
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 1.0842021724855044340E-19L
-/* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */
-# undef LDBL_MIN_EXP
-# define LDBL_MIN_EXP (-16381)
-/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */
-# undef LDBL_MAX_EXP
-# define LDBL_MAX_EXP 16384
-/* Minimum positive normalized number. */
-# undef LDBL_MIN
-# define LDBL_MIN 3.3621031431120935063E-4932L
-/* Maximum representable finite number. */
-# undef LDBL_MAX
-# define LDBL_MAX 1.1897314953572317650E+4932L
-/* Minimum e such that 10^e is in the range of normalized numbers. */
-# undef LDBL_MIN_10_EXP
-# define LDBL_MIN_10_EXP (-4931)
-/* Maximum e such that 10^e is in the range of representable finite numbers. */
-# undef LDBL_MAX_10_EXP
-# define LDBL_MAX_10_EXP 4932
-#endif
-
-/* On FreeBSD/x86 6.4, the 'long double' type really has only 53 bits of
- precision in the compiler but 64 bits of precision at runtime. See
- <http://lists.gnu.org/archive/html/bug-gnulib/2008-07/msg00063.html>. */
-#if defined __i386__ && defined __FreeBSD__
-/* Number of mantissa units, in base FLT_RADIX. */
-# undef LDBL_MANT_DIG
-# define LDBL_MANT_DIG 64
-/* Number of decimal digits that is sufficient for representing a number. */
-# undef LDBL_DIG
-# define LDBL_DIG 18
-/* x-1 where x is the smallest representable number > 1. */
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 1.084202172485504434007452800869941711426e-19L /* 2^-63 */
-/* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */
-# undef LDBL_MIN_EXP
-# define LDBL_MIN_EXP (-16381)
-/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */
-# undef LDBL_MAX_EXP
-# define LDBL_MAX_EXP 16384
-/* Minimum positive normalized number. */
-# undef LDBL_MIN
-# define LDBL_MIN 3.3621031431120935E-4932L /* = 0x1p-16382L */
-/* Maximum representable finite number. */
-# undef LDBL_MAX
-/* LDBL_MAX is represented as { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }.
- But the largest literal that GCC allows us to write is
- 0x0.fffffffffffff8p16384L = { 0xFFFFF800, 0xFFFFFFFF, 32766 }.
- So, define it like this through a reference to an external variable
-
- const unsigned int LDBL_MAX[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 32766 };
- extern const long double LDBL_MAX;
-
- Unfortunately, this is not a constant expression. */
-union gl_long_double_union
- {
- struct { unsigned int lo; unsigned int hi; unsigned int exponent; } xd;
- long double ld;
- };
-extern const union gl_long_double_union gl_LDBL_MAX;
-# define LDBL_MAX (gl_LDBL_MAX.ld)
-/* Minimum e such that 10^e is in the range of normalized numbers. */
-# undef LDBL_MIN_10_EXP
-# define LDBL_MIN_10_EXP (-4931)
-/* Maximum e such that 10^e is in the range of representable finite numbers. */
-# undef LDBL_MAX_10_EXP
-# define LDBL_MAX_10_EXP 4932
-#endif
-
-/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are
- wrong.
- On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong. */
-#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__
-# undef LDBL_MIN_EXP
-# define LDBL_MIN_EXP DBL_MIN_EXP
-# undef LDBL_MIN_10_EXP
-# define LDBL_MIN_10_EXP DBL_MIN_10_EXP
-# undef LDBL_MIN
-# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
-#endif
-#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
-# undef LDBL_MAX
-/* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }.
- It is not easy to define:
- #define LDBL_MAX 1.79769313486231580793728971405302307166e308L
- is too small, whereas
- #define LDBL_MAX 1.79769313486231580793728971405302307167e308L
- is too large. Apparently a bug in GCC decimal-to-binary conversion.
- Also, I can't get values larger than
- #define LDBL63 ((long double) (1ULL << 63))
- #define LDBL882 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
- #define LDBL945 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
- #define LDBL1008 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
- #define LDBL_MAX (LDBL1008 * 65535.0L + LDBL945 * (long double) 9223372036821221375ULL + LDBL882 * (long double) 4611686018427387904ULL)
- which is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xF8000000 }.
- So, define it like this through a reference to an external variable
-
- const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL };
- extern const long double LDBL_MAX;
-
- or through a pointer cast
-
- #define LDBL_MAX \
- (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL })
-
- Unfortunately, this is not a constant expression, and the latter expression
- does not work well when GCC is optimizing.. */
-union gl_long_double_union
- {
- struct { double hi; double lo; } dd;
- long double ld;
- };
-extern const union gl_long_double_union gl_LDBL_MAX;
-# define LDBL_MAX (gl_LDBL_MAX.ld)
-#endif
-
-/* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong.
- On IRIX 6.5, with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_EPSILON
- are wrong. */
-#if defined __sgi && (LDBL_MANT_DIG >= 106)
-# undef LDBL_MANT_DIG
-# define LDBL_MANT_DIG 106
-# if defined __GNUC__
-# undef LDBL_MIN_EXP
-# define LDBL_MIN_EXP DBL_MIN_EXP
-# undef LDBL_MIN_10_EXP
-# define LDBL_MIN_10_EXP DBL_MIN_10_EXP
-# undef LDBL_MIN
-# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */
-# endif
-#endif
-
-#if @REPLACE_ITOLD@
-/* Pull in a function that fixes the 'int' to 'long double' conversion
- of glibc 2.7. */
-extern
-# ifdef __cplusplus
-"C"
-# endif
-void _Qp_itoq (long double *, int);
-static void (*_gl_float_fix_itold) (long double *, int) = _Qp_itoq;
-#endif
-
-#endif /* _@GUARD_PREFIX@_FLOAT_H */
-#endif /* _@GUARD_PREFIX@_FLOAT_H */
diff --git a/src/gl/fseek.c b/src/gl/fseek.c
deleted file mode 100644
index 8524a42f0e..0000000000
--- a/src/gl/fseek.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* An fseek() function that, together with fflush(), is POSIX compliant.
- Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <stdio.h>
-
-/* Get off_t. */
-#include <unistd.h>
-
-int
-fseek (FILE *fp, long offset, int whence)
-{
- /* Use the replacement fseeko function with all its workarounds. */
- return fseeko (fp, (off_t)offset, whence);
-}
diff --git a/src/gl/fseeko.c b/src/gl/fseeko.c
deleted file mode 100644
index 4cdb1f66df..0000000000
--- a/src/gl/fseeko.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* An fseeko() function that, together with fflush(), is POSIX compliant.
- Copyright (C) 2007-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <stdio.h>
-
-/* Get off_t, lseek, _POSIX_VERSION. */
-#include <unistd.h>
-
-#include "stdio-impl.h"
-
-int
-fseeko (FILE *fp, off_t offset, int whence)
-#undef fseeko
-#if !HAVE_FSEEKO
-# undef fseek
-# define fseeko fseek
-#endif
-#if _GL_WINDOWS_64_BIT_OFF_T
-# undef fseeko
-# if HAVE__FSEEKI64 /* msvc, mingw64 */
-# define fseeko _fseeki64
-# else /* mingw */
-# define fseeko fseeko64
-# endif
-#endif
-{
-#if LSEEK_PIPE_BROKEN
- /* mingw gives bogus answers rather than failure on non-seekable files. */
- if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
- return EOF;
-#endif
-
- /* These tests are based on fpurge.c. */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
- if (fp->_IO_read_end == fp->_IO_read_ptr
- && fp->_IO_write_ptr == fp->_IO_write_base
- && fp->_IO_save_base == NULL)
-#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
- /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
-# if defined __SL64 && defined __SCLE /* Cygwin */
- if ((fp->_flags & __SL64) == 0)
- {
- /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
- mode; but has an fseeko that requires 64-bit mode. */
- FILE *tmp = fopen ("/dev/null", "r");
- if (!tmp)
- return -1;
- fp->_flags |= __SL64;
- fp->_seek64 = tmp->_seek64;
- fclose (tmp);
- }
-# endif
- if (fp_->_p == fp_->_bf._base
- && fp_->_r == 0
- && fp_->_w == ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
- ? fp_->_bf._size
- : 0)
- && fp_ub._base == NULL)
-#elif defined __EMX__ /* emx+gcc */
- if (fp->_ptr == fp->_buffer
- && fp->_rcount == 0
- && fp->_wcount == 0
- && fp->_ungetc_count == 0)
-#elif defined __minix /* Minix */
- if (fp_->_ptr == fp_->_buf
- && (fp_->_ptr == NULL || fp_->_count == 0))
-#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
- if (fp_->_ptr == fp_->_base
- && (fp_->_ptr == NULL || fp_->_cnt == 0))
-#elif defined __UCLIBC__ /* uClibc */
- if (((fp->__modeflags & __FLAG_WRITING) == 0
- || fp->__bufpos == fp->__bufstart)
- && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
- || fp->__bufpos == fp->__bufread))
-#elif defined __QNX__ /* QNX */
- if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
- && fp->_Rback == fp->_Back + sizeof (fp->_Back)
- && fp->_Rsave == NULL)
-#elif defined __MINT__ /* Atari FreeMiNT */
- if (fp->__bufp == fp->__buffer
- && fp->__get_limit == fp->__bufp
- && fp->__put_limit == fp->__bufp
- && !fp->__pushed_back)
-#elif defined EPLAN9 /* Plan9 */
- if (fp->rp == fp->buf
- && fp->wp == fp->buf)
-#elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION
- /* Cross-compiling to some other system advertising conformance to
- POSIX.1-2008 or later. Assume fseeko and fflush work as advertised.
- If this assumption is incorrect, please report the bug to
- bug-gnulib. */
- if (0)
-#else
- #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
-#endif
- {
- /* We get here when an fflush() call immediately preceded this one (or
- if ftell() has created buffers but no I/O has occurred on a
- newly-opened stream). We know there are no buffers. */
- off_t pos = lseek (fileno (fp), offset, whence);
- if (pos == -1)
- {
-#if defined __sferror || defined __DragonFly__ || defined __ANDROID__
- /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
- fp_->_flags &= ~__SOFF;
-#endif
- return -1;
- }
-
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
- fp->_flags &= ~_IO_EOF_SEEN;
- fp->_offset = pos;
-#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
- /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
-# if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000)
- /* fp_->_offset is typed as an integer. */
- fp_->_offset = pos;
-# else
- /* fp_->_offset is an fpos_t. */
- {
- /* Use a union, since on NetBSD, the compilation flags
- determine whether fpos_t is typedef'd to off_t or a struct
- containing a single off_t member. */
- union
- {
- fpos_t f;
- off_t o;
- } u;
- u.o = pos;
- fp_->_offset = u.f;
- }
-# endif
- fp_->_flags |= __SOFF;
- fp_->_flags &= ~__SEOF;
-#elif defined __EMX__ /* emx+gcc */
- fp->_flags &= ~_IOEOF;
-#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
- fp->_flag &= ~_IOEOF;
-#elif defined __MINT__ /* Atari FreeMiNT */
- fp->__offset = pos;
- fp->__eof = 0;
-#endif
- return 0;
- }
- return fseeko (fp, offset, whence);
-}
diff --git a/src/gl/fstat.c b/src/gl/fstat.c
deleted file mode 100644
index 435c429070..0000000000
--- a/src/gl/fstat.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* fstat() replacement.
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* If the user's config.h happens to include <sys/stat.h>, let it include only
- the system's <sys/stat.h> here, so that orig_fstat doesn't recurse to
- rpl_fstat. */
-#define __need_system_sys_stat_h
-#include <config.h>
-
-/* Get the original definition of fstat. It might be defined as a macro. */
-#include <sys/types.h>
-#include <sys/stat.h>
-#if _GL_WINDOWS_64_BIT_ST_SIZE
-# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
-# define stat _stati64
-# undef fstat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
-# define fstat _fstati64
-#endif
-#undef __need_system_sys_stat_h
-
-static int
-orig_fstat (int fd, struct stat *buf)
-{
- return fstat (fd, buf);
-}
-
-/* Specification. */
-/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
- eliminates this include because of the preliminary #include <sys/stat.h>
- above. */
-#include "sys/stat.h"
-
-#include <errno.h>
-#include <unistd.h>
-
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-# include "msvc-inval.h"
-#endif
-
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-static int
-fstat_nothrow (int fd, struct stat *buf)
-{
- int result;
-
- TRY_MSVC_INVAL
- {
- result = orig_fstat (fd, buf);
- }
- CATCH_MSVC_INVAL
- {
- result = -1;
- errno = EBADF;
- }
- DONE_MSVC_INVAL;
-
- return result;
-}
-#else
-# define fstat_nothrow orig_fstat
-#endif
-
-int
-rpl_fstat (int fd, struct stat *buf)
-{
-#if REPLACE_FCHDIR && REPLACE_OPEN_DIRECTORY
- /* Handle the case when rpl_open() used a dummy file descriptor to work
- around an open() that can't normally visit directories. */
- const char *name = _gl_directory_name (fd);
- if (name != NULL)
- return stat (name, buf);
-#endif
-
- return fstat_nothrow (fd, buf);
-}
diff --git a/src/gl/ftell.c b/src/gl/ftell.c
deleted file mode 100644
index 75ed1b2eca..0000000000
--- a/src/gl/ftell.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* An ftell() function that works around platform bugs.
- Copyright (C) 2007-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <stdio.h>
-
-#include <errno.h>
-#include <limits.h>
-
-long
-ftell (FILE *fp)
-{
- /* Use the replacement ftello function with all its workarounds. */
- off_t offset = ftello (fp);
- if (LONG_MIN <= offset && offset <= LONG_MAX)
- return /* (long) */ offset;
- else
- {
- errno = EOVERFLOW;
- return -1;
- }
-}
diff --git a/src/gl/ftello.c b/src/gl/ftello.c
deleted file mode 100644
index 4c18ed15bd..0000000000
--- a/src/gl/ftello.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* An ftello() function that works around platform bugs.
- Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <stdio.h>
-
-/* Get lseek. */
-#include <unistd.h>
-
-#include "stdio-impl.h"
-
-off_t
-ftello (FILE *fp)
-#undef ftello
-#if !HAVE_FTELLO
-# undef ftell
-# define ftello ftell
-#endif
-#if _GL_WINDOWS_64_BIT_OFF_T
-# undef ftello
-# if HAVE__FTELLI64 /* msvc, mingw64 */
-# define ftello _ftelli64
-# else /* mingw */
-# define ftello ftello64
-# endif
-#endif
-{
-#if LSEEK_PIPE_BROKEN
- /* mingw gives bogus answers rather than failure on non-seekable files. */
- if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
- return -1;
-#endif
-
-#if FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE /* Solaris */
- /* The Solaris stdio leaves the _IOREAD flag set after reading from a file
- reaches EOF and the program then starts writing to the file. ftello
- gets confused by this. */
- if (fp_->_flag & _IOWRT)
- {
- off_t pos;
-
- /* Call ftello nevertheless, for the side effects that it does on fp. */
- ftello (fp);
-
- /* Compute the file position ourselves. */
- pos = lseek (fileno (fp), (off_t) 0, SEEK_CUR);
- if (pos >= 0)
- {
- if ((fp_->_flag & _IONBF) == 0 && fp_->_base != NULL)
- pos += fp_->_ptr - fp_->_base;
- }
- return pos;
- }
-#endif
-
-#if defined __SL64 && defined __SCLE /* Cygwin */
- if ((fp->_flags & __SL64) == 0)
- {
- /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
- mode; but has an ftello that requires 64-bit mode. */
- FILE *tmp = fopen ("/dev/null", "r");
- if (!tmp)
- return -1;
- fp->_flags |= __SL64;
- fp->_seek64 = tmp->_seek64;
- fclose (tmp);
- }
-#endif
- return ftello (fp);
-}
diff --git a/src/gl/gai_strerror.c b/src/gl/gai_strerror.c
deleted file mode 100644
index a6cae088be..0000000000
--- a/src/gl/gai_strerror.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2016 Free Software
- Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _LIBC
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <netdb.h>
-
-#ifdef _LIBC
-# include <libintl.h>
-#else
-# include "gettext.h"
-# define _(String) gettext (String)
-# define N_(String) String
-#endif
-
-#if HAVE_DECL_GAI_STRERROR
-
-# include <sys/socket.h>
-# undef gai_strerror
-# if HAVE_DECL_GAI_STRERRORA
-# define gai_strerror gai_strerrorA
-# endif
-
-const char *
-rpl_gai_strerror (int code)
-{
- return gai_strerror (code);
-}
-
-#else /* !HAVE_DECL_GAI_STRERROR */
-
-static struct
- {
- int code;
- const char *msg;
- }
-values[] =
- {
- { EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
- { EAI_AGAIN, N_("Temporary failure in name resolution") },
- { EAI_BADFLAGS, N_("Bad value for ai_flags") },
- { EAI_FAIL, N_("Non-recoverable failure in name resolution") },
- { EAI_FAMILY, N_("ai_family not supported") },
- { EAI_MEMORY, N_("Memory allocation failure") },
- { EAI_NODATA, N_("No address associated with hostname") },
- { EAI_NONAME, N_("Name or service not known") },
- { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
- { EAI_SOCKTYPE, N_("ai_socktype not supported") },
- { EAI_SYSTEM, N_("System error") },
- { EAI_OVERFLOW, N_("Argument buffer too small") },
-#ifdef EAI_INPROGRESS
- { EAI_INPROGRESS, N_("Processing request in progress") },
- { EAI_CANCELED, N_("Request canceled") },
- { EAI_NOTCANCELED, N_("Request not canceled") },
- { EAI_ALLDONE, N_("All requests done") },
- { EAI_INTR, N_("Interrupted by a signal") },
- { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
-#endif
- };
-
-const char *
-gai_strerror (int code)
-{
- size_t i;
- for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
- if (values[i].code == code)
- return _(values[i].msg);
-
- return _("Unknown error");
-}
-# ifdef _LIBC
-libc_hidden_def (gai_strerror)
-# endif
-#endif /* !HAVE_DECL_GAI_STRERROR */
diff --git a/src/gl/getaddrinfo.c b/src/gl/getaddrinfo.c
deleted file mode 100644
index 32d1f328b6..0000000000
--- a/src/gl/getaddrinfo.c
+++ /dev/null
@@ -1,443 +0,0 @@
-/* Get address information (partial implementation).
- Copyright (C) 1997, 2001-2002, 2004-2016 Free Software Foundation, Inc.
- Contributed by Simon Josefsson <simon@josefsson.org>.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
- optimizes away the sa == NULL test below. */
-#define _GL_ARG_NONNULL(params)
-
-#include <config.h>
-
-#include <netdb.h>
-
-#if HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
-/* Get inet_ntop. */
-#include <arpa/inet.h>
-
-/* Get calloc. */
-#include <stdlib.h>
-
-/* Get memcpy, strdup. */
-#include <string.h>
-
-/* Get snprintf. */
-#include <stdio.h>
-
-#include <stdbool.h>
-
-#include "gettext.h"
-#define _(String) gettext (String)
-#define N_(String) String
-
-/* BeOS has AF_INET, but not PF_INET. */
-#ifndef PF_INET
-# define PF_INET AF_INET
-#endif
-/* BeOS also lacks PF_UNSPEC. */
-#ifndef PF_UNSPEC
-# define PF_UNSPEC 0
-#endif
-
-#if defined _WIN32 || defined __WIN32__
-# define WINDOWS_NATIVE
-#endif
-
-/* gl_sockets_startup */
-#include "sockets.h"
-
-#ifdef WINDOWS_NATIVE
-typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
- const struct addrinfo*,
- struct addrinfo**);
-typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*);
-typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*,
- socklen_t, char*, DWORD,
- char*, DWORD, int);
-
-static getaddrinfo_func getaddrinfo_ptr = NULL;
-static freeaddrinfo_func freeaddrinfo_ptr = NULL;
-static getnameinfo_func getnameinfo_ptr = NULL;
-
-static int
-use_win32_p (void)
-{
- static int done = 0;
- HMODULE h;
-
- if (done)
- return getaddrinfo_ptr ? 1 : 0;
-
- done = 1;
-
- h = GetModuleHandle ("ws2_32.dll");
-
- if (h)
- {
- getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo");
- freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, "freeaddrinfo");
- getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo");
- }
-
- /* If either is missing, something is odd. */
- if (!getaddrinfo_ptr || !freeaddrinfo_ptr || !getnameinfo_ptr)
- {
- getaddrinfo_ptr = NULL;
- freeaddrinfo_ptr = NULL;
- getnameinfo_ptr = NULL;
- return 0;
- }
-
- gl_sockets_startup (SOCKETS_1_1);
-
- return 1;
-}
-#endif
-
-static bool
-validate_family (int family)
-{
- /* FIXME: Support more families. */
-#if HAVE_IPV4
- if (family == PF_INET)
- return true;
-#endif
-#if HAVE_IPV6
- if (family == PF_INET6)
- return true;
-#endif
- if (family == PF_UNSPEC)
- return true;
- return false;
-}
-
-/* Translate name of a service location and/or a service name to set of
- socket addresses. */
-int
-getaddrinfo (const char *restrict nodename,
- const char *restrict servname,
- const struct addrinfo *restrict hints,
- struct addrinfo **restrict res)
-{
- struct addrinfo *tmp;
- int port = 0;
- struct hostent *he;
- void *storage;
- size_t size;
-#if HAVE_IPV6
- struct v6_pair {
- struct addrinfo addrinfo;
- struct sockaddr_in6 sockaddr_in6;
- };
-#endif
-#if HAVE_IPV4
- struct v4_pair {
- struct addrinfo addrinfo;
- struct sockaddr_in sockaddr_in;
- };
-#endif
-
-#ifdef WINDOWS_NATIVE
- if (use_win32_p ())
- return getaddrinfo_ptr (nodename, servname, hints, res);
-#endif
-
- if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE)))
- /* FIXME: Support more flags. */
- return EAI_BADFLAGS;
-
- if (hints && !validate_family (hints->ai_family))
- return EAI_FAMILY;
-
- if (hints &&
- hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != SOCK_DGRAM)
- /* FIXME: Support other socktype. */
- return EAI_SOCKTYPE; /* FIXME: Better return code? */
-
- if (!nodename)
- {
- if (!(hints->ai_flags & AI_PASSIVE))
- return EAI_NONAME;
-
-#ifdef HAVE_IPV6
- nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
-#else
- nodename = "0.0.0.0";
-#endif
- }
-
- if (servname)
- {
- struct servent *se = NULL;
- const char *proto =
- (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
-
- if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
- /* FIXME: Use getservbyname_r if available. */
- se = getservbyname (servname, proto);
-
- if (!se)
- {
- char *c;
- if (!(*servname >= '0' && *servname <= '9'))
- return EAI_NONAME;
- port = strtoul (servname, &c, 10);
- if (*c || port > 0xffff)
- return EAI_NONAME;
- port = htons (port);
- }
- else
- port = se->s_port;
- }
-
- /* FIXME: Use gethostbyname_r if available. */
- he = gethostbyname (nodename);
- if (!he || he->h_addr_list[0] == NULL)
- return EAI_NONAME;
-
- switch (he->h_addrtype)
- {
-#if HAVE_IPV6
- case PF_INET6:
- size = sizeof (struct v6_pair);
- break;
-#endif
-
-#if HAVE_IPV4
- case PF_INET:
- size = sizeof (struct v4_pair);
- break;
-#endif
-
- default:
- return EAI_NODATA;
- }
-
- storage = calloc (1, size);
- if (!storage)
- return EAI_MEMORY;
-
- switch (he->h_addrtype)
- {
-#if HAVE_IPV6
- case PF_INET6:
- {
- struct v6_pair *p = storage;
- struct sockaddr_in6 *sinp = &p->sockaddr_in6;
- tmp = &p->addrinfo;
-
- if (port)
- sinp->sin6_port = port;
-
- if (he->h_length != sizeof (sinp->sin6_addr))
- {
- free (storage);
- return EAI_SYSTEM; /* FIXME: Better return code? Set errno? */
- }
-
- memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
-
- tmp->ai_addr = (struct sockaddr *) sinp;
- tmp->ai_addrlen = sizeof *sinp;
- }
- break;
-#endif
-
-#if HAVE_IPV4
- case PF_INET:
- {
- struct v4_pair *p = storage;
- struct sockaddr_in *sinp = &p->sockaddr_in;
- tmp = &p->addrinfo;
-
- if (port)
- sinp->sin_port = port;
-
- if (he->h_length != sizeof (sinp->sin_addr))
- {
- free (storage);
- return EAI_SYSTEM; /* FIXME: Better return code? Set errno? */
- }
-
- memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
-
- tmp->ai_addr = (struct sockaddr *) sinp;
- tmp->ai_addrlen = sizeof *sinp;
- }
- break;
-#endif
-
- default:
- free (storage);
- return EAI_NODATA;
- }
-
- if (hints && hints->ai_flags & AI_CANONNAME)
- {
- const char *cn;
- if (he->h_name)
- cn = he->h_name;
- else
- cn = nodename;
-
- tmp->ai_canonname = strdup (cn);
- if (!tmp->ai_canonname)
- {
- free (storage);
- return EAI_MEMORY;
- }
- }
-
- tmp->ai_protocol = (hints) ? hints->ai_protocol : 0;
- tmp->ai_socktype = (hints) ? hints->ai_socktype : 0;
- tmp->ai_addr->sa_family = he->h_addrtype;
- tmp->ai_family = he->h_addrtype;
-
-#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
- switch (he->h_addrtype)
- {
-#if HAVE_IPV4
- case AF_INET:
- tmp->ai_addr->sa_len = sizeof (struct sockaddr_in);
- break;
-#endif
-#if HAVE_IPV6
- case AF_INET6:
- tmp->ai_addr->sa_len = sizeof (struct sockaddr_in6);
- break;
-#endif
- }
-#endif
-
- /* FIXME: If more than one address, create linked list of addrinfo's. */
-
- *res = tmp;
-
- return 0;
-}
-
-/* Free 'addrinfo' structure AI including associated storage. */
-void
-freeaddrinfo (struct addrinfo *ai)
-{
-#ifdef WINDOWS_NATIVE
- if (use_win32_p ())
- {
- freeaddrinfo_ptr (ai);
- return;
- }
-#endif
-
- while (ai)
- {
- struct addrinfo *cur;
-
- cur = ai;
- ai = ai->ai_next;
-
- free (cur->ai_canonname);
- free (cur);
- }
-}
-
-int
-getnameinfo (const struct sockaddr *restrict sa, socklen_t salen,
- char *restrict node, socklen_t nodelen,
- char *restrict service, socklen_t servicelen,
- int flags)
-{
-#ifdef WINDOWS_NATIVE
- if (use_win32_p ())
- return getnameinfo_ptr (sa, salen, node, nodelen,
- service, servicelen, flags);
-#endif
-
- /* FIXME: Support other flags. */
- if ((node && nodelen > 0 && !(flags & NI_NUMERICHOST)) ||
- (service && servicelen > 0 && !(flags & NI_NUMERICHOST)) ||
- (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV)))
- return EAI_BADFLAGS;
-
- if (sa == NULL || salen < sizeof (sa->sa_family))
- return EAI_FAMILY;
-
- switch (sa->sa_family)
- {
-#if HAVE_IPV4
- case AF_INET:
- if (salen < sizeof (struct sockaddr_in))
- return EAI_FAMILY;
- break;
-#endif
-#if HAVE_IPV6
- case AF_INET6:
- if (salen < sizeof (struct sockaddr_in6))
- return EAI_FAMILY;
- break;
-#endif
- default:
- return EAI_FAMILY;
- }
-
- if (node && nodelen > 0 && flags & NI_NUMERICHOST)
- {
- switch (sa->sa_family)
- {
-#if HAVE_IPV4
- case AF_INET:
- if (!inet_ntop (AF_INET,
- &(((const struct sockaddr_in *) sa)->sin_addr),
- node, nodelen))
- return EAI_SYSTEM;
- break;
-#endif
-
-#if HAVE_IPV6
- case AF_INET6:
- if (!inet_ntop (AF_INET6,
- &(((const struct sockaddr_in6 *) sa)->sin6_addr),
- node, nodelen))
- return EAI_SYSTEM;
- break;
-#endif
-
- default:
- return EAI_FAMILY;
- }
- }
-
- if (service && servicelen > 0 && flags & NI_NUMERICSERV)
- switch (sa->sa_family)
- {
-#if HAVE_IPV4
- case AF_INET:
-#endif
-#if HAVE_IPV6
- case AF_INET6:
-#endif
- {
- unsigned short int port
- = ntohs (((const struct sockaddr_in *) sa)->sin_port);
- if (servicelen <= snprintf (service, servicelen, "%u", port))
- return EAI_OVERFLOW;
- }
- break;
- }
-
- return 0;
-}
diff --git a/src/gl/getdelim.c b/src/gl/getdelim.c
deleted file mode 100644
index 175d5c79c0..0000000000
--- a/src/gl/getdelim.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* getdelim.c --- Implementation of replacement getdelim function.
- Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2016 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 3, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Ported from glibc by Simon Josefsson. */
-
-/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
- optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below. */
-#define _GL_ARG_NONNULL(params)
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include <limits.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#ifndef SSIZE_MAX
-# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
-#endif
-
-#if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-# define getc_maybe_unlocked(fp) getc(fp)
-#elif !HAVE_FLOCKFILE || !HAVE_FUNLOCKFILE || !HAVE_DECL_GETC_UNLOCKED
-# undef flockfile
-# undef funlockfile
-# define flockfile(x) ((void) 0)
-# define funlockfile(x) ((void) 0)
-# define getc_maybe_unlocked(fp) getc(fp)
-#else
-# define getc_maybe_unlocked(fp) getc_unlocked(fp)
-#endif
-
-static void
-alloc_failed (void)
-{
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- /* Avoid errno problem without using the realloc module; see:
- http://lists.gnu.org/archive/html/bug-gnulib/2016-08/msg00025.html */
- errno = ENOMEM;
-#endif
-}
-
-/* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
- NUL-terminate it). *LINEPTR is a pointer returned from malloc (or
- NULL), pointing to *N characters of space. It is realloc'ed as
- necessary. Returns the number of characters read (not including
- the null terminator), or -1 on error or EOF. */
-
-ssize_t
-getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
-{
- ssize_t result;
- size_t cur_len = 0;
-
- if (lineptr == NULL || n == NULL || fp == NULL)
- {
- errno = EINVAL;
- return -1;
- }
-
- flockfile (fp);
-
- if (*lineptr == NULL || *n == 0)
- {
- char *new_lineptr;
- *n = 120;
- new_lineptr = (char *) realloc (*lineptr, *n);
- if (new_lineptr == NULL)
- {
- alloc_failed ();
- result = -1;
- goto unlock_return;
- }
- *lineptr = new_lineptr;
- }
-
- for (;;)
- {
- int i;
-
- i = getc_maybe_unlocked (fp);
- if (i == EOF)
- {
- result = -1;
- break;
- }
-
- /* Make enough space for len+1 (for final NUL) bytes. */
- if (cur_len + 1 >= *n)
- {
- size_t needed_max =
- SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
- size_t needed = 2 * *n + 1; /* Be generous. */
- char *new_lineptr;
-
- if (needed_max < needed)
- needed = needed_max;
- if (cur_len + 1 >= needed)
- {
- result = -1;
- errno = EOVERFLOW;
- goto unlock_return;
- }
-
- new_lineptr = (char *) realloc (*lineptr, needed);
- if (new_lineptr == NULL)
- {
- alloc_failed ();
- result = -1;
- goto unlock_return;
- }
-
- *lineptr = new_lineptr;
- *n = needed;
- }
-
- (*lineptr)[cur_len] = i;
- cur_len++;
-
- if (i == delimiter)
- break;
- }
- (*lineptr)[cur_len] = '\0';
- result = cur_len ? cur_len : result;
-
- unlock_return:
- funlockfile (fp); /* doesn't set errno */
-
- return result;
-}
diff --git a/src/gl/getline.c b/src/gl/getline.c
deleted file mode 100644
index dfc679ad01..0000000000
--- a/src/gl/getline.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* getline.c --- Implementation of replacement getline function.
- Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 3, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Simon Josefsson. */
-
-#include <config.h>
-
-#include <stdio.h>
-
-ssize_t
-getline (char **lineptr, size_t *n, FILE *stream)
-{
- return getdelim (lineptr, n, '\n', stream);
-}
diff --git a/src/gl/getpass.c b/src/gl/getpass.c
deleted file mode 100644
index 3360fa2935..0000000000
--- a/src/gl/getpass.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/* Copyright (C) 1992-2001, 2003-2007, 2009-2016 Free Software Foundation, Inc.
-
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _LIBC
-# include <config.h>
-#endif
-
-#include "getpass.h"
-
-#include <stdio.h>
-
-#if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
-
-# include <stdbool.h>
-
-# if HAVE_DECL___FSETLOCKING && HAVE___FSETLOCKING
-# if HAVE_STDIO_EXT_H
-# include <stdio_ext.h>
-# endif
-# else
-# define __fsetlocking(stream, type) /* empty */
-# endif
-
-# if HAVE_TERMIOS_H
-# include <termios.h>
-# endif
-
-# if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-# else
-# if !HAVE_DECL_FFLUSH_UNLOCKED
-# undef fflush_unlocked
-# define fflush_unlocked(x) fflush (x)
-# endif
-# if !HAVE_DECL_FLOCKFILE
-# undef flockfile
-# define flockfile(x) ((void) 0)
-# endif
-# if !HAVE_DECL_FUNLOCKFILE
-# undef funlockfile
-# define funlockfile(x) ((void) 0)
-# endif
-# if !HAVE_DECL_FPUTS_UNLOCKED
-# undef fputs_unlocked
-# define fputs_unlocked(str,stream) fputs (str, stream)
-# endif
-# if !HAVE_DECL_PUTC_UNLOCKED
-# undef putc_unlocked
-# define putc_unlocked(c,stream) putc (c, stream)
-# endif
-# endif
-
-/* It is desirable to use this bit on systems that have it.
- The only bit of terminal state we want to twiddle is echoing, which is
- done in software; there is no need to change the state of the terminal
- hardware. */
-
-# ifndef TCSASOFT
-# define TCSASOFT 0
-# endif
-
-static void
-call_fclose (void *arg)
-{
- if (arg != NULL)
- fclose (arg);
-}
-
-char *
-getpass (const char *prompt)
-{
- FILE *tty;
- FILE *in, *out;
-# if HAVE_TCGETATTR
- struct termios s, t;
-# endif
- bool tty_changed = false;
- static char *buf;
- static size_t bufsize;
- ssize_t nread;
-
- /* Try to write to and read from the terminal if we can.
- If we can't open the terminal, use stderr and stdin. */
-
- tty = fopen ("/dev/tty", "w+");
- if (tty == NULL)
- {
- in = stdin;
- out = stderr;
- }
- else
- {
- /* We do the locking ourselves. */
- __fsetlocking (tty, FSETLOCKING_BYCALLER);
-
- out = in = tty;
- }
-
- flockfile (out);
-
- /* Turn echoing off if it is on now. */
-# if HAVE_TCGETATTR
- if (tcgetattr (fileno (in), &t) == 0)
- {
- /* Save the old one. */
- s = t;
- /* Tricky, tricky. */
- t.c_lflag &= ~(ECHO | ISIG);
- tty_changed = (tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &t) == 0);
- }
-# endif
-
- /* Write the prompt. */
- fputs_unlocked (prompt, out);
- fflush_unlocked (out);
-
- /* Read the password. */
- nread = getline (&buf, &bufsize, in);
-
- /* According to the C standard, input may not be followed by output
- on the same stream without an intervening call to a file
- positioning function. Suppose in == out; then without this fseek
- call, on Solaris, HP-UX, AIX, OSF/1, the previous input gets
- echoed, whereas on IRIX, the following newline is not output as
- it should be. POSIX imposes similar restrictions if fileno (in)
- == fileno (out). The POSIX restrictions are tricky and change
- from POSIX version to POSIX version, so play it safe and invoke
- fseek even if in != out. */
- fseeko (out, 0, SEEK_CUR);
-
- if (buf != NULL)
- {
- if (nread < 0)
- buf[0] = '\0';
- else if (buf[nread - 1] == '\n')
- {
- /* Remove the newline. */
- buf[nread - 1] = '\0';
- if (tty_changed)
- {
- /* Write the newline that was not echoed. */
- putc_unlocked ('\n', out);
- }
- }
- }
-
- /* Restore the original setting. */
-# if HAVE_TCSETATTR
- if (tty_changed)
- tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &s);
-# endif
-
- funlockfile (out);
-
- call_fclose (tty);
-
- return buf;
-}
-
-#else /* W32 native */
-
-/* Windows implementation by Martin Lambers <marlam@marlam.de>,
- improved by Simon Josefsson. */
-
-/* For PASS_MAX. */
-# include <limits.h>
-/* For _getch(). */
-# include <conio.h>
-/* For strdup(). */
-# include <string.h>
-
-# ifndef PASS_MAX
-# define PASS_MAX 512
-# endif
-
-char *
-getpass (const char *prompt)
-{
- char getpassbuf[PASS_MAX + 1];
- size_t i = 0;
- int c;
-
- if (prompt)
- {
- fputs (prompt, stderr);
- fflush (stderr);
- }
-
- for (;;)
- {
- c = _getch ();
- if (c == '\r')
- {
- getpassbuf[i] = '\0';
- break;
- }
- else if (i < PASS_MAX)
- {
- getpassbuf[i++] = c;
- }
-
- if (i >= PASS_MAX)
- {
- getpassbuf[i] = '\0';
- break;
- }
- }
-
- if (prompt)
- {
- fputs ("\r\n", stderr);
- fflush (stderr);
- }
-
- return strdup (getpassbuf);
-}
-#endif
diff --git a/src/gl/getpass.h b/src/gl/getpass.h
deleted file mode 100644
index 785fe00ac4..0000000000
--- a/src/gl/getpass.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* getpass.h -- Read a password of arbitrary length from /dev/tty or stdin.
- Copyright (C) 2004, 2009-2016 Free Software Foundation, Inc.
- Contributed by Simon Josefsson <jas@extundo.com>, 2004.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef GETPASS_H
-# define GETPASS_H
-
-/* Get getpass declaration, if available. */
-# include <unistd.h>
-
-# if !HAVE_DECL_GETPASS
-/* Read a password of arbitrary length from /dev/tty or stdin. */
-char *getpass (const char *prompt);
-
-# endif
-
-#endif /* GETPASS_H */
diff --git a/src/gl/getpeername.c b/src/gl/getpeername.c
deleted file mode 100644
index bc9759b3f3..0000000000
--- a/src/gl/getpeername.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* getpeername.c --- wrappers for Windows getpeername function
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef getpeername
-
-int
-rpl_getpeername (int fd, struct sockaddr *addr, socklen_t *addrlen)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- int r = getpeername (sock, addr, addrlen);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
- }
-}
diff --git a/src/gl/getprogname.c b/src/gl/getprogname.c
deleted file mode 100644
index a7246e9ef2..0000000000
--- a/src/gl/getprogname.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Program name management.
- Copyright (C) 2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include "getprogname.h"
-
-#include <errno.h> /* get program_invocation_name declaration */
-#include <stdlib.h> /* get __argv declaration */
-
-#ifdef _AIX
-# include <unistd.h>
-# include <procinfo.h>
-# include <string.h>
-#endif
-
-#ifdef __MVS__
-# ifndef _OPEN_SYS
-# define _OPEN_SYS
-# endif
-# include <string.h>
-# include <sys/ps.h>
-#endif
-
-#ifdef __hpux
-# include <unistd.h>
-# include <sys/param.h>
-# include <sys/pstat.h>
-# include <string.h>
-#endif
-
-#include "dirname.h"
-
-#ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */
-char const *
-getprogname (void)
-{
-# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME /* glibc, BeOS */
- /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */
- return program_invocation_short_name;
-# elif HAVE_DECL_PROGRAM_INVOCATION_NAME /* glibc, BeOS */
- /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */
- return last_component (program_invocation_name);
-# elif HAVE_GETEXECNAME /* Solaris */
- /* http://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrb1/index.html */
- const char *p = getexecname ();
- if (!p)
- p = "?";
- return last_component (p);
-# elif HAVE_DECL___ARGV /* mingw, MSVC */
- /* https://msdn.microsoft.com/en-us/library/dn727674.aspx */
- const char *p = __argv && __argv[0] ? __argv[0] : "?";
- return last_component (p);
-# elif HAVE_VAR___PROGNAME /* OpenBSD, QNX */
- /* http://man.openbsd.org/style.9 */
- /* http://www.qnx.de/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_lib_ref%2Fp%2F__progname.html */
- /* Be careful to declare this only when we absolutely need it
- (OpenBSD 5.1), rather than when it's available. Otherwise,
- its mere declaration makes program_invocation_short_name
- malfunction (have zero length) with Fedora 25's glibc. */
- extern char *__progname;
- const char *p = __progname;
- return p && p[0] ? p : "?";
-# elif _AIX /* AIX */
- /* Idea by Bastien ROUCARIÈS,
- http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00095.html
- Reference: http://
- ibm.biz/knowctr#ssw_aix_53/com.ibm.aix.basetechref/doc/basetrf1/getprocs.htm
- */
- static char *p;
- static int first = 1;
- if (first)
- {
- first = 0;
- pid_t pid = getpid ();
- struct procentry64 procs;
- p = (0 < getprocs64 (&procs, sizeof procs, NULL, 0, &pid, 1)
- ? strdup (procs.pi_comm)
- : NULL);
- if (!p)
- p = "?";
- }
- return p;
-# elif defined __hpux
- static char *p;
- static int first = 1;
- if (first)
- {
- first = 0;
- pid_t pid = getpid ();
- struct pst_status status;
- p = (0 < pstat_getproc (&status, sizeof status, 0, pid)
- ? strdup (status.pst_ucomm)
- : NULL);
- if (!p)
- p = "?";
- }
- return p;
-# elif __MVS__ /* z/OS */
- /* https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/rtwgetp.htm */
- static char *p = "?";
- static int first = 1;
- if (first)
- {
- pid_t pid = getpid ();
- int token;
- W_PSPROC buf;
- first = 0;
- memset (&buf, 0, sizeof(buf));
- buf.ps_cmdptr = (char *) malloc (buf.ps_cmdlen = PS_CMDBLEN_LONG);
- buf.ps_conttyptr = (char *) malloc (buf.ps_conttylen = PS_CONTTYBLEN);
- buf.ps_pathptr = (char *) malloc (buf.ps_pathlen = PS_PATHBLEN);
- if (buf.ps_cmdptr && buf.ps_conttyptr && buf.ps_pathptr)
- {
- for (token = 0; token >= 0;
- token = w_getpsent (token, &buf, sizeof(buf)))
- {
- if (token > 0 && buf.ps_pid == pid)
- {
- char *s = strdup (last_component (buf.ps_pathptr));
- if (s)
- p = s;
- break;
- }
- }
- }
- free (buf.ps_cmdptr);
- free (buf.ps_conttyptr);
- free (buf.ps_pathptr);
- }
- return p;
-# else
-# error "getprogname module not ported to this OS"
-# endif
-}
-
-#endif
diff --git a/src/gl/getprogname.h b/src/gl/getprogname.h
deleted file mode 100644
index e8f9e978b1..0000000000
--- a/src/gl/getprogname.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Program name management.
- Copyright (C) 2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _GL_GETPROGNAME_H
-#define _GL_GETPROGNAME_H
-
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Return the base name of the executing program.
- On native Windows this will usually end in ".exe" or ".EXE". */
-#ifndef HAVE_GETPROGNAME
-extern char const *getprogname (void)
-# ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME
- _GL_ATTRIBUTE_PURE
-# endif
- ;
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/gl/gettext.h b/src/gl/gettext.h
deleted file mode 100644
index 9a232cc3a8..0000000000
--- a/src/gl/gettext.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/* Convenience header for conditional use of GNU <libintl.h>.
- Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2016 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _LIBGETTEXT_H
-#define _LIBGETTEXT_H 1
-
-/* NLS can be disabled through the configure --disable-nls option. */
-#if ENABLE_NLS
-
-/* Get declarations of GNU message catalog functions. */
-# include <libintl.h>
-
-/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
- the gettext() and ngettext() macros. This is an alternative to calling
- textdomain(), and is useful for libraries. */
-# ifdef DEFAULT_TEXT_DOMAIN
-# undef gettext
-# define gettext(Msgid) \
- dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
-# undef ngettext
-# define ngettext(Msgid1, Msgid2, N) \
- dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
-# endif
-
-#else
-
-/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
- chokes if dcgettext is defined as a macro. So include it now, to make
- later inclusions of <locale.h> a NOP. We don't include <libintl.h>
- as well because people using "gettext.h" will not include <libintl.h>,
- and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
- is OK. */
-#if defined(__sun)
-# include <locale.h>
-#endif
-
-/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
- <libintl.h>, which chokes if dcgettext is defined as a macro. So include
- it now, to make later inclusions of <libintl.h> a NOP. */
-#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
-# include <cstdlib>
-# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
-# include <libintl.h>
-# endif
-#endif
-
-/* Disabled NLS.
- The casts to 'const char *' serve the purpose of producing warnings
- for invalid uses of the value returned from these functions.
- On pre-ANSI systems without 'const', the config.h file is supposed to
- contain "#define const". */
-# undef gettext
-# define gettext(Msgid) ((const char *) (Msgid))
-# undef dgettext
-# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
-# undef dcgettext
-# define dcgettext(Domainname, Msgid, Category) \
- ((void) (Category), dgettext (Domainname, Msgid))
-# undef ngettext
-# define ngettext(Msgid1, Msgid2, N) \
- ((N) == 1 \
- ? ((void) (Msgid2), (const char *) (Msgid1)) \
- : ((void) (Msgid1), (const char *) (Msgid2)))
-# undef dngettext
-# define dngettext(Domainname, Msgid1, Msgid2, N) \
- ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
-# undef dcngettext
-# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
- ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
-# undef textdomain
-# define textdomain(Domainname) ((const char *) (Domainname))
-# undef bindtextdomain
-# define bindtextdomain(Domainname, Dirname) \
- ((void) (Domainname), (const char *) (Dirname))
-# undef bind_textdomain_codeset
-# define bind_textdomain_codeset(Domainname, Codeset) \
- ((void) (Domainname), (const char *) (Codeset))
-
-#endif
-
-/* Prefer gnulib's setlocale override over libintl's setlocale override. */
-#ifdef GNULIB_defined_setlocale
-# undef setlocale
-# define setlocale rpl_setlocale
-#endif
-
-/* A pseudo function call that serves as a marker for the automated
- extraction of messages, but does not call gettext(). The run-time
- translation is done at a different place in the code.
- The argument, String, should be a literal string. Concatenated strings
- and other string expressions won't work.
- The macro's expansion is not parenthesized, so that it is suitable as
- initializer for static 'char[]' or 'const char[]' variables. */
-#define gettext_noop(String) String
-
-/* The separator between msgctxt and msgid in a .mo file. */
-#define GETTEXT_CONTEXT_GLUE "\004"
-
-/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
- MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be
- short and rarely need to change.
- The letter 'p' stands for 'particular' or 'special'. */
-#ifdef DEFAULT_TEXT_DOMAIN
-# define pgettext(Msgctxt, Msgid) \
- pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
-#else
-# define pgettext(Msgctxt, Msgid) \
- pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
-#endif
-#define dpgettext(Domainname, Msgctxt, Msgid) \
- pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
-#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
- pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
-#ifdef DEFAULT_TEXT_DOMAIN
-# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
- npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
-#else
-# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
- npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
-#endif
-#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
- npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
-#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
- npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static const char *
-pgettext_aux (const char *domain,
- const char *msg_ctxt_id, const char *msgid,
- int category)
-{
- const char *translation = dcgettext (domain, msg_ctxt_id, category);
- if (translation == msg_ctxt_id)
- return msgid;
- else
- return translation;
-}
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static const char *
-npgettext_aux (const char *domain,
- const char *msg_ctxt_id, const char *msgid,
- const char *msgid_plural, unsigned long int n,
- int category)
-{
- const char *translation =
- dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
- if (translation == msg_ctxt_id || translation == msgid_plural)
- return (n == 1 ? msgid : msgid_plural);
- else
- return translation;
-}
-
-/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
- can be arbitrary expressions. But for string literals these macros are
- less efficient than those above. */
-
-#include <string.h>
-
-#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
- /* || __STDC_VERSION__ >= 199901L */ )
-# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
-#else
-# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
-#endif
-
-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
-#include <stdlib.h>
-#endif
-
-#define pgettext_expr(Msgctxt, Msgid) \
- dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
-#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
- dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static const char *
-dcpgettext_expr (const char *domain,
- const char *msgctxt, const char *msgid,
- int category)
-{
- size_t msgctxt_len = strlen (msgctxt) + 1;
- size_t msgid_len = strlen (msgid) + 1;
- const char *translation;
-#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
- char msg_ctxt_id[msgctxt_len + msgid_len];
-#else
- char buf[1024];
- char *msg_ctxt_id =
- (msgctxt_len + msgid_len <= sizeof (buf)
- ? buf
- : (char *) malloc (msgctxt_len + msgid_len));
- if (msg_ctxt_id != NULL)
-#endif
- {
- int found_translation;
- memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
- msg_ctxt_id[msgctxt_len - 1] = '\004';
- memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
- translation = dcgettext (domain, msg_ctxt_id, category);
- found_translation = (translation != msg_ctxt_id);
-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
- if (msg_ctxt_id != buf)
- free (msg_ctxt_id);
-#endif
- if (found_translation)
- return translation;
- }
- return msgid;
-}
-
-#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
- dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
-#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
- dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static const char *
-dcnpgettext_expr (const char *domain,
- const char *msgctxt, const char *msgid,
- const char *msgid_plural, unsigned long int n,
- int category)
-{
- size_t msgctxt_len = strlen (msgctxt) + 1;
- size_t msgid_len = strlen (msgid) + 1;
- const char *translation;
-#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
- char msg_ctxt_id[msgctxt_len + msgid_len];
-#else
- char buf[1024];
- char *msg_ctxt_id =
- (msgctxt_len + msgid_len <= sizeof (buf)
- ? buf
- : (char *) malloc (msgctxt_len + msgid_len));
- if (msg_ctxt_id != NULL)
-#endif
- {
- int found_translation;
- memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
- msg_ctxt_id[msgctxt_len - 1] = '\004';
- memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
- translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
- found_translation = !(translation == msg_ctxt_id || translation == msgid_plural);
-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
- if (msg_ctxt_id != buf)
- free (msg_ctxt_id);
-#endif
- if (found_translation)
- return translation;
- }
- return (n == 1 ? msgid : msgid_plural);
-}
-
-#endif /* _LIBGETTEXT_H */
diff --git a/src/gl/gettime.c b/src/gl/gettime.c
deleted file mode 100644
index ea58eb0aaf..0000000000
--- a/src/gl/gettime.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* gettime -- get the system clock
-
- Copyright (C) 2002, 2004-2007, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paul Eggert. */
-
-#include <config.h>
-
-#include "timespec.h"
-
-#include <sys/time.h>
-
-/* Get the system time into *TS. */
-
-void
-gettime (struct timespec *ts)
-{
-#if HAVE_NANOTIME
- nanotime (ts);
-#else
-
-# if defined CLOCK_REALTIME && HAVE_CLOCK_GETTIME
- if (clock_gettime (CLOCK_REALTIME, ts) == 0)
- return;
-# endif
-
- {
- struct timeval tv;
- gettimeofday (&tv, NULL);
- ts->tv_sec = tv.tv_sec;
- ts->tv_nsec = tv.tv_usec * 1000;
- }
-
-#endif
-}
diff --git a/src/gl/gettimeofday.c b/src/gl/gettimeofday.c
deleted file mode 100644
index 224ca6a176..0000000000
--- a/src/gl/gettimeofday.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/* Provide gettimeofday for systems that don't have it or for which it's broken.
-
- Copyright (C) 2001-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* written by Jim Meyering */
-
-#include <config.h>
-
-/* Specification. */
-#include <sys/time.h>
-
-#include <time.h>
-
-#if HAVE_SYS_TIMEB_H
-# include <sys/timeb.h>
-#endif
-
-#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME
-
-/* Work around the bug in some systems whereby gettimeofday clobbers
- the static buffer that localtime uses for its return value. The
- gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has
- this problem. The tzset replacement is necessary for at least
- Solaris 2.5, 2.5.1, and 2.6. */
-
-static struct tm tm_zero_buffer;
-static struct tm *localtime_buffer_addr = &tm_zero_buffer;
-
-# undef localtime
-extern struct tm *localtime (time_t const *);
-
-# undef gmtime
-extern struct tm *gmtime (time_t const *);
-
-/* This is a wrapper for localtime. It is used only on systems for which
- gettimeofday clobbers the static buffer used for localtime's result.
-
- On the first call, record the address of the static buffer that
- localtime uses for its result. */
-
-struct tm *
-rpl_localtime (time_t const *timep)
-{
- struct tm *tm = localtime (timep);
-
- if (localtime_buffer_addr == &tm_zero_buffer)
- localtime_buffer_addr = tm;
-
- return tm;
-}
-
-/* Same as above, since gmtime and localtime use the same buffer. */
-struct tm *
-rpl_gmtime (time_t const *timep)
-{
- struct tm *tm = gmtime (timep);
-
- if (localtime_buffer_addr == &tm_zero_buffer)
- localtime_buffer_addr = tm;
-
- return tm;
-}
-
-#endif /* GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME */
-
-#if TZSET_CLOBBERS_LOCALTIME
-
-# undef tzset
-extern void tzset (void);
-
-/* This is a wrapper for tzset, for systems on which tzset may clobber
- the static buffer used for localtime's result. */
-void
-rpl_tzset (void)
-{
- /* Save and restore the contents of the buffer used for localtime's
- result around the call to tzset. */
- struct tm save = *localtime_buffer_addr;
- tzset ();
- *localtime_buffer_addr = save;
-}
-#endif
-
-/* This is a wrapper for gettimeofday. It is used only on systems
- that lack this function, or whose implementation of this function
- causes problems. */
-
-int
-gettimeofday (struct timeval *restrict tv, void *restrict tz)
-{
-#undef gettimeofday
-#if HAVE_GETTIMEOFDAY
-# if GETTIMEOFDAY_CLOBBERS_LOCALTIME
- /* Save and restore the contents of the buffer used for localtime's
- result around the call to gettimeofday. */
- struct tm save = *localtime_buffer_addr;
-# endif
-
-# if defined timeval /* 'struct timeval' overridden by gnulib? */
-# undef timeval
- struct timeval otv;
- int result = gettimeofday (&otv, (struct timezone *) tz);
- if (result == 0)
- {
- tv->tv_sec = otv.tv_sec;
- tv->tv_usec = otv.tv_usec;
- }
-# else
- int result = gettimeofday (tv, (struct timezone *) tz);
-# endif
-
-# if GETTIMEOFDAY_CLOBBERS_LOCALTIME
- *localtime_buffer_addr = save;
-# endif
-
- return result;
-
-#else
-
-# if HAVE__FTIME
-
- struct _timeb timebuf;
- _ftime (&timebuf);
- tv->tv_sec = timebuf.time;
- tv->tv_usec = timebuf.millitm * 1000;
-
-# else
-
-# if !defined OK_TO_USE_1S_CLOCK
-# error "Only 1-second nominal clock resolution found. Is that intended?" \
- "If so, compile with the -DOK_TO_USE_1S_CLOCK option."
-# endif
- tv->tv_sec = time (NULL);
- tv->tv_usec = 0;
-
-# endif
-
- return 0;
-
-#endif
-}
diff --git a/src/gl/inet_ntop.c b/src/gl/inet_ntop.c
deleted file mode 100644
index 8668bf6d1b..0000000000
--- a/src/gl/inet_ntop.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
-
- Copyright (C) 2005-2006, 2008-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/*
- * Copyright (c) 1996-1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#include <config.h>
-
-/* Specification. */
-#include <arpa/inet.h>
-
-/* Use this to suppress gcc's "...may be used before initialized" warnings.
- Beware: The Code argument must not contain commas. */
-#ifndef IF_LINT
-# if defined GCC_LINT || defined lint
-# define IF_LINT(Code) Code
-# else
-# define IF_LINT(Code) /* empty */
-# endif
-#endif
-
-#if HAVE_DECL_INET_NTOP
-
-# undef inet_ntop
-
-const char *
-rpl_inet_ntop (int af, const void *restrict src,
- char *restrict dst, socklen_t cnt)
-{
- return inet_ntop (af, src, dst, cnt);
-}
-
-#else
-
-# include <stdio.h>
-# include <string.h>
-# include <errno.h>
-
-# define NS_IN6ADDRSZ 16
-# define NS_INT16SZ 2
-
-/*
- * WARNING: Don't even consider trying to compile this on a system where
- * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
- */
-typedef int verify_int_size[4 <= sizeof (int) ? 1 : -1];
-
-static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size);
-# if HAVE_IPV6
-static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t size);
-# endif
-
-
-/* char *
- * inet_ntop(af, src, dst, size)
- * convert a network format address to presentation format.
- * return:
- * pointer to presentation format address ('dst'), or NULL (see errno).
- * author:
- * Paul Vixie, 1996.
- */
-const char *
-inet_ntop (int af, const void *restrict src,
- char *restrict dst, socklen_t cnt)
-{
- switch (af)
- {
-# if HAVE_IPV4
- case AF_INET:
- return (inet_ntop4 (src, dst, cnt));
-# endif
-
-# if HAVE_IPV6
- case AF_INET6:
- return (inet_ntop6 (src, dst, cnt));
-# endif
-
- default:
- errno = EAFNOSUPPORT;
- return (NULL);
- }
- /* NOTREACHED */
-}
-
-/* const char *
- * inet_ntop4(src, dst, size)
- * format an IPv4 address
- * return:
- * 'dst' (as a const)
- * notes:
- * (1) uses no statics
- * (2) takes a u_char* not an in_addr as input
- * author:
- * Paul Vixie, 1996.
- */
-static const char *
-inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
-{
- char tmp[sizeof "255.255.255.255"];
- int len;
-
- len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]);
- if (len < 0)
- return NULL;
-
- if (len > size)
- {
- errno = ENOSPC;
- return NULL;
- }
-
- return strcpy (dst, tmp);
-}
-
-# if HAVE_IPV6
-
-/* const char *
- * inet_ntop6(src, dst, size)
- * convert IPv6 binary address into presentation (printable) format
- * author:
- * Paul Vixie, 1996.
- */
-static const char *
-inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
-{
- /*
- * Note that int32_t and int16_t need only be "at least" large enough
- * to contain a value of the specified size. On some systems, like
- * Crays, there is no such thing as an integer variable with 16 bits.
- * Keep this in mind if you think this function should have been coded
- * to use pointer overlays. All the world's not a VAX.
- */
- char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
- struct
- {
- int base, len;
- } best, cur;
- unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
- int i;
-
- /*
- * Preprocess:
- * Copy the input (bytewise) array into a wordwise array.
- * Find the longest run of 0x00's in src[] for :: shorthanding.
- */
- memset (words, '\0', sizeof words);
- for (i = 0; i < NS_IN6ADDRSZ; i += 2)
- words[i / 2] = (src[i] << 8) | src[i + 1];
- best.base = -1;
- cur.base = -1;
- IF_LINT(best.len = 0);
- IF_LINT(cur.len = 0);
- for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
- {
- if (words[i] == 0)
- {
- if (cur.base == -1)
- cur.base = i, cur.len = 1;
- else
- cur.len++;
- }
- else
- {
- if (cur.base != -1)
- {
- if (best.base == -1 || cur.len > best.len)
- best = cur;
- cur.base = -1;
- }
- }
- }
- if (cur.base != -1)
- {
- if (best.base == -1 || cur.len > best.len)
- best = cur;
- }
- if (best.base != -1 && best.len < 2)
- best.base = -1;
-
- /*
- * Format the result.
- */
- tp = tmp;
- for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
- {
- /* Are we inside the best run of 0x00's? */
- if (best.base != -1 && i >= best.base && i < (best.base + best.len))
- {
- if (i == best.base)
- *tp++ = ':';
- continue;
- }
- /* Are we following an initial run of 0x00s or any real hex? */
- if (i != 0)
- *tp++ = ':';
- /* Is this address an encapsulated IPv4? */
- if (i == 6 && best.base == 0 &&
- (best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
- {
- if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp)))
- return (NULL);
- tp += strlen (tp);
- break;
- }
- {
- int len = sprintf (tp, "%x", words[i]);
- if (len < 0)
- return NULL;
- tp += len;
- }
- }
- /* Was it a trailing run of 0x00's? */
- if (best.base != -1 && (best.base + best.len) ==
- (NS_IN6ADDRSZ / NS_INT16SZ))
- *tp++ = ':';
- *tp++ = '\0';
-
- /*
- * Check for overflow, copy, and we're done.
- */
- if ((socklen_t) (tp - tmp) > size)
- {
- errno = ENOSPC;
- return NULL;
- }
-
- return strcpy (dst, tmp);
-}
-
-# endif
-
-#endif
diff --git a/src/gl/inet_pton.c b/src/gl/inet_pton.c
deleted file mode 100644
index 3cddfb1e01..0000000000
--- a/src/gl/inet_pton.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form
-
- Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/*
- * Copyright (c) 1996,1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#include <config.h>
-
-/* Specification. */
-#include <arpa/inet.h>
-
-#if HAVE_DECL_INET_PTON
-
-# undef inet_pton
-
-int
-rpl_inet_pton (int af, const char *restrict src, void *restrict dst)
-{
- return inet_pton (af, src, dst);
-}
-
-#else
-
-# include <c-ctype.h>
-# include <string.h>
-# include <errno.h>
-
-# define NS_INADDRSZ 4
-# define NS_IN6ADDRSZ 16
-# define NS_INT16SZ 2
-
-/*
- * WARNING: Don't even consider trying to compile this on a system where
- * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
- */
-
-static int inet_pton4 (const char *src, unsigned char *dst);
-# if HAVE_IPV6
-static int inet_pton6 (const char *src, unsigned char *dst);
-# endif
-
-/* int
- * inet_pton(af, src, dst)
- * convert from presentation format (which usually means ASCII printable)
- * to network format (which is usually some kind of binary format).
- * return:
- * 1 if the address was valid for the specified address family
- * 0 if the address wasn't valid ('dst' is untouched in this case)
- * -1 if some other error occurred ('dst' is untouched in this case, too)
- * author:
- * Paul Vixie, 1996.
- */
-int
-inet_pton (int af, const char *restrict src, void *restrict dst)
-{
- switch (af)
- {
- case AF_INET:
- return (inet_pton4 (src, dst));
-
-# if HAVE_IPV6
- case AF_INET6:
- return (inet_pton6 (src, dst));
-# endif
-
- default:
- errno = EAFNOSUPPORT;
- return (-1);
- }
- /* NOTREACHED */
-}
-
-/* int
- * inet_pton4(src, dst)
- * like inet_aton() but without all the hexadecimal, octal (with the
- * exception of 0) and shorthand.
- * return:
- * 1 if 'src' is a valid dotted quad, else 0.
- * notice:
- * does not touch 'dst' unless it's returning 1.
- * author:
- * Paul Vixie, 1996.
- */
-static int
-inet_pton4 (const char *restrict src, unsigned char *restrict dst)
-{
- int saw_digit, octets, ch;
- unsigned char tmp[NS_INADDRSZ], *tp;
-
- saw_digit = 0;
- octets = 0;
- *(tp = tmp) = 0;
- while ((ch = *src++) != '\0')
- {
-
- if (ch >= '0' && ch <= '9')
- {
- unsigned new = *tp * 10 + (ch - '0');
-
- if (saw_digit && *tp == 0)
- return (0);
- if (new > 255)
- return (0);
- *tp = new;
- if (!saw_digit)
- {
- if (++octets > 4)
- return (0);
- saw_digit = 1;
- }
- }
- else if (ch == '.' && saw_digit)
- {
- if (octets == 4)
- return (0);
- *++tp = 0;
- saw_digit = 0;
- }
- else
- return (0);
- }
- if (octets < 4)
- return (0);
- memcpy (dst, tmp, NS_INADDRSZ);
- return (1);
-}
-
-# if HAVE_IPV6
-
-/* int
- * inet_pton6(src, dst)
- * convert presentation level address to network order binary form.
- * return:
- * 1 if 'src' is a valid [RFC1884 2.2] address, else 0.
- * notice:
- * (1) does not touch 'dst' unless it's returning 1.
- * (2) :: in a full address is silently ignored.
- * credit:
- * inspired by Mark Andrews.
- * author:
- * Paul Vixie, 1996.
- */
-static int
-inet_pton6 (const char *restrict src, unsigned char *restrict dst)
-{
- static const char xdigits[] = "0123456789abcdef";
- unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
- const char *curtok;
- int ch, saw_xdigit;
- unsigned val;
-
- tp = memset (tmp, '\0', NS_IN6ADDRSZ);
- endp = tp + NS_IN6ADDRSZ;
- colonp = NULL;
- /* Leading :: requires some special handling. */
- if (*src == ':')
- if (*++src != ':')
- return (0);
- curtok = src;
- saw_xdigit = 0;
- val = 0;
- while ((ch = c_tolower (*src++)) != '\0')
- {
- const char *pch;
-
- pch = strchr (xdigits, ch);
- if (pch != NULL)
- {
- val <<= 4;
- val |= (pch - xdigits);
- if (val > 0xffff)
- return (0);
- saw_xdigit = 1;
- continue;
- }
- if (ch == ':')
- {
- curtok = src;
- if (!saw_xdigit)
- {
- if (colonp)
- return (0);
- colonp = tp;
- continue;
- }
- else if (*src == '\0')
- {
- return (0);
- }
- if (tp + NS_INT16SZ > endp)
- return (0);
- *tp++ = (u_char) (val >> 8) & 0xff;
- *tp++ = (u_char) val & 0xff;
- saw_xdigit = 0;
- val = 0;
- continue;
- }
- if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
- inet_pton4 (curtok, tp) > 0)
- {
- tp += NS_INADDRSZ;
- saw_xdigit = 0;
- break; /* '\0' was seen by inet_pton4(). */
- }
- return (0);
- }
- if (saw_xdigit)
- {
- if (tp + NS_INT16SZ > endp)
- return (0);
- *tp++ = (u_char) (val >> 8) & 0xff;
- *tp++ = (u_char) val & 0xff;
- }
- if (colonp != NULL)
- {
- /*
- * Since some memmove()'s erroneously fail to handle
- * overlapping regions, we'll do the shift by hand.
- */
- const int n = tp - colonp;
- int i;
-
- if (tp == endp)
- return (0);
- for (i = 1; i <= n; i++)
- {
- endp[-i] = colonp[n - i];
- colonp[n - i] = 0;
- }
- tp = endp;
- }
- if (tp != endp)
- return (0);
- memcpy (dst, tmp, NS_IN6ADDRSZ);
- return (1);
-}
-
-# endif
-
-#endif
diff --git a/src/gl/intprops.h b/src/gl/intprops.h
deleted file mode 100644
index 8add5def8e..0000000000
--- a/src/gl/intprops.h
+++ /dev/null
@@ -1,464 +0,0 @@
-/* intprops.h -- properties of integer types
-
- Copyright (C) 2001-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paul Eggert. */
-
-#ifndef _GL_INTPROPS_H
-#define _GL_INTPROPS_H
-
-#include <limits.h>
-#include <verify.h>
-
-#ifndef __has_builtin
-# define __has_builtin(x) 0
-#endif
-
-/* Return a value with the common real type of E and V and the value of V. */
-#define _GL_INT_CONVERT(e, v) (0 * (e) + (v))
-
-/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see
- <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html>. */
-#define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v))
-
-/* The extra casts in the following macros work around compiler bugs,
- e.g., in Cray C 5.0.3.0. */
-
-/* True if the arithmetic type T is an integer type. bool counts as
- an integer. */
-#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
-
-/* True if the real type T is signed. */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-
-/* Return 1 if the real expression E, after promotion, has a
- signed or floating type. */
-#define EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
-
-
-/* Minimum and maximum values for integer types and expressions. */
-
-/* The width in bits of the integer type or expression T.
- Padding bits are not supported; this is checked at compile-time below. */
-#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT)
-
-/* The maximum and minimum values for the integer type T. */
-#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
-#define TYPE_MAXIMUM(t) \
- ((t) (! TYPE_SIGNED (t) \
- ? (t) -1 \
- : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1)))
-
-/* The maximum and minimum values for the type of the expression E,
- after integer promotion. E should not have side effects. */
-#define _GL_INT_MINIMUM(e) \
- (EXPR_SIGNED (e) \
- ? ~ _GL_SIGNED_INT_MAXIMUM (e) \
- : _GL_INT_CONVERT (e, 0))
-#define _GL_INT_MAXIMUM(e) \
- (EXPR_SIGNED (e) \
- ? _GL_SIGNED_INT_MAXIMUM (e) \
- : _GL_INT_NEGATE_CONVERT (e, 1))
-#define _GL_SIGNED_INT_MAXIMUM(e) \
- (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1)
-
-/* Work around OpenVMS incompatibility with C99. */
-#if !defined LLONG_MAX && defined __INT64_MAX
-# define LLONG_MAX __INT64_MAX
-# define LLONG_MIN __INT64_MIN
-#endif
-
-/* This include file assumes that signed types are two's complement without
- padding bits; the above macros have undefined behavior otherwise.
- If this is a problem for you, please let us know how to fix it for your host.
- As a sanity check, test the assumption for some signed types that
- <limits.h> bounds. */
-verify (TYPE_MINIMUM (signed char) == SCHAR_MIN);
-verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX);
-verify (TYPE_MINIMUM (short int) == SHRT_MIN);
-verify (TYPE_MAXIMUM (short int) == SHRT_MAX);
-verify (TYPE_MINIMUM (int) == INT_MIN);
-verify (TYPE_MAXIMUM (int) == INT_MAX);
-verify (TYPE_MINIMUM (long int) == LONG_MIN);
-verify (TYPE_MAXIMUM (long int) == LONG_MAX);
-#ifdef LLONG_MAX
-verify (TYPE_MINIMUM (long long int) == LLONG_MIN);
-verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
-#endif
-/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */
-#ifdef UINT_WIDTH
-verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
-#endif
-
-/* Does the __typeof__ keyword work? This could be done by
- 'configure', but for now it's easier to do it by hand. */
-#if (2 <= __GNUC__ \
- || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \
- || (0x5110 <= __SUNPRO_C && !__STDC__))
-# define _GL_HAVE___TYPEOF__ 1
-#else
-# define _GL_HAVE___TYPEOF__ 0
-#endif
-
-/* Return 1 if the integer type or expression T might be signed. Return 0
- if it is definitely unsigned. This macro does not evaluate its argument,
- and expands to an integer constant expression. */
-#if _GL_HAVE___TYPEOF__
-# define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t))
-#else
-# define _GL_SIGNED_TYPE_OR_EXPR(t) 1
-#endif
-
-/* Bound on length of the string representing an unsigned integer
- value representable in B bits. log10 (2.0) < 146/485. The
- smallest value of B where this bound is not tight is 2621. */
-#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485)
-
-/* Bound on length of the string representing an integer type or expression T.
- Subtract 1 for the sign bit if T is signed, and then add 1 more for
- a minus sign if needed.
-
- Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 0 when its argument is
- signed, this macro may overestimate the true bound by one byte when
- applied to unsigned types of size 2, 4, 16, ... bytes. */
-#define INT_STRLEN_BOUND(t) \
- (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \
- + _GL_SIGNED_TYPE_OR_EXPR (t))
-
-/* Bound on buffer size needed to represent an integer type or expression T,
- including the terminating null. */
-#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
-
-
-/* Range overflow checks.
-
- The INT_<op>_RANGE_OVERFLOW macros return 1 if the corresponding C
- operators might not yield numerically correct answers due to
- arithmetic overflow. They do not rely on undefined or
- implementation-defined behavior. Their implementations are simple
- and straightforward, but they are a bit harder to use than the
- INT_<op>_OVERFLOW macros described below.
-
- Example usage:
-
- long int i = ...;
- long int j = ...;
- if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX))
- printf ("multiply would overflow");
- else
- printf ("product is %ld", i * j);
-
- Restrictions on *_RANGE_OVERFLOW macros:
-
- These macros do not check for all possible numerical problems or
- undefined or unspecified behavior: they do not check for division
- by zero, for bad shift counts, or for shifting negative numbers.
-
- These macros may evaluate their arguments zero or multiple times,
- so the arguments should not have side effects. The arithmetic
- arguments (including the MIN and MAX arguments) must be of the same
- integer type after the usual arithmetic conversions, and the type
- must have minimum value MIN and maximum MAX. Unsigned types should
- use a zero MIN of the proper type.
-
- These macros are tuned for constant MIN and MAX. For commutative
- operations such as A + B, they are also tuned for constant B. */
-
-/* Return 1 if A + B would overflow in [MIN,MAX] arithmetic.
- See above for restrictions. */
-#define INT_ADD_RANGE_OVERFLOW(a, b, min, max) \
- ((b) < 0 \
- ? (a) < (min) - (b) \
- : (max) - (b) < (a))
-
-/* Return 1 if A - B would overflow in [MIN,MAX] arithmetic.
- See above for restrictions. */
-#define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max) \
- ((b) < 0 \
- ? (max) + (b) < (a) \
- : (a) < (min) + (b))
-
-/* Return 1 if - A would overflow in [MIN,MAX] arithmetic.
- See above for restrictions. */
-#define INT_NEGATE_RANGE_OVERFLOW(a, min, max) \
- ((min) < 0 \
- ? (a) < - (max) \
- : 0 < (a))
-
-/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic.
- See above for restrictions. Avoid && and || as they tickle
- bugs in Sun C 5.11 2010/08/13 and other compilers; see
- <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. */
-#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \
- ((b) < 0 \
- ? ((a) < 0 \
- ? (a) < (max) / (b) \
- : (b) == -1 \
- ? 0 \
- : (min) / (b) < (a)) \
- : (b) == 0 \
- ? 0 \
- : ((a) < 0 \
- ? (a) < (min) / (b) \
- : (max) / (b) < (a)))
-
-/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic.
- See above for restrictions. Do not check for division by zero. */
-#define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max) \
- ((min) < 0 && (b) == -1 && (a) < - (max))
-
-/* Return 1 if A % B would overflow in [MIN,MAX] arithmetic.
- See above for restrictions. Do not check for division by zero.
- Mathematically, % should never overflow, but on x86-like hosts
- INT_MIN % -1 traps, and the C standard permits this, so treat this
- as an overflow too. */
-#define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max) \
- INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max)
-
-/* Return 1 if A << B would overflow in [MIN,MAX] arithmetic.
- See above for restrictions. Here, MIN and MAX are for A only, and B need
- not be of the same type as the other arguments. The C standard says that
- behavior is undefined for shifts unless 0 <= B < wordwidth, and that when
- A is negative then A << B has undefined behavior and A >> B has
- implementation-defined behavior, but do not check these other
- restrictions. */
-#define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max) \
- ((a) < 0 \
- ? (a) < (min) >> (b) \
- : (max) >> (b) < (a))
-
-/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */
-#define _GL_HAS_BUILTIN_OVERFLOW \
- (5 <= __GNUC__ || __has_builtin (__builtin_add_overflow))
-
-/* True if __builtin_add_overflow_p (A, B, C) works. */
-#define _GL_HAS_BUILTIN_OVERFLOW_P \
- (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p))
-
-/* The _GL*_OVERFLOW macros have the same restrictions as the
- *_RANGE_OVERFLOW macros, except that they do not assume that operands
- (e.g., A and B) have the same type as MIN and MAX. Instead, they assume
- that the result (e.g., A + B) has that type. */
-#if _GL_HAS_BUILTIN_OVERFLOW_P
-# define _GL_ADD_OVERFLOW(a, b, min, max) \
- __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0)
-# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
- __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0)
-# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
- __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0)
-#else
-# define _GL_ADD_OVERFLOW(a, b, min, max) \
- ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \
- : (a) < 0 ? (b) <= (a) + (b) \
- : (b) < 0 ? (a) <= (a) + (b) \
- : (a) + (b) < (b))
-# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
- ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \
- : (a) < 0 ? 1 \
- : (b) < 0 ? (a) - (b) <= (a) \
- : (a) < (b))
-# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
- (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \
- || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
-#endif
-#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \
- ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
- : (a) < 0 ? (b) <= (a) + (b) - 1 \
- : (b) < 0 && (a) + (b) <= (a))
-#define _GL_REMAINDER_OVERFLOW(a, b, min, max) \
- ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
- : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \
- : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max))
-
-/* Return a nonzero value if A is a mathematical multiple of B, where
- A is unsigned, B is negative, and MAX is the maximum value of A's
- type. A's type must be the same as (A % B)'s type. Normally (A %
- -B == 0) suffices, but things get tricky if -B would overflow. */
-#define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max) \
- (((b) < -_GL_SIGNED_INT_MAXIMUM (b) \
- ? (_GL_SIGNED_INT_MAXIMUM (b) == (max) \
- ? (a) \
- : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1)) \
- : (a) % - (b)) \
- == 0)
-
-/* Check for integer overflow, and report low order bits of answer.
-
- The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators
- might not yield numerically correct answers due to arithmetic overflow.
- The INT_<op>_WRAPV macros also store the low-order bits of the answer.
- These macros work correctly on all known practical hosts, and do not rely
- on undefined behavior due to signed arithmetic overflow.
-
- Example usage, assuming A and B are long int:
-
- if (INT_MULTIPLY_OVERFLOW (a, b))
- printf ("result would overflow\n");
- else
- printf ("result is %ld (no overflow)\n", a * b);
-
- Example usage with WRAPV flavor:
-
- long int result;
- bool overflow = INT_MULTIPLY_WRAPV (a, b, &result);
- printf ("result is %ld (%s)\n", result,
- overflow ? "after overflow" : "no overflow");
-
- Restrictions on these macros:
-
- These macros do not check for all possible numerical problems or
- undefined or unspecified behavior: they do not check for division
- by zero, for bad shift counts, or for shifting negative numbers.
-
- These macros may evaluate their arguments zero or multiple times, so the
- arguments should not have side effects.
-
- The WRAPV macros are not constant expressions. They support only
- +, binary -, and *. The result type must be signed.
-
- These macros are tuned for their last argument being a constant.
-
- Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B,
- A % B, and A << B would overflow, respectively. */
-
-#define INT_ADD_OVERFLOW(a, b) \
- _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
-#define INT_SUBTRACT_OVERFLOW(a, b) \
- _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
-#if _GL_HAS_BUILTIN_OVERFLOW_P
-# define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a)
-#else
-# define INT_NEGATE_OVERFLOW(a) \
- INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
-#endif
-#define INT_MULTIPLY_OVERFLOW(a, b) \
- _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW)
-#define INT_DIVIDE_OVERFLOW(a, b) \
- _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW)
-#define INT_REMAINDER_OVERFLOW(a, b) \
- _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW)
-#define INT_LEFT_SHIFT_OVERFLOW(a, b) \
- INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \
- _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
-
-/* Return 1 if the expression A <op> B would overflow,
- where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test,
- assuming MIN and MAX are the minimum and maximum for the result type.
- Arguments should be free of side effects. */
-#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \
- op_result_overflow (a, b, \
- _GL_INT_MINIMUM (0 * (b) + (a)), \
- _GL_INT_MAXIMUM (0 * (b) + (a)))
-
-/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R.
- Return 1 if the result overflows. See above for restrictions. */
-#define INT_ADD_WRAPV(a, b, r) \
- _GL_INT_OP_WRAPV (a, b, r, +, __builtin_add_overflow, INT_ADD_OVERFLOW)
-#define INT_SUBTRACT_WRAPV(a, b, r) \
- _GL_INT_OP_WRAPV (a, b, r, -, __builtin_sub_overflow, INT_SUBTRACT_OVERFLOW)
-#define INT_MULTIPLY_WRAPV(a, b, r) \
- _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW)
-
-/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See:
- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193
- https://llvm.org/bugs/show_bug.cgi?id=25390
- For now, assume all versions of GCC-like compilers generate bogus
- warnings for _Generic. This matters only for older compilers that
- lack __builtin_add_overflow. */
-#if __GNUC__
-# define _GL__GENERIC_BOGUS 1
-#else
-# define _GL__GENERIC_BOGUS 0
-#endif
-
-/* Store the low-order bits of A <op> B into *R, where OP specifies
- the operation. BUILTIN is the builtin operation, and OVERFLOW the
- overflow predicate. Return 1 if the result overflows. See above
- for restrictions. */
-#if _GL_HAS_BUILTIN_OVERFLOW
-# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r)
-#elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS
-# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
- (_Generic \
- (*(r), \
- signed char: \
- _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \
- signed char, SCHAR_MIN, SCHAR_MAX), \
- short int: \
- _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \
- short int, SHRT_MIN, SHRT_MAX), \
- int: \
- _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
- int, INT_MIN, INT_MAX), \
- long int: \
- _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
- long int, LONG_MIN, LONG_MAX), \
- long long int: \
- _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
- long long int, LLONG_MIN, LLONG_MAX)))
-#else
-# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
- (sizeof *(r) == sizeof (signed char) \
- ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \
- signed char, SCHAR_MIN, SCHAR_MAX) \
- : sizeof *(r) == sizeof (short int) \
- ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \
- short int, SHRT_MIN, SHRT_MAX) \
- : sizeof *(r) == sizeof (int) \
- ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
- int, INT_MIN, INT_MAX) \
- : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow))
-# ifdef LLONG_MAX
-# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \
- (sizeof *(r) == sizeof (long int) \
- ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
- long int, LONG_MIN, LONG_MAX) \
- : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
- long long int, LLONG_MIN, LLONG_MAX))
-# else
-# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \
- _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
- long int, LONG_MIN, LONG_MAX)
-# endif
-#endif
-
-/* Store the low-order bits of A <op> B into *R, where the operation
- is given by OP. Use the unsigned type UT for calculation to avoid
- overflow problems. *R's type is T, with extremal values TMIN and
- TMAX. T must be a signed integer type. Return 1 if the result
- overflows. */
-#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \
- (sizeof ((a) op (b)) < sizeof (t) \
- ? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \
- : _GL_INT_OP_CALC1 (a, b, r, op, overflow, ut, t, tmin, tmax))
-#define _GL_INT_OP_CALC1(a, b, r, op, overflow, ut, t, tmin, tmax) \
- ((overflow (a, b) \
- || (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \
- || (tmax) < ((a) op (b))) \
- ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 1) \
- : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 0))
-
-/* Return A <op> B, where the operation is given by OP. Use the
- unsigned type UT for calculation to avoid overflow problems.
- Convert the result to type T without overflow by subtracting TMIN
- from large values before converting, and adding it afterwards.
- Compilers can optimize all the operations except OP. */
-#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t, tmin, tmax) \
- (((ut) (a) op (ut) (b)) <= (tmax) \
- ? (t) ((ut) (a) op (ut) (b)) \
- : ((t) (((ut) (a) op (ut) (b)) - (tmin)) + (tmin)))
-
-#endif /* _GL_INTPROPS_H */
diff --git a/src/gl/itold.c b/src/gl/itold.c
deleted file mode 100644
index 5533392e53..0000000000
--- a/src/gl/itold.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Replacement for 'int' to 'long double' conversion routine.
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2011.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <float.h>
-
-void
-_Qp_itoq (long double *result, int a)
-{
- /* Convert from 'int' to 'double', then from 'double' to 'long double'. */
- *result = (double) a;
-}
diff --git a/src/gl/limits.in.h b/src/gl/limits.in.h
deleted file mode 100644
index a1eae02ada..0000000000
--- a/src/gl/limits.in.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* A GNU-like <limits.h>.
-
- Copyright 2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _@GUARD_PREFIX@_LIMITS_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* The include_next requires a split double-inclusion guard. */
-#@INCLUDE_NEXT@ @NEXT_LIMITS_H@
-
-#ifndef _@GUARD_PREFIX@_LIMITS_H
-#define _@GUARD_PREFIX@_LIMITS_H
-
-/* The number of usable bits in an unsigned or signed integer type
- with minimum value MIN and maximum value MAX, as an int expression
- suitable in #if. Cover all known practical hosts. This
- implementation exploits the fact that MAX is 1 less than a power of
- 2, and merely counts the number of 1 bits in MAX; "COBn" means
- "count the number of 1 bits in the low-order n bits"). */
-#define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max))
-#define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n))
-#define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n))
-#define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n))
-#define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n))
-#define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n))
-#define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1))
-
-/* Macros specified by ISO/IEC TS 18661-1:2014. */
-
-#if (! defined ULLONG_WIDTH \
- && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))
-# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX)
-# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX)
-# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX)
-# define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX)
-# define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX)
-# define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX)
-# define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX)
-# define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX)
-# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX)
-# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX)
-# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX)
-#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */
-
-#endif /* _@GUARD_PREFIX@_LIMITS_H */
-#endif /* _@GUARD_PREFIX@_LIMITS_H */
diff --git a/src/gl/listen.c b/src/gl/listen.c
deleted file mode 100644
index fd59f753eb..0000000000
--- a/src/gl/listen.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* listen.c --- wrappers for Windows listen function
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef listen
-
-int
-rpl_listen (int fd, int backlog)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- int r = listen (sock, backlog);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
- }
-}
diff --git a/src/gl/lseek.c b/src/gl/lseek.c
deleted file mode 100644
index 2a95a07ea6..0000000000
--- a/src/gl/lseek.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* An lseek() function that detects pipes.
- Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <unistd.h>
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Windows platforms. */
-/* Get GetFileType. */
-# include <windows.h>
-/* Get _get_osfhandle. */
-# include "msvc-nothrow.h"
-#else
-# include <sys/stat.h>
-#endif
-#include <errno.h>
-
-#undef lseek
-
-off_t
-rpl_lseek (int fd, off_t offset, int whence)
-{
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- /* mingw lseek mistakenly succeeds on pipes, sockets, and terminals. */
- HANDLE h = (HANDLE) _get_osfhandle (fd);
- if (h == INVALID_HANDLE_VALUE)
- {
- errno = EBADF;
- return -1;
- }
- if (GetFileType (h) != FILE_TYPE_DISK)
- {
- errno = ESPIPE;
- return -1;
- }
-#else
- /* BeOS lseek mistakenly succeeds on pipes... */
- struct stat statbuf;
- if (fstat (fd, &statbuf) < 0)
- return -1;
- if (!S_ISREG (statbuf.st_mode))
- {
- errno = ESPIPE;
- return -1;
- }
-#endif
-#if _GL_WINDOWS_64_BIT_OFF_T
- return _lseeki64 (fd, offset, whence);
-#else
- return lseek (fd, offset, whence);
-#endif
-}
diff --git a/src/gl/m4/00gnulib.m4 b/src/gl/m4/00gnulib.m4
deleted file mode 100644
index bb37e32aa3..0000000000
--- a/src/gl/m4/00gnulib.m4
+++ /dev/null
@@ -1,46 +0,0 @@
-# 00gnulib.m4 serial 3
-dnl Copyright (C) 2009-2016 Free Software Foundation, Inc.
-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.
-
-dnl This file must be named something that sorts before all other
-dnl gnulib-provided .m4 files. It is needed until such time as we can
-dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE and
-dnl m4_divert semantics.
-
-# Until autoconf 2.63, handling of the diversion stack required m4_init
-# to be called first; but this does not happen with aclocal. Wrapping
-# the entire execution in another layer of the diversion stack fixes this.
-# Worse, prior to autoconf 2.62, m4_wrap depended on the underlying m4
-# for whether it was FIFO or LIFO; in order to properly balance with
-# m4_init, we need to undo our push just before anything wrapped within
-# the m4_init body. The way to ensure this is to wrap both sides of
-# m4_init with a one-shot macro that does the pop at the right time.
-m4_ifndef([_m4_divert_diversion],
-[m4_divert_push([KILL])
-m4_define([gl_divert_fixup], [m4_divert_pop()m4_define([$0])])
-m4_define([m4_init],
- [gl_divert_fixup()]m4_defn([m4_init])[gl_divert_fixup()])])
-
-
-# AC_DEFUN_ONCE([NAME], VALUE)
-# ----------------------------
-# Define NAME to expand to VALUE on the first use (whether by direct
-# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses.
-# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This
-# definition is slower than the version in Autoconf 2.64, because it
-# can only use interfaces that existed since 2.59; but it achieves the
-# same effect. Quoting is necessary to avoid confusing Automake.
-m4_version_prereq([2.63.263], [],
-[m4_define([AC][_DEFUN_ONCE],
- [AC][_DEFUN([$1],
- [AC_REQUIRE([_gl_DEFUN_ONCE([$1])],
- [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl
-[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])])
-
-# gl_00GNULIB
-# -----------
-# Witness macro that this file has been included. Needed to force
-# Automake to include this file prior to all other gnulib .m4 files.
-AC_DEFUN([gl_00GNULIB])
diff --git a/src/gl/m4/absolute-header.m4 b/src/gl/m4/absolute-header.m4
deleted file mode 100644
index 7ffc38d7a2..0000000000
--- a/src/gl/m4/absolute-header.m4
+++ /dev/null
@@ -1,102 +0,0 @@
-# absolute-header.m4 serial 16
-dnl Copyright (C) 2006-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Derek Price.
-
-# gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...)
-# ---------------------------------------
-# Find the absolute name of a header file, testing first if the header exists.
-# If the header were sys/inttypes.h, this macro would define
-# ABSOLUTE_SYS_INTTYPES_H to the '""' quoted absolute name of sys/inttypes.h
-# in config.h
-# (e.g. '#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"').
-# The three "///" are to pacify Sun C 5.8, which otherwise would say
-# "warning: #include of /usr/include/... may be non-portable".
-# Use '""', not '<>', so that the /// cannot be confused with a C99 comment.
-# Note: This macro assumes that the header file is not empty after
-# preprocessing, i.e. it does not only define preprocessor macros but also
-# provides some type/enum definitions or function/variable declarations.
-AC_DEFUN([gl_ABSOLUTE_HEADER],
-[AC_REQUIRE([AC_CANONICAL_HOST])
-AC_LANG_PREPROC_REQUIRE()dnl
-dnl FIXME: gl_absolute_header and ac_header_exists must be used unquoted
-dnl until we can assume autoconf 2.64 or newer.
-m4_foreach_w([gl_HEADER_NAME], [$1],
- [AS_VAR_PUSHDEF([gl_absolute_header],
- [gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl
- AC_CACHE_CHECK([absolute name of <]m4_defn([gl_HEADER_NAME])[>],
- m4_defn([gl_absolute_header]),
- [AS_VAR_PUSHDEF([ac_header_exists],
- [ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl
- AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl
- if test AS_VAR_GET(ac_header_exists) = yes; then
- gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME]))
- fi
- AS_VAR_POPDEF([ac_header_exists])dnl
- ])dnl
- AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])),
- ["AS_VAR_GET(gl_absolute_header)"],
- [Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.])
- AS_VAR_POPDEF([gl_absolute_header])dnl
-])dnl
-])# gl_ABSOLUTE_HEADER
-
-# gl_ABSOLUTE_HEADER_ONE(HEADER)
-# ------------------------------
-# Like gl_ABSOLUTE_HEADER, except that:
-# - it assumes that the header exists,
-# - it uses the current CPPFLAGS,
-# - it does not cache the result,
-# - it is silent.
-AC_DEFUN([gl_ABSOLUTE_HEADER_ONE],
-[
- AC_REQUIRE([AC_CANONICAL_HOST])
- AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote([$1])[[>]])])
- dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
- dnl that contain only a #include of other header files and no
- dnl non-comment tokens of their own. This leads to a failure to
- dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
- dnl and others. The workaround is to force preservation of comments
- dnl through option -C. This ensures all necessary #line directives
- dnl are present. GCC supports option -C as well.
- case "$host_os" in
- aix*) gl_absname_cpp="$ac_cpp -C" ;;
- *) gl_absname_cpp="$ac_cpp" ;;
- esac
-changequote(,)
- case "$host_os" in
- mingw*)
- dnl For the sake of native Windows compilers (excluding gcc),
- dnl treat backslash as a directory separator, like /.
- dnl Actually, these compilers use a double-backslash as
- dnl directory separator, inside the
- dnl # line "filename"
- dnl directives.
- gl_dirsep_regex='[/\\]'
- ;;
- *)
- gl_dirsep_regex='\/'
- ;;
- esac
- dnl A sed expression that turns a string into a basic regular
- dnl expression, for use within "/.../".
- gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
- gl_header_literal_regex=`echo '$1' \
- | sed -e "$gl_make_literal_regex_sed"`
- gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
- s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
- s|^/[^/]|//&|
- p
- q
- }'
-changequote([,])
- dnl eval is necessary to expand gl_absname_cpp.
- dnl Ultrix and Pyramid sh refuse to redirect output of eval,
- dnl so use subshell.
- AS_VAR_SET([gl_cv_absolute_]AS_TR_SH([[$1]]),
-[`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
- sed -n "$gl_absolute_header_sed"`])
-])
diff --git a/src/gl/m4/alloca.m4 b/src/gl/m4/alloca.m4
deleted file mode 100644
index 2382ff1eee..0000000000
--- a/src/gl/m4/alloca.m4
+++ /dev/null
@@ -1,121 +0,0 @@
-# alloca.m4 serial 14
-dnl Copyright (C) 2002-2004, 2006-2007, 2009-2016 Free Software Foundation,
-dnl Inc.
-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_FUNC_ALLOCA],
-[
- AC_REQUIRE([AC_FUNC_ALLOCA])
- if test $ac_cv_func_alloca_works = no; then
- gl_PREREQ_ALLOCA
- fi
-
- # Define an additional variable used in the Makefile substitution.
- if test $ac_cv_working_alloca_h = yes; then
- AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [
- AC_EGREP_CPP([Need own alloca], [
-#if defined __GNUC__ || defined _AIX || defined _MSC_VER
- Need own alloca
-#endif
- ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no])
- ])
- if test $gl_cv_rpl_alloca = yes; then
- dnl OK, alloca can be implemented through a compiler built-in.
- AC_DEFINE([HAVE_ALLOCA], [1],
- [Define to 1 if you have 'alloca' after including <alloca.h>,
- a header that may be supplied by this distribution.])
- ALLOCA_H=alloca.h
- else
- dnl alloca exists as a library function, i.e. it is slow and probably
- dnl a memory leak. Don't define HAVE_ALLOCA in this case.
- ALLOCA_H=
- fi
- else
- ALLOCA_H=alloca.h
- fi
- AC_SUBST([ALLOCA_H])
- AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"])
-])
-
-# Prerequisites of lib/alloca.c.
-# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
-AC_DEFUN([gl_PREREQ_ALLOCA], [:])
-
-# This works around a bug in autoconf <= 2.68.
-# See <http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00277.html>.
-
-m4_version_prereq([2.69], [] ,[
-
-# This is taken from the following Autoconf patch:
-# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497
-
-# _AC_LIBOBJ_ALLOCA
-# -----------------
-# Set up the LIBOBJ replacement of 'alloca'. Well, not exactly
-# AC_LIBOBJ since we actually set the output variable 'ALLOCA'.
-# Nevertheless, for Automake, AC_LIBSOURCES it.
-m4_define([_AC_LIBOBJ_ALLOCA],
-[# The SVR3 libPW and SVR4 libucb both contain incompatible functions
-# that cause trouble. Some versions do not even contain alloca or
-# contain a buggy version. If you still want to use their alloca,
-# use ar to extract alloca.o from them instead of compiling alloca.c.
-AC_LIBSOURCES(alloca.c)
-AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl
-AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.])
-
-AC_CACHE_CHECK(whether 'alloca.c' needs Cray hooks, ac_cv_os_cray,
-[AC_EGREP_CPP(webecray,
-[#if defined CRAY && ! defined CRAY2
-webecray
-#else
-wenotbecray
-#endif
-], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
-if test $ac_cv_os_cray = yes; then
- for ac_func in _getb67 GETB67 getb67; do
- AC_CHECK_FUNC($ac_func,
- [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
- [Define to one of '_getb67', 'GETB67',
- 'getb67' for Cray-2 and Cray-YMP
- systems. This function is required for
- 'alloca.c' support on those systems.])
- break])
- done
-fi
-
-AC_CACHE_CHECK([stack direction for C alloca],
- [ac_cv_c_stack_direction],
-[AC_RUN_IFELSE([AC_LANG_SOURCE(
-[AC_INCLUDES_DEFAULT
-int
-find_stack_direction (int *addr, int depth)
-{
- int dir, dummy = 0;
- if (! addr)
- addr = &dummy;
- *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
- dir = depth ? find_stack_direction (addr, depth - 1) : 0;
- return dir + dummy;
-}
-
-int
-main (int argc, char **argv)
-{
- return find_stack_direction (0, argc + !argv + 20) < 0;
-}])],
- [ac_cv_c_stack_direction=1],
- [ac_cv_c_stack_direction=-1],
- [ac_cv_c_stack_direction=0])])
-AH_VERBATIM([STACK_DIRECTION],
-[/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at runtime.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-@%:@undef STACK_DIRECTION])dnl
-AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
-])# _AC_LIBOBJ_ALLOCA
-])
diff --git a/src/gl/m4/arpa_inet_h.m4 b/src/gl/m4/arpa_inet_h.m4
deleted file mode 100644
index 5387f28409..0000000000
--- a/src/gl/m4/arpa_inet_h.m4
+++ /dev/null
@@ -1,57 +0,0 @@
-# arpa_inet_h.m4 serial 13
-dnl Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc.
-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.
-
-dnl Written by Simon Josefsson and Bruno Haible
-
-AC_DEFUN([gl_HEADER_ARPA_INET],
-[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
-
- AC_CHECK_HEADERS_ONCE([arpa/inet.h])
- if test $ac_cv_header_arpa_inet_h = yes; then
- HAVE_ARPA_INET_H=1
- else
- HAVE_ARPA_INET_H=0
- fi
- AC_SUBST([HAVE_ARPA_INET_H])
- dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK.
- gl_CHECK_NEXT_HEADERS([arpa/inet.h])
-
- AC_REQUIRE([gl_FEATURES_H])
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[
-/* On some systems, this header is not self-consistent. */
-#if !(defined __GLIBC__ || defined __UCLIBC__)
-# include <sys/socket.h>
-#endif
-#ifdef __TANDEM
-# include <netdb.h>
-#endif
-#include <arpa/inet.h>
- ]], [inet_ntop inet_pton])
-])
-
-AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
- gl_MODULE_INDICATOR_SET_VARIABLE([$1])
-])
-
-AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
-[
- GNULIB_INET_NTOP=0; AC_SUBST([GNULIB_INET_NTOP])
- GNULIB_INET_PTON=0; AC_SUBST([GNULIB_INET_PTON])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP])
- HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON])
- REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP])
- REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON])
-])
diff --git a/src/gl/m4/bison.m4 b/src/gl/m4/bison.m4
deleted file mode 100644
index 556730cf67..0000000000
--- a/src/gl/m4/bison.m4
+++ /dev/null
@@ -1,24 +0,0 @@
-# serial 7
-
-# Copyright (C) 2002, 2005, 2009-2016 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_BISON],
-[
- # parse-datetime.y works with bison only.
- : ${YACC='bison -y'}
-dnl
-dnl Declaring YACC & YFLAGS precious will not be necessary after GNULIB
-dnl requires an Autoconf greater than 2.59c, but it will probably still be
-dnl useful to override the description of YACC in the --help output, re
-dnl parse-datetime.y assuming 'bison -y'.
- AC_ARG_VAR([YACC],
-[The "Yet Another C Compiler" implementation to use. Defaults to 'bison -y'.
-Values other than 'bison -y' will most likely break on most systems.])dnl
- AC_ARG_VAR([YFLAGS],
-[YFLAGS contains the list arguments that will be passed by default to Bison.
-This script will default YFLAGS to the empty string to avoid a default value of
-'-d' given by some make applications.])dnl
-])
diff --git a/src/gl/m4/clock_time.m4 b/src/gl/m4/clock_time.m4
deleted file mode 100644
index bb20344e8f..0000000000
--- a/src/gl/m4/clock_time.m4
+++ /dev/null
@@ -1,31 +0,0 @@
-# clock_time.m4 serial 10
-dnl Copyright (C) 2002-2006, 2009-2016 Free Software Foundation, Inc.
-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.
-
-# Check for clock_gettime and clock_settime, and set LIB_CLOCK_GETTIME.
-# For a program named, say foo, you should add a line like the following
-# in the corresponding Makefile.am file:
-# foo_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
-
-AC_DEFUN([gl_CLOCK_TIME],
-[
- dnl Persuade glibc and Solaris <time.h> to declare these functions.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
- # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
-
- # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
- # programs in the package would end up linked with that potentially-shared
- # library, inducing unnecessary run-time overhead.
- LIB_CLOCK_GETTIME=
- AC_SUBST([LIB_CLOCK_GETTIME])
- gl_saved_libs=$LIBS
- AC_SEARCH_LIBS([clock_gettime], [rt posix4],
- [test "$ac_cv_search_clock_gettime" = "none required" ||
- LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
- AC_CHECK_FUNCS([clock_gettime clock_settime])
- LIBS=$gl_saved_libs
-])
diff --git a/src/gl/m4/close.m4 b/src/gl/m4/close.m4
deleted file mode 100644
index 310f076bed..0000000000
--- a/src/gl/m4/close.m4
+++ /dev/null
@@ -1,33 +0,0 @@
-# close.m4 serial 8
-dnl Copyright (C) 2008-2016 Free Software Foundation, Inc.
-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_FUNC_CLOSE],
-[
- AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
- AC_REQUIRE([gl_MSVC_INVAL])
- if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
- REPLACE_CLOSE=1
- fi
- m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [
- gl_PREREQ_SYS_H_WINSOCK2
- if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then
- dnl Even if the 'socket' module is not used here, another part of the
- dnl application may use it and pass file descriptors that refer to
- dnl sockets to the close() function. So enable the support for sockets.
- REPLACE_CLOSE=1
- fi
- ])
- dnl Replace close() for supporting the gnulib-defined fchdir() function,
- dnl to keep fchdir's bookkeeping up-to-date.
- m4_ifdef([gl_FUNC_FCHDIR], [
- if test $REPLACE_CLOSE = 0; then
- gl_TEST_FCHDIR
- if test $HAVE_FCHDIR = 0; then
- REPLACE_CLOSE=1
- fi
- fi
- ])
-])
diff --git a/src/gl/m4/dirname.m4 b/src/gl/m4/dirname.m4
deleted file mode 100644
index 6f8bec32c4..0000000000
--- a/src/gl/m4/dirname.m4
+++ /dev/null
@@ -1,19 +0,0 @@
-#serial 10 -*- autoconf -*-
-dnl Copyright (C) 2002-2006, 2009-2016 Free Software Foundation, Inc.
-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_DIRNAME],
-[
- AC_REQUIRE([gl_DIRNAME_LGPL])
-])
-
-AC_DEFUN([gl_DIRNAME_LGPL],
-[
- dnl Prerequisites of lib/dirname.h.
- AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
-
- dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c,
- dnl lib/stripslash.c.
-])
diff --git a/src/gl/m4/double-slash-root.m4 b/src/gl/m4/double-slash-root.m4
deleted file mode 100644
index dfd3921d1e..0000000000
--- a/src/gl/m4/double-slash-root.m4
+++ /dev/null
@@ -1,38 +0,0 @@
-# double-slash-root.m4 serial 4 -*- Autoconf -*-
-dnl Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc.
-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_DOUBLE_SLASH_ROOT],
-[
- AC_REQUIRE([AC_CANONICAL_HOST])
- AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root],
- [ if test x"$cross_compiling" = xyes ; then
- # When cross-compiling, there is no way to tell whether // is special
- # short of a list of hosts. However, the only known hosts to date
- # that have a distinct // are Apollo DomainOS (too old to port to),
- # Cygwin, and z/OS. If anyone knows of another system for which // has
- # special semantics and is distinct from /, please report it to
- # <bug-gnulib@gnu.org>.
- case $host in
- *-cygwin | i370-ibm-openedition)
- gl_cv_double_slash_root=yes ;;
- *)
- # Be optimistic and assume that / and // are the same when we
- # don't know.
- gl_cv_double_slash_root='unknown, assuming no' ;;
- esac
- else
- set x `ls -di / // 2>/dev/null`
- if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then
- gl_cv_double_slash_root=no
- else
- gl_cv_double_slash_root=yes
- fi
- fi])
- if test "$gl_cv_double_slash_root" = yes; then
- AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1],
- [Define to 1 if // is a file system root distinct from /.])
- fi
-])
diff --git a/src/gl/m4/dup2.m4 b/src/gl/m4/dup2.m4
deleted file mode 100644
index 5b68312b1e..0000000000
--- a/src/gl/m4/dup2.m4
+++ /dev/null
@@ -1,117 +0,0 @@
-#serial 25
-dnl Copyright (C) 2002, 2005, 2007, 2009-2016 Free Software Foundation, Inc.
-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_FUNC_DUP2],
-[
- AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
- AC_REQUIRE([AC_CANONICAL_HOST])
- m4_ifdef([gl_FUNC_DUP2_OBSOLETE], [
- AC_CHECK_FUNCS_ONCE([dup2])
- if test $ac_cv_func_dup2 = no; then
- HAVE_DUP2=0
- fi
- ], [
- AC_DEFINE([HAVE_DUP2], [1], [Define to 1 if you have the 'dup2' function.])
- ])
- if test $HAVE_DUP2 = 1; then
- AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works],
- [AC_RUN_IFELSE([
- AC_LANG_PROGRAM(
- [[#include <errno.h>
- #include <fcntl.h>
- #include <limits.h>
- #include <sys/resource.h>
- #include <unistd.h>
- #ifndef RLIM_SAVED_CUR
- # define RLIM_SAVED_CUR RLIM_INFINITY
- #endif
- #ifndef RLIM_SAVED_MAX
- # define RLIM_SAVED_MAX RLIM_INFINITY
- #endif
- ]],
- [[int result = 0;
- int bad_fd = INT_MAX;
- struct rlimit rlim;
- if (getrlimit (RLIMIT_NOFILE, &rlim) == 0
- && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX
- && rlim.rlim_cur != RLIM_INFINITY
- && rlim.rlim_cur != RLIM_SAVED_MAX
- && rlim.rlim_cur != RLIM_SAVED_CUR)
- bad_fd = rlim.rlim_cur;
- #ifdef FD_CLOEXEC
- if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1)
- result |= 1;
- #endif
- if (dup2 (1, 1) != 1)
- result |= 2;
- #ifdef FD_CLOEXEC
- if (fcntl (1, F_GETFD) != FD_CLOEXEC)
- result |= 4;
- #endif
- close (0);
- if (dup2 (0, 0) != -1)
- result |= 8;
- /* Many gnulib modules require POSIX conformance of EBADF. */
- if (dup2 (2, bad_fd) == -1 && errno != EBADF)
- result |= 16;
- /* Flush out some cygwin core dumps. */
- if (dup2 (2, -1) != -1 || errno != EBADF)
- result |= 32;
- dup2 (2, 255);
- dup2 (2, 256);
- /* On OS/2 kLIBC, dup2() does not work on a directory fd. */
- {
- int fd = open (".", O_RDONLY);
- if (fd == -1)
- result |= 64;
- else if (dup2 (fd, fd + 1) == -1)
- result |= 128;
-
- close (fd);
- }
- return result;]])
- ],
- [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no],
- [case "$host_os" in
- mingw*) # on this platform, dup2 always returns 0 for success
- gl_cv_func_dup2_works="guessing no" ;;
- cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0
- gl_cv_func_dup2_works="guessing no" ;;
- aix* | freebsd*)
- # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE,
- # not EBADF.
- gl_cv_func_dup2_works="guessing no" ;;
- haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC.
- gl_cv_func_dup2_works="guessing no" ;;
- *-android*) # implemented using dup3(), which fails if oldfd == newfd
- gl_cv_func_dup2_works="guessing no" ;;
- os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd.
- gl_cv_func_dup2_works="guessing no" ;;
- *) gl_cv_func_dup2_works="guessing yes" ;;
- esac])
- ])
- case "$gl_cv_func_dup2_works" in
- *yes) ;;
- *)
- REPLACE_DUP2=1
- AC_CHECK_FUNCS([setdtablesize])
- ;;
- esac
- fi
- dnl Replace dup2() for supporting the gnulib-defined fchdir() function,
- dnl to keep fchdir's bookkeeping up-to-date.
- m4_ifdef([gl_FUNC_FCHDIR], [
- gl_TEST_FCHDIR
- if test $HAVE_FCHDIR = 0; then
- if test $HAVE_DUP2 = 1; then
- REPLACE_DUP2=1
- fi
- fi
- ])
-])
-
-# Prerequisites of lib/dup2.c.
-AC_DEFUN([gl_PREREQ_DUP2], [])
diff --git a/src/gl/m4/eealloc.m4 b/src/gl/m4/eealloc.m4
deleted file mode 100644
index 63d74defec..0000000000
--- a/src/gl/m4/eealloc.m4
+++ /dev/null
@@ -1,31 +0,0 @@
-# eealloc.m4 serial 3
-dnl Copyright (C) 2003, 2009-2016 Free Software Foundation, Inc.
-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_EEALLOC],
-[
- AC_REQUIRE([gl_EEMALLOC])
- AC_REQUIRE([gl_EEREALLOC])
-])
-
-AC_DEFUN([gl_EEMALLOC],
-[
- _AC_FUNC_MALLOC_IF(
- [gl_cv_func_malloc_0_nonnull=1],
- [gl_cv_func_malloc_0_nonnull=0])
- AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], [$gl_cv_func_malloc_0_nonnull],
- [If malloc(0) is != NULL, define this to 1. Otherwise define this
- to 0.])
-])
-
-AC_DEFUN([gl_EEREALLOC],
-[
- _AC_FUNC_REALLOC_IF(
- [gl_cv_func_realloc_0_nonnull=1],
- [gl_cv_func_realloc_0_nonnull=0])
- AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], [$gl_cv_func_realloc_0_nonnull],
- [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this
- to 0.])
-])
diff --git a/src/gl/m4/environ.m4 b/src/gl/m4/environ.m4
deleted file mode 100644
index 9a0ea7e214..0000000000
--- a/src/gl/m4/environ.m4
+++ /dev/null
@@ -1,47 +0,0 @@
-# environ.m4 serial 6
-dnl Copyright (C) 2001-2004, 2006-2016 Free Software Foundation, Inc.
-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_ONCE([gl_ENVIRON],
-[
- AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
- dnl Persuade glibc <unistd.h> to declare environ.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_HEADERS_ONCE([unistd.h])
- gt_CHECK_VAR_DECL(
- [#if HAVE_UNISTD_H
- #include <unistd.h>
- #endif
- /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
- #include <stdlib.h>
- ],
- [environ])
- if test $gt_cv_var_environ_declaration != yes; then
- HAVE_DECL_ENVIRON=0
- fi
-])
-
-# Check if a variable is properly declared.
-# gt_CHECK_VAR_DECL(includes,variable)
-AC_DEFUN([gt_CHECK_VAR_DECL],
-[
- define([gt_cv_var], [gt_cv_var_]$2[_declaration])
- AC_MSG_CHECKING([if $2 is properly declared])
- AC_CACHE_VAL([gt_cv_var], [
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[$1
- extern struct { int foo; } $2;]],
- [[$2.foo = 1;]])],
- [gt_cv_var=no],
- [gt_cv_var=yes])])
- AC_MSG_RESULT([$gt_cv_var])
- if test $gt_cv_var = yes; then
- AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1,
- [Define if you have the declaration of $2.])
- fi
- undefine([gt_cv_var])
-])
diff --git a/src/gl/m4/errno_h.m4 b/src/gl/m4/errno_h.m4
deleted file mode 100644
index b111fce053..0000000000
--- a/src/gl/m4/errno_h.m4
+++ /dev/null
@@ -1,137 +0,0 @@
-# errno_h.m4 serial 12
-dnl Copyright (C) 2004, 2006, 2008-2016 Free Software Foundation, Inc.
-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_ONCE([gl_HEADER_ERRNO_H],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
- AC_EGREP_CPP([booboo],[
-#include <errno.h>
-#if !defined ETXTBSY
-booboo
-#endif
-#if !defined ENOMSG
-booboo
-#endif
-#if !defined EIDRM
-booboo
-#endif
-#if !defined ENOLINK
-booboo
-#endif
-#if !defined EPROTO
-booboo
-#endif
-#if !defined EMULTIHOP
-booboo
-#endif
-#if !defined EBADMSG
-booboo
-#endif
-#if !defined EOVERFLOW
-booboo
-#endif
-#if !defined ENOTSUP
-booboo
-#endif
-#if !defined ENETRESET
-booboo
-#endif
-#if !defined ECONNABORTED
-booboo
-#endif
-#if !defined ESTALE
-booboo
-#endif
-#if !defined EDQUOT
-booboo
-#endif
-#if !defined ECANCELED
-booboo
-#endif
-#if !defined EOWNERDEAD
-booboo
-#endif
-#if !defined ENOTRECOVERABLE
-booboo
-#endif
-#if !defined EILSEQ
-booboo
-#endif
- ],
- [gl_cv_header_errno_h_complete=no],
- [gl_cv_header_errno_h_complete=yes])
- ])
- if test $gl_cv_header_errno_h_complete = yes; then
- ERRNO_H=''
- else
- gl_NEXT_HEADERS([errno.h])
- ERRNO_H='errno.h'
- fi
- AC_SUBST([ERRNO_H])
- AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"])
- gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
- gl_REPLACE_ERRNO_VALUE([ENOLINK])
- gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
-])
-
-# Assuming $1 = EOVERFLOW.
-# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
-# POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
-# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
-# Check for the value of EOVERFLOW.
-# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
-AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
-[
- if test -n "$ERRNO_H"; then
- AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
- AC_EGREP_CPP([yes],[
-#include <errno.h>
-#ifdef ]$1[
-yes
-#endif
- ],
- [gl_cv_header_errno_h_]$1[=yes],
- [gl_cv_header_errno_h_]$1[=no])
- if test $gl_cv_header_errno_h_]$1[ = no; then
- AC_EGREP_CPP([yes],[
-#define _XOPEN_SOURCE_EXTENDED 1
-#include <errno.h>
-#ifdef ]$1[
-yes
-#endif
- ], [gl_cv_header_errno_h_]$1[=hidden])
- if test $gl_cv_header_errno_h_]$1[ = hidden; then
- dnl The macro exists but is hidden.
- dnl Define it to the same value.
- AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
-#define _XOPEN_SOURCE_EXTENDED 1
-#include <errno.h>
-/* The following two lines are a workaround against an autoconf-2.52 bug. */
-#include <stdio.h>
-#include <stdlib.h>
-])
- fi
- fi
- ])
- case $gl_cv_header_errno_h_]$1[ in
- yes | no)
- ]$1[_HIDDEN=0; ]$1[_VALUE=
- ;;
- *)
- ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
- ;;
- esac
- AC_SUBST($1[_HIDDEN])
- AC_SUBST($1[_VALUE])
- fi
-])
-
-dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
-dnl Remove this when we can assume autoconf >= 2.61.
-m4_ifdef([AC_COMPUTE_INT], [], [
- AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
-])
diff --git a/src/gl/m4/error.m4 b/src/gl/m4/error.m4
deleted file mode 100644
index f772bcf580..0000000000
--- a/src/gl/m4/error.m4
+++ /dev/null
@@ -1,27 +0,0 @@
-#serial 14
-
-# Copyright (C) 1996-1998, 2001-2004, 2009-2016 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_ERROR],
-[
- dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer
- dnl maintained in Autoconf and because it invokes AC_LIBOBJ.
- AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line],
- [AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <error.h>]],
- [[error_at_line (0, 0, "", 0, "an error occurred");]])],
- [ac_cv_lib_error_at_line=yes],
- [ac_cv_lib_error_at_line=no])])
-])
-
-# Prerequisites of lib/error.c.
-AC_DEFUN([gl_PREREQ_ERROR],
-[
- AC_REQUIRE([AC_FUNC_STRERROR_R])
- :
-])
diff --git a/src/gl/m4/exponentd.m4 b/src/gl/m4/exponentd.m4
deleted file mode 100644
index 7869a7d6cb..0000000000
--- a/src/gl/m4/exponentd.m4
+++ /dev/null
@@ -1,116 +0,0 @@
-# exponentd.m4 serial 3
-dnl Copyright (C) 2007-2008, 2010-2016 Free Software Foundation, Inc.
-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_DOUBLE_EXPONENT_LOCATION],
-[
- AC_CACHE_CHECK([where to find the exponent in a 'double'],
- [gl_cv_cc_double_expbit0],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <float.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-#define NWORDS \
- ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
-typedef union { double value; unsigned int word[NWORDS]; } memory_double;
-static unsigned int ored_words[NWORDS];
-static unsigned int anded_words[NWORDS];
-static void add_to_ored_words (double x)
-{
- memory_double m;
- size_t i;
- /* Clear it first, in case sizeof (double) < sizeof (memory_double). */
- memset (&m, 0, sizeof (memory_double));
- m.value = x;
- for (i = 0; i < NWORDS; i++)
- {
- ored_words[i] |= m.word[i];
- anded_words[i] &= m.word[i];
- }
-}
-int main ()
-{
- size_t j;
- FILE *fp = fopen ("conftest.out", "w");
- if (fp == NULL)
- return 1;
- for (j = 0; j < NWORDS; j++)
- anded_words[j] = ~ (unsigned int) 0;
- add_to_ored_words (0.25);
- add_to_ored_words (0.5);
- add_to_ored_words (1.0);
- add_to_ored_words (2.0);
- add_to_ored_words (4.0);
- /* Remove bits that are common (e.g. if representation of the first mantissa
- bit is explicit). */
- for (j = 0; j < NWORDS; j++)
- ored_words[j] &= ~anded_words[j];
- /* Now find the nonzero word. */
- for (j = 0; j < NWORDS; j++)
- if (ored_words[j] != 0)
- break;
- if (j < NWORDS)
- {
- size_t i;
- for (i = j + 1; i < NWORDS; i++)
- if (ored_words[i] != 0)
- {
- fprintf (fp, "unknown");
- return (fclose (fp) != 0);
- }
- for (i = 0; ; i++)
- if ((ored_words[j] >> i) & 1)
- {
- fprintf (fp, "word %d bit %d", (int) j, (int) i);
- return (fclose (fp) != 0);
- }
- }
- fprintf (fp, "unknown");
- return (fclose (fp) != 0);
-}
- ]])],
- [gl_cv_cc_double_expbit0=`cat conftest.out`],
- [gl_cv_cc_double_expbit0="unknown"],
- [
- dnl On ARM, there are two 'double' floating-point formats, used by
- dnl different sets of instructions: The older FPA instructions assume
- dnl that they are stored in big-endian word order, while the words
- dnl (like integer types) are stored in little-endian byte order.
- dnl The newer VFP instructions assume little-endian order
- dnl consistently.
- AC_EGREP_CPP([mixed_endianness], [
-#if defined arm || defined __arm || defined __arm__
- mixed_endianness
-#endif
- ],
- [gl_cv_cc_double_expbit0="unknown"],
- [
- pushdef([AC_MSG_CHECKING],[:])dnl
- pushdef([AC_MSG_RESULT],[:])dnl
- pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl
- AC_C_BIGENDIAN(
- [gl_cv_cc_double_expbit0="word 0 bit 20"],
- [gl_cv_cc_double_expbit0="word 1 bit 20"],
- [gl_cv_cc_double_expbit0="unknown"])
- popdef([AC_MSG_RESULT_UNQUOTED])dnl
- popdef([AC_MSG_RESULT])dnl
- popdef([AC_MSG_CHECKING])dnl
- ])
- ])
- rm -f conftest.out
- ])
- case "$gl_cv_cc_double_expbit0" in
- word*bit*)
- word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'`
- bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'`
- AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word],
- [Define as the word index where to find the exponent of 'double'.])
- AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit],
- [Define as the bit index in the word where to find bit 0 of the exponent of 'double'.])
- ;;
- esac
-])
diff --git a/src/gl/m4/extensions.m4 b/src/gl/m4/extensions.m4
deleted file mode 100644
index e114a6f729..0000000000
--- a/src/gl/m4/extensions.m4
+++ /dev/null
@@ -1,173 +0,0 @@
-# serial 15 -*- Autoconf -*-
-# Enable extensions on systems that normally disable them.
-
-# Copyright (C) 2003, 2006-2016 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git
-# Autoconf. Perhaps we can remove this once we can assume Autoconf
-# 2.70 or later everywhere, but since Autoconf mutates rapidly
-# enough in this area it's likely we'll need to redefine
-# AC_USE_SYSTEM_EXTENSIONS for quite some time.
-
-# If autoconf reports a warning
-# warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
-# or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
-# the fix is
-# 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
-# but always AC_REQUIREd,
-# 2) to ensure that for each occurrence of
-# AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-# or
-# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-# the corresponding gnulib module description has 'extensions' among
-# its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
-# invocation occurs in gl_EARLY, not in gl_INIT.
-
-# AC_USE_SYSTEM_EXTENSIONS
-# ------------------------
-# Enable extensions on systems that normally disable them,
-# typically due to standards-conformance issues.
-#
-# Remember that #undef in AH_VERBATIM gets replaced with #define by
-# AC_DEFINE. The goal here is to define all known feature-enabling
-# macros, then, if reports of conflicts are made, disable macros that
-# cause problems on some platforms (such as __EXTENSIONS__).
-AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
-[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
-AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-
- AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
- if test "$MINIX" = yes; then
- AC_DEFINE([_POSIX_SOURCE], [1],
- [Define to 1 if you need to in order for 'stat' and other
- things to work.])
- AC_DEFINE([_POSIX_1_SOURCE], [2],
- [Define to 2 if the system does not provide POSIX.1 features
- except with this defined.])
- AC_DEFINE([_MINIX], [1],
- [Define to 1 if on MINIX.])
- AC_DEFINE([_NETBSD_SOURCE], [1],
- [Define to 1 to make NetBSD features available. MINIX 3 needs this.])
- fi
-
-dnl Use a different key than __EXTENSIONS__, as that name broke existing
-dnl configure.ac when using autoheader 2.62.
- AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
-[/* Enable extensions on AIX 3, Interix. */
-#ifndef _ALL_SOURCE
-# undef _ALL_SOURCE
-#endif
-/* Enable general extensions on macOS. */
-#ifndef _DARWIN_C_SOURCE
-# undef _DARWIN_C_SOURCE
-#endif
-/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif
-/* Enable threading extensions on Solaris. */
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
-#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
-# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
-#endif
-/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
-#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
-# undef __STDC_WANT_IEC_60559_BFP_EXT__
-#endif
-/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
-#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
-# undef __STDC_WANT_IEC_60559_DFP_EXT__
-#endif
-/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
-#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
-# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
-#endif
-/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
-#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
-# undef __STDC_WANT_IEC_60559_TYPES_EXT__
-#endif
-/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
-#ifndef __STDC_WANT_LIB_EXT2__
-# undef __STDC_WANT_LIB_EXT2__
-#endif
-/* Enable extensions specified by ISO/IEC 24747:2009. */
-#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
-# undef __STDC_WANT_MATH_SPEC_FUNCS__
-#endif
-/* Enable extensions on HP NonStop. */
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
-/* Enable X/Open extensions if necessary. HP-UX 11.11 defines
- mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
- whether compiling with -Ae or -D_HPUX_SOURCE=1. */
-#ifndef _XOPEN_SOURCE
-# undef _XOPEN_SOURCE
-#endif
-/* Enable general extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-])
- AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
- [ac_cv_safe_to_define___extensions__],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[
-# define __EXTENSIONS__ 1
- ]AC_INCLUDES_DEFAULT])],
- [ac_cv_safe_to_define___extensions__=yes],
- [ac_cv_safe_to_define___extensions__=no])])
- test $ac_cv_safe_to_define___extensions__ = yes &&
- AC_DEFINE([__EXTENSIONS__])
- AC_DEFINE([_ALL_SOURCE])
- AC_DEFINE([_DARWIN_C_SOURCE])
- AC_DEFINE([_GNU_SOURCE])
- AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
- AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__])
- AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__])
- AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__])
- AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__])
- AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__])
- AC_DEFINE([__STDC_WANT_LIB_EXT2__])
- AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__])
- AC_DEFINE([_TANDEM_SOURCE])
- AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
- [ac_cv_should_define__xopen_source],
- [ac_cv_should_define__xopen_source=no
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[
- #include <wchar.h>
- mbstate_t x;]])],
- [],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[
- #define _XOPEN_SOURCE 500
- #include <wchar.h>
- mbstate_t x;]])],
- [ac_cv_should_define__xopen_source=yes])])])
- test $ac_cv_should_define__xopen_source = yes &&
- AC_DEFINE([_XOPEN_SOURCE], [500])
-])# AC_USE_SYSTEM_EXTENSIONS
-
-# gl_USE_SYSTEM_EXTENSIONS
-# ------------------------
-# Enable extensions on systems that normally disable them,
-# typically due to standards-conformance issues.
-AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
-[
- dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS.
- dnl gnulib does not need it. But if it gets required by third-party macros
- dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a
- dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
- dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE,
- dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck.
- AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-])
diff --git a/src/gl/m4/extern-inline.m4 b/src/gl/m4/extern-inline.m4
deleted file mode 100644
index 1e578f3deb..0000000000
--- a/src/gl/m4/extern-inline.m4
+++ /dev/null
@@ -1,102 +0,0 @@
-dnl 'extern inline' a la ISO C99.
-
-dnl Copyright 2012-2016 Free Software Foundation, Inc.
-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_EXTERN_INLINE],
-[
- AH_VERBATIM([extern_inline],
-[/* Please see the Gnulib manual for how to use these macros.
-
- Suppress extern inline with HP-UX cc, as it appears to be broken; see
- <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
-
- Suppress extern inline with Sun C in standards-conformance mode, as it
- mishandles inline functions that call each other. E.g., for 'inline void f
- (void) { } inline void g (void) { f (); }', c99 incorrectly complains
- 'reference to static identifier "f" in extern inline function'.
- This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
-
- Suppress extern inline (with or without __attribute__ ((__gnu_inline__)))
- on configurations that mistakenly use 'static inline' to implement
- functions or macros in standard C headers like <ctype.h>. For example,
- if isdigit is mistakenly implemented via a static inline function,
- a program containing an extern inline function that calls isdigit
- may not work since the C standard prohibits extern inline functions
- from calling static functions. This bug is known to occur on:
-
- OS X 10.8 and earlier; see:
- http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html
-
- DragonFly; see
- http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log
-
- FreeBSD; see:
- http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html
-
- OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
- for clang but remains for g++; see <http://trac.macports.org/ticket/41033>.
- Assume DragonFly and FreeBSD will be similar. */
-#if (((defined __APPLE__ && defined __MACH__) \
- || defined __DragonFly__ || defined __FreeBSD__) \
- && (defined __header_inline \
- ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
- && ! defined __clang__) \
- : ((! defined _DONT_USE_CTYPE_INLINE_ \
- && (defined __GNUC__ || defined __cplusplus)) \
- || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
- && defined __GNUC__ && ! defined __cplusplus))))
-# define _GL_EXTERN_INLINE_STDHEADER_BUG
-#endif
-#if ((__GNUC__ \
- ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
- : (199901L <= __STDC_VERSION__ \
- && !defined __HP_cc \
- && !defined __PGI \
- && !(defined __SUNPRO_C && __STDC__))) \
- && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
-# define _GL_INLINE inline
-# define _GL_EXTERN_INLINE extern inline
-# define _GL_EXTERN_INLINE_IN_USE
-#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
- && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
-# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
- /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
-# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
-# else
-# define _GL_INLINE extern inline
-# endif
-# define _GL_EXTERN_INLINE extern
-# define _GL_EXTERN_INLINE_IN_USE
-#else
-# define _GL_INLINE static _GL_UNUSED
-# define _GL_EXTERN_INLINE static _GL_UNUSED
-#endif
-
-/* In GCC 4.6 (inclusive) to 5.1 (exclusive),
- suppress bogus "no previous prototype for 'FOO'"
- and "no previous declaration for 'FOO'" diagnostics,
- when FOO is an inline function in the header; see
- <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and
- <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */
-#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__
-# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
-# define _GL_INLINE_HEADER_CONST_PRAGMA
-# else
-# define _GL_INLINE_HEADER_CONST_PRAGMA \
- _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
-# endif
-# define _GL_INLINE_HEADER_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
- _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
- _GL_INLINE_HEADER_CONST_PRAGMA
-# define _GL_INLINE_HEADER_END \
- _Pragma ("GCC diagnostic pop")
-#else
-# define _GL_INLINE_HEADER_BEGIN
-# define _GL_INLINE_HEADER_END
-#endif])
-])
diff --git a/src/gl/m4/flexmember.m4 b/src/gl/m4/flexmember.m4
deleted file mode 100644
index 155ae9b812..0000000000
--- a/src/gl/m4/flexmember.m4
+++ /dev/null
@@ -1,43 +0,0 @@
-# serial 4
-# Check for flexible array member support.
-
-# Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# Written by Paul Eggert.
-
-AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER],
-[
- AC_CACHE_CHECK([for flexible array member],
- ac_cv_c_flexmember,
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <stdlib.h>
- #include <stdio.h>
- #include <stddef.h>
- struct s { int n; double d[]; };]],
- [[int m = getchar ();
- size_t nbytes = offsetof (struct s, d) + m * sizeof (double);
- nbytes += sizeof (struct s) - 1;
- nbytes -= nbytes % sizeof (struct s);
- struct s *p = malloc (nbytes);
- p->d[0] = 0.0;
- return p->d != (double *) NULL;]])],
- [ac_cv_c_flexmember=yes],
- [ac_cv_c_flexmember=no])])
- if test $ac_cv_c_flexmember = yes; then
- AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [],
- [Define to nothing if C supports flexible array members, and to
- 1 if it does not. That way, with a declaration like 'struct s
- { int n; double d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack
- can be used with pre-C99 compilers.
- When computing the size of such an object, don't use 'sizeof (struct s)'
- as it overestimates the size. Use 'offsetof (struct s, d)' instead.
- Don't use 'offsetof (struct s, d@<:@0@:>@)', as this doesn't work with
- MSVC and with C++ compilers.])
- else
- AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [1])
- fi
-])
diff --git a/src/gl/m4/float_h.m4 b/src/gl/m4/float_h.m4
deleted file mode 100644
index e2887eb5c6..0000000000
--- a/src/gl/m4/float_h.m4
+++ /dev/null
@@ -1,98 +0,0 @@
-# float_h.m4 serial 9
-dnl Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
-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_FLOAT_H],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST])
- FLOAT_H=
- REPLACE_FLOAT_LDBL=0
- case "$host_os" in
- aix* | beos* | openbsd* | mirbsd* | irix*)
- FLOAT_H=float.h
- ;;
- freebsd*)
- case "$host_cpu" in
-changequote(,)dnl
- i[34567]86 )
-changequote([,])dnl
- FLOAT_H=float.h
- ;;
- x86_64 )
- # On x86_64 systems, the C compiler may still be generating
- # 32-bit code.
- AC_EGREP_CPP([yes],
- [#if defined __LP64__ || defined __x86_64__ || defined __amd64__
- yes
- #endif],
- [],
- [FLOAT_H=float.h])
- ;;
- esac
- ;;
- linux*)
- case "$host_cpu" in
- powerpc*)
- FLOAT_H=float.h
- ;;
- esac
- ;;
- esac
- case "$host_os" in
- aix* | freebsd* | linux*)
- if test -n "$FLOAT_H"; then
- REPLACE_FLOAT_LDBL=1
- fi
- ;;
- esac
-
- dnl Test against glibc-2.7 Linux/SPARC64 bug.
- REPLACE_ITOLD=0
- AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works],
- [gl_cv_func_itold_works],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-int i = -1;
-volatile long double ld;
-int main ()
-{
- ld += i * 1.0L;
- if (ld > 0)
- return 1;
- return 0;
-}]])],
- [gl_cv_func_itold_works=yes],
- [gl_cv_func_itold_works=no],
- [case "$host" in
- sparc*-*-linux*)
- AC_EGREP_CPP([yes],
- [#if defined __LP64__ || defined __arch64__
- yes
- #endif],
- [gl_cv_func_itold_works="guessing no"],
- [gl_cv_func_itold_works="guessing yes"])
- ;;
- *) gl_cv_func_itold_works="guessing yes" ;;
- esac
- ])
- ])
- case "$gl_cv_func_itold_works" in
- *no)
- REPLACE_ITOLD=1
- dnl We add the workaround to <float.h> but also to <math.h>,
- dnl to increase the chances that the fix function gets pulled in.
- FLOAT_H=float.h
- ;;
- esac
-
- if test -n "$FLOAT_H"; then
- gl_NEXT_HEADERS([float.h])
- fi
- AC_SUBST([FLOAT_H])
- AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"])
- AC_SUBST([REPLACE_ITOLD])
-])
diff --git a/src/gl/m4/fseek.m4 b/src/gl/m4/fseek.m4
deleted file mode 100644
index 5ec8d004d3..0000000000
--- a/src/gl/m4/fseek.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-# fseek.m4 serial 4
-dnl Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
-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_FUNC_FSEEK],
-[
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- AC_REQUIRE([gl_FUNC_FSEEKO])
- dnl When fseeko needs fixes, fseek needs them too.
- if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
- REPLACE_FSEEK=1
- fi
-])
diff --git a/src/gl/m4/fseeko.m4 b/src/gl/m4/fseeko.m4
deleted file mode 100644
index 6c7f551bda..0000000000
--- a/src/gl/m4/fseeko.m4
+++ /dev/null
@@ -1,73 +0,0 @@
-# fseeko.m4 serial 17
-dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
-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_FUNC_FSEEKO],
-[
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
- AC_REQUIRE([gl_SYS_TYPES_H])
- AC_REQUIRE([AC_PROG_CC])
-
- dnl Persuade glibc <stdio.h> to declare fseeko().
- AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
- AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
- [
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
-]], [fseeko (stdin, 0, 0);])],
- [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
- ])
-
- AC_CHECK_DECLS_ONCE([fseeko])
- if test $ac_cv_have_decl_fseeko = no; then
- HAVE_DECL_FSEEKO=0
- fi
-
- if test $gl_cv_func_fseeko = no; then
- HAVE_FSEEKO=0
- else
- if test $WINDOWS_64_BIT_OFF_T = 1; then
- REPLACE_FSEEKO=1
- fi
- if test $gl_cv_var_stdin_large_offset = no; then
- REPLACE_FSEEKO=1
- fi
- m4_ifdef([gl_FUNC_FFLUSH_STDIN], [
- gl_FUNC_FFLUSH_STDIN
- if test $gl_cv_func_fflush_stdin != yes; then
- REPLACE_FSEEKO=1
- fi
- ])
- fi
-])
-
-dnl Code shared by fseeko and ftello. Determine if large files are supported,
-dnl but stdin does not start as a large file by default.
-AC_DEFUN([gl_STDIN_LARGE_OFFSET],
- [
- AC_CACHE_CHECK([whether stdin defaults to large file offsets],
- [gl_cv_var_stdin_large_offset],
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
-[[#if defined __SL64 && defined __SCLE /* cygwin */
- /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
- fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and
- it is easier to do a version check than building a runtime test. */
-# include <cygwin/version.h>
-# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
- choke me
-# endif
-#endif]])],
- [gl_cv_var_stdin_large_offset=yes],
- [gl_cv_var_stdin_large_offset=no])])
-])
-
-# Prerequisites of lib/fseeko.c.
-AC_DEFUN([gl_PREREQ_FSEEKO],
-[
- dnl Native Windows has the function _fseeki64. mingw hides it, but mingw64
- dnl makes it usable again.
- AC_CHECK_FUNCS([_fseeki64])
-])
diff --git a/src/gl/m4/fstat.m4 b/src/gl/m4/fstat.m4
deleted file mode 100644
index 29f9b81654..0000000000
--- a/src/gl/m4/fstat.m4
+++ /dev/null
@@ -1,36 +0,0 @@
-# fstat.m4 serial 4
-dnl Copyright (C) 2011-2016 Free Software Foundation, Inc.
-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_FUNC_FSTAT],
-[
- AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
-
- AC_REQUIRE([gl_MSVC_INVAL])
- if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
- REPLACE_FSTAT=1
- fi
-
- AC_REQUIRE([gl_HEADER_SYS_STAT_H])
- if test $WINDOWS_64_BIT_ST_SIZE = 1; then
- REPLACE_FSTAT=1
- fi
-
- dnl Replace fstat() for supporting the gnulib-defined open() on directories.
- m4_ifdef([gl_FUNC_FCHDIR], [
- gl_TEST_FCHDIR
- if test $HAVE_FCHDIR = 0; then
- case "$gl_cv_func_open_directory_works" in
- *yes) ;;
- *)
- REPLACE_FSTAT=1
- ;;
- esac
- fi
- ])
-])
-
-# Prerequisites of lib/fstat.c.
-AC_DEFUN([gl_PREREQ_FSTAT], [:])
diff --git a/src/gl/m4/ftell.m4 b/src/gl/m4/ftell.m4
deleted file mode 100644
index 6701f0a76c..0000000000
--- a/src/gl/m4/ftell.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-# ftell.m4 serial 3
-dnl Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
-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_FUNC_FTELL],
-[
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- AC_REQUIRE([gl_FUNC_FTELLO])
- dnl When ftello needs fixes, ftell needs them too.
- if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
- REPLACE_FTELL=1
- fi
-])
diff --git a/src/gl/m4/ftello.m4 b/src/gl/m4/ftello.m4
deleted file mode 100644
index 3f4808bf37..0000000000
--- a/src/gl/m4/ftello.m4
+++ /dev/null
@@ -1,140 +0,0 @@
-# ftello.m4 serial 11
-dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
-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_FUNC_FTELLO],
-[
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
- AC_REQUIRE([gl_SYS_TYPES_H])
-
- dnl Persuade glibc <stdio.h> to declare ftello().
- AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_DECLS_ONCE([ftello])
- if test $ac_cv_have_decl_ftello = no; then
- HAVE_DECL_FTELLO=0
- fi
-
- AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello],
- [
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <stdio.h>]],
- [[ftello (stdin);]])],
- [gl_cv_func_ftello=yes],
- [gl_cv_func_ftello=no])
- ])
- if test $gl_cv_func_ftello = no; then
- HAVE_FTELLO=0
- else
- if test $WINDOWS_64_BIT_OFF_T = 1; then
- REPLACE_FTELLO=1
- fi
- if test $gl_cv_var_stdin_large_offset = no; then
- REPLACE_FTELLO=1
- fi
- if test $REPLACE_FTELLO = 0; then
- dnl Detect bug on Solaris.
- dnl ftell and ftello produce incorrect results after putc that followed a
- dnl getc call that reached EOF on Solaris. This is because the _IOREAD
- dnl flag does not get cleared in this case, even though _IOWRT gets set,
- dnl and ftell and ftello look whether the _IOREAD flag is set.
- AC_REQUIRE([AC_CANONICAL_HOST])
- AC_CACHE_CHECK([whether ftello works],
- [gl_cv_func_ftello_works],
- [
- dnl Initial guess, used when cross-compiling or when /dev/tty cannot
- dnl be opened.
-changequote(,)dnl
- case "$host_os" in
- # Guess no on Solaris.
- solaris*) gl_cv_func_ftello_works="guessing no" ;;
- # Guess yes otherwise.
- *) gl_cv_func_ftello_works="guessing yes" ;;
- esac
-changequote([,])dnl
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define TESTFILE "conftest.tmp"
-int
-main (void)
-{
- FILE *fp;
-
- /* Create a file with some contents. */
- fp = fopen (TESTFILE, "w");
- if (fp == NULL)
- return 70;
- if (fwrite ("foogarsh", 1, 8, fp) < 8)
- return 71;
- if (fclose (fp))
- return 72;
-
- /* The file's contents is now "foogarsh". */
-
- /* Try writing after reading to EOF. */
- fp = fopen (TESTFILE, "r+");
- if (fp == NULL)
- return 73;
- if (fseek (fp, -1, SEEK_END))
- return 74;
- if (!(getc (fp) == 'h'))
- return 1;
- if (!(getc (fp) == EOF))
- return 2;
- if (!(ftell (fp) == 8))
- return 3;
- if (!(ftell (fp) == 8))
- return 4;
- if (!(putc ('!', fp) == '!'))
- return 5;
- if (!(ftell (fp) == 9))
- return 6;
- if (!(fclose (fp) == 0))
- return 7;
- fp = fopen (TESTFILE, "r");
- if (fp == NULL)
- return 75;
- {
- char buf[10];
- if (!(fread (buf, 1, 10, fp) == 9))
- return 10;
- if (!(memcmp (buf, "foogarsh!", 9) == 0))
- return 11;
- }
- if (!(fclose (fp) == 0))
- return 12;
-
- /* The file's contents is now "foogarsh!". */
-
- return 0;
-}]])],
- [gl_cv_func_ftello_works=yes],
- [gl_cv_func_ftello_works=no], [:])
- ])
- case "$gl_cv_func_ftello_works" in
- *yes) ;;
- *)
- REPLACE_FTELLO=1
- AC_DEFINE([FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE], [1],
- [Define to 1 if the system's ftello function has the Solaris bug.])
- ;;
- esac
- fi
- fi
-])
-
-# Prerequisites of lib/ftello.c.
-AC_DEFUN([gl_PREREQ_FTELLO],
-[
- dnl Native Windows has the function _ftelli64. mingw hides it, but mingw64
- dnl makes it usable again.
- AC_CHECK_FUNCS([_ftelli64])
-])
diff --git a/src/gl/m4/getaddrinfo.m4 b/src/gl/m4/getaddrinfo.m4
deleted file mode 100644
index 4a92d0865f..0000000000
--- a/src/gl/m4/getaddrinfo.m4
+++ /dev/null
@@ -1,209 +0,0 @@
-# getaddrinfo.m4 serial 31
-dnl Copyright (C) 2004-2016 Free Software Foundation, Inc.
-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_GETADDRINFO],
-[
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
- AC_REQUIRE([gl_HEADER_NETDB])dnl for HAVE_NETDB_H
- AC_MSG_CHECKING([how to do getaddrinfo, freeaddrinfo and getnameinfo])
- GETADDRINFO_LIB=
- gai_saved_LIBS="$LIBS"
-
- dnl Where is getaddrinfo()?
- dnl - On Solaris, it is in libsocket.
- dnl - On Haiku, it is in libnetwork.
- dnl - On BeOS, it is in libnet.
- dnl - On native Windows, it is in ws2_32.dll.
- dnl - Otherwise it is in libc.
- AC_SEARCH_LIBS([getaddrinfo], [socket network net],
- [if test "$ac_cv_search_getaddrinfo" != "none required"; then
- GETADDRINFO_LIB="$ac_cv_search_getaddrinfo"
- fi])
- LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
-
- HAVE_GETADDRINFO=1
- AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#include <stddef.h>
-]], [[getaddrinfo("", "", NULL, NULL);]])],
- [gl_cv_func_getaddrinfo=yes],
- [gl_cv_func_getaddrinfo=no])])
- if test $gl_cv_func_getaddrinfo = no; then
- AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32],
- gl_cv_w32_getaddrinfo, [
- gl_cv_w32_getaddrinfo=no
- am_save_LIBS="$LIBS"
- LIBS="$LIBS -lws2_32"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-#include <stddef.h>
-]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes])
- LIBS="$am_save_LIBS"
- ])
- if test "$gl_cv_w32_getaddrinfo" = "yes"; then
- GETADDRINFO_LIB="-lws2_32"
- LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
- else
- HAVE_GETADDRINFO=0
- fi
- fi
-
- # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
- # inline function declared in ws2tcpip.h, so we need to get that
- # header included somehow.
- AC_CHECK_DECLS([gai_strerror], [], [], [[
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-#include <stddef.h>
-]])
- if test $ac_cv_have_decl_gai_strerror = yes; then
- AC_CHECK_DECLS([gai_strerrorA], [], [], [[
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-#include <stddef.h>
-]])
- dnl check for correct signature
- AC_CACHE_CHECK([for gai_strerror with POSIX signature],
- [gl_cv_func_gai_strerror_posix_signature], [
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-#include <stddef.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-const char *gai_strerror(int);]])],
- [gl_cv_func_gai_strerror_posix_signature=yes],
- [gl_cv_func_gai_strerror_posix_signature=no])])
- if test $gl_cv_func_gai_strerror_posix_signature = no; then
- REPLACE_GAI_STRERROR=1
- fi
- fi
-
- LIBS="$gai_saved_LIBS"
-
- gl_PREREQ_GETADDRINFO
-
- AC_SUBST([GETADDRINFO_LIB])
-])
-
-# Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c.
-AC_DEFUN([gl_PREREQ_GETADDRINFO], [
- AC_REQUIRE([gl_NETDB_H_DEFAULTS])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
- AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB
- AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB
- AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB
- AC_REQUIRE([AC_C_RESTRICT])
- AC_REQUIRE([gl_SOCKET_FAMILIES])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
- dnl Including sys/socket.h is wrong for Windows, but Windows does not
- dnl have sa_len so the result is correct anyway.
- AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [
-#include <sys/types.h>
-#include <sys/socket.h>
-])
-
- AC_CHECK_HEADERS_ONCE([netinet/in.h])
-
- AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, getnameinfo],,,[[
- /* sys/types.h is not needed according to POSIX, but the
- sys/socket.h in i386-unknown-freebsd4.10 and
- powerpc-apple-darwin5.5 required it. */
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-]])
- if test $ac_cv_have_decl_getaddrinfo = no; then
- HAVE_DECL_GETADDRINFO=0
- fi
- if test $ac_cv_have_decl_freeaddrinfo = no; then
- HAVE_DECL_FREEADDRINFO=0
- fi
- if test $ac_cv_have_decl_gai_strerror = no; then
- HAVE_DECL_GAI_STRERROR=0
- fi
- if test $ac_cv_have_decl_getnameinfo = no; then
- HAVE_DECL_GETNAMEINFO=0
- fi
-
- AC_CHECK_TYPES([struct addrinfo],,,[
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-])
- if test $ac_cv_type_struct_addrinfo = no; then
- HAVE_STRUCT_ADDRINFO=0
- fi
-
- dnl Append $HOSTENT_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
- case " $GETADDRINFO_LIB " in
- *" $HOSTENT_LIB "*) ;;
- *) GETADDRINFO_LIB="$GETADDRINFO_LIB $HOSTENT_LIB" ;;
- esac
-
- dnl Append $SERVENT_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
- case " $GETADDRINFO_LIB " in
- *" $SERVENT_LIB "*) ;;
- *) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;;
- esac
-
- dnl Append $INET_NTOP_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
- case " $GETADDRINFO_LIB " in
- *" $INET_NTOP_LIB "*) ;;
- *) GETADDRINFO_LIB="$GETADDRINFO_LIB $INET_NTOP_LIB" ;;
- esac
-])
diff --git a/src/gl/m4/getdelim.m4 b/src/gl/m4/getdelim.m4
deleted file mode 100644
index a1a7dcc526..0000000000
--- a/src/gl/m4/getdelim.m4
+++ /dev/null
@@ -1,90 +0,0 @@
-# getdelim.m4 serial 11
-
-dnl Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc.
-dnl
-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_PREREQ([2.59])
-
-AC_DEFUN([gl_FUNC_GETDELIM],
-[
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
-
- dnl Persuade glibc <stdio.h> to declare getdelim().
- AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_DECLS_ONCE([getdelim])
-
- AC_CHECK_FUNCS_ONCE([getdelim])
- if test $ac_cv_func_getdelim = yes; then
- HAVE_GETDELIM=1
- dnl Found it in some library. Verify that it works.
- AC_CACHE_CHECK([for working getdelim function], [gl_cv_func_working_getdelim],
- [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
- int main ()
- {
- FILE *in = fopen ("./conftest.data", "r");
- if (!in)
- return 1;
- {
- /* Test result for a NULL buffer and a zero size.
- Based on a test program from Karl Heuer. */
- char *line = NULL;
- size_t siz = 0;
- int len = getdelim (&line, &siz, '\n', in);
- if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
- return 2;
- }
- {
- /* Test result for a NULL buffer and a non-zero size.
- This crashes on FreeBSD 8.0. */
- char *line = NULL;
- size_t siz = (size_t)(~0) / 4;
- if (getdelim (&line, &siz, '\n', in) == -1)
- return 3;
- free (line);
- }
- fclose (in);
- return 0;
- }
- ]])], [gl_cv_func_working_getdelim=yes] dnl The library version works.
- , [gl_cv_func_working_getdelim=no] dnl The library version does NOT work.
- , dnl We're cross compiling. Assume it works on glibc2 systems.
- [AC_EGREP_CPP([Lucky GNU user],
- [
-#include <features.h>
-#ifdef __GNU_LIBRARY__
- #if (__GLIBC__ >= 2) && !defined __UCLIBC__
- Lucky GNU user
- #endif
-#endif
- ],
- [gl_cv_func_working_getdelim="guessing yes"],
- [gl_cv_func_working_getdelim="guessing no"])]
- )])
- case "$gl_cv_func_working_getdelim" in
- *no)
- REPLACE_GETDELIM=1
- ;;
- esac
- else
- HAVE_GETDELIM=0
- fi
-
- if test $ac_cv_have_decl_getdelim = no; then
- HAVE_DECL_GETDELIM=0
- fi
-])
-
-# Prerequisites of lib/getdelim.c.
-AC_DEFUN([gl_PREREQ_GETDELIM],
-[
- AC_CHECK_FUNCS([flockfile funlockfile])
- AC_CHECK_DECLS([getc_unlocked])
-])
diff --git a/src/gl/m4/getline.m4 b/src/gl/m4/getline.m4
deleted file mode 100644
index f44751cd4b..0000000000
--- a/src/gl/m4/getline.m4
+++ /dev/null
@@ -1,99 +0,0 @@
-# getline.m4 serial 27
-
-dnl Copyright (C) 1998-2003, 2005-2007, 2009-2016 Free Software Foundation,
-dnl Inc.
-dnl
-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_PREREQ([2.59])
-
-dnl See if there's a working, system-supplied version of the getline function.
-dnl We can't just do AC_REPLACE_FUNCS([getline]) because some systems
-dnl have a function by that name in -linet that doesn't have anything
-dnl to do with the function we need.
-AC_DEFUN([gl_FUNC_GETLINE],
-[
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
-
- dnl Persuade glibc <stdio.h> to declare getline().
- AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_DECLS_ONCE([getline])
-
- gl_getline_needs_run_time_check=no
- AC_CHECK_FUNC([getline],
- [dnl Found it in some library. Verify that it works.
- gl_getline_needs_run_time_check=yes],
- [am_cv_func_working_getline=no])
- if test $gl_getline_needs_run_time_check = yes; then
- AC_CACHE_CHECK([for working getline function], [am_cv_func_working_getline],
- [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
- int main ()
- {
- FILE *in = fopen ("./conftest.data", "r");
- if (!in)
- return 1;
- {
- /* Test result for a NULL buffer and a zero size.
- Based on a test program from Karl Heuer. */
- char *line = NULL;
- size_t siz = 0;
- int len = getline (&line, &siz, in);
- if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
- return 2;
- free (line);
- }
- {
- /* Test result for a NULL buffer and a non-zero size.
- This crashes on FreeBSD 8.0. */
- char *line = NULL;
- size_t siz = (size_t)(~0) / 4;
- if (getline (&line, &siz, in) == -1)
- return 3;
- free (line);
- }
- fclose (in);
- return 0;
- }
- ]])], [am_cv_func_working_getline=yes] dnl The library version works.
- , [am_cv_func_working_getline=no] dnl The library version does NOT work.
- , dnl We're cross compiling. Assume it works on glibc2 systems.
- [AC_EGREP_CPP([Lucky GNU user],
- [
-#include <features.h>
-#ifdef __GNU_LIBRARY__
- #if (__GLIBC__ >= 2) && !defined __UCLIBC__
- Lucky GNU user
- #endif
-#endif
- ],
- [am_cv_func_working_getline="guessing yes"],
- [am_cv_func_working_getline="guessing no"])]
- )])
- fi
-
- if test $ac_cv_have_decl_getline = no; then
- HAVE_DECL_GETLINE=0
- fi
-
- case "$am_cv_func_working_getline" in
- *no)
- dnl Set REPLACE_GETLINE always: Even if we have not found the broken
- dnl getline function among $LIBS, it may exist in libinet and the
- dnl executable may be linked with -linet.
- REPLACE_GETLINE=1
- ;;
- esac
-])
-
-# Prerequisites of lib/getline.c.
-AC_DEFUN([gl_PREREQ_GETLINE],
-[
- :
-])
diff --git a/src/gl/m4/getpass.m4 b/src/gl/m4/getpass.m4
deleted file mode 100644
index f0e330cb4e..0000000000
--- a/src/gl/m4/getpass.m4
+++ /dev/null
@@ -1,58 +0,0 @@
-# getpass.m4 serial 14
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2016 Free Software Foundation,
-dnl Inc.
-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.
-
-# Provide a getpass() function if the system doesn't have it.
-AC_DEFUN([gl_FUNC_GETPASS],
-[
- dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass().
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_FUNCS([getpass])
- AC_CHECK_DECLS_ONCE([getpass])
- if test $ac_cv_func_getpass = yes; then
- HAVE_GETPASS=1
- else
- HAVE_GETPASS=0
- fi
-])
-
-# Provide the GNU getpass() implementation. It supports passwords of
-# arbitrary length (not just 8 bytes as on HP-UX).
-AC_DEFUN([gl_FUNC_GETPASS_GNU],
-[
- dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass().
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_DECLS_ONCE([getpass])
- dnl TODO: Detect when GNU getpass() is already found in glibc.
- REPLACE_GETPASS=1
-
- if test $REPLACE_GETPASS = 1; then
- dnl We must choose a different name for our function, since on ELF systems
- dnl an unusable getpass() in libc.so would override our getpass() if it is
- dnl compiled into a shared library.
- AC_DEFINE([getpass], [gnu_getpass],
- [Define to a replacement function name for getpass().])
- fi
-])
-
-# Prerequisites of lib/getpass.c.
-AC_DEFUN([gl_PREREQ_GETPASS], [
- AC_CHECK_HEADERS_ONCE([stdio_ext.h termios.h])
- AC_CHECK_FUNCS_ONCE([__fsetlocking tcgetattr tcsetattr])
- AC_CHECK_DECLS([__fsetlocking],,,
- [[#include <stdio.h>
- #if HAVE_STDIO_EXT_H
- #include <stdio_ext.h>
- #endif]])
- AC_CHECK_DECLS_ONCE([fflush_unlocked])
- AC_CHECK_DECLS_ONCE([flockfile])
- AC_CHECK_DECLS_ONCE([fputs_unlocked])
- AC_CHECK_DECLS_ONCE([funlockfile])
- AC_CHECK_DECLS_ONCE([putc_unlocked])
- :
-])
diff --git a/src/gl/m4/getprogname.m4 b/src/gl/m4/getprogname.m4
deleted file mode 100644
index f027037fc6..0000000000
--- a/src/gl/m4/getprogname.m4
+++ /dev/null
@@ -1,43 +0,0 @@
-# getprogname.m4 - check for getprogname or replacements for it
-
-# Copyright (C) 2016 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 4
-
-AC_DEFUN([gl_FUNC_GETPROGNAME],
-[
- AC_CHECK_FUNCS_ONCE([getprogname getexecname])
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- ac_found=0
- AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [],
- [#include <errno.h>])
- AC_CHECK_DECLS([program_invocation_short_name], [ac_found=1], [],
- [#include <errno.h>])
- AC_CHECK_DECLS([__argv], [ac_found=1], [], [#include <stdlib.h>])
-
- # Incur the cost of this test only if none of the above worked.
- if test $ac_found = 0; then
- # On OpenBSD 5.1, using the global __progname variable appears to be
- # the only way to implement getprogname.
- AC_CACHE_CHECK([whether __progname is defined in default libraries],
- [gl_cv_var___progname],
- [
- gl_cv_var___progname=
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[extern char *__progname;]],
- [[return *__progname;]]
- )],
- [gl_cv_var___progname=yes]
- )
- ]
- )
- if test "$gl_cv_var___progname" = yes; then
- AC_DEFINE([HAVE_VAR___PROGNAME], 1,
- [Define if you have a global __progname variable])
- fi
- fi
-])
diff --git a/src/gl/m4/gettime.m4 b/src/gl/m4/gettime.m4
deleted file mode 100644
index 9843ed4855..0000000000
--- a/src/gl/m4/gettime.m4
+++ /dev/null
@@ -1,13 +0,0 @@
-# gettime.m4 serial 8
-dnl Copyright (C) 2002, 2004-2006, 2009-2016 Free Software Foundation, Inc.
-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_GETTIME],
-[
- dnl Prerequisites of lib/gettime.c.
- AC_REQUIRE([gl_CLOCK_TIME])
- AC_REQUIRE([gl_TIMESPEC])
- AC_CHECK_FUNCS_ONCE([gettimeofday nanotime])
-])
diff --git a/src/gl/m4/gettimeofday.m4 b/src/gl/m4/gettimeofday.m4
deleted file mode 100644
index 4ae5d63fe3..0000000000
--- a/src/gl/m4/gettimeofday.m4
+++ /dev/null
@@ -1,138 +0,0 @@
-# serial 21
-
-# Copyright (C) 2001-2003, 2005, 2007, 2009-2016 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-dnl From Jim Meyering.
-
-AC_DEFUN([gl_FUNC_GETTIMEOFDAY],
-[
- AC_REQUIRE([AC_C_RESTRICT])
- AC_REQUIRE([gl_HEADER_SYS_TIME_H])
- AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
- AC_CHECK_FUNCS_ONCE([gettimeofday])
-
- gl_gettimeofday_timezone=void
- if test $ac_cv_func_gettimeofday != yes; then
- HAVE_GETTIMEOFDAY=0
- else
- gl_FUNC_GETTIMEOFDAY_CLOBBER
- AC_CACHE_CHECK([for gettimeofday with POSIX signature],
- [gl_cv_func_gettimeofday_posix_signature],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <sys/time.h>
- struct timeval c;
- int gettimeofday (struct timeval *restrict, void *restrict);
- ]],
- [[/* glibc uses struct timezone * rather than the POSIX void *
- if _GNU_SOURCE is defined. However, since the only portable
- use of gettimeofday uses NULL as the second parameter, and
- since the glibc definition is actually more typesafe, it is
- not worth wrapping this to get a compliant signature. */
- int (*f) (struct timeval *restrict, void *restrict)
- = gettimeofday;
- int x = f (&c, 0);
- return !(x | c.tv_sec | c.tv_usec);
- ]])],
- [gl_cv_func_gettimeofday_posix_signature=yes],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <sys/time.h>
-int gettimeofday (struct timeval *restrict, struct timezone *restrict);
- ]])],
- [gl_cv_func_gettimeofday_posix_signature=almost],
- [gl_cv_func_gettimeofday_posix_signature=no])])])
- if test $gl_cv_func_gettimeofday_posix_signature = almost; then
- gl_gettimeofday_timezone='struct timezone'
- elif test $gl_cv_func_gettimeofday_posix_signature != yes; then
- REPLACE_GETTIMEOFDAY=1
- fi
- dnl If we override 'struct timeval', we also have to override gettimeofday.
- if test $REPLACE_STRUCT_TIMEVAL = 1; then
- REPLACE_GETTIMEOFDAY=1
- fi
- m4_ifdef([gl_FUNC_TZSET_CLOBBER], [
- gl_FUNC_TZSET_CLOBBER
- case "$gl_cv_func_tzset_clobber" in
- *yes)
- REPLACE_GETTIMEOFDAY=1
- gl_GETTIMEOFDAY_REPLACE_LOCALTIME
- AC_DEFINE([tzset], [rpl_tzset],
- [Define to rpl_tzset if the wrapper function should be used.])
- AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1],
- [Define if tzset clobbers localtime's static buffer.])
- ;;
- esac
- ])
- fi
- AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone],
- [Define this to 'void' or 'struct timezone' to match the system's
- declaration of the second argument to gettimeofday.])
-])
-
-
-dnl See if gettimeofday clobbers the static buffer that localtime uses
-dnl for its return value. The gettimeofday function from Mac OS X 10.0.4
-dnl (i.e., Darwin 1.3.7) has this problem.
-dnl
-dnl If it does, then arrange to use gettimeofday and localtime only via
-dnl the wrapper functions that work around the problem.
-
-AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
-[
- AC_REQUIRE([gl_HEADER_SYS_TIME_H])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-
- AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer],
- [gl_cv_func_gettimeofday_clobber],
- [AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <string.h>
- #include <sys/time.h>
- #include <time.h>
- #include <stdlib.h>
- ]],
- [[
- time_t t = 0;
- struct tm *lt;
- struct tm saved_lt;
- struct timeval tv;
- lt = localtime (&t);
- saved_lt = *lt;
- gettimeofday (&tv, NULL);
- return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0;
- ]])],
- [gl_cv_func_gettimeofday_clobber=no],
- [gl_cv_func_gettimeofday_clobber=yes],
- [# When cross-compiling:
- case "$host_os" in
- # Guess all is fine on glibc systems.
- *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
- # If we don't know, assume the worst.
- *) gl_cv_func_gettimeofday_clobber="guessing yes" ;;
- esac
- ])])
-
- case "$gl_cv_func_gettimeofday_clobber" in
- *yes)
- REPLACE_GETTIMEOFDAY=1
- gl_GETTIMEOFDAY_REPLACE_LOCALTIME
- AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], [1],
- [Define if gettimeofday clobbers the localtime buffer.])
- ;;
- esac
-])
-
-AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [
- REPLACE_GMTIME=1
- REPLACE_LOCALTIME=1
-])
-
-# Prerequisites of lib/gettimeofday.c.
-AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [
- AC_CHECK_HEADERS([sys/timeb.h])
- AC_CHECK_FUNCS([_ftime])
-])
diff --git a/src/gl/m4/gnulib-cache.m4 b/src/gl/m4/gnulib-cache.m4
deleted file mode 100644
index b460788f20..0000000000
--- a/src/gl/m4/gnulib-cache.m4
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright (C) 2002-2016 Free Software Foundation, Inc.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This file is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this file. If not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License,
-# this file may be distributed as part of a program that
-# contains a configuration script generated by Autoconf, under
-# the same distribution terms as the rest of that program.
-#
-# Generated by gnulib-tool.
-#
-# This file represents the specification of how gnulib-tool is used.
-# It acts as a cache: It is written and read by gnulib-tool.
-# In projects that use version control, this file is meant to be put under
-# version control, like the configure.ac and various Makefile.am files.
-
-
-# Specification in the form of a command-line invocation:
-# gnulib-tool --import --local-dir=src/gl/override --lib=libgnu_gpl --source-base=src/gl --m4-base=src/gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=ggl --no-vc-files accept bind close connect getaddrinfo getpass gettext-h inet_ntop inet_pton listen minmax parse-datetime progname read-file recv recvfrom select send sendto servent setsockopt shutdown socket sockets socklen
-
-# Specification in the form of a few gnulib-tool.m4 macro invocations:
-gl_LOCAL_DIR([src/gl/override])
-gl_MODULES([
- accept
- bind
- close
- connect
- getaddrinfo
- getpass
- gettext-h
- inet_ntop
- inet_pton
- listen
- minmax
- parse-datetime
- progname
- read-file
- recv
- recvfrom
- select
- send
- sendto
- servent
- setsockopt
- shutdown
- socket
- sockets
- socklen
-])
-gl_AVOID([])
-gl_SOURCE_BASE([src/gl])
-gl_M4_BASE([src/gl/m4])
-gl_PO_BASE([])
-gl_DOC_BASE([doc])
-gl_TESTS_BASE([tests])
-gl_LIB([libgnu_gpl])
-gl_MAKEFILE_NAME([])
-gl_LIBTOOL
-gl_MACRO_PREFIX([ggl])
-gl_PO_DOMAIN([])
-gl_WITNESS_C_MACRO([])
-gl_VC_FILES([false])
diff --git a/src/gl/m4/gnulib-common.m4 b/src/gl/m4/gnulib-common.m4
deleted file mode 100644
index f8454c8a01..0000000000
--- a/src/gl/m4/gnulib-common.m4
+++ /dev/null
@@ -1,462 +0,0 @@
-# gnulib-common.m4 serial 36
-dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
-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.
-
-# gl_COMMON
-# is expanded unconditionally through gnulib-tool magic.
-AC_DEFUN([gl_COMMON], [
- dnl Use AC_REQUIRE here, so that the code is expanded once only.
- AC_REQUIRE([gl_00GNULIB])
- AC_REQUIRE([gl_COMMON_BODY])
-])
-AC_DEFUN([gl_COMMON_BODY], [
- AH_VERBATIM([_Noreturn],
-[/* The _Noreturn keyword of C11. */
-#if ! (defined _Noreturn \
- || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
-# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
- || 0x5110 <= __SUNPRO_C)
-# define _Noreturn __attribute__ ((__noreturn__))
-# elif defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn
-# endif
-#endif
-])
- AH_VERBATIM([isoc99_inline],
-[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
- the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
- earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
- __APPLE__ && __MACH__ test for Mac OS X.
- __APPLE_CC__ tests for the Apple compiler and its version.
- __STDC_VERSION__ tests for the C99 mode. */
-#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
-# define __GNUC_STDC_INLINE__ 1
-#endif])
- AH_VERBATIM([unused_parameter],
-[/* Define as a marker that can be attached to declarations that might not
- be used. This helps to reduce warnings, such as from
- GCC -Wunused-parameter. */
-#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_UNUSED __attribute__ ((__unused__))
-#else
-# define _GL_UNUSED
-#endif
-/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
- is a misnomer outside of parameter lists. */
-#define _UNUSED_PARAMETER_ _GL_UNUSED
-
-/* gcc supports the "unused" attribute on possibly unused labels, and
- g++ has since version 4.5. Note to support C++ as well as C,
- _GL_UNUSED_LABEL should be used with a trailing ; */
-#if !defined __cplusplus || __GNUC__ > 4 \
- || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
-# define _GL_UNUSED_LABEL _GL_UNUSED
-#else
-# define _GL_UNUSED_LABEL
-#endif
-
-/* The __pure__ attribute was added in gcc 2.96. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define _GL_ATTRIBUTE_PURE /* empty */
-#endif
-
-/* The __const__ attribute was added in gcc 2.95. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
-# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
-#else
-# define _GL_ATTRIBUTE_CONST /* empty */
-#endif
-])
- dnl Preparation for running test programs:
- dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not
- dnl to /dev/tty, so they can be redirected to log files. Such diagnostics
- dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N.
- LIBC_FATAL_STDERR_=1
- export LIBC_FATAL_STDERR_
-])
-
-# gl_MODULE_INDICATOR_CONDITION
-# expands to a C preprocessor expression that evaluates to 1 or 0, depending
-# whether a gnulib module that has been requested shall be considered present
-# or not.
-m4_define([gl_MODULE_INDICATOR_CONDITION], [1])
-
-# gl_MODULE_INDICATOR_SET_VARIABLE([modulename])
-# sets the shell variable that indicates the presence of the given module to
-# a C preprocessor expression that will evaluate to 1.
-AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE],
-[
- gl_MODULE_INDICATOR_SET_VARIABLE_AUX(
- [GNULIB_[]m4_translit([[$1]],
- [abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])],
- [gl_MODULE_INDICATOR_CONDITION])
-])
-
-# gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable])
-# modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION.
-# The shell variable's value is a C preprocessor expression that evaluates
-# to 0 or 1.
-AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX],
-[
- m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1],
- [
- dnl Simplify the expression VALUE || 1 to 1.
- $1=1
- ],
- [gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1],
- [gl_MODULE_INDICATOR_CONDITION])])
-])
-
-# gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition])
-# modifies the shell variable to include the given condition. The shell
-# variable's value is a C preprocessor expression that evaluates to 0 or 1.
-AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR],
-[
- dnl Simplify the expression 1 || CONDITION to 1.
- if test "$[]$1" != 1; then
- dnl Simplify the expression 0 || CONDITION to CONDITION.
- if test "$[]$1" = 0; then
- $1=$2
- else
- $1="($[]$1 || $2)"
- fi
- fi
-])
-
-# gl_MODULE_INDICATOR([modulename])
-# defines a C macro indicating the presence of the given module
-# in a location where it can be used.
-# | Value | Value |
-# | in lib/ | in tests/ |
-# --------------------------------------------+---------+-----------+
-# Module present among main modules: | 1 | 1 |
-# --------------------------------------------+---------+-----------+
-# Module present among tests-related modules: | 0 | 1 |
-# --------------------------------------------+---------+-----------+
-# Module not present at all: | 0 | 0 |
-# --------------------------------------------+---------+-----------+
-AC_DEFUN([gl_MODULE_INDICATOR],
-[
- AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]],
- [abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]),
- [gl_MODULE_INDICATOR_CONDITION],
- [Define to a C preprocessor expression that evaluates to 1 or 0,
- depending whether the gnulib module $1 shall be considered present.])
-])
-
-# gl_MODULE_INDICATOR_FOR_TESTS([modulename])
-# defines a C macro indicating the presence of the given module
-# in lib or tests. This is useful to determine whether the module
-# should be tested.
-# | Value | Value |
-# | in lib/ | in tests/ |
-# --------------------------------------------+---------+-----------+
-# Module present among main modules: | 1 | 1 |
-# --------------------------------------------+---------+-----------+
-# Module present among tests-related modules: | 1 | 1 |
-# --------------------------------------------+---------+-----------+
-# Module not present at all: | 0 | 0 |
-# --------------------------------------------+---------+-----------+
-AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS],
-[
- AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]],
- [abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
- [Define to 1 when the gnulib module $1 should be tested.])
-])
-
-# gl_ASSERT_NO_GNULIB_POSIXCHECK
-# asserts that there will never be a need to #define GNULIB_POSIXCHECK.
-# and thereby enables an optimization of configure and config.h.
-# Used by Emacs.
-AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK],
-[
- dnl Override gl_WARN_ON_USE_PREPARE.
- dnl But hide this definition from 'aclocal'.
- AC_DEFUN([gl_W][ARN_ON_USE_PREPARE], [])
-])
-
-# gl_ASSERT_NO_GNULIB_TESTS
-# asserts that there will be no gnulib tests in the scope of the configure.ac
-# and thereby enables an optimization of config.h.
-# Used by Emacs.
-AC_DEFUN([gl_ASSERT_NO_GNULIB_TESTS],
-[
- dnl Override gl_MODULE_INDICATOR_FOR_TESTS.
- AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], [])
-])
-
-# Test whether <features.h> exists.
-# Set HAVE_FEATURES_H.
-AC_DEFUN([gl_FEATURES_H],
-[
- AC_CHECK_HEADERS_ONCE([features.h])
- if test $ac_cv_header_features_h = yes; then
- HAVE_FEATURES_H=1
- else
- HAVE_FEATURES_H=0
- fi
- AC_SUBST([HAVE_FEATURES_H])
-])
-
-# m4_foreach_w
-# is a backport of autoconf-2.59c's m4_foreach_w.
-# Remove this macro when we can assume autoconf >= 2.60.
-m4_ifndef([m4_foreach_w],
- [m4_define([m4_foreach_w],
- [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
-
-# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
-# ----------------------------------------------------
-# Backport of autoconf-2.63b's macro.
-# Remove this macro when we can assume autoconf >= 2.64.
-m4_ifndef([AS_VAR_IF],
-[m4_define([AS_VAR_IF],
-[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
-
-# gl_PROG_CC_C99
-# Modifies the value of the shell variable CC in an attempt to make $CC
-# understand ISO C99 source code.
-# This is like AC_PROG_CC_C99, except that
-# - AC_PROG_CC_C99 did not exist in Autoconf versions < 2.60,
-# - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC
-# <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00367.html>,
-# but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99
-# <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00441.html>.
-# Remaining problems:
-# - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options
-# to CC twice
-# <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00431.html>.
-# - AC_PROG_CC_STDC is likely to change now that C11 is an ISO standard.
-AC_DEFUN([gl_PROG_CC_C99],
-[
- dnl Change that version number to the minimum Autoconf version that supports
- dnl mixing AC_PROG_CC_C99 calls with AC_PROG_CC_STDC calls.
- m4_version_prereq([9.0],
- [AC_REQUIRE([AC_PROG_CC_C99])],
- [AC_REQUIRE([AC_PROG_CC_STDC])])
-])
-
-# gl_PROG_AR_RANLIB
-# Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler.
-# The user can set the variables AR, ARFLAGS, RANLIB if he wants to override
-# the values.
-AC_DEFUN([gl_PROG_AR_RANLIB],
-[
- dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler
- dnl as "cc", and GCC as "gcc". They have different object file formats and
- dnl library formats. In particular, the GNU binutils programs ar and ranlib
- dnl produce libraries that work only with gcc, not with cc.
- AC_REQUIRE([AC_PROG_CC])
- AC_BEFORE([$0], [AM_PROG_AR])
- AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler],
- [
- AC_EGREP_CPP([Amsterdam],
- [
-#ifdef __ACK__
-Amsterdam
-#endif
- ],
- [gl_cv_c_amsterdam_compiler=yes],
- [gl_cv_c_amsterdam_compiler=no])
- ])
-
- dnl Don't compete with AM_PROG_AR's decision about AR/ARFLAGS if we are not
- dnl building with __ACK__.
- if test $gl_cv_c_amsterdam_compiler = yes; then
- if test -z "$AR"; then
- AR='cc -c.a'
- fi
- if test -z "$ARFLAGS"; then
- ARFLAGS='-o'
- fi
- else
- dnl AM_PROG_AR was added in automake v1.11.2. AM_PROG_AR does not AC_SUBST
- dnl ARFLAGS variable (it is filed into Makefile.in directly by automake
- dnl script on-demand, if not specified by ./configure of course).
- dnl Don't AC_REQUIRE the AM_PROG_AR otherwise the code for __ACK__ above
- dnl will be ignored. Also, pay attention to call AM_PROG_AR in else block
- dnl because AM_PROG_AR is written so it could re-set AR variable even for
- dnl __ACK__. It may seem like its easier to avoid calling the macro here,
- dnl but we need to AC_SUBST both AR/ARFLAGS (thus those must have some good
- dnl default value and automake should usually know them).
- m4_ifdef([AM_PROG_AR], [AM_PROG_AR], [:])
- fi
-
- dnl In case the code above has not helped with setting AR/ARFLAGS, use
- dnl Automake-documented default values for AR and ARFLAGS, but prefer
- dnl ${host}-ar over ar (useful for cross-compiling).
- AC_CHECK_TOOL([AR], [ar], [ar])
- if test -z "$ARFLAGS"; then
- ARFLAGS='cr'
- fi
-
- AC_SUBST([AR])
- AC_SUBST([ARFLAGS])
- if test -z "$RANLIB"; then
- if test $gl_cv_c_amsterdam_compiler = yes; then
- RANLIB=':'
- else
- dnl Use the ranlib program if it is available.
- AC_PROG_RANLIB
- fi
- fi
- AC_SUBST([RANLIB])
-])
-
-# AC_PROG_MKDIR_P
-# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix
-# for interoperability with automake-1.9.6 from autoconf-2.62.
-# Remove this macro when we can assume autoconf >= 2.62 or
-# autoconf >= 2.60 && automake >= 1.10.
-# AC_AUTOCONF_VERSION was introduced in 2.62, so use that as the witness.
-m4_ifndef([AC_AUTOCONF_VERSION],[
-m4_ifdef([AC_PROG_MKDIR_P], [
- dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed.
- m4_define([AC_PROG_MKDIR_P],
- m4_defn([AC_PROG_MKDIR_P])[
- AC_SUBST([MKDIR_P])])], [
- dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P.
- AC_DEFUN_ONCE([AC_PROG_MKDIR_P],
- [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
- MKDIR_P='$(mkdir_p)'
- AC_SUBST([MKDIR_P])])])
-])
-
-# AC_C_RESTRICT
-# This definition is copied from post-2.69 Autoconf and overrides the
-# AC_C_RESTRICT macro from autoconf 2.60..2.69. It can be removed
-# once autoconf >= 2.70 can be assumed. It's painful to check version
-# numbers, and in practice this macro is more up-to-date than Autoconf
-# is, so override Autoconf unconditionally.
-AC_DEFUN([AC_C_RESTRICT],
-[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
- [ac_cv_c_restrict=no
- # The order here caters to the fact that C++ does not require restrict.
- for ac_kw in __restrict __restrict__ _Restrict restrict; do
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[typedef int *int_ptr;
- int foo (int_ptr $ac_kw ip) { return ip[0]; }
- int bar (int [$ac_kw]); /* Catch GCC bug 14050. */
- int bar (int ip[$ac_kw]) { return ip[0]; }
- ]],
- [[int s[1];
- int *$ac_kw t = s;
- t[0] = 0;
- return foo (t) + bar (t);
- ]])],
- [ac_cv_c_restrict=$ac_kw])
- test "$ac_cv_c_restrict" != no && break
- done
- ])
- AH_VERBATIM([restrict],
-[/* Define to the equivalent of the C99 'restrict' keyword, or to
- nothing if this is not supported. Do not define if restrict is
- supported directly. */
-#undef restrict
-/* Work around a bug in Sun C++: it does not support _Restrict or
- __restrict__, even though the corresponding Sun C compiler ends up with
- "#define restrict _Restrict" or "#define restrict __restrict__" in the
- previous line. Perhaps some future version of Sun C++ will work with
- restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
-#if defined __SUNPRO_CC && !defined __RESTRICT
-# define _Restrict
-# define __restrict__
-#endif])
- case $ac_cv_c_restrict in
- restrict) ;;
- no) AC_DEFINE([restrict], []) ;;
- *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
- esac
-])# AC_C_RESTRICT
-
-# gl_BIGENDIAN
-# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd.
-# Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some
-# macros invoke AC_C_BIGENDIAN with arguments.
-AC_DEFUN([gl_BIGENDIAN],
-[
- AC_C_BIGENDIAN
-])
-
-# gl_CACHE_VAL_SILENT(cache-id, command-to-set-it)
-# is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not
-# output a spurious "(cached)" mark in the midst of other configure output.
-# This macro should be used instead of AC_CACHE_VAL when it is not surrounded
-# by an AC_MSG_CHECKING/AC_MSG_RESULT pair.
-AC_DEFUN([gl_CACHE_VAL_SILENT],
-[
- saved_as_echo_n="$as_echo_n"
- as_echo_n=':'
- AC_CACHE_VAL([$1], [$2])
- as_echo_n="$saved_as_echo_n"
-])
-
-# AS_VAR_COPY was added in autoconf 2.63b
-m4_define_default([AS_VAR_COPY],
-[AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
-
-# AC_PROG_SED was added in autoconf 2.59b
-m4_ifndef([AC_PROG_SED],
-[AC_DEFUN([AC_PROG_SED],
-[AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED,
- [dnl ac_script should not contain more than 99 commands (for HP-UX sed),
- dnl but more than about 7000 bytes, to catch a limit in Solaris 8 /usr/ucb/sed.
- ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
- for ac_i in 1 2 3 4 5 6 7; do
- ac_script="$ac_script$as_nl$ac_script"
- done
- echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
- AS_UNSET([ac_script])
- if test -z "$SED"; then
- ac_path_SED_found=false
- _AS_PATH_WALK([], [
- for ac_prog in sed gsed; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
- AS_EXECUTABLE_P(["$ac_path_SED"]) || continue
- case `"$ac_path_SED" --version 2>&1` in
- *GNU*) ac_cv_path_SED=$ac_path_SED ac_path_SED_found=:;;
- *)
- ac_count=0
- _AS_ECHO_N([0123456789]) >conftest.in
- while :
- do
- cat conftest.in conftest.in >conftest.tmp
- mv conftest.tmp conftest.in
- cp conftest.in conftest.nl
- echo >> conftest.nl
- "$ac_path_SED" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
- diff conftest.out conftest.nl >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_SED_max-0}; then
- # Best so far, but keep looking for better
- ac_cv_path_SED=$ac_path_SED
- ac_path_SED_max=$ac_count
- fi
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
- esac
- $ac_path_SED_found && break 3
- done
- done])
- if test -z "$ac_cv_path_SED"; then
- AC_ERROR([no acceptable sed could be found in \$PATH])
- fi
- else
- ac_cv_path_SED=$SED
- fi
- SED="$ac_cv_path_SED"
- AC_SUBST([SED])dnl
- rm -f conftest.sed
-])])])
diff --git a/src/gl/m4/gnulib-comp.m4 b/src/gl/m4/gnulib-comp.m4
deleted file mode 100644
index aad9f74f34..0000000000
--- a/src/gl/m4/gnulib-comp.m4
+++ /dev/null
@@ -1,878 +0,0 @@
-# DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2016 Free Software Foundation, Inc.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This file is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this file. If not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License,
-# this file may be distributed as part of a program that
-# contains a configuration script generated by Autoconf, under
-# the same distribution terms as the rest of that program.
-#
-# Generated by gnulib-tool.
-#
-# This file represents the compiled summary of the specification in
-# gnulib-cache.m4. It lists the computed macro invocations that need
-# to be invoked from configure.ac.
-# In projects that use version control, this file can be treated like
-# other built files.
-
-
-# This macro should be invoked from ./configure.ac, in the section
-# "Checks for programs", right after AC_PROG_CC, and certainly before
-# any checks for libraries, header files, types and library functions.
-AC_DEFUN([ggl_EARLY],
-[
- m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
- m4_pattern_allow([^gl_ES$])dnl a valid locale name
- m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
- m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
-
- # Pre-early section.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_PROG_AR_RANLIB])
-
- # Code from module absolute-header:
- # Code from module accept:
- # Code from module alloca:
- # Code from module alloca-opt:
- # Code from module arpa_inet:
- # Code from module bind:
- # Code from module c-ctype:
- # Code from module clock-time:
- # Code from module close:
- # Code from module connect:
- # Code from module dirname-lgpl:
- # Code from module dosname:
- # Code from module double-slash-root:
- # Code from module dup2:
- # Code from module environ:
- # Code from module errno:
- # Code from module error:
- # Code from module exitfail:
- # Code from module extensions:
- # Code from module extern-inline:
- # Code from module fd-hook:
- # Code from module flexmember:
- # Code from module float:
- # Code from module fseek:
- # Code from module fseeko:
- AC_REQUIRE([AC_FUNC_FSEEKO])
- # Code from module fstat:
- # Code from module ftell:
- # Code from module ftello:
- AC_REQUIRE([AC_FUNC_FSEEKO])
- # Code from module getaddrinfo:
- # Code from module getdelim:
- # Code from module getline:
- # Code from module getpass:
- # Code from module getpeername:
- # Code from module getprogname:
- # Code from module gettext-h:
- # Code from module gettime:
- # Code from module gettimeofday:
- # Code from module hostent:
- # Code from module include_next:
- # Code from module inet_ntop:
- # Code from module inet_pton:
- # Code from module intprops:
- # Code from module largefile:
- AC_REQUIRE([AC_SYS_LARGEFILE])
- # Code from module limits-h:
- # Code from module listen:
- # Code from module lseek:
- # Code from module malloc-posix:
- # Code from module malloca:
- # Code from module memchr:
- # Code from module minmax:
- # Code from module mktime:
- # Code from module mktime-internal:
- # Code from module msvc-inval:
- # Code from module msvc-nothrow:
- # Code from module multiarch:
- # Code from module netdb:
- # Code from module netinet_in:
- # Code from module parse-datetime:
- # Code from module progname:
- # Code from module read-file:
- # Code from module realloc-posix:
- # Code from module recv:
- # Code from module recvfrom:
- # Code from module select:
- # Code from module send:
- # Code from module sendto:
- # Code from module servent:
- # Code from module setenv:
- # Code from module setsockopt:
- # Code from module shutdown:
- # Code from module signal-h:
- # Code from module size_max:
- # Code from module snippet/_Noreturn:
- # Code from module snippet/arg-nonnull:
- # Code from module snippet/c++defs:
- # Code from module snippet/warn-on-use:
- # Code from module snprintf:
- # Code from module socket:
- # Code from module socketlib:
- # Code from module sockets:
- # Code from module socklen:
- # Code from module ssize_t:
- # Code from module stdalign:
- # Code from module stdbool:
- # Code from module stddef:
- # Code from module stdint:
- # Code from module stdio:
- # Code from module stdlib:
- # Code from module strdup-posix:
- # Code from module strerror:
- # Code from module strerror-override:
- # Code from module strftime:
- # Code from module string:
- # Code from module sys_select:
- # Code from module sys_socket:
- # Code from module sys_stat:
- # Code from module sys_time:
- # Code from module sys_types:
- # Code from module sys_uio:
- # Code from module time:
- # Code from module time_r:
- # Code from module time_rz:
- # Code from module timegm:
- # Code from module timespec:
- # Code from module unistd:
- # Code from module unsetenv:
- # Code from module vasnprintf:
- # Code from module verify:
- # Code from module wchar:
- # Code from module xalloc:
- # Code from module xalloc-die:
- # Code from module xalloc-oversized:
- # Code from module xsize:
-])
-
-# This macro should be invoked from ./configure.ac, in the section
-# "Check for header files, types and library functions".
-AC_DEFUN([ggl_INIT],
-[
- AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
- gl_cond_libtool=true
- gl_m4_base='src/gl/m4'
- m4_pushdef([AC_LIBOBJ], m4_defn([ggl_LIBOBJ]))
- m4_pushdef([AC_REPLACE_FUNCS], m4_defn([ggl_REPLACE_FUNCS]))
- m4_pushdef([AC_LIBSOURCES], m4_defn([ggl_LIBSOURCES]))
- m4_pushdef([ggl_LIBSOURCES_LIST], [])
- m4_pushdef([ggl_LIBSOURCES_DIR], [])
- gl_COMMON
- gl_source_base='src/gl'
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([accept])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([accept])
-changequote(,)dnl
-LTALLOCA=`echo "$ALLOCA" | sed -e 's/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'`
-changequote([, ])dnl
-AC_SUBST([LTALLOCA])
- gl_FUNC_ALLOCA
- gl_HEADER_ARPA_INET
- AC_PROG_MKDIR_P
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([bind])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([bind])
- gl_CLOCK_TIME
- gl_FUNC_CLOSE
- if test $REPLACE_CLOSE = 1; then
- AC_LIBOBJ([close])
- fi
- gl_UNISTD_MODULE_INDICATOR([close])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([connect])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([connect])
- gl_DIRNAME_LGPL
- gl_DOUBLE_SLASH_ROOT
- gl_FUNC_DUP2
- if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
- AC_LIBOBJ([dup2])
- gl_PREREQ_DUP2
- fi
- gl_UNISTD_MODULE_INDICATOR([dup2])
- gl_ENVIRON
- gl_UNISTD_MODULE_INDICATOR([environ])
- gl_HEADER_ERRNO_H
- gl_ERROR
- if test $ac_cv_lib_error_at_line = no; then
- AC_LIBOBJ([error])
- gl_PREREQ_ERROR
- fi
- m4_ifdef([AM_XGETTEXT_OPTION],
- [AM_][XGETTEXT_OPTION([--flag=error:3:c-format])
- AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])])
- AC_REQUIRE([gl_EXTERN_INLINE])
- AC_C_FLEXIBLE_ARRAY_MEMBER
- gl_FLOAT_H
- if test $REPLACE_FLOAT_LDBL = 1; then
- AC_LIBOBJ([float])
- fi
- if test $REPLACE_ITOLD = 1; then
- AC_LIBOBJ([itold])
- fi
- gl_FUNC_FSEEK
- if test $REPLACE_FSEEK = 1; then
- AC_LIBOBJ([fseek])
- fi
- gl_STDIO_MODULE_INDICATOR([fseek])
- gl_FUNC_FSEEKO
- if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
- AC_LIBOBJ([fseeko])
- gl_PREREQ_FSEEKO
- fi
- gl_STDIO_MODULE_INDICATOR([fseeko])
- gl_FUNC_FSTAT
- if test $REPLACE_FSTAT = 1; then
- AC_LIBOBJ([fstat])
- gl_PREREQ_FSTAT
- fi
- gl_SYS_STAT_MODULE_INDICATOR([fstat])
- gl_FUNC_FTELL
- if test $REPLACE_FTELL = 1; then
- AC_LIBOBJ([ftell])
- fi
- gl_STDIO_MODULE_INDICATOR([ftell])
- gl_FUNC_FTELLO
- if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
- AC_LIBOBJ([ftello])
- gl_PREREQ_FTELLO
- fi
- gl_STDIO_MODULE_INDICATOR([ftello])
- gl_GETADDRINFO
- if test $HAVE_GETADDRINFO = 0; then
- AC_LIBOBJ([getaddrinfo])
- fi
- if test $HAVE_DECL_GAI_STRERROR = 0 || test $REPLACE_GAI_STRERROR = 1; then
- AC_LIBOBJ([gai_strerror])
- fi
- gl_NETDB_MODULE_INDICATOR([getaddrinfo])
- gl_FUNC_GETDELIM
- if test $HAVE_GETDELIM = 0 || test $REPLACE_GETDELIM = 1; then
- AC_LIBOBJ([getdelim])
- gl_PREREQ_GETDELIM
- fi
- gl_STDIO_MODULE_INDICATOR([getdelim])
- gl_FUNC_GETLINE
- if test $REPLACE_GETLINE = 1; then
- AC_LIBOBJ([getline])
- gl_PREREQ_GETLINE
- fi
- gl_STDIO_MODULE_INDICATOR([getline])
- gl_FUNC_GETPASS
- if test $HAVE_GETPASS = 0; then
- AC_LIBOBJ([getpass])
- gl_PREREQ_GETPASS
- fi
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([getpeername])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([getpeername])
- gl_FUNC_GETPROGNAME
- AC_SUBST([LIBINTL])
- AC_SUBST([LTLIBINTL])
- gl_GETTIME
- gl_FUNC_GETTIMEOFDAY
- if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then
- AC_LIBOBJ([gettimeofday])
- gl_PREREQ_GETTIMEOFDAY
- fi
- gl_SYS_TIME_MODULE_INDICATOR([gettimeofday])
- gl_HOSTENT
- gl_FUNC_INET_NTOP
- if test $HAVE_INET_NTOP = 0 || test $REPLACE_INET_NTOP = 1; then
- AC_LIBOBJ([inet_ntop])
- gl_PREREQ_INET_NTOP
- fi
- gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
- gl_FUNC_INET_PTON
- if test $HAVE_INET_PTON = 0 || test $REPLACE_INET_NTOP = 1; then
- AC_LIBOBJ([inet_pton])
- gl_PREREQ_INET_PTON
- fi
- gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
- AC_REQUIRE([gl_LARGEFILE])
- gl_LIMITS_H
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([listen])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([listen])
- gl_FUNC_LSEEK
- if test $REPLACE_LSEEK = 1; then
- AC_LIBOBJ([lseek])
- fi
- gl_UNISTD_MODULE_INDICATOR([lseek])
- gl_FUNC_MALLOC_POSIX
- if test $REPLACE_MALLOC = 1; then
- AC_LIBOBJ([malloc])
- fi
- gl_STDLIB_MODULE_INDICATOR([malloc-posix])
- gl_MALLOCA
- gl_FUNC_MEMCHR
- if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
- AC_LIBOBJ([memchr])
- gl_PREREQ_MEMCHR
- fi
- gl_STRING_MODULE_INDICATOR([memchr])
- gl_MINMAX
- gl_FUNC_MKTIME
- if test $REPLACE_MKTIME = 1; then
- AC_LIBOBJ([mktime])
- gl_PREREQ_MKTIME
- fi
- gl_TIME_MODULE_INDICATOR([mktime])
- gl_FUNC_MKTIME_INTERNAL
- if test $REPLACE_MKTIME = 1; then
- AC_LIBOBJ([mktime])
- gl_PREREQ_MKTIME
- fi
- AC_REQUIRE([gl_MSVC_INVAL])
- if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
- AC_LIBOBJ([msvc-inval])
- fi
- AC_REQUIRE([gl_MSVC_NOTHROW])
- if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
- AC_LIBOBJ([msvc-nothrow])
- fi
- gl_MULTIARCH
- gl_HEADER_NETDB
- gl_HEADER_NETINET_IN
- AC_PROG_MKDIR_P
- gl_PARSE_DATETIME
- AC_CHECK_DECLS([program_invocation_name], [], [], [#include <errno.h>])
- AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
- gl_PREREQ_READ_FILE
- gl_FUNC_REALLOC_POSIX
- if test $REPLACE_REALLOC = 1; then
- AC_LIBOBJ([realloc])
- fi
- gl_STDLIB_MODULE_INDICATOR([realloc-posix])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([recv])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([recv])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([recvfrom])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([recvfrom])
- gl_FUNC_SELECT
- if test $REPLACE_SELECT = 1; then
- AC_LIBOBJ([select])
- fi
- gl_SYS_SELECT_MODULE_INDICATOR([select])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([send])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([send])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([sendto])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([sendto])
- gl_SERVENT
- gl_FUNC_SETENV
- if test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1; then
- AC_LIBOBJ([setenv])
- fi
- gl_STDLIB_MODULE_INDICATOR([setenv])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([setsockopt])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([shutdown])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([shutdown])
- gl_SIGNAL_H
- gl_SIZE_MAX
- gl_FUNC_SNPRINTF
- gl_STDIO_MODULE_INDICATOR([snprintf])
- gl_MODULE_INDICATOR([snprintf])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([socket])
- fi
- # When this module is used, sockets may actually occur as file descriptors,
- # hence it is worth warning if the modules 'close' and 'ioctl' are not used.
- m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
- m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])])
- AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2])
- if test "$ac_cv_header_winsock2_h" = yes; then
- UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
- SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([socket])
- AC_REQUIRE([gl_SOCKETLIB])
- AC_REQUIRE([gl_SOCKETS])
- gl_TYPE_SOCKLEN_T
- gt_TYPE_SSIZE_T
- gl_STDALIGN_H
- AM_STDBOOL_H
- gl_STDDEF_H
- gl_STDINT_H
- gl_STDIO_H
- gl_STDLIB_H
- gl_FUNC_STRDUP_POSIX
- if test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1; then
- AC_LIBOBJ([strdup])
- gl_PREREQ_STRDUP
- fi
- gl_STRING_MODULE_INDICATOR([strdup])
- gl_FUNC_STRERROR
- if test $REPLACE_STRERROR = 1; then
- AC_LIBOBJ([strerror])
- fi
- gl_MODULE_INDICATOR([strerror])
- gl_STRING_MODULE_INDICATOR([strerror])
- AC_REQUIRE([gl_HEADER_ERRNO_H])
- AC_REQUIRE([gl_FUNC_STRERROR_0])
- if test -n "$ERRNO_H" || test $REPLACE_STRERROR_0 = 1; then
- AC_LIBOBJ([strerror-override])
- gl_PREREQ_SYS_H_WINSOCK2
- fi
- gl_FUNC_GNU_STRFTIME
- gl_HEADER_STRING_H
- gl_HEADER_SYS_SELECT
- AC_PROG_MKDIR_P
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- AC_PROG_MKDIR_P
- gl_HEADER_SYS_STAT_H
- AC_PROG_MKDIR_P
- gl_HEADER_SYS_TIME_H
- AC_PROG_MKDIR_P
- gl_SYS_TYPES_H
- AC_PROG_MKDIR_P
- gl_HEADER_SYS_UIO
- AC_PROG_MKDIR_P
- gl_HEADER_TIME_H
- gl_TIME_R
- if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
- AC_LIBOBJ([time_r])
- gl_PREREQ_TIME_R
- fi
- gl_TIME_MODULE_INDICATOR([time_r])
- gl_TIME_RZ
- if test "$HAVE_TIMEZONE_T" = 0; then
- AC_LIBOBJ([time_rz])
- fi
- gl_TIME_MODULE_INDICATOR([time_rz])
- gl_FUNC_TIMEGM
- if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1; then
- AC_LIBOBJ([timegm])
- gl_PREREQ_TIMEGM
- fi
- gl_TIME_MODULE_INDICATOR([timegm])
- gl_TIMESPEC
- gl_UNISTD_H
- gl_FUNC_UNSETENV
- if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then
- AC_LIBOBJ([unsetenv])
- gl_PREREQ_UNSETENV
- fi
- gl_STDLIB_MODULE_INDICATOR([unsetenv])
- gl_FUNC_VASNPRINTF
- gl_WCHAR_H
- gl_XALLOC
- gl_XSIZE
- # End of code from modules
- m4_ifval(ggl_LIBSOURCES_LIST, [
- m4_syscmd([test ! -d ]m4_defn([ggl_LIBSOURCES_DIR])[ ||
- for gl_file in ]ggl_LIBSOURCES_LIST[ ; do
- if test ! -r ]m4_defn([ggl_LIBSOURCES_DIR])[/$gl_file ; then
- echo "missing file ]m4_defn([ggl_LIBSOURCES_DIR])[/$gl_file" >&2
- exit 1
- fi
- done])dnl
- m4_if(m4_sysval, [0], [],
- [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
- ])
- m4_popdef([ggl_LIBSOURCES_DIR])
- m4_popdef([ggl_LIBSOURCES_LIST])
- m4_popdef([AC_LIBSOURCES])
- m4_popdef([AC_REPLACE_FUNCS])
- m4_popdef([AC_LIBOBJ])
- AC_CONFIG_COMMANDS_PRE([
- ggl_libobjs=
- ggl_ltlibobjs=
- if test -n "$ggl_LIBOBJS"; then
- # Remove the extension.
- sed_drop_objext='s/\.o$//;s/\.obj$//'
- for i in `for i in $ggl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
- ggl_libobjs="$ggl_libobjs $i.$ac_objext"
- ggl_ltlibobjs="$ggl_ltlibobjs $i.lo"
- done
- fi
- AC_SUBST([ggl_LIBOBJS], [$ggl_libobjs])
- AC_SUBST([ggl_LTLIBOBJS], [$ggl_ltlibobjs])
- ])
- gltests_libdeps=
- gltests_ltlibdeps=
- m4_pushdef([AC_LIBOBJ], m4_defn([ggltests_LIBOBJ]))
- m4_pushdef([AC_REPLACE_FUNCS], m4_defn([ggltests_REPLACE_FUNCS]))
- m4_pushdef([AC_LIBSOURCES], m4_defn([ggltests_LIBSOURCES]))
- m4_pushdef([ggltests_LIBSOURCES_LIST], [])
- m4_pushdef([ggltests_LIBSOURCES_DIR], [])
- gl_COMMON
- gl_source_base='tests'
-changequote(,)dnl
- ggltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS
-changequote([, ])dnl
- AC_SUBST([ggltests_WITNESS])
- gl_module_indicator_condition=$ggltests_WITNESS
- m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition])
- m4_popdef([gl_MODULE_INDICATOR_CONDITION])
- m4_ifval(ggltests_LIBSOURCES_LIST, [
- m4_syscmd([test ! -d ]m4_defn([ggltests_LIBSOURCES_DIR])[ ||
- for gl_file in ]ggltests_LIBSOURCES_LIST[ ; do
- if test ! -r ]m4_defn([ggltests_LIBSOURCES_DIR])[/$gl_file ; then
- echo "missing file ]m4_defn([ggltests_LIBSOURCES_DIR])[/$gl_file" >&2
- exit 1
- fi
- done])dnl
- m4_if(m4_sysval, [0], [],
- [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
- ])
- m4_popdef([ggltests_LIBSOURCES_DIR])
- m4_popdef([ggltests_LIBSOURCES_LIST])
- m4_popdef([AC_LIBSOURCES])
- m4_popdef([AC_REPLACE_FUNCS])
- m4_popdef([AC_LIBOBJ])
- AC_CONFIG_COMMANDS_PRE([
- ggltests_libobjs=
- ggltests_ltlibobjs=
- if test -n "$ggltests_LIBOBJS"; then
- # Remove the extension.
- sed_drop_objext='s/\.o$//;s/\.obj$//'
- for i in `for i in $ggltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
- ggltests_libobjs="$ggltests_libobjs $i.$ac_objext"
- ggltests_ltlibobjs="$ggltests_ltlibobjs $i.lo"
- done
- fi
- AC_SUBST([ggltests_LIBOBJS], [$ggltests_libobjs])
- AC_SUBST([ggltests_LTLIBOBJS], [$ggltests_ltlibobjs])
- ])
-])
-
-# Like AC_LIBOBJ, except that the module name goes
-# into ggl_LIBOBJS instead of into LIBOBJS.
-AC_DEFUN([ggl_LIBOBJ], [
- AS_LITERAL_IF([$1], [ggl_LIBSOURCES([$1.c])])dnl
- ggl_LIBOBJS="$ggl_LIBOBJS $1.$ac_objext"
-])
-
-# Like AC_REPLACE_FUNCS, except that the module name goes
-# into ggl_LIBOBJS instead of into LIBOBJS.
-AC_DEFUN([ggl_REPLACE_FUNCS], [
- m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
- AC_CHECK_FUNCS([$1], , [ggl_LIBOBJ($ac_func)])
-])
-
-# Like AC_LIBSOURCES, except the directory where the source file is
-# expected is derived from the gnulib-tool parameterization,
-# and alloca is special cased (for the alloca-opt module).
-# We could also entirely rely on EXTRA_lib..._SOURCES.
-AC_DEFUN([ggl_LIBSOURCES], [
- m4_foreach([_gl_NAME], [$1], [
- m4_if(_gl_NAME, [alloca.c], [], [
- m4_define([ggl_LIBSOURCES_DIR], [src/gl])
- m4_append([ggl_LIBSOURCES_LIST], _gl_NAME, [ ])
- ])
- ])
-])
-
-# Like AC_LIBOBJ, except that the module name goes
-# into ggltests_LIBOBJS instead of into LIBOBJS.
-AC_DEFUN([ggltests_LIBOBJ], [
- AS_LITERAL_IF([$1], [ggltests_LIBSOURCES([$1.c])])dnl
- ggltests_LIBOBJS="$ggltests_LIBOBJS $1.$ac_objext"
-])
-
-# Like AC_REPLACE_FUNCS, except that the module name goes
-# into ggltests_LIBOBJS instead of into LIBOBJS.
-AC_DEFUN([ggltests_REPLACE_FUNCS], [
- m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
- AC_CHECK_FUNCS([$1], , [ggltests_LIBOBJ($ac_func)])
-])
-
-# Like AC_LIBSOURCES, except the directory where the source file is
-# expected is derived from the gnulib-tool parameterization,
-# and alloca is special cased (for the alloca-opt module).
-# We could also entirely rely on EXTRA_lib..._SOURCES.
-AC_DEFUN([ggltests_LIBSOURCES], [
- m4_foreach([_gl_NAME], [$1], [
- m4_if(_gl_NAME, [alloca.c], [], [
- m4_define([ggltests_LIBSOURCES_DIR], [tests])
- m4_append([ggltests_LIBSOURCES_LIST], _gl_NAME, [ ])
- ])
- ])
-])
-
-# This macro records the list of files which have been installed by
-# gnulib-tool and may be removed by future gnulib-tool invocations.
-AC_DEFUN([ggl_FILE_LIST], [
- build-aux/snippet/_Noreturn.h
- build-aux/snippet/arg-nonnull.h
- build-aux/snippet/c++defs.h
- build-aux/snippet/warn-on-use.h
- doc/parse-datetime.texi
- lib/accept.c
- lib/alloca.c
- lib/alloca.in.h
- lib/arpa_inet.in.h
- lib/asnprintf.c
- lib/basename-lgpl.c
- lib/bind.c
- lib/c-ctype.c
- lib/c-ctype.h
- lib/close.c
- lib/connect.c
- lib/dirname-lgpl.c
- lib/dirname.h
- lib/dosname.h
- lib/dup2.c
- lib/errno.in.h
- lib/error.c
- lib/error.h
- lib/exitfail.c
- lib/exitfail.h
- lib/fd-hook.c
- lib/fd-hook.h
- lib/flexmember.h
- lib/float+.h
- lib/float.c
- lib/float.in.h
- lib/fseek.c
- lib/fseeko.c
- lib/fstat.c
- lib/ftell.c
- lib/ftello.c
- lib/gai_strerror.c
- lib/getaddrinfo.c
- lib/getdelim.c
- lib/getline.c
- lib/getpass.c
- lib/getpass.h
- lib/getpeername.c
- lib/getprogname.c
- lib/getprogname.h
- lib/gettext.h
- lib/gettime.c
- lib/gettimeofday.c
- lib/inet_ntop.c
- lib/inet_pton.c
- lib/intprops.h
- lib/itold.c
- lib/limits.in.h
- lib/listen.c
- lib/lseek.c
- lib/malloc.c
- lib/malloca.c
- lib/malloca.h
- lib/malloca.valgrind
- lib/memchr.c
- lib/memchr.valgrind
- lib/minmax.h
- lib/mktime-internal.h
- lib/mktime.c
- lib/msvc-inval.c
- lib/msvc-inval.h
- lib/msvc-nothrow.c
- lib/msvc-nothrow.h
- lib/netdb.in.h
- lib/netinet_in.in.h
- lib/parse-datetime.h
- lib/parse-datetime.y
- lib/printf-args.c
- lib/printf-args.h
- lib/printf-parse.c
- lib/printf-parse.h
- lib/progname.c
- lib/progname.h
- lib/read-file.c
- lib/read-file.h
- lib/realloc.c
- lib/recv.c
- lib/recvfrom.c
- lib/select.c
- lib/send.c
- lib/sendto.c
- lib/setenv.c
- lib/setsockopt.c
- lib/shutdown.c
- lib/signal.in.h
- lib/size_max.h
- lib/snprintf.c
- lib/socket.c
- lib/sockets.c
- lib/sockets.h
- lib/stdalign.in.h
- lib/stdbool.in.h
- lib/stddef.in.h
- lib/stdint.in.h
- lib/stdio-impl.h
- lib/stdio.in.h
- lib/stdlib.in.h
- lib/strdup.c
- lib/strerror-override.c
- lib/strerror-override.h
- lib/strerror.c
- lib/strftime.c
- lib/strftime.h
- lib/string.in.h
- lib/stripslash.c
- lib/sys_select.in.h
- lib/sys_socket.c
- lib/sys_socket.in.h
- lib/sys_stat.in.h
- lib/sys_time.in.h
- lib/sys_types.in.h
- lib/sys_uio.in.h
- lib/time-internal.h
- lib/time.in.h
- lib/time_r.c
- lib/time_rz.c
- lib/timegm.c
- lib/timespec.c
- lib/timespec.h
- lib/unistd.c
- lib/unistd.in.h
- lib/unsetenv.c
- lib/vasnprintf.c
- lib/vasnprintf.h
- lib/verify.h
- lib/w32sock.h
- lib/wchar.in.h
- lib/xalloc-die.c
- lib/xalloc-oversized.h
- lib/xalloc.h
- lib/xmalloc.c
- lib/xsize.c
- lib/xsize.h
- m4/00gnulib.m4
- m4/absolute-header.m4
- m4/alloca.m4
- m4/arpa_inet_h.m4
- m4/bison.m4
- m4/clock_time.m4
- m4/close.m4
- m4/dirname.m4
- m4/double-slash-root.m4
- m4/dup2.m4
- m4/eealloc.m4
- m4/environ.m4
- m4/errno_h.m4
- m4/error.m4
- m4/exponentd.m4
- m4/extensions.m4
- m4/extern-inline.m4
- m4/flexmember.m4
- m4/float_h.m4
- m4/fseek.m4
- m4/fseeko.m4
- m4/fstat.m4
- m4/ftell.m4
- m4/ftello.m4
- m4/getaddrinfo.m4
- m4/getdelim.m4
- m4/getline.m4
- m4/getpass.m4
- m4/getprogname.m4
- m4/gettime.m4
- m4/gettimeofday.m4
- m4/gnulib-common.m4
- m4/hostent.m4
- m4/include_next.m4
- m4/inet_ntop.m4
- m4/inet_pton.m4
- m4/intmax_t.m4
- m4/inttypes_h.m4
- m4/largefile.m4
- m4/limits-h.m4
- m4/longlong.m4
- m4/lseek.m4
- m4/malloc.m4
- m4/malloca.m4
- m4/math_h.m4
- m4/memchr.m4
- m4/minmax.m4
- m4/mktime.m4
- m4/mmap-anon.m4
- m4/msvc-inval.m4
- m4/msvc-nothrow.m4
- m4/multiarch.m4
- m4/netdb_h.m4
- m4/netinet_in_h.m4
- m4/off_t.m4
- m4/parse-datetime.m4
- m4/printf.m4
- m4/read-file.m4
- m4/realloc.m4
- m4/select.m4
- m4/servent.m4
- m4/setenv.m4
- m4/signal_h.m4
- m4/size_max.m4
- m4/snprintf.m4
- m4/socketlib.m4
- m4/sockets.m4
- m4/socklen.m4
- m4/sockpfaf.m4
- m4/ssize_t.m4
- m4/stdalign.m4
- m4/stdbool.m4
- m4/stddef_h.m4
- m4/stdint.m4
- m4/stdint_h.m4
- m4/stdio_h.m4
- m4/stdlib_h.m4
- m4/strdup.m4
- m4/strerror.m4
- m4/strftime.m4
- m4/string_h.m4
- m4/sys_select_h.m4
- m4/sys_socket_h.m4
- m4/sys_stat_h.m4
- m4/sys_time_h.m4
- m4/sys_types_h.m4
- m4/sys_uio_h.m4
- m4/time_h.m4
- m4/time_r.m4
- m4/time_rz.m4
- m4/timegm.m4
- m4/timespec.m4
- m4/tm_gmtoff.m4
- m4/unistd_h.m4
- m4/vasnprintf.m4
- m4/warn-on-use.m4
- m4/wchar_h.m4
- m4/wchar_t.m4
- m4/wint_t.m4
- m4/xalloc.m4
- m4/xsize.m4
-])
diff --git a/src/gl/m4/gnulib-tool.m4 b/src/gl/m4/gnulib-tool.m4
deleted file mode 100644
index 0d2ee444b4..0000000000
--- a/src/gl/m4/gnulib-tool.m4
+++ /dev/null
@@ -1,57 +0,0 @@
-# gnulib-tool.m4 serial 2
-dnl Copyright (C) 2004-2005, 2009-2016 Free Software Foundation, Inc.
-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.
-
-dnl The following macros need not be invoked explicitly.
-dnl Invoking them does nothing except to declare default arguments
-dnl for "gnulib-tool --import".
-
-dnl Usage: gl_LOCAL_DIR([DIR])
-AC_DEFUN([gl_LOCAL_DIR], [])
-
-dnl Usage: gl_MODULES([module1 module2 ...])
-AC_DEFUN([gl_MODULES], [])
-
-dnl Usage: gl_AVOID([module1 module2 ...])
-AC_DEFUN([gl_AVOID], [])
-
-dnl Usage: gl_SOURCE_BASE([DIR])
-AC_DEFUN([gl_SOURCE_BASE], [])
-
-dnl Usage: gl_M4_BASE([DIR])
-AC_DEFUN([gl_M4_BASE], [])
-
-dnl Usage: gl_PO_BASE([DIR])
-AC_DEFUN([gl_PO_BASE], [])
-
-dnl Usage: gl_DOC_BASE([DIR])
-AC_DEFUN([gl_DOC_BASE], [])
-
-dnl Usage: gl_TESTS_BASE([DIR])
-AC_DEFUN([gl_TESTS_BASE], [])
-
-dnl Usage: gl_WITH_TESTS
-AC_DEFUN([gl_WITH_TESTS], [])
-
-dnl Usage: gl_LIB([LIBNAME])
-AC_DEFUN([gl_LIB], [])
-
-dnl Usage: gl_LGPL or gl_LGPL([VERSION])
-AC_DEFUN([gl_LGPL], [])
-
-dnl Usage: gl_MAKEFILE_NAME([FILENAME])
-AC_DEFUN([gl_MAKEFILE_NAME], [])
-
-dnl Usage: gl_LIBTOOL
-AC_DEFUN([gl_LIBTOOL], [])
-
-dnl Usage: gl_MACRO_PREFIX([PREFIX])
-AC_DEFUN([gl_MACRO_PREFIX], [])
-
-dnl Usage: gl_PO_DOMAIN([DOMAIN])
-AC_DEFUN([gl_PO_DOMAIN], [])
-
-dnl Usage: gl_VC_FILES([BOOLEAN])
-AC_DEFUN([gl_VC_FILES], [])
diff --git a/src/gl/m4/hostent.m4 b/src/gl/m4/hostent.m4
deleted file mode 100644
index 1b2488abc0..0000000000
--- a/src/gl/m4/hostent.m4
+++ /dev/null
@@ -1,49 +0,0 @@
-# hostent.m4 serial 2
-dnl Copyright (C) 2008, 2010-2016 Free Software Foundation, Inc.
-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_HOSTENT],
-[
- dnl Where are gethostent(), sethostent(), endhostent(), gethostbyname(),
- dnl gethostbyaddr() defined?
- dnl - On Solaris, they are in libnsl. Ignore libxnet.
- dnl - On Haiku, they are in libnetwork.
- dnl - On BeOS, they are in libnet.
- dnl - On native Windows, they are in ws2_32.dll.
- dnl - Otherwise they are in libc.
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
- HOSTENT_LIB=
- gl_saved_libs="$LIBS"
- AC_SEARCH_LIBS([gethostbyname], [nsl network net],
- [if test "$ac_cv_search_gethostbyname" != "none required"; then
- HOSTENT_LIB="$ac_cv_search_gethostbyname"
- fi])
- LIBS="$gl_saved_libs"
- if test -z "$HOSTENT_LIB"; then
- AC_CHECK_FUNCS([gethostbyname], , [
- AC_CACHE_CHECK([for gethostbyname in winsock2.h and -lws2_32],
- [gl_cv_w32_gethostbyname],
- [gl_cv_w32_gethostbyname=no
- gl_save_LIBS="$LIBS"
- LIBS="$LIBS -lws2_32"
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
-#include <stddef.h>
- ]],
- [[gethostbyname(NULL);]])],
- [gl_cv_w32_gethostbyname=yes])
- LIBS="$gl_save_LIBS"
- ])
- if test "$gl_cv_w32_gethostbyname" = "yes"; then
- HOSTENT_LIB="-lws2_32"
- fi
- ])
- fi
- AC_SUBST([HOSTENT_LIB])
-])
diff --git a/src/gl/m4/include_next.m4 b/src/gl/m4/include_next.m4
deleted file mode 100644
index db0f2c0795..0000000000
--- a/src/gl/m4/include_next.m4
+++ /dev/null
@@ -1,223 +0,0 @@
-# include_next.m4 serial 23
-dnl Copyright (C) 2006-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Paul Eggert and Derek Price.
-
-dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER.
-dnl
-dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to
-dnl 'include' otherwise.
-dnl
-dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler
-dnl supports it in the special case that it is the first include directive in
-dnl the given file, or to 'include' otherwise.
-dnl
-dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next,
-dnl so as to avoid GCC warnings when the gcc option -pedantic is used.
-dnl '#pragma GCC system_header' has the same effect as if the file was found
-dnl through the include search path specified with '-isystem' options (as
-dnl opposed to the search path specified with '-I' options). Namely, gcc
-dnl does not warn about some things, and on some systems (Solaris and Interix)
-dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
-dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
-dnl of plain '__STDC__'.
-dnl
-dnl PRAGMA_COLUMNS can be used in files that override system header files, so
-dnl as to avoid compilation errors on HP NonStop systems when the gnulib file
-dnl is included by a system header file that does a "#pragma COLUMNS 80" (which
-dnl has the effect of truncating the lines of that file and all files that it
-dnl includes to 80 columns) and the gnulib file has lines longer than 80
-dnl columns.
-
-AC_DEFUN([gl_INCLUDE_NEXT],
-[
- AC_LANG_PREPROC_REQUIRE()
- AC_CACHE_CHECK([whether the preprocessor supports include_next],
- [gl_cv_have_include_next],
- [rm -rf conftestd1a conftestd1b conftestd2
- mkdir conftestd1a conftestd1b conftestd2
- dnl IBM C 9.0, 10.1 (original versions, prior to the 2009-01 updates) on
- dnl AIX 6.1 support include_next when used as first preprocessor directive
- dnl in a file, but not when preceded by another include directive. Check
- dnl for this bug by including <stdio.h>.
- dnl Additionally, with this same compiler, include_next is a no-op when
- dnl used in a header file that was included by specifying its absolute
- dnl file name. Despite these two bugs, include_next is used in the
- dnl compiler's <math.h>. By virtue of the second bug, we need to use
- dnl include_next as well in this case.
- cat <<EOF > conftestd1a/conftest.h
-#define DEFINED_IN_CONFTESTD1
-#include_next <conftest.h>
-#ifdef DEFINED_IN_CONFTESTD2
-int foo;
-#else
-#error "include_next doesn't work"
-#endif
-EOF
- cat <<EOF > conftestd1b/conftest.h
-#define DEFINED_IN_CONFTESTD1
-#include <stdio.h>
-#include_next <conftest.h>
-#ifdef DEFINED_IN_CONFTESTD2
-int foo;
-#else
-#error "include_next doesn't work"
-#endif
-EOF
- cat <<EOF > conftestd2/conftest.h
-#ifndef DEFINED_IN_CONFTESTD1
-#error "include_next test doesn't work"
-#endif
-#define DEFINED_IN_CONFTESTD2
-EOF
- gl_save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
-dnl We intentionally avoid using AC_LANG_SOURCE here.
- AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
- [gl_cv_have_include_next=yes],
- [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
- AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
- [gl_cv_have_include_next=buggy],
- [gl_cv_have_include_next=no])
- ])
- CPPFLAGS="$gl_save_CPPFLAGS"
- rm -rf conftestd1a conftestd1b conftestd2
- ])
- PRAGMA_SYSTEM_HEADER=
- if test $gl_cv_have_include_next = yes; then
- INCLUDE_NEXT=include_next
- INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
- if test -n "$GCC"; then
- PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
- fi
- else
- if test $gl_cv_have_include_next = buggy; then
- INCLUDE_NEXT=include
- INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
- else
- INCLUDE_NEXT=include
- INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include
- fi
- fi
- AC_SUBST([INCLUDE_NEXT])
- AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE])
- AC_SUBST([PRAGMA_SYSTEM_HEADER])
- AC_CACHE_CHECK([whether system header files limit the line length],
- [gl_cv_pragma_columns],
- [dnl HP NonStop systems, which define __TANDEM, have this misfeature.
- AC_EGREP_CPP([choke me],
- [
-#ifdef __TANDEM
-choke me
-#endif
- ],
- [gl_cv_pragma_columns=yes],
- [gl_cv_pragma_columns=no])
- ])
- if test $gl_cv_pragma_columns = yes; then
- PRAGMA_COLUMNS="#pragma COLUMNS 10000"
- else
- PRAGMA_COLUMNS=
- fi
- AC_SUBST([PRAGMA_COLUMNS])
-])
-
-# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
-# ------------------------------------------
-# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
-# '<foo.h>'; otherwise define it to be
-# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
-# Also, if #include_next works as first preprocessing directive in a file,
-# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to
-# be
-# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
-# That way, a header file with the following line:
-# #@INCLUDE_NEXT@ @NEXT_FOO_H@
-# or
-# #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
-# behaves (after sed substitution) as if it contained
-# #include_next <foo.h>
-# even if the compiler does not support include_next.
-# The three "///" are to pacify Sun C 5.8, which otherwise would say
-# "warning: #include of /usr/include/... may be non-portable".
-# Use '""', not '<>', so that the /// cannot be confused with a C99 comment.
-# Note: This macro assumes that the header file is not empty after
-# preprocessing, i.e. it does not only define preprocessor macros but also
-# provides some type/enum definitions or function/variable declarations.
-#
-# This macro also checks whether each header exists, by invoking
-# AC_CHECK_HEADERS_ONCE or AC_CHECK_HEADERS on each argument.
-AC_DEFUN([gl_CHECK_NEXT_HEADERS],
-[
- gl_NEXT_HEADERS_INTERNAL([$1], [check])
-])
-
-# gl_NEXT_HEADERS(HEADER1 HEADER2 ...)
-# ------------------------------------
-# Like gl_CHECK_NEXT_HEADERS, except do not check whether the headers exist.
-# This is suitable for headers like <stddef.h> that are standardized by C89
-# and therefore can be assumed to exist.
-AC_DEFUN([gl_NEXT_HEADERS],
-[
- gl_NEXT_HEADERS_INTERNAL([$1], [assume])
-])
-
-# The guts of gl_CHECK_NEXT_HEADERS and gl_NEXT_HEADERS.
-AC_DEFUN([gl_NEXT_HEADERS_INTERNAL],
-[
- AC_REQUIRE([gl_INCLUDE_NEXT])
- AC_REQUIRE([AC_CANONICAL_HOST])
-
- m4_if([$2], [check],
- [AC_CHECK_HEADERS_ONCE([$1])
- ])
-
-dnl FIXME: gl_next_header and gl_header_exists must be used unquoted
-dnl until we can assume autoconf 2.64 or newer.
- m4_foreach_w([gl_HEADER_NAME], [$1],
- [AS_VAR_PUSHDEF([gl_next_header],
- [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
- if test $gl_cv_have_include_next = yes; then
- AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
- else
- AC_CACHE_CHECK(
- [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
- m4_defn([gl_next_header]),
- [m4_if([$2], [check],
- [AS_VAR_PUSHDEF([gl_header_exists],
- [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
- if test AS_VAR_GET(gl_header_exists) = yes; then
- AS_VAR_POPDEF([gl_header_exists])
- ])
- gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME)
- AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME))
- AS_VAR_SET(gl_next_header, ['"'$gl_header'"'])
- m4_if([$2], [check],
- [else
- AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
- fi
- ])
- ])
- fi
- AC_SUBST(
- AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
- [AS_VAR_GET(gl_next_header)])
- if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
- # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
- gl_next_as_first_directive='<'gl_HEADER_NAME'>'
- else
- # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
- gl_next_as_first_directive=AS_VAR_GET(gl_next_header)
- fi
- AC_SUBST(
- AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
- [$gl_next_as_first_directive])
- AS_VAR_POPDEF([gl_next_header])])
-])
-
-# Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE;
-# this fallback is safe for all earlier autoconf versions.
-m4_define_default([AC_LANG_DEFINES_PROVIDED])
diff --git a/src/gl/m4/inet_ntop.m4 b/src/gl/m4/inet_ntop.m4
deleted file mode 100644
index 26464c34ac..0000000000
--- a/src/gl/m4/inet_ntop.m4
+++ /dev/null
@@ -1,68 +0,0 @@
-# inet_ntop.m4 serial 19
-dnl Copyright (C) 2005-2006, 2008-2016 Free Software Foundation, Inc.
-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_FUNC_INET_NTOP],
-[
- AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
-
- dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- AC_REQUIRE([AC_C_RESTRICT])
-
- dnl Most platforms that provide inet_ntop define it in libc.
- dnl Solaris 8..10 provide inet_ntop in libnsl instead.
- dnl Solaris 2.6..7 provide inet_ntop in libresolv instead.
- dnl Native Windows provides it in -lws2_32 instead, with a declaration in
- dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
- dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
- HAVE_INET_NTOP=1
- INET_NTOP_LIB=
- gl_PREREQ_SYS_H_WINSOCK2
- if test $HAVE_WINSOCK2_H = 1; then
- AC_CHECK_DECLS([inet_ntop],,, [[#include <ws2tcpip.h>]])
- if test $ac_cv_have_decl_inet_ntop = yes; then
- dnl It needs to be overridden, because the stdcall calling convention
- dnl is not compliant with POSIX.
- REPLACE_INET_NTOP=1
- INET_NTOP_LIB="-lws2_32"
- else
- HAVE_DECL_INET_NTOP=0
- HAVE_INET_NTOP=0
- fi
- else
- gl_save_LIBS=$LIBS
- AC_SEARCH_LIBS([inet_ntop], [nsl resolv], [],
- [AC_CHECK_FUNCS([inet_ntop])
- if test $ac_cv_func_inet_ntop = no; then
- HAVE_INET_NTOP=0
- fi
- ])
- LIBS=$gl_save_LIBS
-
- if test "$ac_cv_search_inet_ntop" != "no" \
- && test "$ac_cv_search_inet_ntop" != "none required"; then
- INET_NTOP_LIB="$ac_cv_search_inet_ntop"
- fi
-
- AC_CHECK_HEADERS_ONCE([netdb.h])
- AC_CHECK_DECLS([inet_ntop],,,
- [[#include <arpa/inet.h>
- #if HAVE_NETDB_H
- # include <netdb.h>
- #endif
- ]])
- if test $ac_cv_have_decl_inet_ntop = no; then
- HAVE_DECL_INET_NTOP=0
- fi
- fi
- AC_SUBST([INET_NTOP_LIB])
-])
-
-# Prerequisites of lib/inet_ntop.c.
-AC_DEFUN([gl_PREREQ_INET_NTOP], [
- AC_REQUIRE([gl_SOCKET_FAMILIES])
-])
diff --git a/src/gl/m4/inet_pton.m4 b/src/gl/m4/inet_pton.m4
deleted file mode 100644
index 4f5db7149a..0000000000
--- a/src/gl/m4/inet_pton.m4
+++ /dev/null
@@ -1,68 +0,0 @@
-# inet_pton.m4 serial 17
-dnl Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc.
-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_FUNC_INET_PTON],
-[
- AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
-
- dnl Persuade Solaris <arpa/inet.h> to declare inet_pton.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- AC_REQUIRE([AC_C_RESTRICT])
-
- dnl Most platforms that provide inet_pton define it in libc.
- dnl Solaris 8..10 provide inet_pton in libnsl instead.
- dnl Solaris 2.6..7 provide inet_pton in libresolv instead.
- dnl Native Windows provides it in -lws2_32 instead, with a declaration in
- dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
- dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
- HAVE_INET_PTON=1
- INET_PTON_LIB=
- gl_PREREQ_SYS_H_WINSOCK2
- if test $HAVE_WINSOCK2_H = 1; then
- AC_CHECK_DECLS([inet_pton],,, [[#include <ws2tcpip.h>]])
- if test $ac_cv_have_decl_inet_pton = yes; then
- dnl It needs to be overridden, because the stdcall calling convention
- dnl is not compliant with POSIX.
- REPLACE_INET_PTON=1
- INET_PTON_LIB="-lws2_32"
- else
- HAVE_DECL_INET_PTON=0
- HAVE_INET_PTON=0
- fi
- else
- gl_save_LIBS=$LIBS
- AC_SEARCH_LIBS([inet_pton], [nsl resolv], [],
- [AC_CHECK_FUNCS([inet_pton])
- if test $ac_cv_func_inet_pton = no; then
- HAVE_INET_PTON=0
- fi
- ])
- LIBS=$gl_save_LIBS
-
- if test "$ac_cv_search_inet_pton" != "no" \
- && test "$ac_cv_search_inet_pton" != "none required"; then
- INET_PTON_LIB="$ac_cv_search_inet_pton"
- fi
-
- AC_CHECK_HEADERS_ONCE([netdb.h])
- AC_CHECK_DECLS([inet_pton],,,
- [[#include <arpa/inet.h>
- #if HAVE_NETDB_H
- # include <netdb.h>
- #endif
- ]])
- if test $ac_cv_have_decl_inet_pton = no; then
- HAVE_DECL_INET_PTON=0
- fi
- fi
- AC_SUBST([INET_PTON_LIB])
-])
-
-# Prerequisites of lib/inet_pton.c.
-AC_DEFUN([gl_PREREQ_INET_PTON], [
- AC_REQUIRE([gl_SOCKET_FAMILIES])
-])
diff --git a/src/gl/m4/intmax_t.m4 b/src/gl/m4/intmax_t.m4
deleted file mode 100644
index 9559accabf..0000000000
--- a/src/gl/m4/intmax_t.m4
+++ /dev/null
@@ -1,67 +0,0 @@
-# intmax_t.m4 serial 8
-dnl Copyright (C) 1997-2004, 2006-2007, 2009-2016 Free Software Foundation,
-dnl Inc.
-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.
-
-dnl From Paul Eggert.
-
-AC_PREREQ([2.53])
-
-# Define intmax_t to 'long' or 'long long'
-# if it is not already defined in <stdint.h> or <inttypes.h>.
-
-AC_DEFUN([gl_AC_TYPE_INTMAX_T],
-[
- dnl For simplicity, we assume that a header file defines 'intmax_t' if and
- dnl only if it defines 'uintmax_t'.
- AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
- AC_REQUIRE([gl_AC_HEADER_STDINT_H])
- if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
- AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
- test $ac_cv_type_long_long_int = yes \
- && ac_type='long long' \
- || ac_type='long'
- AC_DEFINE_UNQUOTED([intmax_t], [$ac_type],
- [Define to long or long long if <inttypes.h> and <stdint.h> don't define.])
- else
- AC_DEFINE([HAVE_INTMAX_T], [1],
- [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
- fi
-])
-
-dnl An alternative would be to explicitly test for 'intmax_t'.
-
-AC_DEFUN([gt_AC_TYPE_INTMAX_T],
-[
- AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
- AC_REQUIRE([gl_AC_HEADER_STDINT_H])
- AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#include <stddef.h>
-#include <stdlib.h>
-#if HAVE_STDINT_H_WITH_UINTMAX
-#include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H_WITH_UINTMAX
-#include <inttypes.h>
-#endif
- ]],
- [[intmax_t x = -1; return !x;]])],
- [gt_cv_c_intmax_t=yes],
- [gt_cv_c_intmax_t=no])])
- if test $gt_cv_c_intmax_t = yes; then
- AC_DEFINE([HAVE_INTMAX_T], [1],
- [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
- else
- AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
- test $ac_cv_type_long_long_int = yes \
- && ac_type='long long' \
- || ac_type='long'
- AC_DEFINE_UNQUOTED([intmax_t], [$ac_type],
- [Define to long or long long if <stdint.h> and <inttypes.h> don't define.])
- fi
-])
diff --git a/src/gl/m4/inttypes_h.m4 b/src/gl/m4/inttypes_h.m4
deleted file mode 100644
index 76571199f3..0000000000
--- a/src/gl/m4/inttypes_h.m4
+++ /dev/null
@@ -1,29 +0,0 @@
-# inttypes_h.m4 serial 10
-dnl Copyright (C) 1997-2004, 2006, 2008-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Paul Eggert.
-
-# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
-# doesn't clash with <sys/types.h>, and declares uintmax_t.
-
-AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
-[
- AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#include <sys/types.h>
-#include <inttypes.h>
- ]],
- [[uintmax_t i = (uintmax_t) -1; return !i;]])],
- [gl_cv_header_inttypes_h=yes],
- [gl_cv_header_inttypes_h=no])])
- if test $gl_cv_header_inttypes_h = yes; then
- AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1],
- [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
- and declares uintmax_t. ])
- fi
-])
diff --git a/src/gl/m4/largefile.m4 b/src/gl/m4/largefile.m4
deleted file mode 100644
index 8bbdfaac1d..0000000000
--- a/src/gl/m4/largefile.m4
+++ /dev/null
@@ -1,146 +0,0 @@
-# Enable large files on systems where this is not the default.
-
-# Copyright 1992-1996, 1998-2016 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# The following implementation works around a problem in autoconf <= 2.69;
-# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5,
-# or configures them incorrectly in some cases.
-m4_version_prereq([2.70], [] ,[
-
-# _AC_SYS_LARGEFILE_TEST_INCLUDES
-# -------------------------------
-m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
-[@%:@include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
-@%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1]];[]dnl
-])
-
-
-# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
-# CACHE-VAR,
-# DESCRIPTION,
-# PROLOGUE, [FUNCTION-BODY])
-# --------------------------------------------------------
-m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
-[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
-[while :; do
- m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
- [AC_LANG_PROGRAM([$5], [$6])],
- [$3=no; break])
- m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
- [AC_LANG_PROGRAM([@%:@define $1 $2
-$5], [$6])],
- [$3=$2; break])
- $3=unknown
- break
-done])
-case $$3 in #(
- no | unknown) ;;
- *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
-esac
-rm -rf conftest*[]dnl
-])# _AC_SYS_LARGEFILE_MACRO_VALUE
-
-
-# AC_SYS_LARGEFILE
-# ----------------
-# By default, many hosts won't let programs access large files;
-# one must use special compiler options to get large-file access to work.
-# For more details about this brain damage please see:
-# http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
-AC_DEFUN([AC_SYS_LARGEFILE],
-[AC_ARG_ENABLE(largefile,
- [ --disable-largefile omit support for large files])
-if test "$enable_largefile" != no; then
-
- AC_CACHE_CHECK([for special C compiler options needed for large files],
- ac_cv_sys_largefile_CC,
- [ac_cv_sys_largefile_CC=no
- if test "$GCC" != yes; then
- ac_save_CC=$CC
- while :; do
- # IRIX 6.2 and later do not support large files by default,
- # so use the C compiler's -n32 option if that helps.
- AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
- AC_COMPILE_IFELSE([], [break])
- CC="$CC -n32"
- AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
- break
- done
- CC=$ac_save_CC
- rm -f conftest.$ac_ext
- fi])
- if test "$ac_cv_sys_largefile_CC" != no; then
- CC=$CC$ac_cv_sys_largefile_CC
- fi
-
- _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
- ac_cv_sys_file_offset_bits,
- [Number of bits in a file offset, on hosts where this is settable.],
- [_AC_SYS_LARGEFILE_TEST_INCLUDES])
- if test $ac_cv_sys_file_offset_bits = unknown; then
- _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
- ac_cv_sys_large_files,
- [Define for large files, on AIX-style hosts.],
- [_AC_SYS_LARGEFILE_TEST_INCLUDES])
- fi
-
- AC_DEFINE([_DARWIN_USE_64_BIT_INODE], [1],
- [Enable large inode numbers on Mac OS X 10.5.])
-fi
-])# AC_SYS_LARGEFILE
-])# m4_version_prereq 2.70
-
-# Enable large files on systems where this is implemented by Gnulib, not by the
-# system headers.
-# Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib
-# overrides ensure that off_t or 'struct size.st_size' are 64-bit, respectively.
-AC_DEFUN([gl_LARGEFILE],
-[
- AC_REQUIRE([AC_CANONICAL_HOST])
- case "$host_os" in
- mingw*)
- dnl Native Windows.
- dnl mingw64 defines off_t to a 64-bit type already, if
- dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE.
- AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <sys/types.h>
- int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1];
- ]],
- [[]])],
- [gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no])
- ])
- if test $gl_cv_type_off_t_64 = no; then
- WINDOWS_64_BIT_OFF_T=1
- else
- WINDOWS_64_BIT_OFF_T=0
- fi
- dnl But all native Windows platforms (including mingw64) have a 32-bit
- dnl st_size member in 'struct stat'.
- WINDOWS_64_BIT_ST_SIZE=1
- ;;
- *)
- dnl Nothing to do on gnulib's side.
- dnl A 64-bit off_t is
- dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX,
- dnl OSF/1, Cygwin,
- dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on
- dnl glibc, HP-UX, Solaris,
- dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX,
- dnl - impossible to achieve on Minix 3.1.8.
- WINDOWS_64_BIT_OFF_T=0
- WINDOWS_64_BIT_ST_SIZE=0
- ;;
- esac
-])
diff --git a/src/gl/m4/limits-h.m4 b/src/gl/m4/limits-h.m4
deleted file mode 100644
index 31fdf0a779..0000000000
--- a/src/gl/m4/limits-h.m4
+++ /dev/null
@@ -1,31 +0,0 @@
-dnl Check whether limits.h has needed features.
-
-dnl Copyright 2016 Free Software Foundation, Inc.
-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.
-
-dnl From Paul Eggert.
-
-AC_DEFUN_ONCE([gl_LIMITS_H],
-[
- gl_CHECK_NEXT_HEADERS([limits.h])
-
- AC_CACHE_CHECK([whether limits.h has ULLONG_WIDTH etc.],
- [gl_cv_header_limits_width],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
- #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
- #endif
- #include <limits.h>
- int ullw = ULLONG_WIDTH;]])],
- [gl_cv_header_limits_width=yes],
- [gl_cv_header_limits_width=no])])
- if test "$gl_cv_header_limits_width" = yes; then
- LIMITS_H=
- else
- LIMITS_H=limits.h
- fi
- AC_SUBST([LIMITS_H])
- AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
-])
diff --git a/src/gl/m4/longlong.m4 b/src/gl/m4/longlong.m4
deleted file mode 100644
index 36d8b12421..0000000000
--- a/src/gl/m4/longlong.m4
+++ /dev/null
@@ -1,113 +0,0 @@
-# longlong.m4 serial 17
-dnl Copyright (C) 1999-2007, 2009-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Paul Eggert.
-
-# Define HAVE_LONG_LONG_INT if 'long long int' works.
-# This fixes a bug in Autoconf 2.61, and can be faster
-# than what's in Autoconf 2.62 through 2.68.
-
-# Note: If the type 'long long int' exists but is only 32 bits large
-# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
-# defined. In this case you can treat 'long long int' like 'long int'.
-
-AC_DEFUN([AC_TYPE_LONG_LONG_INT],
-[
- AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
- AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
- [ac_cv_type_long_long_int=yes
- if test "x${ac_cv_prog_cc_c99-no}" = xno; then
- ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
- if test $ac_cv_type_long_long_int = yes; then
- dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
- dnl If cross compiling, assume the bug is not important, since
- dnl nobody cross compiles for this platform as far as we know.
- AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [[@%:@include <limits.h>
- @%:@ifndef LLONG_MAX
- @%:@ define HALF \
- (1LL << (sizeof (long long int) * CHAR_BIT - 2))
- @%:@ define LLONG_MAX (HALF - 1 + HALF)
- @%:@endif]],
- [[long long int n = 1;
- int i;
- for (i = 0; ; i++)
- {
- long long int m = n << i;
- if (m >> i != n)
- return 1;
- if (LLONG_MAX / 2 < m)
- break;
- }
- return 0;]])],
- [],
- [ac_cv_type_long_long_int=no],
- [:])
- fi
- fi])
- if test $ac_cv_type_long_long_int = yes; then
- AC_DEFINE([HAVE_LONG_LONG_INT], [1],
- [Define to 1 if the system has the type 'long long int'.])
- fi
-])
-
-# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
-# This fixes a bug in Autoconf 2.61, and can be faster
-# than what's in Autoconf 2.62 through 2.68.
-
-# Note: If the type 'unsigned long long int' exists but is only 32 bits
-# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
-# will not be defined. In this case you can treat 'unsigned long long int'
-# like 'unsigned long int'.
-
-AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
-[
- AC_CACHE_CHECK([for unsigned long long int],
- [ac_cv_type_unsigned_long_long_int],
- [ac_cv_type_unsigned_long_long_int=yes
- if test "x${ac_cv_prog_cc_c99-no}" = xno; then
- AC_LINK_IFELSE(
- [_AC_TYPE_LONG_LONG_SNIPPET],
- [],
- [ac_cv_type_unsigned_long_long_int=no])
- fi])
- if test $ac_cv_type_unsigned_long_long_int = yes; then
- AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
- [Define to 1 if the system has the type 'unsigned long long int'.])
- fi
-])
-
-# Expands to a C program that can be used to test for simultaneous support
-# of 'long long' and 'unsigned long long'. We don't want to say that
-# 'long long' is available if 'unsigned long long' is not, or vice versa,
-# because too many programs rely on the symmetry between signed and unsigned
-# integer types (excluding 'bool').
-AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
-[
- AC_LANG_PROGRAM(
- [[/* For now, do not test the preprocessor; as of 2007 there are too many
- implementations with broken preprocessors. Perhaps this can
- be revisited in 2012. In the meantime, code should not expect
- #if to work with literals wider than 32 bits. */
- /* Test literals. */
- long long int ll = 9223372036854775807ll;
- long long int nll = -9223372036854775807LL;
- unsigned long long int ull = 18446744073709551615ULL;
- /* Test constant expressions. */
- typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
- ? 1 : -1)];
- typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
- ? 1 : -1)];
- int i = 63;]],
- [[/* Test availability of runtime routines for shift and division. */
- long long int llmax = 9223372036854775807ll;
- unsigned long long int ullmax = 18446744073709551615ull;
- return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
- | (llmax / ll) | (llmax % ll)
- | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
- | (ullmax / ull) | (ullmax % ull));]])
-])
diff --git a/src/gl/m4/lseek.m4 b/src/gl/m4/lseek.m4
deleted file mode 100644
index 4a95440073..0000000000
--- a/src/gl/m4/lseek.m4
+++ /dev/null
@@ -1,71 +0,0 @@
-# lseek.m4 serial 10
-dnl Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
-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_FUNC_LSEEK],
-[
- AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-
- AC_REQUIRE([AC_CANONICAL_HOST])
- AC_REQUIRE([AC_PROG_CC])
- AC_CHECK_HEADERS_ONCE([unistd.h])
- AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe],
- [case "$host_os" in
- mingw*)
- dnl Native Windows.
- dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or
- dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT)
- dnl for a pipe depends on the environment: In a Cygwin 1.5
- dnl environment it succeeds (wrong); in a Cygwin 1.7 environment
- dnl it fails with a wrong errno value.
- gl_cv_func_lseek_pipe=no
- ;;
- *)
- if test $cross_compiling = no; then
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#include <sys/types.h> /* for off_t */
-#include <stdio.h> /* for SEEK_CUR */
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#else /* on Windows with MSVC */
-# include <io.h>
-#endif
-]], [[
- /* Exit with success only if stdin is seekable. */
- return lseek (0, (off_t)0, SEEK_CUR) < 0;
-]])],
- [if test -s conftest$ac_exeext \
- && ./conftest$ac_exeext < conftest.$ac_ext \
- && test 1 = "`echo hi \
- | { ./conftest$ac_exeext; echo $?; cat >/dev/null; }`"; then
- gl_cv_func_lseek_pipe=yes
- else
- gl_cv_func_lseek_pipe=no
- fi
- ],
- [gl_cv_func_lseek_pipe=no])
- else
- AC_COMPILE_IFELSE(
- [AC_LANG_SOURCE([[
-#if defined __BEOS__
-/* BeOS mistakenly return 0 when trying to seek on pipes. */
- Choke me.
-#endif]])],
- [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
- fi
- ;;
- esac
- ])
- if test $gl_cv_func_lseek_pipe = no; then
- REPLACE_LSEEK=1
- AC_DEFINE([LSEEK_PIPE_BROKEN], [1],
- [Define to 1 if lseek does not detect pipes.])
- fi
-
- AC_REQUIRE([gl_SYS_TYPES_H])
- if test $WINDOWS_64_BIT_OFF_T = 1; then
- REPLACE_LSEEK=1
- fi
-])
diff --git a/src/gl/m4/malloc.m4 b/src/gl/m4/malloc.m4
deleted file mode 100644
index c393690e27..0000000000
--- a/src/gl/m4/malloc.m4
+++ /dev/null
@@ -1,101 +0,0 @@
-# malloc.m4 serial 15
-dnl Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
-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.
-
-m4_version_prereq([2.70], [] ,[
-
-# This is adapted with modifications from upstream Autoconf here:
-# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c
-AC_DEFUN([_AC_FUNC_MALLOC_IF],
-[
- AC_REQUIRE([AC_HEADER_STDC])dnl
- AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
- AC_CHECK_HEADERS([stdlib.h])
- AC_CACHE_CHECK([for GNU libc compatible malloc],
- [ac_cv_func_malloc_0_nonnull],
- [AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [[#if defined STDC_HEADERS || defined HAVE_STDLIB_H
- # include <stdlib.h>
- #else
- char *malloc ();
- #endif
- ]],
- [[char *p = malloc (0);
- int result = !p;
- free (p);
- return result;]])
- ],
- [ac_cv_func_malloc_0_nonnull=yes],
- [ac_cv_func_malloc_0_nonnull=no],
- [case "$host_os" in
- # Guess yes on platforms where we know the result.
- *-gnu* | freebsd* | netbsd* | openbsd* \
- | hpux* | solaris* | cygwin* | mingw*)
- ac_cv_func_malloc_0_nonnull=yes ;;
- # If we don't know, assume the worst.
- *) ac_cv_func_malloc_0_nonnull=no ;;
- esac
- ])
- ])
- AS_IF([test $ac_cv_func_malloc_0_nonnull = yes], [$1], [$2])
-])# _AC_FUNC_MALLOC_IF
-
-])
-
-# gl_FUNC_MALLOC_GNU
-# ------------------
-# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if
-# it is not.
-AC_DEFUN([gl_FUNC_MALLOC_GNU],
-[
- AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
- dnl _AC_FUNC_MALLOC_IF is defined in Autoconf.
- _AC_FUNC_MALLOC_IF(
- [AC_DEFINE([HAVE_MALLOC_GNU], [1],
- [Define to 1 if your system has a GNU libc compatible 'malloc'
- function, and to 0 otherwise.])],
- [AC_DEFINE([HAVE_MALLOC_GNU], [0])
- REPLACE_MALLOC=1
- ])
-])
-
-# gl_FUNC_MALLOC_POSIX
-# --------------------
-# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
-# fails), and replace malloc if it is not.
-AC_DEFUN([gl_FUNC_MALLOC_POSIX],
-[
- AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
- AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
- if test $gl_cv_func_malloc_posix = yes; then
- AC_DEFINE([HAVE_MALLOC_POSIX], [1],
- [Define if the 'malloc' function is POSIX compliant.])
- else
- REPLACE_MALLOC=1
- fi
-])
-
-# Test whether malloc, realloc, calloc are POSIX compliant,
-# Set gl_cv_func_malloc_posix to yes or no accordingly.
-AC_DEFUN([gl_CHECK_MALLOC_POSIX],
-[
- AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant],
- [gl_cv_func_malloc_posix],
- [
- dnl It is too dangerous to try to allocate a large amount of memory:
- dnl some systems go to their knees when you do that. So assume that
- dnl all Unix implementations of the function are POSIX compliant.
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[]],
- [[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- choke me
- #endif
- ]])],
- [gl_cv_func_malloc_posix=yes],
- [gl_cv_func_malloc_posix=no])
- ])
-])
diff --git a/src/gl/m4/malloca.m4 b/src/gl/m4/malloca.m4
deleted file mode 100644
index b368b20e50..0000000000
--- a/src/gl/m4/malloca.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-# malloca.m4 serial 1
-dnl Copyright (C) 2003-2004, 2006-2007, 2009-2016 Free Software Foundation,
-dnl Inc.
-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_MALLOCA],
-[
- dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables
- dnl @ALLOCA@ and @LTALLOCA@.
- dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies.
- AC_REQUIRE([gl_EEMALLOC])
- AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
-])
diff --git a/src/gl/m4/math_h.m4 b/src/gl/m4/math_h.m4
deleted file mode 100644
index 35d07ee5f5..0000000000
--- a/src/gl/m4/math_h.m4
+++ /dev/null
@@ -1,353 +0,0 @@
-# math_h.m4 serial 114
-dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
-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_MATH_H],
-[
- AC_REQUIRE([gl_MATH_H_DEFAULTS])
- gl_CHECK_NEXT_HEADERS([math.h])
-
- AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
- [[/* Solaris 10 has a broken definition of NAN. Other platforms
- fail to provide NAN, or provide it only in C99 mode; this
- test only needs to fail when NAN is provided but wrong. */
- float f = 1.0f;
-#ifdef NAN
- f = NAN;
-#endif
- return f == 0;]])],
- [gl_cv_header_math_nan_works=yes],
- [gl_cv_header_math_nan_works=no])])
- if test $gl_cv_header_math_nan_works = no; then
- REPLACE_NAN=1
- fi
- AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
- [[/* Solaris 10 has a broken definition of HUGE_VAL. */
- double d = HUGE_VAL;
- return d == 0;]])],
- [gl_cv_header_math_huge_val_works=yes],
- [gl_cv_header_math_huge_val_works=no])])
- if test $gl_cv_header_math_huge_val_works = no; then
- REPLACE_HUGE_VAL=1
- fi
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[#include <math.h>]],
- [acosf acosl asinf asinl atanf atanl
- cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf
- expf expl exp2 exp2f exp2l expm1 expm1f expm1l
- fabsf fabsl floorf floorl fma fmaf fmal
- fmod fmodf fmodl frexpf frexpl hypotf hypotl
- ilogb ilogbf ilogbl
- ldexpf ldexpl
- log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l
- logb logbf logbl
- modf modff modfl powf
- remainder remainderf remainderl
- rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl
- tanf tanl tanhf trunc truncf truncl])
-])
-
-AC_DEFUN([gl_MATH_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_MATH_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_MATH_H_DEFAULTS],
-[
- GNULIB_ACOSF=0; AC_SUBST([GNULIB_ACOSF])
- GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL])
- GNULIB_ASINF=0; AC_SUBST([GNULIB_ASINF])
- GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL])
- GNULIB_ATANF=0; AC_SUBST([GNULIB_ATANF])
- GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL])
- GNULIB_ATAN2F=0; AC_SUBST([GNULIB_ATAN2F])
- GNULIB_CBRT=0; AC_SUBST([GNULIB_CBRT])
- GNULIB_CBRTF=0; AC_SUBST([GNULIB_CBRTF])
- GNULIB_CBRTL=0; AC_SUBST([GNULIB_CBRTL])
- GNULIB_CEIL=0; AC_SUBST([GNULIB_CEIL])
- GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF])
- GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL])
- GNULIB_COPYSIGN=0; AC_SUBST([GNULIB_COPYSIGN])
- GNULIB_COPYSIGNF=0; AC_SUBST([GNULIB_COPYSIGNF])
- GNULIB_COPYSIGNL=0; AC_SUBST([GNULIB_COPYSIGNL])
- GNULIB_COSF=0; AC_SUBST([GNULIB_COSF])
- GNULIB_COSL=0; AC_SUBST([GNULIB_COSL])
- GNULIB_COSHF=0; AC_SUBST([GNULIB_COSHF])
- GNULIB_EXPF=0; AC_SUBST([GNULIB_EXPF])
- GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL])
- GNULIB_EXP2=0; AC_SUBST([GNULIB_EXP2])
- GNULIB_EXP2F=0; AC_SUBST([GNULIB_EXP2F])
- GNULIB_EXP2L=0; AC_SUBST([GNULIB_EXP2L])
- GNULIB_EXPM1=0; AC_SUBST([GNULIB_EXPM1])
- GNULIB_EXPM1F=0; AC_SUBST([GNULIB_EXPM1F])
- GNULIB_EXPM1L=0; AC_SUBST([GNULIB_EXPM1L])
- GNULIB_FABSF=0; AC_SUBST([GNULIB_FABSF])
- GNULIB_FABSL=0; AC_SUBST([GNULIB_FABSL])
- GNULIB_FLOOR=0; AC_SUBST([GNULIB_FLOOR])
- GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF])
- GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL])
- GNULIB_FMA=0; AC_SUBST([GNULIB_FMA])
- GNULIB_FMAF=0; AC_SUBST([GNULIB_FMAF])
- GNULIB_FMAL=0; AC_SUBST([GNULIB_FMAL])
- GNULIB_FMOD=0; AC_SUBST([GNULIB_FMOD])
- GNULIB_FMODF=0; AC_SUBST([GNULIB_FMODF])
- GNULIB_FMODL=0; AC_SUBST([GNULIB_FMODL])
- GNULIB_FREXPF=0; AC_SUBST([GNULIB_FREXPF])
- GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP])
- GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL])
- GNULIB_HYPOT=0; AC_SUBST([GNULIB_HYPOT])
- GNULIB_HYPOTF=0; AC_SUBST([GNULIB_HYPOTF])
- GNULIB_HYPOTL=0; AC_SUBST([GNULIB_HYPOTL])
- GNULIB_ILOGB=0; AC_SUBST([GNULIB_ILOGB])
- GNULIB_ILOGBF=0; AC_SUBST([GNULIB_ILOGBF])
- GNULIB_ILOGBL=0; AC_SUBST([GNULIB_ILOGBL])
- GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE])
- GNULIB_ISINF=0; AC_SUBST([GNULIB_ISINF])
- GNULIB_ISNAN=0; AC_SUBST([GNULIB_ISNAN])
- GNULIB_ISNANF=0; AC_SUBST([GNULIB_ISNANF])
- GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND])
- GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL])
- GNULIB_LDEXPF=0; AC_SUBST([GNULIB_LDEXPF])
- GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL])
- GNULIB_LOG=0; AC_SUBST([GNULIB_LOG])
- GNULIB_LOGF=0; AC_SUBST([GNULIB_LOGF])
- GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL])
- GNULIB_LOG10=0; AC_SUBST([GNULIB_LOG10])
- GNULIB_LOG10F=0; AC_SUBST([GNULIB_LOG10F])
- GNULIB_LOG10L=0; AC_SUBST([GNULIB_LOG10L])
- GNULIB_LOG1P=0; AC_SUBST([GNULIB_LOG1P])
- GNULIB_LOG1PF=0; AC_SUBST([GNULIB_LOG1PF])
- GNULIB_LOG1PL=0; AC_SUBST([GNULIB_LOG1PL])
- GNULIB_LOG2=0; AC_SUBST([GNULIB_LOG2])
- GNULIB_LOG2F=0; AC_SUBST([GNULIB_LOG2F])
- GNULIB_LOG2L=0; AC_SUBST([GNULIB_LOG2L])
- GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB])
- GNULIB_LOGBF=0; AC_SUBST([GNULIB_LOGBF])
- GNULIB_LOGBL=0; AC_SUBST([GNULIB_LOGBL])
- GNULIB_MODF=0; AC_SUBST([GNULIB_MODF])
- GNULIB_MODFF=0; AC_SUBST([GNULIB_MODFF])
- GNULIB_MODFL=0; AC_SUBST([GNULIB_MODFL])
- GNULIB_POWF=0; AC_SUBST([GNULIB_POWF])
- GNULIB_REMAINDER=0; AC_SUBST([GNULIB_REMAINDER])
- GNULIB_REMAINDERF=0; AC_SUBST([GNULIB_REMAINDERF])
- GNULIB_REMAINDERL=0; AC_SUBST([GNULIB_REMAINDERL])
- GNULIB_RINT=0; AC_SUBST([GNULIB_RINT])
- GNULIB_RINTF=0; AC_SUBST([GNULIB_RINTF])
- GNULIB_RINTL=0; AC_SUBST([GNULIB_RINTL])
- GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND])
- GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF])
- GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL])
- GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT])
- GNULIB_SINF=0; AC_SUBST([GNULIB_SINF])
- GNULIB_SINL=0; AC_SUBST([GNULIB_SINL])
- GNULIB_SINHF=0; AC_SUBST([GNULIB_SINHF])
- GNULIB_SQRTF=0; AC_SUBST([GNULIB_SQRTF])
- GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL])
- GNULIB_TANF=0; AC_SUBST([GNULIB_TANF])
- GNULIB_TANL=0; AC_SUBST([GNULIB_TANL])
- GNULIB_TANHF=0; AC_SUBST([GNULIB_TANHF])
- GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC])
- GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF])
- GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_ACOSF=1; AC_SUBST([HAVE_ACOSF])
- HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL])
- HAVE_ASINF=1; AC_SUBST([HAVE_ASINF])
- HAVE_ASINL=1; AC_SUBST([HAVE_ASINL])
- HAVE_ATANF=1; AC_SUBST([HAVE_ATANF])
- HAVE_ATANL=1; AC_SUBST([HAVE_ATANL])
- HAVE_ATAN2F=1; AC_SUBST([HAVE_ATAN2F])
- HAVE_CBRT=1; AC_SUBST([HAVE_CBRT])
- HAVE_CBRTF=1; AC_SUBST([HAVE_CBRTF])
- HAVE_CBRTL=1; AC_SUBST([HAVE_CBRTL])
- HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN])
- HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL])
- HAVE_COSF=1; AC_SUBST([HAVE_COSF])
- HAVE_COSL=1; AC_SUBST([HAVE_COSL])
- HAVE_COSHF=1; AC_SUBST([HAVE_COSHF])
- HAVE_EXPF=1; AC_SUBST([HAVE_EXPF])
- HAVE_EXPL=1; AC_SUBST([HAVE_EXPL])
- HAVE_EXPM1=1; AC_SUBST([HAVE_EXPM1])
- HAVE_EXPM1F=1; AC_SUBST([HAVE_EXPM1F])
- HAVE_FABSF=1; AC_SUBST([HAVE_FABSF])
- HAVE_FABSL=1; AC_SUBST([HAVE_FABSL])
- HAVE_FMA=1; AC_SUBST([HAVE_FMA])
- HAVE_FMAF=1; AC_SUBST([HAVE_FMAF])
- HAVE_FMAL=1; AC_SUBST([HAVE_FMAL])
- HAVE_FMODF=1; AC_SUBST([HAVE_FMODF])
- HAVE_FMODL=1; AC_SUBST([HAVE_FMODL])
- HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF])
- HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF])
- HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL])
- HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB])
- HAVE_ILOGBF=1; AC_SUBST([HAVE_ILOGBF])
- HAVE_ILOGBL=1; AC_SUBST([HAVE_ILOGBL])
- HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF])
- HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND])
- HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL])
- HAVE_LDEXPF=1; AC_SUBST([HAVE_LDEXPF])
- HAVE_LOGF=1; AC_SUBST([HAVE_LOGF])
- HAVE_LOGL=1; AC_SUBST([HAVE_LOGL])
- HAVE_LOG10F=1; AC_SUBST([HAVE_LOG10F])
- HAVE_LOG10L=1; AC_SUBST([HAVE_LOG10L])
- HAVE_LOG1P=1; AC_SUBST([HAVE_LOG1P])
- HAVE_LOG1PF=1; AC_SUBST([HAVE_LOG1PF])
- HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL])
- HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF])
- HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL])
- HAVE_MODFF=1; AC_SUBST([HAVE_MODFF])
- HAVE_MODFL=1; AC_SUBST([HAVE_MODFL])
- HAVE_POWF=1; AC_SUBST([HAVE_POWF])
- HAVE_REMAINDER=1; AC_SUBST([HAVE_REMAINDER])
- HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF])
- HAVE_RINT=1; AC_SUBST([HAVE_RINT])
- HAVE_RINTL=1; AC_SUBST([HAVE_RINTL])
- HAVE_SINF=1; AC_SUBST([HAVE_SINF])
- HAVE_SINL=1; AC_SUBST([HAVE_SINL])
- HAVE_SINHF=1; AC_SUBST([HAVE_SINHF])
- HAVE_SQRTF=1; AC_SUBST([HAVE_SQRTF])
- HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL])
- HAVE_TANF=1; AC_SUBST([HAVE_TANF])
- HAVE_TANL=1; AC_SUBST([HAVE_TANL])
- HAVE_TANHF=1; AC_SUBST([HAVE_TANHF])
- HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL])
- HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL])
- HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL])
- HAVE_DECL_CBRTF=1; AC_SUBST([HAVE_DECL_CBRTF])
- HAVE_DECL_CBRTL=1; AC_SUBST([HAVE_DECL_CBRTL])
- HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF])
- HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL])
- HAVE_DECL_COPYSIGNF=1; AC_SUBST([HAVE_DECL_COPYSIGNF])
- HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL])
- HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL])
- HAVE_DECL_EXP2=1; AC_SUBST([HAVE_DECL_EXP2])
- HAVE_DECL_EXP2F=1; AC_SUBST([HAVE_DECL_EXP2F])
- HAVE_DECL_EXP2L=1; AC_SUBST([HAVE_DECL_EXP2L])
- HAVE_DECL_EXPM1L=1; AC_SUBST([HAVE_DECL_EXPM1L])
- HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF])
- HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL])
- HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL])
- HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL])
- HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL])
- HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L])
- HAVE_DECL_LOG2=1; AC_SUBST([HAVE_DECL_LOG2])
- HAVE_DECL_LOG2F=1; AC_SUBST([HAVE_DECL_LOG2F])
- HAVE_DECL_LOG2L=1; AC_SUBST([HAVE_DECL_LOG2L])
- HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB])
- HAVE_DECL_REMAINDER=1; AC_SUBST([HAVE_DECL_REMAINDER])
- HAVE_DECL_REMAINDERL=1; AC_SUBST([HAVE_DECL_REMAINDERL])
- HAVE_DECL_RINTF=1; AC_SUBST([HAVE_DECL_RINTF])
- HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND])
- HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF])
- HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL])
- HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL])
- HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL])
- HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL])
- HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC])
- HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF])
- HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL])
- REPLACE_CBRTF=0; AC_SUBST([REPLACE_CBRTF])
- REPLACE_CBRTL=0; AC_SUBST([REPLACE_CBRTL])
- REPLACE_CEIL=0; AC_SUBST([REPLACE_CEIL])
- REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF])
- REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL])
- REPLACE_EXPM1=0; AC_SUBST([REPLACE_EXPM1])
- REPLACE_EXPM1F=0; AC_SUBST([REPLACE_EXPM1F])
- REPLACE_EXP2=0; AC_SUBST([REPLACE_EXP2])
- REPLACE_EXP2L=0; AC_SUBST([REPLACE_EXP2L])
- REPLACE_FABSL=0; AC_SUBST([REPLACE_FABSL])
- REPLACE_FLOOR=0; AC_SUBST([REPLACE_FLOOR])
- REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF])
- REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL])
- REPLACE_FMA=0; AC_SUBST([REPLACE_FMA])
- REPLACE_FMAF=0; AC_SUBST([REPLACE_FMAF])
- REPLACE_FMAL=0; AC_SUBST([REPLACE_FMAL])
- REPLACE_FMOD=0; AC_SUBST([REPLACE_FMOD])
- REPLACE_FMODF=0; AC_SUBST([REPLACE_FMODF])
- REPLACE_FMODL=0; AC_SUBST([REPLACE_FMODL])
- REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF])
- REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP])
- REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL])
- REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL])
- REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT])
- REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF])
- REPLACE_HYPOTL=0; AC_SUBST([REPLACE_HYPOTL])
- REPLACE_ILOGB=0; AC_SUBST([REPLACE_ILOGB])
- REPLACE_ILOGBF=0; AC_SUBST([REPLACE_ILOGBF])
- REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE])
- REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF])
- REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN])
- REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL])
- REPLACE_LOG=0; AC_SUBST([REPLACE_LOG])
- REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF])
- REPLACE_LOGL=0; AC_SUBST([REPLACE_LOGL])
- REPLACE_LOG10=0; AC_SUBST([REPLACE_LOG10])
- REPLACE_LOG10F=0; AC_SUBST([REPLACE_LOG10F])
- REPLACE_LOG10L=0; AC_SUBST([REPLACE_LOG10L])
- REPLACE_LOG1P=0; AC_SUBST([REPLACE_LOG1P])
- REPLACE_LOG1PF=0; AC_SUBST([REPLACE_LOG1PF])
- REPLACE_LOG1PL=0; AC_SUBST([REPLACE_LOG1PL])
- REPLACE_LOG2=0; AC_SUBST([REPLACE_LOG2])
- REPLACE_LOG2F=0; AC_SUBST([REPLACE_LOG2F])
- REPLACE_LOG2L=0; AC_SUBST([REPLACE_LOG2L])
- REPLACE_LOGB=0; AC_SUBST([REPLACE_LOGB])
- REPLACE_LOGBF=0; AC_SUBST([REPLACE_LOGBF])
- REPLACE_LOGBL=0; AC_SUBST([REPLACE_LOGBL])
- REPLACE_MODF=0; AC_SUBST([REPLACE_MODF])
- REPLACE_MODFF=0; AC_SUBST([REPLACE_MODFF])
- REPLACE_MODFL=0; AC_SUBST([REPLACE_MODFL])
- REPLACE_NAN=0; AC_SUBST([REPLACE_NAN])
- REPLACE_REMAINDER=0; AC_SUBST([REPLACE_REMAINDER])
- REPLACE_REMAINDERF=0; AC_SUBST([REPLACE_REMAINDERF])
- REPLACE_REMAINDERL=0; AC_SUBST([REPLACE_REMAINDERL])
- REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND])
- REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF])
- REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL])
- REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT])
- REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC])
- REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL])
- REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC])
- REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF])
- REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL])
-])
-
-# gl_LONG_DOUBLE_VS_DOUBLE
-# determines whether 'long double' and 'double' have the same representation.
-# Sets variable HAVE_SAME_LONG_DOUBLE_AS_DOUBLE to 0 or 1, and defines
-# HAVE_SAME_LONG_DOUBLE_AS_DOUBLE accordingly.
-# The currently known platforms where this is the case are:
-# Linux/HPPA, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9.
-AC_DEFUN([gl_LONG_DOUBLE_VS_DOUBLE],
-[
- AC_CACHE_CHECK([whether long double and double are the same],
- [gl_cv_long_double_equals_double],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[#include <float.h>]],
- [[typedef int check[sizeof (long double) == sizeof (double)
- && LDBL_MANT_DIG == DBL_MANT_DIG
- && LDBL_MAX_EXP == DBL_MAX_EXP
- && LDBL_MIN_EXP == DBL_MIN_EXP
- ? 1 : -1];
- ]])],
- [gl_cv_long_double_equals_double=yes],
- [gl_cv_long_double_equals_double=no])
- ])
- if test $gl_cv_long_double_equals_double = yes; then
- AC_DEFINE([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE], [1],
- [Define to 1 if 'long double' and 'double' have the same representation.])
- HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=1
- else
- HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=0
- fi
- AC_SUBST([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE])
-])
diff --git a/src/gl/m4/memchr.m4 b/src/gl/m4/memchr.m4
deleted file mode 100644
index 25d32f0ec9..0000000000
--- a/src/gl/m4/memchr.m4
+++ /dev/null
@@ -1,88 +0,0 @@
-# memchr.m4 serial 12
-dnl Copyright (C) 2002-2004, 2009-2016 Free Software Foundation, Inc.
-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_ONCE([gl_FUNC_MEMCHR],
-[
- dnl Check for prerequisites for memory fence checks.
- gl_FUNC_MMAP_ANON
- AC_CHECK_HEADERS_ONCE([sys/mman.h])
- AC_CHECK_FUNCS_ONCE([mprotect])
-
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [
- dnl These days, we assume memchr is present. But if support for old
- dnl platforms is desired:
- AC_CHECK_FUNCS_ONCE([memchr])
- if test $ac_cv_func_memchr = no; then
- HAVE_MEMCHR=0
- fi
- ])
- if test $HAVE_MEMCHR = 1; then
- # Detect platform-specific bugs in some versions of glibc:
- # memchr should not dereference anything with length 0
- # http://bugzilla.redhat.com/499689
- # memchr should not dereference overestimated length after a match
- # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737
- # http://sourceware.org/bugzilla/show_bug.cgi?id=10162
- # Assume that memchr works on platforms that lack mprotect.
- AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works],
- [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#include <string.h>
-#if HAVE_SYS_MMAN_H
-# include <fcntl.h>
-# include <unistd.h>
-# include <sys/types.h>
-# include <sys/mman.h>
-# ifndef MAP_FILE
-# define MAP_FILE 0
-# endif
-#endif
-]], [[
- int result = 0;
- char *fence = NULL;
-#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
-# if HAVE_MAP_ANONYMOUS
- const int flags = MAP_ANONYMOUS | MAP_PRIVATE;
- const int fd = -1;
-# else /* !HAVE_MAP_ANONYMOUS */
- const int flags = MAP_FILE | MAP_PRIVATE;
- int fd = open ("/dev/zero", O_RDONLY, 0666);
- if (fd >= 0)
-# endif
- {
- int pagesize = getpagesize ();
- char *two_pages =
- (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
- flags, fd, 0);
- if (two_pages != (char *)(-1)
- && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
- fence = two_pages + pagesize;
- }
-#endif
- if (fence)
- {
- if (memchr (fence, 0, 0))
- result |= 1;
- strcpy (fence - 9, "12345678");
- if (memchr (fence - 9, 0, 79) != fence - 1)
- result |= 2;
- if (memchr (fence - 1, 0, 3) != fence - 1)
- result |= 4;
- }
- return result;
-]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no],
- [dnl Be pessimistic for now.
- gl_cv_func_memchr_works="guessing no"])])
- if test "$gl_cv_func_memchr_works" != yes; then
- REPLACE_MEMCHR=1
- fi
- fi
-])
-
-# Prerequisites of lib/memchr.c.
-AC_DEFUN([gl_PREREQ_MEMCHR], [
- AC_CHECK_HEADERS([bp-sym.h])
-])
diff --git a/src/gl/m4/minmax.m4 b/src/gl/m4/minmax.m4
deleted file mode 100644
index 9c43e6452c..0000000000
--- a/src/gl/m4/minmax.m4
+++ /dev/null
@@ -1,44 +0,0 @@
-# minmax.m4 serial 4
-dnl Copyright (C) 2005, 2009-2016 Free Software Foundation, Inc.
-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_PREREQ([2.53])
-
-AC_DEFUN([gl_MINMAX],
-[
- AC_REQUIRE([gl_PREREQ_MINMAX])
-])
-
-# Prerequisites of lib/minmax.h.
-AC_DEFUN([gl_PREREQ_MINMAX],
-[
- gl_MINMAX_IN_HEADER([limits.h])
- gl_MINMAX_IN_HEADER([sys/param.h])
-])
-
-dnl gl_MINMAX_IN_HEADER(HEADER)
-dnl The parameter has to be a literal header name; it cannot be macro,
-dnl nor a shell variable. (Because autoheader collects only AC_DEFINE
-dnl invocations with a literal macro name.)
-AC_DEFUN([gl_MINMAX_IN_HEADER],
-[
- m4_pushdef([header], AS_TR_SH([$1]))
- m4_pushdef([HEADER], AS_TR_CPP([$1]))
- AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
- [gl_cv_minmax_in_]header,
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <$1>
- int x = MIN (42, 17);]],
- [[]])],
- [gl_cv_minmax_in_]header[=yes],
- [gl_cv_minmax_in_]header[=no])])
- if test $gl_cv_minmax_in_[]header = yes; then
- AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1,
- [Define to 1 if <$1> defines the MIN and MAX macros.])
- fi
- m4_popdef([HEADER])
- m4_popdef([header])
-])
diff --git a/src/gl/m4/mktime.m4 b/src/gl/m4/mktime.m4
deleted file mode 100644
index 23cad732ff..0000000000
--- a/src/gl/m4/mktime.m4
+++ /dev/null
@@ -1,268 +0,0 @@
-# serial 27
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2016 Free Software Foundation,
-dnl Inc.
-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.
-
-dnl From Jim Meyering.
-
-AC_DEFUN([gl_TIME_T_IS_SIGNED],
-[
- AC_CACHE_CHECK([whether time_t is signed],
- [gl_cv_time_t_is_signed],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[#include <time.h>
- char time_t_signed[(time_t) -1 < 0 ? 1 : -1];]])],
- [gl_cv_time_t_is_signed=yes],
- [gl_cv_time_t_is_signed=no])])
- if test $gl_cv_time_t_is_signed = yes; then
- AC_DEFINE([TIME_T_IS_SIGNED], [1], [Define to 1 if time_t is signed.])
- fi
-])
-
-AC_DEFUN([gl_FUNC_MKTIME],
-[
- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
- AC_REQUIRE([gl_TIME_T_IS_SIGNED])
-
- dnl We don't use AC_FUNC_MKTIME any more, because it is no longer maintained
- dnl in Autoconf and because it invokes AC_LIBOBJ.
- AC_CHECK_HEADERS_ONCE([unistd.h])
- AC_CHECK_DECLS_ONCE([alarm])
- AC_CHECK_FUNCS_ONCE([tzset])
- AC_REQUIRE([gl_MULTIARCH])
- if test $APPLE_UNIVERSAL_BUILD = 1; then
- # A universal build on Apple Mac OS X platforms.
- # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode.
- # But we need a configuration result that is valid in both modes.
- gl_cv_func_working_mktime=no
- fi
- AC_CACHE_CHECK([for working mktime], [gl_cv_func_working_mktime],
- [AC_RUN_IFELSE(
- [AC_LANG_SOURCE(
-[[/* Test program from Paul Eggert and Tony Leneis. */
-#include <limits.h>
-#include <stdlib.h>
-#include <time.h>
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_DECL_ALARM
-# include <signal.h>
-#endif
-
-/* Work around redefinition to rpl_putenv by other config tests. */
-#undef putenv
-
-static time_t time_t_max;
-static time_t time_t_min;
-
-/* Values we'll use to set the TZ environment variable. */
-static char *tz_strings[] = {
- (char *) 0, "TZ=GMT0", "TZ=JST-9",
- "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
-};
-#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
-
-/* Return 0 if mktime fails to convert a date in the spring-forward gap.
- Based on a problem report from Andreas Jaeger. */
-static int
-spring_forward_gap ()
-{
- /* glibc (up to about 1998-10-07) failed this test. */
- struct tm tm;
-
- /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
- instead of "TZ=America/Vancouver" in order to detect the bug even
- on systems that don't support the Olson extension, or don't have the
- full zoneinfo tables installed. */
- putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
-
- tm.tm_year = 98;
- tm.tm_mon = 3;
- tm.tm_mday = 5;
- tm.tm_hour = 2;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_isdst = -1;
- return mktime (&tm) != (time_t) -1;
-}
-
-static int
-mktime_test1 (time_t now)
-{
- struct tm *lt;
- return ! (lt = localtime (&now)) || mktime (lt) == now;
-}
-
-static int
-mktime_test (time_t now)
-{
- return (mktime_test1 (now)
- && mktime_test1 ((time_t) (time_t_max - now))
- && mktime_test1 ((time_t) (time_t_min + now)));
-}
-
-static int
-irix_6_4_bug ()
-{
- /* Based on code from Ariel Faigon. */
- struct tm tm;
- tm.tm_year = 96;
- tm.tm_mon = 3;
- tm.tm_mday = 0;
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_isdst = -1;
- mktime (&tm);
- return tm.tm_mon == 2 && tm.tm_mday == 31;
-}
-
-static int
-bigtime_test (int j)
-{
- struct tm tm;
- time_t now;
- tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
- now = mktime (&tm);
- if (now != (time_t) -1)
- {
- struct tm *lt = localtime (&now);
- if (! (lt
- && lt->tm_year == tm.tm_year
- && lt->tm_mon == tm.tm_mon
- && lt->tm_mday == tm.tm_mday
- && lt->tm_hour == tm.tm_hour
- && lt->tm_min == tm.tm_min
- && lt->tm_sec == tm.tm_sec
- && lt->tm_yday == tm.tm_yday
- && lt->tm_wday == tm.tm_wday
- && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
- == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
- return 0;
- }
- return 1;
-}
-
-static int
-year_2050_test ()
-{
- /* The correct answer for 2050-02-01 00:00:00 in Pacific time,
- ignoring leap seconds. */
- unsigned long int answer = 2527315200UL;
-
- struct tm tm;
- time_t t;
- tm.tm_year = 2050 - 1900;
- tm.tm_mon = 2 - 1;
- tm.tm_mday = 1;
- tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
- tm.tm_isdst = -1;
-
- /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
- instead of "TZ=America/Vancouver" in order to detect the bug even
- on systems that don't support the Olson extension, or don't have the
- full zoneinfo tables installed. */
- putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
-
- t = mktime (&tm);
-
- /* Check that the result is either a failure, or close enough
- to the correct answer that we can assume the discrepancy is
- due to leap seconds. */
- return (t == (time_t) -1
- || (0 < t && answer - 120 <= t && t <= answer + 120));
-}
-
-int
-main ()
-{
- int result = 0;
- time_t t, delta;
- int i, j;
- int time_t_signed_magnitude = (time_t) ~ (time_t) 0 < (time_t) -1;
-
-#if HAVE_DECL_ALARM
- /* This test makes some buggy mktime implementations loop.
- Give up after 60 seconds; a mktime slower than that
- isn't worth using anyway. */
- signal (SIGALRM, SIG_DFL);
- alarm (60);
-#endif
-
- time_t_max = (! TIME_T_IS_SIGNED
- ? (time_t) -1
- : ((((time_t) 1 << (sizeof (time_t) * CHAR_BIT - 2)) - 1)
- * 2 + 1));
- time_t_min = (! TIME_T_IS_SIGNED
- ? (time_t) 0
- : time_t_signed_magnitude
- ? ~ (time_t) 0
- : ~ time_t_max);
-
- delta = time_t_max / 997; /* a suitable prime number */
- for (i = 0; i < N_STRINGS; i++)
- {
- if (tz_strings[i])
- putenv (tz_strings[i]);
-
- for (t = 0; t <= time_t_max - delta && (result & 1) == 0; t += delta)
- if (! mktime_test (t))
- result |= 1;
- if ((result & 2) == 0
- && ! (mktime_test ((time_t) 1)
- && mktime_test ((time_t) (60 * 60))
- && mktime_test ((time_t) (60 * 60 * 24))))
- result |= 2;
-
- for (j = 1; (result & 4) == 0; j <<= 1)
- {
- if (! bigtime_test (j))
- result |= 4;
- if (INT_MAX / 2 < j)
- break;
- }
- if ((result & 8) == 0 && ! bigtime_test (INT_MAX))
- result |= 8;
- }
- if (! irix_6_4_bug ())
- result |= 16;
- if (! spring_forward_gap ())
- result |= 32;
- if (! year_2050_test ())
- result |= 64;
- return result;
-}]])],
- [gl_cv_func_working_mktime=yes],
- [gl_cv_func_working_mktime=no],
- [gl_cv_func_working_mktime=no])
- ])
-
- if test $gl_cv_func_working_mktime = no; then
- REPLACE_MKTIME=1
- else
- REPLACE_MKTIME=0
- fi
-])
-
-AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [
- AC_REQUIRE([gl_FUNC_MKTIME])
- if test $REPLACE_MKTIME = 0; then
- dnl BeOS has __mktime_internal in libc, but other platforms don't.
- AC_CHECK_FUNC([__mktime_internal],
- [AC_DEFINE([mktime_internal], [__mktime_internal],
- [Define to the real name of the mktime_internal function.])
- ],
- [dnl mktime works but it doesn't export __mktime_internal,
- dnl so we need to substitute our own mktime implementation.
- REPLACE_MKTIME=1
- ])
- fi
-])
-
-# Prerequisites of lib/mktime.c.
-AC_DEFUN([gl_PREREQ_MKTIME], [:])
diff --git a/src/gl/m4/mmap-anon.m4 b/src/gl/m4/mmap-anon.m4
deleted file mode 100644
index 853c89dc9b..0000000000
--- a/src/gl/m4/mmap-anon.m4
+++ /dev/null
@@ -1,55 +0,0 @@
-# mmap-anon.m4 serial 10
-dnl Copyright (C) 2005, 2007, 2009-2016 Free Software Foundation, Inc.
-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.
-
-# Detect how mmap can be used to create anonymous (not file-backed) memory
-# mappings.
-# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS
-# and MAP_ANON exist and have the same value.
-# - On HP-UX, only MAP_ANONYMOUS exists.
-# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists.
-# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be
-# used.
-
-AC_DEFUN([gl_FUNC_MMAP_ANON],
-[
- dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it
- # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is
- # irrelevant for anonymous mappings.
- AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no])
-
- # Try to allow MAP_ANONYMOUS.
- gl_have_mmap_anonymous=no
- if test $gl_have_mmap = yes; then
- AC_MSG_CHECKING([for MAP_ANONYMOUS])
- AC_EGREP_CPP([I cannot identify this map], [
-#include <sys/mman.h>
-#ifdef MAP_ANONYMOUS
- I cannot identify this map
-#endif
-],
- [gl_have_mmap_anonymous=yes])
- if test $gl_have_mmap_anonymous != yes; then
- AC_EGREP_CPP([I cannot identify this map], [
-#include <sys/mman.h>
-#ifdef MAP_ANON
- I cannot identify this map
-#endif
-],
- [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON],
- [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.])
- gl_have_mmap_anonymous=yes])
- fi
- AC_MSG_RESULT([$gl_have_mmap_anonymous])
- if test $gl_have_mmap_anonymous = yes; then
- AC_DEFINE([HAVE_MAP_ANONYMOUS], [1],
- [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including
- config.h and <sys/mman.h>.])
- fi
- fi
-])
diff --git a/src/gl/m4/msvc-inval.m4 b/src/gl/m4/msvc-inval.m4
deleted file mode 100644
index f5e4c89309..0000000000
--- a/src/gl/m4/msvc-inval.m4
+++ /dev/null
@@ -1,19 +0,0 @@
-# msvc-inval.m4 serial 1
-dnl Copyright (C) 2011-2016 Free Software Foundation, Inc.
-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_MSVC_INVAL],
-[
- AC_CHECK_FUNCS_ONCE([_set_invalid_parameter_handler])
- if test $ac_cv_func__set_invalid_parameter_handler = yes; then
- HAVE_MSVC_INVALID_PARAMETER_HANDLER=1
- AC_DEFINE([HAVE_MSVC_INVALID_PARAMETER_HANDLER], [1],
- [Define to 1 on MSVC platforms that have the "invalid parameter handler"
- concept.])
- else
- HAVE_MSVC_INVALID_PARAMETER_HANDLER=0
- fi
- AC_SUBST([HAVE_MSVC_INVALID_PARAMETER_HANDLER])
-])
diff --git a/src/gl/m4/msvc-nothrow.m4 b/src/gl/m4/msvc-nothrow.m4
deleted file mode 100644
index 58f5c0bc20..0000000000
--- a/src/gl/m4/msvc-nothrow.m4
+++ /dev/null
@@ -1,10 +0,0 @@
-# msvc-nothrow.m4 serial 1
-dnl Copyright (C) 2011-2016 Free Software Foundation, Inc.
-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_MSVC_NOTHROW],
-[
- AC_REQUIRE([gl_MSVC_INVAL])
-])
diff --git a/src/gl/m4/multiarch.m4 b/src/gl/m4/multiarch.m4
deleted file mode 100644
index 43b5d05750..0000000000
--- a/src/gl/m4/multiarch.m4
+++ /dev/null
@@ -1,62 +0,0 @@
-# multiarch.m4 serial 7
-dnl Copyright (C) 2008-2016 Free Software Foundation, Inc.
-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.
-
-# Determine whether the compiler is or may be producing universal binaries.
-#
-# On Mac OS X 10.5 and later systems, the user can create libraries and
-# executables that work on multiple system types--known as "fat" or
-# "universal" binaries--by specifying multiple '-arch' options to the
-# compiler but only a single '-arch' option to the preprocessor. Like
-# this:
-#
-# ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
-# CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
-# CPP="gcc -E" CXXCPP="g++ -E"
-#
-# Detect this situation and set APPLE_UNIVERSAL_BUILD accordingly.
-
-AC_DEFUN_ONCE([gl_MULTIARCH],
-[
- dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN.
- gl_cv_c_multiarch=no
- AC_COMPILE_IFELSE(
- [AC_LANG_SOURCE(
- [[#ifndef __APPLE_CC__
- not a universal capable compiler
- #endif
- typedef int dummy;
- ]])],
- [
- dnl Check for potential -arch flags. It is not universal unless
- dnl there are at least two -arch flags with different values.
- arch=
- prev=
- for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do
- if test -n "$prev"; then
- case $word in
- i?86 | x86_64 | ppc | ppc64)
- if test -z "$arch" || test "$arch" = "$word"; then
- arch="$word"
- else
- gl_cv_c_multiarch=yes
- fi
- ;;
- esac
- prev=
- else
- if test "x$word" = "x-arch"; then
- prev=arch
- fi
- fi
- done
- ])
- if test $gl_cv_c_multiarch = yes; then
- APPLE_UNIVERSAL_BUILD=1
- else
- APPLE_UNIVERSAL_BUILD=0
- fi
- AC_SUBST([APPLE_UNIVERSAL_BUILD])
-])
diff --git a/src/gl/m4/netdb_h.m4 b/src/gl/m4/netdb_h.m4
deleted file mode 100644
index 4e5206cebe..0000000000
--- a/src/gl/m4/netdb_h.m4
+++ /dev/null
@@ -1,43 +0,0 @@
-# netdb_h.m4 serial 11
-dnl Copyright (C) 2008-2016 Free Software Foundation, Inc.
-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_HEADER_NETDB],
-[
- AC_REQUIRE([gl_NETDB_H_DEFAULTS])
- gl_CHECK_NEXT_HEADERS([netdb.h])
- if test $ac_cv_header_netdb_h = yes; then
- HAVE_NETDB_H=1
- else
- HAVE_NETDB_H=0
- fi
- AC_SUBST([HAVE_NETDB_H])
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[#include <netdb.h>]],
- [getaddrinfo freeaddrinfo gai_strerror getnameinfo])
-])
-
-AC_DEFUN([gl_NETDB_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_NETDB_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_NETDB_H_DEFAULTS],
-[
- GNULIB_GETADDRINFO=0; AC_SUBST([GNULIB_GETADDRINFO])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_STRUCT_ADDRINFO=1; AC_SUBST([HAVE_STRUCT_ADDRINFO])
- HAVE_DECL_FREEADDRINFO=1; AC_SUBST([HAVE_DECL_FREEADDRINFO])
- HAVE_DECL_GAI_STRERROR=1; AC_SUBST([HAVE_DECL_GAI_STRERROR])
- HAVE_DECL_GETADDRINFO=1; AC_SUBST([HAVE_DECL_GETADDRINFO])
- HAVE_DECL_GETNAMEINFO=1; AC_SUBST([HAVE_DECL_GETNAMEINFO])
- REPLACE_GAI_STRERROR=0; AC_SUBST([REPLACE_GAI_STRERROR])
-])
diff --git a/src/gl/m4/netinet_in_h.m4 b/src/gl/m4/netinet_in_h.m4
deleted file mode 100644
index 93dcc68947..0000000000
--- a/src/gl/m4/netinet_in_h.m4
+++ /dev/null
@@ -1,31 +0,0 @@
-# netinet_in_h.m4 serial 5
-dnl Copyright (C) 2006-2016 Free Software Foundation, Inc.
-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_HEADER_NETINET_IN],
-[
- AC_CACHE_CHECK([whether <netinet/in.h> is self-contained],
- [gl_cv_header_netinet_in_h_selfcontained],
- [
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[]])],
- [gl_cv_header_netinet_in_h_selfcontained=yes],
- [gl_cv_header_netinet_in_h_selfcontained=no])
- ])
- if test $gl_cv_header_netinet_in_h_selfcontained = yes; then
- NETINET_IN_H=''
- else
- NETINET_IN_H='netinet/in.h'
- AC_CHECK_HEADERS([netinet/in.h])
- gl_CHECK_NEXT_HEADERS([netinet/in.h])
- if test $ac_cv_header_netinet_in_h = yes; then
- HAVE_NETINET_IN_H=1
- else
- HAVE_NETINET_IN_H=0
- fi
- AC_SUBST([HAVE_NETINET_IN_H])
- fi
- AC_SUBST([NETINET_IN_H])
- AM_CONDITIONAL([GL_GENERATE_NETINET_IN_H], [test -n "$NETINET_IN_H"])
-])
diff --git a/src/gl/m4/off_t.m4 b/src/gl/m4/off_t.m4
deleted file mode 100644
index 282751b47b..0000000000
--- a/src/gl/m4/off_t.m4
+++ /dev/null
@@ -1,18 +0,0 @@
-# off_t.m4 serial 1
-dnl Copyright (C) 2012-2016 Free Software Foundation, Inc.
-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.
-
-dnl Check whether to override the 'off_t' type.
-dnl Set WINDOWS_64_BIT_OFF_T.
-
-AC_DEFUN([gl_TYPE_OFF_T],
-[
- m4_ifdef([gl_LARGEFILE], [
- AC_REQUIRE([gl_LARGEFILE])
- ], [
- WINDOWS_64_BIT_OFF_T=0
- ])
- AC_SUBST([WINDOWS_64_BIT_OFF_T])
-])
diff --git a/src/gl/m4/parse-datetime.m4 b/src/gl/m4/parse-datetime.m4
deleted file mode 100644
index 6606ab286c..0000000000
--- a/src/gl/m4/parse-datetime.m4
+++ /dev/null
@@ -1,55 +0,0 @@
-# parse-datetime.m4 serial 21
-dnl Copyright (C) 2002-2006, 2008-2016 Free Software Foundation, Inc.
-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.
-
-dnl Define HAVE_COMPOUND_LITERALS if the C compiler supports compound literals
-dnl as in ISO C99.
-dnl Note that compound literals such as (struct s) { 3, 4 } can be used for
-dnl initialization of stack-allocated variables, but are not constant
-dnl expressions and therefore cannot be used as initializer for global or
-dnl static variables (even though gcc supports this in pre-C99 mode).
-AC_DEFUN([gl_C_COMPOUND_LITERALS],
-[
- AC_CACHE_CHECK([for compound literals], [gl_cv_compound_literals],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[struct s { int i, j; };]],
- [[struct s t = (struct s) { 3, 4 };
- if (t.i != 0) return 0;]])],
- gl_cv_compound_literals=yes,
- gl_cv_compound_literals=no)])
- if test $gl_cv_compound_literals = yes; then
- AC_DEFINE([HAVE_COMPOUND_LITERALS], [1],
- [Define if you have compound literals.])
- fi
-])
-
-AC_DEFUN([gl_PARSE_DATETIME],
-[
- dnl Prerequisites of lib/parse-datetime.h.
- AC_REQUIRE([AM_STDBOOL_H])
- AC_REQUIRE([gl_TIMESPEC])
-
- dnl Prerequisites of lib/parse-datetime.y.
- AC_REQUIRE([gl_BISON])
- AC_REQUIRE([gl_C_COMPOUND_LITERALS])
- AC_STRUCT_TIMEZONE
- AC_REQUIRE([gl_CLOCK_TIME])
- AC_REQUIRE([gl_TM_GMTOFF])
- AC_COMPILE_IFELSE(
- [AC_LANG_SOURCE([[
-#include <time.h> /* for time_t */
-#include <limits.h> /* for CHAR_BIT, LONG_MIN, LONG_MAX */
-#define TYPE_MINIMUM(t) \
- ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
-#define TYPE_MAXIMUM(t) \
- ((t) ((t) 0 < (t) -1 \
- ? (t) -1 \
- : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
-typedef int verify_min[2 * (LONG_MIN <= TYPE_MINIMUM (time_t)) - 1];
-typedef int verify_max[2 * (TYPE_MAXIMUM (time_t) <= LONG_MAX) - 1];
- ]])],
- [AC_DEFINE([TIME_T_FITS_IN_LONG_INT], [1],
- [Define to 1 if all 'time_t' values fit in a 'long int'.])
- ])
-])
diff --git a/src/gl/m4/printf.m4 b/src/gl/m4/printf.m4
deleted file mode 100644
index c7a14b20e0..0000000000
--- a/src/gl/m4/printf.m4
+++ /dev/null
@@ -1,1557 +0,0 @@
-# printf.m4 serial 52
-dnl Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
-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.
-
-dnl Test whether the *printf family of functions supports the 'j', 'z', 't',
-dnl 'L' size specifiers. (ISO C99, POSIX:2001)
-dnl Result is gl_cv_func_printf_sizes_c99.
-
-AC_DEFUN([gl_PRINTF_SIZES_C99],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([gl_AC_HEADER_STDINT_H])
- AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf supports size specifiers as in C99],
- [gl_cv_func_printf_sizes_c99],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#if HAVE_STDINT_H_WITH_UINTMAX
-# include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H_WITH_UINTMAX
-# include <inttypes.h>
-#endif
-static char buf[100];
-int main ()
-{
- int result = 0;
-#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX
- buf[0] = '\0';
- if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0
- || strcmp (buf, "12345671 33") != 0)
- result |= 1;
-#else
- result |= 1;
-#endif
- buf[0] = '\0';
- if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0
- || strcmp (buf, "12345672 33") != 0)
- result |= 2;
- buf[0] = '\0';
- if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0
- || strcmp (buf, "12345673 33") != 0)
- result |= 4;
- buf[0] = '\0';
- if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0
- || strcmp (buf, "1.5 33") != 0)
- result |= 8;
- return result;
-}]])],
- [gl_cv_func_printf_sizes_c99=yes],
- [gl_cv_func_printf_sizes_c99=no],
- [
-changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on Mac OS X >= 10.3.
- darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";;
- darwin*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on OpenBSD >= 3.9.
- openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
- gl_cv_func_printf_sizes_c99="guessing no";;
- openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on Solaris >= 2.10.
- solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
- solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_printf_sizes_c99="guessing no";;
- netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_sizes_c99="guessing no";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the *printf family of functions supports 'long double'
-dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001)
-dnl Result is gl_cv_func_printf_long_double.
-
-AC_DEFUN([gl_PRINTF_LONG_DOUBLE],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf supports 'long double' arguments],
- [gl_cv_func_printf_long_double],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <string.h>
-static char buf[10000];
-int main ()
-{
- int result = 0;
- buf[0] = '\0';
- if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0
- || strcmp (buf, "1.750000 33") != 0)
- result |= 1;
- buf[0] = '\0';
- if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0
- || strcmp (buf, "1.750000e+00 33") != 0)
- result |= 2;
- buf[0] = '\0';
- if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0
- || strcmp (buf, "1.75 33") != 0)
- result |= 4;
- return result;
-}]])],
- [gl_cv_func_printf_long_double=yes],
- [gl_cv_func_printf_long_double=no],
- [
-changequote(,)dnl
- case "$host_os" in
- beos*) gl_cv_func_printf_long_double="guessing no";;
- mingw* | pw*) gl_cv_func_printf_long_double="guessing no";;
- *) gl_cv_func_printf_long_double="guessing yes";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the *printf family of functions supports infinite and NaN
-dnl 'double' arguments and negative zero arguments in the %f, %e, %g
-dnl directives. (ISO C99, POSIX:2001)
-dnl Result is gl_cv_func_printf_infinite.
-
-AC_DEFUN([gl_PRINTF_INFINITE],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf supports infinite 'double' arguments],
- [gl_cv_func_printf_infinite],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <string.h>
-static int
-strisnan (const char *string, size_t start_index, size_t end_index)
-{
- if (start_index < end_index)
- {
- if (string[start_index] == '-')
- start_index++;
- if (start_index + 3 <= end_index
- && memcmp (string + start_index, "nan", 3) == 0)
- {
- start_index += 3;
- if (start_index == end_index
- || (string[start_index] == '(' && string[end_index - 1] == ')'))
- return 1;
- }
- }
- return 0;
-}
-static int
-have_minus_zero ()
-{
- static double plus_zero = 0.0;
- double minus_zero = - plus_zero;
- return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0;
-}
-static char buf[10000];
-static double zero = 0.0;
-int main ()
-{
- int result = 0;
- if (sprintf (buf, "%f", 1.0 / zero) < 0
- || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
- result |= 1;
- if (sprintf (buf, "%f", -1.0 / zero) < 0
- || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
- result |= 1;
- if (sprintf (buf, "%f", zero / zero) < 0
- || !strisnan (buf, 0, strlen (buf)))
- result |= 2;
- if (sprintf (buf, "%e", 1.0 / zero) < 0
- || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
- result |= 4;
- if (sprintf (buf, "%e", -1.0 / zero) < 0
- || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
- result |= 4;
- if (sprintf (buf, "%e", zero / zero) < 0
- || !strisnan (buf, 0, strlen (buf)))
- result |= 8;
- if (sprintf (buf, "%g", 1.0 / zero) < 0
- || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
- result |= 16;
- if (sprintf (buf, "%g", -1.0 / zero) < 0
- || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
- result |= 16;
- if (sprintf (buf, "%g", zero / zero) < 0
- || !strisnan (buf, 0, strlen (buf)))
- result |= 32;
- /* This test fails on HP-UX 10.20. */
- if (have_minus_zero ())
- if (sprintf (buf, "%g", - zero) < 0
- || strcmp (buf, "-0") != 0)
- result |= 64;
- return result;
-}]])],
- [gl_cv_func_printf_infinite=yes],
- [gl_cv_func_printf_infinite=no],
- [
-changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on FreeBSD >= 6.
- freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on Mac OS X >= 10.3.
- darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";;
- darwin*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on HP-UX >= 11.
- hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";;
- hpux*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_printf_infinite="guessing no";;
- netbsd*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_printf_infinite="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_infinite="guessing no";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the *printf family of functions supports infinite and NaN
-dnl 'long double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001)
-dnl Result is gl_cv_func_printf_infinite_long_double.
-
-AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE],
-[
- AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([gl_BIGENDIAN])
- AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- dnl The user can set or unset the variable gl_printf_safe to indicate
- dnl that he wishes a safe handling of non-IEEE-754 'long double' values.
- if test -n "$gl_printf_safe"; then
- AC_DEFINE([CHECK_PRINTF_SAFE], [1],
- [Define if you wish *printf() functions that have a safe handling of
- non-IEEE-754 'long double' values.])
- fi
- case "$gl_cv_func_printf_long_double" in
- *yes)
- AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments],
- [gl_cv_func_printf_infinite_long_double],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-]GL_NOCRASH[
-#include <float.h>
-#include <stdio.h>
-#include <string.h>
-static int
-strisnan (const char *string, size_t start_index, size_t end_index)
-{
- if (start_index < end_index)
- {
- if (string[start_index] == '-')
- start_index++;
- if (start_index + 3 <= end_index
- && memcmp (string + start_index, "nan", 3) == 0)
- {
- start_index += 3;
- if (start_index == end_index
- || (string[start_index] == '(' && string[end_index - 1] == ')'))
- return 1;
- }
- }
- return 0;
-}
-static char buf[10000];
-static long double zeroL = 0.0L;
-int main ()
-{
- int result = 0;
- nocrash_init();
- if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0
- || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
- result |= 1;
- if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0
- || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
- result |= 1;
- if (sprintf (buf, "%Lf", zeroL / zeroL) < 0
- || !strisnan (buf, 0, strlen (buf)))
- result |= 1;
- if (sprintf (buf, "%Le", 1.0L / zeroL) < 0
- || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
- result |= 1;
- if (sprintf (buf, "%Le", -1.0L / zeroL) < 0
- || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
- result |= 1;
- if (sprintf (buf, "%Le", zeroL / zeroL) < 0
- || !strisnan (buf, 0, strlen (buf)))
- result |= 1;
- if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0
- || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
- result |= 1;
- if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0
- || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
- result |= 1;
- if (sprintf (buf, "%Lg", zeroL / zeroL) < 0
- || !strisnan (buf, 0, strlen (buf)))
- result |= 1;
-#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
-/* Representation of an 80-bit 'long double' as an initializer for a sequence
- of 'unsigned int' words. */
-# ifdef WORDS_BIGENDIAN
-# define LDBL80_WORDS(exponent,manthi,mantlo) \
- { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
- ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \
- (unsigned int) (mantlo) << 16 \
- }
-# else
-# define LDBL80_WORDS(exponent,manthi,mantlo) \
- { mantlo, manthi, exponent }
-# endif
- { /* Quiet NaN. */
- static union { unsigned int word[4]; long double value; } x =
- { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
- if (sprintf (buf, "%Lf", x.value) < 0
- || !strisnan (buf, 0, strlen (buf)))
- result |= 2;
- if (sprintf (buf, "%Le", x.value) < 0
- || !strisnan (buf, 0, strlen (buf)))
- result |= 2;
- if (sprintf (buf, "%Lg", x.value) < 0
- || !strisnan (buf, 0, strlen (buf)))
- result |= 2;
- }
- {
- /* Signalling NaN. */
- static union { unsigned int word[4]; long double value; } x =
- { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
- if (sprintf (buf, "%Lf", x.value) < 0
- || !strisnan (buf, 0, strlen (buf)))
- result |= 2;
- if (sprintf (buf, "%Le", x.value) < 0
- || !strisnan (buf, 0, strlen (buf)))
- result |= 2;
- if (sprintf (buf, "%Lg", x.value) < 0
- || !strisnan (buf, 0, strlen (buf)))
- result |= 2;
- }
- { /* Pseudo-NaN. */
- static union { unsigned int word[4]; long double value; } x =
- { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
- if (sprintf (buf, "%Lf", x.value) <= 0)
- result |= 4;
- if (sprintf (buf, "%Le", x.value) <= 0)
- result |= 4;
- if (sprintf (buf, "%Lg", x.value) <= 0)
- result |= 4;
- }
- { /* Pseudo-Infinity. */
- static union { unsigned int word[4]; long double value; } x =
- { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
- if (sprintf (buf, "%Lf", x.value) <= 0)
- result |= 8;
- if (sprintf (buf, "%Le", x.value) <= 0)
- result |= 8;
- if (sprintf (buf, "%Lg", x.value) <= 0)
- result |= 8;
- }
- { /* Pseudo-Zero. */
- static union { unsigned int word[4]; long double value; } x =
- { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
- if (sprintf (buf, "%Lf", x.value) <= 0)
- result |= 16;
- if (sprintf (buf, "%Le", x.value) <= 0)
- result |= 16;
- if (sprintf (buf, "%Lg", x.value) <= 0)
- result |= 16;
- }
- { /* Unnormalized number. */
- static union { unsigned int word[4]; long double value; } x =
- { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
- if (sprintf (buf, "%Lf", x.value) <= 0)
- result |= 32;
- if (sprintf (buf, "%Le", x.value) <= 0)
- result |= 32;
- if (sprintf (buf, "%Lg", x.value) <= 0)
- result |= 32;
- }
- { /* Pseudo-Denormal. */
- static union { unsigned int word[4]; long double value; } x =
- { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
- if (sprintf (buf, "%Lf", x.value) <= 0)
- result |= 64;
- if (sprintf (buf, "%Le", x.value) <= 0)
- result |= 64;
- if (sprintf (buf, "%Lg", x.value) <= 0)
- result |= 64;
- }
-#endif
- return result;
-}]])],
- [gl_cv_func_printf_infinite_long_double=yes],
- [gl_cv_func_printf_infinite_long_double=no],
- [
-changequote(,)dnl
- case "$host_cpu" in
- # Guess no on ia64, x86_64, i386.
- ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
- *)
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # Guess yes on FreeBSD >= 6.
- freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # Guess yes on HP-UX >= 11.
- hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
- hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_infinite_long_double="guessing no";;
- esac
- ;;
- esac
-changequote([,])dnl
- ])
- ])
- ;;
- *)
- gl_cv_func_printf_infinite_long_double="irrelevant"
- ;;
- esac
-])
-
-dnl Test whether the *printf family of functions supports the 'a' and 'A'
-dnl conversion specifier for hexadecimal output of floating-point numbers.
-dnl (ISO C99, POSIX:2001)
-dnl Result is gl_cv_func_printf_directive_a.
-
-AC_DEFUN([gl_PRINTF_DIRECTIVE_A],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives],
- [gl_cv_func_printf_directive_a],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <string.h>
-static char buf[100];
-static double zero = 0.0;
-int main ()
-{
- int result = 0;
- if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0
- || (strcmp (buf, "0x1.922p+1 33") != 0
- && strcmp (buf, "0x3.244p+0 33") != 0
- && strcmp (buf, "0x6.488p-1 33") != 0
- && strcmp (buf, "0xc.91p-2 33") != 0))
- result |= 1;
- if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0
- || (strcmp (buf, "-0X1.922P+1 33") != 0
- && strcmp (buf, "-0X3.244P+0 33") != 0
- && strcmp (buf, "-0X6.488P-1 33") != 0
- && strcmp (buf, "-0XC.91P-2 33") != 0))
- result |= 2;
- /* This catches a FreeBSD 6.1 bug: it doesn't round. */
- if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
- || (strcmp (buf, "0x1.83p+0 33") != 0
- && strcmp (buf, "0x3.05p-1 33") != 0
- && strcmp (buf, "0x6.0ap-2 33") != 0
- && strcmp (buf, "0xc.14p-3 33") != 0))
- result |= 4;
- /* This catches a FreeBSD 6.1 bug. See
- <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
- if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0
- || buf[0] == '0')
- result |= 8;
- /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */
- if (sprintf (buf, "%.1a", 1.999) < 0
- || (strcmp (buf, "0x1.0p+1") != 0
- && strcmp (buf, "0x2.0p+0") != 0
- && strcmp (buf, "0x4.0p-1") != 0
- && strcmp (buf, "0x8.0p-2") != 0))
- result |= 16;
- /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a
- glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */
- if (sprintf (buf, "%.1La", 1.999L) < 0
- || (strcmp (buf, "0x1.0p+1") != 0
- && strcmp (buf, "0x2.0p+0") != 0
- && strcmp (buf, "0x4.0p-1") != 0
- && strcmp (buf, "0x8.0p-2") != 0))
- result |= 32;
- return result;
-}]])],
- [gl_cv_func_printf_directive_a=yes],
- [gl_cv_func_printf_directive_a=no],
- [
- case "$host_os" in
- # Guess yes on glibc >= 2.5 systems.
- *-gnu*)
- AC_EGREP_CPP([BZ2908], [
- #include <features.h>
- #ifdef __GNU_LIBRARY__
- #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__
- BZ2908
- #endif
- #endif
- ],
- [gl_cv_func_printf_directive_a="guessing yes"],
- [gl_cv_func_printf_directive_a="guessing no"])
- ;;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_directive_a="guessing no";;
- esac
- ])
- ])
-])
-
-dnl Test whether the *printf family of functions supports the %F format
-dnl directive. (ISO C99, POSIX:2001)
-dnl Result is gl_cv_func_printf_directive_f.
-
-AC_DEFUN([gl_PRINTF_DIRECTIVE_F],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf supports the 'F' directive],
- [gl_cv_func_printf_directive_f],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <string.h>
-static char buf[100];
-static double zero = 0.0;
-int main ()
-{
- int result = 0;
- if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0
- || strcmp (buf, "1234567.000000 33") != 0)
- result |= 1;
- if (sprintf (buf, "%F", 1.0 / zero) < 0
- || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0))
- result |= 2;
- /* This catches a Cygwin 1.5.x bug. */
- if (sprintf (buf, "%.F", 1234.0) < 0
- || strcmp (buf, "1234") != 0)
- result |= 4;
- return result;
-}]])],
- [gl_cv_func_printf_directive_f=yes],
- [gl_cv_func_printf_directive_f=no],
- [
-changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_directive_f="guessing yes";;
- # Guess yes on FreeBSD >= 6.
- freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
- # Guess yes on Mac OS X >= 10.3.
- darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";;
- darwin*) gl_cv_func_printf_directive_f="guessing yes";;
- # Guess yes on Solaris >= 2.10.
- solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
- solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_directive_f="guessing no";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the *printf family of functions supports the %n format
-dnl directive. (ISO C99, POSIX:2001)
-dnl Result is gl_cv_func_printf_directive_n.
-
-AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf supports the 'n' directive],
- [gl_cv_func_printf_directive_n],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef _MSC_VER
-/* See page about "Parameter Validation" on msdn.microsoft.com. */
-static void cdecl
-invalid_parameter_handler (const wchar_t *expression,
- const wchar_t *function,
- const wchar_t *file, unsigned int line,
- uintptr_t dummy)
-{
- exit (1);
-}
-#endif
-static char fmtstring[10];
-static char buf[100];
-int main ()
-{
- int count = -1;
-#ifdef _MSC_VER
- _set_invalid_parameter_handler (invalid_parameter_handler);
-#endif
- /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2)
- support %n in format strings in read-only memory but not in writable
- memory. */
- strcpy (fmtstring, "%d %n");
- if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0
- || strcmp (buf, "123 ") != 0
- || count != 4)
- return 1;
- return 0;
-}]])],
- [gl_cv_func_printf_directive_n=yes],
- [gl_cv_func_printf_directive_n=no],
- [
-changequote(,)dnl
- case "$host_os" in
- mingw*) gl_cv_func_printf_directive_n="guessing no";;
- *) gl_cv_func_printf_directive_n="guessing yes";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the *printf family of functions supports the %ls format
-dnl directive and in particular, when a precision is specified, whether
-dnl the functions stop converting the wide string argument when the number
-dnl of bytes that have been produced by this conversion equals or exceeds
-dnl the precision.
-dnl Result is gl_cv_func_printf_directive_ls.
-
-AC_DEFUN([gl_PRINTF_DIRECTIVE_LS],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf supports the 'ls' directive],
- [gl_cv_func_printf_directive_ls],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
- <wchar.h>.
- BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
- included before <wchar.h>. */
-#include <stddef.h>
-#include <stdio.h>
-#include <time.h>
-#include <wchar.h>
-#include <string.h>
-int main ()
-{
- int result = 0;
- char buf[100];
- /* Test whether %ls works at all.
- This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on
- Cygwin 1.5. */
- {
- static const wchar_t wstring[] = { 'a', 'b', 'c', 0 };
- buf[0] = '\0';
- if (sprintf (buf, "%ls", wstring) < 0
- || strcmp (buf, "abc") != 0)
- result |= 1;
- }
- /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an
- assertion failure inside libc), but not on OpenBSD 4.0. */
- {
- static const wchar_t wstring[] = { 'a', 0 };
- buf[0] = '\0';
- if (sprintf (buf, "%ls", wstring) < 0
- || strcmp (buf, "a") != 0)
- result |= 2;
- }
- /* Test whether precisions in %ls are supported as specified in ISO C 99
- section 7.19.6.1:
- "If a precision is specified, no more than that many bytes are written
- (including shift sequences, if any), and the array shall contain a
- null wide character if, to equal the multibyte character sequence
- length given by the precision, the function would need to access a
- wide character one past the end of the array."
- This test fails on Solaris 10. */
- {
- static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 };
- buf[0] = '\0';
- if (sprintf (buf, "%.2ls", wstring) < 0
- || strcmp (buf, "ab") != 0)
- result |= 8;
- }
- return result;
-}]])],
- [gl_cv_func_printf_directive_ls=yes],
- [gl_cv_func_printf_directive_ls=no],
- [
-changequote(,)dnl
- case "$host_os" in
- openbsd*) gl_cv_func_printf_directive_ls="guessing no";;
- irix*) gl_cv_func_printf_directive_ls="guessing no";;
- solaris*) gl_cv_func_printf_directive_ls="guessing no";;
- cygwin*) gl_cv_func_printf_directive_ls="guessing no";;
- beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
- *) gl_cv_func_printf_directive_ls="guessing yes";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the *printf family of functions supports POSIX/XSI format
-dnl strings with positions. (POSIX:2001)
-dnl Result is gl_cv_func_printf_positions.
-
-AC_DEFUN([gl_PRINTF_POSITIONS],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions],
- [gl_cv_func_printf_positions],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <string.h>
-/* The string "%2$d %1$d", with dollar characters protected from the shell's
- dollar expansion (possibly an autoconf bug). */
-static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
-static char buf[100];
-int main ()
-{
- sprintf (buf, format, 33, 55);
- return (strcmp (buf, "55 33") != 0);
-}]])],
- [gl_cv_func_printf_positions=yes],
- [gl_cv_func_printf_positions=no],
- [
-changequote(,)dnl
- case "$host_os" in
- netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
- gl_cv_func_printf_positions="guessing no";;
- beos*) gl_cv_func_printf_positions="guessing no";;
- mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
- *) gl_cv_func_printf_positions="guessing yes";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the *printf family of functions supports POSIX/XSI format
-dnl strings with the ' flag for grouping of decimal digits. (POSIX:2001)
-dnl Result is gl_cv_func_printf_flag_grouping.
-
-AC_DEFUN([gl_PRINTF_FLAG_GROUPING],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf supports the grouping flag],
- [gl_cv_func_printf_flag_grouping],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <string.h>
-static char buf[100];
-int main ()
-{
- if (sprintf (buf, "%'d %d", 1234567, 99) < 0
- || buf[strlen (buf) - 1] != '9')
- return 1;
- return 0;
-}]])],
- [gl_cv_func_printf_flag_grouping=yes],
- [gl_cv_func_printf_flag_grouping=no],
- [
-changequote(,)dnl
- case "$host_os" in
- cygwin*) gl_cv_func_printf_flag_grouping="guessing no";;
- netbsd*) gl_cv_func_printf_flag_grouping="guessing no";;
- mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
- *) gl_cv_func_printf_flag_grouping="guessing yes";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the *printf family of functions supports the - flag correctly.
-dnl (ISO C99.) See
-dnl <http://lists.gnu.org/archive/html/bug-coreutils/2008-02/msg00035.html>
-dnl Result is gl_cv_func_printf_flag_leftadjust.
-
-AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly],
- [gl_cv_func_printf_flag_leftadjust],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <string.h>
-static char buf[100];
-int main ()
-{
- /* Check that a '-' flag is not annihilated by a negative width. */
- if (sprintf (buf, "a%-*sc", -3, "b") < 0
- || strcmp (buf, "ab c") != 0)
- return 1;
- return 0;
-}]])],
- [gl_cv_func_printf_flag_leftadjust=yes],
- [gl_cv_func_printf_flag_leftadjust=no],
- [
-changequote(,)dnl
- case "$host_os" in
- # Guess yes on HP-UX 11.
- hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
- # Guess no on HP-UX 10 and older.
- hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";;
- # Guess yes otherwise.
- *) gl_cv_func_printf_flag_leftadjust="guessing yes";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the *printf family of functions supports padding of non-finite
-dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See
-dnl <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html>
-dnl Result is gl_cv_func_printf_flag_zero.
-
-AC_DEFUN([gl_PRINTF_FLAG_ZERO],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf supports the zero flag correctly],
- [gl_cv_func_printf_flag_zero],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <string.h>
-static char buf[100];
-static double zero = 0.0;
-int main ()
-{
- if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0
- || (strcmp (buf, " inf") != 0
- && strcmp (buf, " infinity") != 0))
- return 1;
- return 0;
-}]])],
- [gl_cv_func_printf_flag_zero=yes],
- [gl_cv_func_printf_flag_zero=no],
- [
-changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_printf_flag_zero="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_flag_zero="guessing no";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the *printf family of functions supports large precisions.
-dnl On mingw, precisions larger than 512 are treated like 512, in integer,
-dnl floating-point or pointer output. On Solaris 10/x86, precisions larger
-dnl than 510 in floating-point output crash the program. On Solaris 10/SPARC,
-dnl precisions larger than 510 in floating-point output yield wrong results.
-dnl On AIX 7.1, precisions larger than 998 in floating-point output yield
-dnl wrong results. On BeOS, precisions larger than 1044 crash the program.
-dnl Result is gl_cv_func_printf_precision.
-
-AC_DEFUN([gl_PRINTF_PRECISION],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf supports large precisions],
- [gl_cv_func_printf_precision],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <string.h>
-static char buf[5000];
-int main ()
-{
- int result = 0;
-#ifdef __BEOS__
- /* On BeOS, this would crash and show a dialog box. Avoid the crash. */
- return 1;
-#endif
- if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3)
- result |= 1;
- if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5)
- result |= 2;
- if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5
- || buf[0] != '1')
- result |= 4;
- if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5
- || buf[0] != '1')
- result |= 4;
- return result;
-}]])],
- [gl_cv_func_printf_precision=yes],
- [gl_cv_func_printf_precision=no],
- [
-changequote(,)dnl
- case "$host_os" in
- # Guess no only on Solaris, native Windows, and BeOS systems.
- solaris*) gl_cv_func_printf_precision="guessing no" ;;
- mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;;
- beos*) gl_cv_func_printf_precision="guessing no" ;;
- *) gl_cv_func_printf_precision="guessing yes" ;;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the *printf family of functions recovers gracefully in case
-dnl of an out-of-memory condition, or whether it crashes the entire program.
-dnl Result is gl_cv_func_printf_enomem.
-
-AC_DEFUN([gl_PRINTF_ENOMEM],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([gl_MULTIARCH])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether printf survives out-of-memory conditions],
- [gl_cv_func_printf_enomem],
- [
- gl_cv_func_printf_enomem="guessing no"
- if test "$cross_compiling" = no; then
- if test $APPLE_UNIVERSAL_BUILD = 0; then
- AC_LANG_CONFTEST([AC_LANG_SOURCE([
-]GL_NOCRASH[
-changequote(,)dnl
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <errno.h>
-int main()
-{
- struct rlimit limit;
- int ret;
- nocrash_init ();
- /* Some printf implementations allocate temporary space with malloc. */
- /* On BSD systems, malloc() is limited by RLIMIT_DATA. */
-#ifdef RLIMIT_DATA
- if (getrlimit (RLIMIT_DATA, &limit) < 0)
- return 77;
- if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
- limit.rlim_max = 5000000;
- limit.rlim_cur = limit.rlim_max;
- if (setrlimit (RLIMIT_DATA, &limit) < 0)
- return 77;
-#endif
- /* On Linux systems, malloc() is limited by RLIMIT_AS. */
-#ifdef RLIMIT_AS
- if (getrlimit (RLIMIT_AS, &limit) < 0)
- return 77;
- if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
- limit.rlim_max = 5000000;
- limit.rlim_cur = limit.rlim_max;
- if (setrlimit (RLIMIT_AS, &limit) < 0)
- return 77;
-#endif
- /* Some printf implementations allocate temporary space on the stack. */
-#ifdef RLIMIT_STACK
- if (getrlimit (RLIMIT_STACK, &limit) < 0)
- return 77;
- if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
- limit.rlim_max = 5000000;
- limit.rlim_cur = limit.rlim_max;
- if (setrlimit (RLIMIT_STACK, &limit) < 0)
- return 77;
-#endif
- ret = printf ("%.5000000f", 1.0);
- return !(ret == 5000002 || (ret < 0 && errno == ENOMEM));
-}
-changequote([,])dnl
- ])])
- if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
- (./conftest 2>&AS_MESSAGE_LOG_FD
- result=$?
- _AS_ECHO_LOG([\$? = $result])
- if test $result != 0 && test $result != 77; then result=1; fi
- exit $result
- ) >/dev/null 2>/dev/null
- case $? in
- 0) gl_cv_func_printf_enomem="yes" ;;
- 77) gl_cv_func_printf_enomem="guessing no" ;;
- *) gl_cv_func_printf_enomem="no" ;;
- esac
- else
- gl_cv_func_printf_enomem="guessing no"
- fi
- rm -fr conftest*
- else
- dnl A universal build on Apple Mac OS X platforms.
- dnl The result would be 'no' in 32-bit mode and 'yes' in 64-bit mode.
- dnl But we need a configuration result that is valid in both modes.
- gl_cv_func_printf_enomem="guessing no"
- fi
- fi
- if test "$gl_cv_func_printf_enomem" = "guessing no"; then
-changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_enomem="guessing yes";;
- # Guess yes on Solaris.
- solaris*) gl_cv_func_printf_enomem="guessing yes";;
- # Guess yes on AIX.
- aix*) gl_cv_func_printf_enomem="guessing yes";;
- # Guess yes on HP-UX/hppa.
- hpux*) case "$host_cpu" in
- hppa*) gl_cv_func_printf_enomem="guessing yes";;
- *) gl_cv_func_printf_enomem="guessing no";;
- esac
- ;;
- # Guess yes on IRIX.
- irix*) gl_cv_func_printf_enomem="guessing yes";;
- # Guess yes on OSF/1.
- osf*) gl_cv_func_printf_enomem="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_printf_enomem="guessing yes";;
- # Guess yes on Haiku.
- haiku*) gl_cv_func_printf_enomem="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_enomem="guessing no";;
- esac
-changequote([,])dnl
- fi
- ])
-])
-
-dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001)
-dnl Result is ac_cv_func_snprintf.
-
-AC_DEFUN([gl_SNPRINTF_PRESENCE],
-[
- AC_CHECK_FUNCS_ONCE([snprintf])
-])
-
-dnl Test whether the string produced by the snprintf function is always NUL
-dnl terminated. (ISO C99, POSIX:2001)
-dnl Result is gl_cv_func_snprintf_truncation_c99.
-
-AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_REQUIRE([gl_SNPRINTF_PRESENCE])
- AC_CACHE_CHECK([whether snprintf truncates the result as in C99],
- [gl_cv_func_snprintf_truncation_c99],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <string.h>
-#if HAVE_SNPRINTF
-# define my_snprintf snprintf
-#else
-# include <stdarg.h>
-static int my_snprintf (char *buf, int size, const char *format, ...)
-{
- va_list args;
- int ret;
- va_start (args, format);
- ret = vsnprintf (buf, size, format, args);
- va_end (args);
- return ret;
-}
-#endif
-static char buf[100];
-int main ()
-{
- strcpy (buf, "ABCDEF");
- my_snprintf (buf, 3, "%d %d", 4567, 89);
- if (memcmp (buf, "45\0DEF", 6) != 0)
- return 1;
- return 0;
-}]])],
- [gl_cv_func_snprintf_truncation_c99=yes],
- [gl_cv_func_snprintf_truncation_c99=no],
- [
-changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on Mac OS X >= 10.3.
- darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on OpenBSD >= 3.9.
- openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
- gl_cv_func_snprintf_truncation_c99="guessing no";;
- openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on Solaris >= 2.6.
- solaris2.[0-5] | solaris2.[0-5].*)
- gl_cv_func_snprintf_truncation_c99="guessing no";;
- solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on AIX >= 4.
- aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on HP-UX >= 11.
- hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on IRIX >= 6.5.
- irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on OSF/1 >= 5.
- osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_snprintf_truncation_c99="guessing no";;
- netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_snprintf_truncation_c99="guessing no";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the return value of the snprintf function is the number
-dnl of bytes (excluding the terminating NUL) that would have been produced
-dnl if the buffer had been large enough. (ISO C99, POSIX:2001)
-dnl For example, this test program fails on IRIX 6.5:
-dnl ---------------------------------------------------------------------
-dnl #include <stdio.h>
-dnl int main()
-dnl {
-dnl static char buf[8];
-dnl int retval = snprintf (buf, 3, "%d", 12345);
-dnl return retval >= 0 && retval < 3;
-dnl }
-dnl ---------------------------------------------------------------------
-dnl Result is gl_cv_func_snprintf_retval_c99.
-
-AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_REQUIRE([gl_SNPRINTF_PRESENCE])
- AC_CACHE_CHECK([whether snprintf returns a byte count as in C99],
- [gl_cv_func_snprintf_retval_c99],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <string.h>
-#if HAVE_SNPRINTF
-# define my_snprintf snprintf
-#else
-# include <stdarg.h>
-static int my_snprintf (char *buf, int size, const char *format, ...)
-{
- va_list args;
- int ret;
- va_start (args, format);
- ret = vsnprintf (buf, size, format, args);
- va_end (args);
- return ret;
-}
-#endif
-static char buf[100];
-int main ()
-{
- strcpy (buf, "ABCDEF");
- if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7)
- return 1;
- if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7)
- return 2;
- if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7)
- return 3;
- return 0;
-}]])],
- [gl_cv_func_snprintf_retval_c99=yes],
- [gl_cv_func_snprintf_retval_c99=no],
- [
-changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on Mac OS X >= 10.3.
- darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";;
- darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on OpenBSD >= 3.9.
- openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
- gl_cv_func_snprintf_retval_c99="guessing no";;
- openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on Solaris >= 2.10.
- solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
- solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
- # Guess yes on AIX >= 4.
- aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";;
- aix*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_snprintf_retval_c99="guessing no";;
- netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_snprintf_retval_c99="guessing no";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the snprintf function supports the %n format directive
-dnl also in truncated portions of the format string. (ISO C99, POSIX:2001)
-dnl Result is gl_cv_func_snprintf_directive_n.
-
-AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_REQUIRE([gl_SNPRINTF_PRESENCE])
- AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive],
- [gl_cv_func_snprintf_directive_n],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <string.h>
-#if HAVE_SNPRINTF
-# define my_snprintf snprintf
-#else
-# include <stdarg.h>
-static int my_snprintf (char *buf, int size, const char *format, ...)
-{
- va_list args;
- int ret;
- va_start (args, format);
- ret = vsnprintf (buf, size, format, args);
- va_end (args);
- return ret;
-}
-#endif
-static char fmtstring[10];
-static char buf[100];
-int main ()
-{
- int count = -1;
- /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2)
- support %n in format strings in read-only memory but not in writable
- memory. */
- strcpy (fmtstring, "%d %n");
- my_snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55);
- if (count != 6)
- return 1;
- return 0;
-}]])],
- [gl_cv_func_snprintf_directive_n=yes],
- [gl_cv_func_snprintf_directive_n=no],
- [
-changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on Mac OS X >= 10.3.
- darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";;
- darwin*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on Solaris >= 2.6.
- solaris2.[0-5] | solaris2.[0-5].*)
- gl_cv_func_snprintf_directive_n="guessing no";;
- solaris*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on AIX >= 4.
- aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";;
- aix*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on IRIX >= 6.5.
- irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on OSF/1 >= 5.
- osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
- osf*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_snprintf_directive_n="guessing no";;
- netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_snprintf_directive_n="guessing no";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl Test whether the snprintf function, when passed a size = 1, writes any
-dnl output without bounds in this case, behaving like sprintf. This is the
-dnl case on Linux libc5.
-dnl Result is gl_cv_func_snprintf_size1.
-
-AC_DEFUN([gl_SNPRINTF_SIZE1],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([gl_SNPRINTF_PRESENCE])
- AC_CACHE_CHECK([whether snprintf respects a size of 1],
- [gl_cv_func_snprintf_size1],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdio.h>
-#if HAVE_SNPRINTF
-# define my_snprintf snprintf
-#else
-# include <stdarg.h>
-static int my_snprintf (char *buf, int size, const char *format, ...)
-{
- va_list args;
- int ret;
- va_start (args, format);
- ret = vsnprintf (buf, size, format, args);
- va_end (args);
- return ret;
-}
-#endif
-int main()
-{
- static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
- my_snprintf (buf, 1, "%d", 12345);
- return buf[1] != 'E';
-}]])],
- [gl_cv_func_snprintf_size1=yes],
- [gl_cv_func_snprintf_size1=no],
- [gl_cv_func_snprintf_size1="guessing yes"])
- ])
-])
-
-dnl Test whether the vsnprintf function, when passed a zero size, produces no
-dnl output. (ISO C99, POSIX:2001)
-dnl For example, snprintf nevertheless writes a NUL byte in this case
-dnl on OSF/1 5.1:
-dnl ---------------------------------------------------------------------
-dnl #include <stdio.h>
-dnl int main()
-dnl {
-dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
-dnl snprintf (buf, 0, "%d", 12345);
-dnl return buf[0] != 'D';
-dnl }
-dnl ---------------------------------------------------------------------
-dnl And vsnprintf writes any output without bounds in this case, behaving like
-dnl vsprintf, on HP-UX 11 and OSF/1 5.1:
-dnl ---------------------------------------------------------------------
-dnl #include <stdarg.h>
-dnl #include <stdio.h>
-dnl static int my_snprintf (char *buf, int size, const char *format, ...)
-dnl {
-dnl va_list args;
-dnl int ret;
-dnl va_start (args, format);
-dnl ret = vsnprintf (buf, size, format, args);
-dnl va_end (args);
-dnl return ret;
-dnl }
-dnl int main()
-dnl {
-dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
-dnl my_snprintf (buf, 0, "%d", 12345);
-dnl return buf[0] != 'D';
-dnl }
-dnl ---------------------------------------------------------------------
-dnl Result is gl_cv_func_vsnprintf_zerosize_c99.
-
-AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99],
- [gl_cv_func_vsnprintf_zerosize_c99],
- [
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <stdarg.h>
-#include <stdio.h>
-static int my_snprintf (char *buf, int size, const char *format, ...)
-{
- va_list args;
- int ret;
- va_start (args, format);
- ret = vsnprintf (buf, size, format, args);
- va_end (args);
- return ret;
-}
-int main()
-{
- static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
- my_snprintf (buf, 0, "%d", 12345);
- return buf[0] != 'D';
-}]])],
- [gl_cv_func_vsnprintf_zerosize_c99=yes],
- [gl_cv_func_vsnprintf_zerosize_c99=no],
- [
-changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on Mac OS X >= 10.3.
- darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on Cygwin.
- cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on Solaris >= 2.6.
- solaris2.[0-5] | solaris2.[0-5].*)
- gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on AIX >= 4.
- aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on IRIX >= 6.5.
- irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on mingw.
- mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- esac
-changequote([,])dnl
- ])
- ])
-])
-
-dnl The results of these tests on various platforms are:
-dnl
-dnl 1 = gl_PRINTF_SIZES_C99
-dnl 2 = gl_PRINTF_LONG_DOUBLE
-dnl 3 = gl_PRINTF_INFINITE
-dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE
-dnl 5 = gl_PRINTF_DIRECTIVE_A
-dnl 6 = gl_PRINTF_DIRECTIVE_F
-dnl 7 = gl_PRINTF_DIRECTIVE_N
-dnl 8 = gl_PRINTF_DIRECTIVE_LS
-dnl 9 = gl_PRINTF_POSITIONS
-dnl 10 = gl_PRINTF_FLAG_GROUPING
-dnl 11 = gl_PRINTF_FLAG_LEFTADJUST
-dnl 12 = gl_PRINTF_FLAG_ZERO
-dnl 13 = gl_PRINTF_PRECISION
-dnl 14 = gl_PRINTF_ENOMEM
-dnl 15 = gl_SNPRINTF_PRESENCE
-dnl 16 = gl_SNPRINTF_TRUNCATION_C99
-dnl 17 = gl_SNPRINTF_RETVAL_C99
-dnl 18 = gl_SNPRINTF_DIRECTIVE_N
-dnl 19 = gl_SNPRINTF_SIZE1
-dnl 20 = gl_VSNPRINTF_ZEROSIZE_C99
-dnl
-dnl 1 = checking whether printf supports size specifiers as in C99...
-dnl 2 = checking whether printf supports 'long double' arguments...
-dnl 3 = checking whether printf supports infinite 'double' arguments...
-dnl 4 = checking whether printf supports infinite 'long double' arguments...
-dnl 5 = checking whether printf supports the 'a' and 'A' directives...
-dnl 6 = checking whether printf supports the 'F' directive...
-dnl 7 = checking whether printf supports the 'n' directive...
-dnl 8 = checking whether printf supports the 'ls' directive...
-dnl 9 = checking whether printf supports POSIX/XSI format strings with positions...
-dnl 10 = checking whether printf supports the grouping flag...
-dnl 11 = checking whether printf supports the left-adjust flag correctly...
-dnl 12 = checking whether printf supports the zero flag correctly...
-dnl 13 = checking whether printf supports large precisions...
-dnl 14 = checking whether printf survives out-of-memory conditions...
-dnl 15 = checking for snprintf...
-dnl 16 = checking whether snprintf truncates the result as in C99...
-dnl 17 = checking whether snprintf returns a byte count as in C99...
-dnl 18 = checking whether snprintf fully supports the 'n' directive...
-dnl 19 = checking whether snprintf respects a size of 1...
-dnl 20 = checking whether vsnprintf respects a zero size as in C99...
-dnl
-dnl . = yes, # = no.
-dnl
-dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
-dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . .
-dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . .
-dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . .
-dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . .
-dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . .
-dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . .
-dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . .
-dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . .
-dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . .
-dnl Solaris 11 2011-11 . . # # # . . # . . . # . . . . . . . .
-dnl Solaris 10 . . # # # . . # . . . # # . . . . . . .
-dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . .
-dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # #
-dnl AIX 7.1 . . # # # . . . . . . # # . . . . . . .
-dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . .
-dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . .
-dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . .
-dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . #
-dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? #
-dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . .
-dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . #
-dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # #
-dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . .
-dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ?
-dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . .
-dnl Haiku . . . # # # . # . . . . . ? . . ? . . .
-dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . .
-dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . .
-dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . .
-dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . .
-dnl mingw-w64 2011 # # # # # # . . # # . # # ? . # # # . .
diff --git a/src/gl/m4/read-file.m4 b/src/gl/m4/read-file.m4
deleted file mode 100644
index aa23b5840c..0000000000
--- a/src/gl/m4/read-file.m4
+++ /dev/null
@@ -1,8 +0,0 @@
-# read-file.m4 serial 3
-dnl Copyright (C) 2002-2006, 2009-2016 Free Software Foundation, Inc.
-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.
-
-# Prerequisites of lib/read-file.c.
-AC_DEFUN([gl_PREREQ_READ_FILE], [:])
diff --git a/src/gl/m4/realloc.m4 b/src/gl/m4/realloc.m4
deleted file mode 100644
index fc2282544d..0000000000
--- a/src/gl/m4/realloc.m4
+++ /dev/null
@@ -1,79 +0,0 @@
-# realloc.m4 serial 14
-dnl Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
-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.
-
-m4_version_prereq([2.70], [] ,[
-
-# This is adapted with modifications from upstream Autoconf here:
-# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c
-AC_DEFUN([_AC_FUNC_REALLOC_IF],
-[
- AC_REQUIRE([AC_HEADER_STDC])dnl
- AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
- AC_CHECK_HEADERS([stdlib.h])
- AC_CACHE_CHECK([for GNU libc compatible realloc],
- [ac_cv_func_realloc_0_nonnull],
- [AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [[#if defined STDC_HEADERS || defined HAVE_STDLIB_H
- # include <stdlib.h>
- #else
- char *realloc ();
- #endif
- ]],
- [[char *p = realloc (0, 0);
- int result = !p;
- free (p);
- return result;]])
- ],
- [ac_cv_func_realloc_0_nonnull=yes],
- [ac_cv_func_realloc_0_nonnull=no],
- [case "$host_os" in
- # Guess yes on platforms where we know the result.
- *-gnu* | freebsd* | netbsd* | openbsd* \
- | hpux* | solaris* | cygwin* | mingw*)
- ac_cv_func_realloc_0_nonnull=yes ;;
- # If we don't know, assume the worst.
- *) ac_cv_func_realloc_0_nonnull=no ;;
- esac
- ])
- ])
- AS_IF([test $ac_cv_func_realloc_0_nonnull = yes], [$1], [$2])
-])# AC_FUNC_REALLOC
-
-])
-
-# gl_FUNC_REALLOC_GNU
-# -------------------
-# Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace
-# realloc if it is not.
-AC_DEFUN([gl_FUNC_REALLOC_GNU],
-[
- AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
- dnl _AC_FUNC_REALLOC_IF is defined in Autoconf.
- _AC_FUNC_REALLOC_IF(
- [AC_DEFINE([HAVE_REALLOC_GNU], [1],
- [Define to 1 if your system has a GNU libc compatible 'realloc'
- function, and to 0 otherwise.])],
- [AC_DEFINE([HAVE_REALLOC_GNU], [0])
- REPLACE_REALLOC=1
- ])
-])# gl_FUNC_REALLOC_GNU
-
-# gl_FUNC_REALLOC_POSIX
-# ---------------------
-# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it
-# fails), and replace realloc if it is not.
-AC_DEFUN([gl_FUNC_REALLOC_POSIX],
-[
- AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
- AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
- if test $gl_cv_func_malloc_posix = yes; then
- AC_DEFINE([HAVE_REALLOC_POSIX], [1],
- [Define if the 'realloc' function is POSIX compliant.])
- else
- REPLACE_REALLOC=1
- fi
-])
diff --git a/src/gl/m4/select.m4 b/src/gl/m4/select.m4
deleted file mode 100644
index d19365541e..0000000000
--- a/src/gl/m4/select.m4
+++ /dev/null
@@ -1,114 +0,0 @@
-# select.m4 serial 8
-dnl Copyright (C) 2009-2016 Free Software Foundation, Inc.
-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_FUNC_SELECT],
-[
- AC_REQUIRE([gl_HEADER_SYS_SELECT])
- AC_REQUIRE([AC_C_RESTRICT])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_REQUIRE([gl_SOCKETS])
- if test "$ac_cv_header_winsock2_h" = yes; then
- REPLACE_SELECT=1
- else
- dnl On Interix 3.5, select(0, NULL, NULL, NULL, timeout) fails with error
- dnl EFAULT.
- AC_CHECK_HEADERS_ONCE([sys/select.h])
- AC_CACHE_CHECK([whether select supports a 0 argument],
- [gl_cv_func_select_supports0],
- [
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <sys/types.h>
-#include <sys/time.h>
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-int main ()
-{
- struct timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 5;
- return select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &timeout) < 0;
-}]])], [gl_cv_func_select_supports0=yes], [gl_cv_func_select_supports0=no],
- [
-changequote(,)dnl
- case "$host_os" in
- # Guess no on Interix.
- interix*) gl_cv_func_select_supports0="guessing no";;
- # Guess yes otherwise.
- *) gl_cv_func_select_supports0="guessing yes";;
- esac
-changequote([,])dnl
- ])
- ])
- case "$gl_cv_func_select_supports0" in
- *yes) ;;
- *) REPLACE_SELECT=1 ;;
- esac
-
- dnl On FreeBSD 8.2, select() doesn't always reject bad fds.
- AC_CACHE_CHECK([whether select detects invalid fds],
- [gl_cv_func_select_detects_ebadf],
- [
- AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#include <sys/types.h>
-#include <sys/time.h>
-#if HAVE_SYS_SELECT_H
-# include <sys/select.h>
-#endif
-#include <unistd.h>
-#include <errno.h>
-]],[[
- fd_set set;
- dup2(0, 16);
- FD_ZERO(&set);
- FD_SET(16, &set);
- close(16);
- struct timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 5;
- return select (17, &set, NULL, NULL, &timeout) != -1 || errno != EBADF;
-]])], [gl_cv_func_select_detects_ebadf=yes],
- [gl_cv_func_select_detects_ebadf=no],
- [
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_select_detects_ebadf="guessing yes" ;;
- # If we don't know, assume the worst.
- *) gl_cv_func_select_detects_ebadf="guessing no" ;;
- esac
- ])
- ])
- case $gl_cv_func_select_detects_ebadf in
- *yes) ;;
- *) REPLACE_SELECT=1 ;;
- esac
- fi
-
- dnl Determine the needed libraries.
- LIB_SELECT="$LIBSOCKET"
- if test $REPLACE_SELECT = 1; then
- case "$host_os" in
- mingw*)
- dnl On the MSVC platform, the function MsgWaitForMultipleObjects
- dnl (used in lib/select.c) requires linking with -luser32. On mingw,
- dnl it is implicit.
- AC_LINK_IFELSE(
- [AC_LANG_SOURCE([[
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-int
-main ()
-{
- MsgWaitForMultipleObjects (0, NULL, 0, 0, 0);
- return 0;
-}]])],
- [],
- [LIB_SELECT="$LIB_SELECT -luser32"])
- ;;
- esac
- fi
- AC_SUBST([LIB_SELECT])
-])
diff --git a/src/gl/m4/servent.m4 b/src/gl/m4/servent.m4
deleted file mode 100644
index 182e7f6277..0000000000
--- a/src/gl/m4/servent.m4
+++ /dev/null
@@ -1,51 +0,0 @@
-# servent.m4 serial 2
-dnl Copyright (C) 2008, 2010-2016 Free Software Foundation, Inc.
-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_SERVENT],
-[
- dnl Where are getservent(), setservent(), endservent(), getservbyname(),
- dnl getservbyport() defined?
- dnl Where are getprotoent(), setprotoent(), endprotoent(), getprotobyname(),
- dnl getprotobynumber() defined?
- dnl - On Solaris, they are in libsocket. Ignore libxnet.
- dnl - On Haiku, they are in libnetwork.
- dnl - On BeOS, they are in libnet.
- dnl - On native Windows, they are in ws2_32.dll.
- dnl - Otherwise they are in libc.
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
- SERVENT_LIB=
- gl_saved_libs="$LIBS"
- AC_SEARCH_LIBS([getservbyname], [socket network net],
- [if test "$ac_cv_search_getservbyname" != "none required"; then
- SERVENT_LIB="$ac_cv_search_getservbyname"
- fi])
- LIBS="$gl_saved_libs"
- if test -z "$SERVENT_LIB"; then
- AC_CHECK_FUNCS([getservbyname], , [
- AC_CACHE_CHECK([for getservbyname in winsock2.h and -lws2_32],
- [gl_cv_w32_getservbyname],
- [gl_cv_w32_getservbyname=no
- gl_save_LIBS="$LIBS"
- LIBS="$LIBS -lws2_32"
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
-#include <stddef.h>
- ]],
- [[getservbyname(NULL,NULL);]])],
- [gl_cv_w32_getservbyname=yes])
- LIBS="$gl_save_LIBS"
- ])
- if test "$gl_cv_w32_getservbyname" = "yes"; then
- SERVENT_LIB="-lws2_32"
- fi
- ])
- fi
- AC_SUBST([SERVENT_LIB])
-])
diff --git a/src/gl/m4/setenv.m4 b/src/gl/m4/setenv.m4
deleted file mode 100644
index 5d49aba60d..0000000000
--- a/src/gl/m4/setenv.m4
+++ /dev/null
@@ -1,160 +0,0 @@
-# setenv.m4 serial 26
-dnl Copyright (C) 2001-2004, 2006-2016 Free Software Foundation, Inc.
-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_FUNC_SETENV],
-[
- AC_REQUIRE([gl_FUNC_SETENV_SEPARATE])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- if test $ac_cv_func_setenv = no; then
- HAVE_SETENV=0
- else
- AC_CACHE_CHECK([whether setenv validates arguments],
- [gl_cv_func_setenv_works],
- [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
- ]], [[
- int result = 0;
- {
- if (setenv ("", "", 0) != -1)
- result |= 1;
- else if (errno != EINVAL)
- result |= 2;
- }
- {
- if (setenv ("a", "=", 1) != 0)
- result |= 4;
- else if (strcmp (getenv ("a"), "=") != 0)
- result |= 8;
- }
- return result;
- ]])],
- [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no],
- [case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_setenv_works="guessing yes" ;;
- # If we don't know, assume the worst.
- *) gl_cv_func_setenv_works="guessing no" ;;
- esac
- ])])
- case "$gl_cv_func_setenv_works" in
- *yes) ;;
- *)
- REPLACE_SETENV=1
- ;;
- esac
- fi
-])
-
-# Like gl_FUNC_SETENV, except prepare for separate compilation
-# (no REPLACE_SETENV, no AC_LIBOBJ).
-AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
-[
- AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
- AC_CHECK_DECLS_ONCE([setenv])
- if test $ac_cv_have_decl_setenv = no; then
- HAVE_DECL_SETENV=0
- fi
- AC_CHECK_FUNCS_ONCE([setenv])
- gl_PREREQ_SETENV
-])
-
-AC_DEFUN([gl_FUNC_UNSETENV],
-[
- AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CHECK_DECLS_ONCE([unsetenv])
- if test $ac_cv_have_decl_unsetenv = no; then
- HAVE_DECL_UNSETENV=0
- fi
- AC_CHECK_FUNCS([unsetenv])
- if test $ac_cv_func_unsetenv = no; then
- HAVE_UNSETENV=0
- else
- HAVE_UNSETENV=1
- dnl Some BSDs return void, failing to do error checking.
- AC_CACHE_CHECK([for unsetenv() return type], [gt_cv_func_unsetenv_ret],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#undef _BSD
-#define _BSD 1 /* unhide unsetenv declaration in OSF/1 5.1 <stdlib.h> */
-#include <stdlib.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-int unsetenv (const char *name);
- ]],
- [[]])],
- [gt_cv_func_unsetenv_ret='int'],
- [gt_cv_func_unsetenv_ret='void'])])
- if test $gt_cv_func_unsetenv_ret = 'void'; then
- AC_DEFINE([VOID_UNSETENV], [1], [Define to 1 if unsetenv returns void
- instead of int.])
- REPLACE_UNSETENV=1
- fi
-
- dnl Solaris 10 unsetenv does not remove all copies of a name.
- dnl Haiku alpha 2 unsetenv gets confused by assignment to environ.
- dnl OpenBSD 4.7 unsetenv("") does not fail.
- AC_CACHE_CHECK([whether unsetenv obeys POSIX],
- [gl_cv_func_unsetenv_works],
- [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
- #include <stdlib.h>
- #include <errno.h>
- extern char **environ;
- ]], [[
- char entry1[] = "a=1";
- char entry2[] = "b=2";
- char *env[] = { entry1, entry2, NULL };
- if (putenv ((char *) "a=1")) return 1;
- if (putenv (entry2)) return 2;
- entry2[0] = 'a';
- unsetenv ("a");
- if (getenv ("a")) return 3;
- if (!unsetenv ("") || errno != EINVAL) return 4;
- entry2[0] = 'b';
- environ = env;
- if (!getenv ("a")) return 5;
- entry2[0] = 'a';
- unsetenv ("a");
- if (getenv ("a")) return 6;
- ]])],
- [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no],
- [case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;;
- # If we don't know, assume the worst.
- *) gl_cv_func_unsetenv_works="guessing no" ;;
- esac
- ])])
- case "$gl_cv_func_unsetenv_works" in
- *yes) ;;
- *)
- REPLACE_UNSETENV=1
- ;;
- esac
- fi
-])
-
-# Prerequisites of lib/setenv.c.
-AC_DEFUN([gl_PREREQ_SETENV],
-[
- AC_REQUIRE([AC_FUNC_ALLOCA])
- AC_REQUIRE([gl_ENVIRON])
- AC_CHECK_HEADERS_ONCE([unistd.h])
- AC_CHECK_HEADERS([search.h])
- AC_CHECK_FUNCS([tsearch])
-])
-
-# Prerequisites of lib/unsetenv.c.
-AC_DEFUN([gl_PREREQ_UNSETENV],
-[
- AC_REQUIRE([gl_ENVIRON])
- AC_CHECK_HEADERS_ONCE([unistd.h])
-])
diff --git a/src/gl/m4/signal_h.m4 b/src/gl/m4/signal_h.m4
deleted file mode 100644
index bcfd7b4be3..0000000000
--- a/src/gl/m4/signal_h.m4
+++ /dev/null
@@ -1,83 +0,0 @@
-# signal_h.m4 serial 18
-dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
-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_SIGNAL_H],
-[
- AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
- AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T])
- gl_NEXT_HEADERS([signal.h])
-
-# AIX declares sig_atomic_t to already include volatile, and C89 compilers
-# then choke on 'volatile sig_atomic_t'. C99 requires that it compile.
- AC_CHECK_TYPE([volatile sig_atomic_t], [],
- [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[
-#include <signal.h>
- ]])
-
- dnl Ensure the type pid_t gets defined.
- AC_REQUIRE([AC_TYPE_PID_T])
-
- AC_REQUIRE([AC_TYPE_UID_T])
-
- dnl Persuade glibc <signal.h> to define sighandler_t.
- AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
- AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[
-#include <signal.h>
- ]])
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[#include <signal.h>
- ]], [pthread_sigmask sigaction
- sigaddset sigdelset sigemptyset sigfillset sigismember
- sigpending sigprocmask])
-])
-
-AC_DEFUN([gl_CHECK_TYPE_SIGSET_T],
-[
- AC_CHECK_TYPES([sigset_t],
- [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no],
- [[
- #include <signal.h>
- /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */
- #include <sys/types.h>
- ]])
- if test $gl_cv_type_sigset_t != yes; then
- HAVE_SIGSET_T=0
- fi
-])
-
-AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SIGNAL_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_SIGNAL_H_DEFAULTS],
-[
- GNULIB_PTHREAD_SIGMASK=0; AC_SUBST([GNULIB_PTHREAD_SIGMASK])
- GNULIB_RAISE=0; AC_SUBST([GNULIB_RAISE])
- GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE])
- GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK])
- GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING])
- HAVE_PTHREAD_SIGMASK=1; AC_SUBST([HAVE_PTHREAD_SIGMASK])
- HAVE_RAISE=1; AC_SUBST([HAVE_RAISE])
- HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T])
- HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T])
- HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION])
- HAVE_STRUCT_SIGACTION_SA_SIGACTION=1;
- AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION])
- HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1;
- AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T])
- HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T])
- REPLACE_PTHREAD_SIGMASK=0; AC_SUBST([REPLACE_PTHREAD_SIGMASK])
- REPLACE_RAISE=0; AC_SUBST([REPLACE_RAISE])
-])
diff --git a/src/gl/m4/size_max.m4 b/src/gl/m4/size_max.m4
deleted file mode 100644
index de69025d62..0000000000
--- a/src/gl/m4/size_max.m4
+++ /dev/null
@@ -1,79 +0,0 @@
-# size_max.m4 serial 10
-dnl Copyright (C) 2003, 2005-2006, 2008-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Bruno Haible.
-
-AC_DEFUN([gl_SIZE_MAX],
-[
- AC_CHECK_HEADERS([stdint.h])
- dnl First test whether the system already has SIZE_MAX.
- AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [
- gl_cv_size_max=
- AC_EGREP_CPP([Found it], [
-#include <limits.h>
-#if HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#ifdef SIZE_MAX
-Found it
-#endif
-], [gl_cv_size_max=yes])
- if test -z "$gl_cv_size_max"; then
- dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
- dnl than the type 'unsigned long'. Try hard to find a definition that can
- dnl be used in a preprocessor #if, i.e. doesn't contain a cast.
- AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1],
- [#include <stddef.h>
-#include <limits.h>], [size_t_bits_minus_1=])
- AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)],
- [#include <stddef.h>], [fits_in_uint=])
- if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
- if test $fits_in_uint = 1; then
- dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
- dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <stddef.h>
- extern size_t foo;
- extern unsigned long foo;
- ]],
- [[]])],
- [fits_in_uint=0])
- fi
- dnl We cannot use 'expr' to simplify this expression, because 'expr'
- dnl works only with 'long' integers in the host environment, while we
- dnl might be cross-compiling from a 32-bit platform to a 64-bit platform.
- if test $fits_in_uint = 1; then
- gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
- else
- gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
- fi
- else
- dnl Shouldn't happen, but who knows...
- gl_cv_size_max='((size_t)~(size_t)0)'
- fi
- fi
- ])
- if test "$gl_cv_size_max" != yes; then
- AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max],
- [Define as the maximum value of type 'size_t', if the system doesn't define it.])
- fi
- dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after
- dnl <stdint.h>. Remember that the #undef in AH_VERBATIM gets replaced with
- dnl #define by AC_DEFINE_UNQUOTED.
- AH_VERBATIM([SIZE_MAX],
-[/* Define as the maximum value of type 'size_t', if the system doesn't define
- it. */
-#ifndef SIZE_MAX
-# undef SIZE_MAX
-#endif])
-])
-
-dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
-dnl Remove this when we can assume autoconf >= 2.61.
-m4_ifdef([AC_COMPUTE_INT], [], [
- AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
-])
diff --git a/src/gl/m4/snprintf.m4 b/src/gl/m4/snprintf.m4
deleted file mode 100644
index f876b55995..0000000000
--- a/src/gl/m4/snprintf.m4
+++ /dev/null
@@ -1,54 +0,0 @@
-# snprintf.m4 serial 6
-dnl Copyright (C) 2002-2004, 2007-2016 Free Software Foundation, Inc.
-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.
-
-dnl Libintl 0.17 will replace snprintf only if it does not support %1$s,
-dnl but defers to any gnulib snprintf replacements. Therefore, gnulib
-dnl must guarantee that the decision for replacing snprintf is a superset
-dnl of the reasons checked by libintl.
-AC_DEFUN([gl_FUNC_SNPRINTF],
-[
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- gl_cv_func_snprintf_usable=no
- AC_CHECK_FUNCS([snprintf])
- if test $ac_cv_func_snprintf = yes; then
- gl_SNPRINTF_SIZE1
- case "$gl_cv_func_snprintf_size1" in
- *yes)
- gl_SNPRINTF_RETVAL_C99
- case "$gl_cv_func_snprintf_retval_c99" in
- *yes)
- gl_PRINTF_POSITIONS
- case "$gl_cv_func_printf_positions" in
- *yes)
- gl_cv_func_snprintf_usable=yes
- ;;
- esac
- ;;
- esac
- ;;
- esac
- fi
- if test $gl_cv_func_snprintf_usable = no; then
- gl_REPLACE_SNPRINTF
- fi
- AC_CHECK_DECLS_ONCE([snprintf])
- if test $ac_cv_have_decl_snprintf = no; then
- HAVE_DECL_SNPRINTF=0
- fi
-])
-
-AC_DEFUN([gl_REPLACE_SNPRINTF],
-[
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- AC_LIBOBJ([snprintf])
- if test $ac_cv_func_snprintf = yes; then
- REPLACE_SNPRINTF=1
- fi
- gl_PREREQ_SNPRINTF
-])
-
-# Prerequisites of lib/snprintf.c.
-AC_DEFUN([gl_PREREQ_SNPRINTF], [:])
diff --git a/src/gl/m4/socketlib.m4 b/src/gl/m4/socketlib.m4
deleted file mode 100644
index 5da64fcaca..0000000000
--- a/src/gl/m4/socketlib.m4
+++ /dev/null
@@ -1,86 +0,0 @@
-# socketlib.m4 serial 1
-dnl Copyright (C) 2008-2016 Free Software Foundation, Inc.
-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.
-
-dnl gl_SOCKETLIB
-dnl Determines the library to use for socket functions.
-dnl Sets and AC_SUBSTs LIBSOCKET.
-
-AC_DEFUN([gl_SOCKETLIB],
-[
- gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
- LIBSOCKET=
- if test $HAVE_WINSOCK2_H = 1; then
- dnl Native Windows API (not Cygwin).
- AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32],
- [gl_cv_func_wsastartup], [
- gl_save_LIBS="$LIBS"
- LIBS="$LIBS -lws2_32"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#ifdef HAVE_WINSOCK2_H
-# include <winsock2.h>
-#endif]], [[
- WORD wVersionRequested = MAKEWORD(1, 1);
- WSADATA wsaData;
- int err = WSAStartup(wVersionRequested, &wsaData);
- WSACleanup ();]])],
- gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no)
- LIBS="$gl_save_LIBS"
- ])
- if test "$gl_cv_func_wsastartup" = "yes"; then
- AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.])
- LIBSOCKET='-lws2_32'
- fi
- else
- dnl Unix API.
- dnl Solaris has most socket functions in libsocket.
- dnl Haiku has most socket functions in libnetwork.
- dnl BeOS has most socket functions in libnet.
- AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
- gl_cv_lib_socket=
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [],
- [gl_save_LIBS="$LIBS"
- LIBS="$gl_save_LIBS -lsocket"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [gl_cv_lib_socket="-lsocket"])
- if test -z "$gl_cv_lib_socket"; then
- LIBS="$gl_save_LIBS -lnetwork"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [gl_cv_lib_socket="-lnetwork"])
- if test -z "$gl_cv_lib_socket"; then
- LIBS="$gl_save_LIBS -lnet"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [gl_cv_lib_socket="-lnet"])
- fi
- fi
- LIBS="$gl_save_LIBS"
- ])
- if test -z "$gl_cv_lib_socket"; then
- gl_cv_lib_socket="none needed"
- fi
- ])
- if test "$gl_cv_lib_socket" != "none needed"; then
- LIBSOCKET="$gl_cv_lib_socket"
- fi
- fi
- AC_SUBST([LIBSOCKET])
-])
diff --git a/src/gl/m4/sockets.m4 b/src/gl/m4/sockets.m4
deleted file mode 100644
index 7e77a62e88..0000000000
--- a/src/gl/m4/sockets.m4
+++ /dev/null
@@ -1,17 +0,0 @@
-# sockets.m4 serial 7
-dnl Copyright (C) 2008-2016 Free Software Foundation, Inc.
-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_SOCKETS],
-[
- AC_REQUIRE([AC_C_INLINE])
- AC_REQUIRE([gl_SOCKETLIB])
- gl_PREREQ_SOCKETS
-])
-
-# Prerequisites of lib/sockets.c.
-AC_DEFUN([gl_PREREQ_SOCKETS], [
- :
-])
diff --git a/src/gl/m4/socklen.m4 b/src/gl/m4/socklen.m4
deleted file mode 100644
index 634c43a35c..0000000000
--- a/src/gl/m4/socklen.m4
+++ /dev/null
@@ -1,77 +0,0 @@
-# socklen.m4 serial 10
-dnl Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Albert Chin, Windows fixes from Simon Josefsson.
-
-dnl Check for socklen_t: historically on BSD it is an int, and in
-dnl POSIX 1g it is a type of its own, but some platforms use different
-dnl types for the argument to getsockopt, getpeername, etc.:
-dnl HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS.
-dnl So we have to test to find something that will work.
-
-AC_DEFUN([gl_TYPE_SOCKLEN_T],
- [AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])dnl
- AC_CHECK_TYPE([socklen_t], ,
- [AC_MSG_CHECKING([for socklen_t equivalent])
- AC_CACHE_VAL([gl_cv_socklen_t_equiv],
- [# Systems have either "struct sockaddr *" or
- # "void *" as the second argument to getpeername
- gl_cv_socklen_t_equiv=
- for arg2 in "struct sockaddr" void; do
- for t in int size_t "unsigned int" "long int" "unsigned long int"; do
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
- [[#include <sys/types.h>
- #include <sys/socket.h>
-
- int getpeername (int, $arg2 *, $t *);]],
- [[$t len;
- getpeername (0, 0, &len);]])],
- [gl_cv_socklen_t_equiv="$t"])
- test "$gl_cv_socklen_t_equiv" != "" && break
- done
- test "$gl_cv_socklen_t_equiv" != "" && break
- done
- ])
- if test "$gl_cv_socklen_t_equiv" = ""; then
- AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
- fi
- AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
- AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
- [type to use in place of socklen_t if not defined])],
- [gl_SOCKET_HEADERS])])
-
-dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
-dnl it there too. But on Cygwin, wc2tcpip.h must not be included. Users
-dnl of this module should use the same include pattern as gl_SOCKET_HEADERS.
-dnl When you change this macro, keep also in sync:
-dnl - gl_CHECK_SOCKET_HEADERS,
-dnl - the Include section of modules/socklen.
-AC_DEFUN([gl_SOCKET_HEADERS],
-[
-/* <sys/types.h> is not needed according to POSIX, but the
- <sys/socket.h> in i386-unknown-freebsd4.10 and
- powerpc-apple-darwin5.5 required it. */
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#elif HAVE_WS2TCPIP_H
-# include <ws2tcpip.h>
-#endif
-])
-
-dnl Tests for the existence of the header for socket facilities.
-dnl Defines the C macros HAVE_SYS_SOCKET_H, HAVE_WS2TCPIP_H.
-dnl This macro must match gl_SOCKET_HEADERS.
-AC_DEFUN([gl_CHECK_SOCKET_HEADERS],
- [AC_CHECK_HEADERS_ONCE([sys/socket.h])
- if test $ac_cv_header_sys_socket_h = no; then
- dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
- dnl the check for those headers unconditional; yet cygwin reports
- dnl that the headers are present but cannot be compiled (since on
- dnl cygwin, all socket information should come from sys/socket.h).
- AC_CHECK_HEADERS([ws2tcpip.h])
- fi
- ])
diff --git a/src/gl/m4/sockpfaf.m4 b/src/gl/m4/sockpfaf.m4
deleted file mode 100644
index dce8b8f01e..0000000000
--- a/src/gl/m4/sockpfaf.m4
+++ /dev/null
@@ -1,87 +0,0 @@
-# sockpfaf.m4 serial 8
-dnl Copyright (C) 2004, 2006, 2009-2016 Free Software Foundation, Inc.
-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.
-
-dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...)
-dnl and some common address families (AF_INET, AF_INET6, ...).
-dnl This test assumes that a system supports an address family if and only if
-dnl it supports the corresponding protocol family.
-
-dnl From Bruno Haible.
-
-AC_DEFUN([gl_SOCKET_FAMILIES],
-[
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- AC_CHECK_HEADERS_ONCE([netinet/in.h])
-
- AC_MSG_CHECKING([for IPv4 sockets])
- AC_CACHE_VAL([gl_cv_socket_ipv4],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif]],
-[[int x = AF_INET; struct in_addr y; struct sockaddr_in z;
- if (&x && &y && &z) return 0;]])],
- gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)])
- AC_MSG_RESULT([$gl_cv_socket_ipv4])
- if test $gl_cv_socket_ipv4 = yes; then
- AC_DEFINE([HAVE_IPV4], [1], [Define to 1 if <sys/socket.h> defines AF_INET.])
- fi
-
- AC_MSG_CHECKING([for IPv6 sockets])
- AC_CACHE_VAL([gl_cv_socket_ipv6],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif]],
-[[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;
- if (&x && &y && &z) return 0;]])],
- gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)])
- AC_MSG_RESULT([$gl_cv_socket_ipv6])
- if test $gl_cv_socket_ipv6 = yes; then
- AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.])
- fi
-])
-
-AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
-[
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- AC_CHECK_HEADERS_ONCE([sys/un.h])
-
- AC_MSG_CHECKING([for UNIX domain sockets])
- AC_CACHE_VAL([gl_cv_socket_unix],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_SYS_UN_H
-#include <sys/un.h>
-#endif
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif]],
-[[int x = AF_UNIX; struct sockaddr_un y;
- if (&x && &y) return 0;]])],
- gl_cv_socket_unix=yes, gl_cv_socket_unix=no)])
- AC_MSG_RESULT([$gl_cv_socket_unix])
- if test $gl_cv_socket_unix = yes; then
- AC_DEFINE([HAVE_UNIXSOCKET], [1], [Define to 1 if <sys/socket.h> defines AF_UNIX.])
- fi
-])
diff --git a/src/gl/m4/ssize_t.m4 b/src/gl/m4/ssize_t.m4
deleted file mode 100644
index 3e7b9e6e02..0000000000
--- a/src/gl/m4/ssize_t.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-# ssize_t.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2001-2003, 2006, 2010-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Bruno Haible.
-dnl Test whether ssize_t is defined.
-
-AC_DEFUN([gt_TYPE_SSIZE_T],
-[
- AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <sys/types.h>]],
- [[int x = sizeof (ssize_t *) + sizeof (ssize_t);
- return !x;]])],
- [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
- if test $gt_cv_ssize_t = no; then
- AC_DEFINE([ssize_t], [int],
- [Define as a signed type of the same size as size_t.])
- fi
-])
diff --git a/src/gl/m4/stdalign.m4 b/src/gl/m4/stdalign.m4
deleted file mode 100644
index 49980cd636..0000000000
--- a/src/gl/m4/stdalign.m4
+++ /dev/null
@@ -1,57 +0,0 @@
-# Check for stdalign.h that conforms to C11.
-
-dnl Copyright 2011-2016 Free Software Foundation, Inc.
-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.
-
-# Prepare for substituting <stdalign.h> if it is not supported.
-
-AC_DEFUN([gl_STDALIGN_H],
-[
- AC_CACHE_CHECK([for working stdalign.h],
- [gl_cv_header_working_stdalign_h],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <stdalign.h>
- #include <stddef.h>
-
- /* Test that alignof yields a result consistent with offsetof.
- This catches GCC bug 52023
- <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */
- #ifdef __cplusplus
- template <class t> struct alignof_helper { char a; t b; };
- # define ao(type) offsetof (alignof_helper<type>, b)
- #else
- # define ao(type) offsetof (struct { char a; type b; }, b)
- #endif
- char test_double[ao (double) % _Alignof (double) == 0 ? 1 : -1];
- char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1];
- char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1];
-
- /* Test _Alignas only on platforms where gnulib can help. */
- #if \
- ((defined __cplusplus && 201103 <= __cplusplus) \
- || (defined __APPLE__ && defined __MACH__ \
- ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
- : __GNUC__) \
- || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \
- || __ICC || 0x5110 <= __SUNPRO_C \
- || 1300 <= _MSC_VER)
- struct alignas_test { char c; char alignas (8) alignas_8; };
- char test_alignas[offsetof (struct alignas_test, alignas_8) == 8
- ? 1 : -1];
- #endif
- ]])],
- [gl_cv_header_working_stdalign_h=yes],
- [gl_cv_header_working_stdalign_h=no])])
-
- if test $gl_cv_header_working_stdalign_h = yes; then
- STDALIGN_H=''
- else
- STDALIGN_H='stdalign.h'
- fi
-
- AC_SUBST([STDALIGN_H])
- AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"])
-])
diff --git a/src/gl/m4/stdbool.m4 b/src/gl/m4/stdbool.m4
deleted file mode 100644
index 2a9b1db86f..0000000000
--- a/src/gl/m4/stdbool.m4
+++ /dev/null
@@ -1,108 +0,0 @@
-# Check for stdbool.h that conforms to C99.
-
-dnl Copyright (C) 2002-2006, 2009-2016 Free Software Foundation, Inc.
-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.
-
-#serial 7
-
-# Prepare for substituting <stdbool.h> if it is not supported.
-
-AC_DEFUN([AM_STDBOOL_H],
-[
- AC_REQUIRE([AC_CHECK_HEADER_STDBOOL])
-
- # Define two additional variables used in the Makefile substitution.
-
- if test "$ac_cv_header_stdbool_h" = yes; then
- STDBOOL_H=''
- else
- STDBOOL_H='stdbool.h'
- fi
- AC_SUBST([STDBOOL_H])
- AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"])
-
- if test "$ac_cv_type__Bool" = yes; then
- HAVE__BOOL=1
- else
- HAVE__BOOL=0
- fi
- AC_SUBST([HAVE__BOOL])
-])
-
-# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
-AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
-
-# This version of the macro is needed in autoconf <= 2.68.
-
-AC_DEFUN([AC_CHECK_HEADER_STDBOOL],
- [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
- [ac_cv_header_stdbool_h],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <stdbool.h>
-
- #ifdef __cplusplus
- typedef bool Bool;
- #else
- typedef _Bool Bool;
- #ifndef bool
- "error: bool is not defined"
- #endif
- #ifndef false
- "error: false is not defined"
- #endif
- #if false
- "error: false is not 0"
- #endif
- #ifndef true
- "error: true is not defined"
- #endif
- #if true != 1
- "error: true is not 1"
- #endif
- #endif
-
- #ifndef __bool_true_false_are_defined
- "error: __bool_true_false_are_defined is not defined"
- #endif
-
- struct s { Bool s: 1; Bool t; bool u: 1; bool v; } s;
-
- char a[true == 1 ? 1 : -1];
- char b[false == 0 ? 1 : -1];
- char c[__bool_true_false_are_defined == 1 ? 1 : -1];
- char d[(bool) 0.5 == true ? 1 : -1];
- /* See body of main program for 'e'. */
- char f[(Bool) 0.0 == false ? 1 : -1];
- char g[true];
- char h[sizeof (Bool)];
- char i[sizeof s.t];
- enum { j = false, k = true, l = false * true, m = true * 256 };
- /* The following fails for
- HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
- Bool n[m];
- char o[sizeof n == m * sizeof n[0] ? 1 : -1];
- char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
- /* Catch a bug in an HP-UX C compiler. See
- http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
- http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
- */
- Bool q = true;
- Bool *pq = &q;
- bool *qq = &q;
- ]],
- [[
- bool e = &s;
- *pq |= q; *pq |= ! q;
- *qq |= q; *qq |= ! q;
- /* Refer to every declared value, to avoid compiler optimizations. */
- return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
- + !m + !n + !o + !p + !q + !pq + !qq);
- ]])],
- [ac_cv_header_stdbool_h=yes],
- [ac_cv_header_stdbool_h=no])])
- AC_CHECK_TYPES([_Bool])
-])
diff --git a/src/gl/m4/stddef_h.m4 b/src/gl/m4/stddef_h.m4
deleted file mode 100644
index c045c65f9f..0000000000
--- a/src/gl/m4/stddef_h.m4
+++ /dev/null
@@ -1,51 +0,0 @@
-dnl A placeholder for <stddef.h>, for platforms that have issues.
-# stddef_h.m4 serial 5
-dnl Copyright (C) 2009-2016 Free Software Foundation, Inc.
-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_STDDEF_H],
-[
- AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
- STDDEF_H=
- AC_CHECK_TYPE([max_align_t], [], [HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h],
- [[#include <stddef.h>
- ]])
- if test $gt_cv_c_wchar_t = no; then
- HAVE_WCHAR_T=0
- STDDEF_H=stddef.h
- fi
- AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
- [gl_cv_decl_null_works],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
- int test[2 * (sizeof NULL == sizeof (void *)) -1];
-]])],
- [gl_cv_decl_null_works=yes],
- [gl_cv_decl_null_works=no])])
- if test $gl_cv_decl_null_works = no; then
- REPLACE_NULL=1
- STDDEF_H=stddef.h
- fi
- AC_SUBST([STDDEF_H])
- AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"])
- if test -n "$STDDEF_H"; then
- gl_NEXT_HEADERS([stddef.h])
- fi
-])
-
-AC_DEFUN([gl_STDDEF_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
- gl_MODULE_INDICATOR_SET_VARIABLE([$1])
-])
-
-AC_DEFUN([gl_STDDEF_H_DEFAULTS],
-[
- dnl Assume proper GNU behavior unless another module says otherwise.
- REPLACE_NULL=0; AC_SUBST([REPLACE_NULL])
- HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T])
- HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T])
-])
diff --git a/src/gl/m4/stdint.m4 b/src/gl/m4/stdint.m4
deleted file mode 100644
index 05b6ab7846..0000000000
--- a/src/gl/m4/stdint.m4
+++ /dev/null
@@ -1,540 +0,0 @@
-# stdint.m4 serial 48
-dnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Paul Eggert and Bruno Haible.
-dnl Test whether <stdint.h> is supported or must be substituted.
-
-AC_DEFUN_ONCE([gl_STDINT_H],
-[
- AC_PREREQ([2.59])dnl
-
- AC_REQUIRE([gl_LIMITS_H])
-
- dnl Check for long long int and unsigned long long int.
- AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
- if test $ac_cv_type_long_long_int = yes; then
- HAVE_LONG_LONG_INT=1
- else
- HAVE_LONG_LONG_INT=0
- fi
- AC_SUBST([HAVE_LONG_LONG_INT])
- AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
- if test $ac_cv_type_unsigned_long_long_int = yes; then
- HAVE_UNSIGNED_LONG_LONG_INT=1
- else
- HAVE_UNSIGNED_LONG_LONG_INT=0
- fi
- AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
-
- dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does.
- AC_CHECK_HEADERS_ONCE([wchar.h])
- if test $ac_cv_header_wchar_h = yes; then
- HAVE_WCHAR_H=1
- else
- HAVE_WCHAR_H=0
- fi
- AC_SUBST([HAVE_WCHAR_H])
-
- dnl Check for <inttypes.h>.
- dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
- if test $ac_cv_header_inttypes_h = yes; then
- HAVE_INTTYPES_H=1
- else
- HAVE_INTTYPES_H=0
- fi
- AC_SUBST([HAVE_INTTYPES_H])
-
- dnl Check for <sys/types.h>.
- dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
- if test $ac_cv_header_sys_types_h = yes; then
- HAVE_SYS_TYPES_H=1
- else
- HAVE_SYS_TYPES_H=0
- fi
- AC_SUBST([HAVE_SYS_TYPES_H])
-
- gl_CHECK_NEXT_HEADERS([stdint.h])
- if test $ac_cv_header_stdint_h = yes; then
- HAVE_STDINT_H=1
- else
- HAVE_STDINT_H=0
- fi
- AC_SUBST([HAVE_STDINT_H])
-
- dnl Now see whether we need a substitute <stdint.h>.
- if test $ac_cv_header_stdint_h = yes; then
- AC_CACHE_CHECK([whether stdint.h conforms to C99],
- [gl_cv_header_working_stdint_h],
- [gl_cv_header_working_stdint_h=no
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
-#define __STDC_CONSTANT_MACROS 1
-#define __STDC_LIMIT_MACROS 1
-#include <stdint.h>
-/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */
-#if !(defined WCHAR_MIN && defined WCHAR_MAX)
-#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
-#endif
-]
-gl_STDINT_INCLUDES
-[
-#ifdef INT8_MAX
-int8_t a1 = INT8_MAX;
-int8_t a1min = INT8_MIN;
-#endif
-#ifdef INT16_MAX
-int16_t a2 = INT16_MAX;
-int16_t a2min = INT16_MIN;
-#endif
-#ifdef INT32_MAX
-int32_t a3 = INT32_MAX;
-int32_t a3min = INT32_MIN;
-#endif
-#ifdef INT64_MAX
-int64_t a4 = INT64_MAX;
-int64_t a4min = INT64_MIN;
-#endif
-#ifdef UINT8_MAX
-uint8_t b1 = UINT8_MAX;
-#else
-typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
-#endif
-#ifdef UINT16_MAX
-uint16_t b2 = UINT16_MAX;
-#endif
-#ifdef UINT32_MAX
-uint32_t b3 = UINT32_MAX;
-#endif
-#ifdef UINT64_MAX
-uint64_t b4 = UINT64_MAX;
-#endif
-int_least8_t c1 = INT8_C (0x7f);
-int_least8_t c1max = INT_LEAST8_MAX;
-int_least8_t c1min = INT_LEAST8_MIN;
-int_least16_t c2 = INT16_C (0x7fff);
-int_least16_t c2max = INT_LEAST16_MAX;
-int_least16_t c2min = INT_LEAST16_MIN;
-int_least32_t c3 = INT32_C (0x7fffffff);
-int_least32_t c3max = INT_LEAST32_MAX;
-int_least32_t c3min = INT_LEAST32_MIN;
-int_least64_t c4 = INT64_C (0x7fffffffffffffff);
-int_least64_t c4max = INT_LEAST64_MAX;
-int_least64_t c4min = INT_LEAST64_MIN;
-uint_least8_t d1 = UINT8_C (0xff);
-uint_least8_t d1max = UINT_LEAST8_MAX;
-uint_least16_t d2 = UINT16_C (0xffff);
-uint_least16_t d2max = UINT_LEAST16_MAX;
-uint_least32_t d3 = UINT32_C (0xffffffff);
-uint_least32_t d3max = UINT_LEAST32_MAX;
-uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
-uint_least64_t d4max = UINT_LEAST64_MAX;
-int_fast8_t e1 = INT_FAST8_MAX;
-int_fast8_t e1min = INT_FAST8_MIN;
-int_fast16_t e2 = INT_FAST16_MAX;
-int_fast16_t e2min = INT_FAST16_MIN;
-int_fast32_t e3 = INT_FAST32_MAX;
-int_fast32_t e3min = INT_FAST32_MIN;
-int_fast64_t e4 = INT_FAST64_MAX;
-int_fast64_t e4min = INT_FAST64_MIN;
-uint_fast8_t f1 = UINT_FAST8_MAX;
-uint_fast16_t f2 = UINT_FAST16_MAX;
-uint_fast32_t f3 = UINT_FAST32_MAX;
-uint_fast64_t f4 = UINT_FAST64_MAX;
-#ifdef INTPTR_MAX
-intptr_t g = INTPTR_MAX;
-intptr_t gmin = INTPTR_MIN;
-#endif
-#ifdef UINTPTR_MAX
-uintptr_t h = UINTPTR_MAX;
-#endif
-intmax_t i = INTMAX_MAX;
-uintmax_t j = UINTMAX_MAX;
-
-/* Check that SIZE_MAX has the correct type, if possible. */
-#if 201112 <= __STDC_VERSION__
-int k = _Generic (SIZE_MAX, size_t: 0);
-#elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \
- || (0x5110 <= __SUNPRO_C && !__STDC__))
-extern size_t k;
-extern __typeof__ (SIZE_MAX) k;
-#endif
-
-#include <limits.h> /* for CHAR_BIT */
-#define TYPE_MINIMUM(t) \
- ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
-#define TYPE_MAXIMUM(t) \
- ((t) ((t) 0 < (t) -1 \
- ? (t) -1 \
- : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
-struct s {
- int check_PTRDIFF:
- PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
- && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
- ? 1 : -1;
- /* Detect bug in FreeBSD 6.0 / ia64. */
- int check_SIG_ATOMIC:
- SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
- && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
- ? 1 : -1;
- int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1;
- int check_WCHAR:
- WCHAR_MIN == TYPE_MINIMUM (wchar_t)
- && WCHAR_MAX == TYPE_MAXIMUM (wchar_t)
- ? 1 : -1;
- /* Detect bug in mingw. */
- int check_WINT:
- WINT_MIN == TYPE_MINIMUM (wint_t)
- && WINT_MAX == TYPE_MAXIMUM (wint_t)
- ? 1 : -1;
-
- /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */
- int check_UINT8_C:
- (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
- int check_UINT16_C:
- (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
-
- /* Detect bugs in OpenBSD 3.9 stdint.h. */
-#ifdef UINT8_MAX
- int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
-#endif
-#ifdef UINT16_MAX
- int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
-#endif
-#ifdef UINT32_MAX
- int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
-#endif
-#ifdef UINT64_MAX
- int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
-#endif
- int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
- int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
- int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
- int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
- int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
- int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
- int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
- int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
- int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
- int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
- int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
-};
- ]])],
- [dnl Determine whether the various *_MIN, *_MAX macros are usable
- dnl in preprocessor expression. We could do it by compiling a test
- dnl program for each of these macros. It is faster to run a program
- dnl that inspects the macro expansion.
- dnl This detects a bug on HP-UX 11.23/ia64.
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([[
-#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
-#define __STDC_CONSTANT_MACROS 1
-#define __STDC_LIMIT_MACROS 1
-#include <stdint.h>
-]
-gl_STDINT_INCLUDES
-[
-#include <stdio.h>
-#include <string.h>
-#define MVAL(macro) MVAL1(macro)
-#define MVAL1(expression) #expression
-static const char *macro_values[] =
- {
-#ifdef INT8_MAX
- MVAL (INT8_MAX),
-#endif
-#ifdef INT16_MAX
- MVAL (INT16_MAX),
-#endif
-#ifdef INT32_MAX
- MVAL (INT32_MAX),
-#endif
-#ifdef INT64_MAX
- MVAL (INT64_MAX),
-#endif
-#ifdef UINT8_MAX
- MVAL (UINT8_MAX),
-#endif
-#ifdef UINT16_MAX
- MVAL (UINT16_MAX),
-#endif
-#ifdef UINT32_MAX
- MVAL (UINT32_MAX),
-#endif
-#ifdef UINT64_MAX
- MVAL (UINT64_MAX),
-#endif
- NULL
- };
-]], [[
- const char **mv;
- for (mv = macro_values; *mv != NULL; mv++)
- {
- const char *value = *mv;
- /* Test whether it looks like a cast expression. */
- if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
- || strncmp (value, "((unsigned short)"/*)*/, 17) == 0
- || strncmp (value, "((unsigned char)"/*)*/, 16) == 0
- || strncmp (value, "((int)"/*)*/, 6) == 0
- || strncmp (value, "((signed short)"/*)*/, 15) == 0
- || strncmp (value, "((signed char)"/*)*/, 14) == 0)
- return mv - macro_values + 1;
- }
- return 0;
-]])],
- [gl_cv_header_working_stdint_h=yes],
- [],
- [dnl When cross-compiling, assume it works.
- gl_cv_header_working_stdint_h=yes
- ])
- ])
- ])
- fi
-
- HAVE_C99_STDINT_H=0
- HAVE_SYS_BITYPES_H=0
- HAVE_SYS_INTTYPES_H=0
- STDINT_H=stdint.h
- if test "$gl_cv_header_working_stdint_h" = yes; then
- HAVE_C99_STDINT_H=1
- dnl Now see whether the system <stdint.h> works without
- dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined.
- AC_CACHE_CHECK([whether stdint.h predates C++11],
- [gl_cv_header_stdint_predates_cxx11_h],
- [gl_cv_header_stdint_predates_cxx11_h=yes
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
-#include <stdint.h>
-]
-gl_STDINT_INCLUDES
-[
-intmax_t im = INTMAX_MAX;
-int32_t i32 = INT32_C (0x7fffffff);
- ]])],
- [gl_cv_header_stdint_predates_cxx11_h=no])])
-
- if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then
- AC_DEFINE([__STDC_CONSTANT_MACROS], [1],
- [Define to 1 if the system <stdint.h> predates C++11.])
- AC_DEFINE([__STDC_LIMIT_MACROS], [1],
- [Define to 1 if the system <stdint.h> predates C++11.])
- fi
- AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.],
- [gl_cv_header_stdint_width],
- [gl_cv_header_stdint_width=no
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[
- /* Work if build is not clean. */
- #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1
- #ifndef __STDC_WANT_IEC_60559_BFP_EXT__
- #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
- #endif
- #include <stdint.h>
- ]gl_STDINT_INCLUDES[
- int iw = UINTMAX_WIDTH;
- ]])],
- [gl_cv_header_stdint_width=yes])])
- if test "$gl_cv_header_stdint_width" = yes; then
- STDINT_H=
- fi
- else
- dnl Check for <sys/inttypes.h>, and for
- dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
- AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
- if test $ac_cv_header_sys_inttypes_h = yes; then
- HAVE_SYS_INTTYPES_H=1
- fi
- if test $ac_cv_header_sys_bitypes_h = yes; then
- HAVE_SYS_BITYPES_H=1
- fi
- gl_STDINT_TYPE_PROPERTIES
- fi
-
- # The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH.
- LIMITS_H=limits.h
- AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
-
- AC_SUBST([HAVE_C99_STDINT_H])
- AC_SUBST([HAVE_SYS_BITYPES_H])
- AC_SUBST([HAVE_SYS_INTTYPES_H])
- AC_SUBST([STDINT_H])
- AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"])
-])
-
-dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
-dnl Determine the size of each of the given types in bits.
-AC_DEFUN([gl_STDINT_BITSIZEOF],
-[
- dnl Use a shell loop, to avoid bloating configure, and
- dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
- dnl config.h.in,
- dnl - extra AC_SUBST calls, so that the right substitutions are made.
- m4_foreach_w([gltype], [$1],
- [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
- [Define to the number of bits in type ']gltype['.])])
- for gltype in $1 ; do
- AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
- [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT],
- [$2
-#include <limits.h>], [result=unknown])
- eval gl_cv_bitsizeof_${gltype}=\$result
- ])
- eval result=\$gl_cv_bitsizeof_${gltype}
- if test $result = unknown; then
- dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
- dnl do a syntax check even on unused #if conditions and give an error
- dnl on valid C code like this:
- dnl #if 0
- dnl # if > 32
- dnl # endif
- dnl #endif
- result=0
- fi
- GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
- AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
- eval BITSIZEOF_${GLTYPE}=\$result
- done
- m4_foreach_w([gltype], [$1],
- [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
-])
-
-dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
-dnl Determine the signedness of each of the given types.
-dnl Define HAVE_SIGNED_TYPE if type is signed.
-AC_DEFUN([gl_CHECK_TYPES_SIGNED],
-[
- dnl Use a shell loop, to avoid bloating configure, and
- dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
- dnl config.h.in,
- dnl - extra AC_SUBST calls, so that the right substitutions are made.
- m4_foreach_w([gltype], [$1],
- [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
- [Define to 1 if ']gltype[' is a signed integer type.])])
- for gltype in $1 ; do
- AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([$2[
- int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
- result=yes, result=no)
- eval gl_cv_type_${gltype}_signed=\$result
- ])
- eval result=\$gl_cv_type_${gltype}_signed
- GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
- if test "$result" = yes; then
- AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1])
- eval HAVE_SIGNED_${GLTYPE}=1
- else
- eval HAVE_SIGNED_${GLTYPE}=0
- fi
- done
- m4_foreach_w([gltype], [$1],
- [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
-])
-
-dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
-dnl Determine the suffix to use for integer constants of the given types.
-dnl Define t_SUFFIX for each such type.
-AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
-[
- dnl Use a shell loop, to avoid bloating configure, and
- dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
- dnl config.h.in,
- dnl - extra AC_SUBST calls, so that the right substitutions are made.
- m4_foreach_w([gltype], [$1],
- [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
- [Define to l, ll, u, ul, ull, etc., as suitable for
- constants of type ']gltype['.])])
- for gltype in $1 ; do
- AC_CACHE_CHECK([for $gltype integer literal suffix],
- [gl_cv_type_${gltype}_suffix],
- [eval gl_cv_type_${gltype}_suffix=no
- eval result=\$gl_cv_type_${gltype}_signed
- if test "$result" = yes; then
- glsufu=
- else
- glsufu=u
- fi
- for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
- case $glsuf in
- '') gltype1='int';;
- l) gltype1='long int';;
- ll) gltype1='long long int';;
- i64) gltype1='__int64';;
- u) gltype1='unsigned int';;
- ul) gltype1='unsigned long int';;
- ull) gltype1='unsigned long long int';;
- ui64)gltype1='unsigned __int64';;
- esac
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([$2[
- extern $gltype foo;
- extern $gltype1 foo;]])],
- [eval gl_cv_type_${gltype}_suffix=\$glsuf])
- eval result=\$gl_cv_type_${gltype}_suffix
- test "$result" != no && break
- done])
- GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
- eval result=\$gl_cv_type_${gltype}_suffix
- test "$result" = no && result=
- eval ${GLTYPE}_SUFFIX=\$result
- AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result])
- done
- m4_foreach_w([gltype], [$1],
- [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
-])
-
-dnl gl_STDINT_INCLUDES
-AC_DEFUN([gl_STDINT_INCLUDES],
-[[
- /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
- included before <wchar.h>. */
- #include <stddef.h>
- #include <signal.h>
- #if HAVE_WCHAR_H
- # include <stdio.h>
- # include <time.h>
- # include <wchar.h>
- #endif
-]])
-
-dnl gl_STDINT_TYPE_PROPERTIES
-dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
-dnl of interest to stdint.in.h.
-AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
-[
- AC_REQUIRE([gl_MULTIARCH])
- if test $APPLE_UNIVERSAL_BUILD = 0; then
- gl_STDINT_BITSIZEOF([ptrdiff_t size_t],
- [gl_STDINT_INCLUDES])
- fi
- gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t],
- [gl_STDINT_INCLUDES])
- gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
- [gl_STDINT_INCLUDES])
- gl_cv_type_ptrdiff_t_signed=yes
- gl_cv_type_size_t_signed=no
- if test $APPLE_UNIVERSAL_BUILD = 0; then
- gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t],
- [gl_STDINT_INCLUDES])
- fi
- gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
- [gl_STDINT_INCLUDES])
-
- dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99
- dnl requirement that wint_t is "unchanged by default argument promotions".
- dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t.
- dnl Set the variable BITSIZEOF_WINT_T accordingly.
- if test $BITSIZEOF_WINT_T -lt 32; then
- BITSIZEOF_WINT_T=32
- fi
-])
-
-dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
-dnl Remove this when we can assume autoconf >= 2.61.
-m4_ifdef([AC_COMPUTE_INT], [], [
- AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
-])
diff --git a/src/gl/m4/stdint_h.m4 b/src/gl/m4/stdint_h.m4
deleted file mode 100644
index f823b94c33..0000000000
--- a/src/gl/m4/stdint_h.m4
+++ /dev/null
@@ -1,27 +0,0 @@
-# stdint_h.m4 serial 9
-dnl Copyright (C) 1997-2004, 2006, 2008-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Paul Eggert.
-
-# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
-# doesn't clash with <sys/types.h>, and declares uintmax_t.
-
-AC_DEFUN([gl_AC_HEADER_STDINT_H],
-[
- AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <sys/types.h>
- #include <stdint.h>]],
- [[uintmax_t i = (uintmax_t) -1; return !i;]])],
- [gl_cv_header_stdint_h=yes],
- [gl_cv_header_stdint_h=no])])
- if test $gl_cv_header_stdint_h = yes; then
- AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1],
- [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
- and declares uintmax_t. ])
- fi
-])
diff --git a/src/gl/m4/stdio_h.m4 b/src/gl/m4/stdio_h.m4
deleted file mode 100644
index eaa25a01d4..0000000000
--- a/src/gl/m4/stdio_h.m4
+++ /dev/null
@@ -1,225 +0,0 @@
-# stdio_h.m4 serial 48
-dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
-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_STDIO_H],
-[
- AH_VERBATIM([MINGW_ANSI_STDIO],
-[/* Use GNU style printf and scanf. */
-#ifndef __USE_MINGW_ANSI_STDIO
-# undef __USE_MINGW_ANSI_STDIO
-#endif
-])
- AC_DEFINE([__USE_MINGW_ANSI_STDIO])
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- gl_NEXT_HEADERS([stdio.h])
-
- dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and
- dnl inttypes.h behave like gnu instead of system; we must give our
- dnl printf wrapper the right attribute to match.
- AC_CACHE_CHECK([which flavor of printf attribute matches inttypes macros],
- [gl_cv_func_printf_attribute_flavor],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #define __STDC_FORMAT_MACROS 1
- #include <stdio.h>
- #include <inttypes.h>
- /* For non-mingw systems, compilation will trivially succeed.
- For mingw, compilation will succeed for older mingw (system
- printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */
- #if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) && \
- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
- extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1];
- #endif
- ]])], [gl_cv_func_printf_attribute_flavor=system],
- [gl_cv_func_printf_attribute_flavor=gnu])])
- if test "$gl_cv_func_printf_attribute_flavor" = gnu; then
- AC_DEFINE([GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU], [1],
- [Define to 1 if printf and friends should be labeled with
- attribute "__gnu_printf__" instead of "__printf__"])
- fi
-
- dnl No need to create extra modules for these functions. Everyone who uses
- dnl <stdio.h> likely needs them.
- GNULIB_FSCANF=1
- gl_MODULE_INDICATOR([fscanf])
- GNULIB_SCANF=1
- gl_MODULE_INDICATOR([scanf])
- GNULIB_FGETC=1
- GNULIB_GETC=1
- GNULIB_GETCHAR=1
- GNULIB_FGETS=1
- GNULIB_FREAD=1
- dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c"
- dnl "expected source file, required through AC_LIBSOURCES, not found". It is
- dnl also an optimization, to avoid performing a configure check whose result
- dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING
- dnl or GNULIB_NONBLOCKING redundant.
- m4_ifdef([gl_NONBLOCKING_IO], [
- gl_NONBLOCKING_IO
- if test $gl_cv_have_nonblocking != yes; then
- REPLACE_STDIO_READ_FUNCS=1
- AC_LIBOBJ([stdio-read])
- fi
- ])
-
- dnl No need to create extra modules for these functions. Everyone who uses
- dnl <stdio.h> likely needs them.
- GNULIB_FPRINTF=1
- GNULIB_PRINTF=1
- GNULIB_VFPRINTF=1
- GNULIB_VPRINTF=1
- GNULIB_FPUTC=1
- GNULIB_PUTC=1
- GNULIB_PUTCHAR=1
- GNULIB_FPUTS=1
- GNULIB_PUTS=1
- GNULIB_FWRITE=1
- dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
- dnl "expected source file, required through AC_LIBSOURCES, not found". It is
- dnl also an optimization, to avoid performing a configure check whose result
- dnl is not used. But it does not make the test of GNULIB_STDIO_H_SIGPIPE or
- dnl GNULIB_SIGPIPE redundant.
- m4_ifdef([gl_SIGNAL_SIGPIPE], [
- gl_SIGNAL_SIGPIPE
- if test $gl_cv_header_signal_h_SIGPIPE != yes; then
- REPLACE_STDIO_WRITE_FUNCS=1
- AC_LIBOBJ([stdio-write])
- fi
- ])
- dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
- dnl "expected source file, required through AC_LIBSOURCES, not found". It is
- dnl also an optimization, to avoid performing a configure check whose result
- dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING
- dnl or GNULIB_NONBLOCKING redundant.
- m4_ifdef([gl_NONBLOCKING_IO], [
- gl_NONBLOCKING_IO
- if test $gl_cv_have_nonblocking != yes; then
- REPLACE_STDIO_WRITE_FUNCS=1
- AC_LIBOBJ([stdio-write])
- fi
- ])
-
- 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 both C89 and C11.
- gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
- ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen
- renameat snprintf tmpfile vdprintf vsnprintf])
-])
-
-AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_STDIO_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_STDIO_H_DEFAULTS],
-[
- GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF])
- GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE])
- GNULIB_FDOPEN=0; AC_SUBST([GNULIB_FDOPEN])
- GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
- GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC])
- GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS])
- GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
- GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF])
- GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
- GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE])
- GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC])
- GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS])
- GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD])
- GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
- GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF])
- GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
- GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
- GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
- GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
- GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE])
- GNULIB_GETC=0; AC_SUBST([GNULIB_GETC])
- GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR])
- GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM])
- GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE])
- GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF])
- GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
- GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE])
- GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR])
- GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN])
- GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF])
- GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX])
- GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC])
- GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR])
- GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS])
- GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE])
- GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME])
- GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT])
- GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF])
- GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
- GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
- GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING])
- GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
- GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE])
- GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
- GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF])
- GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF])
- GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF])
- GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF])
- GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
- GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF])
- GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX])
- GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF])
- GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE])
- HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO])
- HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO])
- HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM])
- HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
- HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
- HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF])
- HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF])
- HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF])
- HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
- HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
- HAVE_PCLOSE=1; AC_SUBST([HAVE_PCLOSE])
- HAVE_POPEN=1; AC_SUBST([HAVE_POPEN])
- HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT])
- HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
- HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF])
- REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF])
- REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE])
- REPLACE_FDOPEN=0; AC_SUBST([REPLACE_FDOPEN])
- REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
- REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN])
- REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF])
- REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE])
- REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN])
- REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK])
- REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
- REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL])
- REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
- REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM])
- REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE])
- REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF])
- REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR])
- REPLACE_POPEN=0; AC_SUBST([REPLACE_POPEN])
- REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF])
- REPLACE_REMOVE=0; AC_SUBST([REPLACE_REMOVE])
- REPLACE_RENAME=0; AC_SUBST([REPLACE_RENAME])
- REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT])
- REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF])
- REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF])
- REPLACE_STDIO_READ_FUNCS=0; AC_SUBST([REPLACE_STDIO_READ_FUNCS])
- REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
- REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE])
- REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
- REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF])
- REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF])
- REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF])
- REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF])
- REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])
-])
diff --git a/src/gl/m4/stdlib_h.m4 b/src/gl/m4/stdlib_h.m4
deleted file mode 100644
index 3999068153..0000000000
--- a/src/gl/m4/stdlib_h.m4
+++ /dev/null
@@ -1,120 +0,0 @@
-# stdlib_h.m4 serial 43
-dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
-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
- ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
- initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps
- posix_openpt ptsname ptsname_r qsort_r random random_r realpath rpmatch
- secure_getenv setenv setstate setstate_r srandom srandom_r
- strtod strtoll strtoull unlockpt unsetenv])
-])
-
-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])
- GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC])
- 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])
- GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT])
- GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME])
- GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R])
- GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
- GNULIB_QSORT_R=0; AC_SUBST([GNULIB_QSORT_R])
- GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM])
- GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R])
- GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
- GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH])
- GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH])
- GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV])
- 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])
- GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB])
- 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])
- 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])
- HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT])
- HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
- HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R])
- HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R])
- HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM])
- HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
- HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
- HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
- HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
- HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV])
- HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
- HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV])
- 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])
- REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC])
- REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
- REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME])
- REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R])
- REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
- REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R])
- REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R])
- 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])
- REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB])
-])
diff --git a/src/gl/m4/strdup.m4 b/src/gl/m4/strdup.m4
deleted file mode 100644
index ff7060abd3..0000000000
--- a/src/gl/m4/strdup.m4
+++ /dev/null
@@ -1,36 +0,0 @@
-# strdup.m4 serial 13
-
-dnl Copyright (C) 2002-2016 Free Software Foundation, Inc.
-
-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_FUNC_STRDUP],
-[
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- AC_CHECK_FUNCS_ONCE([strdup])
- AC_CHECK_DECLS_ONCE([strdup])
- if test $ac_cv_have_decl_strdup = no; then
- HAVE_DECL_STRDUP=0
- fi
-])
-
-AC_DEFUN([gl_FUNC_STRDUP_POSIX],
-[
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
- AC_CHECK_FUNCS_ONCE([strdup])
- if test $ac_cv_func_strdup = yes; then
- if test $gl_cv_func_malloc_posix != yes; then
- REPLACE_STRDUP=1
- fi
- fi
- AC_CHECK_DECLS_ONCE([strdup])
- if test $ac_cv_have_decl_strdup = no; then
- HAVE_DECL_STRDUP=0
- fi
-])
-
-# Prerequisites of lib/strdup.c.
-AC_DEFUN([gl_PREREQ_STRDUP], [:])
diff --git a/src/gl/m4/strerror.m4 b/src/gl/m4/strerror.m4
deleted file mode 100644
index e286594b58..0000000000
--- a/src/gl/m4/strerror.m4
+++ /dev/null
@@ -1,96 +0,0 @@
-# strerror.m4 serial 17
-dnl Copyright (C) 2002, 2007-2016 Free Software Foundation, Inc.
-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_FUNC_STRERROR],
-[
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- AC_REQUIRE([gl_HEADER_ERRNO_H])
- AC_REQUIRE([gl_FUNC_STRERROR_0])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
- AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
- ])
- if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then
- AC_CACHE_CHECK([for working strerror function],
- [gl_cv_func_working_strerror],
- [AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <string.h>
- ]],
- [[if (!*strerror (-2)) return 1;]])],
- [gl_cv_func_working_strerror=yes],
- [gl_cv_func_working_strerror=no],
- [case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_working_strerror="guessing yes" ;;
- # If we don't know, assume the worst.
- *) gl_cv_func_working_strerror="guessing no" ;;
- esac
- ])
- ])
- case "$gl_cv_func_working_strerror" in
- *yes) ;;
- *)
- dnl The system's strerror() fails to return a string for out-of-range
- dnl integers. Replace it.
- REPLACE_STRERROR=1
- ;;
- esac
- m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
- dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's
- dnl buffer, we must replace strerror.
- case "$gl_cv_func_strerror_r_works" in
- *no) REPLACE_STRERROR=1 ;;
- esac
- ])
- else
- dnl The system's strerror() cannot know about the new errno values we add
- dnl to <errno.h>, or any fix for strerror(0). Replace it.
- REPLACE_STRERROR=1
- fi
-])
-
-dnl Detect if strerror(0) passes (that is, does not set errno, and does not
-dnl return a string that matches strerror(-1)).
-AC_DEFUN([gl_FUNC_STRERROR_0],
-[
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- REPLACE_STRERROR_0=0
- AC_CACHE_CHECK([whether strerror(0) succeeds],
- [gl_cv_func_strerror_0_works],
- [AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <string.h>
- #include <errno.h>
- ]],
- [[int result = 0;
- char *str;
- errno = 0;
- str = strerror (0);
- if (!*str) result |= 1;
- if (errno) result |= 2;
- if (strstr (str, "nknown") || strstr (str, "ndefined"))
- result |= 4;
- return result;]])],
- [gl_cv_func_strerror_0_works=yes],
- [gl_cv_func_strerror_0_works=no],
- [case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_strerror_0_works="guessing yes" ;;
- # If we don't know, assume the worst.
- *) gl_cv_func_strerror_0_works="guessing no" ;;
- esac
- ])
- ])
- case "$gl_cv_func_strerror_0_works" in
- *yes) ;;
- *)
- REPLACE_STRERROR_0=1
- AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0)
- does not return a message implying success.])
- ;;
- esac
-])
diff --git a/src/gl/m4/strftime.m4 b/src/gl/m4/strftime.m4
deleted file mode 100644
index 9598e7272e..0000000000
--- a/src/gl/m4/strftime.m4
+++ /dev/null
@@ -1,28 +0,0 @@
-# serial 33
-
-# Copyright (C) 1996-1997, 1999-2007, 2009-2016 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# Written by Jim Meyering and Paul Eggert.
-
-AC_DEFUN([gl_FUNC_GNU_STRFTIME],
-[
- gl_FUNC_STRFTIME
-])
-
-# These are the prerequisite macros for GNU's strftime.c replacement.
-AC_DEFUN([gl_FUNC_STRFTIME],
-[
- # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
- AC_REQUIRE([AC_STRUCT_TIMEZONE])
-
- AC_REQUIRE([gl_TM_GMTOFF])
-
- AC_CHECK_FUNCS_ONCE([tzset])
-
- AC_DEFINE([my_strftime], [nstrftime],
- [Define to the name of the strftime replacement function.])
-])
diff --git a/src/gl/m4/string_h.m4 b/src/gl/m4/string_h.m4
deleted file mode 100644
index 0c5ec6f9a0..0000000000
--- a/src/gl/m4/string_h.m4
+++ /dev/null
@@ -1,120 +0,0 @@
-# Configure a GNU-like replacement for <string.h>.
-
-# Copyright (C) 2007-2016 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 21
-
-# Written by Paul Eggert.
-
-AC_DEFUN([gl_HEADER_STRING_H],
-[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_HEADER_STRING_H_BODY])
-])
-
-AC_DEFUN([gl_HEADER_STRING_H_BODY],
-[
- AC_REQUIRE([AC_C_RESTRICT])
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- gl_NEXT_HEADERS([string.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 <string.h>
- ]],
- [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul
- strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
- strerror_r strsignal strverscmp])
-])
-
-AC_DEFUN([gl_STRING_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_HEADER_STRING_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_HEADER_STRING_H_DEFAULTS],
-[
- GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL])
- GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL])
- GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR])
- GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM])
- GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY])
- GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR])
- GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR])
- GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY])
- GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY])
- GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL])
- GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP])
- GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT])
- GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP])
- GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN])
- GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK])
- GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP])
- GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR])
- GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR])
- GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R])
- GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN])
- GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN])
- GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR])
- GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR])
- GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR])
- GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP])
- GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP])
- GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP])
- GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR])
- GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN])
- GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK])
- GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN])
- GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP])
- GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
- GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
- GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R])
- GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
- GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
- HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_FFSL=1; AC_SUBST([HAVE_FFSL])
- HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL])
- HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR])
- HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
- HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
- HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
- HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR])
- HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY])
- HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY])
- HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL])
- HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP])
- HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP])
- HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN])
- HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK])
- HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP])
- HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
- HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
- HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
- HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
- HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP])
- REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR])
- REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
- REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY])
- REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
- REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
- REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR])
- REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL])
- REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
- REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
- REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
- REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
- REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN])
- REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
- REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
- UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R])
-])
diff --git a/src/gl/m4/sys_select_h.m4 b/src/gl/m4/sys_select_h.m4
deleted file mode 100644
index 23526e5f56..0000000000
--- a/src/gl/m4/sys_select_h.m4
+++ /dev/null
@@ -1,95 +0,0 @@
-# sys_select_h.m4 serial 20
-dnl Copyright (C) 2006-2016 Free Software Foundation, Inc.
-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_HEADER_SYS_SELECT],
-[
- AC_REQUIRE([AC_C_RESTRICT])
- AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
- AC_CACHE_CHECK([whether <sys/select.h> is self-contained],
- [gl_cv_header_sys_select_h_selfcontained],
- [
- dnl Test against two bugs:
- dnl 1. On many platforms, <sys/select.h> assumes prior inclusion of
- dnl <sys/types.h>.
- dnl 2. On OSF/1 4.0, <sys/select.h> provides only a forward declaration
- dnl of 'struct timeval', and no definition of this type.
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]],
- [[struct timeval b;]])],
- [gl_cv_header_sys_select_h_selfcontained=yes],
- [gl_cv_header_sys_select_h_selfcontained=no])
- dnl Test against another bug:
- dnl 3. On Solaris 10, <sys/select.h> provides an FD_ZERO implementation
- dnl that relies on memset(), but without including <string.h>.
- if test $gl_cv_header_sys_select_h_selfcontained = yes; then
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[#include <sys/select.h>]],
- [[int memset; int bzero;]])
- ],
- [AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([[#include <sys/select.h>]], [[
- #undef memset
- #define memset nonexistent_memset
- extern
- #ifdef __cplusplus
- "C"
- #endif
- void *memset (void *, int, unsigned long);
- #undef bzero
- #define bzero nonexistent_bzero
- extern
- #ifdef __cplusplus
- "C"
- #endif
- void bzero (void *, unsigned long);
- fd_set fds;
- FD_ZERO (&fds);
- ]])
- ],
- [],
- [gl_cv_header_sys_select_h_selfcontained=no])
- ])
- fi
- ])
- dnl <sys/select.h> is always overridden, because of GNULIB_POSIXCHECK.
- gl_CHECK_NEXT_HEADERS([sys/select.h])
- if test $ac_cv_header_sys_select_h = yes; then
- HAVE_SYS_SELECT_H=1
- else
- HAVE_SYS_SELECT_H=0
- fi
- AC_SUBST([HAVE_SYS_SELECT_H])
- gl_PREREQ_SYS_H_WINSOCK2
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[
-/* Some systems require prerequisite headers. */
-#include <sys/types.h>
-#if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#include <sys/select.h>
- ]], [pselect select])
-])
-
-AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SYS_SELECT_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_SYS_SELECT_H_DEFAULTS],
-[
- GNULIB_PSELECT=0; AC_SUBST([GNULIB_PSELECT])
- GNULIB_SELECT=0; AC_SUBST([GNULIB_SELECT])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_PSELECT=1; AC_SUBST([HAVE_PSELECT])
- REPLACE_PSELECT=0; AC_SUBST([REPLACE_PSELECT])
- REPLACE_SELECT=0; AC_SUBST([REPLACE_SELECT])
-])
diff --git a/src/gl/m4/sys_socket_h.m4 b/src/gl/m4/sys_socket_h.m4
deleted file mode 100644
index ae500c7605..0000000000
--- a/src/gl/m4/sys_socket_h.m4
+++ /dev/null
@@ -1,176 +0,0 @@
-# sys_socket_h.m4 serial 23
-dnl Copyright (C) 2005-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Simon Josefsson.
-
-AC_DEFUN([gl_HEADER_SYS_SOCKET],
-[
- AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
- AC_REQUIRE([AC_CANONICAL_HOST])
-
- dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have
- dnl old-style declarations (with return type 'int' instead of 'ssize_t')
- dnl unless _POSIX_PII_SOCKET is defined.
- case "$host_os" in
- osf*)
- AC_DEFINE([_POSIX_PII_SOCKET], [1],
- [Define to 1 in order to get the POSIX compatible declarations
- of socket functions.])
- ;;
- esac
-
- AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
- [gl_cv_header_sys_socket_h_selfcontained],
- [
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[]])],
- [gl_cv_header_sys_socket_h_selfcontained=yes],
- [gl_cv_header_sys_socket_h_selfcontained=no])
- ])
- if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
- dnl If the shutdown function exists, <sys/socket.h> should define
- dnl SHUT_RD, SHUT_WR, SHUT_RDWR.
- AC_CHECK_FUNCS([shutdown])
- if test $ac_cv_func_shutdown = yes; then
- AC_CACHE_CHECK([whether <sys/socket.h> defines the SHUT_* macros],
- [gl_cv_header_sys_socket_h_shut],
- [
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[#include <sys/socket.h>]],
- [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])],
- [gl_cv_header_sys_socket_h_shut=yes],
- [gl_cv_header_sys_socket_h_shut=no])
- ])
- if test $gl_cv_header_sys_socket_h_shut = no; then
- SYS_SOCKET_H='sys/socket.h'
- fi
- fi
- fi
- # We need to check for ws2tcpip.h now.
- gl_PREREQ_SYS_H_SOCKET
- AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
- /* sys/types.h is not needed according to POSIX, but the
- sys/socket.h in i386-unknown-freebsd4.10 and
- powerpc-apple-darwin5.5 required it. */
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-])
- if test $ac_cv_type_struct_sockaddr_storage = no; then
- HAVE_STRUCT_SOCKADDR_STORAGE=0
- fi
- if test $ac_cv_type_sa_family_t = no; then
- HAVE_SA_FAMILY_T=0
- fi
- if test $ac_cv_type_struct_sockaddr_storage != no; then
- AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
- [],
- [HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0],
- [#include <sys/types.h>
- #ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
- #endif
- #ifdef HAVE_WS2TCPIP_H
- #include <ws2tcpip.h>
- #endif
- ])
- fi
- if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \
- || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then
- SYS_SOCKET_H='sys/socket.h'
- fi
- gl_PREREQ_SYS_H_WINSOCK2
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[
-/* Some systems require prerequisite headers. */
-#include <sys/types.h>
-#include <sys/socket.h>
- ]], [socket connect accept bind getpeername getsockname getsockopt
- listen recv send recvfrom sendto setsockopt shutdown accept4])
-])
-
-AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
-[
- dnl Check prerequisites of the <sys/socket.h> replacement.
- AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
- gl_CHECK_NEXT_HEADERS([sys/socket.h])
- if test $ac_cv_header_sys_socket_h = yes; then
- HAVE_SYS_SOCKET_H=1
- HAVE_WS2TCPIP_H=0
- else
- HAVE_SYS_SOCKET_H=0
- if test $ac_cv_header_ws2tcpip_h = yes; then
- HAVE_WS2TCPIP_H=1
- else
- HAVE_WS2TCPIP_H=0
- fi
- fi
- AC_SUBST([HAVE_SYS_SOCKET_H])
- AC_SUBST([HAVE_WS2TCPIP_H])
-])
-
-# Common prerequisites of the <sys/socket.h> replacement and of the
-# <sys/select.h> replacement.
-# Sets and substitutes HAVE_WINSOCK2_H.
-AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2],
-[
- m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
- m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])])
- AC_CHECK_HEADERS_ONCE([sys/socket.h])
- if test $ac_cv_header_sys_socket_h != yes; then
- dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
- dnl the check for those headers unconditional; yet cygwin reports
- dnl that the headers are present but cannot be compiled (since on
- dnl cygwin, all socket information should come from sys/socket.h).
- AC_CHECK_HEADERS([winsock2.h])
- fi
- if test "$ac_cv_header_winsock2_h" = yes; then
- HAVE_WINSOCK2_H=1
- UNISTD_H_HAVE_WINSOCK2_H=1
- SYS_IOCTL_H_HAVE_WINSOCK2_H=1
- else
- HAVE_WINSOCK2_H=0
- fi
- AC_SUBST([HAVE_WINSOCK2_H])
-])
-
-AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SYS_SOCKET_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_SYS_SOCKET_H_DEFAULTS],
-[
- GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET])
- GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT])
- GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT])
- GNULIB_BIND=0; AC_SUBST([GNULIB_BIND])
- GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME])
- GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME])
- GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT])
- GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN])
- GNULIB_RECV=0; AC_SUBST([GNULIB_RECV])
- GNULIB_SEND=0; AC_SUBST([GNULIB_SEND])
- GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM])
- GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO])
- GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT])
- GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN])
- GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4])
- HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
- HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
- AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY])
- HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T])
- HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
-])
diff --git a/src/gl/m4/sys_stat_h.m4 b/src/gl/m4/sys_stat_h.m4
deleted file mode 100644
index 3d43b6f5ef..0000000000
--- a/src/gl/m4/sys_stat_h.m4
+++ /dev/null
@@ -1,96 +0,0 @@
-# sys_stat_h.m4 serial 28 -*- Autoconf -*-
-dnl Copyright (C) 2006-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Eric Blake.
-dnl Provide a GNU-like <sys/stat.h>.
-
-AC_DEFUN([gl_HEADER_SYS_STAT_H],
-[
- AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
-
- dnl Check for broken stat macros.
- AC_REQUIRE([AC_HEADER_STAT])
-
- gl_CHECK_NEXT_HEADERS([sys/stat.h])
-
- dnl Ensure the type mode_t gets defined.
- AC_REQUIRE([AC_TYPE_MODE_T])
-
- dnl Whether to override 'struct stat'.
- m4_ifdef([gl_LARGEFILE], [
- AC_REQUIRE([gl_LARGEFILE])
- ], [
- WINDOWS_64_BIT_ST_SIZE=0
- ])
- AC_SUBST([WINDOWS_64_BIT_ST_SIZE])
- if test $WINDOWS_64_BIT_ST_SIZE = 1; then
- AC_DEFINE([_GL_WINDOWS_64_BIT_ST_SIZE], [1],
- [Define to 1 if Gnulib overrides 'struct stat' on Windows so that
- struct stat.st_size becomes 64-bit.])
- fi
-
- dnl Define types that are supposed to be defined in <sys/types.h> or
- dnl <sys/stat.h>.
- AC_CHECK_TYPE([nlink_t], [],
- [AC_DEFINE([nlink_t], [int],
- [Define to the type of st_nlink in struct stat, or a supertype.])],
- [#include <sys/types.h>
- #include <sys/stat.h>])
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
- ]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
- mknod mknodat stat utimensat])
-]) # gl_HEADER_SYS_STAT_H
-
-AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SYS_STAT_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_SYS_STAT_H_DEFAULTS],
-[
- AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
- GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT])
- GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT])
- GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
- GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS])
- GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
- GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
- GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT])
- GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO])
- GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT])
- GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD])
- GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT])
- GNULIB_STAT=0; AC_SUBST([GNULIB_STAT])
- GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
- HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
- HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS])
- HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
- HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT])
- HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT])
- HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO])
- HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT])
- HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD])
- HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT])
- HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT])
- REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT])
- REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])
- REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS])
- REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
- REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
- REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO])
- REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD])
- REPLACE_STAT=0; AC_SUBST([REPLACE_STAT])
- REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT])
-])
diff --git a/src/gl/m4/sys_time_h.m4 b/src/gl/m4/sys_time_h.m4
deleted file mode 100644
index 3061a9c185..0000000000
--- a/src/gl/m4/sys_time_h.m4
+++ /dev/null
@@ -1,111 +0,0 @@
-# Configure a replacement for <sys/time.h>.
-# serial 8
-
-# Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# Written by Paul Eggert and Martin Lambers.
-
-AC_DEFUN([gl_HEADER_SYS_TIME_H],
-[
- dnl Use AC_REQUIRE here, so that the REPLACE_GETTIMEOFDAY=0 statement
- dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=1
- dnl statements that occur in other macros.
- AC_REQUIRE([gl_HEADER_SYS_TIME_H_BODY])
-])
-
-AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
-[
- AC_REQUIRE([AC_C_RESTRICT])
- AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
- AC_CHECK_HEADERS_ONCE([sys/time.h])
- gl_CHECK_NEXT_HEADERS([sys/time.h])
-
- if test $ac_cv_header_sys_time_h != yes; then
- HAVE_SYS_TIME_H=0
- fi
-
- dnl On native Windows with MSVC, 'struct timeval' is defined in <winsock2.h>
- dnl only. So include that header in the list.
- gl_PREREQ_SYS_H_WINSOCK2
- AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#if HAVE_SYS_TIME_H
- #include <sys/time.h>
- #endif
- #include <time.h>
- #if HAVE_WINSOCK2_H
- # include <winsock2.h>
- #endif
- ]],
- [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
- [gl_cv_sys_struct_timeval=yes],
- [gl_cv_sys_struct_timeval=no])
- ])
- if test $gl_cv_sys_struct_timeval != yes; then
- HAVE_STRUCT_TIMEVAL=0
- else
- dnl On native Windows with a 64-bit 'time_t', 'struct timeval' is defined
- dnl (in <sys/time.h> and <winsock2.h> for mingw64, in <winsock2.h> only
- dnl for MSVC) with a tv_sec field of type 'long' (32-bit!), which is
- dnl smaller than the 'time_t' type mandated by POSIX.
- dnl On OpenBSD 5.1 amd64, tv_sec is 64 bits and time_t 32 bits, but
- dnl that is good enough.
- AC_CACHE_CHECK([for wide-enough struct timeval.tv_sec member],
- [gl_cv_sys_struct_timeval_tv_sec],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#if HAVE_SYS_TIME_H
- #include <sys/time.h>
- #endif
- #include <time.h>
- #if HAVE_WINSOCK2_H
- # include <winsock2.h>
- #endif
- ]],
- [[static struct timeval x;
- typedef int verify_tv_sec_type[
- sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1
- ];
- ]])],
- [gl_cv_sys_struct_timeval_tv_sec=yes],
- [gl_cv_sys_struct_timeval_tv_sec=no])
- ])
- if test $gl_cv_sys_struct_timeval_tv_sec != yes; then
- REPLACE_STRUCT_TIMEVAL=1
- fi
- fi
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[
-#if HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#include <time.h>
- ]], [gettimeofday])
-])
-
-AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_HEADER_SYS_TIME_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_HEADER_SYS_TIME_H_DEFAULTS],
-[
- GNULIB_GETTIMEOFDAY=0; AC_SUBST([GNULIB_GETTIMEOFDAY])
- dnl Assume POSIX behavior unless another module says otherwise.
- HAVE_GETTIMEOFDAY=1; AC_SUBST([HAVE_GETTIMEOFDAY])
- HAVE_STRUCT_TIMEVAL=1; AC_SUBST([HAVE_STRUCT_TIMEVAL])
- HAVE_SYS_TIME_H=1; AC_SUBST([HAVE_SYS_TIME_H])
- HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T])
- REPLACE_GETTIMEOFDAY=0; AC_SUBST([REPLACE_GETTIMEOFDAY])
- REPLACE_STRUCT_TIMEVAL=0; AC_SUBST([REPLACE_STRUCT_TIMEVAL])
-])
diff --git a/src/gl/m4/sys_types_h.m4 b/src/gl/m4/sys_types_h.m4
deleted file mode 100644
index 159b005b3d..0000000000
--- a/src/gl/m4/sys_types_h.m4
+++ /dev/null
@@ -1,49 +0,0 @@
-# sys_types_h.m4 serial 6
-dnl Copyright (C) 2011-2016 Free Software Foundation, Inc.
-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_ONCE([gl_SYS_TYPES_H],
-[
- AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS])
- gl_NEXT_HEADERS([sys/types.h])
-
- dnl Ensure the type pid_t gets defined.
- AC_REQUIRE([AC_TYPE_PID_T])
-
- dnl Ensure the type mode_t gets defined.
- AC_REQUIRE([AC_TYPE_MODE_T])
-
- dnl Whether to override the 'off_t' type.
- AC_REQUIRE([gl_TYPE_OFF_T])
-])
-
-AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS],
-[
-])
-
-# This works around a buggy version in autoconf <= 2.69.
-# See <https://lists.gnu.org/archive/html/autoconf/2016-08/msg00014.html>
-
-m4_version_prereq([2.70], [], [
-
-# This is taken from the following Autoconf patch:
-# http://git.sv.gnu.org/cgit/autoconf.git/commit/?id=e17a30e98
-
-m4_undefine([AC_HEADER_MAJOR])
-AC_DEFUN([AC_HEADER_MAJOR],
-[AC_CHECK_HEADERS_ONCE([sys/types.h])
-AC_CHECK_HEADER([sys/mkdev.h],
- [AC_DEFINE([MAJOR_IN_MKDEV], [1],
- [Define to 1 if `major', `minor', and `makedev' are declared in
- <mkdev.h>.])])
-if test $ac_cv_header_sys_mkdev_h = no; then
- AC_CHECK_HEADER([sys/sysmacros.h],
- [AC_DEFINE([MAJOR_IN_SYSMACROS], [1],
- [Define to 1 if `major', `minor', and `makedev' are declared in
- <sysmacros.h>.])])
-fi
-])
-
-])
diff --git a/src/gl/m4/sys_uio_h.m4 b/src/gl/m4/sys_uio_h.m4
deleted file mode 100644
index d4d967fd57..0000000000
--- a/src/gl/m4/sys_uio_h.m4
+++ /dev/null
@@ -1,31 +0,0 @@
-# sys_uio_h.m4 serial 1
-dnl Copyright (C) 2011-2016 Free Software Foundation, Inc.
-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_HEADER_SYS_UIO],
-[
- AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS])
- dnl <sys/uio.h> is always overridden, because of GNULIB_POSIXCHECK.
- gl_CHECK_NEXT_HEADERS([sys/uio.h])
- if test $ac_cv_header_sys_uio_h = yes; then
- HAVE_SYS_UIO_H=1
- else
- HAVE_SYS_UIO_H=0
- fi
- AC_SUBST([HAVE_SYS_UIO_H])
-])
-
-AC_DEFUN([gl_SYS_UIO_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SYS_UIO_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_SYS_UIO_H_DEFAULTS],
-[
-])
diff --git a/src/gl/m4/time_h.m4 b/src/gl/m4/time_h.m4
deleted file mode 100644
index eb2a631e2c..0000000000
--- a/src/gl/m4/time_h.m4
+++ /dev/null
@@ -1,134 +0,0 @@
-# Configure a more-standard replacement for <time.h>.
-
-# Copyright (C) 2000-2001, 2003-2007, 2009-2016 Free Software Foundation, Inc.
-
-# serial 9
-
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# Written by Paul Eggert and Jim Meyering.
-
-AC_DEFUN([gl_HEADER_TIME_H],
-[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_HEADER_TIME_H_BODY])
-])
-
-AC_DEFUN([gl_HEADER_TIME_H_BODY],
-[
- AC_REQUIRE([AC_C_RESTRICT])
- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
- gl_NEXT_HEADERS([time.h])
- AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
-])
-
-dnl Check whether 'struct timespec' is declared
-dnl in time.h, sys/time.h, pthread.h, or unistd.h.
-
-AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
-[
- AC_CHECK_HEADERS_ONCE([sys/time.h])
- AC_CACHE_CHECK([for struct timespec in <time.h>],
- [gl_cv_sys_struct_timespec_in_time_h],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <time.h>
- ]],
- [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
- [gl_cv_sys_struct_timespec_in_time_h=yes],
- [gl_cv_sys_struct_timespec_in_time_h=no])])
-
- TIME_H_DEFINES_STRUCT_TIMESPEC=0
- SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
- PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0
- UNISTD_H_DEFINES_STRUCT_TIMESPEC=0
- if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
- TIME_H_DEFINES_STRUCT_TIMESPEC=1
- else
- AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
- [gl_cv_sys_struct_timespec_in_sys_time_h],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <sys/time.h>
- ]],
- [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
- [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
- [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
- if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
- SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
- else
- AC_CACHE_CHECK([for struct timespec in <pthread.h>],
- [gl_cv_sys_struct_timespec_in_pthread_h],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <pthread.h>
- ]],
- [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
- [gl_cv_sys_struct_timespec_in_pthread_h=yes],
- [gl_cv_sys_struct_timespec_in_pthread_h=no])])
- if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then
- PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
- else
- AC_CACHE_CHECK([for struct timespec in <unistd.h>],
- [gl_cv_sys_struct_timespec_in_unistd_h],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <unistd.h>
- ]],
- [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
- [gl_cv_sys_struct_timespec_in_unistd_h=yes],
- [gl_cv_sys_struct_timespec_in_unistd_h=no])])
- if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then
- UNISTD_H_DEFINES_STRUCT_TIMESPEC=1
- fi
- fi
- fi
- fi
- AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
- AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
- AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC])
- AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC])
-])
-
-AC_DEFUN([gl_TIME_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_HEADER_TIME_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_HEADER_TIME_H_DEFAULTS],
-[
- GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME])
- GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP])
- GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME])
- GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM])
- GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R])
- GNULIB_TIME_RZ=0; AC_SUBST([GNULIB_TIME_RZ])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R])
- HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP])
- HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME])
- HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM])
- dnl If another module says to replace or to not replace, do that.
- dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
- dnl this lets maintainers check for portability.
- REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R])
- REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME])
- REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP])
- REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM])
-
- dnl Hack so that the time module doesn't depend on the sys_time module.
- dnl First, default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent.
- : ${GNULIB_GETTIMEOFDAY=0}; AC_SUBST([GNULIB_GETTIMEOFDAY])
- dnl Second, it's OK to not use GNULIB_PORTCHECK for REPLACE_GMTIME
- dnl and REPLACE_LOCALTIME, as portability to Solaris 2.6 and earlier
- dnl is no longer a big deal.
- REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME])
- REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME])
-])
diff --git a/src/gl/m4/time_r.m4 b/src/gl/m4/time_r.m4
deleted file mode 100644
index 21b4a2cc18..0000000000
--- a/src/gl/m4/time_r.m4
+++ /dev/null
@@ -1,58 +0,0 @@
-dnl Reentrant time functions: localtime_r, gmtime_r.
-
-dnl Copyright (C) 2003, 2006-2016 Free Software Foundation, Inc.
-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.
-
-dnl Written by Paul Eggert.
-
-AC_DEFUN([gl_TIME_R],
-[
- dnl Persuade glibc and Solaris <time.h> to declare localtime_r.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
- AC_REQUIRE([AC_C_RESTRICT])
-
- dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is
- dnl not defined.
- AC_CHECK_DECLS([localtime_r], [], [], [[#include <time.h>]])
- if test $ac_cv_have_decl_localtime_r = no; then
- HAVE_DECL_LOCALTIME_R=0
- fi
-
- AC_CHECK_FUNCS_ONCE([localtime_r])
- if test $ac_cv_func_localtime_r = yes; then
- HAVE_LOCALTIME_R=1
- AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature],
- [gl_cv_time_r_posix],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <time.h>]],
- [[/* We don't need to append 'restrict's to the argument types,
- even though the POSIX signature has the 'restrict's,
- since C99 says they can't affect type compatibility. */
- struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r;
- if (ptr) return 0;
- /* Check the return type is a pointer.
- On HP-UX 10 it is 'int'. */
- *localtime_r (0, 0);]])
- ],
- [gl_cv_time_r_posix=yes],
- [gl_cv_time_r_posix=no])
- ])
- if test $gl_cv_time_r_posix = yes; then
- REPLACE_LOCALTIME_R=0
- else
- REPLACE_LOCALTIME_R=1
- fi
- else
- HAVE_LOCALTIME_R=0
- fi
-])
-
-# Prerequisites of lib/time_r.c.
-AC_DEFUN([gl_PREREQ_TIME_R], [
- :
-])
diff --git a/src/gl/m4/time_rz.m4 b/src/gl/m4/time_rz.m4
deleted file mode 100644
index 9b1db1b24b..0000000000
--- a/src/gl/m4/time_rz.m4
+++ /dev/null
@@ -1,21 +0,0 @@
-dnl Time zone functions: tzalloc, localtime_rz, etc.
-
-dnl Copyright (C) 2015-2016 Free Software Foundation, Inc.
-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.
-
-dnl Written by Paul Eggert.
-
-AC_DEFUN([gl_TIME_RZ],
-[
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
- AC_REQUIRE([AC_STRUCT_TIMEZONE])
- AC_CHECK_FUNCS_ONCE([tzset])
-
- AC_CHECK_TYPES([timezone_t], [], [], [[#include <time.h>]])
- if test "$ac_cv_type_timezone_t" = yes; then
- HAVE_TIMEZONE_T=1
- fi
-])
diff --git a/src/gl/m4/timegm.m4 b/src/gl/m4/timegm.m4
deleted file mode 100644
index 752aa43d7e..0000000000
--- a/src/gl/m4/timegm.m4
+++ /dev/null
@@ -1,26 +0,0 @@
-# timegm.m4 serial 11
-dnl Copyright (C) 2003, 2007, 2009-2016 Free Software Foundation, Inc.
-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_FUNC_TIMEGM],
-[
- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
- AC_REQUIRE([gl_FUNC_MKTIME])
- REPLACE_TIMEGM=0
- AC_CHECK_FUNCS_ONCE([timegm])
- if test $ac_cv_func_timegm = yes; then
- if test $gl_cv_func_working_mktime = no; then
- # Assume that timegm is buggy if mktime is.
- REPLACE_TIMEGM=1
- fi
- else
- HAVE_TIMEGM=0
- fi
-])
-
-# Prerequisites of lib/timegm.c.
-AC_DEFUN([gl_PREREQ_TIMEGM], [
- :
-])
diff --git a/src/gl/m4/timespec.m4 b/src/gl/m4/timespec.m4
deleted file mode 100644
index 2482518124..0000000000
--- a/src/gl/m4/timespec.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-#serial 15
-
-# Copyright (C) 2000-2001, 2003-2007, 2009-2016 Free Software Foundation, Inc.
-
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-dnl From Jim Meyering
-
-AC_DEFUN([gl_TIMESPEC], [:])
diff --git a/src/gl/m4/tm_gmtoff.m4 b/src/gl/m4/tm_gmtoff.m4
deleted file mode 100644
index ce0671fd1f..0000000000
--- a/src/gl/m4/tm_gmtoff.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-# tm_gmtoff.m4 serial 3
-dnl Copyright (C) 2002, 2009-2016 Free Software Foundation, Inc.
-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_TM_GMTOFF],
-[
- AC_CHECK_MEMBER([struct tm.tm_gmtoff],
- [AC_DEFINE([HAVE_TM_GMTOFF], [1],
- [Define if struct tm has the tm_gmtoff member.])],
- ,
- [#include <time.h>])
-])
diff --git a/src/gl/m4/unistd_h.m4 b/src/gl/m4/unistd_h.m4
deleted file mode 100644
index 544dadb412..0000000000
--- a/src/gl/m4/unistd_h.m4
+++ /dev/null
@@ -1,189 +0,0 @@
-# unistd_h.m4 serial 68
-dnl Copyright (C) 2006-2016 Free Software Foundation, Inc.
-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.
-
-dnl Written by Simon Josefsson, Bruno Haible.
-
-AC_DEFUN([gl_UNISTD_H],
-[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-
- gl_CHECK_NEXT_HEADERS([unistd.h])
- if test $ac_cv_header_unistd_h = yes; then
- HAVE_UNISTD_H=1
- else
- HAVE_UNISTD_H=0
- fi
- AC_SUBST([HAVE_UNISTD_H])
-
- dnl Ensure the type pid_t gets defined.
- AC_REQUIRE([AC_TYPE_PID_T])
-
- dnl Determine WINDOWS_64_BIT_OFF_T.
- AC_REQUIRE([gl_TYPE_OFF_T])
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-/* Some systems declare various items in the wrong headers. */
-#if !(defined __GLIBC__ && !defined __UCLIBC__)
-# include <fcntl.h>
-# include <stdio.h>
-# include <stdlib.h>
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# include <io.h>
-# endif
-#endif
- ]], [chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat
- fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups
- gethostname getlogin getlogin_r getpagesize
- getusershell setusershell endusershell
- group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite
- readlink readlinkat rmdir sethostname sleep symlink symlinkat ttyname_r
- unlink unlinkat usleep])
-])
-
-AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_UNISTD_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_UNISTD_H_DEFAULTS],
-[
- GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR])
- GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
- GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE])
- GNULIB_DUP=0; AC_SUBST([GNULIB_DUP])
- GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
- GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3])
- GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON])
- GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS])
- GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT])
- GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
- GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT])
- GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC])
- GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC])
- GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
- GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
- GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME])
- GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE])
- GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS])
- GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME])
- GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN])
- GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
- GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
- GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL])
- GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER])
- GNULIB_ISATTY=0; AC_SUBST([GNULIB_ISATTY])
- GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
- GNULIB_LINK=0; AC_SUBST([GNULIB_LINK])
- GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT])
- GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
- GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE])
- GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2])
- GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD])
- GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE])
- GNULIB_READ=0; AC_SUBST([GNULIB_READ])
- GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
- GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT])
- GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR])
- GNULIB_SETHOSTNAME=0; AC_SUBST([GNULIB_SETHOSTNAME])
- GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
- GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK])
- GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT])
- GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R])
- GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING])
- GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
- GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK])
- GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT])
- GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP])
- GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN])
- HAVE_DUP2=1; AC_SUBST([HAVE_DUP2])
- HAVE_DUP3=1; AC_SUBST([HAVE_DUP3])
- HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS])
- HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT])
- HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR])
- HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT])
- HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC])
- HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC])
- HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE])
- HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE])
- HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS])
- HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME])
- HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN])
- HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE])
- HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER])
- HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN])
- HAVE_LINK=1; AC_SUBST([HAVE_LINK])
- HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT])
- HAVE_PIPE=1; AC_SUBST([HAVE_PIPE])
- HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2])
- HAVE_PREAD=1; AC_SUBST([HAVE_PREAD])
- HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE])
- HAVE_READLINK=1; AC_SUBST([HAVE_READLINK])
- HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT])
- HAVE_SETHOSTNAME=1; AC_SUBST([HAVE_SETHOSTNAME])
- HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP])
- HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK])
- HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT])
- HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT])
- HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP])
- HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON])
- HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR])
- HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC])
- HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME])
- HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
- HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])
- HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL])
- HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME])
- HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R])
- HAVE_OS_H=0; AC_SUBST([HAVE_OS_H])
- HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H])
- REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN])
- REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE])
- REPLACE_DUP=0; AC_SUBST([REPLACE_DUP])
- REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2])
- REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT])
- REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE])
- REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
- REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
- REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE])
- REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R])
- REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS])
- REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
- REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY])
- REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
- REPLACE_LINK=0; AC_SUBST([REPLACE_LINK])
- REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT])
- REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
- REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD])
- REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE])
- REPLACE_READ=0; AC_SUBST([REPLACE_READ])
- REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK])
- REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT])
- REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR])
- REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP])
- REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK])
- REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT])
- REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R])
- REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK])
- REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT])
- REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP])
- REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE])
- UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
- UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
- AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
-])
diff --git a/src/gl/m4/vasnprintf.m4 b/src/gl/m4/vasnprintf.m4
deleted file mode 100644
index 2d4b46310b..0000000000
--- a/src/gl/m4/vasnprintf.m4
+++ /dev/null
@@ -1,291 +0,0 @@
-# vasnprintf.m4 serial 36
-dnl Copyright (C) 2002-2004, 2006-2016 Free Software Foundation, Inc.
-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_FUNC_VASNPRINTF],
-[
- AC_CHECK_FUNCS_ONCE([vasnprintf])
- if test $ac_cv_func_vasnprintf = no; then
- gl_REPLACE_VASNPRINTF
- fi
-])
-
-AC_DEFUN([gl_REPLACE_VASNPRINTF],
-[
- AC_CHECK_FUNCS_ONCE([vasnprintf])
- AC_LIBOBJ([vasnprintf])
- AC_LIBOBJ([printf-args])
- AC_LIBOBJ([printf-parse])
- AC_LIBOBJ([asnprintf])
- if test $ac_cv_func_vasnprintf = yes; then
- AC_DEFINE([REPLACE_VASNPRINTF], [1],
- [Define if vasnprintf exists but is overridden by gnulib.])
- fi
- gl_PREREQ_PRINTF_ARGS
- gl_PREREQ_PRINTF_PARSE
- gl_PREREQ_VASNPRINTF
- gl_PREREQ_ASNPRINTF
-])
-
-# Prerequisites of lib/printf-args.h, lib/printf-args.c.
-AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
-[
- AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
- AC_REQUIRE([gt_TYPE_WINT_T])
-])
-
-# Prerequisites of lib/printf-parse.h, lib/printf-parse.c.
-AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
-[
- AC_REQUIRE([gl_FEATURES_H])
- AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
- AC_REQUIRE([gt_TYPE_WINT_T])
- AC_REQUIRE([AC_TYPE_SIZE_T])
- AC_CHECK_TYPE([ptrdiff_t], ,
- [AC_DEFINE([ptrdiff_t], [long],
- [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
- ])
- AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
-])
-
-# Prerequisites of lib/vasnprintf.c.
-AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF],
-[
- AC_REQUIRE([AC_FUNC_ALLOCA])
- AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
- AC_REQUIRE([gt_TYPE_WINT_T])
- AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
- dnl Use the _snprintf function only if it is declared (because on NetBSD it
- dnl is defined as a weak alias of snprintf; we prefer to use the latter).
- AC_CHECK_DECLS([_snprintf], , , [[#include <stdio.h>]])
- dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization
- dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE.
- AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION])
- dnl We can avoid a lot of code by assuming that snprintf's return value
- dnl conforms to ISO C99. So check that.
- AC_REQUIRE([gl_SNPRINTF_RETVAL_C99])
- case "$gl_cv_func_snprintf_retval_c99" in
- *yes)
- AC_DEFINE([HAVE_SNPRINTF_RETVAL_C99], [1],
- [Define if the return value of the snprintf function is the number of
- of bytes (excluding the terminating NUL) that would have been produced
- if the buffer had been large enough.])
- ;;
- esac
-])
-
-# Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
-# arguments.
-AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
-[
- AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
- case "$gl_cv_func_printf_long_double" in
- *yes)
- ;;
- *)
- AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
- [Define if the vasnprintf implementation needs special code for
- 'long double' arguments.])
- ;;
- esac
-])
-
-# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
-# arguments.
-AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
-[
- AC_REQUIRE([gl_PRINTF_INFINITE])
- case "$gl_cv_func_printf_infinite" in
- *yes)
- ;;
- *)
- AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], [1],
- [Define if the vasnprintf implementation needs special code for
- infinite 'double' arguments.])
- ;;
- esac
-])
-
-# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
-# arguments.
-AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
-[
- AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
- dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if
- dnl NEED_PRINTF_LONG_DOUBLE is already set.
- AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE])
- case "$gl_cv_func_printf_long_double" in
- *yes)
- case "$gl_cv_func_printf_infinite_long_double" in
- *yes)
- ;;
- *)
- AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], [1],
- [Define if the vasnprintf implementation needs special code for
- infinite 'long double' arguments.])
- ;;
- esac
- ;;
- esac
-])
-
-# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
-AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
-[
- AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
- case "$gl_cv_func_printf_directive_a" in
- *yes)
- ;;
- *)
- AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1],
- [Define if the vasnprintf implementation needs special code for
- the 'a' and 'A' directives.])
- AC_CHECK_FUNCS([nl_langinfo])
- ;;
- esac
-])
-
-# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
-AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
-[
- AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
- case "$gl_cv_func_printf_directive_f" in
- *yes)
- ;;
- *)
- AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], [1],
- [Define if the vasnprintf implementation needs special code for
- the 'F' directive.])
- ;;
- esac
-])
-
-# Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive.
-AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS],
-[
- AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
- case "$gl_cv_func_printf_directive_ls" in
- *yes)
- ;;
- *)
- AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1],
- [Define if the vasnprintf implementation needs special code for
- the 'ls' directive.])
- ;;
- esac
-])
-
-# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
-AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
-[
- AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
- case "$gl_cv_func_printf_flag_grouping" in
- *yes)
- ;;
- *)
- AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
- [Define if the vasnprintf implementation needs special code for the
- ' flag.])
- ;;
- esac
-])
-
-# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
-AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
-[
- AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
- case "$gl_cv_func_printf_flag_leftadjust" in
- *yes)
- ;;
- *)
- AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], [1],
- [Define if the vasnprintf implementation needs special code for the
- '-' flag.])
- ;;
- esac
-])
-
-# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
-AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
-[
- AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
- case "$gl_cv_func_printf_flag_zero" in
- *yes)
- ;;
- *)
- AC_DEFINE([NEED_PRINTF_FLAG_ZERO], [1],
- [Define if the vasnprintf implementation needs special code for the
- 0 flag.])
- ;;
- esac
-])
-
-# Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
-AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
-[
- AC_REQUIRE([gl_PRINTF_PRECISION])
- case "$gl_cv_func_printf_precision" in
- *yes)
- ;;
- *)
- AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], [1],
- [Define if the vasnprintf implementation needs special code for
- supporting large precisions without arbitrary bounds.])
- AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
- [Define if the vasnprintf implementation needs special code for
- 'double' arguments.])
- AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
- [Define if the vasnprintf implementation needs special code for
- 'long double' arguments.])
- ;;
- esac
-])
-
-# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
-# conditions.
-AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
-[
- AC_REQUIRE([gl_PRINTF_ENOMEM])
- case "$gl_cv_func_printf_enomem" in
- *yes)
- ;;
- *)
- AC_DEFINE([NEED_PRINTF_ENOMEM], [1],
- [Define if the vasnprintf implementation needs special code for
- surviving out-of-memory conditions.])
- AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
- [Define if the vasnprintf implementation needs special code for
- 'double' arguments.])
- AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
- [Define if the vasnprintf implementation needs special code for
- 'long double' arguments.])
- ;;
- esac
-])
-
-# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
-AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
-[
- AC_REQUIRE([gl_PREREQ_VASNPRINTF])
- gl_PREREQ_VASNPRINTF_LONG_DOUBLE
- gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
- gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
- gl_PREREQ_VASNPRINTF_DIRECTIVE_A
- gl_PREREQ_VASNPRINTF_DIRECTIVE_F
- gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
- gl_PREREQ_VASNPRINTF_FLAG_GROUPING
- gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
- gl_PREREQ_VASNPRINTF_FLAG_ZERO
- gl_PREREQ_VASNPRINTF_PRECISION
- gl_PREREQ_VASNPRINTF_ENOMEM
-])
-
-# Prerequisites of lib/asnprintf.c.
-AC_DEFUN([gl_PREREQ_ASNPRINTF],
-[
-])
diff --git a/src/gl/m4/warn-on-use.m4 b/src/gl/m4/warn-on-use.m4
deleted file mode 100644
index 08440ec593..0000000000
--- a/src/gl/m4/warn-on-use.m4
+++ /dev/null
@@ -1,47 +0,0 @@
-# warn-on-use.m4 serial 5
-dnl Copyright (C) 2010-2016 Free Software Foundation, Inc.
-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.
-
-# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES)
-# ---------------------------------------
-# For each whitespace-separated element in the list of NAMES, define
-# HAVE_RAW_DECL_name if the function has a declaration among INCLUDES
-# even after being undefined as a macro.
-#
-# See warn-on-use.h for some hints on how to poison function names, as
-# well as ideas on poisoning global variables and macros. NAMES may
-# include global variables, but remember that only functions work with
-# _GL_WARN_ON_USE. Typically, INCLUDES only needs to list a single
-# header, but if the replacement header pulls in other headers because
-# some systems declare functions in the wrong header, then INCLUDES
-# should do likewise.
-#
-# It is generally safe to assume declarations for functions declared
-# in the intersection of C89 and C11 (such as printf) without
-# needing gl_WARN_ON_USE_PREPARE.
-AC_DEFUN([gl_WARN_ON_USE_PREPARE],
-[
- m4_foreach_w([gl_decl], [$2],
- [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])),
- [Define to 1 if ]m4_defn([gl_decl])[ is declared even after
- undefining macros.])])dnl
-dnl FIXME: gl_Symbol must be used unquoted until we can assume
-dnl autoconf 2.64 or newer.
- for gl_func in m4_flatten([$2]); do
- AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl
- AC_CACHE_CHECK([whether $gl_func is declared without a macro],
- gl_Symbol,
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1],
-[@%:@undef $gl_func
- (void) $gl_func;])],
- [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])])
- AS_VAR_IF(gl_Symbol, [yes],
- [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1])
- dnl shortcut - if the raw declaration exists, then set a cache
- dnl variable to allow skipping any later AC_CHECK_DECL efforts
- eval ac_cv_have_decl_$gl_func=yes])
- AS_VAR_POPDEF([gl_Symbol])dnl
- done
-])
diff --git a/src/gl/m4/wchar_h.m4 b/src/gl/m4/wchar_h.m4
deleted file mode 100644
index 16017a59fb..0000000000
--- a/src/gl/m4/wchar_h.m4
+++ /dev/null
@@ -1,233 +0,0 @@
-dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
-
-dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
-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.
-
-dnl Written by Eric Blake.
-
-# wchar_h.m4 serial 40
-
-AC_DEFUN([gl_WCHAR_H],
-[
- AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
- AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
- dnl Prepare for creating substitute <wchar.h>.
- dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
- dnl character support).
- dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK.
- gl_CHECK_NEXT_HEADERS([wchar.h])
- if test $ac_cv_header_wchar_h = yes; then
- HAVE_WCHAR_H=1
- else
- HAVE_WCHAR_H=0
- fi
- AC_SUBST([HAVE_WCHAR_H])
-
- AC_REQUIRE([gl_FEATURES_H])
-
- AC_REQUIRE([gt_TYPE_WINT_T])
- if test $gt_cv_c_wint_t = yes; then
- HAVE_WINT_T=1
- else
- HAVE_WINT_T=0
- fi
- AC_SUBST([HAVE_WINT_T])
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[
-/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
- <wchar.h>.
- BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
- included before <wchar.h>. */
-#if !(defined __GLIBC__ && !defined __UCLIBC__)
-# include <stddef.h>
-# include <stdio.h>
-# include <time.h>
-#endif
-#include <wchar.h>
- ]],
- [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
- wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset
- wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp
- wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr
- wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth
- ])
-])
-
-dnl Check whether <wchar.h> is usable at all.
-AC_DEFUN([gl_WCHAR_H_INLINE_OK],
-[
- dnl Test whether <wchar.h> suffers due to the transition from '__inline' to
- dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022>
- dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary,
- dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and
- dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>.
- AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly],
- [gl_cv_header_wchar_h_correct_inline],
- [gl_cv_header_wchar_h_correct_inline=yes
- AC_LANG_CONFTEST([
- AC_LANG_SOURCE([[#define wcstod renamed_wcstod
-/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
- <wchar.h>.
- BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
- included before <wchar.h>. */
-#include <stddef.h>
-#include <stdio.h>
-#include <time.h>
-#include <wchar.h>
-extern int zero (void);
-int main () { return zero(); }
-]])])
- dnl Do not rename the object file from conftest.$ac_objext to
- dnl conftest1.$ac_objext, as this will cause the link to fail on
- dnl z/OS when using the XPLINK object format (due to duplicate
- dnl CSECT names). Instead, temporarily redefine $ac_compile so
- dnl that the object file has the latter name from the start.
- save_ac_compile="$ac_compile"
- ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/`
- if AC_TRY_EVAL([ac_compile]); then
- AC_LANG_CONFTEST([
- AC_LANG_SOURCE([[#define wcstod renamed_wcstod
-/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
- <wchar.h>.
- BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
- included before <wchar.h>. */
-#include <stddef.h>
-#include <stdio.h>
-#include <time.h>
-#include <wchar.h>
-int zero (void) { return 0; }
-]])])
- dnl See note above about renaming object files.
- ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/`
- if AC_TRY_EVAL([ac_compile]); then
- if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then
- :
- else
- gl_cv_header_wchar_h_correct_inline=no
- fi
- fi
- fi
- ac_compile="$save_ac_compile"
- rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext
- ])
- if test $gl_cv_header_wchar_h_correct_inline = no; then
- AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS).
-This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in
-C99 mode. You have four options:
- - Add the flag -fgnu89-inline to CC and reconfigure, or
- - Fix your include files, using parts of
- <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or
- - Use a gcc version older than 4.3, or
- - Don't use the flags -std=c99 or -std=gnu99.
-Configuration aborted.])
- fi
-])
-
-AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_WCHAR_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_WCHAR_H_DEFAULTS],
-[
- GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC])
- GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB])
- GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT])
- GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC])
- GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN])
- GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS])
- GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS])
- GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB])
- GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS])
- GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
- GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
- GNULIB_WMEMCHR=0; AC_SUBST([GNULIB_WMEMCHR])
- GNULIB_WMEMCMP=0; AC_SUBST([GNULIB_WMEMCMP])
- GNULIB_WMEMCPY=0; AC_SUBST([GNULIB_WMEMCPY])
- GNULIB_WMEMMOVE=0; AC_SUBST([GNULIB_WMEMMOVE])
- GNULIB_WMEMSET=0; AC_SUBST([GNULIB_WMEMSET])
- GNULIB_WCSLEN=0; AC_SUBST([GNULIB_WCSLEN])
- GNULIB_WCSNLEN=0; AC_SUBST([GNULIB_WCSNLEN])
- GNULIB_WCSCPY=0; AC_SUBST([GNULIB_WCSCPY])
- GNULIB_WCPCPY=0; AC_SUBST([GNULIB_WCPCPY])
- GNULIB_WCSNCPY=0; AC_SUBST([GNULIB_WCSNCPY])
- GNULIB_WCPNCPY=0; AC_SUBST([GNULIB_WCPNCPY])
- GNULIB_WCSCAT=0; AC_SUBST([GNULIB_WCSCAT])
- GNULIB_WCSNCAT=0; AC_SUBST([GNULIB_WCSNCAT])
- GNULIB_WCSCMP=0; AC_SUBST([GNULIB_WCSCMP])
- GNULIB_WCSNCMP=0; AC_SUBST([GNULIB_WCSNCMP])
- GNULIB_WCSCASECMP=0; AC_SUBST([GNULIB_WCSCASECMP])
- GNULIB_WCSNCASECMP=0; AC_SUBST([GNULIB_WCSNCASECMP])
- GNULIB_WCSCOLL=0; AC_SUBST([GNULIB_WCSCOLL])
- GNULIB_WCSXFRM=0; AC_SUBST([GNULIB_WCSXFRM])
- GNULIB_WCSDUP=0; AC_SUBST([GNULIB_WCSDUP])
- GNULIB_WCSCHR=0; AC_SUBST([GNULIB_WCSCHR])
- GNULIB_WCSRCHR=0; AC_SUBST([GNULIB_WCSRCHR])
- GNULIB_WCSCSPN=0; AC_SUBST([GNULIB_WCSCSPN])
- GNULIB_WCSSPN=0; AC_SUBST([GNULIB_WCSSPN])
- GNULIB_WCSPBRK=0; AC_SUBST([GNULIB_WCSPBRK])
- GNULIB_WCSSTR=0; AC_SUBST([GNULIB_WCSSTR])
- GNULIB_WCSTOK=0; AC_SUBST([GNULIB_WCSTOK])
- GNULIB_WCSWIDTH=0; AC_SUBST([GNULIB_WCSWIDTH])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC])
- HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT])
- HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC])
- HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN])
- HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS])
- HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS])
- HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB])
- HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS])
- HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS])
- HAVE_WMEMCHR=1; AC_SUBST([HAVE_WMEMCHR])
- HAVE_WMEMCMP=1; AC_SUBST([HAVE_WMEMCMP])
- HAVE_WMEMCPY=1; AC_SUBST([HAVE_WMEMCPY])
- HAVE_WMEMMOVE=1; AC_SUBST([HAVE_WMEMMOVE])
- HAVE_WMEMSET=1; AC_SUBST([HAVE_WMEMSET])
- HAVE_WCSLEN=1; AC_SUBST([HAVE_WCSLEN])
- HAVE_WCSNLEN=1; AC_SUBST([HAVE_WCSNLEN])
- HAVE_WCSCPY=1; AC_SUBST([HAVE_WCSCPY])
- HAVE_WCPCPY=1; AC_SUBST([HAVE_WCPCPY])
- HAVE_WCSNCPY=1; AC_SUBST([HAVE_WCSNCPY])
- HAVE_WCPNCPY=1; AC_SUBST([HAVE_WCPNCPY])
- HAVE_WCSCAT=1; AC_SUBST([HAVE_WCSCAT])
- HAVE_WCSNCAT=1; AC_SUBST([HAVE_WCSNCAT])
- HAVE_WCSCMP=1; AC_SUBST([HAVE_WCSCMP])
- HAVE_WCSNCMP=1; AC_SUBST([HAVE_WCSNCMP])
- HAVE_WCSCASECMP=1; AC_SUBST([HAVE_WCSCASECMP])
- HAVE_WCSNCASECMP=1; AC_SUBST([HAVE_WCSNCASECMP])
- HAVE_WCSCOLL=1; AC_SUBST([HAVE_WCSCOLL])
- HAVE_WCSXFRM=1; AC_SUBST([HAVE_WCSXFRM])
- HAVE_WCSDUP=1; AC_SUBST([HAVE_WCSDUP])
- HAVE_WCSCHR=1; AC_SUBST([HAVE_WCSCHR])
- HAVE_WCSRCHR=1; AC_SUBST([HAVE_WCSRCHR])
- HAVE_WCSCSPN=1; AC_SUBST([HAVE_WCSCSPN])
- HAVE_WCSSPN=1; AC_SUBST([HAVE_WCSSPN])
- HAVE_WCSPBRK=1; AC_SUBST([HAVE_WCSPBRK])
- HAVE_WCSSTR=1; AC_SUBST([HAVE_WCSSTR])
- HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK])
- HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH])
- HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB])
- HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
- REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T])
- REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC])
- REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB])
- REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT])
- REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC])
- REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN])
- REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS])
- REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS])
- REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB])
- REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS])
- REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
- REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
- REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH])
-])
diff --git a/src/gl/m4/wchar_t.m4 b/src/gl/m4/wchar_t.m4
deleted file mode 100644
index 2db8c3f2f6..0000000000
--- a/src/gl/m4/wchar_t.m4
+++ /dev/null
@@ -1,24 +0,0 @@
-# wchar_t.m4 serial 4 (gettext-0.18.2)
-dnl Copyright (C) 2002-2003, 2008-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Bruno Haible.
-dnl Test whether <stddef.h> has the 'wchar_t' type.
-dnl Prerequisite: AC_PROG_CC
-
-AC_DEFUN([gt_TYPE_WCHAR_T],
-[
- AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <stddef.h>
- wchar_t foo = (wchar_t)'\0';]],
- [[]])],
- [gt_cv_c_wchar_t=yes],
- [gt_cv_c_wchar_t=no])])
- if test $gt_cv_c_wchar_t = yes; then
- AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
- fi
-])
diff --git a/src/gl/m4/wint_t.m4 b/src/gl/m4/wint_t.m4
deleted file mode 100644
index 8ff2a5b5a2..0000000000
--- a/src/gl/m4/wint_t.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-# wint_t.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
-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.
-
-dnl From Bruno Haible.
-dnl Test whether <wchar.h> has the 'wint_t' type.
-dnl Prerequisite: AC_PROG_CC
-
-AC_DEFUN([gt_TYPE_WINT_T],
-[
- AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
- <wchar.h>.
- BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
- before <wchar.h>. */
-#include <stddef.h>
-#include <stdio.h>
-#include <time.h>
-#include <wchar.h>
- wint_t foo = (wchar_t)'\0';]],
- [[]])],
- [gt_cv_c_wint_t=yes],
- [gt_cv_c_wint_t=no])])
- if test $gt_cv_c_wint_t = yes; then
- AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
- fi
-])
diff --git a/src/gl/m4/xalloc.m4 b/src/gl/m4/xalloc.m4
deleted file mode 100644
index f4f540d118..0000000000
--- a/src/gl/m4/xalloc.m4
+++ /dev/null
@@ -1,7 +0,0 @@
-# xalloc.m4 serial 18
-dnl Copyright (C) 2002-2006, 2009-2016 Free Software Foundation, Inc.
-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_XALLOC], [:])
diff --git a/src/gl/m4/xsize.m4 b/src/gl/m4/xsize.m4
deleted file mode 100644
index 16764e89dd..0000000000
--- a/src/gl/m4/xsize.m4
+++ /dev/null
@@ -1,12 +0,0 @@
-# xsize.m4 serial 5
-dnl Copyright (C) 2003-2004, 2008-2016 Free Software Foundation, Inc.
-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_XSIZE],
-[
- dnl Prerequisites of lib/xsize.h.
- AC_REQUIRE([gl_SIZE_MAX])
- AC_CHECK_HEADERS([stdint.h])
-])
diff --git a/src/gl/malloc.c b/src/gl/malloc.c
deleted file mode 100644
index e9b01d2615..0000000000
--- a/src/gl/malloc.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* malloc() function that is glibc compatible.
-
- Copyright (C) 1997-1998, 2006-2007, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* written by Jim Meyering and Bruno Haible */
-
-#define _GL_USE_STDLIB_ALLOC 1
-#include <config.h>
-/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */
-#ifdef malloc
-# define NEED_MALLOC_GNU 1
-# undef malloc
-/* Whereas the gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */
-#elif GNULIB_MALLOC_GNU && !HAVE_MALLOC_GNU
-# define NEED_MALLOC_GNU 1
-#endif
-
-#include <stdlib.h>
-
-#include <errno.h>
-
-/* Allocate an N-byte block of memory from the heap.
- If N is zero, allocate a 1-byte block. */
-
-void *
-rpl_malloc (size_t n)
-{
- void *result;
-
-#if NEED_MALLOC_GNU
- if (n == 0)
- n = 1;
-#endif
-
- result = malloc (n);
-
-#if !HAVE_MALLOC_POSIX
- if (result == NULL)
- errno = ENOMEM;
-#endif
-
- return result;
-}
diff --git a/src/gl/malloca.c b/src/gl/malloca.c
deleted file mode 100644
index a6132775b1..0000000000
--- a/src/gl/malloca.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Safe automatic memory allocation.
- Copyright (C) 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#define _GL_USE_STDLIB_ALLOC 1
-#include <config.h>
-
-/* Specification. */
-#include "malloca.h"
-
-#include <stdint.h>
-
-#include "verify.h"
-
-/* The speed critical point in this file is freea() applied to an alloca()
- result: it must be fast, to match the speed of alloca(). The speed of
- mmalloca() and freea() in the other case are not critical, because they
- are only invoked for big memory sizes. */
-
-#if HAVE_ALLOCA
-
-/* Store the mmalloca() results in a hash table. This is needed to reliably
- distinguish a mmalloca() result and an alloca() result.
-
- Although it is possible that the same pointer is returned by alloca() and
- by mmalloca() at different times in the same application, it does not lead
- to a bug in freea(), because:
- - Before a pointer returned by alloca() can point into malloc()ed memory,
- the function must return, and once this has happened the programmer must
- not call freea() on it anyway.
- - Before a pointer returned by mmalloca() can point into the stack, it
- must be freed. The only function that can free it is freea(), and
- when freea() frees it, it also removes it from the hash table. */
-
-#define MAGIC_NUMBER 0x1415fb4a
-#define MAGIC_SIZE sizeof (int)
-/* This is how the header info would look like without any alignment
- considerations. */
-struct preliminary_header { void *next; int magic; };
-/* But the header's size must be a multiple of sa_alignment_max. */
-#define HEADER_SIZE \
- (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max)
-union header {
- void *next;
- struct {
- char room[HEADER_SIZE - MAGIC_SIZE];
- int word;
- } magic;
-};
-verify (HEADER_SIZE == sizeof (union header));
-/* We make the hash table quite big, so that during lookups the probability
- of empty hash buckets is quite high. There is no need to make the hash
- table resizable, because when the hash table gets filled so much that the
- lookup becomes slow, it means that the application has memory leaks. */
-#define HASH_TABLE_SIZE 257
-static void * mmalloca_results[HASH_TABLE_SIZE];
-
-#endif
-
-void *
-mmalloca (size_t n)
-{
-#if HAVE_ALLOCA
- /* Allocate one more word, that serves as an indicator for malloc()ed
- memory, so that freea() of an alloca() result is fast. */
- size_t nplus = n + HEADER_SIZE;
-
- if (nplus >= n)
- {
- void *p = malloc (nplus);
-
- if (p != NULL)
- {
- size_t slot;
- union header *h = p;
-
- p = h + 1;
-
- /* Put a magic number into the indicator word. */
- h->magic.word = MAGIC_NUMBER;
-
- /* Enter p into the hash table. */
- slot = (uintptr_t) p % HASH_TABLE_SIZE;
- h->next = mmalloca_results[slot];
- mmalloca_results[slot] = p;
-
- return p;
- }
- }
- /* Out of memory. */
- return NULL;
-#else
-# if !MALLOC_0_IS_NONNULL
- if (n == 0)
- n = 1;
-# endif
- return malloc (n);
-#endif
-}
-
-#if HAVE_ALLOCA
-void
-freea (void *p)
-{
- /* mmalloca() may have returned NULL. */
- if (p != NULL)
- {
- /* Attempt to quickly distinguish the mmalloca() result - which has
- a magic indicator word - and the alloca() result - which has an
- uninitialized indicator word. It is for this test that sa_increment
- additional bytes are allocated in the alloca() case. */
- if (((int *) p)[-1] == MAGIC_NUMBER)
- {
- /* Looks like a mmalloca() result. To see whether it really is one,
- perform a lookup in the hash table. */
- size_t slot = (uintptr_t) p % HASH_TABLE_SIZE;
- void **chain = &mmalloca_results[slot];
- for (; *chain != NULL;)
- {
- union header *h = p;
- if (*chain == p)
- {
- /* Found it. Remove it from the hash table and free it. */
- union header *p_begin = h - 1;
- *chain = p_begin->next;
- free (p_begin);
- return;
- }
- h = *chain;
- chain = &h[-1].next;
- }
- }
- /* At this point, we know it was not a mmalloca() result. */
- }
-}
-#endif
diff --git a/src/gl/malloca.h b/src/gl/malloca.h
deleted file mode 100644
index fa27a9e7a2..0000000000
--- a/src/gl/malloca.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* Safe automatic memory allocation.
- Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _MALLOCA_H
-#define _MALLOCA_H
-
-#include <alloca.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call
- alloca(N); otherwise it returns NULL. It either returns N bytes of
- memory allocated on the stack, that lasts until the function returns,
- or NULL.
- Use of safe_alloca should be avoided:
- - inside arguments of function calls - undefined behaviour,
- - in inline functions - the allocation may actually last until the
- calling function returns.
-*/
-#if HAVE_ALLOCA
-/* The OS usually guarantees only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- allocate anything larger than 4096 bytes. Also care for the possibility
- of a few compiler-allocated temporary stack slots.
- This must be a macro, not a function. */
-# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL)
-#else
-# define safe_alloca(N) ((void) (N), NULL)
-#endif
-
-/* malloca(N) is a safe variant of alloca(N). It allocates N bytes of
- memory allocated on the stack, that must be freed using freea() before
- the function returns. Upon failure, it returns NULL. */
-#if HAVE_ALLOCA
-# define malloca(N) \
- ((N) < 4032 - sa_increment \
- ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \
- : mmalloca (N))
-#else
-# define malloca(N) \
- mmalloca (N)
-#endif
-extern void * mmalloca (size_t n);
-
-/* Free a block of memory allocated through malloca(). */
-#if HAVE_ALLOCA
-extern void freea (void *p);
-#else
-# define freea free
-#endif
-
-/* nmalloca(N,S) is an overflow-safe variant of malloca (N * S).
- It allocates an array of N objects, each with S bytes of memory,
- on the stack. S must be positive and N must be nonnegative.
- The array must be freed using freea() before the function returns. */
-#if 1
-/* Cf. the definition of xalloc_oversized. */
-# define nmalloca(n, s) \
- ((n) > (size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) \
- ? NULL \
- : malloca ((n) * (s)))
-#else
-extern void * nmalloca (size_t n, size_t s);
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-/* ------------------- Auxiliary, non-public definitions ------------------- */
-
-/* Determine the alignment of a type at compile time. */
-#if defined __GNUC__ || defined __IBM__ALIGNOF__
-# define sa_alignof __alignof__
-#elif defined __cplusplus
- template <class type> struct sa_alignof_helper { char __slot1; type __slot2; };
-# define sa_alignof(type) offsetof (sa_alignof_helper<type>, __slot2)
-#elif defined __hpux
- /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof
- values. */
-# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
-#elif defined _AIX
- /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof
- values. */
-# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
-#else
-# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
-#endif
-
-enum
-{
-/* The desired alignment of memory allocations is the maximum alignment
- among all elementary types. */
- sa_alignment_long = sa_alignof (long),
- sa_alignment_double = sa_alignof (double),
-#if HAVE_LONG_LONG_INT
- sa_alignment_longlong = sa_alignof (long long),
-#endif
- sa_alignment_longdouble = sa_alignof (long double),
- sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
-#if HAVE_LONG_LONG_INT
- | (sa_alignment_longlong - 1)
-#endif
- | (sa_alignment_longdouble - 1)
- ) + 1,
-/* The increment that guarantees room for a magic word must be >= sizeof (int)
- and a multiple of sa_alignment_max. */
- sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max
-};
-
-#endif /* _MALLOCA_H */
diff --git a/src/gl/malloca.valgrind b/src/gl/malloca.valgrind
deleted file mode 100644
index 52f0a50f57..0000000000
--- a/src/gl/malloca.valgrind
+++ /dev/null
@@ -1,7 +0,0 @@
-# Suppress a valgrind message about use of uninitialized memory in freea().
-# This use is OK because it provides only a speedup.
-{
- freea
- Memcheck:Cond
- fun:freea
-}
diff --git a/src/gl/memchr.c b/src/gl/memchr.c
deleted file mode 100644
index b565542c39..0000000000
--- a/src/gl/memchr.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2016
- Free Software Foundation, Inc.
-
- Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
- with help from Dan Sahlin (dan@sics.se) and
- commentary by Jim Blandy (jimb@ai.mit.edu);
- adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
- and implemented by Roland McGrath (roland@ai.mit.edu).
-
-NOTE: The canonical source of this file is maintained with the GNU C Library.
-Bugs can be reported to bug-glibc@prep.ai.mit.edu.
-
-This program is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or any
-later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _LIBC
-# include <config.h>
-#endif
-
-#include <string.h>
-
-#include <stddef.h>
-
-#if defined _LIBC
-# include <memcopy.h>
-#else
-# define reg_char char
-#endif
-
-#include <limits.h>
-
-#if HAVE_BP_SYM_H || defined _LIBC
-# include <bp-sym.h>
-#else
-# define BP_SYM(sym) sym
-#endif
-
-#undef __memchr
-#ifdef _LIBC
-# undef memchr
-#endif
-
-#ifndef weak_alias
-# define __memchr memchr
-#endif
-
-/* Search no more than N bytes of S for C. */
-void *
-__memchr (void const *s, int c_in, size_t n)
-{
- /* On 32-bit hardware, choosing longword to be a 32-bit unsigned
- long instead of a 64-bit uintmax_t tends to give better
- performance. On 64-bit hardware, unsigned long is generally 64
- bits already. Change this typedef to experiment with
- performance. */
- typedef unsigned long int longword;
-
- const unsigned char *char_ptr;
- const longword *longword_ptr;
- longword repeated_one;
- longword repeated_c;
- unsigned reg_char c;
-
- c = (unsigned char) c_in;
-
- /* Handle the first few bytes by reading one byte at a time.
- Do this until CHAR_PTR is aligned on a longword boundary. */
- for (char_ptr = (const unsigned char *) s;
- n > 0 && (size_t) char_ptr % sizeof (longword) != 0;
- --n, ++char_ptr)
- if (*char_ptr == c)
- return (void *) char_ptr;
-
- longword_ptr = (const longword *) char_ptr;
-
- /* All these elucidatory comments refer to 4-byte longwords,
- but the theory applies equally well to any size longwords. */
-
- /* Compute auxiliary longword values:
- repeated_one is a value which has a 1 in every byte.
- repeated_c has c in every byte. */
- repeated_one = 0x01010101;
- repeated_c = c | (c << 8);
- repeated_c |= repeated_c << 16;
- if (0xffffffffU < (longword) -1)
- {
- repeated_one |= repeated_one << 31 << 1;
- repeated_c |= repeated_c << 31 << 1;
- if (8 < sizeof (longword))
- {
- size_t i;
-
- for (i = 64; i < sizeof (longword) * 8; i *= 2)
- {
- repeated_one |= repeated_one << i;
- repeated_c |= repeated_c << i;
- }
- }
- }
-
- /* Instead of the traditional loop which tests each byte, we will test a
- longword at a time. The tricky part is testing if *any of the four*
- bytes in the longword in question are equal to c. We first use an xor
- with repeated_c. This reduces the task to testing whether *any of the
- four* bytes in longword1 is zero.
-
- We compute tmp =
- ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
- That is, we perform the following operations:
- 1. Subtract repeated_one.
- 2. & ~longword1.
- 3. & a mask consisting of 0x80 in every byte.
- Consider what happens in each byte:
- - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
- and step 3 transforms it into 0x80. A carry can also be propagated
- to more significant bytes.
- - If a byte of longword1 is nonzero, let its lowest 1 bit be at
- position k (0 <= k <= 7); so the lowest k bits are 0. After step 1,
- the byte ends in a single bit of value 0 and k bits of value 1.
- After step 2, the result is just k bits of value 1: 2^k - 1. After
- step 3, the result is 0. And no carry is produced.
- So, if longword1 has only non-zero bytes, tmp is zero.
- Whereas if longword1 has a zero byte, call j the position of the least
- significant zero byte. Then the result has a zero at positions 0, ...,
- j-1 and a 0x80 at position j. We cannot predict the result at the more
- significant bytes (positions j+1..3), but it does not matter since we
- already have a non-zero bit at position 8*j+7.
-
- So, the test whether any byte in longword1 is zero is equivalent to
- testing whether tmp is nonzero. */
-
- while (n >= sizeof (longword))
- {
- longword longword1 = *longword_ptr ^ repeated_c;
-
- if ((((longword1 - repeated_one) & ~longword1)
- & (repeated_one << 7)) != 0)
- break;
- longword_ptr++;
- n -= sizeof (longword);
- }
-
- char_ptr = (const unsigned char *) longword_ptr;
-
- /* At this point, we know that either n < sizeof (longword), or one of the
- sizeof (longword) bytes starting at char_ptr is == c. On little-endian
- machines, we could determine the first such byte without any further
- memory accesses, just by looking at the tmp result from the last loop
- iteration. But this does not work on big-endian machines. Choose code
- that works in both cases. */
-
- for (; n > 0; --n, ++char_ptr)
- {
- if (*char_ptr == c)
- return (void *) char_ptr;
- }
-
- return NULL;
-}
-#ifdef weak_alias
-weak_alias (__memchr, BP_SYM (memchr))
-#endif
diff --git a/src/gl/memchr.valgrind b/src/gl/memchr.valgrind
deleted file mode 100644
index 60f247e10d..0000000000
--- a/src/gl/memchr.valgrind
+++ /dev/null
@@ -1,14 +0,0 @@
-# Suppress a valgrind message about use of uninitialized memory in memchr().
-# POSIX states that when the character is found, memchr must not read extra
-# bytes in an overestimated length (for example, where memchr is used to
-# implement strnlen). However, we use a safe word read to provide a speedup.
-{
- memchr-value4
- Memcheck:Value4
- fun:rpl_memchr
-}
-{
- memchr-value8
- Memcheck:Value8
- fun:rpl_memchr
-}
diff --git a/src/gl/minmax.h b/src/gl/minmax.h
deleted file mode 100644
index be6b321ee1..0000000000
--- a/src/gl/minmax.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* MIN, MAX macros.
- Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2016 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _MINMAX_H
-#define _MINMAX_H
-
-/* Note: MIN, MAX are also defined in <sys/param.h> on some systems
- (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about
- MIN, MAX macro redefinitions on some systems; the workaround is to
- #include this file as the last one among the #include list. */
-
-/* Before we define the following symbols we get the <limits.h> file
- since otherwise we get redefinitions on some systems if <limits.h> is
- included after this file. Likewise for <sys/param.h>.
- If more than one of these system headers define MIN and MAX, pick just
- one of the headers (because the definitions most likely are the same). */
-#if HAVE_MINMAX_IN_LIMITS_H
-# include <limits.h>
-#elif HAVE_MINMAX_IN_SYS_PARAM_H
-# include <sys/param.h>
-#endif
-
-/* Note: MIN and MAX should be used with two arguments of the
- same type. They might not return the minimum and maximum of their two
- arguments, if the arguments have different types or have unusual
- floating-point values. For example, on a typical host with 32-bit 'int',
- 64-bit 'long long', and 64-bit IEEE 754 'double' types:
-
- MAX (-1, 2147483648) returns 4294967295.
- MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0.
- MAX (NaN, 0.0) returns 0.0.
- MAX (+0.0, -0.0) returns -0.0.
-
- and in each case the answer is in some sense bogus. */
-
-/* MAX(a,b) returns the maximum of A and B. */
-#ifndef MAX
-# define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-/* MIN(a,b) returns the minimum of A and B. */
-#ifndef MIN
-# define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
-#endif /* _MINMAX_H */
diff --git a/src/gl/mktime-internal.h b/src/gl/mktime-internal.h
deleted file mode 100644
index 2f586aef64..0000000000
--- a/src/gl/mktime-internal.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* mktime variant that also uses an offset guess
-
- Copyright 2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <time.h>
-
-/* mktime_offset_t is a signed type wide enough to hold a UTC offset
- in seconds, and used as part of the type of the offset-guess
- argument to mktime_internal. Use time_t on platforms where time_t
- is signed, to be compatible with platforms like BeOS that export
- this implementation detail of mktime. On platforms where time_t is
- unsigned, GNU and POSIX code can assume 'int' is at least 32 bits
- which is wide enough for a UTC offset. */
-
-#if TIME_T_IS_SIGNED
-typedef time_t mktime_offset_t;
-#else
-typedef int mktime_offset_t;
-#endif
-
-time_t mktime_internal (struct tm *,
- struct tm * (*) (time_t const *, struct tm *),
- mktime_offset_t *);
diff --git a/src/gl/mktime.c b/src/gl/mktime.c
deleted file mode 100644
index 8ee4e5ecab..0000000000
--- a/src/gl/mktime.c
+++ /dev/null
@@ -1,630 +0,0 @@
-/* Convert a 'struct tm' to a time_t value.
- Copyright (C) 1993-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Paul Eggert <eggert@twinsun.com>.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-/* Define this to 1 to have a standalone program to test this implementation of
- mktime. */
-#ifndef DEBUG_MKTIME
-# define DEBUG_MKTIME 0
-#endif
-
-#if !defined _LIBC && !DEBUG_MKTIME
-# include <config.h>
-#endif
-
-/* Assume that leap seconds are possible, unless told otherwise.
- If the host has a 'zic' command with a '-L leapsecondfilename' option,
- then it supports leap seconds; otherwise it probably doesn't. */
-#ifndef LEAP_SECONDS_POSSIBLE
-# define LEAP_SECONDS_POSSIBLE 1
-#endif
-
-#include <time.h>
-
-#include <limits.h>
-#include <stdbool.h>
-
-#include <intprops.h>
-#include <verify.h>
-
-#if DEBUG_MKTIME
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
-/* Make it work even if the system's libc has its own mktime routine. */
-# undef mktime
-# define mktime my_mktime
-#endif
-
-/* A signed type that can represent an integer number of years
- multiplied by three times the number of seconds in a year. It is
- needed when converting a tm_year value times the number of seconds
- in a year. The factor of three comes because these products need
- to be subtracted from each other, and sometimes with an offset
- added to them, without worrying about overflow.
-
- Much of the code uses long_int to represent time_t values, to
- lessen the hassle of dealing with platforms where time_t is
- unsigned, and because long_int should suffice to represent all
- time_t values that mktime can generate even on platforms where
- time_t is excessively wide. */
-
-#if INT_MAX <= LONG_MAX / 3 / 366 / 24 / 60 / 60
-typedef long int long_int;
-#else
-typedef long long int long_int;
-#endif
-verify (INT_MAX <= TYPE_MAXIMUM (long_int) / 3 / 366 / 24 / 60 / 60);
-
-/* Shift A right by B bits portably, by dividing A by 2**B and
- truncating towards minus infinity. B should be in the range 0 <= B
- <= LONG_INT_BITS - 2, where LONG_INT_BITS is the number of useful
- bits in a long_int. LONG_INT_BITS is at least 32.
-
- ISO C99 says that A >> B is implementation-defined if A < 0. Some
- implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
- right in the usual way when A < 0, so SHR falls back on division if
- ordinary A >> B doesn't seem to be the usual signed shift. */
-
-static long_int
-shr (long_int a, int b)
-{
- long_int one = 1;
- return (-one >> 1 == -1
- ? a >> b
- : a / (one << b) - (a % (one << b) < 0));
-}
-
-/* Bounds for the intersection of time_t and long_int. */
-
-static long_int const mktime_min
- = ((TYPE_SIGNED (time_t) && TYPE_MINIMUM (time_t) < TYPE_MINIMUM (long_int))
- ? TYPE_MINIMUM (long_int) : TYPE_MINIMUM (time_t));
-static long_int const mktime_max
- = (TYPE_MAXIMUM (long_int) < TYPE_MAXIMUM (time_t)
- ? TYPE_MAXIMUM (long_int) : TYPE_MAXIMUM (time_t));
-
-verify (TYPE_IS_INTEGER (time_t));
-
-#define EPOCH_YEAR 1970
-#define TM_YEAR_BASE 1900
-verify (TM_YEAR_BASE % 100 == 0);
-
-/* Is YEAR + TM_YEAR_BASE a leap year? */
-static bool
-leapyear (long_int year)
-{
- /* Don't add YEAR to TM_YEAR_BASE, as that might overflow.
- Also, work even if YEAR is negative. */
- return
- ((year & 3) == 0
- && (year % 100 != 0
- || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
-}
-
-/* How many days come before each month (0-12). */
-#ifndef _LIBC
-static
-#endif
-const unsigned short int __mon_yday[2][13] =
- {
- /* Normal years. */
- { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
- /* Leap years. */
- { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
- };
-
-
-#ifdef _LIBC
-typedef time_t mktime_offset_t;
-#else
-/* Portable standalone applications should supply a <time.h> that
- declares a POSIX-compliant localtime_r, for the benefit of older
- implementations that lack localtime_r or have a nonstandard one.
- See the gnulib time_r module for one way to implement this. */
-# undef __localtime_r
-# define __localtime_r localtime_r
-# define __mktime_internal mktime_internal
-# include "mktime-internal.h"
-#endif
-
-/* Do the values A and B differ according to the rules for tm_isdst?
- A and B differ if one is zero and the other positive. */
-static bool
-isdst_differ (int a, int b)
-{
- return (!a != !b) && (0 <= a) && (0 <= b);
-}
-
-/* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) -
- (YEAR0-YDAY0 HOUR0:MIN0:SEC0) in seconds, assuming that the clocks
- were not adjusted between the time stamps.
-
- The YEAR values uses the same numbering as TP->tm_year. Values
- need not be in the usual range. However, YEAR1 must not overflow
- when multiplied by three times the number of seconds in a year, and
- likewise for YDAY1 and three times the number of seconds in a day. */
-
-static long_int
-ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1,
- int year0, int yday0, int hour0, int min0, int sec0)
-{
- verify (-1 / 2 == 0);
-
- /* Compute intervening leap days correctly even if year is negative.
- Take care to avoid integer overflow here. */
- int a4 = shr (year1, 2) + shr (TM_YEAR_BASE, 2) - ! (year1 & 3);
- int b4 = shr (year0, 2) + shr (TM_YEAR_BASE, 2) - ! (year0 & 3);
- int a100 = a4 / 25 - (a4 % 25 < 0);
- int b100 = b4 / 25 - (b4 % 25 < 0);
- int a400 = shr (a100, 2);
- int b400 = shr (b100, 2);
- int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
-
- /* Compute the desired time without overflowing. */
- long_int years = year1 - year0;
- long_int days = 365 * years + yday1 - yday0 + intervening_leap_days;
- long_int hours = 24 * days + hour1 - hour0;
- long_int minutes = 60 * hours + min1 - min0;
- long_int seconds = 60 * minutes + sec1 - sec0;
- return seconds;
-}
-
-/* Return the average of A and B, even if A + B would overflow.
- Round toward positive infinity. */
-static long_int
-long_int_avg (long_int a, long_int b)
-{
- return shr (a, 1) + shr (b, 1) + ((a | b) & 1);
-}
-
-/* Return a time_t value corresponding to (YEAR-YDAY HOUR:MIN:SEC),
- assuming that T corresponds to *TP and that no clock adjustments
- occurred between *TP and the desired time.
- Although T and the returned value are of type long_int,
- they represent time_t values and must be in time_t range.
- If TP is null, return a value not equal to T; this avoids false matches.
- YEAR and YDAY must not be so large that multiplying them by three times the
- number of seconds in a year (or day, respectively) would overflow long_int.
- If the returned value would be out of range, yield the minimal or
- maximal in-range value, except do not yield a value equal to T. */
-static long_int
-guess_time_tm (long_int year, long_int yday, int hour, int min, int sec,
- long_int t, const struct tm *tp)
-{
- if (tp)
- {
- long_int result;
- long_int d = ydhms_diff (year, yday, hour, min, sec,
- tp->tm_year, tp->tm_yday,
- tp->tm_hour, tp->tm_min, tp->tm_sec);
- if (! INT_ADD_WRAPV (t, d, &result))
- return result;
- }
-
- /* Overflow occurred one way or another. Return the nearest result
- that is actually in range, except don't report a zero difference
- if the actual difference is nonzero, as that would cause a false
- match; and don't oscillate between two values, as that would
- confuse the spring-forward gap detector. */
- return (t < long_int_avg (mktime_min, mktime_max)
- ? (t <= mktime_min + 1 ? t + 1 : mktime_min)
- : (mktime_max - 1 <= t ? t - 1 : mktime_max));
-}
-
-/* Use CONVERT to convert T to a struct tm value in *TM. T must be in
- range for time_t. Return TM if successful, NULL if T is out of
- range for CONVERT. */
-static struct tm *
-convert_time (struct tm *(*convert) (const time_t *, struct tm *),
- long_int t, struct tm *tm)
-{
- time_t x = t;
- return convert (&x, tm);
-}
-
-/* Use CONVERT to convert *T to a broken down time in *TP.
- If *T is out of range for conversion, adjust it so that
- it is the nearest in-range value and then convert that.
- A value is in range if it fits in both time_t and long_int. */
-static struct tm *
-ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
- long_int *t, struct tm *tp)
-{
- struct tm *r;
- if (*t < mktime_min)
- *t = mktime_min;
- else if (mktime_max < *t)
- *t = mktime_max;
- r = convert_time (convert, *t, tp);
-
- if (!r && *t)
- {
- long_int bad = *t;
- long_int ok = 0;
-
- /* BAD is a known unconvertible value, and OK is a known good one.
- Use binary search to narrow the range between BAD and OK until
- they differ by 1. */
- while (true)
- {
- long_int mid = long_int_avg (ok, bad);
- if (mid != ok && mid != bad)
- break;
- r = convert_time (convert, mid, tp);
- if (r)
- ok = mid;
- else
- bad = mid;
- }
-
- if (!r && ok)
- {
- /* The last conversion attempt failed;
- revert to the most recent successful attempt. */
- r = convert_time (convert, ok, tp);
- }
- }
-
- return r;
-}
-
-/* Convert *TP to a time_t value, inverting
- the monotonic and mostly-unit-linear conversion function CONVERT.
- Use *OFFSET to keep track of a guess at the offset of the result,
- compared to what the result would be for UTC without leap seconds.
- If *OFFSET's guess is correct, only one CONVERT call is needed.
- This function is external because it is used also by timegm.c. */
-time_t
-__mktime_internal (struct tm *tp,
- struct tm *(*convert) (const time_t *, struct tm *),
- mktime_offset_t *offset)
-{
- long_int t, gt, t0, t1, t2, dt;
- struct tm tm;
-
- /* The maximum number of probes (calls to CONVERT) should be enough
- to handle any combinations of time zone rule changes, solar time,
- leap seconds, and oscillations around a spring-forward gap.
- POSIX.1 prohibits leap seconds, but some hosts have them anyway. */
- int remaining_probes = 6;
-
- /* Time requested. Copy it in case CONVERT modifies *TP; this can
- occur if TP is localtime's returned value and CONVERT is localtime. */
- int sec = tp->tm_sec;
- int min = tp->tm_min;
- int hour = tp->tm_hour;
- int mday = tp->tm_mday;
- int mon = tp->tm_mon;
- int year_requested = tp->tm_year;
- int isdst = tp->tm_isdst;
-
- /* 1 if the previous probe was DST. */
- int dst2;
-
- /* Ensure that mon is in range, and set year accordingly. */
- int mon_remainder = mon % 12;
- int negative_mon_remainder = mon_remainder < 0;
- int mon_years = mon / 12 - negative_mon_remainder;
- long_int lyear_requested = year_requested;
- long_int year = lyear_requested + mon_years;
-
- /* The other values need not be in range:
- the remaining code handles overflows correctly. */
-
- /* Calculate day of year from year, month, and day of month.
- The result need not be in range. */
- int mon_yday = ((__mon_yday[leapyear (year)]
- [mon_remainder + 12 * negative_mon_remainder])
- - 1);
- long_int lmday = mday;
- long_int yday = mon_yday + lmday;
-
- int negative_offset_guess;
-
- int sec_requested = sec;
-
- if (LEAP_SECONDS_POSSIBLE)
- {
- /* Handle out-of-range seconds specially,
- since ydhms_tm_diff assumes every minute has 60 seconds. */
- if (sec < 0)
- sec = 0;
- if (59 < sec)
- sec = 59;
- }
-
- /* Invert CONVERT by probing. First assume the same offset as last
- time. */
-
- INT_SUBTRACT_WRAPV (0, *offset, &negative_offset_guess);
- t0 = ydhms_diff (year, yday, hour, min, sec,
- EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, negative_offset_guess);
-
- /* Repeatedly use the error to improve the guess. */
-
- for (t = t1 = t2 = t0, dst2 = 0;
- (gt = guess_time_tm (year, yday, hour, min, sec, t,
- ranged_convert (convert, &t, &tm)),
- t != gt);
- t1 = t2, t2 = t, t = gt, dst2 = tm.tm_isdst != 0)
- if (t == t1 && t != t2
- && (tm.tm_isdst < 0
- || (isdst < 0
- ? dst2 <= (tm.tm_isdst != 0)
- : (isdst != 0) != (tm.tm_isdst != 0))))
- /* We can't possibly find a match, as we are oscillating
- between two values. The requested time probably falls
- within a spring-forward gap of size GT - T. Follow the common
- practice in this case, which is to return a time that is GT - T
- away from the requested time, preferring a time whose
- tm_isdst differs from the requested value. (If no tm_isdst
- was requested and only one of the two values has a nonzero
- tm_isdst, prefer that value.) In practice, this is more
- useful than returning -1. */
- goto offset_found;
- else if (--remaining_probes == 0)
- return -1;
-
- /* We have a match. Check whether tm.tm_isdst has the requested
- value, if any. */
- if (isdst_differ (isdst, tm.tm_isdst))
- {
- /* tm.tm_isdst has the wrong value. Look for a neighboring
- time with the right value, and use its UTC offset.
-
- Heuristic: probe the adjacent timestamps in both directions,
- looking for the desired isdst. This should work for all real
- time zone histories in the tz database. */
-
- /* Distance between probes when looking for a DST boundary. In
- tzdata2003a, the shortest period of DST is 601200 seconds
- (e.g., America/Recife starting 2000-10-08 01:00), and the
- shortest period of non-DST surrounded by DST is 694800
- seconds (Africa/Tunis starting 1943-04-17 01:00). Use the
- minimum of these two values, so we don't miss these short
- periods when probing. */
- int stride = 601200;
-
- /* The longest period of DST in tzdata2003a is 536454000 seconds
- (e.g., America/Jujuy starting 1946-10-01 01:00). The longest
- period of non-DST is much longer, but it makes no real sense
- to search for more than a year of non-DST, so use the DST
- max. */
- int duration_max = 536454000;
-
- /* Search in both directions, so the maximum distance is half
- the duration; add the stride to avoid off-by-1 problems. */
- int delta_bound = duration_max / 2 + stride;
-
- int delta, direction;
-
- for (delta = stride; delta < delta_bound; delta += stride)
- for (direction = -1; direction <= 1; direction += 2)
- {
- long_int ot;
- if (! INT_ADD_WRAPV (t, delta * direction, &ot))
- {
- struct tm otm;
- ranged_convert (convert, &ot, &otm);
- if (! isdst_differ (isdst, otm.tm_isdst))
- {
- /* We found the desired tm_isdst.
- Extrapolate back to the desired time. */
- t = guess_time_tm (year, yday, hour, min, sec, ot, &otm);
- ranged_convert (convert, &t, &tm);
- goto offset_found;
- }
- }
- }
- }
-
- offset_found:
- /* Set *OFFSET to the low-order bits of T - T0 - NEGATIVE_OFFSET_GUESS.
- This is just a heuristic to speed up the next mktime call, and
- correctness is unaffected if integer overflow occurs here. */
- INT_SUBTRACT_WRAPV (t, t0, &dt);
- INT_SUBTRACT_WRAPV (dt, negative_offset_guess, offset);
-
- if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec)
- {
- /* Adjust time to reflect the tm_sec requested, not the normalized value.
- Also, repair any damage from a false match due to a leap second. */
- long_int sec_adjustment = sec == 0 && tm.tm_sec == 60;
- sec_adjustment -= sec;
- sec_adjustment += sec_requested;
- if (INT_ADD_WRAPV (t, sec_adjustment, &t)
- || ! (mktime_min <= t && t <= mktime_max)
- || ! convert_time (convert, t, &tm))
- return -1;
- }
-
- *tp = tm;
- return t;
-}
-
-
-static mktime_offset_t localtime_offset;
-
-/* Convert *TP to a time_t value. */
-time_t
-mktime (struct tm *tp)
-{
-#ifdef _LIBC
- /* POSIX.1 8.1.1 requires that whenever mktime() is called, the
- time zone names contained in the external variable 'tzname' shall
- be set as if the tzset() function had been called. */
- __tzset ();
-#elif HAVE_TZSET
- tzset ();
-#endif
-
- return __mktime_internal (tp, __localtime_r, &localtime_offset);
-}
-
-#ifdef weak_alias
-weak_alias (mktime, timelocal)
-#endif
-
-#ifdef _LIBC
-libc_hidden_def (mktime)
-libc_hidden_weak (timelocal)
-#endif
-
-#if DEBUG_MKTIME
-
-static int
-not_equal_tm (const struct tm *a, const struct tm *b)
-{
- return ((a->tm_sec ^ b->tm_sec)
- | (a->tm_min ^ b->tm_min)
- | (a->tm_hour ^ b->tm_hour)
- | (a->tm_mday ^ b->tm_mday)
- | (a->tm_mon ^ b->tm_mon)
- | (a->tm_year ^ b->tm_year)
- | (a->tm_yday ^ b->tm_yday)
- | isdst_differ (a->tm_isdst, b->tm_isdst));
-}
-
-static void
-print_tm (const struct tm *tp)
-{
- if (tp)
- printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
- tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
- tp->tm_hour, tp->tm_min, tp->tm_sec,
- tp->tm_yday, tp->tm_wday, tp->tm_isdst);
- else
- printf ("0");
-}
-
-static int
-check_result (time_t tk, struct tm tmk, time_t tl, const struct tm *lt)
-{
- if (tk != tl || !lt || not_equal_tm (&tmk, lt))
- {
- printf ("mktime (");
- print_tm (lt);
- printf (")\nyields (");
- print_tm (&tmk);
- printf (") == %ld, should be %ld\n", (long int) tk, (long int) tl);
- return 1;
- }
-
- return 0;
-}
-
-int
-main (int argc, char **argv)
-{
- int status = 0;
- struct tm tm, tmk, tml;
- struct tm *lt;
- time_t tk, tl, tl1;
- char trailer;
-
- /* Sanity check, plus call tzset. */
- tl = 0;
- if (! localtime (&tl))
- {
- printf ("localtime (0) fails\n");
- status = 1;
- }
-
- if ((argc == 3 || argc == 4)
- && (sscanf (argv[1], "%d-%d-%d%c",
- &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
- == 3)
- && (sscanf (argv[2], "%d:%d:%d%c",
- &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
- == 3))
- {
- tm.tm_year -= TM_YEAR_BASE;
- tm.tm_mon--;
- tm.tm_isdst = argc == 3 ? -1 : atoi (argv[3]);
- tmk = tm;
- tl = mktime (&tmk);
- lt = localtime_r (&tl, &tml);
- printf ("mktime returns %ld == ", (long int) tl);
- print_tm (&tmk);
- printf ("\n");
- status = check_result (tl, tmk, tl, lt);
- }
- else if (argc == 4 || (argc == 5 && strcmp (argv[4], "-") == 0))
- {
- time_t from = atol (argv[1]);
- time_t by = atol (argv[2]);
- time_t to = atol (argv[3]);
-
- if (argc == 4)
- for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
- {
- lt = localtime_r (&tl, &tml);
- if (lt)
- {
- tmk = tml;
- tk = mktime (&tmk);
- status |= check_result (tk, tmk, tl, &tml);
- }
- else
- {
- printf ("localtime_r (%ld) yields 0\n", (long int) tl);
- status = 1;
- }
- tl1 = tl + by;
- if ((tl1 < tl) != (by < 0))
- break;
- }
- else
- for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
- {
- /* Null benchmark. */
- lt = localtime_r (&tl, &tml);
- if (lt)
- {
- tmk = tml;
- tk = tl;
- status |= check_result (tk, tmk, tl, &tml);
- }
- else
- {
- printf ("localtime_r (%ld) yields 0\n", (long int) tl);
- status = 1;
- }
- tl1 = tl + by;
- if ((tl1 < tl) != (by < 0))
- break;
- }
- }
- else
- printf ("Usage:\
-\t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\
-\t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\
-\t%s FROM BY TO - # Do not test those values (for benchmark).\n",
- argv[0], argv[0], argv[0]);
-
- return status;
-}
-
-#endif /* DEBUG_MKTIME */
-
-/*
-Local Variables:
-compile-command: "gcc -DDEBUG_MKTIME -I. -Wall -W -O2 -g mktime.c -o mktime"
-End:
-*/
diff --git a/src/gl/msvc-inval.c b/src/gl/msvc-inval.c
deleted file mode 100644
index baaf39eda1..0000000000
--- a/src/gl/msvc-inval.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Invalid parameter handler for MSVC runtime libraries.
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include "msvc-inval.h"
-
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
- && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING)
-
-/* Get _invalid_parameter_handler type and _set_invalid_parameter_handler
- declaration. */
-# include <stdlib.h>
-
-# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
-
-static void __cdecl
-gl_msvc_invalid_parameter_handler (const wchar_t *expression,
- const wchar_t *function,
- const wchar_t *file,
- unsigned int line,
- uintptr_t dummy)
-{
-}
-
-# else
-
-/* Get declarations of the native Windows API functions. */
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-
-# if defined _MSC_VER
-
-static void __cdecl
-gl_msvc_invalid_parameter_handler (const wchar_t *expression,
- const wchar_t *function,
- const wchar_t *file,
- unsigned int line,
- uintptr_t dummy)
-{
- RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL);
-}
-
-# else
-
-/* An index to thread-local storage. */
-static DWORD tls_index;
-static int tls_initialized /* = 0 */;
-
-/* Used as a fallback only. */
-static struct gl_msvc_inval_per_thread not_per_thread;
-
-struct gl_msvc_inval_per_thread *
-gl_msvc_inval_current (void)
-{
- if (!tls_initialized)
- {
- tls_index = TlsAlloc ();
- tls_initialized = 1;
- }
- if (tls_index == TLS_OUT_OF_INDEXES)
- /* TlsAlloc had failed. */
- return &not_per_thread;
- else
- {
- struct gl_msvc_inval_per_thread *pointer =
- (struct gl_msvc_inval_per_thread *) TlsGetValue (tls_index);
- if (pointer == NULL)
- {
- /* First call. Allocate a new 'struct gl_msvc_inval_per_thread'. */
- pointer =
- (struct gl_msvc_inval_per_thread *)
- malloc (sizeof (struct gl_msvc_inval_per_thread));
- if (pointer == NULL)
- /* Could not allocate memory. Use the global storage. */
- pointer = &not_per_thread;
- TlsSetValue (tls_index, pointer);
- }
- return pointer;
- }
-}
-
-static void __cdecl
-gl_msvc_invalid_parameter_handler (const wchar_t *expression,
- const wchar_t *function,
- const wchar_t *file,
- unsigned int line,
- uintptr_t dummy)
-{
- struct gl_msvc_inval_per_thread *current = gl_msvc_inval_current ();
- if (current->restart_valid)
- longjmp (current->restart, 1);
- else
- /* An invalid parameter notification from outside the gnulib code.
- Give the caller a chance to intervene. */
- RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL);
-}
-
-# endif
-
-# endif
-
-static int gl_msvc_inval_initialized /* = 0 */;
-
-void
-gl_msvc_inval_ensure_handler (void)
-{
- if (gl_msvc_inval_initialized == 0)
- {
- _set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler);
- gl_msvc_inval_initialized = 1;
- }
-}
-
-#endif
diff --git a/src/gl/msvc-inval.h b/src/gl/msvc-inval.h
deleted file mode 100644
index 027c94972a..0000000000
--- a/src/gl/msvc-inval.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/* Invalid parameter handler for MSVC runtime libraries.
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _MSVC_INVAL_H
-#define _MSVC_INVAL_H
-
-/* With MSVC runtime libraries with the "invalid parameter handler" concept,
- functions like fprintf(), dup2(), or close() crash when the caller passes
- an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF)
- instead.
- This file defines macros that turn such an invalid parameter notification
- into a non-local exit. An error code can then be produced at the target
- of this exit. You can thus write code like
-
- TRY_MSVC_INVAL
- {
- <Code that can trigger an invalid parameter notification
- but does not do 'return', 'break', 'continue', nor 'goto'.>
- }
- CATCH_MSVC_INVAL
- {
- <Code that handles an invalid parameter notification
- but does not do 'return', 'break', 'continue', nor 'goto'.>
- }
- DONE_MSVC_INVAL;
-
- This entire block expands to a single statement.
-
- The handling of invalid parameters can be done in three ways:
-
- * The default way, which is reasonable for programs (not libraries):
- AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [DEFAULT_HANDLING])
-
- * The way for libraries that make "hairy" calls (like close(-1), or
- fclose(fp) where fileno(fp) is closed, or simply getdtablesize()):
- AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [HAIRY_LIBRARY_HANDLING])
-
- * The way for libraries that make no "hairy" calls:
- AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [SANE_LIBRARY_HANDLING])
- */
-
-#define DEFAULT_HANDLING 0
-#define HAIRY_LIBRARY_HANDLING 1
-#define SANE_LIBRARY_HANDLING 2
-
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
- && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING)
-/* A native Windows platform with the "invalid parameter handler" concept,
- and either DEFAULT_HANDLING or HAIRY_LIBRARY_HANDLING. */
-
-# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
-/* Default handling. */
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-/* Ensure that the invalid parameter handler in installed that just returns.
- Because we assume no other part of the program installs a different
- invalid parameter handler, this solution is multithread-safe. */
-extern void gl_msvc_inval_ensure_handler (void);
-
-# ifdef __cplusplus
-}
-# endif
-
-# define TRY_MSVC_INVAL \
- do \
- { \
- gl_msvc_inval_ensure_handler (); \
- if (1)
-# define CATCH_MSVC_INVAL \
- else
-# define DONE_MSVC_INVAL \
- } \
- while (0)
-
-# else
-/* Handling for hairy libraries. */
-
-# include <excpt.h>
-
-/* Gnulib can define its own status codes, as described in the page
- "Raising Software Exceptions" on microsoft.com
- <http://msdn.microsoft.com/en-us/library/het71c37.aspx>.
- Our status codes are composed of
- - 0xE0000000, mandatory for all user-defined status codes,
- - 0x474E550, a API identifier ("GNU"),
- - 0, 1, 2, ..., used to distinguish different status codes from the
- same API. */
-# define STATUS_GNULIB_INVALID_PARAMETER (0xE0000000 + 0x474E550 + 0)
-
-# if defined _MSC_VER
-/* A compiler that supports __try/__except, as described in the page
- "try-except statement" on microsoft.com
- <http://msdn.microsoft.com/en-us/library/s58ftw19.aspx>.
- With __try/__except, we can use the multithread-safe exception handling. */
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-/* Ensure that the invalid parameter handler in installed that raises a
- software exception with code STATUS_GNULIB_INVALID_PARAMETER.
- Because we assume no other part of the program installs a different
- invalid parameter handler, this solution is multithread-safe. */
-extern void gl_msvc_inval_ensure_handler (void);
-
-# ifdef __cplusplus
-}
-# endif
-
-# define TRY_MSVC_INVAL \
- do \
- { \
- gl_msvc_inval_ensure_handler (); \
- __try
-# define CATCH_MSVC_INVAL \
- __except (GetExceptionCode () == STATUS_GNULIB_INVALID_PARAMETER \
- ? EXCEPTION_EXECUTE_HANDLER \
- : EXCEPTION_CONTINUE_SEARCH)
-# define DONE_MSVC_INVAL \
- } \
- while (0)
-
-# else
-/* Any compiler.
- We can only use setjmp/longjmp. */
-
-# include <setjmp.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-struct gl_msvc_inval_per_thread
-{
- /* The restart that will resume execution at the code between
- CATCH_MSVC_INVAL and DONE_MSVC_INVAL. It is enabled only between
- TRY_MSVC_INVAL and CATCH_MSVC_INVAL. */
- jmp_buf restart;
-
- /* Tells whether the contents of restart is valid. */
- int restart_valid;
-};
-
-/* Ensure that the invalid parameter handler in installed that passes
- control to the gl_msvc_inval_restart if it is valid, or raises a
- software exception with code STATUS_GNULIB_INVALID_PARAMETER otherwise.
- Because we assume no other part of the program installs a different
- invalid parameter handler, this solution is multithread-safe. */
-extern void gl_msvc_inval_ensure_handler (void);
-
-/* Return a pointer to the per-thread data for the current thread. */
-extern struct gl_msvc_inval_per_thread *gl_msvc_inval_current (void);
-
-# ifdef __cplusplus
-}
-# endif
-
-# define TRY_MSVC_INVAL \
- do \
- { \
- struct gl_msvc_inval_per_thread *msvc_inval_current; \
- gl_msvc_inval_ensure_handler (); \
- msvc_inval_current = gl_msvc_inval_current (); \
- /* First, initialize gl_msvc_inval_restart. */ \
- if (setjmp (msvc_inval_current->restart) == 0) \
- { \
- /* Then, mark it as valid. */ \
- msvc_inval_current->restart_valid = 1;
-# define CATCH_MSVC_INVAL \
- /* Execution completed. \
- Mark gl_msvc_inval_restart as invalid. */ \
- msvc_inval_current->restart_valid = 0; \
- } \
- else \
- { \
- /* Execution triggered an invalid parameter notification. \
- Mark gl_msvc_inval_restart as invalid. */ \
- msvc_inval_current->restart_valid = 0;
-# define DONE_MSVC_INVAL \
- } \
- } \
- while (0)
-
-# endif
-
-# endif
-
-#else
-/* A platform that does not need to the invalid parameter handler,
- or when SANE_LIBRARY_HANDLING is desired. */
-
-/* The braces here avoid GCC warnings like
- "warning: suggest explicit braces to avoid ambiguous 'else'". */
-# define TRY_MSVC_INVAL \
- do \
- { \
- if (1)
-# define CATCH_MSVC_INVAL \
- else
-# define DONE_MSVC_INVAL \
- } \
- while (0)
-
-#endif
-
-#endif /* _MSVC_INVAL_H */
diff --git a/src/gl/msvc-nothrow.c b/src/gl/msvc-nothrow.c
deleted file mode 100644
index ba75bbfb27..0000000000
--- a/src/gl/msvc-nothrow.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Wrappers that don't throw invalid parameter notifications
- with MSVC runtime libraries.
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include "msvc-nothrow.h"
-
-/* Get declarations of the native Windows API functions. */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#include "msvc-inval.h"
-
-#undef _get_osfhandle
-
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-intptr_t
-_gl_nothrow_get_osfhandle (int fd)
-{
- intptr_t result;
-
- TRY_MSVC_INVAL
- {
- result = _get_osfhandle (fd);
- }
- CATCH_MSVC_INVAL
- {
- result = (intptr_t) INVALID_HANDLE_VALUE;
- }
- DONE_MSVC_INVAL;
-
- return result;
-}
-#endif
diff --git a/src/gl/msvc-nothrow.h b/src/gl/msvc-nothrow.h
deleted file mode 100644
index 3493b84a86..0000000000
--- a/src/gl/msvc-nothrow.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Wrappers that don't throw invalid parameter notifications
- with MSVC runtime libraries.
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _MSVC_NOTHROW_H
-#define _MSVC_NOTHROW_H
-
-/* With MSVC runtime libraries with the "invalid parameter handler" concept,
- functions like fprintf(), dup2(), or close() crash when the caller passes
- an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF)
- instead.
- This file defines wrappers that turn such an invalid parameter notification
- into an error code. */
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-/* Get original declaration of _get_osfhandle. */
-# include <io.h>
-
-# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-
-/* Override _get_osfhandle. */
-extern intptr_t _gl_nothrow_get_osfhandle (int fd);
-# define _get_osfhandle _gl_nothrow_get_osfhandle
-
-# endif
-
-#endif
-
-#endif /* _MSVC_NOTHROW_H */
diff --git a/src/gl/netdb.in.h b/src/gl/netdb.in.h
deleted file mode 100644
index 5e2c035731..0000000000
--- a/src/gl/netdb.in.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/* Provide a netdb.h header file for systems lacking it (read: MinGW).
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
- Written by Simon Josefsson.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* This file is supposed to be used on platforms that lack <netdb.h>.
- It is intended to provide definitions and prototypes needed by an
- application. */
-
-#ifndef _@GUARD_PREFIX@_NETDB_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if @HAVE_NETDB_H@
-
-/* The include_next requires a split double-inclusion guard. */
-# @INCLUDE_NEXT@ @NEXT_NETDB_H@
-
-#endif
-
-#ifndef _@GUARD_PREFIX@_NETDB_H
-#define _@GUARD_PREFIX@_NETDB_H
-
-/* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and
- 'struct hostent' on MinGW. */
-#include <sys/socket.h>
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-/* Declarations for a platform that lacks <netdb.h>, or where it is
- incomplete. */
-
-#if @GNULIB_GETADDRINFO@
-
-# if !@HAVE_STRUCT_ADDRINFO@
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# if !GNULIB_defined_struct_addrinfo
-/* Structure to contain information about address of a service provider. */
-struct addrinfo
-{
- int ai_flags; /* Input flags. */
- int ai_family; /* Protocol family for socket. */
- int ai_socktype; /* Socket type. */
- int ai_protocol; /* Protocol for socket. */
- socklen_t ai_addrlen; /* Length of socket address. */
- struct sockaddr *ai_addr; /* Socket address for socket. */
- char *ai_canonname; /* Canonical name for service location. */
- struct addrinfo *ai_next; /* Pointer to next in list. */
-};
-# define GNULIB_defined_struct_addrinfo 1
-# endif
-
-# ifdef __cplusplus
-}
-# endif
-
-# endif
-
-/* Possible values for 'ai_flags' field in 'addrinfo' structure. */
-# ifndef AI_PASSIVE
-# define AI_PASSIVE 0x0001 /* Socket address is intended for 'bind'. */
-# endif
-# ifndef AI_CANONNAME
-# define AI_CANONNAME 0x0002 /* Request for canonical name. */
-# endif
-# ifndef AI_NUMERICSERV
-# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
-# endif
-
-# if 0
-# define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
-# endif
-
-/* These symbolic constants are required to be present by POSIX, but
- our getaddrinfo replacement doesn't use them (yet). Setting them
- to 0 on systems that doesn't have them avoids causing problems for
- system getaddrinfo implementations that would be confused by
- unknown values. */
-# ifndef AI_V4MAPPED
-# define AI_V4MAPPED 0 /* 0x0008: IPv4 mapped addresses are acceptable. */
-# endif
-# ifndef AI_ALL
-# define AI_ALL 0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */
-# endif
-# ifndef AI_ADDRCONFIG
-# define AI_ADDRCONFIG 0 /* 0x0020: Use configuration of this host to choose
- returned address type. */
-# endif
-
-/* Error values for 'getaddrinfo' function. */
-# ifndef EAI_BADFLAGS
-# define EAI_BADFLAGS -1 /* Invalid value for 'ai_flags' field. */
-# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
-# define EAI_AGAIN -3 /* Temporary failure in name resolution. */
-# define EAI_FAIL -4 /* Non-recoverable failure in name res. */
-# define EAI_NODATA -5 /* No address associated with NAME. */
-# define EAI_FAMILY -6 /* 'ai_family' not supported. */
-# define EAI_SOCKTYPE -7 /* 'ai_socktype' not supported. */
-# define EAI_SERVICE -8 /* SERVICE not supported for 'ai_socktype'. */
-# define EAI_MEMORY -10 /* Memory allocation failure. */
-# endif
-
-/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
- FreeBSD, which does define EAI_BADFLAGS) have removed the definition
- in favor of EAI_NONAME. */
-# if !defined EAI_NODATA && defined EAI_NONAME
-# define EAI_NODATA EAI_NONAME
-# endif
-
-# ifndef EAI_OVERFLOW
-/* Not defined on mingw32 and Haiku. */
-# define EAI_OVERFLOW -12 /* Argument buffer overflow. */
-# endif
-# ifndef EAI_ADDRFAMILY
-/* Not defined on mingw32. */
-# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
-# endif
-# ifndef EAI_SYSTEM
-/* Not defined on mingw32. */
-# define EAI_SYSTEM -11 /* System error returned in 'errno'. */
-# endif
-
-# if 0
-/* The commented out definitions below are not yet implemented in the
- GNULIB getaddrinfo() replacement, so are not yet needed.
-
- If they are restored, be sure to protect the definitions with #ifndef. */
-# ifndef EAI_INPROGRESS
-# define EAI_INPROGRESS -100 /* Processing request in progress. */
-# define EAI_CANCELED -101 /* Request canceled. */
-# define EAI_NOTCANCELED -102 /* Request not canceled. */
-# define EAI_ALLDONE -103 /* All requests done. */
-# define EAI_INTR -104 /* Interrupted by a signal. */
-# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
-# endif
-# endif
-
-# if !@HAVE_DECL_GETADDRINFO@
-/* Translate name of a service location and/or a service name to set of
- socket addresses.
- For more details, see the POSIX:2001 specification
- <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
-_GL_FUNCDECL_SYS (getaddrinfo, int,
- (const char *restrict nodename,
- const char *restrict servname,
- const struct addrinfo *restrict hints,
- struct addrinfo **restrict res)
- _GL_ARG_NONNULL ((4)));
-# endif
-_GL_CXXALIAS_SYS (getaddrinfo, int,
- (const char *restrict nodename,
- const char *restrict servname,
- const struct addrinfo *restrict hints,
- struct addrinfo **restrict res));
-_GL_CXXALIASWARN (getaddrinfo);
-
-# if !@HAVE_DECL_FREEADDRINFO@
-/* Free 'addrinfo' structure AI including associated storage.
- For more details, see the POSIX:2001 specification
- <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
-_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai));
-_GL_CXXALIASWARN (freeaddrinfo);
-
-# if @REPLACE_GAI_STRERROR@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gai_strerror
-# define gai_strerror rpl_gai_strerror
-# endif
-_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode));
-_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode));
-# else
-# if !@HAVE_DECL_GAI_STRERROR@
-/* Convert error return from getaddrinfo() to a string.
- For more details, see the POSIX:2001 specification
- <http://www.opengroup.org/susv3xsh/gai_strerror.html>. */
-_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode));
-# endif
-_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode));
-# endif
-_GL_CXXALIASWARN (gai_strerror);
-
-# if !@HAVE_DECL_GETNAMEINFO@
-/* Convert socket address to printable node and service names.
- For more details, see the POSIX:2001 specification
- <http://www.opengroup.org/susv3xsh/getnameinfo.html>. */
-_GL_FUNCDECL_SYS (getnameinfo, int,
- (const struct sockaddr *restrict sa, socklen_t salen,
- char *restrict node, socklen_t nodelen,
- char *restrict service, socklen_t servicelen,
- int flags)
- _GL_ARG_NONNULL ((1)));
-# endif
-/* Need to cast, because on glibc systems, the seventh parameter is
- unsigned int flags. */
-_GL_CXXALIAS_SYS_CAST (getnameinfo, int,
- (const struct sockaddr *restrict sa, socklen_t salen,
- char *restrict node, socklen_t nodelen,
- char *restrict service, socklen_t servicelen,
- int flags));
-_GL_CXXALIASWARN (getnameinfo);
-
-/* Possible flags for getnameinfo. */
-# ifndef NI_NUMERICHOST
-# define NI_NUMERICHOST 1
-# endif
-# ifndef NI_NUMERICSERV
-# define NI_NUMERICSERV 2
-# endif
-
-#elif defined GNULIB_POSIXCHECK
-
-# undef getaddrinfo
-# if HAVE_RAW_DECL_GETADDRINFO
-_GL_WARN_ON_USE (getaddrinfo, "getaddrinfo is unportable - "
- "use gnulib module getaddrinfo for portability");
-# endif
-
-# undef freeaddrinfo
-# if HAVE_RAW_DECL_FREEADDRINFO
-_GL_WARN_ON_USE (freeaddrinfo, "freeaddrinfo is unportable - "
- "use gnulib module getaddrinfo for portability");
-# endif
-
-# undef gai_strerror
-# if HAVE_RAW_DECL_GAI_STRERROR
-_GL_WARN_ON_USE (gai_strerror, "gai_strerror is unportable - "
- "use gnulib module getaddrinfo for portability");
-# endif
-
-# undef getnameinfo
-# if HAVE_RAW_DECL_GETNAMEINFO
-_GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - "
- "use gnulib module getaddrinfo for portability");
-# endif
-
-#endif
-
-#endif /* _@GUARD_PREFIX@_NETDB_H */
-#endif /* _@GUARD_PREFIX@_NETDB_H */
diff --git a/src/gl/netinet_in.in.h b/src/gl/netinet_in.in.h
deleted file mode 100644
index 54e1ec04cd..0000000000
--- a/src/gl/netinet_in.in.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Substitute for <netinet/in.h>.
- Copyright (C) 2007-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _@GUARD_PREFIX@_NETINET_IN_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if @HAVE_NETINET_IN_H@
-
-/* On many platforms, <netinet/in.h> assumes prior inclusion of
- <sys/types.h>. */
-# include <sys/types.h>
-
-/* The include_next requires a split double-inclusion guard. */
-# @INCLUDE_NEXT@ @NEXT_NETINET_IN_H@
-
-#endif
-
-#ifndef _@GUARD_PREFIX@_NETINET_IN_H
-#define _@GUARD_PREFIX@_NETINET_IN_H
-
-#if !@HAVE_NETINET_IN_H@
-
-/* A platform that lacks <netinet/in.h>. */
-
-# include <sys/socket.h>
-
-#endif
-
-#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
-#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
diff --git a/src/gl/parse-datetime.h b/src/gl/parse-datetime.h
deleted file mode 100644
index 1c8d310c2b..0000000000
--- a/src/gl/parse-datetime.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Parse a string into an internal time stamp.
-
- Copyright (C) 1995, 1997-1998, 2003-2004, 2007, 2009-2016 Free Software
- Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <stdbool.h>
-#include <time.h>
-
-bool parse_datetime (struct timespec *, char const *, struct timespec const *);
-
-/* parse_datetime2 flag: if set, print debug/progress information to STDERR */
-#define PARSE_DATETIME_DEBUG 1
-
-/* same as above, supporting additional flags */
-bool parse_datetime2 (struct timespec *, char const *, struct timespec const *,
- unsigned int flags);
diff --git a/src/gl/parse-datetime.y b/src/gl/parse-datetime.y
deleted file mode 100644
index 6b2b878d0b..0000000000
--- a/src/gl/parse-datetime.y
+++ /dev/null
@@ -1,2320 +0,0 @@
-%{
-/* Parse a string into an internal time stamp.
-
- Copyright (C) 1999-2000, 2002-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Originally written by Steven M. Bellovin <smb@research.att.com> while
- at the University of North Carolina at Chapel Hill. Later tweaked by
- a couple of people on Usenet. Completely overhauled by Rich $alz
- <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
-
- Modified by Paul Eggert <eggert@twinsun.com> in August 1999 to do
- the right thing about local DST. Also modified by Paul Eggert
- <eggert@cs.ucla.edu> in February 2004 to support
- nanosecond-resolution time stamps, and in October 2004 to support
- TZ strings in dates. */
-
-/* FIXME: Check for arithmetic overflow in all cases, not just
- some of them. */
-
-#include <config.h>
-
-#include "parse-datetime.h"
-
-#include "intprops.h"
-#include "timespec.h"
-#include "verify.h"
-#include "strftime.h"
-
-/* There's no need to extend the stack, so there's no need to involve
- alloca. */
-#define YYSTACK_USE_ALLOCA 0
-
-/* Tell Bison how much stack space is needed. 20 should be plenty for
- this grammar, which is not right recursive. Beware setting it too
- high, since that might cause problems on machines whose
- implementations have lame stack-overflow checking. */
-#define YYMAXDEPTH 20
-#define YYINITDEPTH YYMAXDEPTH
-
-/* Since the code of parse-datetime.y is not included in the Emacs executable
- itself, there is no need to #define static in this file. Even if
- the code were included in the Emacs executable, it probably
- wouldn't do any harm to #undef it here; this will only cause
- problems if we try to write to a static variable, which I don't
- think this code needs to do. */
-#ifdef emacs
-# undef static
-#endif
-
-#include <inttypes.h>
-#include <c-ctype.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "gettext.h"
-#include "xalloc.h"
-
-#define _(str) gettext (str)
-
-/* Bison's skeleton tests _STDLIB_H, while some stdlib.h headers
- use _STDLIB_H_ as witness. Map the latter to the one bison uses. */
-/* FIXME: this is temporary. Remove when we have a mechanism to ensure
- that the version we're using is fixed, too. */
-#ifdef _STDLIB_H_
-# undef _STDLIB_H
-# define _STDLIB_H 1
-#endif
-
-/* ISDIGIT differs from isdigit, as follows:
- - Its arg may be any int or unsigned int; it need not be an unsigned char
- or EOF.
- - It's typically faster.
- POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
- isdigit unless it's important to use the locale's definition
- of "digit" even when the host does not conform to POSIX. */
-#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
-
-/* Shift A right by B bits portably, by dividing A by 2**B and
- truncating towards minus infinity. A and B should be free of side
- effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
- INT_BITS is the number of useful bits in an int. GNU code can
- assume that INT_BITS is at least 32.
-
- ISO C99 says that A >> B is implementation-defined if A < 0. Some
- implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
- right in the usual way when A < 0, so SHR falls back on division if
- ordinary A >> B doesn't seem to be the usual signed shift. */
-#define SHR(a, b) \
- (-1 >> 1 == -1 \
- ? (a) >> (b) \
- : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
-
-#define EPOCH_YEAR 1970
-#define TM_YEAR_BASE 1900
-
-#define HOUR(x) ((x) * 60)
-
-#define STREQ(a, b) (strcmp (a, b) == 0)
-
-/* long_time_t is a signed integer type that contains all time_t values. */
-verify (TYPE_IS_INTEGER (time_t));
-#if TIME_T_FITS_IN_LONG_INT
-typedef long int long_time_t;
-#else
-typedef time_t long_time_t;
-#endif
-
-/* Convert a possibly-signed character to an unsigned character. This is
- a bit safer than casting to unsigned char, since it catches some type
- errors that the cast doesn't. */
-static unsigned char to_uchar (char ch) { return ch; }
-
-static void
-dbg_printf (const char *msg,...)
-{
- va_list args;
- /* TODO: use gnulib's 'program_name' instead? */
- fputs ("date: ", stderr);
-
- va_start (args, msg);
- vfprintf (stderr, msg, args);
- va_end (args);
-}
-
-
-
-/* Lots of this code assumes time_t and time_t-like values fit into
- long_time_t. */
-verify (TYPE_MINIMUM (long_time_t) <= TYPE_MINIMUM (time_t)
- && TYPE_MAXIMUM (time_t) <= TYPE_MAXIMUM (long_time_t));
-
-/* FIXME: It also assumes that signed integer overflow silently wraps around,
- but this is not true any more with recent versions of GCC 4. */
-
-/* An integer value, and the number of digits in its textual
- representation. */
-typedef struct
-{
- bool negative;
- long int value;
- size_t digits;
-} textint;
-
-/* An entry in the lexical lookup table. */
-typedef struct
-{
- char const *name;
- int type;
- int value;
-} table;
-
-/* Meridian: am, pm, or 24-hour style. */
-enum { MERam, MERpm, MER24 };
-
-enum { BILLION = 1000000000, LOG10_BILLION = 9 };
-
-/* Relative times. */
-typedef struct
-{
- /* Relative year, month, day, hour, minutes, seconds, and nanoseconds. */
- long int year;
- long int month;
- long int day;
- long int hour;
- long int minutes;
- long_time_t seconds;
- long int ns;
-} relative_time;
-
-#if HAVE_COMPOUND_LITERALS
-# define RELATIVE_TIME_0 ((relative_time) { 0, 0, 0, 0, 0, 0, 0 })
-#else
-static relative_time const RELATIVE_TIME_0;
-#endif
-
-/* Information passed to and from the parser. */
-typedef struct
-{
- /* The input string remaining to be parsed. */
- const char *input;
-
- /* N, if this is the Nth Tuesday. */
- long int day_ordinal;
-
- /* Day of week; Sunday is 0. */
- int day_number;
-
- /* tm_isdst flag for the local zone. */
- int local_isdst;
-
- /* Time zone, in minutes east of UTC. */
- long int time_zone;
-
- /* Style used for time. */
- int meridian;
-
- /* Gregorian year, month, day, hour, minutes, seconds, and nanoseconds. */
- textint year;
- long int month;
- long int day;
- long int hour;
- long int minutes;
- struct timespec seconds; /* includes nanoseconds */
-
- /* Relative year, month, day, hour, minutes, seconds, and nanoseconds. */
- relative_time rel;
-
- /* Presence or counts of nonterminals of various flavors parsed so far. */
- bool timespec_seen;
- bool rels_seen;
- size_t dates_seen;
- size_t days_seen;
- size_t local_zones_seen;
- size_t dsts_seen;
- size_t times_seen;
- size_t zones_seen;
-
- /* if true, print debugging output to stderr */
- bool parse_datetime_debug;
-
- /* which of the 'seen' parts has been printed when debugging */
- size_t debug_dates_seen;
- size_t debug_days_seen;
- size_t debug_local_zones_seen;
- size_t debug_dsts_seen;
- size_t debug_times_seen;
- size_t debug_zones_seen;
-
- /* true if the user specified explicit ordinal day value, */
- bool debug_ordinal_day_seen;
-
- /* the default input timezone, set by TZ value */
- long int debug_default_input_timezone;
-
- /* Table of local time zone abbreviations, terminated by a null entry. */
- table local_time_zone_table[3];
-} parser_control;
-
-union YYSTYPE;
-static int yylex (union YYSTYPE *, parser_control *);
-static int yyerror (parser_control const *, char const *);
-static long int time_zone_hhmm (parser_control *, textint, long int);
-
-/* Extract into *PC any date and time info from a string of digits
- of the form e.g., YYYYMMDD, YYMMDD, HHMM, HH (and sometimes YYY,
- YYYY, ...). */
-static void
-digits_to_date_time (parser_control *pc, textint text_int)
-{
- if (pc->dates_seen && ! pc->year.digits
- && ! pc->rels_seen && (pc->times_seen || 2 < text_int.digits))
- pc->year = text_int;
- else
- {
- if (4 < text_int.digits)
- {
- pc->dates_seen++;
- pc->day = text_int.value % 100;
- pc->month = (text_int.value / 100) % 100;
- pc->year.value = text_int.value / 10000;
- pc->year.digits = text_int.digits - 4;
- }
- else
- {
- pc->times_seen++;
- if (text_int.digits <= 2)
- {
- pc->hour = text_int.value;
- pc->minutes = 0;
- }
- else
- {
- pc->hour = text_int.value / 100;
- pc->minutes = text_int.value % 100;
- }
- pc->seconds.tv_sec = 0;
- pc->seconds.tv_nsec = 0;
- pc->meridian = MER24;
- }
- }
-}
-
-/* Increment PC->rel by FACTOR * REL (FACTOR is 1 or -1). */
-static void
-apply_relative_time (parser_control *pc, relative_time rel, int factor)
-{
- pc->rel.ns += factor * rel.ns;
- pc->rel.seconds += factor * rel.seconds;
- pc->rel.minutes += factor * rel.minutes;
- pc->rel.hour += factor * rel.hour;
- pc->rel.day += factor * rel.day;
- pc->rel.month += factor * rel.month;
- pc->rel.year += factor * rel.year;
- pc->rels_seen = true;
-}
-
-/* Set PC-> hour, minutes, seconds and nanoseconds members from arguments. */
-static void
-set_hhmmss (parser_control *pc, long int hour, long int minutes,
- time_t sec, long int nsec)
-{
- pc->hour = hour;
- pc->minutes = minutes;
- pc->seconds.tv_sec = sec;
- pc->seconds.tv_nsec = nsec;
-}
-
-/* returns a textual representation of the day ordinal/number values
- in the parser_control struct (e.g. 'last wed', 'this tues', 'thu') */
-static const char*
-str_days (parser_control *pc, char* /*output*/ buffer, size_t n)
-{
- /* TODO: use the relative_time_table[] for reverse lookup */
- static const char* ordinal_values[] = {
- "last",
- "this",
- "next/first",
- "(SECOND)", /* SECOND is commented out in relative_time_table[] */
- "third",
- "fourth",
- "fifth",
- "sixth",
- "seventh",
- "eight",
- "ninth",
- "tenth",
- "eleventh",
- "twelfth"};
-
- static const char* days_values[] = {
- "Sun",
- "Mon",
- "Tue",
- "Wed",
- "Thu",
- "Fri",
- "Sat"
- };
-
- /* don't add an ordinal prefix if the user didn't specify it
- (e.g., "this wed" vs "wed") */
- if (pc->debug_ordinal_day_seen)
- {
- /* use word description of possible (e.g. -1 = last, 3 = third) */
- if (pc->day_ordinal>=-1 && pc->day_ordinal<=12)
- {
- snprintf (buffer, n, "%s", ordinal_values[pc->day_ordinal + 1]);
- }
- else
- {
- snprintf (buffer, n, "%ld", pc->day_ordinal);
- }
- }
- else
- {
- buffer[0] = '\0';
- }
-
- /* Add the day name */
- if (pc->day_number>=0 && pc->day_number<=6)
- {
- size_t l = strlen (buffer);
-
- if (l < n)
- snprintf (buffer + l, n - l, "%s%s",
- (l ? " " : ""), days_values[pc->day_number]);
- }
- else
- {
- /* invalid day_number value - should never happen */
- }
- return buffer;
-}
-
-/* debugging: print the current time in the parser_control structure.
- The parser will increment "*_seen" members for those which were parsed.
- This function will print only newly seen parts. */
-static void
-debug_print_current_time (const char* item, parser_control *pc)
-{
- char tmp[100] = {0};
- int space = 0; /* if true, add space delimiter */
-
- if (!pc->parse_datetime_debug)
- return;
-
- /* no newline, more items printed below */
- dbg_printf (_("parsed %s part: "), item);
-
- if (pc->dates_seen != pc->debug_dates_seen)
- {
- /*TODO: use pc->year.negative? */
- fprintf (stderr,"(Y-M-D) %04ld-%02ld-%02ld",
- pc->year.value, pc->month, pc->day);
- pc->debug_dates_seen = pc->dates_seen;
- space = 1;
- }
-
- if (pc->times_seen != pc->debug_times_seen)
- {
- if (space)
- fputc (' ',stderr);
- fprintf (stderr,"%02ld:%02ld:%02ld",
- pc->hour, pc->minutes, pc->seconds.tv_sec);
- if (pc->seconds.tv_nsec!=0)
- fprintf (stderr,"%09ld", pc->seconds.tv_nsec);
- if (pc->meridian==MERpm)
- fputs ("pm",stderr);
-
- pc->debug_times_seen = pc->times_seen;
- space = 1;
- }
-
- if (pc->days_seen != pc->debug_days_seen)
- {
- if (space)
- fputc (' ',stderr);
- fprintf (stderr,_("%s (day ordinal=%ld number=%d)"),
- str_days (pc,tmp,sizeof (tmp)),
- pc->day_ordinal, pc->day_number);
- pc->debug_days_seen = pc->days_seen ;
- space = 1;
- }
-
- if (pc->dsts_seen != pc->debug_dsts_seen)
- {
- if (space)
- fputc (' ',stderr);
- fprintf (stderr,_("is-dst=%d"), pc->local_isdst);
- pc->dsts_seen = pc->debug_dsts_seen;
- space = 1;
- }
-
- /* TODO: fix incorrect display of EST=2:08h? */
- if (pc->zones_seen != pc->debug_zones_seen)
- {
- if (space)
- fputc (' ',stderr);
- fprintf (stderr,_("TZ=%+03d:%02d"), (int)(pc->time_zone/60),
- abs ((int)pc->time_zone%60));
- pc->debug_zones_seen = pc->zones_seen;
- space = 1;
- }
-
- if (pc->local_zones_seen != pc->debug_local_zones_seen)
- {
- if (space)
- fputc (' ',stderr);
- fprintf (stderr,_("Local-TZ=%+03d:%02d"), (int)(pc->time_zone/60),
- abs ((int)pc->time_zone%60));
- pc->debug_local_zones_seen = pc->local_zones_seen;
- space = 1;
- }
-
- if (pc->timespec_seen)
- {
- if (space)
- fputc (' ',stderr);
- fprintf (stderr,_("number of seconds: %ld"), pc->seconds.tv_sec);
- }
-
- fputc ('\n', stderr);
-}
-
-/* debugging: print the current relative values. */
-static void
-debug_print_relative_time (const char* item, const parser_control *pc)
-{
- int space = 0; /* if true, add space delimiter */
-
- if (!pc->parse_datetime_debug)
- return;
-
- /* no newline, more items printed below */
- dbg_printf (_("parsed %s part: "), item);
-
- if (pc->rel.year==0 && pc->rel.month==0 && pc->rel.day==0
- && pc->rel.hour==0 && pc->rel.minutes==00 && pc->rel.seconds == 0
- && pc->rel.ns==0)
- {
- /* Special case: relative time of this/today/now */
- fputs (_("today/this/now\n"),stderr);
- return ;
- }
-
-#define PRINT_REL_PART(x,name) \
- do { \
- if ( (pc->rel.x) != 0 ) \
- { \
- if (space) \
- fputc (' ',stderr); \
- fprintf (stderr,"%+ld %s", pc->rel.x, name); \
- space = 1; \
- } \
- } while (0)
-
- PRINT_REL_PART (year,"year(s)");
- PRINT_REL_PART (month,"month(s)");
- PRINT_REL_PART (day,"day(s)");
- PRINT_REL_PART (hour,"hour(s)");
- PRINT_REL_PART (minutes,"minutes");
- PRINT_REL_PART (seconds,"seconds");
- PRINT_REL_PART (ns,"nanoseconds");
-
- fputc ('\n',stderr);
-}
-
-
-
-%}
-
-/* We want a reentrant parser, even if the TZ manipulation and the calls to
- localtime and gmtime are not reentrant. */
-%pure-parser
-%parse-param { parser_control *pc }
-%lex-param { parser_control *pc }
-
-/* This grammar has 31 shift/reduce conflicts. */
-%expect 31
-
-%union
-{
- long int intval;
- textint textintval;
- struct timespec timespec;
- relative_time rel;
-}
-
-%token <intval> tAGO
-%token tDST
-
-%token tYEAR_UNIT tMONTH_UNIT tHOUR_UNIT tMINUTE_UNIT tSEC_UNIT
-%token <intval> tDAY_UNIT tDAY_SHIFT
-
-%token <intval> tDAY tDAYZONE tLOCAL_ZONE tMERIDIAN
-%token <intval> tMONTH tORDINAL tZONE
-
-%token <textintval> tSNUMBER tUNUMBER
-%token <timespec> tSDECIMAL_NUMBER tUDECIMAL_NUMBER
-
-%type <intval> o_colon_minutes
-%type <timespec> seconds signed_seconds unsigned_seconds
-
-%type <rel> relunit relunit_snumber dayshift
-
-%%
-
-spec:
- timespec
- | items
- ;
-
-timespec:
- '@' seconds
- {
- pc->seconds = $2;
- pc->timespec_seen = true;
- debug_print_current_time (_("number of seconds"), pc);
- }
- ;
-
-items:
- /* empty */
- | items item
- ;
-
-item:
- datetime
- {
- pc->times_seen++; pc->dates_seen++;
- debug_print_current_time (_("datetime"), pc);
- }
- | time
- {
- pc->times_seen++;
- debug_print_current_time (_("time"), pc);
- }
- | local_zone
- {
- pc->local_zones_seen++;
- debug_print_current_time (_("local_zone"), pc);
- }
- | zone
- {
- pc->zones_seen++;
- debug_print_current_time (_("zone"), pc);
- }
- | date
- {
- pc->dates_seen++;
- debug_print_current_time (_("date"), pc);
- }
- | day
- {
- pc->days_seen++;
- debug_print_current_time (_("day"), pc);
- }
- | rel
- {
- debug_print_relative_time (_("relative"), pc);
- }
- | number
- {
- debug_print_relative_time (_("number"), pc);
- }
- | hybrid
- {
- debug_print_relative_time (_("hybrid"), pc);
- }
- ;
-
-datetime:
- iso_8601_datetime
- ;
-
-iso_8601_datetime:
- iso_8601_date 'T' iso_8601_time
- ;
-
-time:
- tUNUMBER tMERIDIAN
- {
- set_hhmmss (pc, $1.value, 0, 0, 0);
- pc->meridian = $2;
- }
- | tUNUMBER ':' tUNUMBER tMERIDIAN
- {
- set_hhmmss (pc, $1.value, $3.value, 0, 0);
- pc->meridian = $4;
- }
- | tUNUMBER ':' tUNUMBER ':' unsigned_seconds tMERIDIAN
- {
- set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
- pc->meridian = $6;
- }
- | iso_8601_time
- ;
-
-iso_8601_time:
- tUNUMBER zone_offset
- {
- set_hhmmss (pc, $1.value, 0, 0, 0);
- pc->meridian = MER24;
- }
- | tUNUMBER ':' tUNUMBER o_zone_offset
- {
- set_hhmmss (pc, $1.value, $3.value, 0, 0);
- pc->meridian = MER24;
- }
- | tUNUMBER ':' tUNUMBER ':' unsigned_seconds o_zone_offset
- {
- set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
- pc->meridian = MER24;
- }
- ;
-
-o_zone_offset:
- /* empty */
- | zone_offset
- ;
-
-zone_offset:
- tSNUMBER o_colon_minutes
- {
- pc->zones_seen++;
- pc->time_zone = time_zone_hhmm (pc, $1, $2);
- }
- ;
-
-local_zone:
- tLOCAL_ZONE
- {
- pc->local_isdst = $1;
- pc->dsts_seen += (0 < $1);
- }
- | tLOCAL_ZONE tDST
- {
- pc->local_isdst = 1;
- pc->dsts_seen += (0 < $1) + 1;
- }
- ;
-
-/* Note 'T' is a special case, as it is used as the separator in ISO
- 8601 date and time of day representation. */
-zone:
- tZONE
- { pc->time_zone = $1; }
- | 'T'
- { pc->time_zone = HOUR(7); }
- | tZONE relunit_snumber
- { pc->time_zone = $1;
- apply_relative_time (pc, $2, 1); }
- | 'T' relunit_snumber
- { pc->time_zone = HOUR(7);
- apply_relative_time (pc, $2, 1); }
- | tZONE tSNUMBER o_colon_minutes
- { pc->time_zone = $1 + time_zone_hhmm (pc, $2, $3); }
- | tDAYZONE
- { pc->time_zone = $1 + 60; }
- | tZONE tDST
- { pc->time_zone = $1 + 60; }
- ;
-
-day:
- tDAY
- {
- pc->day_ordinal = 0;
- pc->day_number = $1;
- }
- | tDAY ','
- {
- pc->day_ordinal = 0;
- pc->day_number = $1;
- }
- | tORDINAL tDAY
- {
- pc->day_ordinal = $1;
- pc->day_number = $2;
- pc->debug_ordinal_day_seen = true;
- }
- | tUNUMBER tDAY
- {
- pc->day_ordinal = $1.value;
- pc->day_number = $2;
- pc->debug_ordinal_day_seen = true;
- }
- ;
-
-date:
- tUNUMBER '/' tUNUMBER
- {
- pc->month = $1.value;
- pc->day = $3.value;
- }
- | tUNUMBER '/' tUNUMBER '/' tUNUMBER
- {
- /* Interpret as YYYY/MM/DD if the first value has 4 or more digits,
- otherwise as MM/DD/YY.
- The goal in recognizing YYYY/MM/DD is solely to support legacy
- machine-generated dates like those in an RCS log listing. If
- you want portability, use the ISO 8601 format. */
- if (4 <= $1.digits)
- {
- if (pc->parse_datetime_debug)
- dbg_printf (_("warning: value %ld has %"PRIuMAX" digits. " \
- "Assuming YYYY/MM/DD\n"), $1.value, $1.digits);
-
- pc->year = $1;
- pc->month = $3.value;
- pc->day = $5.value;
- }
- else
- {
- if (pc->parse_datetime_debug)
- dbg_printf (_("warning: value %ld has less than 4 digits. " \
- "Assuming MM/DD/YY[YY]\n"), $1.value);
-
- pc->month = $1.value;
- pc->day = $3.value;
- pc->year = $5;
- }
- }
- | tUNUMBER tMONTH tSNUMBER
- {
- /* e.g. 17-JUN-1992. */
- pc->day = $1.value;
- pc->month = $2;
- pc->year.value = -$3.value;
- pc->year.digits = $3.digits;
- }
- | tMONTH tSNUMBER tSNUMBER
- {
- /* e.g. JUN-17-1992. */
- pc->month = $1;
- pc->day = -$2.value;
- pc->year.value = -$3.value;
- pc->year.digits = $3.digits;
- }
- | tMONTH tUNUMBER
- {
- pc->month = $1;
- pc->day = $2.value;
- }
- | tMONTH tUNUMBER ',' tUNUMBER
- {
- pc->month = $1;
- pc->day = $2.value;
- pc->year = $4;
- }
- | tUNUMBER tMONTH
- {
- pc->day = $1.value;
- pc->month = $2;
- }
- | tUNUMBER tMONTH tUNUMBER
- {
- pc->day = $1.value;
- pc->month = $2;
- pc->year = $3;
- }
- | iso_8601_date
- ;
-
-iso_8601_date:
- tUNUMBER tSNUMBER tSNUMBER
- {
- /* ISO 8601 format. YYYY-MM-DD. */
- pc->year = $1;
- pc->month = -$2.value;
- pc->day = -$3.value;
- }
- ;
-
-rel:
- relunit tAGO
- { apply_relative_time (pc, $1, $2); }
- | relunit
- { apply_relative_time (pc, $1, 1); }
- | dayshift
- { apply_relative_time (pc, $1, 1); }
- ;
-
-relunit:
- tORDINAL tYEAR_UNIT
- { $$ = RELATIVE_TIME_0; $$.year = $1; }
- | tUNUMBER tYEAR_UNIT
- { $$ = RELATIVE_TIME_0; $$.year = $1.value; }
- | tYEAR_UNIT
- { $$ = RELATIVE_TIME_0; $$.year = 1; }
- | tORDINAL tMONTH_UNIT
- { $$ = RELATIVE_TIME_0; $$.month = $1; }
- | tUNUMBER tMONTH_UNIT
- { $$ = RELATIVE_TIME_0; $$.month = $1.value; }
- | tMONTH_UNIT
- { $$ = RELATIVE_TIME_0; $$.month = 1; }
- | tORDINAL tDAY_UNIT
- { $$ = RELATIVE_TIME_0; $$.day = $1 * $2; }
- | tUNUMBER tDAY_UNIT
- { $$ = RELATIVE_TIME_0; $$.day = $1.value * $2; }
- | tDAY_UNIT
- { $$ = RELATIVE_TIME_0; $$.day = $1; }
- | tORDINAL tHOUR_UNIT
- { $$ = RELATIVE_TIME_0; $$.hour = $1; }
- | tUNUMBER tHOUR_UNIT
- { $$ = RELATIVE_TIME_0; $$.hour = $1.value; }
- | tHOUR_UNIT
- { $$ = RELATIVE_TIME_0; $$.hour = 1; }
- | tORDINAL tMINUTE_UNIT
- { $$ = RELATIVE_TIME_0; $$.minutes = $1; }
- | tUNUMBER tMINUTE_UNIT
- { $$ = RELATIVE_TIME_0; $$.minutes = $1.value; }
- | tMINUTE_UNIT
- { $$ = RELATIVE_TIME_0; $$.minutes = 1; }
- | tORDINAL tSEC_UNIT
- { $$ = RELATIVE_TIME_0; $$.seconds = $1; }
- | tUNUMBER tSEC_UNIT
- { $$ = RELATIVE_TIME_0; $$.seconds = $1.value; }
- | tSDECIMAL_NUMBER tSEC_UNIT
- { $$ = RELATIVE_TIME_0; $$.seconds = $1.tv_sec; $$.ns = $1.tv_nsec; }
- | tUDECIMAL_NUMBER tSEC_UNIT
- { $$ = RELATIVE_TIME_0; $$.seconds = $1.tv_sec; $$.ns = $1.tv_nsec; }
- | tSEC_UNIT
- { $$ = RELATIVE_TIME_0; $$.seconds = 1; }
- | relunit_snumber
- ;
-
-relunit_snumber:
- tSNUMBER tYEAR_UNIT
- { $$ = RELATIVE_TIME_0; $$.year = $1.value; }
- | tSNUMBER tMONTH_UNIT
- { $$ = RELATIVE_TIME_0; $$.month = $1.value; }
- | tSNUMBER tDAY_UNIT
- { $$ = RELATIVE_TIME_0; $$.day = $1.value * $2; }
- | tSNUMBER tHOUR_UNIT
- { $$ = RELATIVE_TIME_0; $$.hour = $1.value; }
- | tSNUMBER tMINUTE_UNIT
- { $$ = RELATIVE_TIME_0; $$.minutes = $1.value; }
- | tSNUMBER tSEC_UNIT
- { $$ = RELATIVE_TIME_0; $$.seconds = $1.value; }
- ;
-
-dayshift:
- tDAY_SHIFT
- { $$ = RELATIVE_TIME_0; $$.day = $1; }
- ;
-
-seconds: signed_seconds | unsigned_seconds;
-
-signed_seconds:
- tSDECIMAL_NUMBER
- | tSNUMBER
- { $$.tv_sec = $1.value; $$.tv_nsec = 0; }
- ;
-
-unsigned_seconds:
- tUDECIMAL_NUMBER
- | tUNUMBER
- { $$.tv_sec = $1.value; $$.tv_nsec = 0; }
- ;
-
-number:
- tUNUMBER
- { digits_to_date_time (pc, $1); }
- ;
-
-hybrid:
- tUNUMBER relunit_snumber
- {
- /* Hybrid all-digit and relative offset, so that we accept e.g.,
- "YYYYMMDD +N days" as well as "YYYYMMDD N days". */
- digits_to_date_time (pc, $1);
- apply_relative_time (pc, $2, 1);
- }
- ;
-
-o_colon_minutes:
- /* empty */
- { $$ = -1; }
- | ':' tUNUMBER
- { $$ = $2.value; }
- ;
-
-%%
-
-static table const meridian_table[] =
-{
- { "AM", tMERIDIAN, MERam },
- { "A.M.", tMERIDIAN, MERam },
- { "PM", tMERIDIAN, MERpm },
- { "P.M.", tMERIDIAN, MERpm },
- { NULL, 0, 0 }
-};
-
-static table const dst_table[] =
-{
- { "DST", tDST, 0 }
-};
-
-static table const month_and_day_table[] =
-{
- { "JANUARY", tMONTH, 1 },
- { "FEBRUARY", tMONTH, 2 },
- { "MARCH", tMONTH, 3 },
- { "APRIL", tMONTH, 4 },
- { "MAY", tMONTH, 5 },
- { "JUNE", tMONTH, 6 },
- { "JULY", tMONTH, 7 },
- { "AUGUST", tMONTH, 8 },
- { "SEPTEMBER",tMONTH, 9 },
- { "SEPT", tMONTH, 9 },
- { "OCTOBER", tMONTH, 10 },
- { "NOVEMBER", tMONTH, 11 },
- { "DECEMBER", tMONTH, 12 },
- { "SUNDAY", tDAY, 0 },
- { "MONDAY", tDAY, 1 },
- { "TUESDAY", tDAY, 2 },
- { "TUES", tDAY, 2 },
- { "WEDNESDAY",tDAY, 3 },
- { "WEDNES", tDAY, 3 },
- { "THURSDAY", tDAY, 4 },
- { "THUR", tDAY, 4 },
- { "THURS", tDAY, 4 },
- { "FRIDAY", tDAY, 5 },
- { "SATURDAY", tDAY, 6 },
- { NULL, 0, 0 }
-};
-
-static table const time_units_table[] =
-{
- { "YEAR", tYEAR_UNIT, 1 },
- { "MONTH", tMONTH_UNIT, 1 },
- { "FORTNIGHT",tDAY_UNIT, 14 },
- { "WEEK", tDAY_UNIT, 7 },
- { "DAY", tDAY_UNIT, 1 },
- { "HOUR", tHOUR_UNIT, 1 },
- { "MINUTE", tMINUTE_UNIT, 1 },
- { "MIN", tMINUTE_UNIT, 1 },
- { "SECOND", tSEC_UNIT, 1 },
- { "SEC", tSEC_UNIT, 1 },
- { NULL, 0, 0 }
-};
-
-/* Assorted relative-time words. */
-static table const relative_time_table[] =
-{
- { "TOMORROW", tDAY_SHIFT, 1 },
- { "YESTERDAY",tDAY_SHIFT, -1 },
- { "TODAY", tDAY_SHIFT, 0 },
- { "NOW", tDAY_SHIFT, 0 },
- { "LAST", tORDINAL, -1 },
- { "THIS", tORDINAL, 0 },
- { "NEXT", tORDINAL, 1 },
- { "FIRST", tORDINAL, 1 },
-/*{ "SECOND", tORDINAL, 2 }, */
- { "THIRD", tORDINAL, 3 },
- { "FOURTH", tORDINAL, 4 },
- { "FIFTH", tORDINAL, 5 },
- { "SIXTH", tORDINAL, 6 },
- { "SEVENTH", tORDINAL, 7 },
- { "EIGHTH", tORDINAL, 8 },
- { "NINTH", tORDINAL, 9 },
- { "TENTH", tORDINAL, 10 },
- { "ELEVENTH", tORDINAL, 11 },
- { "TWELFTH", tORDINAL, 12 },
- { "AGO", tAGO, -1 },
- { "HENCE", tAGO, 1 },
- { NULL, 0, 0 }
-};
-
-/* The universal time zone table. These labels can be used even for
- time stamps that would not otherwise be valid, e.g., GMT time
- stamps in London during summer. */
-static table const universal_time_zone_table[] =
-{
- { "GMT", tZONE, HOUR ( 0) }, /* Greenwich Mean */
- { "UT", tZONE, HOUR ( 0) }, /* Universal (Coordinated) */
- { "UTC", tZONE, HOUR ( 0) },
- { NULL, 0, 0 }
-};
-
-/* The time zone table. This table is necessarily incomplete, as time
- zone abbreviations are ambiguous; e.g. Australians interpret "EST"
- as Eastern time in Australia, not as US Eastern Standard Time.
- You cannot rely on parse_datetime to handle arbitrary time zone
- abbreviations; use numeric abbreviations like "-0500" instead. */
-static table const time_zone_table[] =
-{
- { "WET", tZONE, HOUR ( 0) }, /* Western European */
- { "WEST", tDAYZONE, HOUR ( 0) }, /* Western European Summer */
- { "BST", tDAYZONE, HOUR ( 0) }, /* British Summer */
- { "ART", tZONE, -HOUR ( 3) }, /* Argentina */
- { "BRT", tZONE, -HOUR ( 3) }, /* Brazil */
- { "BRST", tDAYZONE, -HOUR ( 3) }, /* Brazil Summer */
- { "NST", tZONE, -(HOUR ( 3) + 30) }, /* Newfoundland Standard */
- { "NDT", tDAYZONE,-(HOUR ( 3) + 30) }, /* Newfoundland Daylight */
- { "AST", tZONE, -HOUR ( 4) }, /* Atlantic Standard */
- { "ADT", tDAYZONE, -HOUR ( 4) }, /* Atlantic Daylight */
- { "CLT", tZONE, -HOUR ( 4) }, /* Chile */
- { "CLST", tDAYZONE, -HOUR ( 4) }, /* Chile Summer */
- { "EST", tZONE, -HOUR ( 5) }, /* Eastern Standard */
- { "EDT", tDAYZONE, -HOUR ( 5) }, /* Eastern Daylight */
- { "CST", tZONE, -HOUR ( 6) }, /* Central Standard */
- { "CDT", tDAYZONE, -HOUR ( 6) }, /* Central Daylight */
- { "MST", tZONE, -HOUR ( 7) }, /* Mountain Standard */
- { "MDT", tDAYZONE, -HOUR ( 7) }, /* Mountain Daylight */
- { "PST", tZONE, -HOUR ( 8) }, /* Pacific Standard */
- { "PDT", tDAYZONE, -HOUR ( 8) }, /* Pacific Daylight */
- { "AKST", tZONE, -HOUR ( 9) }, /* Alaska Standard */
- { "AKDT", tDAYZONE, -HOUR ( 9) }, /* Alaska Daylight */
- { "HST", tZONE, -HOUR (10) }, /* Hawaii Standard */
- { "HAST", tZONE, -HOUR (10) }, /* Hawaii-Aleutian Standard */
- { "HADT", tDAYZONE, -HOUR (10) }, /* Hawaii-Aleutian Daylight */
- { "SST", tZONE, -HOUR (12) }, /* Samoa Standard */
- { "WAT", tZONE, HOUR ( 1) }, /* West Africa */
- { "CET", tZONE, HOUR ( 1) }, /* Central European */
- { "CEST", tDAYZONE, HOUR ( 1) }, /* Central European Summer */
- { "MET", tZONE, HOUR ( 1) }, /* Middle European */
- { "MEZ", tZONE, HOUR ( 1) }, /* Middle European */
- { "MEST", tDAYZONE, HOUR ( 1) }, /* Middle European Summer */
- { "MESZ", tDAYZONE, HOUR ( 1) }, /* Middle European Summer */
- { "EET", tZONE, HOUR ( 2) }, /* Eastern European */
- { "EEST", tDAYZONE, HOUR ( 2) }, /* Eastern European Summer */
- { "CAT", tZONE, HOUR ( 2) }, /* Central Africa */
- { "SAST", tZONE, HOUR ( 2) }, /* South Africa Standard */
- { "EAT", tZONE, HOUR ( 3) }, /* East Africa */
- { "MSK", tZONE, HOUR ( 3) }, /* Moscow */
- { "MSD", tDAYZONE, HOUR ( 3) }, /* Moscow Daylight */
- { "IST", tZONE, (HOUR ( 5) + 30) }, /* India Standard */
- { "SGT", tZONE, HOUR ( 8) }, /* Singapore */
- { "KST", tZONE, HOUR ( 9) }, /* Korea Standard */
- { "JST", tZONE, HOUR ( 9) }, /* Japan Standard */
- { "GST", tZONE, HOUR (10) }, /* Guam Standard */
- { "NZST", tZONE, HOUR (12) }, /* New Zealand Standard */
- { "NZDT", tDAYZONE, HOUR (12) }, /* New Zealand Daylight */
- { NULL, 0, 0 }
-};
-
-/* Military time zone table.
-
- Note 'T' is a special case, as it is used as the separator in ISO
- 8601 date and time of day representation. */
-static table const military_table[] =
-{
- { "A", tZONE, -HOUR ( 1) },
- { "B", tZONE, -HOUR ( 2) },
- { "C", tZONE, -HOUR ( 3) },
- { "D", tZONE, -HOUR ( 4) },
- { "E", tZONE, -HOUR ( 5) },
- { "F", tZONE, -HOUR ( 6) },
- { "G", tZONE, -HOUR ( 7) },
- { "H", tZONE, -HOUR ( 8) },
- { "I", tZONE, -HOUR ( 9) },
- { "K", tZONE, -HOUR (10) },
- { "L", tZONE, -HOUR (11) },
- { "M", tZONE, -HOUR (12) },
- { "N", tZONE, HOUR ( 1) },
- { "O", tZONE, HOUR ( 2) },
- { "P", tZONE, HOUR ( 3) },
- { "Q", tZONE, HOUR ( 4) },
- { "R", tZONE, HOUR ( 5) },
- { "S", tZONE, HOUR ( 6) },
- { "T", 'T', 0 },
- { "U", tZONE, HOUR ( 8) },
- { "V", tZONE, HOUR ( 9) },
- { "W", tZONE, HOUR (10) },
- { "X", tZONE, HOUR (11) },
- { "Y", tZONE, HOUR (12) },
- { "Z", tZONE, HOUR ( 0) },
- { NULL, 0, 0 }
-};
-
-
-
-/* Convert a time zone expressed as HH:MM into an integer count of
- minutes. If MM is negative, then S is of the form HHMM and needs
- to be picked apart; otherwise, S is of the form HH. As specified in
- http://www.opengroup.org/susv3xbd/xbd_chap08.html#tag_08_03, allow
- only valid TZ range, and consider first two digits as hours, if no
- minutes specified. */
-
-static long int
-time_zone_hhmm (parser_control *pc, textint s, long int mm)
-{
- long int n_minutes;
-
- /* If the length of S is 1 or 2 and no minutes are specified,
- interpret it as a number of hours. */
- if (s.digits <= 2 && mm < 0)
- s.value *= 100;
-
- if (mm < 0)
- n_minutes = (s.value / 100) * 60 + s.value % 100;
- else
- n_minutes = s.value * 60 + (s.negative ? -mm : mm);
-
- /* If the absolute number of minutes is larger than 24 hours,
- arrange to reject it by incrementing pc->zones_seen. Thus,
- we allow only values in the range UTC-24:00 to UTC+24:00. */
- if (24 * 60 < abs (n_minutes))
- pc->zones_seen++;
-
- return n_minutes;
-}
-
-static int
-to_hour (long int hours, int meridian)
-{
- switch (meridian)
- {
- default: /* Pacify GCC. */
- case MER24:
- return 0 <= hours && hours < 24 ? hours : -1;
- case MERam:
- return 0 < hours && hours < 12 ? hours : hours == 12 ? 0 : -1;
- case MERpm:
- return 0 < hours && hours < 12 ? hours + 12 : hours == 12 ? 12 : -1;
- }
-}
-
-static long int
-to_year (textint textyear, bool debug)
-{
- long int year = textyear.value;
-
- if (year < 0)
- year = -year;
-
- /* XPG4 suggests that years 00-68 map to 2000-2068, and
- years 69-99 map to 1969-1999. */
- else if (textyear.digits == 2)
- {
- year += year < 69 ? 2000 : 1900;
- if (debug)
- dbg_printf (_("warning: adjusting year value %ld to %ld\n"),
- textyear.value, year);
- }
-
- return year;
-}
-
-static table const * _GL_ATTRIBUTE_PURE
-lookup_zone (parser_control const *pc, char const *name)
-{
- table const *tp;
-
- for (tp = universal_time_zone_table; tp->name; tp++)
- if (strcmp (name, tp->name) == 0)
- return tp;
-
- /* Try local zone abbreviations before those in time_zone_table, as
- the local ones are more likely to be right. */
- for (tp = pc->local_time_zone_table; tp->name; tp++)
- if (strcmp (name, tp->name) == 0)
- return tp;
-
- for (tp = time_zone_table; tp->name; tp++)
- if (strcmp (name, tp->name) == 0)
- return tp;
-
- return NULL;
-}
-
-#if ! HAVE_TM_GMTOFF
-/* Yield the difference between *A and *B,
- measured in seconds, ignoring leap seconds.
- The body of this function is taken directly from the GNU C Library;
- see src/strftime.c. */
-static long int
-tm_diff (struct tm const *a, struct tm const *b)
-{
- /* Compute intervening leap days correctly even if year is negative.
- Take care to avoid int overflow in leap day calculations. */
- int a4 = SHR (a->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (a->tm_year & 3);
- int b4 = SHR (b->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (b->tm_year & 3);
- int a100 = a4 / 25 - (a4 % 25 < 0);
- int b100 = b4 / 25 - (b4 % 25 < 0);
- int a400 = SHR (a100, 2);
- int b400 = SHR (b100, 2);
- int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
- long int ayear = a->tm_year;
- long int years = ayear - b->tm_year;
- long int days = (365 * years + intervening_leap_days
- + (a->tm_yday - b->tm_yday));
- return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
- + (a->tm_min - b->tm_min))
- + (a->tm_sec - b->tm_sec));
-}
-#endif /* ! HAVE_TM_GMTOFF */
-
-static table const *
-lookup_word (parser_control const *pc, char *word)
-{
- char *p;
- char *q;
- size_t wordlen;
- table const *tp;
- bool period_found;
- bool abbrev;
-
- /* Make it uppercase. */
- for (p = word; *p; p++)
- {
- unsigned char ch = *p;
- *p = c_toupper (ch);
- }
-
- for (tp = meridian_table; tp->name; tp++)
- if (strcmp (word, tp->name) == 0)
- return tp;
-
- /* See if we have an abbreviation for a month. */
- wordlen = strlen (word);
- abbrev = wordlen == 3 || (wordlen == 4 && word[3] == '.');
-
- for (tp = month_and_day_table; tp->name; tp++)
- if ((abbrev ? strncmp (word, tp->name, 3) : strcmp (word, tp->name)) == 0)
- return tp;
-
- if ((tp = lookup_zone (pc, word)))
- return tp;
-
- if (strcmp (word, dst_table[0].name) == 0)
- return dst_table;
-
- for (tp = time_units_table; tp->name; tp++)
- if (strcmp (word, tp->name) == 0)
- return tp;
-
- /* Strip off any plural and try the units table again. */
- if (word[wordlen - 1] == 'S')
- {
- word[wordlen - 1] = '\0';
- for (tp = time_units_table; tp->name; tp++)
- if (strcmp (word, tp->name) == 0)
- return tp;
- word[wordlen - 1] = 'S'; /* For "this" in relative_time_table. */
- }
-
- for (tp = relative_time_table; tp->name; tp++)
- if (strcmp (word, tp->name) == 0)
- return tp;
-
- /* Military time zones. */
- if (wordlen == 1)
- for (tp = military_table; tp->name; tp++)
- if (word[0] == tp->name[0])
- return tp;
-
- /* Drop out any periods and try the time zone table again. */
- for (period_found = false, p = q = word; (*p = *q); q++)
- if (*q == '.')
- period_found = true;
- else
- p++;
- if (period_found && (tp = lookup_zone (pc, word)))
- return tp;
-
- return NULL;
-}
-
-static int
-yylex (union YYSTYPE *lvalp, parser_control *pc)
-{
- unsigned char c;
- size_t count;
-
- for (;;)
- {
- while (c = *pc->input, c_isspace (c))
- pc->input++;
-
- if (ISDIGIT (c) || c == '-' || c == '+')
- {
- char const *p;
- int sign;
- unsigned long int value;
- if (c == '-' || c == '+')
- {
- sign = c == '-' ? -1 : 1;
- while (c = *++pc->input, c_isspace (c))
- continue;
- if (! ISDIGIT (c))
- /* skip the '-' sign */
- continue;
- }
- else
- sign = 0;
- p = pc->input;
- for (value = 0; ; value *= 10)
- {
- unsigned long int value1 = value + (c - '0');
- if (value1 < value)
- return '?';
- value = value1;
- c = *++p;
- if (! ISDIGIT (c))
- break;
- if (ULONG_MAX / 10 < value)
- return '?';
- }
- if ((c == '.' || c == ',') && ISDIGIT (p[1]))
- {
- time_t s;
- int ns;
- int digits;
- unsigned long int value1;
-
- /* Check for overflow when converting value to time_t. */
- if (sign < 0)
- {
- s = - value;
- if (0 < s)
- return '?';
- value1 = -s;
- }
- else
- {
- s = value;
- if (s < 0)
- return '?';
- value1 = s;
- }
- if (value != value1)
- return '?';
-
- /* Accumulate fraction, to ns precision. */
- p++;
- ns = *p++ - '0';
- for (digits = 2; digits <= LOG10_BILLION; digits++)
- {
- ns *= 10;
- if (ISDIGIT (*p))
- ns += *p++ - '0';
- }
-
- /* Skip excess digits, truncating toward -Infinity. */
- if (sign < 0)
- for (; ISDIGIT (*p); p++)
- if (*p != '0')
- {
- ns++;
- break;
- }
- while (ISDIGIT (*p))
- p++;
-
- /* Adjust to the timespec convention, which is that
- tv_nsec is always a positive offset even if tv_sec is
- negative. */
- if (sign < 0 && ns)
- {
- s--;
- if (! (s < 0))
- return '?';
- ns = BILLION - ns;
- }
-
- lvalp->timespec.tv_sec = s;
- lvalp->timespec.tv_nsec = ns;
- pc->input = p;
- return sign ? tSDECIMAL_NUMBER : tUDECIMAL_NUMBER;
- }
- else
- {
- lvalp->textintval.negative = sign < 0;
- if (sign < 0)
- {
- lvalp->textintval.value = - value;
- if (0 < lvalp->textintval.value)
- return '?';
- }
- else
- {
- lvalp->textintval.value = value;
- if (lvalp->textintval.value < 0)
- return '?';
- }
- lvalp->textintval.digits = p - pc->input;
- pc->input = p;
- return sign ? tSNUMBER : tUNUMBER;
- }
- }
-
- if (c_isalpha (c))
- {
- char buff[20];
- char *p = buff;
- table const *tp;
-
- do
- {
- if (p < buff + sizeof buff - 1)
- *p++ = c;
- c = *++pc->input;
- }
- while (c_isalpha (c) || c == '.');
-
- *p = '\0';
- tp = lookup_word (pc, buff);
- if (! tp)
- {
- if (pc->parse_datetime_debug)
- dbg_printf (_("error: unknown word '%s'\n"), buff);
- return '?';
- }
- lvalp->intval = tp->value;
- return tp->type;
- }
-
- if (c != '(')
- return to_uchar (*pc->input++);
-
- count = 0;
- do
- {
- c = *pc->input++;
- if (c == '\0')
- return c;
- if (c == '(')
- count++;
- else if (c == ')')
- count--;
- }
- while (count != 0);
- }
-}
-
-/* Do nothing if the parser reports an error. */
-static int
-yyerror (parser_control const *pc _GL_UNUSED,
- char const *s _GL_UNUSED)
-{
- return 0;
-}
-
-/* If *TM0 is the old and *TM1 is the new value of a struct tm after
- passing it to mktime, return true if it's OK that mktime returned T.
- It's not OK if *TM0 has out-of-range members. */
-
-static bool
-mktime_ok (struct tm const *tm0, struct tm const *tm1, time_t t)
-{
- if (t == (time_t) -1)
- {
- /* Guard against falsely reporting an error when parsing a time
- stamp that happens to equal (time_t) -1, on a host that
- supports such a time stamp. */
- tm1 = localtime (&t);
- if (!tm1)
- return false;
- }
-
- return ! ((tm0->tm_sec ^ tm1->tm_sec)
- | (tm0->tm_min ^ tm1->tm_min)
- | (tm0->tm_hour ^ tm1->tm_hour)
- | (tm0->tm_mday ^ tm1->tm_mday)
- | (tm0->tm_mon ^ tm1->tm_mon)
- | (tm0->tm_year ^ tm1->tm_year));
-}
-
-/* A reasonable upper bound for the size of ordinary TZ strings.
- Use heap allocation if TZ's length exceeds this. */
-enum { TZBUFSIZE = 100 };
-
-/* A reasonable upper bound for the buffer used in debug print outs.
- see days_to_name(), debug_strftime() and debug_mktime_not_ok() */
-enum { DBGBUFSIZE = 100 };
-
-/* Return a copy of TZ, stored in TZBUF if it fits, and heap-allocated
- otherwise. */
-static char *
-get_tz (char tzbuf[TZBUFSIZE])
-{
- char *tz = getenv ("TZ");
- if (tz)
- {
- size_t tzsize = strlen (tz) + 1;
- tz = (tzsize <= TZBUFSIZE
- ? memcpy (tzbuf, tz, tzsize)
- : xmemdup (tz, tzsize));
- }
- return tz;
-}
-
-/* debugging: format a 'struct tm' into a buffer, taking the parser's
- timezone information into account (if pc!=NULL). */
-static const char*
-debug_strfdatetime (const struct tm *tm, const parser_control *pc,
- char* /*output*/ buf, size_t n)
-{
- /* TODO:
- 1. find an optimal way to print date string in a clear and unambiguous
- format. Currently, always add '(Y-M-D)' prefix.
- Consider '2016y01m10d' or 'year(2016) month(01) day(10)'.
-
- If the user needs debug printing, it means he/she already having
- issues with the parsing - better to avoid formats that could
- be mis-interpreted (e.g. just YYYY-MM-DD).
-
- 2. Can strftime be used instead?
- depends if it is portable and can print invalid dates on all systems.
-
- 3. Print timezone information ?
-
- 4. Print DST information ?
-
- 5. Print nanosecond information ?
-
- NOTE:
- Printed date/time values might not be valid, e.g. '2016-02-31'
- or '2016-19-2016' . These are the values as parsed from the user
- string, before validation.
- */
- int m = nstrftime (buf, n, "(Y-M-D) %Y-%m-%d %H:%M:%S", tm, 0, 0);
-
- /* if parser_control information was provided (for timezone),
- and there's enough space in the buffer - add timezone info */
- if (pc != NULL && ((n-m)>0))
- {
- const long int tz = (pc->zones_seen || pc->local_zones_seen)
- ? pc->time_zone
- : pc->debug_default_input_timezone;
- snprintf (&buf[m],n-m," TZ=%+03d:%02d", (int)(tz/60), abs ((int)tz)%60);
- }
- return buf;
-}
-
-static const char*
-debug_strfdate (const struct tm *tm, char* /*output*/ buf, size_t n)
-{
- snprintf (buf,n,"(Y-M-D) %04d-%02d-%02d",
- tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday);
- return buf;
-}
-
-static const char*
-debug_strftime (const struct tm *tm, char* /*output*/ buf, size_t n)
-{
- snprintf (buf,n,"%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
- return buf;
-}
-
-/* If 'mktime_ok()' failed, display the failed time values,
- and provide possible hints. Example output:
-
- date: error: invalid date/time value:
- date: user provided time: '(Y-M-D) 2006-04-02 02:45:00'
- date: normalized time: '(Y-M-D) 2006-04-02 03:45:00'
- date: __
- date: possible reasons:
- date: non-existing due to daylight-saving time;
- date: numeric values overflow;
- date: missing timezone;
- */
-static void
-debug_mktime_not_ok (struct tm const *tm0, struct tm const *tm1,
- const parser_control *pc, bool time_zone_seen)
-{
- /* TODO: handle t==-1 (as in 'mktime_ok') */
- char tmp[DBGBUFSIZE];
- int i;
- const bool eq_sec = (tm0->tm_sec == tm1->tm_sec);
- const bool eq_min = (tm0->tm_min == tm1->tm_min);
- const bool eq_hour = (tm0->tm_hour == tm1->tm_hour);
- const bool eq_mday = (tm0->tm_mday == tm1->tm_mday);
- const bool eq_month = (tm0->tm_mon == tm1->tm_mon);
- const bool eq_year = (tm0->tm_year == tm1->tm_year);
-
- const bool dst_shift = eq_sec && eq_min && !eq_hour
- && eq_mday && eq_month && eq_year;
-
- if (!pc->parse_datetime_debug)
- return;
-
- dbg_printf (_("error: invalid date/time value:\n"));
- dbg_printf (_(" user provided time: '%s'\n"),
- debug_strfdatetime (tm0, pc, tmp, sizeof (tmp)));
- dbg_printf (_(" normalized time: '%s'\n"),
- debug_strfdatetime (tm1, pc, tmp, sizeof (tmp)));
- /* NOTEs: the format must be aligned with debug_strfdatetime() and the two
- DEBUG statements above. this string is not translated. */
- i = snprintf (tmp, sizeof(tmp),
- " %4s %2s %2s %2s %2s %2s",
- eq_year?"":"----", eq_month?"":"--", eq_mday?"":"--",
- eq_hour?"":"--", eq_min?"":"--", eq_sec?"":"--");
- /* Trim trailing whitespace */
- if ((i>0) && (i<sizeof(tmp)))
- {
- while ((i>0) && (tmp[i-1]==' '))
- --i;
- tmp[i] = '\0';
- }
- dbg_printf ("%s\n", tmp);
-
- dbg_printf (_(" possible reasons:\n"));
- if (dst_shift)
- dbg_printf (_(" non-existing due to daylight-saving time;\n"));
- if (!eq_mday && !eq_month)
- dbg_printf (_(" invalid day/month combination;\n"));
- dbg_printf (_(" numeric values overflow;\n"));
- dbg_printf (" %s\n",time_zone_seen?_("incorrect timezone")
- :_("missing timezone"));
-}
-
-
-/* Returns the effective local timezone, in minutes. */
-static long int
-get_effective_timezone (void)
-{
- /* TODO: check for failures */
- const time_t z = 0;
- time_t lz ;
- struct tm *ltm;
- ltm = localtime (&z);
- lz = timegm (ltm)/60;
- return (long int)lz;
-}
-
-/* The original interface: run with debug=false */
-bool
-parse_datetime (struct timespec *result, char const *p,
- struct timespec const *now)
-{
- return parse_datetime2 (result, p, now, 0);
-}
-
-/* Parse a date/time string, storing the resulting time value into *RESULT.
- The string itself is pointed to by P. Return true if successful.
- P can be an incomplete or relative time specification; if so, use
- *NOW as the basis for the returned time. */
-bool
-parse_datetime2 (struct timespec *result, char const *p,
- struct timespec const *now, unsigned int flags)
-{
- time_t Start;
- long int Start_ns;
- struct tm const *tmp;
- struct tm tm;
- struct tm tm0;
- parser_control pc;
- struct timespec gettime_buffer;
- unsigned char c;
- bool tz_was_altered = false;
- char *tz0 = NULL;
- char tz0buf[TZBUFSIZE];
- bool ok = true;
- char dbg_ord[DBGBUFSIZE];
- char dbg_tm[DBGBUFSIZE];
- char const *input_sentinel = p + strlen (p);
-
- if (! now)
- {
- gettime (&gettime_buffer);
- now = &gettime_buffer;
- }
-
- Start = now->tv_sec;
- Start_ns = now->tv_nsec;
-
- tmp = localtime (&now->tv_sec);
- if (! tmp)
- return false;
-
- while (c = *p, c_isspace (c))
- p++;
-
- if (strncmp (p, "TZ=\"", 4) == 0)
- {
- char const *tzbase = p + 4;
- size_t tzsize = 1;
- char const *s;
-
- for (s = tzbase; *s; s++, tzsize++)
- if (*s == '\\')
- {
- s++;
- if (! (*s == '\\' || *s == '"'))
- break;
- }
- else if (*s == '"')
- {
- char *z;
- char *tz1;
- char tz1buf[TZBUFSIZE];
- bool large_tz = TZBUFSIZE < tzsize;
- bool setenv_ok;
- tz0 = get_tz (tz0buf);
- z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf;
- for (s = tzbase; *s != '"'; s++)
- *z++ = *(s += *s == '\\');
- *z = '\0';
- setenv_ok = setenv ("TZ", tz1, 1) == 0;
- if (large_tz)
- free (tz1);
- if (!setenv_ok)
- goto fail;
- tz_was_altered = true;
-
- p = s + 1;
- while (c = *p, c_isspace (c))
- p++;
-
- break;
- }
- }
-
- /* As documented, be careful to treat the empty string just like
- a date string of "0". Without this, an empty string would be
- declared invalid when parsed during a DST transition. */
- if (*p == '\0')
- p = "0";
-
- pc.input = p;
- pc.year.value = tmp->tm_year;
- pc.year.value += TM_YEAR_BASE;
- pc.year.digits = 0;
- pc.month = tmp->tm_mon + 1;
- pc.day = tmp->tm_mday;
- pc.hour = tmp->tm_hour;
- pc.minutes = tmp->tm_min;
- pc.seconds.tv_sec = tmp->tm_sec;
- pc.seconds.tv_nsec = Start_ns;
- tm.tm_isdst = tmp->tm_isdst;
-
- pc.meridian = MER24;
- pc.rel = RELATIVE_TIME_0;
- pc.timespec_seen = false;
- pc.rels_seen = false;
- pc.dates_seen = 0;
- pc.days_seen = 0;
- pc.times_seen = 0;
- pc.local_zones_seen = 0;
- pc.dsts_seen = 0;
- pc.zones_seen = 0;
- pc.parse_datetime_debug = (flags & PARSE_DATETIME_DEBUG)!=0;
- pc.debug_dates_seen = 0;
- pc.debug_days_seen = 0;
- pc.debug_times_seen = 0;
- pc.debug_local_zones_seen = 0;
- pc.debug_dsts_seen = 0;
- pc.debug_zones_seen = 0;
- pc.debug_ordinal_day_seen = false;
- pc.debug_default_input_timezone = 0;
-
-#if HAVE_STRUCT_TM_TM_ZONE
- pc.local_time_zone_table[0].name = tmp->tm_zone;
- pc.local_time_zone_table[0].type = tLOCAL_ZONE;
- pc.local_time_zone_table[0].value = tmp->tm_isdst;
- pc.local_time_zone_table[1].name = NULL;
-
- /* Probe the names used in the next three calendar quarters, looking
- for a tm_isdst different from the one we already have. */
- {
- int quarter;
- for (quarter = 1; quarter <= 3; quarter++)
- {
- time_t probe = Start + quarter * (90 * 24 * 60 * 60);
- struct tm const *probe_tm = localtime (&probe);
- if (probe_tm && probe_tm->tm_zone
- && probe_tm->tm_isdst != pc.local_time_zone_table[0].value)
- {
- {
- pc.local_time_zone_table[1].name = probe_tm->tm_zone;
- pc.local_time_zone_table[1].type = tLOCAL_ZONE;
- pc.local_time_zone_table[1].value = probe_tm->tm_isdst;
- pc.local_time_zone_table[2].name = NULL;
- }
- break;
- }
- }
- }
-#else
-#if HAVE_TZNAME
- {
-# if !HAVE_DECL_TZNAME
- extern char *tzname[];
-# endif
- int i;
- for (i = 0; i < 2; i++)
- {
- pc.local_time_zone_table[i].name = tzname[i];
- pc.local_time_zone_table[i].type = tLOCAL_ZONE;
- pc.local_time_zone_table[i].value = i;
- }
- pc.local_time_zone_table[i].name = NULL;
- }
-#else
- pc.local_time_zone_table[0].name = NULL;
-#endif
-#endif
-
- if (pc.local_time_zone_table[0].name && pc.local_time_zone_table[1].name
- && ! strcmp (pc.local_time_zone_table[0].name,
- pc.local_time_zone_table[1].name))
- {
- /* This locale uses the same abbreviation for standard and
- daylight times. So if we see that abbreviation, we don't
- know whether it's daylight time. */
- pc.local_time_zone_table[0].value = -1;
- pc.local_time_zone_table[1].name = NULL;
- }
-
- pc.debug_default_input_timezone = get_effective_timezone ();
-
- if (yyparse (&pc) != 0)
- {
- if (pc.parse_datetime_debug)
- {
- if (input_sentinel <= pc.input)
- dbg_printf (_("error: parsing failed\n"), pc.input);
- else
- {
- dbg_printf (_("error: parsing failed, stopped at '%s'\n"),
- pc.input);
- }
- }
- goto fail;
- }
-
- /* determine effective timezone source */
- if (pc.parse_datetime_debug)
- {
- long int tz = pc.debug_default_input_timezone;
- const char* tz_env;
- const char* tz_src;
-
- if (pc.timespec_seen)
- {
- tz = 0 ;
- tz_src = _("'@timespec' - always UTC0");
- }
- else if (pc.local_zones_seen || pc.zones_seen)
- {
- tz = pc.time_zone;
- tz_src = _("parsed date/time string");
- }
- else if ((tz_env = getenv("TZ")))
- {
- if (tz_was_altered)
- {
- snprintf (dbg_tm, sizeof(dbg_tm), _("TZ=\"%s\" in date string"),
- tz_env);
- tz_src = dbg_tm;
- }
- else if (STREQ(tz_env,"UTC0"))
- {
- /* Special case: using 'date -u' simply set TZ=UTC0 */
- tz_src = _("TZ=UTC0 environment value or -u");
- }
- else
- {
- snprintf (dbg_tm, sizeof(dbg_tm),
- _("TZ=\"%s\" environment value"), tz_env);
- tz_src = dbg_tm;
- }
- }
- else
- {
- tz_src = _("system default");
- }
-
- if (pc.parse_datetime_debug)
- dbg_printf (_("input timezone: %+03d:%02d (set from %s)\n"),
- (int)(tz/60), abs ((int)tz)%60, tz_src);
-
- }
-
- if (pc.timespec_seen)
- *result = pc.seconds;
- else
- {
- if (1 < (pc.times_seen | pc.dates_seen | pc.days_seen | pc.dsts_seen
- | (pc.local_zones_seen + pc.zones_seen)))
- {
- if (pc.parse_datetime_debug)
- {
- if (pc.times_seen > 1)
- dbg_printf ("error: seen multiple time parts\n");
- if (pc.dates_seen > 1)
- dbg_printf ("error: seen multiple date parts\n");
- if (pc.days_seen > 1)
- dbg_printf ("error: seen multiple days parts\n");
- if (pc.dsts_seen > 1)
- dbg_printf ("error: seen multiple daylight-saving parts\n");
- if ( (pc.local_zones_seen + pc.zones_seen) > 1)
- dbg_printf ("error: seen multiple time-zone parts\n");
- }
- goto fail;
- }
-
- tm.tm_year = to_year (pc.year, pc.parse_datetime_debug) - TM_YEAR_BASE;
- tm.tm_mon = pc.month - 1;
- tm.tm_mday = pc.day;
- if (pc.times_seen || (pc.rels_seen && ! pc.dates_seen && ! pc.days_seen))
- {
- tm.tm_hour = to_hour (pc.hour, pc.meridian);
- if (tm.tm_hour < 0)
- {
- const char* mrd = (pc.meridian==MERam)?"am":
- (pc.meridian==MERpm)?"pm":"";
- if (pc.parse_datetime_debug)
- dbg_printf (_("error: invalid hour %ld%s\n"), pc.hour, mrd);
-
- goto fail;
- }
- tm.tm_min = pc.minutes;
- tm.tm_sec = pc.seconds.tv_sec;
- if (pc.parse_datetime_debug)
- dbg_printf (_("using %s time as starting value: '%s'\n"),
- (pc.times_seen)?_("specified"):_("current"),
- debug_strftime (&tm,dbg_tm,sizeof (dbg_tm)));
- }
- else
- {
- tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
- pc.seconds.tv_nsec = 0;
- if (pc.parse_datetime_debug)
- dbg_printf ("warning: using midnight as starting time: 00:00:00\n");
- }
-
- /* Let mktime deduce tm_isdst if we have an absolute time stamp. */
- if (pc.dates_seen | pc.days_seen | pc.times_seen)
- tm.tm_isdst = -1;
-
- /* But if the input explicitly specifies local time with or without
- DST, give mktime that information. */
- if (pc.local_zones_seen)
- tm.tm_isdst = pc.local_isdst;
-
- tm0 = tm;
-
- Start = mktime (&tm);
-
- if (! mktime_ok (&tm0, &tm, Start))
- {
- if (! pc.zones_seen)
- {
- debug_mktime_not_ok (&tm0, &tm, &pc, pc.zones_seen);
-
- goto fail;
- }
- else
- {
- /* Guard against falsely reporting errors near the time_t
- boundaries when parsing times in other time zones. For
- example, suppose the input string "1969-12-31 23:00:00 -0100",
- the current time zone is 8 hours ahead of UTC, and the min
- time_t value is 1970-01-01 00:00:00 UTC. Then the min
- localtime value is 1970-01-01 08:00:00, and mktime will
- therefore fail on 1969-12-31 23:00:00. To work around the
- problem, set the time zone to 1 hour behind UTC temporarily
- by setting TZ="XXX1:00" and try mktime again. */
-
- long int time_zone = pc.time_zone;
- long int abs_time_zone = time_zone < 0 ? - time_zone : time_zone;
- long int abs_time_zone_hour = abs_time_zone / 60;
- int abs_time_zone_min = abs_time_zone % 60;
- char tz1buf[sizeof "XXX+0:00" + TYPE_WIDTH (pc.time_zone) / 3];
- if (!tz_was_altered)
- tz0 = get_tz (tz0buf);
- sprintf (tz1buf, "XXX%s%ld:%02d", &"-"[time_zone < 0],
- abs_time_zone_hour, abs_time_zone_min);
- if (setenv ("TZ", tz1buf, 1) != 0)
- {
- /* TODO: was warn () + print errno? */
- if (pc.parse_datetime_debug)
- dbg_printf (_("error: setenv('TZ','%s') failed\n"), tz1buf);
-
- goto fail;
- }
- tz_was_altered = true;
- tm = tm0;
- Start = mktime (&tm);
- if (! mktime_ok (&tm0, &tm, Start))
- {
- debug_mktime_not_ok (&tm0, &tm, &pc, pc.zones_seen);
-
- goto fail;
- }
- }
- }
-
- if (pc.days_seen && ! pc.dates_seen)
- {
- tm.tm_mday += ((pc.day_number - tm.tm_wday + 7) % 7
- + 7 * (pc.day_ordinal
- - (0 < pc.day_ordinal
- && tm.tm_wday != pc.day_number)));
- tm.tm_isdst = -1;
- Start = mktime (&tm);
- if (Start == (time_t) -1)
- {
- if (pc.parse_datetime_debug)
- dbg_printf (_("error: day '%s' (day ordinal=%ld number=%d) " \
- "resulted in an invalid date: '%s'\n"),
- str_days (&pc,dbg_ord,sizeof (dbg_ord)),
- pc.day_ordinal,pc.day_number,
- debug_strfdatetime (&tm, &pc, dbg_tm,
- sizeof (dbg_tm)));
-
- goto fail;
- }
-
- if (pc.parse_datetime_debug)
- dbg_printf (_("new start date: '%s' is '%s'\n"),
- str_days (&pc,dbg_ord,sizeof (dbg_ord)),
- debug_strfdatetime (&tm, &pc, dbg_tm,sizeof (dbg_tm)));
-
- }
-
- if (pc.parse_datetime_debug)
- {
- if (!pc.dates_seen && !pc.days_seen)
- dbg_printf (_("using current date as starting value: '%s'\n"),
- debug_strfdate (&tm,dbg_tm,sizeof (dbg_tm)));
-
- if (pc.days_seen && pc.dates_seen)
- dbg_printf (_("warning: day (%s) ignored when explicit dates " \
- "are given\n"),
- str_days (&pc,dbg_ord,sizeof (dbg_ord)));
-
- dbg_printf (_("starting date/time: '%s'\n"),
- debug_strfdatetime (&tm, &pc, dbg_tm,sizeof (dbg_tm)));
- }
-
- /* Add relative date. */
- if (pc.rel.year | pc.rel.month | pc.rel.day)
- {
- if (pc.parse_datetime_debug)
- {
- if ((pc.rel.year != 0 || pc.rel.month !=0) && tm.tm_mday==1)
- dbg_printf (_("warning: when adding relative months/years, " \
- "it is recommended to specify the 15th of the " \
- "months\n"));
-
- if (pc.rel.day != 0 && tm.tm_hour==0)
- dbg_printf (_("warning: when adding relative days, " \
- "it is recommended to specify 12:00pm\n"));
- }
-
- int year = tm.tm_year + pc.rel.year;
- int month = tm.tm_mon + pc.rel.month;
- int day = tm.tm_mday + pc.rel.day;
- if (((year < tm.tm_year) ^ (pc.rel.year < 0))
- | ((month < tm.tm_mon) ^ (pc.rel.month < 0))
- | ((day < tm.tm_mday) ^ (pc.rel.day < 0)))
- {
- /* TODO: what is the actual error? int-value wrap-around? */
- if (pc.parse_datetime_debug)
- dbg_printf (_("error: %s:%d\n"), __FILE__,__LINE__);
-
- goto fail;
- }
- tm.tm_year = year;
- tm.tm_mon = month;
- tm.tm_mday = day;
- tm.tm_hour = tm0.tm_hour;
- tm.tm_min = tm0.tm_min;
- tm.tm_sec = tm0.tm_sec;
- tm.tm_isdst = tm0.tm_isdst;
- Start = mktime (&tm);
- if (Start == (time_t) -1)
- {
- if (pc.parse_datetime_debug)
- dbg_printf(_("error: adding relative date resulted " \
- "in an invalid date: '%s'\n"),
- debug_strfdatetime (&tm, &pc, dbg_tm,
- sizeof (dbg_tm)));
-
- goto fail;
- }
-
- if (pc.parse_datetime_debug)
- {
- dbg_printf (_("after date adjustment " \
- "(%+ld years, %+ld months, %+ld days),\n"),
- pc.rel.year, pc.rel.month, pc.rel.day);
- dbg_printf (_(" new date/time = '%s'\n"),
- debug_strfdatetime (&tm, &pc, dbg_tm,
- sizeof (dbg_tm)));
- }
-
- }
-
- /* The only "output" of this if-block is an updated Start value,
- so this block must follow others that clobber Start. */
- if (pc.zones_seen)
- {
- long int delta = pc.time_zone * 60;
- time_t t1;
-#ifdef HAVE_TM_GMTOFF
- delta -= tm.tm_gmtoff;
-#else
- time_t t = Start;
- struct tm const *gmt = gmtime (&t);
- if (! gmt)
- {
- /* TODO: use 'warn(3)' + print errno ? */
- if (pc.parse_datetime_debug)
- dbg_printf (_("error: gmtime failed for t=%ld\n"),t);
-
- goto fail;
- }
- delta -= tm_diff (&tm, gmt);
-#endif
- t1 = Start - delta;
- if ((Start < t1) != (delta < 0))
- {
- if (pc.parse_datetime_debug)
- dbg_printf (_("error: timezone %ld caused time_t overflow\n"),
- pc.time_zone);
-
- goto fail; /* time_t overflow */
- }
- Start = t1;
- }
-
- if (pc.parse_datetime_debug)
- dbg_printf (_("'%s' = %ld epoch-seconds\n"),
- debug_strfdatetime (&tm, &pc, dbg_tm, sizeof (dbg_tm)),
- Start);
-
- /* Add relative hours, minutes, and seconds. On hosts that support
- leap seconds, ignore the possibility of leap seconds; e.g.,
- "+ 10 minutes" adds 600 seconds, even if one of them is a
- leap second. Typically this is not what the user wants, but it's
- too hard to do it the other way, because the time zone indicator
- must be applied before relative times, and if mktime is applied
- again the time zone will be lost. */
- {
- long int sum_ns = pc.seconds.tv_nsec + pc.rel.ns;
- long int normalized_ns = (sum_ns % BILLION + BILLION) % BILLION;
- time_t t0 = Start;
- long int d1 = 60 * 60 * pc.rel.hour;
- time_t t1 = t0 + d1;
- long int d2 = 60 * pc.rel.minutes;
- time_t t2 = t1 + d2;
- long_time_t d3 = pc.rel.seconds;
- long_time_t t3 = t2 + d3;
- long int d4 = (sum_ns - normalized_ns) / BILLION;
- long_time_t t4 = t3 + d4;
- time_t t5 = t4;
-
- if ((d1 / (60 * 60) ^ pc.rel.hour)
- | (d2 / 60 ^ pc.rel.minutes)
- | ((t1 < t0) ^ (d1 < 0))
- | ((t2 < t1) ^ (d2 < 0))
- | ((t3 < t2) ^ (d3 < 0))
- | ((t4 < t3) ^ (d4 < 0))
- | (t5 != t4))
- {
- if (pc.parse_datetime_debug)
- dbg_printf (_("error: adding relative time caused an " \
- "overflow\n"));
-
- goto fail;
- }
-
- if (pc.parse_datetime_debug
- && (pc.rel.hour | pc.rel.minutes | pc.rel.seconds | pc.rel.ns))
- {
- dbg_printf (_("after time adjustment (%+ld hours, " \
- "%+ld minutes, %+ld seconds, %+ld ns),\n"),
- pc.rel.hour,pc.rel.minutes,pc.rel.seconds,pc.rel.ns);
- dbg_printf (_(" new time = %ld epoch-seconds\n"),t5);
- }
-
- result->tv_sec = t5;
- result->tv_nsec = normalized_ns;
- }
- }
-
- goto done;
-
- fail:
- ok = false;
- done:
- if (tz_was_altered)
- ok &= (tz0 ? setenv ("TZ", tz0, 1) : unsetenv ("TZ")) == 0;
- if (tz0 != tz0buf)
- free (tz0);
-
- if (ok && pc.parse_datetime_debug)
- {
- /* print local timezone AFTER restoring TZ (if tz_was_altered)*/
- const long int otz = get_effective_timezone ();
- const char* tz_src;
- const char* tz_env;
-
- if ((tz_env = getenv("TZ")))
- {
- /* Special case: using 'date -u' simply set TZ=UTC0 */
- if (STREQ(tz_env,"UTC0"))
- {
- tz_src = _("TZ=UTC0 environment value or -u");
- }
- else
- {
- snprintf (dbg_tm, sizeof(dbg_tm),
- _("TZ=\"%s\" environment value"), tz_env);
- tz_src = dbg_tm;
- }
- }
- else
- {
- tz_src = _("system default");
- }
-
- if (pc.parse_datetime_debug)
- {
- dbg_printf (_("output timezone: %+03d:%02d (set from %s)\n"),
- (int)(otz/60), abs ((int)otz)%60, tz_src);
-
-
- dbg_printf (_("final: %ld.%09ld (epoch-seconds)\n"),
- result->tv_sec,result->tv_nsec);
-
- struct tm const *gmt = gmtime (&result->tv_sec);
- dbg_printf (_("final: %s (UTC0)\n"),
- debug_strfdatetime (gmt, NULL, dbg_tm, sizeof (dbg_tm)));
- struct tm const *lmt = localtime (&result->tv_sec);
- dbg_printf (_("final: %s (output timezone TZ=%+03d:%02d)\n"),
- debug_strfdatetime (lmt, NULL, dbg_tm, sizeof (dbg_tm)),
- (int)(otz/60), abs ((int)otz)%60);
- }
- }
-
- return ok;
-}
-
-#if TEST
-
-int
-main (int ac, char **av)
-{
- char buff[BUFSIZ];
-
- printf ("Enter date, or blank line to exit.\n\t> ");
- fflush (stdout);
-
- buff[BUFSIZ - 1] = '\0';
- while (fgets (buff, BUFSIZ - 1, stdin) && buff[0])
- {
- struct timespec d;
- struct tm const *tm;
- if (! parse_datetime (&d, buff, NULL))
- printf ("Bad format - couldn't convert.\n");
- else if (! (tm = localtime (&d.tv_sec)))
- {
- long int sec = d.tv_sec;
- printf ("localtime (%ld) failed\n", sec);
- }
- else
- {
- int ns = d.tv_nsec;
- printf ("%04ld-%02d-%02d %02d:%02d:%02d.%09d\n",
- tm->tm_year + 1900L, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec, ns);
- }
- printf ("\t> ");
- fflush (stdout);
- }
- return 0;
-}
-#endif /* TEST */
diff --git a/src/gl/printf-args.c b/src/gl/printf-args.c
deleted file mode 100644
index cfaed994a1..0000000000
--- a/src/gl/printf-args.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2016 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* This file can be parametrized with the following macros:
- ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
- PRINTF_FETCHARGS Name of the function to be defined.
- STATIC Set to 'static' to declare the function static. */
-
-#ifndef PRINTF_FETCHARGS
-# include <config.h>
-#endif
-
-/* Specification. */
-#ifndef PRINTF_FETCHARGS
-# include "printf-args.h"
-#endif
-
-#ifdef STATIC
-STATIC
-#endif
-int
-PRINTF_FETCHARGS (va_list args, arguments *a)
-{
- size_t i;
- argument *ap;
-
- for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
- switch (ap->type)
- {
- case TYPE_SCHAR:
- ap->a.a_schar = va_arg (args, /*signed char*/ int);
- break;
- case TYPE_UCHAR:
- ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
- break;
- case TYPE_SHORT:
- ap->a.a_short = va_arg (args, /*short*/ int);
- break;
- case TYPE_USHORT:
- ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
- break;
- case TYPE_INT:
- ap->a.a_int = va_arg (args, int);
- break;
- case TYPE_UINT:
- ap->a.a_uint = va_arg (args, unsigned int);
- break;
- case TYPE_LONGINT:
- ap->a.a_longint = va_arg (args, long int);
- break;
- case TYPE_ULONGINT:
- ap->a.a_ulongint = va_arg (args, unsigned long int);
- break;
-#if HAVE_LONG_LONG_INT
- case TYPE_LONGLONGINT:
- ap->a.a_longlongint = va_arg (args, long long int);
- break;
- case TYPE_ULONGLONGINT:
- ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
- break;
-#endif
- case TYPE_DOUBLE:
- ap->a.a_double = va_arg (args, double);
- break;
- case TYPE_LONGDOUBLE:
- ap->a.a_longdouble = va_arg (args, long double);
- break;
- case TYPE_CHAR:
- ap->a.a_char = va_arg (args, int);
- break;
-#if HAVE_WINT_T
- case TYPE_WIDE_CHAR:
- /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
- default argument promotions", this is not the case in mingw32,
- where wint_t is 'unsigned short'. */
- ap->a.a_wide_char =
- (sizeof (wint_t) < sizeof (int)
- ? (wint_t) va_arg (args, int)
- : va_arg (args, wint_t));
- break;
-#endif
- case TYPE_STRING:
- ap->a.a_string = va_arg (args, const char *);
- /* A null pointer is an invalid argument for "%s", but in practice
- it occurs quite frequently in printf statements that produce
- debug output. Use a fallback in this case. */
- if (ap->a.a_string == NULL)
- ap->a.a_string = "(NULL)";
- break;
-#if HAVE_WCHAR_T
- case TYPE_WIDE_STRING:
- ap->a.a_wide_string = va_arg (args, const wchar_t *);
- /* A null pointer is an invalid argument for "%ls", but in practice
- it occurs quite frequently in printf statements that produce
- debug output. Use a fallback in this case. */
- if (ap->a.a_wide_string == NULL)
- {
- static const wchar_t wide_null_string[] =
- {
- (wchar_t)'(',
- (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
- (wchar_t)')',
- (wchar_t)0
- };
- ap->a.a_wide_string = wide_null_string;
- }
- break;
-#endif
- case TYPE_POINTER:
- ap->a.a_pointer = va_arg (args, void *);
- break;
- case TYPE_COUNT_SCHAR_POINTER:
- ap->a.a_count_schar_pointer = va_arg (args, signed char *);
- break;
- case TYPE_COUNT_SHORT_POINTER:
- ap->a.a_count_short_pointer = va_arg (args, short *);
- break;
- case TYPE_COUNT_INT_POINTER:
- ap->a.a_count_int_pointer = va_arg (args, int *);
- break;
- case TYPE_COUNT_LONGINT_POINTER:
- ap->a.a_count_longint_pointer = va_arg (args, long int *);
- break;
-#if HAVE_LONG_LONG_INT
- case TYPE_COUNT_LONGLONGINT_POINTER:
- ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
- break;
-#endif
-#if ENABLE_UNISTDIO
- /* The unistdio extensions. */
- case TYPE_U8_STRING:
- ap->a.a_u8_string = va_arg (args, const uint8_t *);
- /* A null pointer is an invalid argument for "%U", but in practice
- it occurs quite frequently in printf statements that produce
- debug output. Use a fallback in this case. */
- if (ap->a.a_u8_string == NULL)
- {
- static const uint8_t u8_null_string[] =
- { '(', 'N', 'U', 'L', 'L', ')', 0 };
- ap->a.a_u8_string = u8_null_string;
- }
- break;
- case TYPE_U16_STRING:
- ap->a.a_u16_string = va_arg (args, const uint16_t *);
- /* A null pointer is an invalid argument for "%lU", but in practice
- it occurs quite frequently in printf statements that produce
- debug output. Use a fallback in this case. */
- if (ap->a.a_u16_string == NULL)
- {
- static const uint16_t u16_null_string[] =
- { '(', 'N', 'U', 'L', 'L', ')', 0 };
- ap->a.a_u16_string = u16_null_string;
- }
- break;
- case TYPE_U32_STRING:
- ap->a.a_u32_string = va_arg (args, const uint32_t *);
- /* A null pointer is an invalid argument for "%llU", but in practice
- it occurs quite frequently in printf statements that produce
- debug output. Use a fallback in this case. */
- if (ap->a.a_u32_string == NULL)
- {
- static const uint32_t u32_null_string[] =
- { '(', 'N', 'U', 'L', 'L', ')', 0 };
- ap->a.a_u32_string = u32_null_string;
- }
- break;
-#endif
- default:
- /* Unknown type. */
- return -1;
- }
- return 0;
-}
diff --git a/src/gl/printf-args.h b/src/gl/printf-args.h
deleted file mode 100644
index 256c413112..0000000000
--- a/src/gl/printf-args.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2016 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _PRINTF_ARGS_H
-#define _PRINTF_ARGS_H
-
-/* This file can be parametrized with the following macros:
- ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
- PRINTF_FETCHARGS Name of the function to be declared.
- STATIC Set to 'static' to declare the function static. */
-
-/* Default parameters. */
-#ifndef PRINTF_FETCHARGS
-# define PRINTF_FETCHARGS printf_fetchargs
-#endif
-
-/* Get size_t. */
-#include <stddef.h>
-
-/* Get wchar_t. */
-#if HAVE_WCHAR_T
-# include <stddef.h>
-#endif
-
-/* Get wint_t. */
-#if HAVE_WINT_T
-# include <wchar.h>
-#endif
-
-/* Get va_list. */
-#include <stdarg.h>
-
-
-/* Argument types */
-typedef enum
-{
- TYPE_NONE,
- TYPE_SCHAR,
- TYPE_UCHAR,
- TYPE_SHORT,
- TYPE_USHORT,
- TYPE_INT,
- TYPE_UINT,
- TYPE_LONGINT,
- TYPE_ULONGINT,
-#if HAVE_LONG_LONG_INT
- TYPE_LONGLONGINT,
- TYPE_ULONGLONGINT,
-#endif
- TYPE_DOUBLE,
- TYPE_LONGDOUBLE,
- TYPE_CHAR,
-#if HAVE_WINT_T
- TYPE_WIDE_CHAR,
-#endif
- TYPE_STRING,
-#if HAVE_WCHAR_T
- TYPE_WIDE_STRING,
-#endif
- TYPE_POINTER,
- TYPE_COUNT_SCHAR_POINTER,
- TYPE_COUNT_SHORT_POINTER,
- TYPE_COUNT_INT_POINTER,
- TYPE_COUNT_LONGINT_POINTER
-#if HAVE_LONG_LONG_INT
-, TYPE_COUNT_LONGLONGINT_POINTER
-#endif
-#if ENABLE_UNISTDIO
- /* The unistdio extensions. */
-, TYPE_U8_STRING
-, TYPE_U16_STRING
-, TYPE_U32_STRING
-#endif
-} arg_type;
-
-/* Polymorphic argument */
-typedef struct
-{
- arg_type type;
- union
- {
- signed char a_schar;
- unsigned char a_uchar;
- short a_short;
- unsigned short a_ushort;
- int a_int;
- unsigned int a_uint;
- long int a_longint;
- unsigned long int a_ulongint;
-#if HAVE_LONG_LONG_INT
- long long int a_longlongint;
- unsigned long long int a_ulonglongint;
-#endif
- float a_float;
- double a_double;
- long double a_longdouble;
- int a_char;
-#if HAVE_WINT_T
- wint_t a_wide_char;
-#endif
- const char* a_string;
-#if HAVE_WCHAR_T
- const wchar_t* a_wide_string;
-#endif
- void* a_pointer;
- signed char * a_count_schar_pointer;
- short * a_count_short_pointer;
- int * a_count_int_pointer;
- long int * a_count_longint_pointer;
-#if HAVE_LONG_LONG_INT
- long long int * a_count_longlongint_pointer;
-#endif
-#if ENABLE_UNISTDIO
- /* The unistdio extensions. */
- const uint8_t * a_u8_string;
- const uint16_t * a_u16_string;
- const uint32_t * a_u32_string;
-#endif
- }
- a;
-}
-argument;
-
-/* Number of directly allocated arguments (no malloc() needed). */
-#define N_DIRECT_ALLOC_ARGUMENTS 7
-
-typedef struct
-{
- size_t count;
- argument *arg;
- argument direct_alloc_arg[N_DIRECT_ALLOC_ARGUMENTS];
-}
-arguments;
-
-
-/* Fetch the arguments, putting them into a. */
-#ifdef STATIC
-STATIC
-#else
-extern
-#endif
-int PRINTF_FETCHARGS (va_list args, arguments *a);
-
-#endif /* _PRINTF_ARGS_H */
diff --git a/src/gl/printf-parse.c b/src/gl/printf-parse.c
deleted file mode 100644
index fad5d3d24c..0000000000
--- a/src/gl/printf-parse.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/* Formatted output to strings.
- Copyright (C) 1999-2000, 2002-2003, 2006-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* This file can be parametrized with the following macros:
- CHAR_T The element type of the format string.
- CHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters
- in the format string are ASCII.
- DIRECTIVE Structure denoting a format directive.
- Depends on CHAR_T.
- DIRECTIVES Structure denoting the set of format directives of a
- format string. Depends on CHAR_T.
- PRINTF_PARSE Function that parses a format string.
- Depends on CHAR_T.
- STATIC Set to 'static' to declare the function static.
- ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. */
-
-#ifndef PRINTF_PARSE
-# include <config.h>
-#endif
-
-/* Specification. */
-#ifndef PRINTF_PARSE
-# include "printf-parse.h"
-#endif
-
-/* Default parameters. */
-#ifndef PRINTF_PARSE
-# define PRINTF_PARSE printf_parse
-# define CHAR_T char
-# define DIRECTIVE char_directive
-# define DIRECTIVES char_directives
-#endif
-
-/* Get size_t, NULL. */
-#include <stddef.h>
-
-/* Get intmax_t. */
-#if defined IN_LIBINTL || defined IN_LIBASPRINTF
-# if HAVE_STDINT_H_WITH_UINTMAX
-# include <stdint.h>
-# endif
-# if HAVE_INTTYPES_H_WITH_UINTMAX
-# include <inttypes.h>
-# endif
-#else
-# include <stdint.h>
-#endif
-
-/* malloc(), realloc(), free(). */
-#include <stdlib.h>
-
-/* memcpy(). */
-#include <string.h>
-
-/* errno. */
-#include <errno.h>
-
-/* Checked size_t computations. */
-#include "xsize.h"
-
-#if CHAR_T_ONLY_ASCII
-/* c_isascii(). */
-# include "c-ctype.h"
-#endif
-
-#ifdef STATIC
-STATIC
-#endif
-int
-PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
-{
- const CHAR_T *cp = format; /* pointer into format */
- size_t arg_posn = 0; /* number of regular arguments consumed */
- size_t d_allocated; /* allocated elements of d->dir */
- size_t a_allocated; /* allocated elements of a->arg */
- size_t max_width_length = 0;
- size_t max_precision_length = 0;
-
- d->count = 0;
- d_allocated = N_DIRECT_ALLOC_DIRECTIVES;
- d->dir = d->direct_alloc_dir;
-
- a->count = 0;
- a_allocated = N_DIRECT_ALLOC_ARGUMENTS;
- a->arg = a->direct_alloc_arg;
-
-#define REGISTER_ARG(_index_,_type_) \
- { \
- size_t n = (_index_); \
- if (n >= a_allocated) \
- { \
- size_t memory_size; \
- argument *memory; \
- \
- a_allocated = xtimes (a_allocated, 2); \
- if (a_allocated <= n) \
- a_allocated = xsum (n, 1); \
- memory_size = xtimes (a_allocated, sizeof (argument)); \
- if (size_overflow_p (memory_size)) \
- /* Overflow, would lead to out of memory. */ \
- goto out_of_memory; \
- memory = (argument *) (a->arg != a->direct_alloc_arg \
- ? realloc (a->arg, memory_size) \
- : malloc (memory_size)); \
- if (memory == NULL) \
- /* Out of memory. */ \
- goto out_of_memory; \
- if (a->arg == a->direct_alloc_arg) \
- memcpy (memory, a->arg, a->count * sizeof (argument)); \
- a->arg = memory; \
- } \
- while (a->count <= n) \
- a->arg[a->count++].type = TYPE_NONE; \
- if (a->arg[n].type == TYPE_NONE) \
- a->arg[n].type = (_type_); \
- else if (a->arg[n].type != (_type_)) \
- /* Ambiguous type for positional argument. */ \
- goto error; \
- }
-
- while (*cp != '\0')
- {
- CHAR_T c = *cp++;
- if (c == '%')
- {
- size_t arg_index = ARG_NONE;
- DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */
-
- /* Initialize the next directive. */
- dp->dir_start = cp - 1;
- dp->flags = 0;
- dp->width_start = NULL;
- dp->width_end = NULL;
- dp->width_arg_index = ARG_NONE;
- dp->precision_start = NULL;
- dp->precision_end = NULL;
- dp->precision_arg_index = ARG_NONE;
- dp->arg_index = ARG_NONE;
-
- /* Test for positional argument. */
- if (*cp >= '0' && *cp <= '9')
- {
- const CHAR_T *np;
-
- for (np = cp; *np >= '0' && *np <= '9'; np++)
- ;
- if (*np == '$')
- {
- size_t n = 0;
-
- for (np = cp; *np >= '0' && *np <= '9'; np++)
- n = xsum (xtimes (n, 10), *np - '0');
- if (n == 0)
- /* Positional argument 0. */
- goto error;
- if (size_overflow_p (n))
- /* n too large, would lead to out of memory later. */
- goto error;
- arg_index = n - 1;
- cp = np + 1;
- }
- }
-
- /* Read the flags. */
- for (;;)
- {
- if (*cp == '\'')
- {
- dp->flags |= FLAG_GROUP;
- cp++;
- }
- else if (*cp == '-')
- {
- dp->flags |= FLAG_LEFT;
- cp++;
- }
- else if (*cp == '+')
- {
- dp->flags |= FLAG_SHOWSIGN;
- cp++;
- }
- else if (*cp == ' ')
- {
- dp->flags |= FLAG_SPACE;
- cp++;
- }
- else if (*cp == '#')
- {
- dp->flags |= FLAG_ALT;
- cp++;
- }
- else if (*cp == '0')
- {
- dp->flags |= FLAG_ZERO;
- cp++;
- }
-#if __GLIBC__ >= 2 && !defined __UCLIBC__
- else if (*cp == 'I')
- {
- dp->flags |= FLAG_LOCALIZED;
- cp++;
- }
-#endif
- else
- break;
- }
-
- /* Parse the field width. */
- if (*cp == '*')
- {
- dp->width_start = cp;
- cp++;
- dp->width_end = cp;
- if (max_width_length < 1)
- max_width_length = 1;
-
- /* Test for positional argument. */
- if (*cp >= '0' && *cp <= '9')
- {
- const CHAR_T *np;
-
- for (np = cp; *np >= '0' && *np <= '9'; np++)
- ;
- if (*np == '$')
- {
- size_t n = 0;
-
- for (np = cp; *np >= '0' && *np <= '9'; np++)
- n = xsum (xtimes (n, 10), *np - '0');
- if (n == 0)
- /* Positional argument 0. */
- goto error;
- if (size_overflow_p (n))
- /* n too large, would lead to out of memory later. */
- goto error;
- dp->width_arg_index = n - 1;
- cp = np + 1;
- }
- }
- if (dp->width_arg_index == ARG_NONE)
- {
- dp->width_arg_index = arg_posn++;
- if (dp->width_arg_index == ARG_NONE)
- /* arg_posn wrapped around. */
- goto error;
- }
- REGISTER_ARG (dp->width_arg_index, TYPE_INT);
- }
- else if (*cp >= '0' && *cp <= '9')
- {
- size_t width_length;
-
- dp->width_start = cp;
- for (; *cp >= '0' && *cp <= '9'; cp++)
- ;
- dp->width_end = cp;
- width_length = dp->width_end - dp->width_start;
- if (max_width_length < width_length)
- max_width_length = width_length;
- }
-
- /* Parse the precision. */
- if (*cp == '.')
- {
- cp++;
- if (*cp == '*')
- {
- dp->precision_start = cp - 1;
- cp++;
- dp->precision_end = cp;
- if (max_precision_length < 2)
- max_precision_length = 2;
-
- /* Test for positional argument. */
- if (*cp >= '0' && *cp <= '9')
- {
- const CHAR_T *np;
-
- for (np = cp; *np >= '0' && *np <= '9'; np++)
- ;
- if (*np == '$')
- {
- size_t n = 0;
-
- for (np = cp; *np >= '0' && *np <= '9'; np++)
- n = xsum (xtimes (n, 10), *np - '0');
- if (n == 0)
- /* Positional argument 0. */
- goto error;
- if (size_overflow_p (n))
- /* n too large, would lead to out of memory
- later. */
- goto error;
- dp->precision_arg_index = n - 1;
- cp = np + 1;
- }
- }
- if (dp->precision_arg_index == ARG_NONE)
- {
- dp->precision_arg_index = arg_posn++;
- if (dp->precision_arg_index == ARG_NONE)
- /* arg_posn wrapped around. */
- goto error;
- }
- REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
- }
- else
- {
- size_t precision_length;
-
- dp->precision_start = cp - 1;
- for (; *cp >= '0' && *cp <= '9'; cp++)
- ;
- dp->precision_end = cp;
- precision_length = dp->precision_end - dp->precision_start;
- if (max_precision_length < precision_length)
- max_precision_length = precision_length;
- }
- }
-
- {
- arg_type type;
-
- /* Parse argument type/size specifiers. */
- {
- int flags = 0;
-
- for (;;)
- {
- if (*cp == 'h')
- {
- flags |= (1 << (flags & 1));
- cp++;
- }
- else if (*cp == 'L')
- {
- flags |= 4;
- cp++;
- }
- else if (*cp == 'l')
- {
- flags += 8;
- cp++;
- }
- else if (*cp == 'j')
- {
- if (sizeof (intmax_t) > sizeof (long))
- {
- /* intmax_t = long long */
- flags += 16;
- }
- else if (sizeof (intmax_t) > sizeof (int))
- {
- /* intmax_t = long */
- flags += 8;
- }
- cp++;
- }
- else if (*cp == 'z' || *cp == 'Z')
- {
- /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
- because the warning facility in gcc-2.95.2 understands
- only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */
- if (sizeof (size_t) > sizeof (long))
- {
- /* size_t = long long */
- flags += 16;
- }
- else if (sizeof (size_t) > sizeof (int))
- {
- /* size_t = long */
- flags += 8;
- }
- cp++;
- }
- else if (*cp == 't')
- {
- if (sizeof (ptrdiff_t) > sizeof (long))
- {
- /* ptrdiff_t = long long */
- flags += 16;
- }
- else if (sizeof (ptrdiff_t) > sizeof (int))
- {
- /* ptrdiff_t = long */
- flags += 8;
- }
- cp++;
- }
-#if defined __APPLE__ && defined __MACH__
- /* On Mac OS X 10.3, PRIdMAX is defined as "qd".
- We cannot change it to "lld" because PRIdMAX must also
- be understood by the system's printf routines. */
- else if (*cp == 'q')
- {
- if (64 / 8 > sizeof (long))
- {
- /* int64_t = long long */
- flags += 16;
- }
- else
- {
- /* int64_t = long */
- flags += 8;
- }
- cp++;
- }
-#endif
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- /* On native Windows, PRIdMAX is defined as "I64d".
- We cannot change it to "lld" because PRIdMAX must also
- be understood by the system's printf routines. */
- else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
- {
- if (64 / 8 > sizeof (long))
- {
- /* __int64 = long long */
- flags += 16;
- }
- else
- {
- /* __int64 = long */
- flags += 8;
- }
- cp += 3;
- }
-#endif
- else
- break;
- }
-
- /* Read the conversion character. */
- c = *cp++;
- switch (c)
- {
- case 'd': case 'i':
-#if HAVE_LONG_LONG_INT
- /* If 'long long' exists and is larger than 'long': */
- if (flags >= 16 || (flags & 4))
- type = TYPE_LONGLONGINT;
- else
-#endif
- /* If 'long long' exists and is the same as 'long', we parse
- "lld" into TYPE_LONGINT. */
- if (flags >= 8)
- type = TYPE_LONGINT;
- else if (flags & 2)
- type = TYPE_SCHAR;
- else if (flags & 1)
- type = TYPE_SHORT;
- else
- type = TYPE_INT;
- break;
- case 'o': case 'u': case 'x': case 'X':
-#if HAVE_LONG_LONG_INT
- /* If 'long long' exists and is larger than 'long': */
- if (flags >= 16 || (flags & 4))
- type = TYPE_ULONGLONGINT;
- else
-#endif
- /* If 'unsigned long long' exists and is the same as
- 'unsigned long', we parse "llu" into TYPE_ULONGINT. */
- if (flags >= 8)
- type = TYPE_ULONGINT;
- else if (flags & 2)
- type = TYPE_UCHAR;
- else if (flags & 1)
- type = TYPE_USHORT;
- else
- type = TYPE_UINT;
- break;
- case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
- case 'a': case 'A':
- if (flags >= 16 || (flags & 4))
- type = TYPE_LONGDOUBLE;
- else
- type = TYPE_DOUBLE;
- break;
- case 'c':
- if (flags >= 8)
-#if HAVE_WINT_T
- type = TYPE_WIDE_CHAR;
-#else
- goto error;
-#endif
- else
- type = TYPE_CHAR;
- break;
-#if HAVE_WINT_T
- case 'C':
- type = TYPE_WIDE_CHAR;
- c = 'c';
- break;
-#endif
- case 's':
- if (flags >= 8)
-#if HAVE_WCHAR_T
- type = TYPE_WIDE_STRING;
-#else
- goto error;
-#endif
- else
- type = TYPE_STRING;
- break;
-#if HAVE_WCHAR_T
- case 'S':
- type = TYPE_WIDE_STRING;
- c = 's';
- break;
-#endif
- case 'p':
- type = TYPE_POINTER;
- break;
- case 'n':
-#if HAVE_LONG_LONG_INT
- /* If 'long long' exists and is larger than 'long': */
- if (flags >= 16 || (flags & 4))
- type = TYPE_COUNT_LONGLONGINT_POINTER;
- else
-#endif
- /* If 'long long' exists and is the same as 'long', we parse
- "lln" into TYPE_COUNT_LONGINT_POINTER. */
- if (flags >= 8)
- type = TYPE_COUNT_LONGINT_POINTER;
- else if (flags & 2)
- type = TYPE_COUNT_SCHAR_POINTER;
- else if (flags & 1)
- type = TYPE_COUNT_SHORT_POINTER;
- else
- type = TYPE_COUNT_INT_POINTER;
- break;
-#if ENABLE_UNISTDIO
- /* The unistdio extensions. */
- case 'U':
- if (flags >= 16)
- type = TYPE_U32_STRING;
- else if (flags >= 8)
- type = TYPE_U16_STRING;
- else
- type = TYPE_U8_STRING;
- break;
-#endif
- case '%':
- type = TYPE_NONE;
- break;
- default:
- /* Unknown conversion character. */
- goto error;
- }
- }
-
- if (type != TYPE_NONE)
- {
- dp->arg_index = arg_index;
- if (dp->arg_index == ARG_NONE)
- {
- dp->arg_index = arg_posn++;
- if (dp->arg_index == ARG_NONE)
- /* arg_posn wrapped around. */
- goto error;
- }
- REGISTER_ARG (dp->arg_index, type);
- }
- dp->conversion = c;
- dp->dir_end = cp;
- }
-
- d->count++;
- if (d->count >= d_allocated)
- {
- size_t memory_size;
- DIRECTIVE *memory;
-
- d_allocated = xtimes (d_allocated, 2);
- memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
- if (size_overflow_p (memory_size))
- /* Overflow, would lead to out of memory. */
- goto out_of_memory;
- memory = (DIRECTIVE *) (d->dir != d->direct_alloc_dir
- ? realloc (d->dir, memory_size)
- : malloc (memory_size));
- if (memory == NULL)
- /* Out of memory. */
- goto out_of_memory;
- if (d->dir == d->direct_alloc_dir)
- memcpy (memory, d->dir, d->count * sizeof (DIRECTIVE));
- d->dir = memory;
- }
- }
-#if CHAR_T_ONLY_ASCII
- else if (!c_isascii (c))
- {
- /* Non-ASCII character. Not supported. */
- goto error;
- }
-#endif
- }
- d->dir[d->count].dir_start = cp;
-
- d->max_width_length = max_width_length;
- d->max_precision_length = max_precision_length;
- return 0;
-
-error:
- if (a->arg != a->direct_alloc_arg)
- free (a->arg);
- if (d->dir != d->direct_alloc_dir)
- free (d->dir);
- errno = EINVAL;
- return -1;
-
-out_of_memory:
- if (a->arg != a->direct_alloc_arg)
- free (a->arg);
- if (d->dir != d->direct_alloc_dir)
- free (d->dir);
- errno = ENOMEM;
- return -1;
-}
-
-#undef PRINTF_PARSE
-#undef DIRECTIVES
-#undef DIRECTIVE
-#undef CHAR_T_ONLY_ASCII
-#undef CHAR_T
diff --git a/src/gl/printf-parse.h b/src/gl/printf-parse.h
deleted file mode 100644
index a46d946241..0000000000
--- a/src/gl/printf-parse.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* Parse printf format string.
- Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2016 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _PRINTF_PARSE_H
-#define _PRINTF_PARSE_H
-
-/* This file can be parametrized with the following macros:
- ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
- STATIC Set to 'static' to declare the function static. */
-
-#if HAVE_FEATURES_H
-# include <features.h> /* for __GLIBC__, __UCLIBC__ */
-#endif
-
-#include "printf-args.h"
-
-
-/* Flags */
-#define FLAG_GROUP 1 /* ' flag */
-#define FLAG_LEFT 2 /* - flag */
-#define FLAG_SHOWSIGN 4 /* + flag */
-#define FLAG_SPACE 8 /* space flag */
-#define FLAG_ALT 16 /* # flag */
-#define FLAG_ZERO 32
-#if __GLIBC__ >= 2 && !defined __UCLIBC__
-# define FLAG_LOCALIZED 64 /* I flag, uses localized digits */
-#endif
-
-/* arg_index value indicating that no argument is consumed. */
-#define ARG_NONE (~(size_t)0)
-
-/* xxx_directive: A parsed directive.
- xxx_directives: A parsed format string. */
-
-/* Number of directly allocated directives (no malloc() needed). */
-#define N_DIRECT_ALLOC_DIRECTIVES 7
-
-/* A parsed directive. */
-typedef struct
-{
- const char* dir_start;
- const char* dir_end;
- int flags;
- const char* width_start;
- const char* width_end;
- size_t width_arg_index;
- const char* precision_start;
- const char* precision_end;
- size_t precision_arg_index;
- char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
- size_t arg_index;
-}
-char_directive;
-
-/* A parsed format string. */
-typedef struct
-{
- size_t count;
- char_directive *dir;
- size_t max_width_length;
- size_t max_precision_length;
- char_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
-}
-char_directives;
-
-#if ENABLE_UNISTDIO
-
-/* A parsed directive. */
-typedef struct
-{
- const uint8_t* dir_start;
- const uint8_t* dir_end;
- int flags;
- const uint8_t* width_start;
- const uint8_t* width_end;
- size_t width_arg_index;
- const uint8_t* precision_start;
- const uint8_t* precision_end;
- size_t precision_arg_index;
- uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
- size_t arg_index;
-}
-u8_directive;
-
-/* A parsed format string. */
-typedef struct
-{
- size_t count;
- u8_directive *dir;
- size_t max_width_length;
- size_t max_precision_length;
- u8_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
-}
-u8_directives;
-
-/* A parsed directive. */
-typedef struct
-{
- const uint16_t* dir_start;
- const uint16_t* dir_end;
- int flags;
- const uint16_t* width_start;
- const uint16_t* width_end;
- size_t width_arg_index;
- const uint16_t* precision_start;
- const uint16_t* precision_end;
- size_t precision_arg_index;
- uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
- size_t arg_index;
-}
-u16_directive;
-
-/* A parsed format string. */
-typedef struct
-{
- size_t count;
- u16_directive *dir;
- size_t max_width_length;
- size_t max_precision_length;
- u16_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
-}
-u16_directives;
-
-/* A parsed directive. */
-typedef struct
-{
- const uint32_t* dir_start;
- const uint32_t* dir_end;
- int flags;
- const uint32_t* width_start;
- const uint32_t* width_end;
- size_t width_arg_index;
- const uint32_t* precision_start;
- const uint32_t* precision_end;
- size_t precision_arg_index;
- uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
- size_t arg_index;
-}
-u32_directive;
-
-/* A parsed format string. */
-typedef struct
-{
- size_t count;
- u32_directive *dir;
- size_t max_width_length;
- size_t max_precision_length;
- u32_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
-}
-u32_directives;
-
-#endif
-
-
-/* Parses the format string. Fills in the number N of directives, and fills
- in directives[0], ..., directives[N-1], and sets directives[N].dir_start
- to the end of the format string. Also fills in the arg_type fields of the
- arguments and the needed count of arguments. */
-#if ENABLE_UNISTDIO
-extern int
- ulc_printf_parse (const char *format, char_directives *d, arguments *a);
-extern int
- u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a);
-extern int
- u16_printf_parse (const uint16_t *format, u16_directives *d,
- arguments *a);
-extern int
- u32_printf_parse (const uint32_t *format, u32_directives *d,
- arguments *a);
-#else
-# ifdef STATIC
-STATIC
-# else
-extern
-# endif
-int printf_parse (const char *format, char_directives *d, arguments *a);
-#endif
-
-#endif /* _PRINTF_PARSE_H */
diff --git a/src/gl/progname.c b/src/gl/progname.c
deleted file mode 100644
index debb76026d..0000000000
--- a/src/gl/progname.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Program name management.
- Copyright (C) 2001-2003, 2005-2016 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2001.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-
-#include <config.h>
-
-/* Specification. */
-#undef ENABLE_RELOCATABLE /* avoid defining set_program_name as a macro */
-#include "progname.h"
-
-#include <errno.h> /* get program_invocation_name declaration */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/* String containing name the program is called with.
- To be initialized by main(). */
-const char *program_name = NULL;
-
-/* Set program_name, based on argv[0].
- argv0 must be a string allocated with indefinite extent, and must not be
- modified after this call. */
-void
-set_program_name (const char *argv0)
-{
- /* libtool creates a temporary executable whose name is sometimes prefixed
- with "lt-" (depends on the platform). It also makes argv[0] absolute.
- But the name of the temporary executable is a detail that should not be
- visible to the end user and to the test suite.
- Remove this "<dirname>/.libs/" or "<dirname>/.libs/lt-" prefix here. */
- const char *slash;
- const char *base;
-
- /* Sanity check. POSIX requires the invoking process to pass a non-NULL
- argv[0]. */
- if (argv0 == NULL)
- {
- /* It's a bug in the invoking program. Help diagnosing it. */
- fputs ("A NULL argv[0] was passed through an exec system call.\n",
- stderr);
- abort ();
- }
-
- slash = strrchr (argv0, '/');
- base = (slash != NULL ? slash + 1 : argv0);
- if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0)
- {
- argv0 = base;
- if (strncmp (base, "lt-", 3) == 0)
- {
- argv0 = base + 3;
- /* On glibc systems, remove the "lt-" prefix from the variable
- program_invocation_short_name. */
-#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
- program_invocation_short_name = (char *) argv0;
-#endif
- }
- }
-
- /* But don't strip off a leading <dirname>/ in general, because when the user
- runs
- /some/hidden/place/bin/cp foo foo
- he should get the error message
- /some/hidden/place/bin/cp: `foo' and `foo' are the same file
- not
- cp: `foo' and `foo' are the same file
- */
-
- program_name = argv0;
-
- /* On glibc systems, the error() function comes from libc and uses the
- variable program_invocation_name, not program_name. So set this variable
- as well. */
-#if HAVE_DECL_PROGRAM_INVOCATION_NAME
- program_invocation_name = (char *) argv0;
-#endif
-}
diff --git a/src/gl/progname.h b/src/gl/progname.h
deleted file mode 100644
index 0a574071bf..0000000000
--- a/src/gl/progname.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Program name management.
- Copyright (C) 2001-2004, 2006, 2009-2016 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2001.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _PROGNAME_H
-#define _PROGNAME_H
-
-/* Programs using this file should do the following in main():
- set_program_name (argv[0]);
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* String containing name the program is called with. */
-extern const char *program_name;
-
-/* Set program_name, based on argv[0].
- argv0 must be a string allocated with indefinite extent, and must not be
- modified after this call. */
-extern void set_program_name (const char *argv0);
-
-#if ENABLE_RELOCATABLE
-
-/* Set program_name, based on argv[0], and original installation prefix and
- directory, for relocatability. */
-extern void set_program_name_and_installdir (const char *argv0,
- const char *orig_installprefix,
- const char *orig_installdir);
-#undef set_program_name
-#define set_program_name(ARG0) \
- set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR)
-
-/* Return the full pathname of the current executable, based on the earlier
- call to set_program_name_and_installdir. Return NULL if unknown. */
-extern char *get_full_program_name (void);
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _PROGNAME_H */
diff --git a/src/gl/read-file.c b/src/gl/read-file.c
deleted file mode 100644
index f7b119965c..0000000000
--- a/src/gl/read-file.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* read-file.c -- read file contents into a string
- Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc.
- Written by Simon Josefsson and Bruno Haible.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include "read-file.h"
-
-/* Get fstat. */
-#include <sys/stat.h>
-
-/* Get ftello. */
-#include <stdio.h>
-
-/* Get SIZE_MAX. */
-#include <stdint.h>
-
-/* Get malloc, realloc, free. */
-#include <stdlib.h>
-
-/* Get errno. */
-#include <errno.h>
-
-/* Read a STREAM and return a newly allocated string with the content,
- and set *LENGTH to the length of the string. The string is
- zero-terminated, but the terminating zero byte is not counted in
- *LENGTH. On errors, *LENGTH is undefined, errno preserves the
- values set by system functions (if any), and NULL is returned. */
-char *
-fread_file (FILE *stream, size_t *length)
-{
- char *buf = NULL;
- size_t alloc = BUFSIZ;
-
- /* For a regular file, allocate a buffer that has exactly the right
- size. This avoids the need to do dynamic reallocations later. */
- {
- struct stat st;
-
- if (fstat (fileno (stream), &st) >= 0 && S_ISREG (st.st_mode))
- {
- off_t pos = ftello (stream);
-
- if (pos >= 0 && pos < st.st_size)
- {
- off_t alloc_off = st.st_size - pos;
-
- /* '1' below, accounts for the trailing NUL. */
- if (SIZE_MAX - 1 < alloc_off)
- {
- errno = ENOMEM;
- return NULL;
- }
-
- alloc = alloc_off + 1;
- }
- }
- }
-
- if (!(buf = malloc (alloc)))
- return NULL; /* errno is ENOMEM. */
-
- {
- size_t size = 0; /* number of bytes read so far */
- int save_errno;
-
- for (;;)
- {
- /* This reads 1 more than the size of a regular file
- so that we get eof immediately. */
- size_t requested = alloc - size;
- size_t count = fread (buf + size, 1, requested, stream);
- size += count;
-
- if (count != requested)
- {
- save_errno = errno;
- if (ferror (stream))
- break;
-
- /* Shrink the allocated memory if possible. */
- if (size < alloc - 1)
- {
- char *smaller_buf = realloc (buf, size + 1);
- if (smaller_buf != NULL)
- buf = smaller_buf;
- }
-
- buf[size] = '\0';
- *length = size;
- return buf;
- }
-
- {
- char *new_buf;
-
- if (alloc == SIZE_MAX)
- {
- save_errno = ENOMEM;
- break;
- }
-
- if (alloc < SIZE_MAX - alloc / 2)
- alloc = alloc + alloc / 2;
- else
- alloc = SIZE_MAX;
-
- if (!(new_buf = realloc (buf, alloc)))
- {
- save_errno = errno;
- break;
- }
-
- buf = new_buf;
- }
- }
-
- free (buf);
- errno = save_errno;
- return NULL;
- }
-}
-
-static char *
-internal_read_file (const char *filename, size_t *length, const char *mode)
-{
- FILE *stream = fopen (filename, mode);
- char *out;
- int save_errno;
-
- if (!stream)
- return NULL;
-
- out = fread_file (stream, length);
-
- save_errno = errno;
-
- if (fclose (stream) != 0)
- {
- if (out)
- {
- save_errno = errno;
- free (out);
- }
- errno = save_errno;
- return NULL;
- }
-
- return out;
-}
-
-/* Open and read the contents of FILENAME, and return a newly
- allocated string with the content, and set *LENGTH to the length of
- the string. The string is zero-terminated, but the terminating
- zero byte is not counted in *LENGTH. On errors, *LENGTH is
- undefined, errno preserves the values set by system functions (if
- any), and NULL is returned. */
-char *
-read_file (const char *filename, size_t *length)
-{
- return internal_read_file (filename, length, "r");
-}
-
-/* Open (on non-POSIX systems, in binary mode) and read the contents
- of FILENAME, and return a newly allocated string with the content,
- and set LENGTH to the length of the string. The string is
- zero-terminated, but the terminating zero byte is not counted in
- the LENGTH variable. On errors, *LENGTH is undefined, errno
- preserves the values set by system functions (if any), and NULL is
- returned. */
-char *
-read_binary_file (const char *filename, size_t *length)
-{
- return internal_read_file (filename, length, "rb");
-}
diff --git a/src/gl/read-file.h b/src/gl/read-file.h
deleted file mode 100644
index 6248065b79..0000000000
--- a/src/gl/read-file.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* read-file.h -- read file contents into a string
- Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc.
- Written by Simon Josefsson.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef READ_FILE_H
-#define READ_FILE_H
-
-/* Get size_t. */
-#include <stddef.h>
-
-/* Get FILE. */
-#include <stdio.h>
-
-extern char *fread_file (FILE * stream, size_t * length);
-
-extern char *read_file (const char *filename, size_t * length);
-
-extern char *read_binary_file (const char *filename, size_t * length);
-
-#endif /* READ_FILE_H */
diff --git a/src/gl/realloc.c b/src/gl/realloc.c
deleted file mode 100644
index 83cb44ee3e..0000000000
--- a/src/gl/realloc.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* realloc() function that is glibc compatible.
-
- Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2016 Free Software
- Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* written by Jim Meyering and Bruno Haible */
-
-#define _GL_USE_STDLIB_ALLOC 1
-#include <config.h>
-
-/* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */
-#ifdef realloc
-# define NEED_REALLOC_GNU 1
-/* Whereas the gnulib module 'realloc-gnu' defines HAVE_REALLOC_GNU. */
-#elif GNULIB_REALLOC_GNU && !HAVE_REALLOC_GNU
-# define NEED_REALLOC_GNU 1
-#endif
-
-/* Infer the properties of the system's malloc function.
- The gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */
-#if GNULIB_MALLOC_GNU && HAVE_MALLOC_GNU
-# define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1
-#endif
-
-#include <stdlib.h>
-
-#include <errno.h>
-
-/* Change the size of an allocated block of memory P to N bytes,
- with error checking. If N is zero, change it to 1. If P is NULL,
- use malloc. */
-
-void *
-rpl_realloc (void *p, size_t n)
-{
- void *result;
-
-#if NEED_REALLOC_GNU
- if (n == 0)
- {
- n = 1;
-
- /* In theory realloc might fail, so don't rely on it to free. */
- free (p);
- p = NULL;
- }
-#endif
-
- if (p == NULL)
- {
-#if GNULIB_REALLOC_GNU && !NEED_REALLOC_GNU && !SYSTEM_MALLOC_GLIBC_COMPATIBLE
- if (n == 0)
- n = 1;
-#endif
- result = malloc (n);
- }
- else
- result = realloc (p, n);
-
-#if !HAVE_REALLOC_POSIX
- if (result == NULL)
- errno = ENOMEM;
-#endif
-
- return result;
-}
diff --git a/src/gl/recv.c b/src/gl/recv.c
deleted file mode 100644
index e130627ae0..0000000000
--- a/src/gl/recv.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* recv.c --- wrappers for Windows recv function
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef recv
-
-ssize_t
-rpl_recv (int fd, void *buf, size_t len, int flags)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- int r = recv (sock, buf, len, flags);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
- }
-}
diff --git a/src/gl/recvfrom.c b/src/gl/recvfrom.c
deleted file mode 100644
index 85c55823ad..0000000000
--- a/src/gl/recvfrom.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* recvfrom.c --- wrappers for Windows recvfrom function
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef recvfrom
-
-ssize_t
-rpl_recvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *from,
- socklen_t *fromlen)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- int frombufsize = (from != NULL ? *fromlen : 0);
- int r = recvfrom (sock, buf, len, flags, from, fromlen);
-
- if (r < 0)
- set_winsock_errno ();
-
- /* Winsock recvfrom() only returns a valid 'from' when the socket is
- connectionless. POSIX gives a valid 'from' for all types of
- sockets. */
- else if (from != NULL && *fromlen == frombufsize)
- rpl_getpeername (fd, from, fromlen);
-
- return r;
- }
-}
diff --git a/src/gl/select.c b/src/gl/select.c
deleted file mode 100644
index 73abcf39e2..0000000000
--- a/src/gl/select.c
+++ /dev/null
@@ -1,575 +0,0 @@
-/* Emulation for select(2)
- Contributed by Paolo Bonzini.
-
- Copyright 2008-2016 Free Software Foundation, Inc.
-
- This file is part of gnulib.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-#include <alloca.h>
-#include <assert.h>
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Native Windows. */
-
-#include <sys/types.h>
-#include <errno.h>
-#include <limits.h>
-
-#include <winsock2.h>
-#include <windows.h>
-#include <io.h>
-#include <stdio.h>
-#include <conio.h>
-#include <time.h>
-
-/* Get the overridden 'struct timeval'. */
-#include <sys/time.h>
-
-#include "msvc-nothrow.h"
-
-#undef select
-
-struct bitset {
- unsigned char in[FD_SETSIZE / CHAR_BIT];
- unsigned char out[FD_SETSIZE / CHAR_BIT];
-};
-
-/* Declare data structures for ntdll functions. */
-typedef struct _FILE_PIPE_LOCAL_INFORMATION {
- ULONG NamedPipeType;
- ULONG NamedPipeConfiguration;
- ULONG MaximumInstances;
- ULONG CurrentInstances;
- ULONG InboundQuota;
- ULONG ReadDataAvailable;
- ULONG OutboundQuota;
- ULONG WriteQuotaAvailable;
- ULONG NamedPipeState;
- ULONG NamedPipeEnd;
-} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
-
-typedef struct _IO_STATUS_BLOCK
-{
- union {
- DWORD Status;
- PVOID Pointer;
- } u;
- ULONG_PTR Information;
-} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
-
-typedef enum _FILE_INFORMATION_CLASS {
- FilePipeLocalInformation = 24
-} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
-
-typedef DWORD (WINAPI *PNtQueryInformationFile)
- (HANDLE, IO_STATUS_BLOCK *, VOID *, ULONG, FILE_INFORMATION_CLASS);
-
-#ifndef PIPE_BUF
-#define PIPE_BUF 512
-#endif
-
-static BOOL IsConsoleHandle (HANDLE h)
-{
- DWORD mode;
- return GetConsoleMode (h, &mode) != 0;
-}
-
-static BOOL
-IsSocketHandle (HANDLE h)
-{
- WSANETWORKEVENTS ev;
-
- if (IsConsoleHandle (h))
- return FALSE;
-
- /* Under Wine, it seems that getsockopt returns 0 for pipes too.
- WSAEnumNetworkEvents instead distinguishes the two correctly. */
- ev.lNetworkEvents = 0xDEADBEEF;
- WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev);
- return ev.lNetworkEvents != 0xDEADBEEF;
-}
-
-/* Compute output fd_sets for libc descriptor FD (whose Windows handle is
- H). */
-
-static int
-windows_poll_handle (HANDLE h, int fd,
- struct bitset *rbits,
- struct bitset *wbits,
- struct bitset *xbits)
-{
- BOOL read, write, except;
- int i, ret;
- INPUT_RECORD *irbuffer;
- DWORD avail, nbuffer;
- BOOL bRet;
- IO_STATUS_BLOCK iosb;
- FILE_PIPE_LOCAL_INFORMATION fpli;
- static PNtQueryInformationFile NtQueryInformationFile;
- static BOOL once_only;
-
- read = write = except = FALSE;
- switch (GetFileType (h))
- {
- case FILE_TYPE_DISK:
- read = TRUE;
- write = TRUE;
- break;
-
- case FILE_TYPE_PIPE:
- if (!once_only)
- {
- NtQueryInformationFile = (PNtQueryInformationFile)
- GetProcAddress (GetModuleHandle ("ntdll.dll"),
- "NtQueryInformationFile");
- once_only = TRUE;
- }
-
- if (PeekNamedPipe (h, NULL, 0, NULL, &avail, NULL) != 0)
- {
- if (avail)
- read = TRUE;
- }
- else if (GetLastError () == ERROR_BROKEN_PIPE)
- ;
-
- else
- {
- /* It was the write-end of the pipe. Check if it is writable.
- If NtQueryInformationFile fails, optimistically assume the pipe is
- writable. This could happen on Windows 9x, where
- NtQueryInformationFile is not available, or if we inherit a pipe
- that doesn't permit FILE_READ_ATTRIBUTES access on the write end
- (I think this should not happen since Windows XP SP2; WINE seems
- fine too). Otherwise, ensure that enough space is available for
- atomic writes. */
- memset (&iosb, 0, sizeof (iosb));
- memset (&fpli, 0, sizeof (fpli));
-
- if (!NtQueryInformationFile
- || NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli),
- FilePipeLocalInformation)
- || fpli.WriteQuotaAvailable >= PIPE_BUF
- || (fpli.OutboundQuota < PIPE_BUF &&
- fpli.WriteQuotaAvailable == fpli.OutboundQuota))
- write = TRUE;
- }
- break;
-
- case FILE_TYPE_CHAR:
- write = TRUE;
- if (!(rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
- break;
-
- ret = WaitForSingleObject (h, 0);
- if (ret == WAIT_OBJECT_0)
- {
- if (!IsConsoleHandle (h))
- {
- read = TRUE;
- break;
- }
-
- nbuffer = avail = 0;
- bRet = GetNumberOfConsoleInputEvents (h, &nbuffer);
-
- /* Screen buffers handles are filtered earlier. */
- assert (bRet);
- if (nbuffer == 0)
- {
- except = TRUE;
- break;
- }
-
- irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD));
- bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail);
- if (!bRet || avail == 0)
- {
- except = TRUE;
- break;
- }
-
- for (i = 0; i < avail; i++)
- if (irbuffer[i].EventType == KEY_EVENT)
- read = TRUE;
- }
- break;
-
- default:
- ret = WaitForSingleObject (h, 0);
- write = TRUE;
- if (ret == WAIT_OBJECT_0)
- read = TRUE;
-
- break;
- }
-
- ret = 0;
- if (read && (rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
- {
- rbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1)));
- ret++;
- }
-
- if (write && (wbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
- {
- wbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1)));
- ret++;
- }
-
- if (except && (xbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
- {
- xbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1)));
- ret++;
- }
-
- return ret;
-}
-
-int
-rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
- struct timeval *timeout)
-#undef timeval
-{
- static struct timeval tv0;
- static HANDLE hEvent;
- HANDLE h, handle_array[FD_SETSIZE + 2];
- fd_set handle_rfds, handle_wfds, handle_xfds;
- struct bitset rbits, wbits, xbits;
- unsigned char anyfds_in[FD_SETSIZE / CHAR_BIT];
- DWORD ret, wait_timeout, nhandles, nsock, nbuffer;
- MSG msg;
- int i, fd, rc;
- clock_t tend;
-
- if (nfds > FD_SETSIZE)
- nfds = FD_SETSIZE;
-
- if (!timeout)
- wait_timeout = INFINITE;
- else
- {
- wait_timeout = timeout->tv_sec * 1000 + timeout->tv_usec / 1000;
-
- /* select is also used as a portable usleep. */
- if (!rfds && !wfds && !xfds)
- {
- Sleep (wait_timeout);
- return 0;
- }
- }
-
- if (!hEvent)
- hEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
-
- handle_array[0] = hEvent;
- nhandles = 1;
- nsock = 0;
-
- /* Copy descriptors to bitsets. At the same time, eliminate
- bits in the "wrong" direction for console input buffers
- and screen buffers, because screen buffers are waitable
- and they will block until a character is available. */
- memset (&rbits, 0, sizeof (rbits));
- memset (&wbits, 0, sizeof (wbits));
- memset (&xbits, 0, sizeof (xbits));
- memset (anyfds_in, 0, sizeof (anyfds_in));
- if (rfds)
- for (i = 0; i < rfds->fd_count; i++)
- {
- fd = rfds->fd_array[i];
- h = (HANDLE) _get_osfhandle (fd);
- if (IsConsoleHandle (h)
- && !GetNumberOfConsoleInputEvents (h, &nbuffer))
- continue;
-
- rbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
- anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
- }
- else
- rfds = (fd_set *) alloca (sizeof (fd_set));
-
- if (wfds)
- for (i = 0; i < wfds->fd_count; i++)
- {
- fd = wfds->fd_array[i];
- h = (HANDLE) _get_osfhandle (fd);
- if (IsConsoleHandle (h)
- && GetNumberOfConsoleInputEvents (h, &nbuffer))
- continue;
-
- wbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
- anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
- }
- else
- wfds = (fd_set *) alloca (sizeof (fd_set));
-
- if (xfds)
- for (i = 0; i < xfds->fd_count; i++)
- {
- fd = xfds->fd_array[i];
- xbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
- anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
- }
- else
- xfds = (fd_set *) alloca (sizeof (fd_set));
-
- /* Zero all the fd_sets, including the application's. */
- FD_ZERO (rfds);
- FD_ZERO (wfds);
- FD_ZERO (xfds);
- FD_ZERO (&handle_rfds);
- FD_ZERO (&handle_wfds);
- FD_ZERO (&handle_xfds);
-
- /* Classify handles. Create fd sets for sockets, poll the others. */
- for (i = 0; i < nfds; i++)
- {
- if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
- continue;
-
- h = (HANDLE) _get_osfhandle (i);
- if (!h)
- {
- errno = EBADF;
- return -1;
- }
-
- if (IsSocketHandle (h))
- {
- int requested = FD_CLOSE;
-
- /* See above; socket handles are mapped onto select, but we
- need to map descriptors to handles. */
- if (rbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
- {
- requested |= FD_READ | FD_ACCEPT;
- FD_SET ((SOCKET) h, rfds);
- FD_SET ((SOCKET) h, &handle_rfds);
- }
- if (wbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
- {
- requested |= FD_WRITE | FD_CONNECT;
- FD_SET ((SOCKET) h, wfds);
- FD_SET ((SOCKET) h, &handle_wfds);
- }
- if (xbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
- {
- requested |= FD_OOB;
- FD_SET ((SOCKET) h, xfds);
- FD_SET ((SOCKET) h, &handle_xfds);
- }
-
- WSAEventSelect ((SOCKET) h, hEvent, requested);
- nsock++;
- }
- else
- {
- handle_array[nhandles++] = h;
-
- /* Poll now. If we get an event, do not wait below. */
- if (wait_timeout != 0
- && windows_poll_handle (h, i, &rbits, &wbits, &xbits))
- wait_timeout = 0;
- }
- }
-
- /* Place a sentinel at the end of the array. */
- handle_array[nhandles] = NULL;
-
- /* When will the waiting period expire? */
- if (wait_timeout != INFINITE)
- tend = clock () + wait_timeout;
-
-restart:
- if (wait_timeout == 0 || nsock == 0)
- rc = 0;
- else
- {
- /* See if we need to wait in the loop below. If any select is ready,
- do MsgWaitForMultipleObjects anyway to dispatch messages, but
- no need to call select again. */
- rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0);
- if (rc == 0)
- {
- /* Restore the fd_sets for the other select we do below. */
- memcpy (&handle_rfds, rfds, sizeof (fd_set));
- memcpy (&handle_wfds, wfds, sizeof (fd_set));
- memcpy (&handle_xfds, xfds, sizeof (fd_set));
- }
- else
- wait_timeout = 0;
- }
-
- /* How much is left to wait? */
- if (wait_timeout != INFINITE)
- {
- clock_t tnow = clock ();
- if (tend >= tnow)
- wait_timeout = tend - tnow;
- else
- wait_timeout = 0;
- }
-
- for (;;)
- {
- ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE,
- wait_timeout, QS_ALLINPUT);
-
- if (ret == WAIT_OBJECT_0 + nhandles)
- {
- /* new input of some other kind */
- BOOL bRet;
- while ((bRet = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) != 0)
- {
- TranslateMessage (&msg);
- DispatchMessage (&msg);
- }
- }
- else
- break;
- }
-
- /* If we haven't done it yet, check the status of the sockets. */
- if (rc == 0 && nsock > 0)
- rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0);
-
- if (nhandles > 1)
- {
- /* Count results that are not counted in the return value of select. */
- nhandles = 1;
- for (i = 0; i < nfds; i++)
- {
- if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
- continue;
-
- h = (HANDLE) _get_osfhandle (i);
- if (h == handle_array[nhandles])
- {
- /* Not a socket. */
- nhandles++;
- windows_poll_handle (h, i, &rbits, &wbits, &xbits);
- if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))
- || wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))
- || xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
- rc++;
- }
- }
-
- if (rc == 0
- && (wait_timeout == INFINITE
- /* If NHANDLES > 1, but no bits are set, it means we've
- been told incorrectly that some handle was signaled.
- This happens with anonymous pipes, which always cause
- MsgWaitForMultipleObjects to exit immediately, but no
- data is found ready to be read by windows_poll_handle.
- To avoid a total failure (whereby we return zero and
- don't wait at all), let's poll in a more busy loop. */
- || (wait_timeout != 0 && nhandles > 1)))
- {
- /* Sleep 1 millisecond to avoid busy wait and retry with the
- original fd_sets. */
- memcpy (&handle_rfds, rfds, sizeof (fd_set));
- memcpy (&handle_wfds, wfds, sizeof (fd_set));
- memcpy (&handle_xfds, xfds, sizeof (fd_set));
- SleepEx (1, TRUE);
- goto restart;
- }
- if (timeout && wait_timeout == 0 && rc == 0)
- timeout->tv_sec = timeout->tv_usec = 0;
- }
-
- /* Now fill in the results. */
- FD_ZERO (rfds);
- FD_ZERO (wfds);
- FD_ZERO (xfds);
- nhandles = 1;
- for (i = 0; i < nfds; i++)
- {
- if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
- continue;
-
- h = (HANDLE) _get_osfhandle (i);
- if (h != handle_array[nhandles])
- {
- /* Perform handle->descriptor mapping. */
- WSAEventSelect ((SOCKET) h, NULL, 0);
- if (FD_ISSET (h, &handle_rfds))
- FD_SET (i, rfds);
- if (FD_ISSET (h, &handle_wfds))
- FD_SET (i, wfds);
- if (FD_ISSET (h, &handle_xfds))
- FD_SET (i, xfds);
- }
- else
- {
- /* Not a socket. */
- nhandles++;
- if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
- FD_SET (i, rfds);
- if (wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
- FD_SET (i, wfds);
- if (xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
- FD_SET (i, xfds);
- }
- }
-
- return rc;
-}
-
-#else /* ! Native Windows. */
-
-#include <sys/select.h>
-#include <stddef.h> /* NULL */
-#include <errno.h>
-#include <unistd.h>
-
-#undef select
-
-int
-rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
- struct timeval *timeout)
-{
- int i;
-
- /* FreeBSD 8.2 has a bug: it does not always detect invalid fds. */
- if (nfds < 0 || nfds > FD_SETSIZE)
- {
- errno = EINVAL;
- return -1;
- }
- for (i = 0; i < nfds; i++)
- {
- if (((rfds && FD_ISSET (i, rfds))
- || (wfds && FD_ISSET (i, wfds))
- || (xfds && FD_ISSET (i, xfds)))
- && dup2 (i, i) != i)
- return -1;
- }
-
- /* Interix 3.5 has a bug: it does not support nfds == 0. */
- if (nfds == 0)
- {
- nfds = 1;
- rfds = NULL;
- wfds = NULL;
- xfds = NULL;
- }
- return select (nfds, rfds, wfds, xfds, timeout);
-}
-
-#endif
diff --git a/src/gl/send.c b/src/gl/send.c
deleted file mode 100644
index 594472ffa2..0000000000
--- a/src/gl/send.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* send.c --- wrappers for Windows send function
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef send
-
-ssize_t
-rpl_send (int fd, const void *buf, size_t len, int flags)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- int r = send (sock, buf, len, flags);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
- }
-}
diff --git a/src/gl/sendto.c b/src/gl/sendto.c
deleted file mode 100644
index 484234532e..0000000000
--- a/src/gl/sendto.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* sendto.c --- wrappers for Windows sendto function
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef sendto
-
-ssize_t
-rpl_sendto (int fd, const void *buf, size_t len, int flags,
- const struct sockaddr *to, socklen_t tolen)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- int r = sendto (sock, buf, len, flags, to, tolen);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
- }
-}
diff --git a/src/gl/setenv.c b/src/gl/setenv.c
deleted file mode 100644
index 85c32cb224..0000000000
--- a/src/gl/setenv.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/* Copyright (C) 1992, 1995-2003, 2005-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#if !_LIBC
-/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
- optimizes away the name == NULL test below. */
-# define _GL_ARG_NONNULL(params)
-
-# define _GL_USE_STDLIB_ALLOC 1
-# include <config.h>
-#endif
-
-#include <alloca.h>
-
-/* Specification. */
-#include <stdlib.h>
-
-#include <errno.h>
-#ifndef __set_errno
-# define __set_errno(ev) ((errno) = (ev))
-#endif
-
-#include <string.h>
-#if _LIBC || HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if !_LIBC
-# include "malloca.h"
-#endif
-
-#if _LIBC || !HAVE_SETENV
-
-#if !_LIBC
-# define __environ environ
-#endif
-
-#if _LIBC
-/* This lock protects against simultaneous modifications of 'environ'. */
-# include <bits/libc-lock.h>
-__libc_lock_define_initialized (static, envlock)
-# define LOCK __libc_lock_lock (envlock)
-# define UNLOCK __libc_lock_unlock (envlock)
-#else
-# define LOCK
-# define UNLOCK
-#endif
-
-/* In the GNU C library we must keep the namespace clean. */
-#ifdef _LIBC
-# define setenv __setenv
-# define clearenv __clearenv
-# define tfind __tfind
-# define tsearch __tsearch
-#endif
-
-/* In the GNU C library implementation we try to be more clever and
- allow arbitrarily many changes of the environment given that the used
- values are from a small set. Outside glibc this will eat up all
- memory after a while. */
-#if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \
- && defined __GNUC__)
-# define USE_TSEARCH 1
-# include <search.h>
-typedef int (*compar_fn_t) (const void *, const void *);
-
-/* This is a pointer to the root of the search tree with the known
- values. */
-static void *known_values;
-
-# define KNOWN_VALUE(Str) \
- ({ \
- void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \
- value != NULL ? *(char **) value : NULL; \
- })
-# define STORE_VALUE(Str) \
- tsearch (Str, &known_values, (compar_fn_t) strcmp)
-
-#else
-# undef USE_TSEARCH
-
-# define KNOWN_VALUE(Str) NULL
-# define STORE_VALUE(Str) do { } while (0)
-
-#endif
-
-
-/* If this variable is not a null pointer we allocated the current
- environment. */
-static char **last_environ;
-
-
-/* This function is used by 'setenv' and 'putenv'. The difference between
- the two functions is that for the former must create a new string which
- is then placed in the environment, while the argument of 'putenv'
- must be used directly. This is all complicated by the fact that we try
- to reuse values once generated for a 'setenv' call since we can never
- free the strings. */
-int
-__add_to_environ (const char *name, const char *value, const char *combined,
- int replace)
-{
- char **ep;
- size_t size;
- const size_t namelen = strlen (name);
- const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
-
- LOCK;
-
- /* We have to get the pointer now that we have the lock and not earlier
- since another thread might have created a new environment. */
- ep = __environ;
-
- size = 0;
- if (ep != NULL)
- {
- for (; *ep != NULL; ++ep)
- if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
- break;
- else
- ++size;
- }
-
- if (ep == NULL || *ep == NULL)
- {
- char **new_environ;
-#ifdef USE_TSEARCH
- char *new_value;
-#endif
-
- /* We allocated this space; we can extend it. */
- new_environ =
- (char **) (last_environ == NULL
- ? malloc ((size + 2) * sizeof (char *))
- : realloc (last_environ, (size + 2) * sizeof (char *)));
- if (new_environ == NULL)
- {
- /* It's easier to set errno to ENOMEM than to rely on the
- 'malloc-posix' and 'realloc-posix' gnulib modules. */
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
-
- /* If the whole entry is given add it. */
- if (combined != NULL)
- /* We must not add the string to the search tree since it belongs
- to the user. */
- new_environ[size] = (char *) combined;
- else
- {
- /* See whether the value is already known. */
-#ifdef USE_TSEARCH
-# ifdef _LIBC
- new_value = (char *) alloca (namelen + 1 + vallen);
- __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
- value, vallen);
-# else
- new_value = (char *) malloca (namelen + 1 + vallen);
- if (new_value == NULL)
- {
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
- memcpy (new_value, name, namelen);
- new_value[namelen] = '=';
- memcpy (&new_value[namelen + 1], value, vallen);
-# endif
-
- new_environ[size] = KNOWN_VALUE (new_value);
- if (new_environ[size] == NULL)
-#endif
- {
- new_environ[size] = (char *) malloc (namelen + 1 + vallen);
- if (new_environ[size] == NULL)
- {
-#if defined USE_TSEARCH && !defined _LIBC
- freea (new_value);
-#endif
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
-
-#ifdef USE_TSEARCH
- memcpy (new_environ[size], new_value, namelen + 1 + vallen);
-#else
- memcpy (new_environ[size], name, namelen);
- new_environ[size][namelen] = '=';
- memcpy (&new_environ[size][namelen + 1], value, vallen);
-#endif
- /* And save the value now. We cannot do this when we remove
- the string since then we cannot decide whether it is a
- user string or not. */
- STORE_VALUE (new_environ[size]);
- }
-#if defined USE_TSEARCH && !defined _LIBC
- freea (new_value);
-#endif
- }
-
- if (__environ != last_environ)
- memcpy ((char *) new_environ, (char *) __environ,
- size * sizeof (char *));
-
- new_environ[size + 1] = NULL;
-
- last_environ = __environ = new_environ;
- }
- else if (replace)
- {
- char *np;
-
- /* Use the user string if given. */
- if (combined != NULL)
- np = (char *) combined;
- else
- {
-#ifdef USE_TSEARCH
- char *new_value;
-# ifdef _LIBC
- new_value = alloca (namelen + 1 + vallen);
- __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
- value, vallen);
-# else
- new_value = malloca (namelen + 1 + vallen);
- if (new_value == NULL)
- {
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
- memcpy (new_value, name, namelen);
- new_value[namelen] = '=';
- memcpy (&new_value[namelen + 1], value, vallen);
-# endif
-
- np = KNOWN_VALUE (new_value);
- if (np == NULL)
-#endif
- {
- np = (char *) malloc (namelen + 1 + vallen);
- if (np == NULL)
- {
-#if defined USE_TSEARCH && !defined _LIBC
- freea (new_value);
-#endif
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
-
-#ifdef USE_TSEARCH
- memcpy (np, new_value, namelen + 1 + vallen);
-#else
- memcpy (np, name, namelen);
- np[namelen] = '=';
- memcpy (&np[namelen + 1], value, vallen);
-#endif
- /* And remember the value. */
- STORE_VALUE (np);
- }
-#if defined USE_TSEARCH && !defined _LIBC
- freea (new_value);
-#endif
- }
-
- *ep = np;
- }
-
- UNLOCK;
-
- return 0;
-}
-
-int
-setenv (const char *name, const char *value, int replace)
-{
- if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- return __add_to_environ (name, value, NULL, replace);
-}
-
-/* The 'clearenv' was planned to be added to POSIX.1 but probably
- never made it. Nevertheless the POSIX.9 standard (POSIX bindings
- for Fortran 77) requires this function. */
-int
-clearenv (void)
-{
- LOCK;
-
- if (__environ == last_environ && __environ != NULL)
- {
- /* We allocated this environment so we can free it. */
- free (__environ);
- last_environ = NULL;
- }
-
- /* Clear the environment pointer removes the whole environment. */
- __environ = NULL;
-
- UNLOCK;
-
- return 0;
-}
-
-#ifdef _LIBC
-static void
-free_mem (void)
-{
- /* Remove all traces. */
- clearenv ();
-
- /* Now remove the search tree. */
- __tdestroy (known_values, free);
- known_values = NULL;
-}
-text_set_element (__libc_subfreeres, free_mem);
-
-
-# undef setenv
-# undef clearenv
-weak_alias (__setenv, setenv)
-weak_alias (__clearenv, clearenv)
-#endif
-
-#endif /* _LIBC || !HAVE_SETENV */
-
-/* The rest of this file is called into use when replacing an existing
- but buggy setenv. Known bugs include failure to diagnose invalid
- name, and consuming a leading '=' from value. */
-#if HAVE_SETENV
-
-# undef setenv
-# if !HAVE_DECL_SETENV
-extern int setenv (const char *, const char *, int);
-# endif
-# define STREQ(a, b) (strcmp (a, b) == 0)
-
-int
-rpl_setenv (const char *name, const char *value, int replace)
-{
- int result;
- if (!name || !*name || strchr (name, '='))
- {
- errno = EINVAL;
- return -1;
- }
- /* Call the real setenv even if replace is 0, in case implementation
- has underlying data to update, such as when environ changes. */
- result = setenv (name, value, replace);
- if (result == 0 && replace && *value == '=')
- {
- char *tmp = getenv (name);
- if (!STREQ (tmp, value))
- {
- int saved_errno;
- size_t len = strlen (value);
- tmp = malloca (len + 2);
- /* Since leading '=' is eaten, double it up. */
- *tmp = '=';
- memcpy (tmp + 1, value, len + 1);
- result = setenv (name, tmp, replace);
- saved_errno = errno;
- freea (tmp);
- errno = saved_errno;
- }
- }
- return result;
-}
-
-#endif /* HAVE_SETENV */
diff --git a/src/gl/setsockopt.c b/src/gl/setsockopt.c
deleted file mode 100644
index af09f3250f..0000000000
--- a/src/gl/setsockopt.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* setsockopt.c --- wrappers for Windows setsockopt function
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get struct timeval. */
-#include <sys/time.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef setsockopt
-
-int
-rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- int r;
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- if (level == SOL_SOCKET
- && (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
- {
- const struct timeval *tv = optval;
- int milliseconds = tv->tv_sec * 1000 + tv->tv_usec / 1000;
- optval = &milliseconds;
- r = setsockopt (sock, level, optname, optval, sizeof (int));
- }
- else
- {
- r = setsockopt (sock, level, optname, optval, optlen);
- }
-
- if (r < 0)
- set_winsock_errno ();
-
- return r;
- }
-}
diff --git a/src/gl/shutdown.c b/src/gl/shutdown.c
deleted file mode 100644
index 9dd4df6ecf..0000000000
--- a/src/gl/shutdown.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* shutdown.c --- wrappers for Windows shutdown function
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef shutdown
-
-int
-rpl_shutdown (int fd, int how)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- int r = shutdown (sock, how);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
- }
-}
diff --git a/src/gl/signal.in.h b/src/gl/signal.in.h
deleted file mode 100644
index ab0a049f8b..0000000000
--- a/src/gl/signal.in.h
+++ /dev/null
@@ -1,463 +0,0 @@
-/* A GNU-like <signal.h>.
-
- Copyright (C) 2006-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T)
-/* Special invocation convention:
- - Inside glibc header files.
- - On glibc systems we have a sequence of nested includes
- <signal.h> -> <ucontext.h> -> <signal.h>.
- In this situation, the functions are not yet declared, therefore we cannot
- provide the C++ aliases.
- - On glibc systems with GCC 4.3 we have a sequence of nested includes
- <csignal> -> </usr/include/signal.h> -> <sys/ucontext.h> -> <signal.h>.
- In this situation, some of the functions are not yet declared, therefore
- we cannot provide the C++ aliases. */
-
-# @INCLUDE_NEXT@ @NEXT_SIGNAL_H@
-
-#else
-/* Normal invocation convention. */
-
-#ifndef _@GUARD_PREFIX@_SIGNAL_H
-
-#define _GL_ALREADY_INCLUDING_SIGNAL_H
-
-/* Define pid_t, uid_t.
- Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.
- On Solaris 10, <signal.h> includes <sys/types.h>, which eventually includes
- us; so include <sys/types.h> now, before the second inclusion guard. */
-#include <sys/types.h>
-
-/* The include_next requires a split double-inclusion guard. */
-#@INCLUDE_NEXT@ @NEXT_SIGNAL_H@
-
-#undef _GL_ALREADY_INCLUDING_SIGNAL_H
-
-#ifndef _@GUARD_PREFIX@_SIGNAL_H
-#define _@GUARD_PREFIX@_SIGNAL_H
-
-/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android
- declare pthread_sigmask in <pthread.h>, not in <signal.h>.
- But avoid namespace pollution on glibc systems.*/
-#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
- && ((defined __APPLE__ && defined __MACH__) \
- || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ \
- || defined __sun || defined __ANDROID__) \
- && ! defined __GLIBC__
-# include <pthread.h>
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-/* On AIX, sig_atomic_t already includes volatile. C99 requires that
- 'volatile sig_atomic_t' ignore the extra modifier, but C89 did not.
- Hence, redefine this to a non-volatile type as needed. */
-#if ! @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
-# if !GNULIB_defined_sig_atomic_t
-typedef int rpl_sig_atomic_t;
-# undef sig_atomic_t
-# define sig_atomic_t rpl_sig_atomic_t
-# define GNULIB_defined_sig_atomic_t 1
-# endif
-#endif
-
-/* A set or mask of signals. */
-#if !@HAVE_SIGSET_T@
-# if !GNULIB_defined_sigset_t
-typedef unsigned int sigset_t;
-# define GNULIB_defined_sigset_t 1
-# endif
-#endif
-
-/* Define sighandler_t, the type of signal handlers. A GNU extension. */
-#if !@HAVE_SIGHANDLER_T@
-# ifdef __cplusplus
-extern "C" {
-# endif
-# if !GNULIB_defined_sighandler_t
-typedef void (*sighandler_t) (int);
-# define GNULIB_defined_sighandler_t 1
-# endif
-# ifdef __cplusplus
-}
-# endif
-#endif
-
-
-#if @GNULIB_SIGNAL_H_SIGPIPE@
-# ifndef SIGPIPE
-/* Define SIGPIPE to a value that does not overlap with other signals. */
-# define SIGPIPE 13
-# define GNULIB_defined_SIGPIPE 1
-/* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask',
- 'write', 'stdio'. */
-# endif
-#endif
-
-
-/* Maximum signal number + 1. */
-#ifndef NSIG
-# if defined __TANDEM
-# define NSIG 32
-# endif
-#endif
-
-
-#if @GNULIB_PTHREAD_SIGMASK@
-# if @REPLACE_PTHREAD_SIGMASK@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef pthread_sigmask
-# define pthread_sigmask rpl_pthread_sigmask
-# endif
-_GL_FUNCDECL_RPL (pthread_sigmask, int,
- (int how, const sigset_t *new_mask, sigset_t *old_mask));
-_GL_CXXALIAS_RPL (pthread_sigmask, int,
- (int how, const sigset_t *new_mask, sigset_t *old_mask));
-# else
-# if !@HAVE_PTHREAD_SIGMASK@
-_GL_FUNCDECL_SYS (pthread_sigmask, int,
- (int how, const sigset_t *new_mask, sigset_t *old_mask));
-# endif
-_GL_CXXALIAS_SYS (pthread_sigmask, int,
- (int how, const sigset_t *new_mask, sigset_t *old_mask));
-# endif
-_GL_CXXALIASWARN (pthread_sigmask);
-#elif defined GNULIB_POSIXCHECK
-# undef pthread_sigmask
-# if HAVE_RAW_DECL_PTHREAD_SIGMASK
-_GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - "
- "use gnulib module pthread_sigmask for portability");
-# endif
-#endif
-
-
-#if @GNULIB_RAISE@
-# if @REPLACE_RAISE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef raise
-# define raise rpl_raise
-# endif
-_GL_FUNCDECL_RPL (raise, int, (int sig));
-_GL_CXXALIAS_RPL (raise, int, (int sig));
-# else
-# if !@HAVE_RAISE@
-_GL_FUNCDECL_SYS (raise, int, (int sig));
-# endif
-_GL_CXXALIAS_SYS (raise, int, (int sig));
-# endif
-_GL_CXXALIASWARN (raise);
-#elif defined GNULIB_POSIXCHECK
-# undef raise
-/* Assume raise is always declared. */
-_GL_WARN_ON_USE (raise, "raise can crash on native Windows - "
- "use gnulib module raise for portability");
-#endif
-
-
-#if @GNULIB_SIGPROCMASK@
-# if !@HAVE_POSIX_SIGNALBLOCKING@
-
-# ifndef GNULIB_defined_signal_blocking
-# define GNULIB_defined_signal_blocking 1
-# endif
-
-/* Maximum signal number + 1. */
-# ifndef NSIG
-# define NSIG 32
-# endif
-
-/* This code supports only 32 signals. */
-# if !GNULIB_defined_verify_NSIG_constraint
-typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
-# define GNULIB_defined_verify_NSIG_constraint 1
-# endif
-
-# endif
-
-/* When also using extern inline, suppress the use of static inline in
- standard headers of problematic Apple configurations, as Libc at
- least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
- <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
- Perhaps Apple will fix this some day. */
-#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
- && (defined __i386__ || defined __x86_64__))
-# undef sigaddset
-# undef sigdelset
-# undef sigemptyset
-# undef sigfillset
-# undef sigismember
-#endif
-
-/* Test whether a given signal is contained in a signal set. */
-# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on Mac OS X. */
-# if defined __cplusplus && defined GNULIB_NAMESPACE
-# undef sigismember
-# endif
-# else
-_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig));
-_GL_CXXALIASWARN (sigismember);
-
-/* Initialize a signal set to the empty set. */
-# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on Mac OS X. */
-# if defined __cplusplus && defined GNULIB_NAMESPACE
-# undef sigemptyset
-# endif
-# else
-_GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set));
-_GL_CXXALIASWARN (sigemptyset);
-
-/* Add a signal to a signal set. */
-# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on Mac OS X. */
-# if defined __cplusplus && defined GNULIB_NAMESPACE
-# undef sigaddset
-# endif
-# else
-_GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig));
-_GL_CXXALIASWARN (sigaddset);
-
-/* Remove a signal from a signal set. */
-# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on Mac OS X. */
-# if defined __cplusplus && defined GNULIB_NAMESPACE
-# undef sigdelset
-# endif
-# else
-_GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig));
-_GL_CXXALIASWARN (sigdelset);
-
-/* Fill a signal set with all possible signals. */
-# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on Mac OS X. */
-# if defined __cplusplus && defined GNULIB_NAMESPACE
-# undef sigfillset
-# endif
-# else
-_GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set));
-_GL_CXXALIASWARN (sigfillset);
-
-/* Return the set of those blocked signals that are pending. */
-# if !@HAVE_POSIX_SIGNALBLOCKING@
-_GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set));
-_GL_CXXALIASWARN (sigpending);
-
-/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
- Then, if SET is not NULL, affect the current set of blocked signals by
- combining it with *SET as indicated in OPERATION.
- In this implementation, you are not allowed to change a signal handler
- while the signal is blocked. */
-# if !@HAVE_POSIX_SIGNALBLOCKING@
-# define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */
-# define SIG_SETMASK 1 /* blocked_set = *set; */
-# define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */
-_GL_FUNCDECL_SYS (sigprocmask, int,
- (int operation, const sigset_t *set, sigset_t *old_set));
-# endif
-_GL_CXXALIAS_SYS (sigprocmask, int,
- (int operation, const sigset_t *set, sigset_t *old_set));
-_GL_CXXALIASWARN (sigprocmask);
-
-/* Install the handler FUNC for signal SIG, and return the previous
- handler. */
-# ifdef __cplusplus
-extern "C" {
-# endif
-# if !GNULIB_defined_function_taking_int_returning_void_t
-typedef void (*_gl_function_taking_int_returning_void_t) (int);
-# define GNULIB_defined_function_taking_int_returning_void_t 1
-# endif
-# ifdef __cplusplus
-}
-# endif
-# if !@HAVE_POSIX_SIGNALBLOCKING@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define signal rpl_signal
-# endif
-_GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t,
- (int sig, _gl_function_taking_int_returning_void_t func));
-_GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t,
- (int sig, _gl_function_taking_int_returning_void_t func));
-# else
-_GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t,
- (int sig, _gl_function_taking_int_returning_void_t func));
-# endif
-_GL_CXXALIASWARN (signal);
-
-# if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE
-/* Raise signal SIGPIPE. */
-_GL_EXTERN_C int _gl_raise_SIGPIPE (void);
-# endif
-
-#elif defined GNULIB_POSIXCHECK
-# undef sigaddset
-# if HAVE_RAW_DECL_SIGADDSET
-_GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - "
- "use the gnulib module sigprocmask for portability");
-# endif
-# undef sigdelset
-# if HAVE_RAW_DECL_SIGDELSET
-_GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - "
- "use the gnulib module sigprocmask for portability");
-# endif
-# undef sigemptyset
-# if HAVE_RAW_DECL_SIGEMPTYSET
-_GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - "
- "use the gnulib module sigprocmask for portability");
-# endif
-# undef sigfillset
-# if HAVE_RAW_DECL_SIGFILLSET
-_GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - "
- "use the gnulib module sigprocmask for portability");
-# endif
-# undef sigismember
-# if HAVE_RAW_DECL_SIGISMEMBER
-_GL_WARN_ON_USE (sigismember, "sigismember is unportable - "
- "use the gnulib module sigprocmask for portability");
-# endif
-# undef sigpending
-# if HAVE_RAW_DECL_SIGPENDING
-_GL_WARN_ON_USE (sigpending, "sigpending is unportable - "
- "use the gnulib module sigprocmask for portability");
-# endif
-# undef sigprocmask
-# if HAVE_RAW_DECL_SIGPROCMASK
-_GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
- "use the gnulib module sigprocmask for portability");
-# endif
-#endif /* @GNULIB_SIGPROCMASK@ */
-
-
-#if @GNULIB_SIGACTION@
-# if !@HAVE_SIGACTION@
-
-# if !@HAVE_SIGINFO_T@
-
-# if !GNULIB_defined_siginfo_types
-
-/* Present to allow compilation, but unsupported by gnulib. */
-union sigval
-{
- int sival_int;
- void *sival_ptr;
-};
-
-/* Present to allow compilation, but unsupported by gnulib. */
-struct siginfo_t
-{
- int si_signo;
- int si_code;
- int si_errno;
- pid_t si_pid;
- uid_t si_uid;
- void *si_addr;
- int si_status;
- long si_band;
- union sigval si_value;
-};
-typedef struct siginfo_t siginfo_t;
-
-# define GNULIB_defined_siginfo_types 1
-# endif
-
-# endif /* !@HAVE_SIGINFO_T@ */
-
-/* We assume that platforms which lack the sigaction() function also lack
- the 'struct sigaction' type, and vice versa. */
-
-# if !GNULIB_defined_struct_sigaction
-
-struct sigaction
-{
- union
- {
- void (*_sa_handler) (int);
- /* Present to allow compilation, but unsupported by gnulib. POSIX
- says that implementations may, but not must, make sa_sigaction
- overlap with sa_handler, but we know of no implementation where
- they do not overlap. */
- void (*_sa_sigaction) (int, siginfo_t *, void *);
- } _sa_func;
- sigset_t sa_mask;
- /* Not all POSIX flags are supported. */
- int sa_flags;
-};
-# define sa_handler _sa_func._sa_handler
-# define sa_sigaction _sa_func._sa_sigaction
-/* Unsupported flags are not present. */
-# define SA_RESETHAND 1
-# define SA_NODEFER 2
-# define SA_RESTART 4
-
-# define GNULIB_defined_struct_sigaction 1
-# endif
-
-_GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict,
- struct sigaction *restrict));
-
-# elif !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@
-
-# define sa_sigaction sa_handler
-
-# endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */
-
-_GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict,
- struct sigaction *restrict));
-_GL_CXXALIASWARN (sigaction);
-
-#elif defined GNULIB_POSIXCHECK
-# undef sigaction
-# if HAVE_RAW_DECL_SIGACTION
-_GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
- "use the gnulib module sigaction for portability");
-# endif
-#endif
-
-/* Some systems don't have SA_NODEFER. */
-#ifndef SA_NODEFER
-# define SA_NODEFER 0
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_SIGNAL_H */
-#endif /* _@GUARD_PREFIX@_SIGNAL_H */
-#endif
diff --git a/src/gl/size_max.h b/src/gl/size_max.h
deleted file mode 100644
index 2f2792c233..0000000000
--- a/src/gl/size_max.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* size_max.h -- declare SIZE_MAX through system headers
- Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc.
- Written by Simon Josefsson.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef GNULIB_SIZE_MAX_H
-#define GNULIB_SIZE_MAX_H
-
-/* Get SIZE_MAX declaration on systems like Solaris 7/8/9. */
-# include <limits.h>
-/* Get SIZE_MAX declaration on systems like glibc 2. */
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
-/* On systems where these include files don't define it, SIZE_MAX is defined
- in config.h. */
-
-#endif /* GNULIB_SIZE_MAX_H */
diff --git a/src/gl/snprintf.c b/src/gl/snprintf.c
deleted file mode 100644
index 7cd89af871..0000000000
--- a/src/gl/snprintf.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Formatted output to strings.
- Copyright (C) 2004, 2006-2016 Free Software Foundation, Inc.
- Written by Simon Josefsson and Paul Eggert.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <stdio.h>
-
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "vasnprintf.h"
-
-/* Print formatted output to string STR. Similar to sprintf, but
- additional length SIZE limit how much is written into STR. Returns
- string length of formatted string (which may be larger than SIZE).
- STR may be NULL, in which case nothing will be written. On error,
- return a negative value. */
-int
-snprintf (char *str, size_t size, const char *format, ...)
-{
- char *output;
- size_t len;
- size_t lenbuf = size;
- va_list args;
-
- va_start (args, format);
- output = vasnprintf (str, &lenbuf, format, args);
- len = lenbuf;
- va_end (args);
-
- if (!output)
- return -1;
-
- if (output != str)
- {
- if (size)
- {
- size_t pruned_len = (len < size ? len : size - 1);
- memcpy (str, output, pruned_len);
- str[pruned_len] = '\0';
- }
-
- free (output);
- }
-
- if (INT_MAX < len)
- {
- errno = EOVERFLOW;
- return -1;
- }
-
- return len;
-}
diff --git a/src/gl/socket.c b/src/gl/socket.c
deleted file mode 100644
index 4ccec4b424..0000000000
--- a/src/gl/socket.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* socket.c --- wrappers for Windows socket function
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#include "sockets.h"
-
-int
-rpl_socket (int domain, int type, int protocol)
-{
- SOCKET fh;
-
- gl_sockets_startup (SOCKETS_1_1);
-
- /* We have to use WSASocket() to create non-overlapped IO sockets.
- Overlapped IO sockets cannot be used with read/write. */
- fh = WSASocket (domain, type, protocol, NULL, 0, 0);
-
- if (fh == INVALID_SOCKET)
- {
- set_winsock_errno ();
- return -1;
- }
- else
- return SOCKET_TO_FD (fh);
-}
diff --git a/src/gl/sockets.c b/src/gl/sockets.c
deleted file mode 100644
index abfab029fc..0000000000
--- a/src/gl/sockets.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* sockets.c --- wrappers for Windows socket functions
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Simon Josefsson */
-
-#include <config.h>
-
-/* Specification. */
-#include "sockets.h"
-
-#if WINDOWS_SOCKETS
-
-/* This includes winsock2.h on MinGW. */
-# include <sys/socket.h>
-
-# include "fd-hook.h"
-# include "msvc-nothrow.h"
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-# include "w32sock.h"
-
-static int
-close_fd_maybe_socket (const struct fd_hook *remaining_list,
- gl_close_fn primary,
- int fd)
-{
- /* Note about multithread-safety: There is a race condition where, between
- our calls to closesocket() and the primary close(), some other thread
- could make system calls that allocate precisely the same HANDLE value
- as sock; then the primary close() would call CloseHandle() on it. */
- SOCKET sock;
- WSANETWORKEVENTS ev;
-
- /* Test whether fd refers to a socket. */
- sock = FD_TO_SOCKET (fd);
- ev.lNetworkEvents = 0xDEADBEEF;
- WSAEnumNetworkEvents (sock, NULL, &ev);
- if (ev.lNetworkEvents != 0xDEADBEEF)
- {
- /* fd refers to a socket. */
- /* FIXME: other applications, like squid, use an undocumented
- _free_osfhnd free function. But this is not enough: The 'osfile'
- flags for fd also needs to be cleared, but it is hard to access it.
- Instead, here we just close twice the file descriptor. */
- if (closesocket (sock))
- {
- set_winsock_errno ();
- return -1;
- }
- else
- {
- /* This call frees the file descriptor and does a
- CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails. */
- _close (fd);
- return 0;
- }
- }
- else
- /* Some other type of file descriptor. */
- return execute_close_hooks (remaining_list, primary, fd);
-}
-
-static int
-ioctl_fd_maybe_socket (const struct fd_hook *remaining_list,
- gl_ioctl_fn primary,
- int fd, int request, void *arg)
-{
- SOCKET sock;
- WSANETWORKEVENTS ev;
-
- /* Test whether fd refers to a socket. */
- sock = FD_TO_SOCKET (fd);
- ev.lNetworkEvents = 0xDEADBEEF;
- WSAEnumNetworkEvents (sock, NULL, &ev);
- if (ev.lNetworkEvents != 0xDEADBEEF)
- {
- /* fd refers to a socket. */
- if (ioctlsocket (sock, request, arg) < 0)
- {
- set_winsock_errno ();
- return -1;
- }
- else
- return 0;
- }
- else
- /* Some other type of file descriptor. */
- return execute_ioctl_hooks (remaining_list, primary, fd, request, arg);
-}
-
-static struct fd_hook fd_sockets_hook;
-
-static int initialized_sockets_version /* = 0 */;
-
-#endif /* WINDOWS_SOCKETS */
-
-int
-gl_sockets_startup (int version _GL_UNUSED)
-{
-#if WINDOWS_SOCKETS
- if (version > initialized_sockets_version)
- {
- WSADATA data;
- int err;
-
- err = WSAStartup (version, &data);
- if (err != 0)
- return 1;
-
- if (data.wVersion != version)
- {
- WSACleanup ();
- return 2;
- }
-
- if (initialized_sockets_version == 0)
- register_fd_hook (close_fd_maybe_socket, ioctl_fd_maybe_socket,
- &fd_sockets_hook);
-
- initialized_sockets_version = version;
- }
-#endif
-
- return 0;
-}
-
-int
-gl_sockets_cleanup (void)
-{
-#if WINDOWS_SOCKETS
- int err;
-
- initialized_sockets_version = 0;
-
- unregister_fd_hook (&fd_sockets_hook);
-
- err = WSACleanup ();
- if (err != 0)
- return 1;
-#endif
-
- return 0;
-}
diff --git a/src/gl/sockets.h b/src/gl/sockets.h
deleted file mode 100644
index 01a68d07fd..0000000000
--- a/src/gl/sockets.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* sockets.h - wrappers for Windows socket functions
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Simon Josefsson */
-
-#ifndef SOCKETS_H
-# define SOCKETS_H 1
-
-#define SOCKETS_1_0 0x0001
-#define SOCKETS_1_1 0x0101
-#define SOCKETS_2_0 0x0002
-#define SOCKETS_2_1 0x0102
-#define SOCKETS_2_2 0x0202
-
-int gl_sockets_startup (int version)
-#if !WINDOWS_SOCKETS
- _GL_ATTRIBUTE_CONST
-#endif
- ;
-
-int gl_sockets_cleanup (void)
-#if !WINDOWS_SOCKETS
- _GL_ATTRIBUTE_CONST
-#endif
- ;
-
-/* This function is useful it you create a socket using gnulib's
- Winsock wrappers but needs to pass on the socket handle to some
- other library that only accepts sockets. */
-#if WINDOWS_SOCKETS
-
-#include <sys/socket.h>
-
-#include "msvc-nothrow.h"
-
-static inline SOCKET
-gl_fd_to_handle (int fd)
-{
- return _get_osfhandle (fd);
-}
-
-#else
-
-#define gl_fd_to_handle(x) (x)
-
-#endif /* WINDOWS_SOCKETS */
-
-#endif /* SOCKETS_H */
diff --git a/src/gl/stdalign.in.h b/src/gl/stdalign.in.h
deleted file mode 100644
index 12f8a15b31..0000000000
--- a/src/gl/stdalign.in.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* A substitute for ISO C11 <stdalign.h>.
-
- Copyright 2011-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paul Eggert and Bruno Haible. */
-
-#ifndef _GL_STDALIGN_H
-#define _GL_STDALIGN_H
-
-/* ISO C11 <stdalign.h> for platforms that lack it.
-
- References:
- ISO C11 (latest free draft
- <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>)
- sections 6.5.3.4, 6.7.5, 7.15.
- C++11 (latest free draft
- <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>)
- section 18.10. */
-
-/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment
- requirement of a structure member (i.e., slot or field) that is of
- type TYPE, as an integer constant expression.
-
- This differs from GCC's __alignof__ operator, which can yield a
- better-performing alignment for an object of that type. For
- example, on x86 with GCC, __alignof__ (double) and __alignof__
- (long long) are 8, whereas alignof (double) and alignof (long long)
- are 4 unless the option '-malign-double' is used.
-
- The result cannot be used as a value for an 'enum' constant, if you
- want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc.
-
- Include <stddef.h> for offsetof. */
-#include <stddef.h>
-
-/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
- standard headers, defines conflicting implementations of _Alignas
- and _Alignof that are no better than ours; override them. */
-#undef _Alignas
-#undef _Alignof
-
-/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023
- <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */
-#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
- || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9)))
-# ifdef __cplusplus
-# if 201103 <= __cplusplus
-# define _Alignof(type) alignof (type)
-# else
- template <class __t> struct __alignof_helper { char __a; __t __b; };
-# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
-# endif
-# else
-# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
-# endif
-#endif
-#if ! (defined __cplusplus && 201103 <= __cplusplus)
-# define alignof _Alignof
-#endif
-#define __alignof_is_defined 1
-
-/* alignas (A), also known as _Alignas (A), aligns a variable or type
- to the alignment A, where A is an integer constant expression. For
- example:
-
- int alignas (8) foo;
- struct s { int a; int alignas (8) bar; };
-
- aligns the address of FOO and the offset of BAR to be multiples of 8.
-
- A should be a power of two that is at least the type's alignment
- and at most the implementation's alignment limit. This limit is
- 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable
- to MSVC through at least version 10.0, A should be an integer
- constant, as MSVC does not support expressions such as 1 << 3.
- To be portable to Sun C 5.11, do not align auto variables to
- anything stricter than their default alignment.
-
- The following C11 requirements are not supported here:
-
- - If A is zero, alignas has no effect.
- - alignas can be used multiple times; the strictest one wins.
- - alignas (TYPE) is equivalent to alignas (alignof (TYPE)).
-
- */
-
-#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
-# if defined __cplusplus && 201103 <= __cplusplus
-# define _Alignas(a) alignas (a)
-# elif ((defined __APPLE__ && defined __MACH__ \
- ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
- : __GNUC__) \
- || 061200 <= __HP_cc || 061200 <= __HP_aCC \
- || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)
-# define _Alignas(a) __attribute__ ((__aligned__ (a)))
-# elif 1300 <= _MSC_VER
-# define _Alignas(a) __declspec (align (a))
-# endif
-#endif
-#if ((defined _Alignas && ! (defined __cplusplus && 201103 <= __cplusplus)) \
- || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
-# define alignas _Alignas
-#endif
-#if defined alignas || (defined __cplusplus && 201103 <= __cplusplus)
-# define __alignas_is_defined 1
-#endif
-
-#endif /* _GL_STDALIGN_H */
diff --git a/src/gl/stdbool.in.h b/src/gl/stdbool.in.h
deleted file mode 100644
index 7ecf203e75..0000000000
--- a/src/gl/stdbool.in.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Copyright (C) 2001-2003, 2006-2016 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _GL_STDBOOL_H
-#define _GL_STDBOOL_H
-
-/* ISO C 99 <stdbool.h> for platforms that lack it. */
-
-/* Usage suggestions:
-
- Programs that use <stdbool.h> should be aware of some limitations
- and standards compliance issues.
-
- Standards compliance:
-
- - <stdbool.h> must be #included before 'bool', 'false', 'true'
- can be used.
-
- - You cannot assume that sizeof (bool) == 1.
-
- - Programs should not undefine the macros bool, true, and false,
- as C99 lists that as an "obsolescent feature".
-
- Limitations of this substitute, when used in a C89 environment:
-
- - <stdbool.h> must be #included before the '_Bool' type can be used.
-
- - You cannot assume that _Bool is a typedef; it might be a macro.
-
- - Bit-fields of type 'bool' are not supported. Portable code
- should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
-
- - In C99, casts and automatic conversions to '_Bool' or 'bool' are
- performed in such a way that every nonzero value gets converted
- to 'true', and zero gets converted to 'false'. This doesn't work
- with this substitute. With this substitute, only the values 0 and 1
- give the expected result when converted to _Bool' or 'bool'.
-
- - C99 allows the use of (_Bool)0.0 in constant expressions, but
- this substitute cannot always provide this property.
-
- Also, it is suggested that programs use 'bool' rather than '_Bool';
- this isn't required, but 'bool' is more common. */
-
-
-/* 7.16. Boolean type and values */
-
-/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
- definitions below, but temporarily we have to #undef them. */
-#if defined __BEOS__ && !defined __HAIKU__
-# include <OS.h> /* defines bool but not _Bool */
-# undef false
-# undef true
-#endif
-
-#ifdef __cplusplus
-# define _Bool bool
-# define bool bool
-#else
-# if defined __BEOS__ && !defined __HAIKU__
- /* A compiler known to have 'bool'. */
- /* If the compiler already has both 'bool' and '_Bool', we can assume they
- are the same types. */
-# if !@HAVE__BOOL@
-typedef bool _Bool;
-# endif
-# else
-# if !defined __GNUC__
- /* If @HAVE__BOOL@:
- Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
- the built-in _Bool type is used. See
- http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
- http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
- http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
- Similar bugs are likely with other compilers as well; this file
- wouldn't be used if <stdbool.h> was working.
- So we override the _Bool type.
- If !@HAVE__BOOL@:
- Need to define _Bool ourselves. As 'signed char' or as an enum type?
- Use of a typedef, with SunPRO C, leads to a stupid
- "warning: _Bool is a keyword in ISO C99".
- Use of an enum type, with IRIX cc, leads to a stupid
- "warning(1185): enumerated type mixed with another type".
- Even the existence of an enum type, without a typedef,
- "Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
- The only benefit of the enum, debuggability, is not important
- with these compilers. So use 'signed char' and no enum. */
-# define _Bool signed char
-# else
- /* With this compiler, trust the _Bool type if the compiler has it. */
-# if !@HAVE__BOOL@
- /* For the sake of symbolic names in gdb, define true and false as
- enum constants, not only as macros.
- It is tempting to write
- typedef enum { false = 0, true = 1 } _Bool;
- so that gdb prints values of type 'bool' symbolically. But then
- values of type '_Bool' might promote to 'int' or 'unsigned int'
- (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
- (see ISO C 99 6.3.1.1.(2)). So add a negative value to the
- enum; this ensures that '_Bool' promotes to 'int'. */
-typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
-# endif
-# endif
-# endif
-# define bool _Bool
-#endif
-
-/* The other macros must be usable in preprocessor directives. */
-#ifdef __cplusplus
-# define false false
-# define true true
-#else
-# define false 0
-# define true 1
-#endif
-
-#define __bool_true_false_are_defined 1
-
-#endif /* _GL_STDBOOL_H */
diff --git a/src/gl/stddef.in.h b/src/gl/stddef.in.h
deleted file mode 100644
index f4c4a1070d..0000000000
--- a/src/gl/stddef.in.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
-
- Copyright (C) 2009-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Eric Blake. */
-
-/*
- * POSIX 2008 <stddef.h> for platforms that have issues.
- * <http://www.opengroup.org/susv3xbd/stddef.h.html>
- */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if defined __need_wchar_t || defined __need_size_t \
- || defined __need_ptrdiff_t || defined __need_NULL \
- || defined __need_wint_t
-/* Special invocation convention inside gcc header files. In
- particular, gcc provides a version of <stddef.h> that blindly
- redefines NULL even when __need_wint_t was defined, even though
- wint_t is not normally provided by <stddef.h>. Hence, we must
- remember if special invocation has ever been used to obtain wint_t,
- in which case we need to clean up NULL yet again. */
-
-# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
-# ifdef __need_wint_t
-# define _GL_STDDEF_WINT_T
-# endif
-# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
-# endif
-
-#else
-/* Normal invocation convention. */
-
-# ifndef _@GUARD_PREFIX@_STDDEF_H
-
-/* The include_next requires a split double-inclusion guard. */
-
-# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
-
-/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
-# if (@REPLACE_NULL@ \
- && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T))
-# undef NULL
-# ifdef __cplusplus
- /* ISO C++ says that the macro NULL must expand to an integer constant
- expression, hence '((void *) 0)' is not allowed in C++. */
-# if __GNUG__ >= 3
- /* GNU C++ has a __null macro that behaves like an integer ('int' or
- 'long') but has the same size as a pointer. Use that, to avoid
- warnings. */
-# define NULL __null
-# else
-# define NULL 0L
-# endif
-# else
-# define NULL ((void *) 0)
-# endif
-# endif
-
-# ifndef _@GUARD_PREFIX@_STDDEF_H
-# define _@GUARD_PREFIX@_STDDEF_H
-
-/* Some platforms lack wchar_t. */
-#if !@HAVE_WCHAR_T@
-# define wchar_t int
-#endif
-
-/* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is
- a hack in case the configure-time test was done with g++ even though
- we are currently compiling with gcc. */
-#if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T)
-/* On the x86, the maximum storage alignment of double, long, etc. is 4,
- but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8,
- and the C11 standard allows this. Work around this problem by
- using __alignof__ (which returns 8 for double) rather than _Alignof
- (which returns 4), and align each union member accordingly. */
-# ifdef __GNUC__
-# define _GL_STDDEF_ALIGNAS(type) \
- __attribute__ ((__aligned__ (__alignof__ (type))))
-# else
-# define _GL_STDDEF_ALIGNAS(type) /* */
-# endif
-typedef union
-{
- char *__p _GL_STDDEF_ALIGNAS (char *);
- double __d _GL_STDDEF_ALIGNAS (double);
- long double __ld _GL_STDDEF_ALIGNAS (long double);
- long int __i _GL_STDDEF_ALIGNAS (long int);
-} max_align_t;
-#endif
-
-# endif /* _@GUARD_PREFIX@_STDDEF_H */
-# endif /* _@GUARD_PREFIX@_STDDEF_H */
-#endif /* __need_XXX */
diff --git a/src/gl/stdint.in.h b/src/gl/stdint.in.h
deleted file mode 100644
index c86ab09628..0000000000
--- a/src/gl/stdint.in.h
+++ /dev/null
@@ -1,698 +0,0 @@
-/* Copyright (C) 2001-2002, 2004-2016 Free Software Foundation, Inc.
- Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
- This file is part of gnulib.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/*
- * ISO C 99 <stdint.h> for platforms that lack it.
- * <http://www.opengroup.org/susv3xbd/stdint.h.html>
- */
-
-#ifndef _@GUARD_PREFIX@_STDINT_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* When including a system file that in turn includes <inttypes.h>,
- use the system <inttypes.h>, not our substitute. This avoids
- problems with (for example) VMS, whose <sys/bitypes.h> includes
- <inttypes.h>. */
-#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
-
-/* On Android (Bionic libc), <sys/types.h> includes this file before
- having defined 'time_t'. Therefore in this case avoid including
- other system header files; just include the system's <stdint.h>.
- Ideally we should test __BIONIC__ here, but it is only defined after
- <sys/cdefs.h> has been included; hence test __ANDROID__ instead. */
-#if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H
-# @INCLUDE_NEXT@ @NEXT_STDINT_H@
-#else
-
-/* Get those types that are already defined in other system include
- files, so that we can "#define int8_t signed char" below without
- worrying about a later system include file containing a "typedef
- signed char int8_t;" that will get messed up by our macro. Our
- macros should all be consistent with the system versions, except
- for the "fast" types and macros, which we recommend against using
- in public interfaces due to compiler differences. */
-
-#if @HAVE_STDINT_H@
-# if defined __sgi && ! defined __c99
- /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
- with "This header file is to be used only for c99 mode compilations"
- diagnostics. */
-# define __STDINT_H__
-# endif
-
- /* Some pre-C++11 <stdint.h> implementations need this. */
-# ifdef __cplusplus
-# ifndef __STDC_CONSTANT_MACROS
-# define __STDC_CONSTANT_MACROS 1
-# endif
-# ifndef __STDC_LIMIT_MACROS
-# define __STDC_LIMIT_MACROS 1
-# endif
-# endif
-
- /* Other systems may have an incomplete or buggy <stdint.h>.
- Include it before <inttypes.h>, since any "#include <stdint.h>"
- in <inttypes.h> would reinclude us, skipping our contents because
- _@GUARD_PREFIX@_STDINT_H is defined.
- The include_next requires a split double-inclusion guard. */
-# @INCLUDE_NEXT@ @NEXT_STDINT_H@
-#endif
-
-#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
-#define _@GUARD_PREFIX@_STDINT_H
-
-/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
- LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */
-#include <limits.h>
-
-#if ! @HAVE_C99_STDINT_H@
-
-/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
- IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
- AIX 5.2 <sys/types.h> isn't needed and causes troubles.
- Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
- relies on the system <stdint.h> definitions, so include
- <sys/types.h> after @NEXT_STDINT_H@. */
-# if @HAVE_SYS_TYPES_H@ && ! defined _AIX
-# include <sys/types.h>
-# endif
-
-# if @HAVE_INTTYPES_H@
- /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
- int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
- <inttypes.h> also defines intptr_t and uintptr_t. */
-# include <inttypes.h>
-# elif @HAVE_SYS_INTTYPES_H@
- /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
- the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */
-# include <sys/inttypes.h>
-# endif
-
-# if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
- /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
- int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
- included by <sys/types.h>. */
-# include <sys/bitypes.h>
-# endif
-
-# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
-
-/* Minimum and maximum values for an integer type under the usual assumption.
- Return an unspecified value if BITS == 0, adding a check to pacify
- picky compilers. */
-
-# define _STDINT_MIN(signed, bits, zero) \
- ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero))
-
-# define _STDINT_MAX(signed, bits, zero) \
- (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
-
-#if !GNULIB_defined_stdint_types
-
-/* 7.18.1.1. Exact-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
- types have 8, 16, 32, optionally 64 bits. */
-
-# undef int8_t
-# undef uint8_t
-typedef signed char gl_int8_t;
-typedef unsigned char gl_uint8_t;
-# define int8_t gl_int8_t
-# define uint8_t gl_uint8_t
-
-# undef int16_t
-# undef uint16_t
-typedef short int gl_int16_t;
-typedef unsigned short int gl_uint16_t;
-# define int16_t gl_int16_t
-# define uint16_t gl_uint16_t
-
-# undef int32_t
-# undef uint32_t
-typedef int gl_int32_t;
-typedef unsigned int gl_uint32_t;
-# define int32_t gl_int32_t
-# define uint32_t gl_uint32_t
-
-/* If the system defines INT64_MAX, assume int64_t works. That way,
- if the underlying platform defines int64_t to be a 64-bit long long
- int, the code below won't mistakenly define it to be a 64-bit long
- int, which would mess up C++ name mangling. We must use #ifdef
- rather than #if, to avoid an error with HP-UX 10.20 cc. */
-
-# ifdef INT64_MAX
-# define GL_INT64_T
-# else
-/* Do not undefine int64_t if gnulib is not being used with 64-bit
- types, since otherwise it breaks platforms like Tandem/NSK. */
-# if LONG_MAX >> 31 >> 31 == 1
-# undef int64_t
-typedef long int gl_int64_t;
-# define int64_t gl_int64_t
-# define GL_INT64_T
-# elif defined _MSC_VER
-# undef int64_t
-typedef __int64 gl_int64_t;
-# define int64_t gl_int64_t
-# define GL_INT64_T
-# elif @HAVE_LONG_LONG_INT@
-# undef int64_t
-typedef long long int gl_int64_t;
-# define int64_t gl_int64_t
-# define GL_INT64_T
-# endif
-# endif
-
-# ifdef UINT64_MAX
-# define GL_UINT64_T
-# else
-# if ULONG_MAX >> 31 >> 31 >> 1 == 1
-# undef uint64_t
-typedef unsigned long int gl_uint64_t;
-# define uint64_t gl_uint64_t
-# define GL_UINT64_T
-# elif defined _MSC_VER
-# undef uint64_t
-typedef unsigned __int64 gl_uint64_t;
-# define uint64_t gl_uint64_t
-# define GL_UINT64_T
-# elif @HAVE_UNSIGNED_LONG_LONG_INT@
-# undef uint64_t
-typedef unsigned long long int gl_uint64_t;
-# define uint64_t gl_uint64_t
-# define GL_UINT64_T
-# endif
-# endif
-
-/* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */
-# define _UINT8_T
-# define _UINT32_T
-# define _UINT64_T
-
-
-/* 7.18.1.2. Minimum-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
- types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
- are the same as the corresponding N_t types. */
-
-# undef int_least8_t
-# undef uint_least8_t
-# undef int_least16_t
-# undef uint_least16_t
-# undef int_least32_t
-# undef uint_least32_t
-# undef int_least64_t
-# undef uint_least64_t
-# define int_least8_t int8_t
-# define uint_least8_t uint8_t
-# define int_least16_t int16_t
-# define uint_least16_t uint16_t
-# define int_least32_t int32_t
-# define uint_least32_t uint32_t
-# ifdef GL_INT64_T
-# define int_least64_t int64_t
-# endif
-# ifdef GL_UINT64_T
-# define uint_least64_t uint64_t
-# endif
-
-/* 7.18.1.3. Fastest minimum-width integer types */
-
-/* Note: Other <stdint.h> substitutes may define these types differently.
- It is not recommended to use these types in public header files. */
-
-/* Here we assume a standard architecture where the hardware integer
- types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
- are taken from the same list of types. The following code normally
- uses types consistent with glibc, as that lessens the chance of
- incompatibility with older GNU hosts. */
-
-# undef int_fast8_t
-# undef uint_fast8_t
-# undef int_fast16_t
-# undef uint_fast16_t
-# undef int_fast32_t
-# undef uint_fast32_t
-# undef int_fast64_t
-# undef uint_fast64_t
-typedef signed char gl_int_fast8_t;
-typedef unsigned char gl_uint_fast8_t;
-
-# ifdef __sun
-/* Define types compatible with SunOS 5.10, so that code compiled under
- earlier SunOS versions works with code compiled under SunOS 5.10. */
-typedef int gl_int_fast32_t;
-typedef unsigned int gl_uint_fast32_t;
-# else
-typedef long int gl_int_fast32_t;
-typedef unsigned long int gl_uint_fast32_t;
-# endif
-typedef gl_int_fast32_t gl_int_fast16_t;
-typedef gl_uint_fast32_t gl_uint_fast16_t;
-
-# define int_fast8_t gl_int_fast8_t
-# define uint_fast8_t gl_uint_fast8_t
-# define int_fast16_t gl_int_fast16_t
-# define uint_fast16_t gl_uint_fast16_t
-# define int_fast32_t gl_int_fast32_t
-# define uint_fast32_t gl_uint_fast32_t
-# ifdef GL_INT64_T
-# define int_fast64_t int64_t
-# endif
-# ifdef GL_UINT64_T
-# define uint_fast64_t uint64_t
-# endif
-
-/* 7.18.1.4. Integer types capable of holding object pointers */
-
-/* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own
- definitions of intptr_t and uintptr_t (which use int and unsigned)
- to avoid clashes with declarations of system functions like sbrk. */
-# ifndef _INTPTR_T_DECLARED
-# undef intptr_t
-# undef uintptr_t
-typedef long int gl_intptr_t;
-typedef unsigned long int gl_uintptr_t;
-# define intptr_t gl_intptr_t
-# define uintptr_t gl_uintptr_t
-# endif
-
-/* 7.18.1.5. Greatest-width integer types */
-
-/* Note: These types are compiler dependent. It may be unwise to use them in
- public header files. */
-
-/* If the system defines INTMAX_MAX, assume that intmax_t works, and
- similarly for UINTMAX_MAX and uintmax_t. This avoids problems with
- assuming one type where another is used by the system. */
-
-# ifndef INTMAX_MAX
-# undef INTMAX_C
-# undef intmax_t
-# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-typedef long long int gl_intmax_t;
-# define intmax_t gl_intmax_t
-# elif defined GL_INT64_T
-# define intmax_t int64_t
-# else
-typedef long int gl_intmax_t;
-# define intmax_t gl_intmax_t
-# endif
-# endif
-
-# ifndef UINTMAX_MAX
-# undef UINTMAX_C
-# undef uintmax_t
-# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-typedef unsigned long long int gl_uintmax_t;
-# define uintmax_t gl_uintmax_t
-# elif defined GL_UINT64_T
-# define uintmax_t uint64_t
-# else
-typedef unsigned long int gl_uintmax_t;
-# define uintmax_t gl_uintmax_t
-# endif
-# endif
-
-/* Verify that intmax_t and uintmax_t have the same size. Too much code
- breaks if this is not the case. If this check fails, the reason is likely
- to be found in the autoconf macros. */
-typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
- ? 1 : -1];
-
-# define GNULIB_defined_stdint_types 1
-# endif /* !GNULIB_defined_stdint_types */
-
-/* 7.18.2. Limits of specified-width integer types */
-
-/* 7.18.2.1. Limits of exact-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
- types have 8, 16, 32, optionally 64 bits. */
-
-# undef INT8_MIN
-# undef INT8_MAX
-# undef UINT8_MAX
-# define INT8_MIN (~ INT8_MAX)
-# define INT8_MAX 127
-# define UINT8_MAX 255
-
-# undef INT16_MIN
-# undef INT16_MAX
-# undef UINT16_MAX
-# define INT16_MIN (~ INT16_MAX)
-# define INT16_MAX 32767
-# define UINT16_MAX 65535
-
-# undef INT32_MIN
-# undef INT32_MAX
-# undef UINT32_MAX
-# define INT32_MIN (~ INT32_MAX)
-# define INT32_MAX 2147483647
-# define UINT32_MAX 4294967295U
-
-# if defined GL_INT64_T && ! defined INT64_MAX
-/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
- evaluates the latter incorrectly in preprocessor expressions. */
-# define INT64_MIN (- INTMAX_C (1) << 63)
-# define INT64_MAX INTMAX_C (9223372036854775807)
-# endif
-
-# if defined GL_UINT64_T && ! defined UINT64_MAX
-# define UINT64_MAX UINTMAX_C (18446744073709551615)
-# endif
-
-/* 7.18.2.2. Limits of minimum-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
- types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
- are the same as the corresponding N_t types. */
-
-# undef INT_LEAST8_MIN
-# undef INT_LEAST8_MAX
-# undef UINT_LEAST8_MAX
-# define INT_LEAST8_MIN INT8_MIN
-# define INT_LEAST8_MAX INT8_MAX
-# define UINT_LEAST8_MAX UINT8_MAX
-
-# undef INT_LEAST16_MIN
-# undef INT_LEAST16_MAX
-# undef UINT_LEAST16_MAX
-# define INT_LEAST16_MIN INT16_MIN
-# define INT_LEAST16_MAX INT16_MAX
-# define UINT_LEAST16_MAX UINT16_MAX
-
-# undef INT_LEAST32_MIN
-# undef INT_LEAST32_MAX
-# undef UINT_LEAST32_MAX
-# define INT_LEAST32_MIN INT32_MIN
-# define INT_LEAST32_MAX INT32_MAX
-# define UINT_LEAST32_MAX UINT32_MAX
-
-# undef INT_LEAST64_MIN
-# undef INT_LEAST64_MAX
-# ifdef GL_INT64_T
-# define INT_LEAST64_MIN INT64_MIN
-# define INT_LEAST64_MAX INT64_MAX
-# endif
-
-# undef UINT_LEAST64_MAX
-# ifdef GL_UINT64_T
-# define UINT_LEAST64_MAX UINT64_MAX
-# endif
-
-/* 7.18.2.3. Limits of fastest minimum-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
- types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
- are taken from the same list of types. */
-
-# undef INT_FAST8_MIN
-# undef INT_FAST8_MAX
-# undef UINT_FAST8_MAX
-# define INT_FAST8_MIN SCHAR_MIN
-# define INT_FAST8_MAX SCHAR_MAX
-# define UINT_FAST8_MAX UCHAR_MAX
-
-# undef INT_FAST16_MIN
-# undef INT_FAST16_MAX
-# undef UINT_FAST16_MAX
-# define INT_FAST16_MIN INT_FAST32_MIN
-# define INT_FAST16_MAX INT_FAST32_MAX
-# define UINT_FAST16_MAX UINT_FAST32_MAX
-
-# undef INT_FAST32_MIN
-# undef INT_FAST32_MAX
-# undef UINT_FAST32_MAX
-# ifdef __sun
-# define INT_FAST32_MIN INT_MIN
-# define INT_FAST32_MAX INT_MAX
-# define UINT_FAST32_MAX UINT_MAX
-# else
-# define INT_FAST32_MIN LONG_MIN
-# define INT_FAST32_MAX LONG_MAX
-# define UINT_FAST32_MAX ULONG_MAX
-# endif
-
-# undef INT_FAST64_MIN
-# undef INT_FAST64_MAX
-# ifdef GL_INT64_T
-# define INT_FAST64_MIN INT64_MIN
-# define INT_FAST64_MAX INT64_MAX
-# endif
-
-# undef UINT_FAST64_MAX
-# ifdef GL_UINT64_T
-# define UINT_FAST64_MAX UINT64_MAX
-# endif
-
-/* 7.18.2.4. Limits of integer types capable of holding object pointers */
-
-# undef INTPTR_MIN
-# undef INTPTR_MAX
-# undef UINTPTR_MAX
-# define INTPTR_MIN LONG_MIN
-# define INTPTR_MAX LONG_MAX
-# define UINTPTR_MAX ULONG_MAX
-
-/* 7.18.2.5. Limits of greatest-width integer types */
-
-# ifndef INTMAX_MAX
-# undef INTMAX_MIN
-# ifdef INT64_MAX
-# define INTMAX_MIN INT64_MIN
-# define INTMAX_MAX INT64_MAX
-# else
-# define INTMAX_MIN INT32_MIN
-# define INTMAX_MAX INT32_MAX
-# endif
-# endif
-
-# ifndef UINTMAX_MAX
-# ifdef UINT64_MAX
-# define UINTMAX_MAX UINT64_MAX
-# else
-# define UINTMAX_MAX UINT32_MAX
-# endif
-# endif
-
-/* 7.18.3. Limits of other integer types */
-
-/* ptrdiff_t limits */
-# undef PTRDIFF_MIN
-# undef PTRDIFF_MAX
-# if @APPLE_UNIVERSAL_BUILD@
-# ifdef _LP64
-# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l)
-# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l)
-# else
-# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0)
-# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0)
-# endif
-# else
-# define PTRDIFF_MIN \
- _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
-# define PTRDIFF_MAX \
- _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
-# endif
-
-/* sig_atomic_t limits */
-# undef SIG_ATOMIC_MIN
-# undef SIG_ATOMIC_MAX
-# define SIG_ATOMIC_MIN \
- _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
- 0@SIG_ATOMIC_T_SUFFIX@)
-# define SIG_ATOMIC_MAX \
- _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
- 0@SIG_ATOMIC_T_SUFFIX@)
-
-
-/* size_t limit */
-# undef SIZE_MAX
-# if @APPLE_UNIVERSAL_BUILD@
-# ifdef _LP64
-# define SIZE_MAX _STDINT_MAX (0, 64, 0ul)
-# else
-# define SIZE_MAX _STDINT_MAX (0, 32, 0ul)
-# endif
-# else
-# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
-# endif
-
-/* wchar_t limits */
-/* Get WCHAR_MIN, WCHAR_MAX.
- This include is not on the top, above, because on OSF/1 4.0 we have a
- sequence of nested includes
- <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
- <stdint.h> and assumes its types are already defined. */
-# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
- /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
- included before <wchar.h>. */
-# include <stddef.h>
-# include <stdio.h>
-# include <time.h>
-# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
-# include <wchar.h>
-# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
-# endif
-# undef WCHAR_MIN
-# undef WCHAR_MAX
-# define WCHAR_MIN \
- _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
-# define WCHAR_MAX \
- _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
-
-/* wint_t limits */
-# undef WINT_MIN
-# undef WINT_MAX
-# define WINT_MIN \
- _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
-# define WINT_MAX \
- _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
-
-/* 7.18.4. Macros for integer constants */
-
-/* 7.18.4.1. Macros for minimum-width integer constants */
-/* According to ISO C 99 Technical Corrigendum 1 */
-
-/* Here we assume a standard architecture where the hardware integer
- types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */
-
-# undef INT8_C
-# undef UINT8_C
-# define INT8_C(x) x
-# define UINT8_C(x) x
-
-# undef INT16_C
-# undef UINT16_C
-# define INT16_C(x) x
-# define UINT16_C(x) x
-
-# undef INT32_C
-# undef UINT32_C
-# define INT32_C(x) x
-# define UINT32_C(x) x ## U
-
-# undef INT64_C
-# undef UINT64_C
-# if LONG_MAX >> 31 >> 31 == 1
-# define INT64_C(x) x##L
-# elif defined _MSC_VER
-# define INT64_C(x) x##i64
-# elif @HAVE_LONG_LONG_INT@
-# define INT64_C(x) x##LL
-# endif
-# if ULONG_MAX >> 31 >> 31 >> 1 == 1
-# define UINT64_C(x) x##UL
-# elif defined _MSC_VER
-# define UINT64_C(x) x##ui64
-# elif @HAVE_UNSIGNED_LONG_LONG_INT@
-# define UINT64_C(x) x##ULL
-# endif
-
-/* 7.18.4.2. Macros for greatest-width integer constants */
-
-# ifndef INTMAX_C
-# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-# define INTMAX_C(x) x##LL
-# elif defined GL_INT64_T
-# define INTMAX_C(x) INT64_C(x)
-# else
-# define INTMAX_C(x) x##L
-# endif
-# endif
-
-# ifndef UINTMAX_C
-# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-# define UINTMAX_C(x) x##ULL
-# elif defined GL_UINT64_T
-# define UINTMAX_C(x) UINT64_C(x)
-# else
-# define UINTMAX_C(x) x##UL
-# endif
-# endif
-
-#endif /* !@HAVE_C99_STDINT_H@ */
-
-/* Macros specified by ISO/IEC TS 18661-1:2014. */
-
-#if (!defined UINTMAX_WIDTH \
- && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))
-# ifdef INT8_MAX
-# define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX)
-# endif
-# ifdef UINT8_MAX
-# define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX)
-# endif
-# ifdef INT16_MAX
-# define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX)
-# endif
-# ifdef UINT16_MAX
-# define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX)
-# endif
-# ifdef INT32_MAX
-# define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX)
-# endif
-# ifdef UINT32_MAX
-# define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX)
-# endif
-# ifdef INT64_MAX
-# define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX)
-# endif
-# ifdef UINT64_MAX
-# define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX)
-# endif
-# define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX)
-# define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX)
-# define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX)
-# define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX)
-# define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX)
-# define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX)
-# define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX)
-# define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX)
-# define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX)
-# define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX)
-# define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX)
-# define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX)
-# define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX)
-# define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX)
-# define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX)
-# define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX)
-# define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX)
-# define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX)
-# define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX)
-# define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX)
-# define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX)
-# define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX)
-# define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX)
-# ifdef WINT_MAX
-# define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX)
-# endif
-# ifdef SIG_ATOMIC_MAX
-# define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX)
-# endif
-#endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */
-
-#endif /* _@GUARD_PREFIX@_STDINT_H */
-#endif /* !(defined __ANDROID__ && ...) */
-#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
diff --git a/src/gl/stdio-impl.h b/src/gl/stdio-impl.h
deleted file mode 100644
index 987897a92f..0000000000
--- a/src/gl/stdio-impl.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Implementation details of FILE streams.
- Copyright (C) 2007-2008, 2010-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Many stdio implementations have the same logic and therefore can share
- the same implementation of stdio extension API, except that some fields
- have different naming conventions, or their access requires some casts. */
-
-
-/* BSD stdio derived implementations. */
-
-#if defined __NetBSD__ /* NetBSD */
-/* Get __NetBSD_Version__. */
-# include <sys/param.h>
-#endif
-
-#include <errno.h> /* For detecting Plan9. */
-
-#if defined __sferror || defined __DragonFly__ || defined __ANDROID__
- /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
-
-# if defined __DragonFly__ /* DragonFly */
- /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
-# define fp_ ((struct { struct __FILE_public pub; \
- struct { unsigned char *_base; int _size; } _bf; \
- void *cookie; \
- void *_close; \
- void *_read; \
- void *_seek; \
- void *_write; \
- struct { unsigned char *_base; int _size; } _ub; \
- int _ur; \
- unsigned char _ubuf[3]; \
- unsigned char _nbuf[1]; \
- struct { unsigned char *_base; int _size; } _lb; \
- int _blksize; \
- fpos_t _offset; \
- /* More fields, not relevant here. */ \
- } *) fp)
- /* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
-# define _p pub._p
-# define _flags pub._flags
-# define _r pub._r
-# define _w pub._w
-# else
-# define fp_ fp
-# endif
-
-# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Android */
- /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
- and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
- struct __sfileext
- {
- struct __sbuf _ub; /* ungetc buffer */
- /* More fields, not relevant here. */
- };
-# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
-# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin, Android */
-# define fp_ub fp_->_ub
-# endif
-
-# define HASUB(fp) (fp_ub._base != NULL)
-
-#endif
-
-
-/* SystemV derived implementations. */
-
-#ifdef __TANDEM /* NonStop Kernel */
-# ifndef _IOERR
-/* These values were determined by the program 'stdioext-flags' at
- <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */
-# define _IOERR 0x40
-# define _IOREAD 0x80
-# define _IOWRT 0x4
-# define _IORW 0x100
-# endif
-#endif
-
-#if defined _IOERR
-
-# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
-# define fp_ ((struct { unsigned char *_ptr; \
- unsigned char *_base; \
- unsigned char *_end; \
- long _cnt; \
- int _file; \
- unsigned int _flag; \
- } *) fp)
-# else
-# define fp_ fp
-# endif
-
-# if defined _SCO_DS /* OpenServer */
-# define _cnt __cnt
-# define _ptr __ptr
-# define _base __base
-# define _flag __flag
-# endif
-
-#endif
diff --git a/src/gl/stdio.in.h b/src/gl/stdio.in.h
deleted file mode 100644
index 9b313656c5..0000000000
--- a/src/gl/stdio.in.h
+++ /dev/null
@@ -1,1357 +0,0 @@
-/* A GNU-like <stdio.h>.
-
- Copyright (C) 2004, 2007-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H
-/* Special invocation convention:
- - Inside glibc header files.
- - On OSF/1 5.1 we have a sequence of nested includes
- <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
- <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
- In this situation, the functions are not yet declared, therefore we cannot
- provide the C++ aliases. */
-
-#@INCLUDE_NEXT@ @NEXT_STDIO_H@
-
-#else
-/* Normal invocation convention. */
-
-#ifndef _@GUARD_PREFIX@_STDIO_H
-
-#define _GL_ALREADY_INCLUDING_STDIO_H
-
-/* The include_next requires a split double-inclusion guard. */
-#@INCLUDE_NEXT@ @NEXT_STDIO_H@
-
-#undef _GL_ALREADY_INCLUDING_STDIO_H
-
-#ifndef _@GUARD_PREFIX@_STDIO_H
-#define _@GUARD_PREFIX@_STDIO_H
-
-/* Get va_list. Needed on many systems, including glibc 2.8. */
-#include <stdarg.h>
-
-#include <stddef.h>
-
-/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
- and eglibc 2.11.2.
- May also define off_t to a 64-bit type on native Windows. */
-#include <sys/types.h>
-
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
- The __-protected variants of the attributes 'format' and 'printf' are
- accepted by gcc versions 2.6.4 (effectively 2.7) and later.
- We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
- gnulib and libintl do '#define printf __printf__' when they override
- the 'printf' function. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
-/* _GL_ATTRIBUTE_FORMAT_PRINTF
- indicates to GCC that the function takes a format string and arguments,
- where the format string directives are the ones standardized by ISO C99
- and POSIX. */
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
-# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
- _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
-#else
-# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
- _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
-#endif
-
-/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF,
- except that it indicates to GCC that the supported format string directives
- are the ones of the system printf(), rather than the ones standardized by
- ISO C99 and POSIX. */
-#if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
-# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
- _GL_ATTRIBUTE_FORMAT_PRINTF (formatstring_parameter, first_argument)
-#else
-# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
- _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
-#endif
-
-/* _GL_ATTRIBUTE_FORMAT_SCANF
- indicates to GCC that the function takes a format string and arguments,
- where the format string directives are the ones standardized by ISO C99
- and POSIX. */
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
-# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
- _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument))
-#else
-# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
- _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
-#endif
-
-/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF,
- except that it indicates to GCC that the supported format string directives
- are the ones of the system scanf(), rather than the ones standardized by
- ISO C99 and POSIX. */
-#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
- _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
-
-/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */
-/* But in any case avoid namespace pollution on glibc systems. */
-#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
- && ! defined __GLIBC__
-# include <unistd.h>
-#endif
-
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-/* Macros for stringification. */
-#define _GL_STDIO_STRINGIZE(token) #token
-#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
-
-/* When also using extern inline, suppress the use of static inline in
- standard headers of problematic Apple configurations, as Libc at
- least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
- <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
- Perhaps Apple will fix this some day. */
-#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
- && defined __GNUC__ && defined __STDC__)
-# undef putc_unlocked
-#endif
-
-#if @GNULIB_DPRINTF@
-# if @REPLACE_DPRINTF@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define dprintf rpl_dprintf
-# endif
-_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
-# else
-# if !@HAVE_DPRINTF@
-_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (dprintf);
-#elif defined GNULIB_POSIXCHECK
-# undef dprintf
-# if HAVE_RAW_DECL_DPRINTF
-_GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
- "use gnulib module dprintf for portability");
-# endif
-#endif
-
-#if @GNULIB_FCLOSE@
-/* Close STREAM and its underlying file descriptor. */
-# if @REPLACE_FCLOSE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define fclose rpl_fclose
-# endif
-_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
-# endif
-_GL_CXXALIASWARN (fclose);
-#elif defined GNULIB_POSIXCHECK
-# undef fclose
-/* Assume fclose is always declared. */
-_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
- "use gnulib module fclose for portable POSIX compliance");
-#endif
-
-#if @GNULIB_FDOPEN@
-# if @REPLACE_FDOPEN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fdopen
-# define fdopen rpl_fdopen
-# endif
-_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
-# else
-_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
-# endif
-_GL_CXXALIASWARN (fdopen);
-#elif defined GNULIB_POSIXCHECK
-# undef fdopen
-/* Assume fdopen is always declared. */
-_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
- "use gnulib module fdopen for portability");
-#endif
-
-#if @GNULIB_FFLUSH@
-/* Flush all pending data on STREAM according to POSIX rules. Both
- output and seekable input streams are supported.
- Note! LOSS OF DATA can occur if fflush is applied on an input stream
- that is _not_seekable_ or on an update stream that is _not_seekable_
- and in which the most recent operation was input. Seekability can
- be tested with lseek(fileno(fp),0,SEEK_CUR). */
-# if @REPLACE_FFLUSH@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define fflush rpl_fflush
-# endif
-_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
-_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
-# else
-_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
-# endif
-_GL_CXXALIASWARN (fflush);
-#elif defined GNULIB_POSIXCHECK
-# undef fflush
-/* Assume fflush is always declared. */
-_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
- "use gnulib module fflush for portable POSIX compliance");
-#endif
-
-#if @GNULIB_FGETC@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fgetc
-# define fgetc rpl_fgetc
-# endif
-_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
-# endif
-_GL_CXXALIASWARN (fgetc);
-#endif
-
-#if @GNULIB_FGETS@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fgets
-# define fgets rpl_fgets
-# endif
-_GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream)
- _GL_ARG_NONNULL ((1, 3)));
-_GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
-# endif
-_GL_CXXALIASWARN (fgets);
-#endif
-
-#if @GNULIB_FOPEN@
-# if @REPLACE_FOPEN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fopen
-# define fopen rpl_fopen
-# endif
-_GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
-# else
-_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
-# endif
-_GL_CXXALIASWARN (fopen);
-#elif defined GNULIB_POSIXCHECK
-# undef fopen
-/* Assume fopen is always declared. */
-_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - "
- "use gnulib module fopen for portability");
-#endif
-
-#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
-# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
- || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define fprintf rpl_fprintf
-# endif
-# define GNULIB_overrides_fprintf 1
-# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
-_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
-# else
-_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
-# else
-_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (fprintf);
-#endif
-#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
-# if !GNULIB_overrides_fprintf
-# undef fprintf
-# endif
-/* Assume fprintf is always declared. */
-_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
- "use gnulib module fprintf-posix for portable "
- "POSIX compliance");
-#endif
-
-#if @GNULIB_FPURGE@
-/* Discard all pending buffered I/O data on STREAM.
- STREAM must not be wide-character oriented.
- When discarding pending output, the file position is set back to where it
- was before the write calls. When discarding pending input, the file
- position is advanced to match the end of the previously read input.
- Return 0 if successful. Upon error, return -1 and set errno. */
-# if @REPLACE_FPURGE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define fpurge rpl_fpurge
-# endif
-_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
-# else
-# if !@HAVE_DECL_FPURGE@
-_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
-# endif
-_GL_CXXALIASWARN (fpurge);
-#elif defined GNULIB_POSIXCHECK
-# undef fpurge
-# if HAVE_RAW_DECL_FPURGE
-_GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
- "use gnulib module fpurge for portability");
-# endif
-#endif
-
-#if @GNULIB_FPUTC@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fputc
-# define fputc rpl_fputc
-# endif
-_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
-# endif
-_GL_CXXALIASWARN (fputc);
-#endif
-
-#if @GNULIB_FPUTS@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fputs
-# define fputs rpl_fputs
-# endif
-_GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
-# endif
-_GL_CXXALIASWARN (fputs);
-#endif
-
-#if @GNULIB_FREAD@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fread
-# define fread rpl_fread
-# endif
-_GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)
- _GL_ARG_NONNULL ((4)));
-_GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
-# endif
-_GL_CXXALIASWARN (fread);
-#endif
-
-#if @GNULIB_FREOPEN@
-# if @REPLACE_FREOPEN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef freopen
-# define freopen rpl_freopen
-# endif
-_GL_FUNCDECL_RPL (freopen, FILE *,
- (const char *filename, const char *mode, FILE *stream)
- _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (freopen, FILE *,
- (const char *filename, const char *mode, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (freopen, FILE *,
- (const char *filename, const char *mode, FILE *stream));
-# endif
-_GL_CXXALIASWARN (freopen);
-#elif defined GNULIB_POSIXCHECK
-# undef freopen
-/* Assume freopen is always declared. */
-_GL_WARN_ON_USE (freopen,
- "freopen on native Windows platforms is not POSIX compliant - "
- "use gnulib module freopen for portability");
-#endif
-
-#if @GNULIB_FSCANF@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fscanf
-# define fscanf rpl_fscanf
-# endif
-_GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
-# else
-_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (fscanf);
-#endif
-
-
-/* Set up the following warnings, based on which modules are in use.
- GNU Coding Standards discourage the use of fseek, since it imposes
- an arbitrary limitation on some 32-bit hosts. Remember that the
- fseek module depends on the fseeko module, so we only have three
- cases to consider:
-
- 1. The developer is not using either module. Issue a warning under
- GNULIB_POSIXCHECK for both functions, to remind them that both
- functions have bugs on some systems. _GL_NO_LARGE_FILES has no
- impact on this warning.
-
- 2. The developer is using both modules. They may be unaware of the
- arbitrary limitations of fseek, so issue a warning under
- GNULIB_POSIXCHECK. On the other hand, they may be using both
- modules intentionally, so the developer can define
- _GL_NO_LARGE_FILES in the compilation units where the use of fseek
- is safe, to silence the warning.
-
- 3. The developer is using the fseeko module, but not fseek. Gnulib
- guarantees that fseek will still work around platform bugs in that
- case, but we presume that the developer is aware of the pitfalls of
- fseek and was trying to avoid it, so issue a warning even when
- GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be
- defined to silence the warning in particular compilation units.
- In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
- fseek gets defined as a macro, it is recommended that the developer
- uses the fseek module, even if he is not calling the fseek function.
-
- Most gnulib clients that perform stream operations should fall into
- category 3. */
-
-#if @GNULIB_FSEEK@
-# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
-# define _GL_FSEEK_WARN /* Category 2, above. */
-# undef fseek
-# endif
-# if @REPLACE_FSEEK@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fseek
-# define fseek rpl_fseek
-# endif
-_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
-# else
-_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
-# endif
-_GL_CXXALIASWARN (fseek);
-#endif
-
-#if @GNULIB_FSEEKO@
-# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
-# define _GL_FSEEK_WARN /* Category 3, above. */
-# undef fseek
-# endif
-# if @REPLACE_FSEEKO@
-/* Provide an fseeko function that is aware of a preceding fflush(), and which
- detects pipes. */
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fseeko
-# define fseeko rpl_fseeko
-# endif
-_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
-# else
-# if ! @HAVE_DECL_FSEEKO@
-_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
-# endif
-_GL_CXXALIASWARN (fseeko);
-#elif defined GNULIB_POSIXCHECK
-# define _GL_FSEEK_WARN /* Category 1, above. */
-# undef fseek
-# undef fseeko
-# if HAVE_RAW_DECL_FSEEKO
-_GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
- "use gnulib module fseeko for portability");
-# endif
-#endif
-
-#ifdef _GL_FSEEK_WARN
-# undef _GL_FSEEK_WARN
-/* Here, either fseek is undefined (but C89 guarantees that it is
- declared), or it is defined as rpl_fseek (declared above). */
-_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
- "on 32-bit platforms - "
- "use fseeko function for handling of large files");
-#endif
-
-
-/* ftell, ftello. See the comments on fseek/fseeko. */
-
-#if @GNULIB_FTELL@
-# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
-# define _GL_FTELL_WARN /* Category 2, above. */
-# undef ftell
-# endif
-# if @REPLACE_FTELL@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef ftell
-# define ftell rpl_ftell
-# endif
-_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
-# else
-_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
-# endif
-_GL_CXXALIASWARN (ftell);
-#endif
-
-#if @GNULIB_FTELLO@
-# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
-# define _GL_FTELL_WARN /* Category 3, above. */
-# undef ftell
-# endif
-# if @REPLACE_FTELLO@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef ftello
-# define ftello rpl_ftello
-# endif
-_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
-# else
-# if ! @HAVE_DECL_FTELLO@
-_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
-# endif
-_GL_CXXALIASWARN (ftello);
-#elif defined GNULIB_POSIXCHECK
-# define _GL_FTELL_WARN /* Category 1, above. */
-# undef ftell
-# undef ftello
-# if HAVE_RAW_DECL_FTELLO
-_GL_WARN_ON_USE (ftello, "ftello is unportable - "
- "use gnulib module ftello for portability");
-# endif
-#endif
-
-#ifdef _GL_FTELL_WARN
-# undef _GL_FTELL_WARN
-/* Here, either ftell is undefined (but C89 guarantees that it is
- declared), or it is defined as rpl_ftell (declared above). */
-_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
- "on 32-bit platforms - "
- "use ftello function for handling of large files");
-#endif
-
-
-#if @GNULIB_FWRITE@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fwrite
-# define fwrite rpl_fwrite
-# endif
-_GL_FUNCDECL_RPL (fwrite, size_t,
- (const void *ptr, size_t s, size_t n, FILE *stream)
- _GL_ARG_NONNULL ((1, 4)));
-_GL_CXXALIAS_RPL (fwrite, size_t,
- (const void *ptr, size_t s, size_t n, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fwrite, size_t,
- (const void *ptr, size_t s, size_t n, FILE *stream));
-
-/* Work around bug 11959 when fortifying glibc 2.4 through 2.15
- <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
- which sometimes causes an unwanted diagnostic for fwrite calls.
- This affects only function declaration attributes under certain
- versions of gcc and clang, and is not needed for C++. */
-# if (0 < __USE_FORTIFY_LEVEL \
- && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
- && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \
- && !defined __cplusplus)
-# undef fwrite
-# undef fwrite_unlocked
-extern size_t __REDIRECT (rpl_fwrite,
- (const void *__restrict, size_t, size_t,
- FILE *__restrict),
- fwrite);
-extern size_t __REDIRECT (rpl_fwrite_unlocked,
- (const void *__restrict, size_t, size_t,
- FILE *__restrict),
- fwrite_unlocked);
-# define fwrite rpl_fwrite
-# define fwrite_unlocked rpl_fwrite_unlocked
-# endif
-# endif
-_GL_CXXALIASWARN (fwrite);
-#endif
-
-#if @GNULIB_GETC@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef getc
-# define getc rpl_fgetc
-# endif
-_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
-# else
-_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
-# endif
-_GL_CXXALIASWARN (getc);
-#endif
-
-#if @GNULIB_GETCHAR@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef getchar
-# define getchar rpl_getchar
-# endif
-_GL_FUNCDECL_RPL (getchar, int, (void));
-_GL_CXXALIAS_RPL (getchar, int, (void));
-# else
-_GL_CXXALIAS_SYS (getchar, int, (void));
-# endif
-_GL_CXXALIASWARN (getchar);
-#endif
-
-#if @GNULIB_GETDELIM@
-/* Read input, up to (and including) the next occurrence of DELIMITER, from
- STREAM, store it in *LINEPTR (and NUL-terminate it).
- *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
- bytes of space. It is realloc'd as necessary.
- Return the number of bytes read and stored at *LINEPTR (not including the
- NUL terminator), or -1 on error or EOF. */
-# if @REPLACE_GETDELIM@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef getdelim
-# define getdelim rpl_getdelim
-# endif
-_GL_FUNCDECL_RPL (getdelim, ssize_t,
- (char **lineptr, size_t *linesize, int delimiter,
- FILE *stream)
- _GL_ARG_NONNULL ((1, 2, 4)));
-_GL_CXXALIAS_RPL (getdelim, ssize_t,
- (char **lineptr, size_t *linesize, int delimiter,
- FILE *stream));
-# else
-# if !@HAVE_DECL_GETDELIM@
-_GL_FUNCDECL_SYS (getdelim, ssize_t,
- (char **lineptr, size_t *linesize, int delimiter,
- FILE *stream)
- _GL_ARG_NONNULL ((1, 2, 4)));
-# endif
-_GL_CXXALIAS_SYS (getdelim, ssize_t,
- (char **lineptr, size_t *linesize, int delimiter,
- FILE *stream));
-# endif
-_GL_CXXALIASWARN (getdelim);
-#elif defined GNULIB_POSIXCHECK
-# undef getdelim
-# if HAVE_RAW_DECL_GETDELIM
-_GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
- "use gnulib module getdelim for portability");
-# endif
-#endif
-
-#if @GNULIB_GETLINE@
-/* Read a line, up to (and including) the next newline, from STREAM, store it
- in *LINEPTR (and NUL-terminate it).
- *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
- bytes of space. It is realloc'd as necessary.
- Return the number of bytes read and stored at *LINEPTR (not including the
- NUL terminator), or -1 on error or EOF. */
-# if @REPLACE_GETLINE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef getline
-# define getline rpl_getline
-# endif
-_GL_FUNCDECL_RPL (getline, ssize_t,
- (char **lineptr, size_t *linesize, FILE *stream)
- _GL_ARG_NONNULL ((1, 2, 3)));
-_GL_CXXALIAS_RPL (getline, ssize_t,
- (char **lineptr, size_t *linesize, FILE *stream));
-# else
-# if !@HAVE_DECL_GETLINE@
-_GL_FUNCDECL_SYS (getline, ssize_t,
- (char **lineptr, size_t *linesize, FILE *stream)
- _GL_ARG_NONNULL ((1, 2, 3)));
-# endif
-_GL_CXXALIAS_SYS (getline, ssize_t,
- (char **lineptr, size_t *linesize, FILE *stream));
-# endif
-# if @HAVE_DECL_GETLINE@
-_GL_CXXALIASWARN (getline);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef getline
-# if HAVE_RAW_DECL_GETLINE
-_GL_WARN_ON_USE (getline, "getline is unportable - "
- "use gnulib module getline for portability");
-# endif
-#endif
-
-/* It is very rare that the developer ever has full control of stdin,
- so any use of gets warrants an unconditional warning; besides, C11
- removed it. */
-#undef gets
-#if HAVE_RAW_DECL_GETS && !defined __cplusplus
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
-#endif
-
-#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
-struct obstack;
-/* Grow an obstack with formatted output. Return the number of
- bytes added to OBS. No trailing nul byte is added, and the
- object should be closed with obstack_finish before use. Upon
- memory allocation error, call obstack_alloc_failed_handler. Upon
- other error, return -1. */
-# if @REPLACE_OBSTACK_PRINTF@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define obstack_printf rpl_obstack_printf
-# endif
-_GL_FUNCDECL_RPL (obstack_printf, int,
- (struct obstack *obs, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (obstack_printf, int,
- (struct obstack *obs, const char *format, ...));
-# else
-# if !@HAVE_DECL_OBSTACK_PRINTF@
-_GL_FUNCDECL_SYS (obstack_printf, int,
- (struct obstack *obs, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (obstack_printf, int,
- (struct obstack *obs, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (obstack_printf);
-# if @REPLACE_OBSTACK_PRINTF@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define obstack_vprintf rpl_obstack_vprintf
-# endif
-_GL_FUNCDECL_RPL (obstack_vprintf, int,
- (struct obstack *obs, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (obstack_vprintf, int,
- (struct obstack *obs, const char *format, va_list args));
-# else
-# if !@HAVE_DECL_OBSTACK_PRINTF@
-_GL_FUNCDECL_SYS (obstack_vprintf, int,
- (struct obstack *obs, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (obstack_vprintf, int,
- (struct obstack *obs, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (obstack_vprintf);
-#endif
-
-#if @GNULIB_PCLOSE@
-# if !@HAVE_PCLOSE@
-_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
-_GL_CXXALIASWARN (pclose);
-#elif defined GNULIB_POSIXCHECK
-# undef pclose
-# if HAVE_RAW_DECL_PCLOSE
-_GL_WARN_ON_USE (pclose, "pclose is unportable - "
- "use gnulib module pclose for more portability");
-# endif
-#endif
-
-#if @GNULIB_PERROR@
-/* Print a message to standard error, describing the value of ERRNO,
- (if STRING is not NULL and not empty) prefixed with STRING and ": ",
- and terminated with a newline. */
-# if @REPLACE_PERROR@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define perror rpl_perror
-# endif
-_GL_FUNCDECL_RPL (perror, void, (const char *string));
-_GL_CXXALIAS_RPL (perror, void, (const char *string));
-# else
-_GL_CXXALIAS_SYS (perror, void, (const char *string));
-# endif
-_GL_CXXALIASWARN (perror);
-#elif defined GNULIB_POSIXCHECK
-# undef perror
-/* Assume perror is always declared. */
-_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
- "use gnulib module perror for portability");
-#endif
-
-#if @GNULIB_POPEN@
-# if @REPLACE_POPEN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef popen
-# define popen rpl_popen
-# endif
-_GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
-# else
-# if !@HAVE_POPEN@
-_GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
-# endif
-_GL_CXXALIASWARN (popen);
-#elif defined GNULIB_POSIXCHECK
-# undef popen
-# if HAVE_RAW_DECL_POPEN
-_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
- "use gnulib module popen or pipe for more portability");
-# endif
-#endif
-
-#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
-# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
- || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
-# if defined __GNUC__
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-/* Don't break __attribute__((format(printf,M,N))). */
-# define printf __printf__
-# endif
-# if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
-_GL_FUNCDECL_RPL_1 (__printf__, int,
- (const char *format, ...)
- __asm__ (@ASM_SYMBOL_PREFIX@
- _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
- _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
- _GL_ARG_NONNULL ((1)));
-# else
-_GL_FUNCDECL_RPL_1 (__printf__, int,
- (const char *format, ...)
- __asm__ (@ASM_SYMBOL_PREFIX@
- _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
- _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
-# else
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define printf rpl_printf
-# endif
-_GL_FUNCDECL_RPL (printf, int,
- (const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
-# endif
-# define GNULIB_overrides_printf 1
-# else
-_GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
-# endif
-_GL_CXXALIASWARN (printf);
-#endif
-#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
-# if !GNULIB_overrides_printf
-# undef printf
-# endif
-/* Assume printf is always declared. */
-_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
- "use gnulib module printf-posix for portable "
- "POSIX compliance");
-#endif
-
-#if @GNULIB_PUTC@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef putc
-# define putc rpl_fputc
-# endif
-_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
-# endif
-_GL_CXXALIASWARN (putc);
-#endif
-
-#if @GNULIB_PUTCHAR@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef putchar
-# define putchar rpl_putchar
-# endif
-_GL_FUNCDECL_RPL (putchar, int, (int c));
-_GL_CXXALIAS_RPL (putchar, int, (int c));
-# else
-_GL_CXXALIAS_SYS (putchar, int, (int c));
-# endif
-_GL_CXXALIASWARN (putchar);
-#endif
-
-#if @GNULIB_PUTS@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef puts
-# define puts rpl_puts
-# endif
-_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (puts, int, (const char *string));
-# else
-_GL_CXXALIAS_SYS (puts, int, (const char *string));
-# endif
-_GL_CXXALIASWARN (puts);
-#endif
-
-#if @GNULIB_REMOVE@
-# if @REPLACE_REMOVE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef remove
-# define remove rpl_remove
-# endif
-_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (remove, int, (const char *name));
-# else
-_GL_CXXALIAS_SYS (remove, int, (const char *name));
-# endif
-_GL_CXXALIASWARN (remove);
-#elif defined GNULIB_POSIXCHECK
-# undef remove
-/* Assume remove is always declared. */
-_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
- "use gnulib module remove for more portability");
-#endif
-
-#if @GNULIB_RENAME@
-# if @REPLACE_RENAME@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef rename
-# define rename rpl_rename
-# endif
-_GL_FUNCDECL_RPL (rename, int,
- (const char *old_filename, const char *new_filename)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (rename, int,
- (const char *old_filename, const char *new_filename));
-# else
-_GL_CXXALIAS_SYS (rename, int,
- (const char *old_filename, const char *new_filename));
-# endif
-_GL_CXXALIASWARN (rename);
-#elif defined GNULIB_POSIXCHECK
-# undef rename
-/* Assume rename is always declared. */
-_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
- "use gnulib module rename for more portability");
-#endif
-
-#if @GNULIB_RENAMEAT@
-# if @REPLACE_RENAMEAT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef renameat
-# define renameat rpl_renameat
-# endif
-_GL_FUNCDECL_RPL (renameat, int,
- (int fd1, char const *file1, int fd2, char const *file2)
- _GL_ARG_NONNULL ((2, 4)));
-_GL_CXXALIAS_RPL (renameat, int,
- (int fd1, char const *file1, int fd2, char const *file2));
-# else
-# if !@HAVE_RENAMEAT@
-_GL_FUNCDECL_SYS (renameat, int,
- (int fd1, char const *file1, int fd2, char const *file2)
- _GL_ARG_NONNULL ((2, 4)));
-# endif
-_GL_CXXALIAS_SYS (renameat, int,
- (int fd1, char const *file1, int fd2, char const *file2));
-# endif
-_GL_CXXALIASWARN (renameat);
-#elif defined GNULIB_POSIXCHECK
-# undef renameat
-# if HAVE_RAW_DECL_RENAMEAT
-_GL_WARN_ON_USE (renameat, "renameat is not portable - "
- "use gnulib module renameat for portability");
-# endif
-#endif
-
-#if @GNULIB_SCANF@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-# if defined __GNUC__
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef scanf
-/* Don't break __attribute__((format(scanf,M,N))). */
-# define scanf __scanf__
-# endif
-_GL_FUNCDECL_RPL_1 (__scanf__, int,
- (const char *format, ...)
- __asm__ (@ASM_SYMBOL_PREFIX@
- _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
- _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...));
-# else
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef scanf
-# define scanf rpl_scanf
-# endif
-_GL_FUNCDECL_RPL (scanf, int, (const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
-# endif
-# else
-_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
-# endif
-_GL_CXXALIASWARN (scanf);
-#endif
-
-#if @GNULIB_SNPRINTF@
-# if @REPLACE_SNPRINTF@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define snprintf rpl_snprintf
-# endif
-_GL_FUNCDECL_RPL (snprintf, int,
- (char *str, size_t size, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
- _GL_ARG_NONNULL ((3)));
-_GL_CXXALIAS_RPL (snprintf, int,
- (char *str, size_t size, const char *format, ...));
-# else
-# if !@HAVE_DECL_SNPRINTF@
-_GL_FUNCDECL_SYS (snprintf, int,
- (char *str, size_t size, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
- _GL_ARG_NONNULL ((3)));
-# endif
-_GL_CXXALIAS_SYS (snprintf, int,
- (char *str, size_t size, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (snprintf);
-#elif defined GNULIB_POSIXCHECK
-# undef snprintf
-# if HAVE_RAW_DECL_SNPRINTF
-_GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
- "use gnulib module snprintf for portability");
-# endif
-#endif
-
-/* Some people would argue that all sprintf uses should be warned about
- (for example, OpenBSD issues a link warning for it),
- since it can cause security holes due to buffer overruns.
- However, we believe that sprintf can be used safely, and is more
- efficient than snprintf in those safe cases; and as proof of our
- belief, we use sprintf in several gnulib modules. So this header
- intentionally avoids adding a warning to sprintf except when
- GNULIB_POSIXCHECK is defined. */
-
-#if @GNULIB_SPRINTF_POSIX@
-# if @REPLACE_SPRINTF@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define sprintf rpl_sprintf
-# endif
-_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
-# else
-_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (sprintf);
-#elif defined GNULIB_POSIXCHECK
-# undef sprintf
-/* Assume sprintf is always declared. */
-_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
- "use gnulib module sprintf-posix for portable "
- "POSIX compliance");
-#endif
-
-#if @GNULIB_TMPFILE@
-# if @REPLACE_TMPFILE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define tmpfile rpl_tmpfile
-# endif
-_GL_FUNCDECL_RPL (tmpfile, FILE *, (void));
-_GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
-# else
-_GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
-# endif
-_GL_CXXALIASWARN (tmpfile);
-#elif defined GNULIB_POSIXCHECK
-# undef tmpfile
-# if HAVE_RAW_DECL_TMPFILE
-_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
- "use gnulib module tmpfile for portability");
-# endif
-#endif
-
-#if @GNULIB_VASPRINTF@
-/* Write formatted output to a string dynamically allocated with malloc().
- If the memory allocation succeeds, store the address of the string in
- *RESULT and return the number of resulting bytes, excluding the trailing
- NUL. Upon memory allocation error, or some other error, return -1. */
-# if @REPLACE_VASPRINTF@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define asprintf rpl_asprintf
-# endif
-_GL_FUNCDECL_RPL (asprintf, int,
- (char **result, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (asprintf, int,
- (char **result, const char *format, ...));
-# else
-# if !@HAVE_VASPRINTF@
-_GL_FUNCDECL_SYS (asprintf, int,
- (char **result, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (asprintf, int,
- (char **result, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (asprintf);
-# if @REPLACE_VASPRINTF@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define vasprintf rpl_vasprintf
-# endif
-_GL_FUNCDECL_RPL (vasprintf, int,
- (char **result, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (vasprintf, int,
- (char **result, const char *format, va_list args));
-# else
-# if !@HAVE_VASPRINTF@
-_GL_FUNCDECL_SYS (vasprintf, int,
- (char **result, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (vasprintf, int,
- (char **result, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vasprintf);
-#endif
-
-#if @GNULIB_VDPRINTF@
-# if @REPLACE_VDPRINTF@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define vdprintf rpl_vdprintf
-# endif
-_GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
-# else
-# if !@HAVE_VDPRINTF@
-_GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
- _GL_ARG_NONNULL ((2)));
-# endif
-/* Need to cast, because on Solaris, the third parameter will likely be
- __va_list args. */
-_GL_CXXALIAS_SYS_CAST (vdprintf, int,
- (int fd, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vdprintf);
-#elif defined GNULIB_POSIXCHECK
-# undef vdprintf
-# if HAVE_RAW_DECL_VDPRINTF
-_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
- "use gnulib module vdprintf for portability");
-# endif
-#endif
-
-#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
-# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
- || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define vfprintf rpl_vfprintf
-# endif
-# define GNULIB_overrides_vfprintf 1
-# if @GNULIB_VFPRINTF_POSIX@
-_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
-# else
-_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
-# else
-/* Need to cast, because on Solaris, the third parameter is
- __va_list args
- and GCC's fixincludes did not change this to __gnuc_va_list. */
-_GL_CXXALIAS_SYS_CAST (vfprintf, int,
- (FILE *fp, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vfprintf);
-#endif
-#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
-# if !GNULIB_overrides_vfprintf
-# undef vfprintf
-# endif
-/* Assume vfprintf is always declared. */
-_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
- "use gnulib module vfprintf-posix for portable "
- "POSIX compliance");
-#endif
-
-#if @GNULIB_VFSCANF@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef vfscanf
-# define vfscanf rpl_vfscanf
-# endif
-_GL_FUNCDECL_RPL (vfscanf, int,
- (FILE *stream, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (vfscanf, int,
- (FILE *stream, const char *format, va_list args));
-# else
-_GL_CXXALIAS_SYS (vfscanf, int,
- (FILE *stream, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vfscanf);
-#endif
-
-#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
-# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
- || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define vprintf rpl_vprintf
-# endif
-# define GNULIB_overrides_vprintf 1
-# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
-_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
- _GL_ARG_NONNULL ((1)));
-# else
-_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
-# else
-/* Need to cast, because on Solaris, the second parameter is
- __va_list args
- and GCC's fixincludes did not change this to __gnuc_va_list. */
-_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vprintf);
-#endif
-#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
-# if !GNULIB_overrides_vprintf
-# undef vprintf
-# endif
-/* Assume vprintf is always declared. */
-_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
- "use gnulib module vprintf-posix for portable "
- "POSIX compliance");
-#endif
-
-#if @GNULIB_VSCANF@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef vscanf
-# define vscanf rpl_vscanf
-# endif
-_GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args));
-# else
-_GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vscanf);
-#endif
-
-#if @GNULIB_VSNPRINTF@
-# if @REPLACE_VSNPRINTF@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define vsnprintf rpl_vsnprintf
-# endif
-_GL_FUNCDECL_RPL (vsnprintf, int,
- (char *str, size_t size, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
- _GL_ARG_NONNULL ((3)));
-_GL_CXXALIAS_RPL (vsnprintf, int,
- (char *str, size_t size, const char *format, va_list args));
-# else
-# if !@HAVE_DECL_VSNPRINTF@
-_GL_FUNCDECL_SYS (vsnprintf, int,
- (char *str, size_t size, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
- _GL_ARG_NONNULL ((3)));
-# endif
-_GL_CXXALIAS_SYS (vsnprintf, int,
- (char *str, size_t size, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vsnprintf);
-#elif defined GNULIB_POSIXCHECK
-# undef vsnprintf
-# if HAVE_RAW_DECL_VSNPRINTF
-_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
- "use gnulib module vsnprintf for portability");
-# endif
-#endif
-
-#if @GNULIB_VSPRINTF_POSIX@
-# if @REPLACE_VSPRINTF@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define vsprintf rpl_vsprintf
-# endif
-_GL_FUNCDECL_RPL (vsprintf, int,
- (char *str, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (vsprintf, int,
- (char *str, const char *format, va_list args));
-# else
-/* Need to cast, because on Solaris, the third parameter is
- __va_list args
- and GCC's fixincludes did not change this to __gnuc_va_list. */
-_GL_CXXALIAS_SYS_CAST (vsprintf, int,
- (char *str, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vsprintf);
-#elif defined GNULIB_POSIXCHECK
-# undef vsprintf
-/* Assume vsprintf is always declared. */
-_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
- "use gnulib module vsprintf-posix for portable "
- "POSIX compliance");
-#endif
-
-#endif /* _@GUARD_PREFIX@_STDIO_H */
-#endif /* _@GUARD_PREFIX@_STDIO_H */
-#endif
diff --git a/src/gl/stdlib.in.h b/src/gl/stdlib.in.h
deleted file mode 100644
index db3253bd97..0000000000
--- a/src/gl/stdlib.in.h
+++ /dev/null
@@ -1,992 +0,0 @@
-/* A GNU-like <stdlib.h>.
-
- Copyright (C) 1995, 2001-2004, 2006-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
-/* Special invocation conventions inside some gnulib header files,
- and inside some glibc header files, respectively. */
-
-#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
-
-#else
-/* Normal invocation convention. */
-
-#ifndef _@GUARD_PREFIX@_STDLIB_H
-
-/* The include_next requires a split double-inclusion guard. */
-#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
-
-#ifndef _@GUARD_PREFIX@_STDLIB_H
-#define _@GUARD_PREFIX@_STDLIB_H
-
-/* NetBSD 5.0 mis-defines NULL. */
-#include <stddef.h>
-
-/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
-#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
-# include <sys/wait.h>
-#endif
-
-/* Solaris declares getloadavg() in <sys/loadavg.h>. */
-#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
-# include <sys/loadavg.h>
-#endif
-
-/* Native Windows platforms declare mktemp() in <io.h>. */
-#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
-# include <io.h>
-#endif
-
-#if @GNULIB_RANDOM_R@
-
-/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
- from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
- 'struct random_data'. */
-# if @HAVE_RANDOM_H@
-# include <random.h>
-# endif
-
-# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
-# include <stdint.h>
-# endif
-
-# if !@HAVE_STRUCT_RANDOM_DATA@
-/* Define 'struct random_data'.
- But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
-# if !GNULIB_defined_struct_random_data
-struct random_data
-{
- int32_t *fptr; /* Front pointer. */
- int32_t *rptr; /* Rear pointer. */
- int32_t *state; /* Array of state values. */
- int rand_type; /* Type of random number generator. */
- int rand_deg; /* Degree of random number generator. */
- int rand_sep; /* Distance between front and rear. */
- int32_t *end_ptr; /* Pointer behind state table. */
-};
-# define GNULIB_defined_struct_random_data 1
-# endif
-# endif
-#endif
-
-#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
-/* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
-/* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
-/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
-/* But avoid namespace pollution on glibc systems and native Windows. */
-# include <unistd.h>
-#endif
-
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
- The attribute __pure__ was added in gcc 2.96. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define _GL_ATTRIBUTE_PURE /* empty */
-#endif
-
-/* The definition of _Noreturn is copied here. */
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-
-/* Some systems do not define EXIT_*, despite otherwise supporting C89. */
-#ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-#endif
-/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
- with proper operation of xargs. */
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#elif EXIT_FAILURE != 1
-# undef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
-
-#if @GNULIB__EXIT@
-/* Terminate the current process with the given return code, without running
- the 'atexit' handlers. */
-# if !@HAVE__EXIT@
-_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
-# endif
-_GL_CXXALIAS_SYS (_Exit, void, (int status));
-_GL_CXXALIASWARN (_Exit);
-#elif defined GNULIB_POSIXCHECK
-# undef _Exit
-# if HAVE_RAW_DECL__EXIT
-_GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
- "use gnulib module _Exit for portability");
-# endif
-#endif
-
-
-#if @GNULIB_ATOLL@
-/* Parse a signed decimal integer.
- Returns the value of the integer. Errors are not detected. */
-# if !@HAVE_ATOLL@
-_GL_FUNCDECL_SYS (atoll, long long, (const char *string)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
-_GL_CXXALIASWARN (atoll);
-#elif defined GNULIB_POSIXCHECK
-# undef atoll
-# if HAVE_RAW_DECL_ATOLL
-_GL_WARN_ON_USE (atoll, "atoll is unportable - "
- "use gnulib module atoll for portability");
-# endif
-#endif
-
-#if @GNULIB_CALLOC_POSIX@
-# if @REPLACE_CALLOC@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef calloc
-# define calloc rpl_calloc
-# endif
-_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
-_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
-# else
-_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
-# endif
-_GL_CXXALIASWARN (calloc);
-#elif defined GNULIB_POSIXCHECK
-# undef calloc
-/* Assume calloc is always declared. */
-_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
- "use gnulib module calloc-posix for portability");
-#endif
-
-#if @GNULIB_CANONICALIZE_FILE_NAME@
-# if @REPLACE_CANONICALIZE_FILE_NAME@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define canonicalize_file_name rpl_canonicalize_file_name
-# endif
-_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
-# else
-# if !@HAVE_CANONICALIZE_FILE_NAME@
-_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
-# endif
-_GL_CXXALIASWARN (canonicalize_file_name);
-#elif defined GNULIB_POSIXCHECK
-# undef canonicalize_file_name
-# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
-_GL_WARN_ON_USE (canonicalize_file_name,
- "canonicalize_file_name is unportable - "
- "use gnulib module canonicalize-lgpl for portability");
-# endif
-#endif
-
-#if @GNULIB_GETLOADAVG@
-/* Store max(NELEM,3) load average numbers in LOADAVG[].
- The three numbers are the load average of the last 1 minute, the last 5
- minutes, and the last 15 minutes, respectively.
- LOADAVG is an array of NELEM numbers. */
-# if !@HAVE_DECL_GETLOADAVG@
-_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
-_GL_CXXALIASWARN (getloadavg);
-#elif defined GNULIB_POSIXCHECK
-# undef getloadavg
-# if HAVE_RAW_DECL_GETLOADAVG
-_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
- "use gnulib module getloadavg for portability");
-# endif
-#endif
-
-#if @GNULIB_GETSUBOPT@
-/* Assuming *OPTIONP is a comma separated list of elements of the form
- "token" or "token=value", getsubopt parses the first of these elements.
- If the first element refers to a "token" that is member of the given
- NULL-terminated array of tokens:
- - It replaces the comma with a NUL byte, updates *OPTIONP to point past
- the first option and the comma, sets *VALUEP to the value of the
- element (or NULL if it doesn't contain an "=" sign),
- - It returns the index of the "token" in the given array of tokens.
- Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
- For more details see the POSIX:2001 specification.
- http://www.opengroup.org/susv3xsh/getsubopt.html */
-# if !@HAVE_GETSUBOPT@
-_GL_FUNCDECL_SYS (getsubopt, int,
- (char **optionp, char *const *tokens, char **valuep)
- _GL_ARG_NONNULL ((1, 2, 3)));
-# endif
-_GL_CXXALIAS_SYS (getsubopt, int,
- (char **optionp, char *const *tokens, char **valuep));
-_GL_CXXALIASWARN (getsubopt);
-#elif defined GNULIB_POSIXCHECK
-# undef getsubopt
-# if HAVE_RAW_DECL_GETSUBOPT
-_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
- "use gnulib module getsubopt for portability");
-# endif
-#endif
-
-#if @GNULIB_GRANTPT@
-/* Change the ownership and access permission of the slave side of the
- pseudo-terminal whose master side is specified by FD. */
-# if !@HAVE_GRANTPT@
-_GL_FUNCDECL_SYS (grantpt, int, (int fd));
-# endif
-_GL_CXXALIAS_SYS (grantpt, int, (int fd));
-_GL_CXXALIASWARN (grantpt);
-#elif defined GNULIB_POSIXCHECK
-# undef grantpt
-# if HAVE_RAW_DECL_GRANTPT
-_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
- "use gnulib module grantpt for portability");
-# endif
-#endif
-
-/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
- rely on GNU or POSIX semantics for malloc and realloc (for example,
- by never specifying a zero size), so it does not need malloc or
- realloc to be redefined. */
-#if @GNULIB_MALLOC_POSIX@
-# if @REPLACE_MALLOC@
-# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
- || _GL_USE_STDLIB_ALLOC)
-# undef malloc
-# define malloc rpl_malloc
-# endif
-_GL_FUNCDECL_RPL (malloc, void *, (size_t size));
-_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
-# else
-_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
-# endif
-_GL_CXXALIASWARN (malloc);
-#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
-# undef malloc
-/* Assume malloc is always declared. */
-_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
- "use gnulib module malloc-posix for portability");
-#endif
-
-/* Convert a multibyte character to a wide character. */
-#if @GNULIB_MBTOWC@
-# if @REPLACE_MBTOWC@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef mbtowc
-# define mbtowc rpl_mbtowc
-# endif
-_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
-_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
-# else
-_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
-# endif
-_GL_CXXALIASWARN (mbtowc);
-#endif
-
-#if @GNULIB_MKDTEMP@
-/* Create a unique temporary directory from TEMPLATE.
- The last six characters of TEMPLATE must be "XXXXXX";
- they are replaced with a string that makes the directory name unique.
- Returns TEMPLATE, or a null pointer if it cannot get a unique name.
- The directory is created mode 700. */
-# if !@HAVE_MKDTEMP@
-_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
-_GL_CXXALIASWARN (mkdtemp);
-#elif defined GNULIB_POSIXCHECK
-# undef mkdtemp
-# if HAVE_RAW_DECL_MKDTEMP
-_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
- "use gnulib module mkdtemp for portability");
-# endif
-#endif
-
-#if @GNULIB_MKOSTEMP@
-/* Create a unique temporary file from TEMPLATE.
- The last six characters of TEMPLATE must be "XXXXXX";
- they are replaced with a string that makes the file name unique.
- The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
- and O_TEXT, O_BINARY (defined in "binary-io.h").
- The file is then created, with the specified flags, ensuring it didn't exist
- before.
- The file is created read-write (mask at least 0600 & ~umask), but it may be
- world-readable and world-writable (mask 0666 & ~umask), depending on the
- implementation.
- Returns the open file descriptor if successful, otherwise -1 and errno
- set. */
-# if !@HAVE_MKOSTEMP@
-_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
-_GL_CXXALIASWARN (mkostemp);
-#elif defined GNULIB_POSIXCHECK
-# undef mkostemp
-# if HAVE_RAW_DECL_MKOSTEMP
-_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
- "use gnulib module mkostemp for portability");
-# endif
-#endif
-
-#if @GNULIB_MKOSTEMPS@
-/* Create a unique temporary file from TEMPLATE.
- The last six characters of TEMPLATE before a suffix of length
- SUFFIXLEN must be "XXXXXX";
- they are replaced with a string that makes the file name unique.
- The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
- and O_TEXT, O_BINARY (defined in "binary-io.h").
- The file is then created, with the specified flags, ensuring it didn't exist
- before.
- The file is created read-write (mask at least 0600 & ~umask), but it may be
- world-readable and world-writable (mask 0666 & ~umask), depending on the
- implementation.
- Returns the open file descriptor if successful, otherwise -1 and errno
- set. */
-# if !@HAVE_MKOSTEMPS@
-_GL_FUNCDECL_SYS (mkostemps, int,
- (char * /*template*/, int /*suffixlen*/, int /*flags*/)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (mkostemps, int,
- (char * /*template*/, int /*suffixlen*/, int /*flags*/));
-_GL_CXXALIASWARN (mkostemps);
-#elif defined GNULIB_POSIXCHECK
-# undef mkostemps
-# if HAVE_RAW_DECL_MKOSTEMPS
-_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
- "use gnulib module mkostemps for portability");
-# endif
-#endif
-
-#if @GNULIB_MKSTEMP@
-/* Create a unique temporary file from TEMPLATE.
- The last six characters of TEMPLATE must be "XXXXXX";
- they are replaced with a string that makes the file name unique.
- The file is then created, ensuring it didn't exist before.
- The file is created read-write (mask at least 0600 & ~umask), but it may be
- world-readable and world-writable (mask 0666 & ~umask), depending on the
- implementation.
- Returns the open file descriptor if successful, otherwise -1 and errno
- set. */
-# if @REPLACE_MKSTEMP@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define mkstemp rpl_mkstemp
-# endif
-_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
-# else
-# if ! @HAVE_MKSTEMP@
-_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
-# endif
-_GL_CXXALIASWARN (mkstemp);
-#elif defined GNULIB_POSIXCHECK
-# undef mkstemp
-# if HAVE_RAW_DECL_MKSTEMP
-_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
- "use gnulib module mkstemp for portability");
-# endif
-#endif
-
-#if @GNULIB_MKSTEMPS@
-/* Create a unique temporary file from TEMPLATE.
- The last six characters of TEMPLATE prior to a suffix of length
- SUFFIXLEN must be "XXXXXX";
- they are replaced with a string that makes the file name unique.
- The file is then created, ensuring it didn't exist before.
- The file is created read-write (mask at least 0600 & ~umask), but it may be
- world-readable and world-writable (mask 0666 & ~umask), depending on the
- implementation.
- Returns the open file descriptor if successful, otherwise -1 and errno
- set. */
-# if !@HAVE_MKSTEMPS@
-_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
-_GL_CXXALIASWARN (mkstemps);
-#elif defined GNULIB_POSIXCHECK
-# undef mkstemps
-# if HAVE_RAW_DECL_MKSTEMPS
-_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
- "use gnulib module mkstemps for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_OPENPT@
-/* Return an FD open to the master side of a pseudo-terminal. Flags should
- include O_RDWR, and may also include O_NOCTTY. */
-# if !@HAVE_POSIX_OPENPT@
-_GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
-# endif
-_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
-_GL_CXXALIASWARN (posix_openpt);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_openpt
-# if HAVE_RAW_DECL_POSIX_OPENPT
-_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
- "use gnulib module posix_openpt for portability");
-# endif
-#endif
-
-#if @GNULIB_PTSNAME@
-/* Return the pathname of the pseudo-terminal slave associated with
- the master FD is open on, or NULL on errors. */
-# if @REPLACE_PTSNAME@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef ptsname
-# define ptsname rpl_ptsname
-# endif
-_GL_FUNCDECL_RPL (ptsname, char *, (int fd));
-_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
-# else
-# if !@HAVE_PTSNAME@
-_GL_FUNCDECL_SYS (ptsname, char *, (int fd));
-# endif
-_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
-# endif
-_GL_CXXALIASWARN (ptsname);
-#elif defined GNULIB_POSIXCHECK
-# undef ptsname
-# if HAVE_RAW_DECL_PTSNAME
-_GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
- "use gnulib module ptsname for portability");
-# endif
-#endif
-
-#if @GNULIB_PTSNAME_R@
-/* Set the pathname of the pseudo-terminal slave associated with
- the master FD is open on and return 0, or set errno and return
- non-zero on errors. */
-# if @REPLACE_PTSNAME_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef ptsname_r
-# define ptsname_r rpl_ptsname_r
-# endif
-_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
-_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
-# else
-# if !@HAVE_PTSNAME_R@
-_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
-# endif
-_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
-# endif
-_GL_CXXALIASWARN (ptsname_r);
-#elif defined GNULIB_POSIXCHECK
-# undef ptsname_r
-# if HAVE_RAW_DECL_PTSNAME_R
-_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
- "use gnulib module ptsname_r for portability");
-# endif
-#endif
-
-#if @GNULIB_PUTENV@
-# if @REPLACE_PUTENV@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef putenv
-# define putenv rpl_putenv
-# endif
-_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (putenv, int, (char *string));
-# else
-_GL_CXXALIAS_SYS (putenv, int, (char *string));
-# endif
-_GL_CXXALIASWARN (putenv);
-#endif
-
-#if @GNULIB_QSORT_R@
-/* Sort an array of NMEMB elements, starting at address BASE, each element
- occupying SIZE bytes, in ascending order according to the comparison
- function COMPARE. */
-# if @REPLACE_QSORT_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef qsort_r
-# define qsort_r rpl_qsort_r
-# endif
-_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
- int (*compare) (void const *, void const *,
- void *),
- void *arg) _GL_ARG_NONNULL ((1, 4)));
-_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
- int (*compare) (void const *, void const *,
- void *),
- void *arg));
-# else
-# if !@HAVE_QSORT_R@
-_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
- int (*compare) (void const *, void const *,
- void *),
- void *arg) _GL_ARG_NONNULL ((1, 4)));
-# endif
-_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
- int (*compare) (void const *, void const *,
- void *),
- void *arg));
-# endif
-_GL_CXXALIASWARN (qsort_r);
-#elif defined GNULIB_POSIXCHECK
-# undef qsort_r
-# if HAVE_RAW_DECL_QSORT_R
-_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
- "use gnulib module qsort_r for portability");
-# endif
-#endif
-
-
-#if @GNULIB_RANDOM_R@
-# if !@HAVE_RANDOM_R@
-# ifndef RAND_MAX
-# define RAND_MAX 2147483647
-# endif
-# endif
-#endif
-
-
-#if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@
-_GL_FUNCDECL_SYS (random, long, (void));
-# endif
-_GL_CXXALIAS_SYS (random, long, (void));
-_GL_CXXALIASWARN (random);
-#elif defined GNULIB_POSIXCHECK
-# undef random
-# if HAVE_RAW_DECL_RANDOM
-_GL_WARN_ON_USE (random, "random is unportable - "
- "use gnulib module random for portability");
-# endif
-#endif
-
-#if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@
-_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
-# endif
-_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
-_GL_CXXALIASWARN (srandom);
-#elif defined GNULIB_POSIXCHECK
-# undef srandom
-# if HAVE_RAW_DECL_SRANDOM
-_GL_WARN_ON_USE (srandom, "srandom is unportable - "
- "use gnulib module random for portability");
-# endif
-#endif
-
-#if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@
-_GL_FUNCDECL_SYS (initstate, char *,
- (unsigned int seed, char *buf, size_t buf_size)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (initstate, char *,
- (unsigned int seed, char *buf, size_t buf_size));
-_GL_CXXALIASWARN (initstate);
-#elif defined GNULIB_POSIXCHECK
-# undef initstate
-# if HAVE_RAW_DECL_INITSTATE_R
-_GL_WARN_ON_USE (initstate, "initstate is unportable - "
- "use gnulib module random for portability");
-# endif
-#endif
-
-#if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@
-_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
-_GL_CXXALIASWARN (setstate);
-#elif defined GNULIB_POSIXCHECK
-# undef setstate
-# if HAVE_RAW_DECL_SETSTATE_R
-_GL_WARN_ON_USE (setstate, "setstate is unportable - "
- "use gnulib module random for portability");
-# endif
-#endif
-
-
-#if @GNULIB_RANDOM_R@
-# if @REPLACE_RANDOM_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef random_r
-# define random_r rpl_random_r
-# endif
-_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
-# else
-# if !@HAVE_RANDOM_R@
-_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
-# endif
-_GL_CXXALIASWARN (random_r);
-#elif defined GNULIB_POSIXCHECK
-# undef random_r
-# if HAVE_RAW_DECL_RANDOM_R
-_GL_WARN_ON_USE (random_r, "random_r is unportable - "
- "use gnulib module random_r for portability");
-# endif
-#endif
-
-#if @GNULIB_RANDOM_R@
-# if @REPLACE_RANDOM_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef srandom_r
-# define srandom_r rpl_srandom_r
-# endif
-_GL_FUNCDECL_RPL (srandom_r, int,
- (unsigned int seed, struct random_data *rand_state)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (srandom_r, int,
- (unsigned int seed, struct random_data *rand_state));
-# else
-# if !@HAVE_RANDOM_R@
-_GL_FUNCDECL_SYS (srandom_r, int,
- (unsigned int seed, struct random_data *rand_state)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (srandom_r, int,
- (unsigned int seed, struct random_data *rand_state));
-# endif
-_GL_CXXALIASWARN (srandom_r);
-#elif defined GNULIB_POSIXCHECK
-# undef srandom_r
-# if HAVE_RAW_DECL_SRANDOM_R
-_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
- "use gnulib module random_r for portability");
-# endif
-#endif
-
-#if @GNULIB_RANDOM_R@
-# if @REPLACE_RANDOM_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef initstate_r
-# define initstate_r rpl_initstate_r
-# endif
-_GL_FUNCDECL_RPL (initstate_r, int,
- (unsigned int seed, char *buf, size_t buf_size,
- struct random_data *rand_state)
- _GL_ARG_NONNULL ((2, 4)));
-_GL_CXXALIAS_RPL (initstate_r, int,
- (unsigned int seed, char *buf, size_t buf_size,
- struct random_data *rand_state));
-# else
-# if !@HAVE_RANDOM_R@
-_GL_FUNCDECL_SYS (initstate_r, int,
- (unsigned int seed, char *buf, size_t buf_size,
- struct random_data *rand_state)
- _GL_ARG_NONNULL ((2, 4)));
-# endif
-_GL_CXXALIAS_SYS (initstate_r, int,
- (unsigned int seed, char *buf, size_t buf_size,
- struct random_data *rand_state));
-# endif
-_GL_CXXALIASWARN (initstate_r);
-#elif defined GNULIB_POSIXCHECK
-# undef initstate_r
-# if HAVE_RAW_DECL_INITSTATE_R
-_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
- "use gnulib module random_r for portability");
-# endif
-#endif
-
-#if @GNULIB_RANDOM_R@
-# if @REPLACE_RANDOM_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef setstate_r
-# define setstate_r rpl_setstate_r
-# endif
-_GL_FUNCDECL_RPL (setstate_r, int,
- (char *arg_state, struct random_data *rand_state)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (setstate_r, int,
- (char *arg_state, struct random_data *rand_state));
-# else
-# if !@HAVE_RANDOM_R@
-_GL_FUNCDECL_SYS (setstate_r, int,
- (char *arg_state, struct random_data *rand_state)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (setstate_r, int,
- (char *arg_state, struct random_data *rand_state));
-# endif
-_GL_CXXALIASWARN (setstate_r);
-#elif defined GNULIB_POSIXCHECK
-# undef setstate_r
-# if HAVE_RAW_DECL_SETSTATE_R
-_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
- "use gnulib module random_r for portability");
-# endif
-#endif
-
-
-#if @GNULIB_REALLOC_POSIX@
-# if @REPLACE_REALLOC@
-# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
- || _GL_USE_STDLIB_ALLOC)
-# undef realloc
-# define realloc rpl_realloc
-# endif
-_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
-_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
-# else
-_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
-# endif
-_GL_CXXALIASWARN (realloc);
-#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
-# undef realloc
-/* Assume realloc is always declared. */
-_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
- "use gnulib module realloc-posix for portability");
-#endif
-
-#if @GNULIB_REALPATH@
-# if @REPLACE_REALPATH@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define realpath rpl_realpath
-# endif
-_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
-# else
-# if !@HAVE_REALPATH@
-_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
-# endif
-_GL_CXXALIASWARN (realpath);
-#elif defined GNULIB_POSIXCHECK
-# undef realpath
-# if HAVE_RAW_DECL_REALPATH
-_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
- "canonicalize or canonicalize-lgpl for portability");
-# endif
-#endif
-
-#if @GNULIB_RPMATCH@
-/* Test a user response to a question.
- Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
-# if !@HAVE_RPMATCH@
-_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
-_GL_CXXALIASWARN (rpmatch);
-#elif defined GNULIB_POSIXCHECK
-# undef rpmatch
-# if HAVE_RAW_DECL_RPMATCH
-_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
- "use gnulib module rpmatch for portability");
-# endif
-#endif
-
-#if @GNULIB_SECURE_GETENV@
-/* Look up NAME in the environment, returning 0 in insecure situations. */
-# if !@HAVE_SECURE_GETENV@
-_GL_FUNCDECL_SYS (secure_getenv, char *,
- (char const *name) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
-_GL_CXXALIASWARN (secure_getenv);
-#elif defined GNULIB_POSIXCHECK
-# undef secure_getenv
-# if HAVE_RAW_DECL_SECURE_GETENV
-_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
- "use gnulib module secure_getenv for portability");
-# endif
-#endif
-
-#if @GNULIB_SETENV@
-/* Set NAME to VALUE in the environment.
- If REPLACE is nonzero, overwrite an existing value. */
-# if @REPLACE_SETENV@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef setenv
-# define setenv rpl_setenv
-# endif
-_GL_FUNCDECL_RPL (setenv, int,
- (const char *name, const char *value, int replace)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (setenv, int,
- (const char *name, const char *value, int replace));
-# else
-# if !@HAVE_DECL_SETENV@
-_GL_FUNCDECL_SYS (setenv, int,
- (const char *name, const char *value, int replace)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (setenv, int,
- (const char *name, const char *value, int replace));
-# endif
-# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
-_GL_CXXALIASWARN (setenv);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef setenv
-# if HAVE_RAW_DECL_SETENV
-_GL_WARN_ON_USE (setenv, "setenv is unportable - "
- "use gnulib module setenv for portability");
-# endif
-#endif
-
-#if @GNULIB_STRTOD@
- /* Parse a double from STRING, updating ENDP if appropriate. */
-# if @REPLACE_STRTOD@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define strtod rpl_strtod
-# endif
-_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
-# else
-# if !@HAVE_STRTOD@
-_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
-# endif
-_GL_CXXALIASWARN (strtod);
-#elif defined GNULIB_POSIXCHECK
-# undef strtod
-# if HAVE_RAW_DECL_STRTOD
-_GL_WARN_ON_USE (strtod, "strtod is unportable - "
- "use gnulib module strtod for portability");
-# endif
-#endif
-
-#if @GNULIB_STRTOLL@
-/* Parse a signed integer whose textual representation starts at STRING.
- The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
- it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
- "0x").
- If ENDPTR is not NULL, the address of the first byte after the integer is
- stored in *ENDPTR.
- Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
- to ERANGE. */
-# if !@HAVE_STRTOLL@
-_GL_FUNCDECL_SYS (strtoll, long long,
- (const char *string, char **endptr, int base)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (strtoll, long long,
- (const char *string, char **endptr, int base));
-_GL_CXXALIASWARN (strtoll);
-#elif defined GNULIB_POSIXCHECK
-# undef strtoll
-# if HAVE_RAW_DECL_STRTOLL
-_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
- "use gnulib module strtoll for portability");
-# endif
-#endif
-
-#if @GNULIB_STRTOULL@
-/* Parse an unsigned integer whose textual representation starts at STRING.
- The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
- it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
- "0x").
- If ENDPTR is not NULL, the address of the first byte after the integer is
- stored in *ENDPTR.
- Upon overflow, the return value is ULLONG_MAX, and errno is set to
- ERANGE. */
-# if !@HAVE_STRTOULL@
-_GL_FUNCDECL_SYS (strtoull, unsigned long long,
- (const char *string, char **endptr, int base)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (strtoull, unsigned long long,
- (const char *string, char **endptr, int base));
-_GL_CXXALIASWARN (strtoull);
-#elif defined GNULIB_POSIXCHECK
-# undef strtoull
-# if HAVE_RAW_DECL_STRTOULL
-_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
- "use gnulib module strtoull for portability");
-# endif
-#endif
-
-#if @GNULIB_UNLOCKPT@
-/* Unlock the slave side of the pseudo-terminal whose master side is specified
- by FD, so that it can be opened. */
-# if !@HAVE_UNLOCKPT@
-_GL_FUNCDECL_SYS (unlockpt, int, (int fd));
-# endif
-_GL_CXXALIAS_SYS (unlockpt, int, (int fd));
-_GL_CXXALIASWARN (unlockpt);
-#elif defined GNULIB_POSIXCHECK
-# undef unlockpt
-# if HAVE_RAW_DECL_UNLOCKPT
-_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
- "use gnulib module unlockpt for portability");
-# endif
-#endif
-
-#if @GNULIB_UNSETENV@
-/* Remove the variable NAME from the environment. */
-# if @REPLACE_UNSETENV@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef unsetenv
-# define unsetenv rpl_unsetenv
-# endif
-_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
-# else
-# if !@HAVE_DECL_UNSETENV@
-_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
-# endif
-# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
-_GL_CXXALIASWARN (unsetenv);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef unsetenv
-# if HAVE_RAW_DECL_UNSETENV
-_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
- "use gnulib module unsetenv for portability");
-# endif
-#endif
-
-/* Convert a wide character to a multibyte character. */
-#if @GNULIB_WCTOMB@
-# if @REPLACE_WCTOMB@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef wctomb
-# define wctomb rpl_wctomb
-# endif
-_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
-_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
-# else
-_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
-# endif
-_GL_CXXALIASWARN (wctomb);
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_STDLIB_H */
-#endif /* _@GUARD_PREFIX@_STDLIB_H */
-#endif
diff --git a/src/gl/strdup.c b/src/gl/strdup.c
deleted file mode 100644
index 81eb2260ce..0000000000
--- a/src/gl/strdup.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2016 Free Software
- Foundation, Inc.
-
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _LIBC
-# include <config.h>
-#endif
-
-/* Get specification. */
-#include <string.h>
-
-#include <stdlib.h>
-
-#undef __strdup
-#ifdef _LIBC
-# undef strdup
-#endif
-
-#ifndef weak_alias
-# define __strdup strdup
-#endif
-
-/* Duplicate S, returning an identical malloc'd string. */
-char *
-__strdup (const char *s)
-{
- size_t len = strlen (s) + 1;
- void *new = malloc (len);
-
- if (new == NULL)
- return NULL;
-
- return (char *) memcpy (new, s, len);
-}
-#ifdef libc_hidden_def
-libc_hidden_def (__strdup)
-#endif
-#ifdef weak_alias
-weak_alias (__strdup, strdup)
-#endif
diff --git a/src/gl/strerror-override.c b/src/gl/strerror-override.c
deleted file mode 100644
index 9bc9b18951..0000000000
--- a/src/gl/strerror-override.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/* strerror-override.c --- POSIX compatible system error routine
-
- Copyright (C) 2010-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2010. */
-
-#include <config.h>
-
-#include "strerror-override.h"
-
-#include <errno.h>
-
-#if GNULIB_defined_EWINSOCK /* native Windows platforms */
-# if HAVE_WINSOCK2_H
-# include <winsock2.h>
-# endif
-#endif
-
-/* If ERRNUM maps to an errno value defined by gnulib, return a string
- describing the error. Otherwise return NULL. */
-const char *
-strerror_override (int errnum)
-{
- /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */
- switch (errnum)
- {
-#if REPLACE_STRERROR_0
- case 0:
- return "Success";
-#endif
-
-#if GNULIB_defined_ESOCK /* native Windows platforms with older <errno.h> */
- case EINPROGRESS:
- return "Operation now in progress";
- case EALREADY:
- return "Operation already in progress";
- case ENOTSOCK:
- return "Socket operation on non-socket";
- case EDESTADDRREQ:
- return "Destination address required";
- case EMSGSIZE:
- return "Message too long";
- case EPROTOTYPE:
- return "Protocol wrong type for socket";
- case ENOPROTOOPT:
- return "Protocol not available";
- case EPROTONOSUPPORT:
- return "Protocol not supported";
- case EOPNOTSUPP:
- return "Operation not supported";
- case EAFNOSUPPORT:
- return "Address family not supported by protocol";
- case EADDRINUSE:
- return "Address already in use";
- case EADDRNOTAVAIL:
- return "Cannot assign requested address";
- case ENETDOWN:
- return "Network is down";
- case ENETUNREACH:
- return "Network is unreachable";
- case ECONNRESET:
- return "Connection reset by peer";
- case ENOBUFS:
- return "No buffer space available";
- case EISCONN:
- return "Transport endpoint is already connected";
- case ENOTCONN:
- return "Transport endpoint is not connected";
- case ETIMEDOUT:
- return "Connection timed out";
- case ECONNREFUSED:
- return "Connection refused";
- case ELOOP:
- return "Too many levels of symbolic links";
- case EHOSTUNREACH:
- return "No route to host";
- case EWOULDBLOCK:
- return "Operation would block";
-#endif
-#if GNULIB_defined_ESTREAMS /* native Windows platforms with older <errno.h> */
- case ETXTBSY:
- return "Text file busy";
- case ENODATA:
- return "No data available";
- case ENOSR:
- return "Out of streams resources";
- case ENOSTR:
- return "Device not a stream";
- case ETIME:
- return "Timer expired";
- case EOTHER:
- return "Other error";
-#endif
-#if GNULIB_defined_EWINSOCK /* native Windows platforms */
- case ESOCKTNOSUPPORT:
- return "Socket type not supported";
- case EPFNOSUPPORT:
- return "Protocol family not supported";
- case ESHUTDOWN:
- return "Cannot send after transport endpoint shutdown";
- case ETOOMANYREFS:
- return "Too many references: cannot splice";
- case EHOSTDOWN:
- return "Host is down";
- case EPROCLIM:
- return "Too many processes";
- case EUSERS:
- return "Too many users";
- case EDQUOT:
- return "Disk quota exceeded";
- case ESTALE:
- return "Stale NFS file handle";
- case EREMOTE:
- return "Object is remote";
-# if HAVE_WINSOCK2_H
- /* WSA_INVALID_HANDLE maps to EBADF */
- /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
- /* WSA_INVALID_PARAMETER maps to EINVAL */
- case WSA_OPERATION_ABORTED:
- return "Overlapped operation aborted";
- case WSA_IO_INCOMPLETE:
- return "Overlapped I/O event object not in signaled state";
- case WSA_IO_PENDING:
- return "Overlapped operations will complete later";
- /* WSAEINTR maps to EINTR */
- /* WSAEBADF maps to EBADF */
- /* WSAEACCES maps to EACCES */
- /* WSAEFAULT maps to EFAULT */
- /* WSAEINVAL maps to EINVAL */
- /* WSAEMFILE maps to EMFILE */
- /* WSAEWOULDBLOCK maps to EWOULDBLOCK */
- /* WSAEINPROGRESS maps to EINPROGRESS */
- /* WSAEALREADY maps to EALREADY */
- /* WSAENOTSOCK maps to ENOTSOCK */
- /* WSAEDESTADDRREQ maps to EDESTADDRREQ */
- /* WSAEMSGSIZE maps to EMSGSIZE */
- /* WSAEPROTOTYPE maps to EPROTOTYPE */
- /* WSAENOPROTOOPT maps to ENOPROTOOPT */
- /* WSAEPROTONOSUPPORT maps to EPROTONOSUPPORT */
- /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
- /* WSAEOPNOTSUPP maps to EOPNOTSUPP */
- /* WSAEPFNOSUPPORT is EPFNOSUPPORT */
- /* WSAEAFNOSUPPORT maps to EAFNOSUPPORT */
- /* WSAEADDRINUSE maps to EADDRINUSE */
- /* WSAEADDRNOTAVAIL maps to EADDRNOTAVAIL */
- /* WSAENETDOWN maps to ENETDOWN */
- /* WSAENETUNREACH maps to ENETUNREACH */
- /* WSAENETRESET maps to ENETRESET */
- /* WSAECONNABORTED maps to ECONNABORTED */
- /* WSAECONNRESET maps to ECONNRESET */
- /* WSAENOBUFS maps to ENOBUFS */
- /* WSAEISCONN maps to EISCONN */
- /* WSAENOTCONN maps to ENOTCONN */
- /* WSAESHUTDOWN is ESHUTDOWN */
- /* WSAETOOMANYREFS is ETOOMANYREFS */
- /* WSAETIMEDOUT maps to ETIMEDOUT */
- /* WSAECONNREFUSED maps to ECONNREFUSED */
- /* WSAELOOP maps to ELOOP */
- /* WSAENAMETOOLONG maps to ENAMETOOLONG */
- /* WSAEHOSTDOWN is EHOSTDOWN */
- /* WSAEHOSTUNREACH maps to EHOSTUNREACH */
- /* WSAENOTEMPTY maps to ENOTEMPTY */
- /* WSAEPROCLIM is EPROCLIM */
- /* WSAEUSERS is EUSERS */
- /* WSAEDQUOT is EDQUOT */
- /* WSAESTALE is ESTALE */
- /* WSAEREMOTE is EREMOTE */
- case WSASYSNOTREADY:
- return "Network subsystem is unavailable";
- case WSAVERNOTSUPPORTED:
- return "Winsock.dll version out of range";
- case WSANOTINITIALISED:
- return "Successful WSAStartup not yet performed";
- case WSAEDISCON:
- return "Graceful shutdown in progress";
- case WSAENOMORE: case WSA_E_NO_MORE:
- return "No more results";
- case WSAECANCELLED: case WSA_E_CANCELLED:
- return "Call was canceled";
- case WSAEINVALIDPROCTABLE:
- return "Procedure call table is invalid";
- case WSAEINVALIDPROVIDER:
- return "Service provider is invalid";
- case WSAEPROVIDERFAILEDINIT:
- return "Service provider failed to initialize";
- case WSASYSCALLFAILURE:
- return "System call failure";
- case WSASERVICE_NOT_FOUND:
- return "Service not found";
- case WSATYPE_NOT_FOUND:
- return "Class type not found";
- case WSAEREFUSED:
- return "Database query was refused";
- case WSAHOST_NOT_FOUND:
- return "Host not found";
- case WSATRY_AGAIN:
- return "Nonauthoritative host not found";
- case WSANO_RECOVERY:
- return "Nonrecoverable error";
- case WSANO_DATA:
- return "Valid name, no data record of requested type";
- /* WSA_QOS_* omitted */
-# endif
-#endif
-
-#if GNULIB_defined_ENOMSG
- case ENOMSG:
- return "No message of desired type";
-#endif
-
-#if GNULIB_defined_EIDRM
- case EIDRM:
- return "Identifier removed";
-#endif
-
-#if GNULIB_defined_ENOLINK
- case ENOLINK:
- return "Link has been severed";
-#endif
-
-#if GNULIB_defined_EPROTO
- case EPROTO:
- return "Protocol error";
-#endif
-
-#if GNULIB_defined_EMULTIHOP
- case EMULTIHOP:
- return "Multihop attempted";
-#endif
-
-#if GNULIB_defined_EBADMSG
- case EBADMSG:
- return "Bad message";
-#endif
-
-#if GNULIB_defined_EOVERFLOW
- case EOVERFLOW:
- return "Value too large for defined data type";
-#endif
-
-#if GNULIB_defined_ENOTSUP
- case ENOTSUP:
- return "Not supported";
-#endif
-
-#if GNULIB_defined_ENETRESET
- case ENETRESET:
- return "Network dropped connection on reset";
-#endif
-
-#if GNULIB_defined_ECONNABORTED
- case ECONNABORTED:
- return "Software caused connection abort";
-#endif
-
-#if GNULIB_defined_ESTALE
- case ESTALE:
- return "Stale NFS file handle";
-#endif
-
-#if GNULIB_defined_EDQUOT
- case EDQUOT:
- return "Disk quota exceeded";
-#endif
-
-#if GNULIB_defined_ECANCELED
- case ECANCELED:
- return "Operation canceled";
-#endif
-
-#if GNULIB_defined_EOWNERDEAD
- case EOWNERDEAD:
- return "Owner died";
-#endif
-
-#if GNULIB_defined_ENOTRECOVERABLE
- case ENOTRECOVERABLE:
- return "State not recoverable";
-#endif
-
-#if GNULIB_defined_EILSEQ
- case EILSEQ:
- return "Invalid or incomplete multibyte or wide character";
-#endif
-
- default:
- return NULL;
- }
-}
diff --git a/src/gl/strerror-override.h b/src/gl/strerror-override.h
deleted file mode 100644
index 5264fd5f39..0000000000
--- a/src/gl/strerror-override.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* strerror-override.h --- POSIX compatible system error routine
-
- Copyright (C) 2010-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _GL_STRERROR_OVERRIDE_H
-# define _GL_STRERROR_OVERRIDE_H
-
-# include <errno.h>
-# include <stddef.h>
-
-/* Reasonable buffer size that should never trigger ERANGE; if this
- proves too small, we intentionally abort(), to remind us to fix
- this value. */
-# define STACKBUF_LEN 256
-
-/* If ERRNUM maps to an errno value defined by gnulib, return a string
- describing the error. Otherwise return NULL. */
-# if REPLACE_STRERROR_0 \
- || GNULIB_defined_ESOCK \
- || GNULIB_defined_ESTREAMS \
- || GNULIB_defined_EWINSOCK \
- || GNULIB_defined_ENOMSG \
- || GNULIB_defined_EIDRM \
- || GNULIB_defined_ENOLINK \
- || GNULIB_defined_EPROTO \
- || GNULIB_defined_EMULTIHOP \
- || GNULIB_defined_EBADMSG \
- || GNULIB_defined_EOVERFLOW \
- || GNULIB_defined_ENOTSUP \
- || GNULIB_defined_ENETRESET \
- || GNULIB_defined_ECONNABORTED \
- || GNULIB_defined_ESTALE \
- || GNULIB_defined_EDQUOT \
- || GNULIB_defined_ECANCELED \
- || GNULIB_defined_EOWNERDEAD \
- || GNULIB_defined_ENOTRECOVERABLE \
- || GNULIB_defined_EILSEQ
-extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST;
-# else
-# define strerror_override(ignored) NULL
-# endif
-
-#endif /* _GL_STRERROR_OVERRIDE_H */
diff --git a/src/gl/strerror.c b/src/gl/strerror.c
deleted file mode 100644
index 8fff3bd6a8..0000000000
--- a/src/gl/strerror.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* strerror.c --- POSIX compatible system error routine
-
- Copyright (C) 2007-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <string.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "intprops.h"
-#include "strerror-override.h"
-#include "verify.h"
-
-/* Use the system functions, not the gnulib overrides in this file. */
-#undef sprintf
-
-char *
-strerror (int n)
-#undef strerror
-{
- static char buf[STACKBUF_LEN];
- size_t len;
-
- /* Cast away const, due to the historical signature of strerror;
- callers should not be modifying the string. */
- const char *msg = strerror_override (n);
- if (msg)
- return (char *) msg;
-
- msg = strerror (n);
-
- /* Our strerror_r implementation might use the system's strerror
- buffer, so all other clients of strerror have to see the error
- copied into a buffer that we manage. This is not thread-safe,
- even if the system strerror is, but portable programs shouldn't
- be using strerror if they care about thread-safety. */
- if (!msg || !*msg)
- {
- static char const fmt[] = "Unknown error %d";
- verify (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n));
- sprintf (buf, fmt, n);
- errno = EINVAL;
- return buf;
- }
-
- /* Fix STACKBUF_LEN if this ever aborts. */
- len = strlen (msg);
- if (sizeof buf <= len)
- abort ();
-
- memcpy (buf, msg, len + 1);
- return buf;
-}
diff --git a/src/gl/strftime.c b/src/gl/strftime.c
deleted file mode 100644
index 2e010830f7..0000000000
--- a/src/gl/strftime.c
+++ /dev/null
@@ -1,1499 +0,0 @@
-/* Copyright (C) 1991-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef _LIBC
-# define USE_IN_EXTENDED_LOCALE_MODEL 1
-# define HAVE_STRUCT_ERA_ENTRY 1
-# define HAVE_TM_GMTOFF 1
-# define HAVE_TM_ZONE 1
-# define HAVE_TZNAME 1
-# define HAVE_TZSET 1
-# include "../locale/localeinfo.h"
-#else
-# include <config.h>
-# if FPRINTFTIME
-# include "fprintftime.h"
-# else
-# include "strftime.h"
-# endif
-# include "time-internal.h"
-#endif
-
-#include <ctype.h>
-#include <time.h>
-
-#if HAVE_TZNAME && !HAVE_DECL_TZNAME
-extern char *tzname[];
-#endif
-
-/* Do multibyte processing if multibyte encodings are supported, unless
- multibyte sequences are safe in formats. Multibyte sequences are
- safe if they cannot contain byte sequences that look like format
- conversion specifications. The multibyte encodings used by the
- C library on the various platforms (UTF-8, GB2312, GBK, CP936,
- GB18030, EUC-TW, BIG5, BIG5-HKSCS, CP950, EUC-JP, EUC-KR, CP949,
- SHIFT_JIS, CP932, JOHAB) are safe for formats, because the byte '%'
- cannot occur in a multibyte character except in the first byte.
-
- The DEC-HANYU encoding used on OSF/1 is not safe for formats, but
- this encoding has never been seen in real-life use, so we ignore
- it. */
-#if !(defined __osf__ && 0)
-# define MULTIBYTE_IS_FORMAT_SAFE 1
-#endif
-#define DO_MULTIBYTE (! MULTIBYTE_IS_FORMAT_SAFE)
-
-#if DO_MULTIBYTE
-# include <wchar.h>
- static const mbstate_t mbstate_zero;
-#endif
-
-#include <limits.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdbool.h>
-
-#ifdef COMPILE_WIDE
-# include <endian.h>
-# define CHAR_T wchar_t
-# define UCHAR_T unsigned int
-# define L_(Str) L##Str
-# define NLW(Sym) _NL_W##Sym
-
-# define MEMCPY(d, s, n) __wmemcpy (d, s, n)
-# define STRLEN(s) __wcslen (s)
-
-#else
-# define CHAR_T char
-# define UCHAR_T unsigned char
-# define L_(Str) Str
-# define NLW(Sym) Sym
-
-# define MEMCPY(d, s, n) memcpy (d, s, n)
-# define STRLEN(s) strlen (s)
-
-#endif
-
-/* Shift A right by B bits portably, by dividing A by 2**B and
- truncating towards minus infinity. A and B should be free of side
- effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
- INT_BITS is the number of useful bits in an int. GNU code can
- assume that INT_BITS is at least 32.
-
- ISO C99 says that A >> B is implementation-defined if A < 0. Some
- implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
- right in the usual way when A < 0, so SHR falls back on division if
- ordinary A >> B doesn't seem to be the usual signed shift. */
-#define SHR(a, b) \
- (-1 >> 1 == -1 \
- ? (a) >> (b) \
- : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
-
-/* Bound on length of the string representing an integer type or expression T.
- Subtract 1 for the sign bit if t is signed; log10 (2.0) < 146/485;
- add 1 for integer division truncation; add 1 more for a minus sign
- if needed. */
-#define INT_STRLEN_BOUND(t) \
- ((sizeof (t) * CHAR_BIT - 1) * 146 / 485 + 2)
-
-#define TM_YEAR_BASE 1900
-
-#ifndef __isleap
-/* Nonzero if YEAR is a leap year (every 4 years,
- except every 100th isn't, and every 400th is). */
-# define __isleap(year) \
- ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
-#endif
-
-
-#ifdef _LIBC
-# define mktime_z(tz, tm) mktime (tm)
-# define tzname __tzname
-# define tzset __tzset
-#endif
-
-#ifndef FPRINTFTIME
-# define FPRINTFTIME 0
-#endif
-
-#if FPRINTFTIME
-# define STREAM_OR_CHAR_T FILE
-# define STRFTIME_ARG(x) /* empty */
-#else
-# define STREAM_OR_CHAR_T CHAR_T
-# define STRFTIME_ARG(x) x,
-#endif
-
-#if FPRINTFTIME
-# define memset_byte(P, Len, Byte) \
- do { size_t _i; for (_i = 0; _i < Len; _i++) fputc (Byte, P); } while (0)
-# define memset_space(P, Len) memset_byte (P, Len, ' ')
-# define memset_zero(P, Len) memset_byte (P, Len, '0')
-#elif defined COMPILE_WIDE
-# define memset_space(P, Len) (wmemset (P, L' ', Len), (P) += (Len))
-# define memset_zero(P, Len) (wmemset (P, L'0', Len), (P) += (Len))
-#else
-# define memset_space(P, Len) (memset (P, ' ', Len), (P) += (Len))
-# define memset_zero(P, Len) (memset (P, '0', Len), (P) += (Len))
-#endif
-
-#if FPRINTFTIME
-# define advance(P, N)
-#else
-# define advance(P, N) ((P) += (N))
-#endif
-
-#define add(n, f) \
- do \
- { \
- size_t _n = (n); \
- size_t _w = (width < 0 ? 0 : width); \
- size_t _incr = _n < _w ? _w : _n; \
- if (_incr >= maxsize - i) \
- return 0; \
- if (p) \
- { \
- if (digits == 0 && _n < _w) \
- { \
- size_t _delta = width - _n; \
- if (pad == L_('0')) \
- memset_zero (p, _delta); \
- else \
- memset_space (p, _delta); \
- } \
- f; \
- advance (p, _n); \
- } \
- i += _incr; \
- } while (0)
-
-#if FPRINTFTIME
-# define add1(C) add (1, fputc (C, p))
-#else
-# define add1(C) add (1, *p = C)
-#endif
-
-#if FPRINTFTIME
-# define cpy(n, s) \
- add ((n), \
- do \
- { \
- if (to_lowcase) \
- fwrite_lowcase (p, (s), _n); \
- else if (to_uppcase) \
- fwrite_uppcase (p, (s), _n); \
- else \
- { \
- /* Ignore the value of fwrite. The caller can determine whether \
- an error occurred by inspecting ferror (P). All known fwrite \
- implementations set the stream's error indicator when they \
- fail due to ENOMEM etc., even though C11 and POSIX.1-2008 do \
- not require this. */ \
- fwrite (s, _n, 1, p); \
- } \
- } \
- while (0) \
- )
-#else
-# define cpy(n, s) \
- add ((n), \
- if (to_lowcase) \
- memcpy_lowcase (p, (s), _n LOCALE_ARG); \
- else if (to_uppcase) \
- memcpy_uppcase (p, (s), _n LOCALE_ARG); \
- else \
- MEMCPY ((void *) p, (void const *) (s), _n))
-#endif
-
-#ifdef COMPILE_WIDE
-# ifndef USE_IN_EXTENDED_LOCALE_MODEL
-# undef __mbsrtowcs_l
-# define __mbsrtowcs_l(d, s, l, st, loc) __mbsrtowcs (d, s, l, st)
-# endif
-# define widen(os, ws, l) \
- { \
- mbstate_t __st; \
- const char *__s = os; \
- memset (&__st, '\0', sizeof (__st)); \
- l = __mbsrtowcs_l (NULL, &__s, 0, &__st, loc); \
- ws = (wchar_t *) alloca ((l + 1) * sizeof (wchar_t)); \
- (void) __mbsrtowcs_l (ws, &__s, l, &__st, loc); \
- }
-#endif
-
-
-#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL
-/* We use this code also for the extended locale handling where the
- function gets as an additional argument the locale which has to be
- used. To access the values we have to redefine the _NL_CURRENT
- macro. */
-# define strftime __strftime_l
-# define wcsftime __wcsftime_l
-# undef _NL_CURRENT
-# define _NL_CURRENT(category, item) \
- (current->values[_NL_ITEM_INDEX (item)].string)
-# define LOCALE_PARAM , __locale_t loc
-# define LOCALE_ARG , loc
-# define HELPER_LOCALE_ARG , current
-#else
-# define LOCALE_PARAM
-# define LOCALE_ARG
-# ifdef _LIBC
-# define HELPER_LOCALE_ARG , _NL_CURRENT_DATA (LC_TIME)
-# else
-# define HELPER_LOCALE_ARG
-# endif
-#endif
-
-#ifdef COMPILE_WIDE
-# ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# define TOUPPER(Ch, L) __towupper_l (Ch, L)
-# define TOLOWER(Ch, L) __towlower_l (Ch, L)
-# else
-# define TOUPPER(Ch, L) towupper (Ch)
-# define TOLOWER(Ch, L) towlower (Ch)
-# endif
-#else
-# ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# define TOUPPER(Ch, L) __toupper_l (Ch, L)
-# define TOLOWER(Ch, L) __tolower_l (Ch, L)
-# else
-# define TOUPPER(Ch, L) toupper (Ch)
-# define TOLOWER(Ch, L) tolower (Ch)
-# endif
-#endif
-/* We don't use 'isdigit' here since the locale dependent
- interpretation is not what we want here. We only need to accept
- the arabic digits in the ASCII range. One day there is perhaps a
- more reliable way to accept other sets of digits. */
-#define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9)
-
-#if FPRINTFTIME
-static void
-fwrite_lowcase (FILE *fp, const CHAR_T *src, size_t len)
-{
- while (len-- > 0)
- {
- fputc (TOLOWER ((UCHAR_T) *src, loc), fp);
- ++src;
- }
-}
-
-static void
-fwrite_uppcase (FILE *fp, const CHAR_T *src, size_t len)
-{
- while (len-- > 0)
- {
- fputc (TOUPPER ((UCHAR_T) *src, loc), fp);
- ++src;
- }
-}
-#else
-static CHAR_T *memcpy_lowcase (CHAR_T *dest, const CHAR_T *src,
- size_t len LOCALE_PARAM);
-
-static CHAR_T *
-memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM)
-{
- while (len-- > 0)
- dest[len] = TOLOWER ((UCHAR_T) src[len], loc);
- return dest;
-}
-
-static CHAR_T *memcpy_uppcase (CHAR_T *dest, const CHAR_T *src,
- size_t len LOCALE_PARAM);
-
-static CHAR_T *
-memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM)
-{
- while (len-- > 0)
- dest[len] = TOUPPER ((UCHAR_T) src[len], loc);
- return dest;
-}
-#endif
-
-
-#if ! HAVE_TM_GMTOFF
-/* Yield the difference between *A and *B,
- measured in seconds, ignoring leap seconds. */
-# define tm_diff ftime_tm_diff
-static int tm_diff (const struct tm *, const struct tm *);
-static int
-tm_diff (const struct tm *a, const struct tm *b)
-{
- /* Compute intervening leap days correctly even if year is negative.
- Take care to avoid int overflow in leap day calculations,
- but it's OK to assume that A and B are close to each other. */
- int a4 = SHR (a->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (a->tm_year & 3);
- int b4 = SHR (b->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (b->tm_year & 3);
- int a100 = a4 / 25 - (a4 % 25 < 0);
- int b100 = b4 / 25 - (b4 % 25 < 0);
- int a400 = SHR (a100, 2);
- int b400 = SHR (b100, 2);
- int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
- int years = a->tm_year - b->tm_year;
- int days = (365 * years + intervening_leap_days
- + (a->tm_yday - b->tm_yday));
- return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
- + (a->tm_min - b->tm_min))
- + (a->tm_sec - b->tm_sec));
-}
-#endif /* ! HAVE_TM_GMTOFF */
-
-
-
-/* The number of days from the first day of the first ISO week of this
- year to the year day YDAY with week day WDAY. ISO weeks start on
- Monday; the first ISO week has the year's first Thursday. YDAY may
- be as small as YDAY_MINIMUM. */
-#define ISO_WEEK_START_WDAY 1 /* Monday */
-#define ISO_WEEK1_WDAY 4 /* Thursday */
-#define YDAY_MINIMUM (-366)
-static int iso_week_days (int, int);
-#ifdef __GNUC__
-__inline__
-#endif
-static int
-iso_week_days (int yday, int wday)
-{
- /* Add enough to the first operand of % to make it nonnegative. */
- int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
- return (yday
- - (yday - wday + ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7
- + ISO_WEEK1_WDAY - ISO_WEEK_START_WDAY);
-}
-
-
-/* When compiling this file, GNU applications can #define my_strftime
- to a symbol (typically nstrftime) to get an extended strftime with
- extra arguments TZ and NS. */
-
-#if FPRINTFTIME
-# undef my_strftime
-# define my_strftime fprintftime
-#endif
-
-#ifdef my_strftime
-# undef HAVE_TZSET
-# define extra_args , tz, ns
-# define extra_args_spec , timezone_t tz, int ns
-#else
-# if defined COMPILE_WIDE
-# define my_strftime wcsftime
-# define nl_get_alt_digit _nl_get_walt_digit
-# else
-# define my_strftime strftime
-# define nl_get_alt_digit _nl_get_alt_digit
-# endif
-# define extra_args
-# define extra_args_spec
-/* We don't have this information in general. */
-# define tz 1
-# define ns 0
-#endif
-
-static size_t __strftime_internal (STREAM_OR_CHAR_T *, STRFTIME_ARG (size_t)
- const CHAR_T *, const struct tm *,
- bool, bool *
- extra_args_spec LOCALE_PARAM);
-
-/* Write information from TP into S according to the format
- string FORMAT, writing no more that MAXSIZE characters
- (including the terminating '\0') and returning number of
- characters written. If S is NULL, nothing will be written
- anywhere, so to determine how many characters would be
- written, use NULL for S and (size_t) -1 for MAXSIZE. */
-size_t
-my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
- const CHAR_T *format,
- const struct tm *tp extra_args_spec LOCALE_PARAM)
-{
- bool tzset_called = false;
- return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp,
- false, &tzset_called extra_args LOCALE_ARG);
-}
-#if defined _LIBC && ! FPRINTFTIME
-libc_hidden_def (my_strftime)
-#endif
-
-/* Just like my_strftime, above, but with two more parameters.
- UPCASE indicate that the result should be converted to upper case,
- and *TZSET_CALLED indicates whether tzset has been called here. */
-static size_t
-__strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
- const CHAR_T *format,
- const struct tm *tp, bool upcase, bool *tzset_called
- extra_args_spec LOCALE_PARAM)
-{
-#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL
- struct __locale_data *const current = loc->__locales[LC_TIME];
-#endif
-#if FPRINTFTIME
- size_t maxsize = (size_t) -1;
-#endif
-
- int hour12 = tp->tm_hour;
-#ifdef _NL_CURRENT
- /* We cannot make the following values variables since we must delay
- the evaluation of these values until really needed since some
- expressions might not be valid in every situation. The 'struct tm'
- might be generated by a strptime() call that initialized
- only a few elements. Dereference the pointers only if the format
- requires this. Then it is ok to fail if the pointers are invalid. */
-# define a_wkday \
- ((const CHAR_T *) (tp->tm_wday < 0 || tp->tm_wday > 6 \
- ? "?" : _NL_CURRENT (LC_TIME, NLW(ABDAY_1) + tp->tm_wday)))
-# define f_wkday \
- ((const CHAR_T *) (tp->tm_wday < 0 || tp->tm_wday > 6 \
- ? "?" : _NL_CURRENT (LC_TIME, NLW(DAY_1) + tp->tm_wday)))
-# define a_month \
- ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \
- ? "?" : _NL_CURRENT (LC_TIME, NLW(ABMON_1) + tp->tm_mon)))
-# define f_month \
- ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \
- ? "?" : _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon)))
-# define ampm \
- ((const CHAR_T *) _NL_CURRENT (LC_TIME, tp->tm_hour > 11 \
- ? NLW(PM_STR) : NLW(AM_STR)))
-
-# define aw_len STRLEN (a_wkday)
-# define am_len STRLEN (a_month)
-# define ap_len STRLEN (ampm)
-#endif
-#if HAVE_TZNAME
- char **tzname_vec = tzname;
-#endif
- const char *zone;
- size_t i = 0;
- STREAM_OR_CHAR_T *p = s;
- const CHAR_T *f;
-#if DO_MULTIBYTE && !defined COMPILE_WIDE
- const char *format_end = NULL;
-#endif
-
-#if ! defined _LIBC && ! HAVE_RUN_TZSET_TEST
- /* Solaris 2.5.x and 2.6 tzset sometimes modify the storage returned
- by localtime. On such systems, we must either use the tzset and
- localtime wrappers to work around the bug (which sets
- HAVE_RUN_TZSET_TEST) or make a copy of the structure. */
- struct tm copy = *tp;
- tp = &copy;
-#endif
-
- zone = NULL;
-#if HAVE_TM_ZONE
- /* The POSIX test suite assumes that setting
- the environment variable TZ to a new value before calling strftime()
- will influence the result (the %Z format) even if the information in
- TP is computed with a totally different time zone.
- This is bogus: though POSIX allows bad behavior like this,
- POSIX does not require it. Do the right thing instead. */
- zone = (const char *) tp->tm_zone;
-#endif
-#if HAVE_TZNAME
- if (!tz)
- {
- if (! (zone && *zone))
- zone = "GMT";
- }
- else
- {
-# if !HAVE_TM_ZONE
- /* Infer the zone name from *TZ instead of from TZNAME. */
- tzname_vec = tz->tzname_copy;
-# endif
- }
- /* The tzset() call might have changed the value. */
- if (!(zone && *zone) && tp->tm_isdst >= 0)
- {
- /* POSIX.1 requires that local time zone information be used as
- though strftime called tzset. */
-# if HAVE_TZSET
- if (!*tzset_called)
- {
- tzset ();
- *tzset_called = true;
- }
-# endif
- zone = tzname_vec[tp->tm_isdst != 0];
- }
-#endif
- if (! zone)
- zone = "";
-
- if (hour12 > 12)
- hour12 -= 12;
- else
- if (hour12 == 0)
- hour12 = 12;
-
- for (f = format; *f != '\0'; ++f)
- {
- int pad = 0; /* Padding for number ('-', '_', or 0). */
- int modifier; /* Field modifier ('E', 'O', or 0). */
- int digits = 0; /* Max digits for numeric format. */
- int number_value; /* Numeric value to be printed. */
- unsigned int u_number_value; /* (unsigned int) number_value. */
- bool negative_number; /* The number is negative. */
- bool always_output_a_sign; /* +/- should always be output. */
- int tz_colon_mask; /* Bitmask of where ':' should appear. */
- const CHAR_T *subfmt;
- CHAR_T sign_char;
- CHAR_T *bufp;
- CHAR_T buf[1
- + 2 /* for the two colons in a %::z or %:::z time zone */
- + (sizeof (int) < sizeof (time_t)
- ? INT_STRLEN_BOUND (time_t)
- : INT_STRLEN_BOUND (int))];
- int width = -1;
- bool to_lowcase = false;
- bool to_uppcase = upcase;
- size_t colons;
- bool change_case = false;
- int format_char;
-
-#if DO_MULTIBYTE && !defined COMPILE_WIDE
- switch (*f)
- {
- case L_('%'):
- break;
-
- case L_('\b'): case L_('\t'): case L_('\n'):
- case L_('\v'): case L_('\f'): case L_('\r'):
- case L_(' '): case L_('!'): case L_('"'): case L_('#'): case L_('&'):
- case L_('\''): case L_('('): case L_(')'): case L_('*'): case L_('+'):
- case L_(','): case L_('-'): case L_('.'): case L_('/'): case L_('0'):
- case L_('1'): case L_('2'): case L_('3'): case L_('4'): case L_('5'):
- case L_('6'): case L_('7'): case L_('8'): case L_('9'): case L_(':'):
- case L_(';'): case L_('<'): case L_('='): case L_('>'): case L_('?'):
- case L_('A'): case L_('B'): case L_('C'): case L_('D'): case L_('E'):
- case L_('F'): case L_('G'): case L_('H'): case L_('I'): case L_('J'):
- case L_('K'): case L_('L'): case L_('M'): case L_('N'): case L_('O'):
- case L_('P'): case L_('Q'): case L_('R'): case L_('S'): case L_('T'):
- case L_('U'): case L_('V'): case L_('W'): case L_('X'): case L_('Y'):
- case L_('Z'): case L_('['): case L_('\\'): case L_(']'): case L_('^'):
- case L_('_'): case L_('a'): case L_('b'): case L_('c'): case L_('d'):
- case L_('e'): case L_('f'): case L_('g'): case L_('h'): case L_('i'):
- case L_('j'): case L_('k'): case L_('l'): case L_('m'): case L_('n'):
- case L_('o'): case L_('p'): case L_('q'): case L_('r'): case L_('s'):
- case L_('t'): case L_('u'): case L_('v'): case L_('w'): case L_('x'):
- case L_('y'): case L_('z'): case L_('{'): case L_('|'): case L_('}'):
- case L_('~'):
- /* The C Standard requires these 98 characters (plus '%') to
- be in the basic execution character set. None of these
- characters can start a multibyte sequence, so they need
- not be analyzed further. */
- add1 (*f);
- continue;
-
- default:
- /* Copy this multibyte sequence until we reach its end, find
- an error, or come back to the initial shift state. */
- {
- mbstate_t mbstate = mbstate_zero;
- size_t len = 0;
- size_t fsize;
-
- if (! format_end)
- format_end = f + strlen (f) + 1;
- fsize = format_end - f;
-
- do
- {
- size_t bytes = mbrlen (f + len, fsize - len, &mbstate);
-
- if (bytes == 0)
- break;
-
- if (bytes == (size_t) -2)
- {
- len += strlen (f + len);
- break;
- }
-
- if (bytes == (size_t) -1)
- {
- len++;
- break;
- }
-
- len += bytes;
- }
- while (! mbsinit (&mbstate));
-
- cpy (len, f);
- f += len - 1;
- continue;
- }
- }
-
-#else /* ! DO_MULTIBYTE */
-
- /* Either multibyte encodings are not supported, they are
- safe for formats, so any non-'%' byte can be copied through,
- or this is the wide character version. */
- if (*f != L_('%'))
- {
- add1 (*f);
- continue;
- }
-
-#endif /* ! DO_MULTIBYTE */
-
- /* Check for flags that can modify a format. */
- while (1)
- {
- switch (*++f)
- {
- /* This influences the number formats. */
- case L_('_'):
- case L_('-'):
- case L_('0'):
- pad = *f;
- continue;
-
- /* This changes textual output. */
- case L_('^'):
- to_uppcase = true;
- continue;
- case L_('#'):
- change_case = true;
- continue;
-
- default:
- break;
- }
- break;
- }
-
- /* As a GNU extension we allow the field width to be specified. */
- if (ISDIGIT (*f))
- {
- width = 0;
- do
- {
- if (width > INT_MAX / 10
- || (width == INT_MAX / 10 && *f - L_('0') > INT_MAX % 10))
- /* Avoid overflow. */
- width = INT_MAX;
- else
- {
- width *= 10;
- width += *f - L_('0');
- }
- ++f;
- }
- while (ISDIGIT (*f));
- }
-
- /* Check for modifiers. */
- switch (*f)
- {
- case L_('E'):
- case L_('O'):
- modifier = *f++;
- break;
-
- default:
- modifier = 0;
- break;
- }
-
- /* Now do the specified format. */
- format_char = *f;
- switch (format_char)
- {
-#define DO_NUMBER(d, v) \
- do \
- { \
- digits = d; \
- number_value = v; \
- goto do_number; \
- } \
- while (0)
-#define DO_SIGNED_NUMBER(d, negative, v) \
- do \
- { \
- digits = d; \
- negative_number = negative; \
- u_number_value = v; \
- goto do_signed_number; \
- } \
- while (0)
-
- /* The mask is not what you might think.
- When the ordinal i'th bit is set, insert a colon
- before the i'th digit of the time zone representation. */
-#define DO_TZ_OFFSET(d, negative, mask, v) \
- do \
- { \
- digits = d; \
- negative_number = negative; \
- tz_colon_mask = mask; \
- u_number_value = v; \
- goto do_tz_offset; \
- } \
- while (0)
-#define DO_NUMBER_SPACEPAD(d, v) \
- do \
- { \
- digits = d; \
- number_value = v; \
- goto do_number_spacepad; \
- } \
- while (0)
-
- case L_('%'):
- if (modifier != 0)
- goto bad_format;
- add1 (*f);
- break;
-
- case L_('a'):
- if (modifier != 0)
- goto bad_format;
- if (change_case)
- {
- to_uppcase = true;
- to_lowcase = false;
- }
-#ifdef _NL_CURRENT
- cpy (aw_len, a_wkday);
- break;
-#else
- goto underlying_strftime;
-#endif
-
- case 'A':
- if (modifier != 0)
- goto bad_format;
- if (change_case)
- {
- to_uppcase = true;
- to_lowcase = false;
- }
-#ifdef _NL_CURRENT
- cpy (STRLEN (f_wkday), f_wkday);
- break;
-#else
- goto underlying_strftime;
-#endif
-
- case L_('b'):
- case L_('h'):
- if (change_case)
- {
- to_uppcase = true;
- to_lowcase = false;
- }
- if (modifier != 0)
- goto bad_format;
-#ifdef _NL_CURRENT
- cpy (am_len, a_month);
- break;
-#else
- goto underlying_strftime;
-#endif
-
- case L_('B'):
- if (modifier != 0)
- goto bad_format;
- if (change_case)
- {
- to_uppcase = true;
- to_lowcase = false;
- }
-#ifdef _NL_CURRENT
- cpy (STRLEN (f_month), f_month);
- break;
-#else
- goto underlying_strftime;
-#endif
-
- case L_('c'):
- if (modifier == L_('O'))
- goto bad_format;
-#ifdef _NL_CURRENT
- if (! (modifier == 'E'
- && (*(subfmt =
- (const CHAR_T *) _NL_CURRENT (LC_TIME,
- NLW(ERA_D_T_FMT)))
- != '\0')))
- subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_T_FMT));
-#else
- goto underlying_strftime;
-#endif
-
- subformat:
- {
- size_t len = __strftime_internal (NULL, STRFTIME_ARG ((size_t) -1)
- subfmt,
- tp, to_uppcase, tzset_called
- extra_args LOCALE_ARG);
- add (len, __strftime_internal (p,
- STRFTIME_ARG (maxsize - i)
- subfmt,
- tp, to_uppcase, tzset_called
- extra_args LOCALE_ARG));
- }
- break;
-
-#if !(defined _NL_CURRENT && HAVE_STRUCT_ERA_ENTRY)
- underlying_strftime:
- {
- /* The relevant information is available only via the
- underlying strftime implementation, so use that. */
- char ufmt[5];
- char *u = ufmt;
- char ubuf[1024]; /* enough for any single format in practice */
- size_t len;
- /* Make sure we're calling the actual underlying strftime.
- In some cases, config.h contains something like
- "#define strftime rpl_strftime". */
-# ifdef strftime
-# undef strftime
- size_t strftime ();
-# endif
-
- /* The space helps distinguish strftime failure from empty
- output. */
- *u++ = ' ';
- *u++ = '%';
- if (modifier != 0)
- *u++ = modifier;
- *u++ = format_char;
- *u = '\0';
- len = strftime (ubuf, sizeof ubuf, ufmt, tp);
- if (len != 0)
- cpy (len - 1, ubuf + 1);
- }
- break;
-#endif
-
- case L_('C'):
- if (modifier == L_('E'))
- {
-#if HAVE_STRUCT_ERA_ENTRY
- struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
- if (era)
- {
-# ifdef COMPILE_WIDE
- size_t len = __wcslen (era->era_wname);
- cpy (len, era->era_wname);
-# else
- size_t len = strlen (era->era_name);
- cpy (len, era->era_name);
-# endif
- break;
- }
-#else
- goto underlying_strftime;
-#endif
- }
-
- {
- int century = tp->tm_year / 100 + TM_YEAR_BASE / 100;
- century -= tp->tm_year % 100 < 0 && 0 < century;
- DO_SIGNED_NUMBER (2, tp->tm_year < - TM_YEAR_BASE, century);
- }
-
- case L_('x'):
- if (modifier == L_('O'))
- goto bad_format;
-#ifdef _NL_CURRENT
- if (! (modifier == L_('E')
- && (*(subfmt =
- (const CHAR_T *)_NL_CURRENT (LC_TIME, NLW(ERA_D_FMT)))
- != L_('\0'))))
- subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_FMT));
- goto subformat;
-#else
- goto underlying_strftime;
-#endif
- case L_('D'):
- if (modifier != 0)
- goto bad_format;
- subfmt = L_("%m/%d/%y");
- goto subformat;
-
- case L_('d'):
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_NUMBER (2, tp->tm_mday);
-
- case L_('e'):
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_NUMBER_SPACEPAD (2, tp->tm_mday);
-
- /* All numeric formats set DIGITS and NUMBER_VALUE (or U_NUMBER_VALUE)
- and then jump to one of these labels. */
-
- do_tz_offset:
- always_output_a_sign = true;
- goto do_number_body;
-
- do_number_spacepad:
- /* Force '_' flag unless overridden by '0' or '-' flag. */
- if (pad != L_('0') && pad != L_('-'))
- pad = L_('_');
-
- do_number:
- /* Format NUMBER_VALUE according to the MODIFIER flag. */
- negative_number = number_value < 0;
- u_number_value = number_value;
-
- do_signed_number:
- always_output_a_sign = false;
- tz_colon_mask = 0;
-
- do_number_body:
- /* Format U_NUMBER_VALUE according to the MODIFIER flag.
- NEGATIVE_NUMBER is nonzero if the original number was
- negative; in this case it was converted directly to
- unsigned int (i.e., modulo (UINT_MAX + 1)) without
- negating it. */
- if (modifier == L_('O') && !negative_number)
- {
-#ifdef _NL_CURRENT
- /* Get the locale specific alternate representation of
- the number. If none exist NULL is returned. */
- const CHAR_T *cp = nl_get_alt_digit (u_number_value
- HELPER_LOCALE_ARG);
-
- if (cp != NULL)
- {
- size_t digitlen = STRLEN (cp);
- if (digitlen != 0)
- {
- cpy (digitlen, cp);
- break;
- }
- }
-#else
- goto underlying_strftime;
-#endif
- }
-
- bufp = buf + sizeof (buf) / sizeof (buf[0]);
-
- if (negative_number)
- u_number_value = - u_number_value;
-
- do
- {
- if (tz_colon_mask & 1)
- *--bufp = ':';
- tz_colon_mask >>= 1;
- *--bufp = u_number_value % 10 + L_('0');
- u_number_value /= 10;
- }
- while (u_number_value != 0 || tz_colon_mask != 0);
-
- do_number_sign_and_padding:
- if (digits < width)
- digits = width;
-
- sign_char = (negative_number ? L_('-')
- : always_output_a_sign ? L_('+')
- : 0);
-
- if (pad == L_('-'))
- {
- if (sign_char)
- add1 (sign_char);
- }
- else
- {
- int padding = digits - (buf + (sizeof (buf) / sizeof (buf[0]))
- - bufp) - !!sign_char;
-
- if (padding > 0)
- {
- if (pad == L_('_'))
- {
- if ((size_t) padding >= maxsize - i)
- return 0;
-
- if (p)
- memset_space (p, padding);
- i += padding;
- width = width > padding ? width - padding : 0;
- if (sign_char)
- add1 (sign_char);
- }
- else
- {
- if ((size_t) digits >= maxsize - i)
- return 0;
-
- if (sign_char)
- add1 (sign_char);
-
- if (p)
- memset_zero (p, padding);
- i += padding;
- width = 0;
- }
- }
- else
- {
- if (sign_char)
- add1 (sign_char);
- }
- }
-
- cpy (buf + sizeof (buf) / sizeof (buf[0]) - bufp, bufp);
- break;
-
- case L_('F'):
- if (modifier != 0)
- goto bad_format;
- subfmt = L_("%Y-%m-%d");
- goto subformat;
-
- case L_('H'):
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_NUMBER (2, tp->tm_hour);
-
- case L_('I'):
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_NUMBER (2, hour12);
-
- case L_('k'): /* GNU extension. */
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_NUMBER_SPACEPAD (2, tp->tm_hour);
-
- case L_('l'): /* GNU extension. */
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_NUMBER_SPACEPAD (2, hour12);
-
- case L_('j'):
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_SIGNED_NUMBER (3, tp->tm_yday < -1, tp->tm_yday + 1U);
-
- case L_('M'):
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_NUMBER (2, tp->tm_min);
-
- case L_('m'):
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_SIGNED_NUMBER (2, tp->tm_mon < -1, tp->tm_mon + 1U);
-
-#ifndef _LIBC
- case L_('N'): /* GNU extension. */
- if (modifier == L_('E'))
- goto bad_format;
-
- number_value = ns;
- if (width == -1)
- width = 9;
- else
- {
- /* Take an explicit width less than 9 as a precision. */
- int j;
- for (j = width; j < 9; j++)
- number_value /= 10;
- }
-
- DO_NUMBER (width, number_value);
-#endif
-
- case L_('n'):
- add1 (L_('\n'));
- break;
-
- case L_('P'):
- to_lowcase = true;
-#ifndef _NL_CURRENT
- format_char = L_('p');
-#endif
- /* FALLTHROUGH */
-
- case L_('p'):
- if (change_case)
- {
- to_uppcase = false;
- to_lowcase = true;
- }
-#ifdef _NL_CURRENT
- cpy (ap_len, ampm);
- break;
-#else
- goto underlying_strftime;
-#endif
-
- case L_('q'): /* GNU extension. */
- DO_SIGNED_NUMBER (1, false, ((tp->tm_mon * 11) >> 5) + 1);
- break;
-
- case L_('R'):
- subfmt = L_("%H:%M");
- goto subformat;
-
- case L_('r'):
-#ifdef _NL_CURRENT
- if (*(subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME,
- NLW(T_FMT_AMPM)))
- == L_('\0'))
- subfmt = L_("%I:%M:%S %p");
- goto subformat;
-#else
- goto underlying_strftime;
-#endif
-
- case L_('S'):
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_NUMBER (2, tp->tm_sec);
-
- case L_('s'): /* GNU extension. */
- {
- struct tm ltm;
- time_t t;
-
- ltm = *tp;
- t = mktime_z (tz, &ltm);
-
- /* Generate string value for T using time_t arithmetic;
- this works even if sizeof (long) < sizeof (time_t). */
-
- bufp = buf + sizeof (buf) / sizeof (buf[0]);
- negative_number = t < 0;
-
- do
- {
- int d = t % 10;
- t /= 10;
- *--bufp = (negative_number ? -d : d) + L_('0');
- }
- while (t != 0);
-
- digits = 1;
- always_output_a_sign = false;
- goto do_number_sign_and_padding;
- }
-
- case L_('X'):
- if (modifier == L_('O'))
- goto bad_format;
-#ifdef _NL_CURRENT
- if (! (modifier == L_('E')
- && (*(subfmt =
- (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ERA_T_FMT)))
- != L_('\0'))))
- subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(T_FMT));
- goto subformat;
-#else
- goto underlying_strftime;
-#endif
- case L_('T'):
- subfmt = L_("%H:%M:%S");
- goto subformat;
-
- case L_('t'):
- add1 (L_('\t'));
- break;
-
- case L_('u'):
- DO_NUMBER (1, (tp->tm_wday - 1 + 7) % 7 + 1);
-
- case L_('U'):
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_NUMBER (2, (tp->tm_yday - tp->tm_wday + 7) / 7);
-
- case L_('V'):
- case L_('g'):
- case L_('G'):
- if (modifier == L_('E'))
- goto bad_format;
- {
- /* YEAR is a leap year if and only if (tp->tm_year + TM_YEAR_BASE)
- is a leap year, except that YEAR and YEAR - 1 both work
- correctly even when (tp->tm_year + TM_YEAR_BASE) would
- overflow. */
- int year = (tp->tm_year
- + (tp->tm_year < 0
- ? TM_YEAR_BASE % 400
- : TM_YEAR_BASE % 400 - 400));
- int year_adjust = 0;
- int days = iso_week_days (tp->tm_yday, tp->tm_wday);
-
- if (days < 0)
- {
- /* This ISO week belongs to the previous year. */
- year_adjust = -1;
- days = iso_week_days (tp->tm_yday + (365 + __isleap (year - 1)),
- tp->tm_wday);
- }
- else
- {
- int d = iso_week_days (tp->tm_yday - (365 + __isleap (year)),
- tp->tm_wday);
- if (0 <= d)
- {
- /* This ISO week belongs to the next year. */
- year_adjust = 1;
- days = d;
- }
- }
-
- switch (*f)
- {
- case L_('g'):
- {
- int yy = (tp->tm_year % 100 + year_adjust) % 100;
- DO_NUMBER (2, (0 <= yy
- ? yy
- : tp->tm_year < -TM_YEAR_BASE - year_adjust
- ? -yy
- : yy + 100));
- }
-
- case L_('G'):
- DO_SIGNED_NUMBER (4, tp->tm_year < -TM_YEAR_BASE - year_adjust,
- (tp->tm_year + (unsigned int) TM_YEAR_BASE
- + year_adjust));
-
- default:
- DO_NUMBER (2, days / 7 + 1);
- }
- }
-
- case L_('W'):
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_NUMBER (2, (tp->tm_yday - (tp->tm_wday - 1 + 7) % 7 + 7) / 7);
-
- case L_('w'):
- if (modifier == L_('E'))
- goto bad_format;
-
- DO_NUMBER (1, tp->tm_wday);
-
- case L_('Y'):
- if (modifier == 'E')
- {
-#if HAVE_STRUCT_ERA_ENTRY
- struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
- if (era)
- {
-# ifdef COMPILE_WIDE
- subfmt = era->era_wformat;
-# else
- subfmt = era->era_format;
-# endif
- goto subformat;
- }
-#else
- goto underlying_strftime;
-#endif
- }
- if (modifier == L_('O'))
- goto bad_format;
-
- DO_SIGNED_NUMBER (4, tp->tm_year < -TM_YEAR_BASE,
- tp->tm_year + (unsigned int) TM_YEAR_BASE);
-
- case L_('y'):
- if (modifier == L_('E'))
- {
-#if HAVE_STRUCT_ERA_ENTRY
- struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
- if (era)
- {
- int delta = tp->tm_year - era->start_date[0];
- DO_NUMBER (1, (era->offset
- + delta * era->absolute_direction));
- }
-#else
- goto underlying_strftime;
-#endif
- }
-
- {
- int yy = tp->tm_year % 100;
- if (yy < 0)
- yy = tp->tm_year < - TM_YEAR_BASE ? -yy : yy + 100;
- DO_NUMBER (2, yy);
- }
-
- case L_('Z'):
- if (change_case)
- {
- to_uppcase = false;
- to_lowcase = true;
- }
-
-#ifdef COMPILE_WIDE
- {
- /* The zone string is always given in multibyte form. We have
- to transform it first. */
- wchar_t *wczone;
- size_t len;
- widen (zone, wczone, len);
- cpy (len, wczone);
- }
-#else
- cpy (strlen (zone), zone);
-#endif
- break;
-
- case L_(':'):
- /* :, ::, and ::: are valid only just before 'z'.
- :::: etc. are rejected later. */
- for (colons = 1; f[colons] == L_(':'); colons++)
- continue;
- if (f[colons] != L_('z'))
- goto bad_format;
- f += colons;
- goto do_z_conversion;
-
- case L_('z'):
- colons = 0;
-
- do_z_conversion:
- if (tp->tm_isdst < 0)
- break;
-
- {
- int diff;
- int hour_diff;
- int min_diff;
- int sec_diff;
-#if HAVE_TM_GMTOFF
- diff = tp->tm_gmtoff;
-#else
- if (!tz)
- diff = 0;
- else
- {
- struct tm gtm;
- struct tm ltm;
- time_t lt;
-
- /* POSIX.1 requires that local time zone information be used as
- though strftime called tzset. */
-# if HAVE_TZSET
- if (!*tzset_called)
- {
- tzset ();
- *tzset_called = true;
- }
-# endif
-
- ltm = *tp;
- lt = mktime_z (tz, &ltm);
-
- if (lt == (time_t) -1)
- {
- /* mktime returns -1 for errors, but -1 is also a
- valid time_t value. Check whether an error really
- occurred. */
- struct tm tm;
-
- if (! localtime_rz (tz, &lt, &tm)
- || ((ltm.tm_sec ^ tm.tm_sec)
- | (ltm.tm_min ^ tm.tm_min)
- | (ltm.tm_hour ^ tm.tm_hour)
- | (ltm.tm_mday ^ tm.tm_mday)
- | (ltm.tm_mon ^ tm.tm_mon)
- | (ltm.tm_year ^ tm.tm_year)))
- break;
- }
-
- if (! localtime_rz (0, &lt, &gtm))
- break;
-
- diff = tm_diff (&ltm, &gtm);
- }
-#endif
-
- hour_diff = diff / 60 / 60;
- min_diff = diff / 60 % 60;
- sec_diff = diff % 60;
-
- switch (colons)
- {
- case 0: /* +hhmm */
- DO_TZ_OFFSET (5, diff < 0, 0, hour_diff * 100 + min_diff);
-
- case 1: tz_hh_mm: /* +hh:mm */
- DO_TZ_OFFSET (6, diff < 0, 04, hour_diff * 100 + min_diff);
-
- case 2: tz_hh_mm_ss: /* +hh:mm:ss */
- DO_TZ_OFFSET (9, diff < 0, 024,
- hour_diff * 10000 + min_diff * 100 + sec_diff);
-
- case 3: /* +hh if possible, else +hh:mm, else +hh:mm:ss */
- if (sec_diff != 0)
- goto tz_hh_mm_ss;
- if (min_diff != 0)
- goto tz_hh_mm;
- DO_TZ_OFFSET (3, diff < 0, 0, hour_diff);
-
- default:
- goto bad_format;
- }
- }
-
- case L_('\0'): /* GNU extension: % at end of format. */
- --f;
- /* Fall through. */
- default:
- /* Unknown format; output the format, including the '%',
- since this is most likely the right thing to do if a
- multibyte string has been misparsed. */
- bad_format:
- {
- int flen;
- for (flen = 1; f[1 - flen] != L_('%'); flen++)
- continue;
- cpy (flen, &f[1 - flen]);
- }
- break;
- }
- }
-
-#if ! FPRINTFTIME
- if (p && maxsize != 0)
- *p = L_('\0');
-#endif
-
- return i;
-}
diff --git a/src/gl/strftime.h b/src/gl/strftime.h
deleted file mode 100644
index 17445e1898..0000000000
--- a/src/gl/strftime.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* declarations for strftime.c
-
- Copyright (C) 2002, 2004, 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Just like strftime, but with two more arguments:
- POSIX requires that strftime use the local timezone information.
- Use the timezone __TZ instead. Use __NS as the number of
- nanoseconds in the %N directive. */
-size_t nstrftime (char *, size_t, char const *, struct tm const *,
- timezone_t __tz, int __ns);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/src/gl/string.in.h b/src/gl/string.in.h
deleted file mode 100644
index b3213c4c1a..0000000000
--- a/src/gl/string.in.h
+++ /dev/null
@@ -1,1046 +0,0 @@
-/* A GNU-like <string.h>.
-
- Copyright (C) 1995-1996, 2001-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if defined _GL_ALREADY_INCLUDING_STRING_H
-/* Special invocation convention:
- - On OS X/NetBSD we have a sequence of nested includes
- <string.h> -> <strings.h> -> "string.h"
- In this situation system _chk variants due to -D_FORTIFY_SOURCE
- might be used after any replacements defined here. */
-
-#@INCLUDE_NEXT@ @NEXT_STRING_H@
-
-#else
-/* Normal invocation convention. */
-
-#ifndef _@GUARD_PREFIX@_STRING_H
-
-#define _GL_ALREADY_INCLUDING_STRING_H
-
-/* The include_next requires a split double-inclusion guard. */
-#@INCLUDE_NEXT@ @NEXT_STRING_H@
-
-#undef _GL_ALREADY_INCLUDING_STRING_H
-
-#ifndef _@GUARD_PREFIX@_STRING_H
-#define _@GUARD_PREFIX@_STRING_H
-
-/* NetBSD 5.0 mis-defines NULL. */
-#include <stddef.h>
-
-/* MirBSD defines mbslen as a macro. */
-#if @GNULIB_MBSLEN@ && defined __MirBSD__
-# include <wchar.h>
-#endif
-
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
- The attribute __pure__ was added in gcc 2.96. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define _GL_ATTRIBUTE_PURE /* empty */
-#endif
-
-/* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */
-/* But in any case avoid namespace pollution on glibc systems. */
-#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
- && ! defined __GLIBC__
-# include <unistd.h>
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-
-/* Find the index of the least-significant set bit. */
-#if @GNULIB_FFSL@
-# if !@HAVE_FFSL@
-_GL_FUNCDECL_SYS (ffsl, int, (long int i));
-# endif
-_GL_CXXALIAS_SYS (ffsl, int, (long int i));
-_GL_CXXALIASWARN (ffsl);
-#elif defined GNULIB_POSIXCHECK
-# undef ffsl
-# if HAVE_RAW_DECL_FFSL
-_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
-# endif
-#endif
-
-
-/* Find the index of the least-significant set bit. */
-#if @GNULIB_FFSLL@
-# if !@HAVE_FFSLL@
-_GL_FUNCDECL_SYS (ffsll, int, (long long int i));
-# endif
-_GL_CXXALIAS_SYS (ffsll, int, (long long int i));
-_GL_CXXALIASWARN (ffsll);
-#elif defined GNULIB_POSIXCHECK
-# undef ffsll
-# if HAVE_RAW_DECL_FFSLL
-_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
-# endif
-#endif
-
-
-/* Return the first instance of C within N bytes of S, or NULL. */
-#if @GNULIB_MEMCHR@
-# if @REPLACE_MEMCHR@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define memchr rpl_memchr
-# endif
-_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
-# else
-# if ! @HAVE_MEMCHR@
-_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-# endif
- /* On some systems, this function is defined as an overloaded function:
- extern "C" { const void * std::memchr (const void *, int, size_t); }
- extern "C++" { void * std::memchr (void *, int, size_t); } */
-_GL_CXXALIAS_SYS_CAST2 (memchr,
- void *, (void const *__s, int __c, size_t __n),
- void const *, (void const *__s, int __c, size_t __n));
-# endif
-# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
- && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
-_GL_CXXALIASWARN1 (memchr, void const *,
- (void const *__s, int __c, size_t __n));
-# else
-_GL_CXXALIASWARN (memchr);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef memchr
-/* Assume memchr is always declared. */
-_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
- "use gnulib module memchr for portability" );
-#endif
-
-/* Return the first occurrence of NEEDLE in HAYSTACK. */
-#if @GNULIB_MEMMEM@
-# if @REPLACE_MEMMEM@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define memmem rpl_memmem
-# endif
-_GL_FUNCDECL_RPL (memmem, void *,
- (void const *__haystack, size_t __haystack_len,
- void const *__needle, size_t __needle_len)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 3)));
-_GL_CXXALIAS_RPL (memmem, void *,
- (void const *__haystack, size_t __haystack_len,
- void const *__needle, size_t __needle_len));
-# else
-# if ! @HAVE_DECL_MEMMEM@
-_GL_FUNCDECL_SYS (memmem, void *,
- (void const *__haystack, size_t __haystack_len,
- void const *__needle, size_t __needle_len)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 3)));
-# endif
-_GL_CXXALIAS_SYS (memmem, void *,
- (void const *__haystack, size_t __haystack_len,
- void const *__needle, size_t __needle_len));
-# endif
-_GL_CXXALIASWARN (memmem);
-#elif defined GNULIB_POSIXCHECK
-# undef memmem
-# if HAVE_RAW_DECL_MEMMEM
-_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
- "use gnulib module memmem-simple for portability, "
- "and module memmem for speed" );
-# endif
-#endif
-
-/* Copy N bytes of SRC to DEST, return pointer to bytes after the
- last written byte. */
-#if @GNULIB_MEMPCPY@
-# if ! @HAVE_MEMPCPY@
-_GL_FUNCDECL_SYS (mempcpy, void *,
- (void *restrict __dest, void const *restrict __src,
- size_t __n)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (mempcpy, void *,
- (void *restrict __dest, void const *restrict __src,
- size_t __n));
-_GL_CXXALIASWARN (mempcpy);
-#elif defined GNULIB_POSIXCHECK
-# undef mempcpy
-# if HAVE_RAW_DECL_MEMPCPY
-_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
- "use gnulib module mempcpy for portability");
-# endif
-#endif
-
-/* Search backwards through a block for a byte (specified as an int). */
-#if @GNULIB_MEMRCHR@
-# if ! @HAVE_DECL_MEMRCHR@
-_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-# endif
- /* On some systems, this function is defined as an overloaded function:
- extern "C++" { const void * std::memrchr (const void *, int, size_t); }
- extern "C++" { void * std::memrchr (void *, int, size_t); } */
-_GL_CXXALIAS_SYS_CAST2 (memrchr,
- void *, (void const *, int, size_t),
- void const *, (void const *, int, size_t));
-# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
- && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t));
-_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t));
-# else
-_GL_CXXALIASWARN (memrchr);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef memrchr
-# if HAVE_RAW_DECL_MEMRCHR
-_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
- "use gnulib module memrchr for portability");
-# endif
-#endif
-
-/* Find the first occurrence of C in S. More efficient than
- memchr(S,C,N), at the expense of undefined behavior if C does not
- occur within N bytes. */
-#if @GNULIB_RAWMEMCHR@
-# if ! @HAVE_RAWMEMCHR@
-_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-# endif
- /* On some systems, this function is defined as an overloaded function:
- extern "C++" { const void * std::rawmemchr (const void *, int); }
- extern "C++" { void * std::rawmemchr (void *, int); } */
-_GL_CXXALIAS_SYS_CAST2 (rawmemchr,
- void *, (void const *__s, int __c_in),
- void const *, (void const *__s, int __c_in));
-# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
- && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in));
-_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in));
-# else
-_GL_CXXALIASWARN (rawmemchr);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef rawmemchr
-# if HAVE_RAW_DECL_RAWMEMCHR
-_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
- "use gnulib module rawmemchr for portability");
-# endif
-#endif
-
-/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
-#if @GNULIB_STPCPY@
-# if ! @HAVE_STPCPY@
-_GL_FUNCDECL_SYS (stpcpy, char *,
- (char *restrict __dst, char const *restrict __src)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (stpcpy, char *,
- (char *restrict __dst, char const *restrict __src));
-_GL_CXXALIASWARN (stpcpy);
-#elif defined GNULIB_POSIXCHECK
-# undef stpcpy
-# if HAVE_RAW_DECL_STPCPY
-_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
- "use gnulib module stpcpy for portability");
-# endif
-#endif
-
-/* Copy no more than N bytes of SRC to DST, returning a pointer past the
- last non-NUL byte written into DST. */
-#if @GNULIB_STPNCPY@
-# if @REPLACE_STPNCPY@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef stpncpy
-# define stpncpy rpl_stpncpy
-# endif
-_GL_FUNCDECL_RPL (stpncpy, char *,
- (char *restrict __dst, char const *restrict __src,
- size_t __n)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (stpncpy, char *,
- (char *restrict __dst, char const *restrict __src,
- size_t __n));
-# else
-# if ! @HAVE_STPNCPY@
-_GL_FUNCDECL_SYS (stpncpy, char *,
- (char *restrict __dst, char const *restrict __src,
- size_t __n)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (stpncpy, char *,
- (char *restrict __dst, char const *restrict __src,
- size_t __n));
-# endif
-_GL_CXXALIASWARN (stpncpy);
-#elif defined GNULIB_POSIXCHECK
-# undef stpncpy
-# if HAVE_RAW_DECL_STPNCPY
-_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
- "use gnulib module stpncpy for portability");
-# endif
-#endif
-
-#if defined GNULIB_POSIXCHECK
-/* strchr() does not work with multibyte strings if the locale encoding is
- GB18030 and the character to be searched is a digit. */
-# undef strchr
-/* Assume strchr is always declared. */
-_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
- "in some multibyte locales - "
- "use mbschr if you care about internationalization");
-#endif
-
-/* Find the first occurrence of C in S or the final NUL byte. */
-#if @GNULIB_STRCHRNUL@
-# if @REPLACE_STRCHRNUL@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define strchrnul rpl_strchrnul
-# endif
-_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (strchrnul, char *,
- (const char *str, int ch));
-# else
-# if ! @HAVE_STRCHRNUL@
-_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-# endif
- /* On some systems, this function is defined as an overloaded function:
- extern "C++" { const char * std::strchrnul (const char *, int); }
- extern "C++" { char * std::strchrnul (char *, int); } */
-_GL_CXXALIAS_SYS_CAST2 (strchrnul,
- char *, (char const *__s, int __c_in),
- char const *, (char const *__s, int __c_in));
-# endif
-# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
- && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
-_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in));
-# else
-_GL_CXXALIASWARN (strchrnul);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef strchrnul
-# if HAVE_RAW_DECL_STRCHRNUL
-_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
- "use gnulib module strchrnul for portability");
-# endif
-#endif
-
-/* Duplicate S, returning an identical malloc'd string. */
-#if @GNULIB_STRDUP@
-# if @REPLACE_STRDUP@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef strdup
-# define strdup rpl_strdup
-# endif
-_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
-# else
-# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
- /* strdup exists as a function and as a macro. Get rid of the macro. */
-# undef strdup
-# endif
-# if !(@HAVE_DECL_STRDUP@ || defined strdup)
-_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
-# endif
-_GL_CXXALIASWARN (strdup);
-#elif defined GNULIB_POSIXCHECK
-# undef strdup
-# if HAVE_RAW_DECL_STRDUP
-_GL_WARN_ON_USE (strdup, "strdup is unportable - "
- "use gnulib module strdup for portability");
-# endif
-#endif
-
-/* Append no more than N characters from SRC onto DEST. */
-#if @GNULIB_STRNCAT@
-# if @REPLACE_STRNCAT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef strncat
-# define strncat rpl_strncat
-# endif
-_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n));
-# else
-_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n));
-# endif
-_GL_CXXALIASWARN (strncat);
-#elif defined GNULIB_POSIXCHECK
-# undef strncat
-# if HAVE_RAW_DECL_STRNCAT
-_GL_WARN_ON_USE (strncat, "strncat is unportable - "
- "use gnulib module strncat for portability");
-# endif
-#endif
-
-/* Return a newly allocated copy of at most N bytes of STRING. */
-#if @GNULIB_STRNDUP@
-# if @REPLACE_STRNDUP@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef strndup
-# define strndup rpl_strndup
-# endif
-_GL_FUNCDECL_RPL (strndup, char *, (char const *__s, size_t __n)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
-# else
-# if ! @HAVE_DECL_STRNDUP@
-_GL_FUNCDECL_SYS (strndup, char *, (char const *__s, size_t __n)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n));
-# endif
-_GL_CXXALIASWARN (strndup);
-#elif defined GNULIB_POSIXCHECK
-# undef strndup
-# if HAVE_RAW_DECL_STRNDUP
-_GL_WARN_ON_USE (strndup, "strndup is unportable - "
- "use gnulib module strndup for portability");
-# endif
-#endif
-
-/* Find the length (number of bytes) of STRING, but scan at most
- MAXLEN bytes. If no '\0' terminator is found in that many bytes,
- return MAXLEN. */
-#if @GNULIB_STRNLEN@
-# if @REPLACE_STRNLEN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef strnlen
-# define strnlen rpl_strnlen
-# endif
-_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen));
-# else
-# if ! @HAVE_DECL_STRNLEN@
-_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen));
-# endif
-_GL_CXXALIASWARN (strnlen);
-#elif defined GNULIB_POSIXCHECK
-# undef strnlen
-# if HAVE_RAW_DECL_STRNLEN
-_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
- "use gnulib module strnlen for portability");
-# endif
-#endif
-
-#if defined GNULIB_POSIXCHECK
-/* strcspn() assumes the second argument is a list of single-byte characters.
- Even in this simple case, it does not work with multibyte strings if the
- locale encoding is GB18030 and one of the characters to be searched is a
- digit. */
-# undef strcspn
-/* Assume strcspn is always declared. */
-_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
- "in multibyte locales - "
- "use mbscspn if you care about internationalization");
-#endif
-
-/* Find the first occurrence in S of any character in ACCEPT. */
-#if @GNULIB_STRPBRK@
-# if ! @HAVE_STRPBRK@
-_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2)));
-# endif
- /* On some systems, this function is defined as an overloaded function:
- extern "C" { const char * strpbrk (const char *, const char *); }
- extern "C++" { char * strpbrk (char *, const char *); } */
-_GL_CXXALIAS_SYS_CAST2 (strpbrk,
- char *, (char const *__s, char const *__accept),
- const char *, (char const *__s, char const *__accept));
-# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
- && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
-_GL_CXXALIASWARN1 (strpbrk, char const *,
- (char const *__s, char const *__accept));
-# else
-_GL_CXXALIASWARN (strpbrk);
-# endif
-# if defined GNULIB_POSIXCHECK
-/* strpbrk() assumes the second argument is a list of single-byte characters.
- Even in this simple case, it does not work with multibyte strings if the
- locale encoding is GB18030 and one of the characters to be searched is a
- digit. */
-# undef strpbrk
-_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
- "in multibyte locales - "
- "use mbspbrk if you care about internationalization");
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef strpbrk
-# if HAVE_RAW_DECL_STRPBRK
-_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
- "use gnulib module strpbrk for portability");
-# endif
-#endif
-
-#if defined GNULIB_POSIXCHECK
-/* strspn() assumes the second argument is a list of single-byte characters.
- Even in this simple case, it cannot work with multibyte strings. */
-# undef strspn
-/* Assume strspn is always declared. */
-_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
- "in multibyte locales - "
- "use mbsspn if you care about internationalization");
-#endif
-
-#if defined GNULIB_POSIXCHECK
-/* strrchr() does not work with multibyte strings if the locale encoding is
- GB18030 and the character to be searched is a digit. */
-# undef strrchr
-/* Assume strrchr is always declared. */
-_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
- "in some multibyte locales - "
- "use mbsrchr if you care about internationalization");
-#endif
-
-/* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
- If one is found, overwrite it with a NUL, and advance *STRINGP
- to point to the next char after it. Otherwise, set *STRINGP to NULL.
- If *STRINGP was already NULL, nothing happens.
- Return the old value of *STRINGP.
-
- This is a variant of strtok() that is multithread-safe and supports
- empty fields.
-
- Caveat: It modifies the original string.
- Caveat: These functions cannot be used on constant strings.
- Caveat: The identity of the delimiting character is lost.
- Caveat: It doesn't work with multibyte strings unless all of the delimiter
- characters are ASCII characters < 0x30.
-
- See also strtok_r(). */
-#if @GNULIB_STRSEP@
-# if ! @HAVE_STRSEP@
-_GL_FUNCDECL_SYS (strsep, char *,
- (char **restrict __stringp, char const *restrict __delim)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (strsep, char *,
- (char **restrict __stringp, char const *restrict __delim));
-_GL_CXXALIASWARN (strsep);
-# if defined GNULIB_POSIXCHECK
-# undef strsep
-_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
- "in multibyte locales - "
- "use mbssep if you care about internationalization");
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef strsep
-# if HAVE_RAW_DECL_STRSEP
-_GL_WARN_ON_USE (strsep, "strsep is unportable - "
- "use gnulib module strsep for portability");
-# endif
-#endif
-
-#if @GNULIB_STRSTR@
-# if @REPLACE_STRSTR@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define strstr rpl_strstr
-# endif
-_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
-# else
- /* On some systems, this function is defined as an overloaded function:
- extern "C++" { const char * strstr (const char *, const char *); }
- extern "C++" { char * strstr (char *, const char *); } */
-_GL_CXXALIAS_SYS_CAST2 (strstr,
- char *, (const char *haystack, const char *needle),
- const char *, (const char *haystack, const char *needle));
-# endif
-# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
- && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
-_GL_CXXALIASWARN1 (strstr, const char *,
- (const char *haystack, const char *needle));
-# else
-_GL_CXXALIASWARN (strstr);
-# endif
-#elif defined GNULIB_POSIXCHECK
-/* strstr() does not work with multibyte strings if the locale encoding is
- different from UTF-8:
- POSIX says that it operates on "strings", and "string" in POSIX is defined
- as a sequence of bytes, not of characters. */
-# undef strstr
-/* Assume strstr is always declared. */
-_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
- "work correctly on character strings in most "
- "multibyte locales - "
- "use mbsstr if you care about internationalization, "
- "or use strstr if you care about speed");
-#endif
-
-/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
- comparison. */
-#if @GNULIB_STRCASESTR@
-# if @REPLACE_STRCASESTR@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define strcasestr rpl_strcasestr
-# endif
-_GL_FUNCDECL_RPL (strcasestr, char *,
- (const char *haystack, const char *needle)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (strcasestr, char *,
- (const char *haystack, const char *needle));
-# else
-# if ! @HAVE_STRCASESTR@
-_GL_FUNCDECL_SYS (strcasestr, char *,
- (const char *haystack, const char *needle)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2)));
-# endif
- /* On some systems, this function is defined as an overloaded function:
- extern "C++" { const char * strcasestr (const char *, const char *); }
- extern "C++" { char * strcasestr (char *, const char *); } */
-_GL_CXXALIAS_SYS_CAST2 (strcasestr,
- char *, (const char *haystack, const char *needle),
- const char *, (const char *haystack, const char *needle));
-# endif
-# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
- && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle));
-_GL_CXXALIASWARN1 (strcasestr, const char *,
- (const char *haystack, const char *needle));
-# else
-_GL_CXXALIASWARN (strcasestr);
-# endif
-#elif defined GNULIB_POSIXCHECK
-/* strcasestr() does not work with multibyte strings:
- It is a glibc extension, and glibc implements it only for unibyte
- locales. */
-# undef strcasestr
-# if HAVE_RAW_DECL_STRCASESTR
-_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
- "strings in multibyte locales - "
- "use mbscasestr if you care about "
- "internationalization, or use c-strcasestr if you want "
- "a locale independent function");
-# endif
-#endif
-
-/* Parse S into tokens separated by characters in DELIM.
- If S is NULL, the saved pointer in SAVE_PTR is used as
- the next starting point. For example:
- char s[] = "-abc-=-def";
- char *sp;
- x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
- x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
- x = strtok_r(NULL, "=", &sp); // x = NULL
- // s = "abc\0-def\0"
-
- This is a variant of strtok() that is multithread-safe.
-
- For the POSIX documentation for this function, see:
- http://www.opengroup.org/susv3xsh/strtok.html
-
- Caveat: It modifies the original string.
- Caveat: These functions cannot be used on constant strings.
- Caveat: The identity of the delimiting character is lost.
- Caveat: It doesn't work with multibyte strings unless all of the delimiter
- characters are ASCII characters < 0x30.
-
- See also strsep(). */
-#if @GNULIB_STRTOK_R@
-# if @REPLACE_STRTOK_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef strtok_r
-# define strtok_r rpl_strtok_r
-# endif
-_GL_FUNCDECL_RPL (strtok_r, char *,
- (char *restrict s, char const *restrict delim,
- char **restrict save_ptr)
- _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (strtok_r, char *,
- (char *restrict s, char const *restrict delim,
- char **restrict save_ptr));
-# else
-# if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
-# undef strtok_r
-# endif
-# if ! @HAVE_DECL_STRTOK_R@
-_GL_FUNCDECL_SYS (strtok_r, char *,
- (char *restrict s, char const *restrict delim,
- char **restrict save_ptr)
- _GL_ARG_NONNULL ((2, 3)));
-# endif
-_GL_CXXALIAS_SYS (strtok_r, char *,
- (char *restrict s, char const *restrict delim,
- char **restrict save_ptr));
-# endif
-_GL_CXXALIASWARN (strtok_r);
-# if defined GNULIB_POSIXCHECK
-_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
- "strings in multibyte locales - "
- "use mbstok_r if you care about internationalization");
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef strtok_r
-# if HAVE_RAW_DECL_STRTOK_R
-_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
- "use gnulib module strtok_r for portability");
-# endif
-#endif
-
-
-/* The following functions are not specified by POSIX. They are gnulib
- extensions. */
-
-#if @GNULIB_MBSLEN@
-/* Return the number of multibyte characters in the character string STRING.
- This considers multibyte characters, unlike strlen, which counts bytes. */
-# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */
-# undef mbslen
-# endif
-# if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define mbslen rpl_mbslen
-# endif
-_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
-# else
-_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
-# endif
-_GL_CXXALIASWARN (mbslen);
-#endif
-
-#if @GNULIB_MBSNLEN@
-/* Return the number of multibyte characters in the character string starting
- at STRING and ending at STRING + LEN. */
-_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1));
-#endif
-
-#if @GNULIB_MBSCHR@
-/* Locate the first single-byte character C in the character string STRING,
- and return a pointer to it. Return NULL if C is not found in STRING.
- Unlike strchr(), this function works correctly in multibyte locales with
- encodings such as GB18030. */
-# if defined __hpux
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
-# endif
-_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
-# else
-_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
-# endif
-_GL_CXXALIASWARN (mbschr);
-#endif
-
-#if @GNULIB_MBSRCHR@
-/* Locate the last single-byte character C in the character string STRING,
- and return a pointer to it. Return NULL if C is not found in STRING.
- Unlike strrchr(), this function works correctly in multibyte locales with
- encodings such as GB18030. */
-# if defined __hpux || defined __INTERIX
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define mbsrchr rpl_mbsrchr /* avoid collision with system function */
-# endif
-_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
-# else
-_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
-# endif
-_GL_CXXALIASWARN (mbsrchr);
-#endif
-
-#if @GNULIB_MBSSTR@
-/* Find the first occurrence of the character string NEEDLE in the character
- string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK.
- Unlike strstr(), this function works correctly in multibyte locales with
- encodings different from UTF-8. */
-_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2));
-#endif
-
-#if @GNULIB_MBSCASECMP@
-/* Compare the character strings S1 and S2, ignoring case, returning less than,
- equal to or greater than zero if S1 is lexicographically less than, equal to
- or greater than S2.
- Note: This function may, in multibyte locales, return 0 for strings of
- different lengths!
- Unlike strcasecmp(), this function works correctly in multibyte locales. */
-_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2));
-#endif
-
-#if @GNULIB_MBSNCASECMP@
-/* Compare the initial segment of the character string S1 consisting of at most
- N characters with the initial segment of the character string S2 consisting
- of at most N characters, ignoring case, returning less than, equal to or
- greater than zero if the initial segment of S1 is lexicographically less
- than, equal to or greater than the initial segment of S2.
- Note: This function may, in multibyte locales, return 0 for initial segments
- of different lengths!
- Unlike strncasecmp(), this function works correctly in multibyte locales.
- But beware that N is not a byte count but a character count! */
-_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2));
-#endif
-
-#if @GNULIB_MBSPCASECMP@
-/* Compare the initial segment of the character string STRING consisting of
- at most mbslen (PREFIX) characters with the character string PREFIX,
- ignoring case. If the two match, return a pointer to the first byte
- after this prefix in STRING. Otherwise, return NULL.
- Note: This function may, in multibyte locales, return non-NULL if STRING
- is of smaller length than PREFIX!
- Unlike strncasecmp(), this function works correctly in multibyte
- locales. */
-_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2));
-#endif
-
-#if @GNULIB_MBSCASESTR@
-/* Find the first occurrence of the character string NEEDLE in the character
- string HAYSTACK, using case-insensitive comparison.
- Note: This function may, in multibyte locales, return success even if
- strlen (haystack) < strlen (needle) !
- Unlike strcasestr(), this function works correctly in multibyte locales. */
-_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2));
-#endif
-
-#if @GNULIB_MBSCSPN@
-/* Find the first occurrence in the character string STRING of any character
- in the character string ACCEPT. Return the number of bytes from the
- beginning of the string to this occurrence, or to the end of the string
- if none exists.
- Unlike strcspn(), this function works correctly in multibyte locales. */
-_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2));
-#endif
-
-#if @GNULIB_MBSPBRK@
-/* Find the first occurrence in the character string STRING of any character
- in the character string ACCEPT. Return the pointer to it, or NULL if none
- exists.
- Unlike strpbrk(), this function works correctly in multibyte locales. */
-# if defined __hpux
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
-# endif
-_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
-# else
-_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
-# endif
-_GL_CXXALIASWARN (mbspbrk);
-#endif
-
-#if @GNULIB_MBSSPN@
-/* Find the first occurrence in the character string STRING of any character
- not in the character string REJECT. Return the number of bytes from the
- beginning of the string to this occurrence, or to the end of the string
- if none exists.
- Unlike strspn(), this function works correctly in multibyte locales. */
-_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2));
-#endif
-
-#if @GNULIB_MBSSEP@
-/* Search the next delimiter (multibyte character listed in the character
- string DELIM) starting at the character string *STRINGP.
- If one is found, overwrite it with a NUL, and advance *STRINGP to point
- to the next multibyte character after it. Otherwise, set *STRINGP to NULL.
- If *STRINGP was already NULL, nothing happens.
- Return the old value of *STRINGP.
-
- This is a variant of mbstok_r() that supports empty fields.
-
- Caveat: It modifies the original string.
- Caveat: These functions cannot be used on constant strings.
- Caveat: The identity of the delimiting character is lost.
-
- See also mbstok_r(). */
-_GL_EXTERN_C char * mbssep (char **stringp, const char *delim)
- _GL_ARG_NONNULL ((1, 2));
-#endif
-
-#if @GNULIB_MBSTOK_R@
-/* Parse the character string STRING into tokens separated by characters in
- the character string DELIM.
- If STRING is NULL, the saved pointer in SAVE_PTR is used as
- the next starting point. For example:
- char s[] = "-abc-=-def";
- char *sp;
- x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def"
- x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL
- x = mbstok_r(NULL, "=", &sp); // x = NULL
- // s = "abc\0-def\0"
-
- Caveat: It modifies the original string.
- Caveat: These functions cannot be used on constant strings.
- Caveat: The identity of the delimiting character is lost.
-
- See also mbssep(). */
-_GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr)
- _GL_ARG_NONNULL ((2, 3));
-#endif
-
-/* Map any int, typically from errno, into an error message. */
-#if @GNULIB_STRERROR@
-# if @REPLACE_STRERROR@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef strerror
-# define strerror rpl_strerror
-# endif
-_GL_FUNCDECL_RPL (strerror, char *, (int));
-_GL_CXXALIAS_RPL (strerror, char *, (int));
-# else
-_GL_CXXALIAS_SYS (strerror, char *, (int));
-# endif
-_GL_CXXALIASWARN (strerror);
-#elif defined GNULIB_POSIXCHECK
-# undef strerror
-/* Assume strerror is always declared. */
-_GL_WARN_ON_USE (strerror, "strerror is unportable - "
- "use gnulib module strerror to guarantee non-NULL result");
-#endif
-
-/* Map any int, typically from errno, into an error message. Multithread-safe.
- Uses the POSIX declaration, not the glibc declaration. */
-#if @GNULIB_STRERROR_R@
-# if @REPLACE_STRERROR_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef strerror_r
-# define strerror_r rpl_strerror_r
-# endif
-_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
-# else
-# if !@HAVE_DECL_STRERROR_R@
-_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
-# endif
-# if @HAVE_DECL_STRERROR_R@
-_GL_CXXALIASWARN (strerror_r);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef strerror_r
-# if HAVE_RAW_DECL_STRERROR_R
-_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
- "use gnulib module strerror_r-posix for portability");
-# endif
-#endif
-
-#if @GNULIB_STRSIGNAL@
-# if @REPLACE_STRSIGNAL@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define strsignal rpl_strsignal
-# endif
-_GL_FUNCDECL_RPL (strsignal, char *, (int __sig));
-_GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
-# else
-# if ! @HAVE_DECL_STRSIGNAL@
-_GL_FUNCDECL_SYS (strsignal, char *, (int __sig));
-# endif
-/* Need to cast, because on Cygwin 1.5.x systems, the return type is
- 'const char *'. */
-_GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig));
-# endif
-_GL_CXXALIASWARN (strsignal);
-#elif defined GNULIB_POSIXCHECK
-# undef strsignal
-# if HAVE_RAW_DECL_STRSIGNAL
-_GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
- "use gnulib module strsignal for portability");
-# endif
-#endif
-
-#if @GNULIB_STRVERSCMP@
-# if !@HAVE_STRVERSCMP@
-_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
-_GL_CXXALIASWARN (strverscmp);
-#elif defined GNULIB_POSIXCHECK
-# undef strverscmp
-# if HAVE_RAW_DECL_STRVERSCMP
-_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
- "use gnulib module strverscmp for portability");
-# endif
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_STRING_H */
-#endif /* _@GUARD_PREFIX@_STRING_H */
-#endif
diff --git a/src/gl/stripslash.c b/src/gl/stripslash.c
deleted file mode 100644
index 0453e36cc6..0000000000
--- a/src/gl/stripslash.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* stripslash.c -- remove redundant trailing slashes from a file name
-
- Copyright (C) 1990, 2001, 2003-2006, 2009-2016 Free Software Foundation,
- Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include "dirname.h"
-
-/* Remove trailing slashes from FILE. Return true if a trailing slash
- was removed. This is useful when using file name completion from a
- shell that adds a "/" after directory names (such as tcsh and
- bash), because on symlinks to directories, several system calls
- have different semantics according to whether a trailing slash is
- present. */
-
-bool
-strip_trailing_slashes (char *file)
-{
- char *base = last_component (file);
- char *base_lim;
- bool had_slash;
-
- /* last_component returns "" for file system roots, but we need to turn
- "///" into "/". */
- if (! *base)
- base = file;
- base_lim = base + base_len (base);
- had_slash = (*base_lim != '\0');
- *base_lim = '\0';
- return had_slash;
-}
diff --git a/src/gl/sys_select.in.h b/src/gl/sys_select.in.h
deleted file mode 100644
index 9a2622f978..0000000000
--- a/src/gl/sys_select.in.h
+++ /dev/null
@@ -1,319 +0,0 @@
-/* Substitute for <sys/select.h>.
- Copyright (C) 2007-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-# if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-# endif
-@PRAGMA_COLUMNS@
-
-/* On OSF/1 and Solaris 2.6, <sys/types.h> and <sys/time.h>
- both include <sys/select.h>.
- On Cygwin, <sys/time.h> includes <sys/select.h>.
- Simply delegate to the system's header in this case. */
-#if (@HAVE_SYS_SELECT_H@ \
- && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H \
- && ((defined __osf__ && defined _SYS_TYPES_H_ \
- && defined _OSF_SOURCE) \
- || (defined __sun && defined _SYS_TYPES_H \
- && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
- || defined __EXTENSIONS__))))
-
-# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
-# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
-
-#elif (@HAVE_SYS_SELECT_H@ \
- && (defined _CYGWIN_SYS_TIME_H \
- || (!defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \
- && ((defined __osf__ && defined _SYS_TIME_H_ \
- && defined _OSF_SOURCE) \
- || (defined __sun && defined _SYS_TIME_H \
- && (! (defined _XOPEN_SOURCE \
- || defined _POSIX_C_SOURCE) \
- || defined __EXTENSIONS__))))))
-
-# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
-# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
-
-/* On IRIX 6.5, <sys/timespec.h> includes <sys/types.h>, which includes
- <sys/bsd_types.h>, which includes <sys/select.h>. At this point we cannot
- include <signal.h>, because that includes <internal/signal_core.h>, which
- gives a syntax error because <sys/timespec.h> has not been completely
- processed. Simply delegate to the system's header in this case. */
-#elif @HAVE_SYS_SELECT_H@ && defined __sgi && (defined _SYS_BSD_TYPES_H && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H)
-
-# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H
-# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
-
-/* On OpenBSD 5.0, <pthread.h> includes <sys/types.h>, which includes
- <sys/select.h>. At this point we cannot include <signal.h>, because that
- includes gnulib's pthread.h override, which gives a syntax error because
- /usr/include/pthread.h has not been completely processed. Simply delegate
- to the system's header in this case. */
-#elif @HAVE_SYS_SELECT_H@ && defined __OpenBSD__ && (defined _PTHREAD_H_ && !defined PTHREAD_MUTEX_INITIALIZER)
-
-# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
-
-#else
-
-#ifndef _@GUARD_PREFIX@_SYS_SELECT_H
-
-/* On many platforms, <sys/select.h> assumes prior inclusion of
- <sys/types.h>. Also, mingw defines sigset_t there, instead of
- in <signal.h> where it belongs. */
-#include <sys/types.h>
-
-#if @HAVE_SYS_SELECT_H@
-
-/* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
- of 'struct timeval', and no definition of this type.
- Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select()
- in <sys/time.h>.
- But avoid namespace pollution on glibc systems and "unknown type
- name" problems on Cygwin. */
-# if !(defined __GLIBC__ || defined __CYGWIN__)
-# include <sys/time.h>
-# endif
-
-/* On AIX 7 and Solaris 10, <sys/select.h> provides an FD_ZERO implementation
- that relies on memset(), but without including <string.h>.
- But in any case avoid namespace pollution on glibc systems. */
-# if (defined __OpenBSD__ || defined _AIX || defined __sun || defined __osf__ || defined __BEOS__) \
- && ! defined __GLIBC__
-# include <string.h>
-# endif
-
-/* The include_next requires a split double-inclusion guard. */
-# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
-
-#endif
-
-/* Get definition of 'sigset_t'.
- But avoid namespace pollution on glibc systems and "unknown type
- name" problems on Cygwin.
- Do this after the include_next (for the sake of OpenBSD 5.0) but before
- the split double-inclusion guard (for the sake of Solaris). */
-#if !((defined __GLIBC__ || defined __CYGWIN__) && !defined __UCLIBC__)
-# include <signal.h>
-#endif
-
-#ifndef _@GUARD_PREFIX@_SYS_SELECT_H
-#define _@GUARD_PREFIX@_SYS_SELECT_H
-
-#if !@HAVE_SYS_SELECT_H@
-/* A platform that lacks <sys/select.h>. */
-/* Get the 'struct timeval' and 'fd_set' types and the FD_* macros
- on most platforms. */
-# include <sys/time.h>
-/* On HP-UX 11, <sys/time.h> provides an FD_ZERO implementation
- that relies on memset(), but without including <string.h>. */
-# if defined __hpux
-# include <string.h>
-# endif
-/* On native Windows platforms:
- Get the 'fd_set' type.
- Get the close() declaration before we override it. */
-# if @HAVE_WINSOCK2_H@
-# if !defined _GL_INCLUDING_WINSOCK2_H
-# define _GL_INCLUDING_WINSOCK2_H
-# include <winsock2.h>
-# undef _GL_INCLUDING_WINSOCK2_H
-# endif
-# include <io.h>
-# endif
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-
-/* Fix some definitions from <winsock2.h>. */
-
-#if @HAVE_WINSOCK2_H@
-
-# if !GNULIB_defined_rpl_fd_isset
-
-/* Re-define FD_ISSET to avoid a WSA call while we are not using
- network sockets. */
-static int
-rpl_fd_isset (SOCKET fd, fd_set * set)
-{
- u_int i;
- if (set == NULL)
- return 0;
-
- for (i = 0; i < set->fd_count; i++)
- if (set->fd_array[i] == fd)
- return 1;
-
- return 0;
-}
-
-# define GNULIB_defined_rpl_fd_isset 1
-# endif
-
-# undef FD_ISSET
-# define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
-
-#endif
-
-/* Hide some function declarations from <winsock2.h>. */
-
-#if @HAVE_WINSOCK2_H@
-# if !defined _@GUARD_PREFIX@_UNISTD_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef close
-# define close close_used_without_including_unistd_h
-# else
- _GL_WARN_ON_USE (close,
- "close() used without including <unistd.h>");
-# endif
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gethostname
-# define gethostname gethostname_used_without_including_unistd_h
-# else
- _GL_WARN_ON_USE (gethostname,
- "gethostname() used without including <unistd.h>");
-# endif
-# endif
-# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef socket
-# define socket socket_used_without_including_sys_socket_h
-# undef connect
-# define connect connect_used_without_including_sys_socket_h
-# undef accept
-# define accept accept_used_without_including_sys_socket_h
-# undef bind
-# define bind bind_used_without_including_sys_socket_h
-# undef getpeername
-# define getpeername getpeername_used_without_including_sys_socket_h
-# undef getsockname
-# define getsockname getsockname_used_without_including_sys_socket_h
-# undef getsockopt
-# define getsockopt getsockopt_used_without_including_sys_socket_h
-# undef listen
-# define listen listen_used_without_including_sys_socket_h
-# undef recv
-# define recv recv_used_without_including_sys_socket_h
-# undef send
-# define send send_used_without_including_sys_socket_h
-# undef recvfrom
-# define recvfrom recvfrom_used_without_including_sys_socket_h
-# undef sendto
-# define sendto sendto_used_without_including_sys_socket_h
-# undef setsockopt
-# define setsockopt setsockopt_used_without_including_sys_socket_h
-# undef shutdown
-# define shutdown shutdown_used_without_including_sys_socket_h
-# else
- _GL_WARN_ON_USE (socket,
- "socket() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (connect,
- "connect() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (accept,
- "accept() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (bind,
- "bind() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (getpeername,
- "getpeername() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (getsockname,
- "getsockname() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (getsockopt,
- "getsockopt() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (listen,
- "listen() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (recv,
- "recv() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (send,
- "send() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (recvfrom,
- "recvfrom() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (sendto,
- "sendto() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (setsockopt,
- "setsockopt() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (shutdown,
- "shutdown() used without including <sys/socket.h>");
-# endif
-# endif
-#endif
-
-
-#if @GNULIB_PSELECT@
-# if @REPLACE_PSELECT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef pselect
-# define pselect rpl_pselect
-# endif
-_GL_FUNCDECL_RPL (pselect, int,
- (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
- struct timespec const *restrict, const sigset_t *restrict));
-_GL_CXXALIAS_RPL (pselect, int,
- (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
- struct timespec const *restrict, const sigset_t *restrict));
-# else
-# if !@HAVE_PSELECT@
-_GL_FUNCDECL_SYS (pselect, int,
- (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
- struct timespec const *restrict, const sigset_t *restrict));
-# endif
-_GL_CXXALIAS_SYS (pselect, int,
- (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
- struct timespec const *restrict, const sigset_t *restrict));
-# endif
-_GL_CXXALIASWARN (pselect);
-#elif defined GNULIB_POSIXCHECK
-# undef pselect
-# if HAVE_RAW_DECL_PSELECT
-_GL_WARN_ON_USE (pselect, "pselect is not portable - "
- "use gnulib module pselect for portability");
-# endif
-#endif
-
-#if @GNULIB_SELECT@
-# if @REPLACE_SELECT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef select
-# define select rpl_select
-# endif
-_GL_FUNCDECL_RPL (select, int,
- (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
- struct timeval *restrict));
-_GL_CXXALIAS_RPL (select, int,
- (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
- struct timeval *restrict));
-# else
-_GL_CXXALIAS_SYS (select, int,
- (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
- struct timeval *restrict));
-# endif
-_GL_CXXALIASWARN (select);
-#elif @HAVE_WINSOCK2_H@
-# undef select
-# define select select_used_without_requesting_gnulib_module_select
-#elif defined GNULIB_POSIXCHECK
-# undef select
-# if HAVE_RAW_DECL_SELECT
-_GL_WARN_ON_USE (select, "select is not always POSIX compliant - "
- "use gnulib module select for portability");
-# endif
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_SYS_SELECT_H */
-#endif /* _@GUARD_PREFIX@_SYS_SELECT_H */
-#endif /* OSF/1 */
diff --git a/src/gl/sys_socket.c b/src/gl/sys_socket.c
deleted file mode 100644
index 3b261da039..0000000000
--- a/src/gl/sys_socket.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <config.h>
-#define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE
-#include "sys/socket.h"
-typedef int dummy;
diff --git a/src/gl/sys_socket.in.h b/src/gl/sys_socket.in.h
deleted file mode 100644
index 1f148f4aa6..0000000000
--- a/src/gl/sys_socket.in.h
+++ /dev/null
@@ -1,697 +0,0 @@
-/* Provide a sys/socket header file for systems lacking it (read: MinGW)
- and for systems where it is incomplete.
- Copyright (C) 2005-2016 Free Software Foundation, Inc.
- Written by Simon Josefsson.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* This file is supposed to be used on platforms that lack <sys/socket.h>,
- on platforms where <sys/socket.h> cannot be included standalone, and on
- platforms where <sys/socket.h> does not provide all necessary definitions.
- It is intended to provide definitions and prototypes needed by an
- application. */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
-/* Special invocation convention:
- - On Cygwin 1.5.x we have a sequence of nested includes
- <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>,
- and the latter includes <sys/socket.h>. In this situation, the functions
- are not yet declared, therefore we cannot provide the C++ aliases. */
-
-#@INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
-
-#else
-/* Normal invocation convention. */
-
-#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
-
-#if @HAVE_SYS_SOCKET_H@
-
-# define _GL_ALREADY_INCLUDING_SYS_SOCKET_H
-
-/* On many platforms, <sys/socket.h> assumes prior inclusion of
- <sys/types.h>. */
-# include <sys/types.h>
-
-/* On FreeBSD 6.4, <sys/socket.h> defines some macros that assume that NULL
- is defined. */
-# include <stddef.h>
-
-/* The include_next requires a split double-inclusion guard. */
-# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
-
-# undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H
-
-#endif
-
-#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
-#define _@GUARD_PREFIX@_SYS_SOCKET_H
-
-#ifndef _GL_INLINE_HEADER_BEGIN
- #error "Please include config.h first."
-#endif
-_GL_INLINE_HEADER_BEGIN
-#ifndef _GL_SYS_SOCKET_INLINE
-# define _GL_SYS_SOCKET_INLINE _GL_INLINE
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-#if !@HAVE_SA_FAMILY_T@
-# if !GNULIB_defined_sa_family_t
-/* On OS/2 kLIBC, sa_family_t is unsigned char unless TCPV40HDRS is defined. */
-# if !defined __KLIBC__ || defined TCPV40HDRS
-typedef unsigned short sa_family_t;
-# else
-typedef unsigned char sa_family_t;
-# endif
-# define GNULIB_defined_sa_family_t 1
-# endif
-#endif
-
-#if @HAVE_STRUCT_SOCKADDR_STORAGE@
-/* Make the 'struct sockaddr_storage' field 'ss_family' visible on AIX 7.1. */
-# if !@HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@
-# ifndef ss_family
-# define ss_family __ss_family
-# endif
-# endif
-#else
-# include <stdalign.h>
-/* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
- 2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
-# define __ss_aligntype unsigned long int
-# define _SS_SIZE 256
-# define _SS_PADSIZE \
- (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype) \
- ? sizeof (sa_family_t) \
- : alignof (__ss_aligntype)) \
- + sizeof (__ss_aligntype)))
-
-# if !GNULIB_defined_struct_sockaddr_storage
-struct sockaddr_storage
-{
- sa_family_t ss_family; /* Address family, etc. */
- __ss_aligntype __ss_align; /* Force desired alignment. */
- char __ss_padding[_SS_PADSIZE];
-};
-# define GNULIB_defined_struct_sockaddr_storage 1
-# endif
-
-#endif
-
-/* Get struct iovec. */
-/* But avoid namespace pollution on glibc systems. */
-#if ! defined __GLIBC__
-# include <sys/uio.h>
-#endif
-
-#if @HAVE_SYS_SOCKET_H@
-
-/* A platform that has <sys/socket.h>. */
-
-/* For shutdown(). */
-# if !defined SHUT_RD
-# define SHUT_RD 0
-# endif
-# if !defined SHUT_WR
-# define SHUT_WR 1
-# endif
-# if !defined SHUT_RDWR
-# define SHUT_RDWR 2
-# endif
-
-#else
-
-# ifdef __CYGWIN__
-# error "Cygwin does have a sys/socket.h, doesn't it?!?"
-# endif
-
-/* A platform that lacks <sys/socket.h>.
-
- Currently only MinGW is supported. See the gnulib manual regarding
- Windows sockets. MinGW has the header files winsock2.h and
- ws2tcpip.h that declare the sys/socket.h definitions we need. Note
- that you can influence which definitions you get by setting the
- WINVER symbol before including these two files. For example,
- getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
- symbol is set indirectly through WINVER). You can set this by
- adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
- code may not run on older Windows releases then. My Windows 2000
- box was not able to run the code, for example. The situation is
- slightly confusing because
- <http://msdn.microsoft.com/en-us/library/ms738520>
- suggests that getaddrinfo should be available on all Windows
- releases. */
-
-# if @HAVE_WINSOCK2_H@
-# include <winsock2.h>
-# endif
-# if @HAVE_WS2TCPIP_H@
-# include <ws2tcpip.h>
-# endif
-
-/* For shutdown(). */
-# if !defined SHUT_RD && defined SD_RECEIVE
-# define SHUT_RD SD_RECEIVE
-# endif
-# if !defined SHUT_WR && defined SD_SEND
-# define SHUT_WR SD_SEND
-# endif
-# if !defined SHUT_RDWR && defined SD_BOTH
-# define SHUT_RDWR SD_BOTH
-# endif
-
-# if @HAVE_WINSOCK2_H@
-/* Include headers needed by the emulation code. */
-# include <sys/types.h>
-# include <io.h>
-
-# if !GNULIB_defined_socklen_t
-typedef int socklen_t;
-# define GNULIB_defined_socklen_t 1
-# endif
-
-# endif
-
-/* Rudimentary 'struct msghdr'; this works as long as you don't try to
- access msg_control or msg_controllen. */
-struct msghdr {
- void *msg_name;
- socklen_t msg_namelen;
- struct iovec *msg_iov;
- int msg_iovlen;
- int msg_flags;
-};
-
-#endif
-
-/* Fix some definitions from <winsock2.h>. */
-
-#if @HAVE_WINSOCK2_H@
-
-# if !GNULIB_defined_rpl_fd_isset
-
-/* Re-define FD_ISSET to avoid a WSA call while we are not using
- network sockets. */
-_GL_SYS_SOCKET_INLINE int
-rpl_fd_isset (SOCKET fd, fd_set * set)
-{
- u_int i;
- if (set == NULL)
- return 0;
-
- for (i = 0; i < set->fd_count; i++)
- if (set->fd_array[i] == fd)
- return 1;
-
- return 0;
-}
-
-# define GNULIB_defined_rpl_fd_isset 1
-# endif
-
-# undef FD_ISSET
-# define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
-
-#endif
-
-/* Hide some function declarations from <winsock2.h>. */
-
-#if @HAVE_WINSOCK2_H@
-# if !defined _@GUARD_PREFIX@_UNISTD_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef close
-# define close close_used_without_including_unistd_h
-# else
- _GL_WARN_ON_USE (close,
- "close() used without including <unistd.h>");
-# endif
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gethostname
-# define gethostname gethostname_used_without_including_unistd_h
-# else
- _GL_WARN_ON_USE (gethostname,
- "gethostname() used without including <unistd.h>");
-# endif
-# endif
-# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef select
-# define select select_used_without_including_sys_select_h
-# else
- _GL_WARN_ON_USE (select,
- "select() used without including <sys/select.h>");
-# endif
-# endif
-#endif
-
-/* Wrap everything else to use libc file descriptors for sockets. */
-
-#if @GNULIB_SOCKET@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef socket
-# define socket rpl_socket
-# endif
-_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol));
-_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol));
-# else
-_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol));
-# endif
-_GL_CXXALIASWARN (socket);
-#elif @HAVE_WINSOCK2_H@
-# undef socket
-# define socket socket_used_without_requesting_gnulib_module_socket
-#elif defined GNULIB_POSIXCHECK
-# undef socket
-# if HAVE_RAW_DECL_SOCKET
-_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
- "use gnulib module socket for portability");
-# endif
-#endif
-
-#if @GNULIB_CONNECT@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef connect
-# define connect rpl_connect
-# endif
-_GL_FUNCDECL_RPL (connect, int,
- (int fd, const struct sockaddr *addr, socklen_t addrlen)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (connect, int,
- (int fd, const struct sockaddr *addr, socklen_t addrlen));
-# else
-/* Need to cast, because on NonStop Kernel, the third parameter is
- size_t addrlen. */
-_GL_CXXALIAS_SYS_CAST (connect, int,
- (int fd,
- const struct sockaddr *addr, socklen_t addrlen));
-# endif
-_GL_CXXALIASWARN (connect);
-#elif @HAVE_WINSOCK2_H@
-# undef connect
-# define connect socket_used_without_requesting_gnulib_module_connect
-#elif defined GNULIB_POSIXCHECK
-# undef connect
-# if HAVE_RAW_DECL_CONNECT
-_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
- "use gnulib module connect for portability");
-# endif
-#endif
-
-#if @GNULIB_ACCEPT@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef accept
-# define accept rpl_accept
-# endif
-_GL_FUNCDECL_RPL (accept, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
-_GL_CXXALIAS_RPL (accept, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
-# else
-/* Need to cast, because on Solaris 10 systems, the third parameter is
- void *addrlen. */
-_GL_CXXALIAS_SYS_CAST (accept, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
-# endif
-_GL_CXXALIASWARN (accept);
-#elif @HAVE_WINSOCK2_H@
-# undef accept
-# define accept accept_used_without_requesting_gnulib_module_accept
-#elif defined GNULIB_POSIXCHECK
-# undef accept
-# if HAVE_RAW_DECL_ACCEPT
-_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
- "use gnulib module accept for portability");
-# endif
-#endif
-
-#if @GNULIB_BIND@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef bind
-# define bind rpl_bind
-# endif
-_GL_FUNCDECL_RPL (bind, int,
- (int fd, const struct sockaddr *addr, socklen_t addrlen)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (bind, int,
- (int fd, const struct sockaddr *addr, socklen_t addrlen));
-# else
-/* Need to cast, because on NonStop Kernel, the third parameter is
- size_t addrlen. */
-_GL_CXXALIAS_SYS_CAST (bind, int,
- (int fd,
- const struct sockaddr *addr, socklen_t addrlen));
-# endif
-_GL_CXXALIASWARN (bind);
-#elif @HAVE_WINSOCK2_H@
-# undef bind
-# define bind bind_used_without_requesting_gnulib_module_bind
-#elif defined GNULIB_POSIXCHECK
-# undef bind
-# if HAVE_RAW_DECL_BIND
-_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
- "use gnulib module bind for portability");
-# endif
-#endif
-
-#if @GNULIB_GETPEERNAME@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef getpeername
-# define getpeername rpl_getpeername
-# endif
-_GL_FUNCDECL_RPL (getpeername, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen)
- _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (getpeername, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
-# else
-/* Need to cast, because on Solaris 10 systems, the third parameter is
- void *addrlen. */
-_GL_CXXALIAS_SYS_CAST (getpeername, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
-# endif
-_GL_CXXALIASWARN (getpeername);
-#elif @HAVE_WINSOCK2_H@
-# undef getpeername
-# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
-#elif defined GNULIB_POSIXCHECK
-# undef getpeername
-# if HAVE_RAW_DECL_GETPEERNAME
-_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
- "use gnulib module getpeername for portability");
-# endif
-#endif
-
-#if @GNULIB_GETSOCKNAME@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef getsockname
-# define getsockname rpl_getsockname
-# endif
-_GL_FUNCDECL_RPL (getsockname, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen)
- _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (getsockname, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
-# else
-/* Need to cast, because on Solaris 10 systems, the third parameter is
- void *addrlen. */
-_GL_CXXALIAS_SYS_CAST (getsockname, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
-# endif
-_GL_CXXALIASWARN (getsockname);
-#elif @HAVE_WINSOCK2_H@
-# undef getsockname
-# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
-#elif defined GNULIB_POSIXCHECK
-# undef getsockname
-# if HAVE_RAW_DECL_GETSOCKNAME
-_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
- "use gnulib module getsockname for portability");
-# endif
-#endif
-
-#if @GNULIB_GETSOCKOPT@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef getsockopt
-# define getsockopt rpl_getsockopt
-# endif
-_GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname,
- void *optval, socklen_t *optlen)
- _GL_ARG_NONNULL ((4, 5)));
-_GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname,
- void *optval, socklen_t *optlen));
-# else
-/* Need to cast, because on Solaris 10 systems, the fifth parameter is
- void *optlen. */
-_GL_CXXALIAS_SYS_CAST (getsockopt, int, (int fd, int level, int optname,
- void *optval, socklen_t *optlen));
-# endif
-_GL_CXXALIASWARN (getsockopt);
-#elif @HAVE_WINSOCK2_H@
-# undef getsockopt
-# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
-#elif defined GNULIB_POSIXCHECK
-# undef getsockopt
-# if HAVE_RAW_DECL_GETSOCKOPT
-_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
- "use gnulib module getsockopt for portability");
-# endif
-#endif
-
-#if @GNULIB_LISTEN@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef listen
-# define listen rpl_listen
-# endif
-_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog));
-_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog));
-# else
-_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog));
-# endif
-_GL_CXXALIASWARN (listen);
-#elif @HAVE_WINSOCK2_H@
-# undef listen
-# define listen listen_used_without_requesting_gnulib_module_listen
-#elif defined GNULIB_POSIXCHECK
-# undef listen
-# if HAVE_RAW_DECL_LISTEN
-_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
- "use gnulib module listen for portability");
-# endif
-#endif
-
-#if @GNULIB_RECV@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef recv
-# define recv rpl_recv
-# endif
-_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
-# else
-_GL_CXXALIAS_SYS (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
-# endif
-_GL_CXXALIASWARN (recv);
-#elif @HAVE_WINSOCK2_H@
-# undef recv
-# define recv recv_used_without_requesting_gnulib_module_recv
-#elif defined GNULIB_POSIXCHECK
-# undef recv
-# if HAVE_RAW_DECL_RECV
-_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
- "use gnulib module recv for portability");
-# endif
-#endif
-
-#if @GNULIB_SEND@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef send
-# define send rpl_send
-# endif
-_GL_FUNCDECL_RPL (send, ssize_t,
- (int fd, const void *buf, size_t len, int flags)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (send, ssize_t,
- (int fd, const void *buf, size_t len, int flags));
-# else
-_GL_CXXALIAS_SYS (send, ssize_t,
- (int fd, const void *buf, size_t len, int flags));
-# endif
-_GL_CXXALIASWARN (send);
-#elif @HAVE_WINSOCK2_H@
-# undef send
-# define send send_used_without_requesting_gnulib_module_send
-#elif defined GNULIB_POSIXCHECK
-# undef send
-# if HAVE_RAW_DECL_SEND
-_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
- "use gnulib module send for portability");
-# endif
-#endif
-
-#if @GNULIB_RECVFROM@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef recvfrom
-# define recvfrom rpl_recvfrom
-# endif
-_GL_FUNCDECL_RPL (recvfrom, ssize_t,
- (int fd, void *buf, size_t len, int flags,
- struct sockaddr *from, socklen_t *fromlen)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (recvfrom, ssize_t,
- (int fd, void *buf, size_t len, int flags,
- struct sockaddr *from, socklen_t *fromlen));
-# else
-/* Need to cast, because on Solaris 10 systems, the sixth parameter is
- void *fromlen. */
-_GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
- (int fd, void *buf, size_t len, int flags,
- struct sockaddr *from, socklen_t *fromlen));
-# endif
-_GL_CXXALIASWARN (recvfrom);
-#elif @HAVE_WINSOCK2_H@
-# undef recvfrom
-# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
-#elif defined GNULIB_POSIXCHECK
-# undef recvfrom
-# if HAVE_RAW_DECL_RECVFROM
-_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
- "use gnulib module recvfrom for portability");
-# endif
-#endif
-
-#if @GNULIB_SENDTO@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef sendto
-# define sendto rpl_sendto
-# endif
-_GL_FUNCDECL_RPL (sendto, ssize_t,
- (int fd, const void *buf, size_t len, int flags,
- const struct sockaddr *to, socklen_t tolen)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (sendto, ssize_t,
- (int fd, const void *buf, size_t len, int flags,
- const struct sockaddr *to, socklen_t tolen));
-# else
-/* Need to cast, because on NonStop Kernel, the sixth parameter is
- size_t tolen. */
-_GL_CXXALIAS_SYS_CAST (sendto, ssize_t,
- (int fd, const void *buf, size_t len, int flags,
- const struct sockaddr *to, socklen_t tolen));
-# endif
-_GL_CXXALIASWARN (sendto);
-#elif @HAVE_WINSOCK2_H@
-# undef sendto
-# define sendto sendto_used_without_requesting_gnulib_module_sendto
-#elif defined GNULIB_POSIXCHECK
-# undef sendto
-# if HAVE_RAW_DECL_SENDTO
-_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
- "use gnulib module sendto for portability");
-# endif
-#endif
-
-#if @GNULIB_SETSOCKOPT@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef setsockopt
-# define setsockopt rpl_setsockopt
-# endif
-_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
- const void * optval, socklen_t optlen)
- _GL_ARG_NONNULL ((4)));
-_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
- const void * optval, socklen_t optlen));
-# else
-/* Need to cast, because on NonStop Kernel, the fifth parameter is
- size_t optlen. */
-_GL_CXXALIAS_SYS_CAST (setsockopt, int,
- (int fd, int level, int optname,
- const void * optval, socklen_t optlen));
-# endif
-_GL_CXXALIASWARN (setsockopt);
-#elif @HAVE_WINSOCK2_H@
-# undef setsockopt
-# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
-#elif defined GNULIB_POSIXCHECK
-# undef setsockopt
-# if HAVE_RAW_DECL_SETSOCKOPT
-_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
- "use gnulib module setsockopt for portability");
-# endif
-#endif
-
-#if @GNULIB_SHUTDOWN@
-# if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef shutdown
-# define shutdown rpl_shutdown
-# endif
-_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how));
-_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how));
-# else
-_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how));
-# endif
-_GL_CXXALIASWARN (shutdown);
-#elif @HAVE_WINSOCK2_H@
-# undef shutdown
-# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
-#elif defined GNULIB_POSIXCHECK
-# undef shutdown
-# if HAVE_RAW_DECL_SHUTDOWN
-_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
- "use gnulib module shutdown for portability");
-# endif
-#endif
-
-#if @GNULIB_ACCEPT4@
-/* Accept a connection on a socket, with specific opening flags.
- The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
- and O_TEXT, O_BINARY (defined in "binary-io.h").
- See also the Linux man page at
- <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */
-# if @HAVE_ACCEPT4@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define accept4 rpl_accept4
-# endif
-_GL_FUNCDECL_RPL (accept4, int,
- (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
- int flags));
-_GL_CXXALIAS_RPL (accept4, int,
- (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
- int flags));
-# else
-_GL_FUNCDECL_SYS (accept4, int,
- (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
- int flags));
-_GL_CXXALIAS_SYS (accept4, int,
- (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
- int flags));
-# endif
-_GL_CXXALIASWARN (accept4);
-#elif defined GNULIB_POSIXCHECK
-# undef accept4
-# if HAVE_RAW_DECL_ACCEPT4
-_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
- "use gnulib module accept4 for portability");
-# endif
-#endif
-
-_GL_INLINE_HEADER_END
-
-#endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
-#endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
-#endif
diff --git a/src/gl/sys_stat.in.h b/src/gl/sys_stat.in.h
deleted file mode 100644
index 72d9537420..0000000000
--- a/src/gl/sys_stat.in.h
+++ /dev/null
@@ -1,732 +0,0 @@
-/* Provide a more complete sys/stat header file.
- Copyright (C) 2005-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
-
-/* This file is supposed to be used on platforms where <sys/stat.h> is
- incomplete. It is intended to provide definitions and prototypes
- needed by an application. Start with what the system provides. */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if defined __need_system_sys_stat_h
-/* Special invocation convention. */
-
-#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
-
-#else
-/* Normal invocation convention. */
-
-#ifndef _@GUARD_PREFIX@_SYS_STAT_H
-
-/* Get nlink_t.
- May also define off_t to a 64-bit type on native Windows. */
-#include <sys/types.h>
-
-/* Get struct timespec. */
-#include <time.h>
-
-/* The include_next requires a split double-inclusion guard. */
-#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
-
-#ifndef _@GUARD_PREFIX@_SYS_STAT_H
-#define _@GUARD_PREFIX@_SYS_STAT_H
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
- headers that may declare mkdir(). Native Windows platforms declare mkdir
- in <io.h> and/or <direct.h>, not in <unistd.h>. */
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# include <io.h> /* mingw32, mingw64 */
-# include <direct.h> /* mingw64, MSVC 9 */
-#endif
-
-/* Native Windows platforms declare umask() in <io.h>. */
-#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
-# include <io.h>
-#endif
-
-/* Large File Support on native Windows. */
-#if @WINDOWS_64_BIT_ST_SIZE@
-# define stat _stati64
-#endif
-
-#ifndef S_IFIFO
-# ifdef _S_IFIFO
-# define S_IFIFO _S_IFIFO
-# endif
-#endif
-
-#ifndef S_IFMT
-# define S_IFMT 0170000
-#endif
-
-#if STAT_MACROS_BROKEN
-# undef S_ISBLK
-# undef S_ISCHR
-# undef S_ISDIR
-# undef S_ISFIFO
-# undef S_ISLNK
-# undef S_ISNAM
-# undef S_ISMPB
-# undef S_ISMPC
-# undef S_ISNWK
-# undef S_ISREG
-# undef S_ISSOCK
-#endif
-
-#ifndef S_ISBLK
-# ifdef S_IFBLK
-# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-# else
-# define S_ISBLK(m) 0
-# endif
-#endif
-
-#ifndef S_ISCHR
-# ifdef S_IFCHR
-# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-# else
-# define S_ISCHR(m) 0
-# endif
-#endif
-
-#ifndef S_ISDIR
-# ifdef S_IFDIR
-# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-# else
-# define S_ISDIR(m) 0
-# endif
-#endif
-
-#ifndef S_ISDOOR /* Solaris 2.5 and up */
-# define S_ISDOOR(m) 0
-#endif
-
-#ifndef S_ISFIFO
-# ifdef S_IFIFO
-# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-# else
-# define S_ISFIFO(m) 0
-# endif
-#endif
-
-#ifndef S_ISLNK
-# ifdef S_IFLNK
-# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-# else
-# define S_ISLNK(m) 0
-# endif
-#endif
-
-#ifndef S_ISMPB /* V7 */
-# ifdef S_IFMPB
-# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
-# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
-# else
-# define S_ISMPB(m) 0
-# define S_ISMPC(m) 0
-# endif
-#endif
-
-#ifndef S_ISMPX /* AIX */
-# define S_ISMPX(m) 0
-#endif
-
-#ifndef S_ISNAM /* Xenix */
-# ifdef S_IFNAM
-# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
-# else
-# define S_ISNAM(m) 0
-# endif
-#endif
-
-#ifndef S_ISNWK /* HP/UX */
-# ifdef S_IFNWK
-# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
-# else
-# define S_ISNWK(m) 0
-# endif
-#endif
-
-#ifndef S_ISPORT /* Solaris 10 and up */
-# define S_ISPORT(m) 0
-#endif
-
-#ifndef S_ISREG
-# ifdef S_IFREG
-# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-# else
-# define S_ISREG(m) 0
-# endif
-#endif
-
-#ifndef S_ISSOCK
-# ifdef S_IFSOCK
-# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-# else
-# define S_ISSOCK(m) 0
-# endif
-#endif
-
-
-#ifndef S_TYPEISMQ
-# define S_TYPEISMQ(p) 0
-#endif
-
-#ifndef S_TYPEISTMO
-# define S_TYPEISTMO(p) 0
-#endif
-
-
-#ifndef S_TYPEISSEM
-# ifdef S_INSEM
-# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
-# else
-# define S_TYPEISSEM(p) 0
-# endif
-#endif
-
-#ifndef S_TYPEISSHM
-# ifdef S_INSHD
-# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
-# else
-# define S_TYPEISSHM(p) 0
-# endif
-#endif
-
-/* high performance ("contiguous data") */
-#ifndef S_ISCTG
-# define S_ISCTG(p) 0
-#endif
-
-/* Cray DMF (data migration facility): off line, with data */
-#ifndef S_ISOFD
-# define S_ISOFD(p) 0
-#endif
-
-/* Cray DMF (data migration facility): off line, with no data */
-#ifndef S_ISOFL
-# define S_ISOFL(p) 0
-#endif
-
-/* 4.4BSD whiteout */
-#ifndef S_ISWHT
-# define S_ISWHT(m) 0
-#endif
-
-/* If any of the following are undefined,
- define them to their de facto standard values. */
-#if !S_ISUID
-# define S_ISUID 04000
-#endif
-#if !S_ISGID
-# define S_ISGID 02000
-#endif
-
-/* S_ISVTX is a common extension to POSIX. */
-#ifndef S_ISVTX
-# define S_ISVTX 01000
-#endif
-
-#if !S_IRUSR && S_IREAD
-# define S_IRUSR S_IREAD
-#endif
-#if !S_IRUSR
-# define S_IRUSR 00400
-#endif
-#if !S_IRGRP
-# define S_IRGRP (S_IRUSR >> 3)
-#endif
-#if !S_IROTH
-# define S_IROTH (S_IRUSR >> 6)
-#endif
-
-#if !S_IWUSR && S_IWRITE
-# define S_IWUSR S_IWRITE
-#endif
-#if !S_IWUSR
-# define S_IWUSR 00200
-#endif
-#if !S_IWGRP
-# define S_IWGRP (S_IWUSR >> 3)
-#endif
-#if !S_IWOTH
-# define S_IWOTH (S_IWUSR >> 6)
-#endif
-
-#if !S_IXUSR && S_IEXEC
-# define S_IXUSR S_IEXEC
-#endif
-#if !S_IXUSR
-# define S_IXUSR 00100
-#endif
-#if !S_IXGRP
-# define S_IXGRP (S_IXUSR >> 3)
-#endif
-#if !S_IXOTH
-# define S_IXOTH (S_IXUSR >> 6)
-#endif
-
-#if !S_IRWXU
-# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
-#endif
-#if !S_IRWXG
-# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
-#endif
-#if !S_IRWXO
-# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
-#endif
-
-/* S_IXUGO is a common extension to POSIX. */
-#if !S_IXUGO
-# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
-#endif
-
-#ifndef S_IRWXUGO
-# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
-#endif
-
-/* Macros for futimens and utimensat. */
-#ifndef UTIME_NOW
-# define UTIME_NOW (-1)
-# define UTIME_OMIT (-2)
-#endif
-
-
-#if @GNULIB_FCHMODAT@
-# if !@HAVE_FCHMODAT@
-_GL_FUNCDECL_SYS (fchmodat, int,
- (int fd, char const *file, mode_t mode, int flag)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (fchmodat, int,
- (int fd, char const *file, mode_t mode, int flag));
-_GL_CXXALIASWARN (fchmodat);
-#elif defined GNULIB_POSIXCHECK
-# undef fchmodat
-# if HAVE_RAW_DECL_FCHMODAT
-_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
- "use gnulib module openat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FSTAT@
-# if @REPLACE_FSTAT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fstat
-# define fstat rpl_fstat
-# endif
-_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
-# else
-_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
-# endif
-_GL_CXXALIASWARN (fstat);
-#elif @WINDOWS_64_BIT_ST_SIZE@
-/* Above, we define stat to _stati64. */
-# define fstat _fstati64
-#elif defined GNULIB_POSIXCHECK
-# undef fstat
-# if HAVE_RAW_DECL_FSTAT
-_GL_WARN_ON_USE (fstat, "fstat has portability problems - "
- "use gnulib module fstat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FSTATAT@
-# if @REPLACE_FSTATAT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fstatat
-# define fstatat rpl_fstatat
-# endif
-_GL_FUNCDECL_RPL (fstatat, int,
- (int fd, char const *name, struct stat *st, int flags)
- _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (fstatat, int,
- (int fd, char const *name, struct stat *st, int flags));
-# else
-# if !@HAVE_FSTATAT@
-_GL_FUNCDECL_SYS (fstatat, int,
- (int fd, char const *name, struct stat *st, int flags)
- _GL_ARG_NONNULL ((2, 3)));
-# endif
-_GL_CXXALIAS_SYS (fstatat, int,
- (int fd, char const *name, struct stat *st, int flags));
-# endif
-_GL_CXXALIASWARN (fstatat);
-#elif defined GNULIB_POSIXCHECK
-# undef fstatat
-# if HAVE_RAW_DECL_FSTATAT
-_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
- "use gnulib module openat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FUTIMENS@
-/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
- implementation relies on futimesat, which on Solaris 10 makes an invocation
- to futimens that is meant to invoke the libc's futimens(), not gnulib's
- futimens(). */
-# if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun)
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef futimens
-# define futimens rpl_futimens
-# endif
-_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
-_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
-# else
-# if !@HAVE_FUTIMENS@
-_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
-# endif
-_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
-# endif
-# if @HAVE_FUTIMENS@
-_GL_CXXALIASWARN (futimens);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef futimens
-# if HAVE_RAW_DECL_FUTIMENS
-_GL_WARN_ON_USE (futimens, "futimens is not portable - "
- "use gnulib module futimens for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LCHMOD@
-/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
- denotes a symbolic link. */
-# if !@HAVE_LCHMOD@
-/* The lchmod replacement follows symbolic links. Callers should take
- this into account; lchmod should be applied only to arguments that
- are known to not be symbolic links. On hosts that lack lchmod,
- this can lead to race conditions between the check and the
- invocation of lchmod, but we know of no workarounds that are
- reliable in general. You might try requesting support for lchmod
- from your operating system supplier. */
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define lchmod chmod
-# endif
-/* Need to cast, because on mingw, the second parameter of chmod is
- int mode. */
-_GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
- (const char *filename, mode_t mode));
-# else
-# if 0 /* assume already declared */
-_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
-# endif
-# if @HAVE_LCHMOD@
-_GL_CXXALIASWARN (lchmod);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef lchmod
-# if HAVE_RAW_DECL_LCHMOD
-_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
- "use gnulib module lchmod for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LSTAT@
-# if ! @HAVE_LSTAT@
-/* mingw does not support symlinks, therefore it does not have lstat. But
- without links, stat does just fine. */
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define lstat stat
-# endif
-_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
-# elif @REPLACE_LSTAT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef lstat
-# define lstat rpl_lstat
-# endif
-_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
-# else
-_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
-# endif
-# if @HAVE_LSTAT@
-_GL_CXXALIASWARN (lstat);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef lstat
-# if HAVE_RAW_DECL_LSTAT
-_GL_WARN_ON_USE (lstat, "lstat is unportable - "
- "use gnulib module lstat for portability");
-# endif
-#endif
-
-
-#if @REPLACE_MKDIR@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef mkdir
-# define mkdir rpl_mkdir
-# endif
-_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
-#else
-/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
- Additionally, it declares _mkdir (and depending on compile flags, an
- alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
- which are included above. */
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-# if !GNULIB_defined_rpl_mkdir
-static int
-rpl_mkdir (char const *name, mode_t mode)
-{
- return _mkdir (name);
-}
-# define GNULIB_defined_rpl_mkdir 1
-# endif
-
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define mkdir rpl_mkdir
-# endif
-_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
-# else
-_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
-# endif
-#endif
-_GL_CXXALIASWARN (mkdir);
-
-
-#if @GNULIB_MKDIRAT@
-# if !@HAVE_MKDIRAT@
-_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
-_GL_CXXALIASWARN (mkdirat);
-#elif defined GNULIB_POSIXCHECK
-# undef mkdirat
-# if HAVE_RAW_DECL_MKDIRAT
-_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
- "use gnulib module openat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_MKFIFO@
-# if @REPLACE_MKFIFO@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef mkfifo
-# define mkfifo rpl_mkfifo
-# endif
-_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
-# else
-# if !@HAVE_MKFIFO@
-_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
-# endif
-_GL_CXXALIASWARN (mkfifo);
-#elif defined GNULIB_POSIXCHECK
-# undef mkfifo
-# if HAVE_RAW_DECL_MKFIFO
-_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
- "use gnulib module mkfifo for portability");
-# endif
-#endif
-
-
-#if @GNULIB_MKFIFOAT@
-# if !@HAVE_MKFIFOAT@
-_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
-_GL_CXXALIASWARN (mkfifoat);
-#elif defined GNULIB_POSIXCHECK
-# undef mkfifoat
-# if HAVE_RAW_DECL_MKFIFOAT
-_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
- "use gnulib module mkfifoat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_MKNOD@
-# if @REPLACE_MKNOD@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef mknod
-# define mknod rpl_mknod
-# endif
-_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
-# else
-# if !@HAVE_MKNOD@
-_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
- _GL_ARG_NONNULL ((1)));
-# endif
-/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
-_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
-# endif
-_GL_CXXALIASWARN (mknod);
-#elif defined GNULIB_POSIXCHECK
-# undef mknod
-# if HAVE_RAW_DECL_MKNOD
-_GL_WARN_ON_USE (mknod, "mknod is not portable - "
- "use gnulib module mknod for portability");
-# endif
-#endif
-
-
-#if @GNULIB_MKNODAT@
-# if !@HAVE_MKNODAT@
-_GL_FUNCDECL_SYS (mknodat, int,
- (int fd, char const *file, mode_t mode, dev_t dev)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (mknodat, int,
- (int fd, char const *file, mode_t mode, dev_t dev));
-_GL_CXXALIASWARN (mknodat);
-#elif defined GNULIB_POSIXCHECK
-# undef mknodat
-# if HAVE_RAW_DECL_MKNODAT
-_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
- "use gnulib module mkfifoat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_STAT@
-# if @REPLACE_STAT@
-/* We can't use the object-like #define stat rpl_stat, because of
- struct stat. This means that rpl_stat will not be used if the user
- does (stat)(a,b). Oh well. */
-# if defined _AIX && defined stat && defined _LARGE_FILES
- /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
- so we have to replace stat64() instead of stat(). */
-# undef stat64
-# define stat64(name, st) rpl_stat (name, st)
-# elif @WINDOWS_64_BIT_ST_SIZE@
- /* Above, we define stat to _stati64. */
-# if defined __MINGW32__ && defined _stati64
-# ifndef _USE_32BIT_TIME_T
- /* The system headers define _stati64 to _stat64. */
-# undef _stat64
-# define _stat64(name, st) rpl_stat (name, st)
-# endif
-# elif defined _MSC_VER && defined _stati64
-# ifdef _USE_32BIT_TIME_T
- /* The system headers define _stati64 to _stat32i64. */
-# undef _stat32i64
-# define _stat32i64(name, st) rpl_stat (name, st)
-# else
- /* The system headers define _stati64 to _stat64. */
-# undef _stat64
-# define _stat64(name, st) rpl_stat (name, st)
-# endif
-# else
-# undef _stati64
-# define _stati64(name, st) rpl_stat (name, st)
-# endif
-# elif defined __MINGW32__ && defined stat
-# ifdef _USE_32BIT_TIME_T
- /* The system headers define stat to _stat32i64. */
-# undef _stat32i64
-# define _stat32i64(name, st) rpl_stat (name, st)
-# else
- /* The system headers define stat to _stat64. */
-# undef _stat64
-# define _stat64(name, st) rpl_stat (name, st)
-# endif
-# elif defined _MSC_VER && defined stat
-# ifdef _USE_32BIT_TIME_T
- /* The system headers define stat to _stat32. */
-# undef _stat32
-# define _stat32(name, st) rpl_stat (name, st)
-# else
- /* The system headers define stat to _stat64i32. */
-# undef _stat64i32
-# define _stat64i32(name, st) rpl_stat (name, st)
-# endif
-# else /* !(_AIX ||__MINGW32__ || _MSC_VER) */
-# undef stat
-# define stat(name, st) rpl_stat (name, st)
-# endif /* !_LARGE_FILES */
-_GL_EXTERN_C int stat (const char *name, struct stat *buf)
- _GL_ARG_NONNULL ((1, 2));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef stat
-# if HAVE_RAW_DECL_STAT
-_GL_WARN_ON_USE (stat, "stat is unportable - "
- "use gnulib module stat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_UTIMENSAT@
-/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
- implementation relies on futimesat, which on Solaris 10 makes an invocation
- to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
- utimensat(). */
-# if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun)
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef utimensat
-# define utimensat rpl_utimensat
-# endif
-_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
- struct timespec const times[2], int flag)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
- struct timespec const times[2], int flag));
-# else
-# if !@HAVE_UTIMENSAT@
-_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
- struct timespec const times[2], int flag)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
- struct timespec const times[2], int flag));
-# endif
-# if @HAVE_UTIMENSAT@
-_GL_CXXALIASWARN (utimensat);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef utimensat
-# if HAVE_RAW_DECL_UTIMENSAT
-_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
- "use gnulib module utimensat for portability");
-# endif
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
-#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
-#endif
diff --git a/src/gl/sys_time.in.h b/src/gl/sys_time.in.h
deleted file mode 100644
index d535a6a48b..0000000000
--- a/src/gl/sys_time.in.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/* Provide a more complete sys/time.h.
-
- Copyright (C) 2007-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paul Eggert. */
-
-#ifndef _@GUARD_PREFIX@_SYS_TIME_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* On Cygwin and on many BSDish systems, <sys/time.h> includes itself
- recursively via <sys/select.h>.
- Simply delegate to the system's header in this case; it is a no-op.
- Without this extra ifdef, the C++ gettimeofday declaration below
- would be a forward declaration in gnulib's nested <sys/time.h>. */
-#if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_
-# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
-#else
-
-/* The include_next requires a split double-inclusion guard. */
-#if @HAVE_SYS_TIME_H@
-# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
-#endif
-
-#ifndef _@GUARD_PREFIX@_SYS_TIME_H
-#define _@GUARD_PREFIX@_SYS_TIME_H
-
-#if ! @HAVE_SYS_TIME_H@
-# include <time.h>
-#endif
-
-/* On native Windows with MSVC, get the 'struct timeval' type.
- Also, on native Windows with a 64-bit time_t, where we are overriding the
- 'struct timeval' type, get all declarations of system functions whose
- signature contains 'struct timeval'. */
-#if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
-# define _GL_INCLUDING_WINSOCK2_H
-# include <winsock2.h>
-# undef _GL_INCLUDING_WINSOCK2_H
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
-
-# if @REPLACE_STRUCT_TIMEVAL@
-# define timeval rpl_timeval
-# endif
-
-# if !GNULIB_defined_struct_timeval
-struct timeval
-{
- time_t tv_sec;
- long int tv_usec;
-};
-# define GNULIB_defined_struct_timeval 1
-# endif
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#if @GNULIB_GETTIMEOFDAY@
-# if @REPLACE_GETTIMEOFDAY@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gettimeofday
-# define gettimeofday rpl_gettimeofday
-# endif
-_GL_FUNCDECL_RPL (gettimeofday, int,
- (struct timeval *restrict, void *restrict)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (gettimeofday, int,
- (struct timeval *restrict, void *restrict));
-# else
-# if !@HAVE_GETTIMEOFDAY@
-_GL_FUNCDECL_SYS (gettimeofday, int,
- (struct timeval *restrict, void *restrict)
- _GL_ARG_NONNULL ((1)));
-# endif
-/* Need to cast, because on glibc systems, by default, the second argument is
- struct timezone *. */
-_GL_CXXALIAS_SYS_CAST (gettimeofday, int,
- (struct timeval *restrict, void *restrict));
-# endif
-_GL_CXXALIASWARN (gettimeofday);
-# if defined __cplusplus && defined GNULIB_NAMESPACE
-namespace GNULIB_NAMESPACE {
- typedef ::timeval
-#undef timeval
- timeval;
-}
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef gettimeofday
-# if HAVE_RAW_DECL_GETTIMEOFDAY
-_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
- "use gnulib module gettimeofday for portability");
-# endif
-#endif
-
-/* Hide some function declarations from <winsock2.h>. */
-
-#if defined _MSC_VER && @HAVE_WINSOCK2_H@
-# if !defined _@GUARD_PREFIX@_UNISTD_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef close
-# define close close_used_without_including_unistd_h
-# else
- _GL_WARN_ON_USE (close,
- "close() used without including <unistd.h>");
-# endif
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gethostname
-# define gethostname gethostname_used_without_including_unistd_h
-# else
- _GL_WARN_ON_USE (gethostname,
- "gethostname() used without including <unistd.h>");
-# endif
-# endif
-# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef socket
-# define socket socket_used_without_including_sys_socket_h
-# undef connect
-# define connect connect_used_without_including_sys_socket_h
-# undef accept
-# define accept accept_used_without_including_sys_socket_h
-# undef bind
-# define bind bind_used_without_including_sys_socket_h
-# undef getpeername
-# define getpeername getpeername_used_without_including_sys_socket_h
-# undef getsockname
-# define getsockname getsockname_used_without_including_sys_socket_h
-# undef getsockopt
-# define getsockopt getsockopt_used_without_including_sys_socket_h
-# undef listen
-# define listen listen_used_without_including_sys_socket_h
-# undef recv
-# define recv recv_used_without_including_sys_socket_h
-# undef send
-# define send send_used_without_including_sys_socket_h
-# undef recvfrom
-# define recvfrom recvfrom_used_without_including_sys_socket_h
-# undef sendto
-# define sendto sendto_used_without_including_sys_socket_h
-# undef setsockopt
-# define setsockopt setsockopt_used_without_including_sys_socket_h
-# undef shutdown
-# define shutdown shutdown_used_without_including_sys_socket_h
-# else
- _GL_WARN_ON_USE (socket,
- "socket() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (connect,
- "connect() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (accept,
- "accept() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (bind,
- "bind() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (getpeername,
- "getpeername() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (getsockname,
- "getsockname() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (getsockopt,
- "getsockopt() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (listen,
- "listen() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (recv,
- "recv() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (send,
- "send() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (recvfrom,
- "recvfrom() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (sendto,
- "sendto() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (setsockopt,
- "setsockopt() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (shutdown,
- "shutdown() used without including <sys/socket.h>");
-# endif
-# endif
-# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef select
-# define select select_used_without_including_sys_select_h
-# else
- _GL_WARN_ON_USE (select,
- "select() used without including <sys/select.h>");
-# endif
-# endif
-#endif
-
-#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
-#endif /* _CYGWIN_SYS_TIME_H */
-#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
diff --git a/src/gl/sys_types.in.h b/src/gl/sys_types.in.h
deleted file mode 100644
index 8ab0545382..0000000000
--- a/src/gl/sys_types.in.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Provide a more complete sys/types.h.
-
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
-
-/* The include_next requires a split double-inclusion guard. */
-# define _GL_INCLUDING_SYS_TYPES_H
-#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
-# undef _GL_INCLUDING_SYS_TYPES_H
-
-#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
-#define _@GUARD_PREFIX@_SYS_TYPES_H
-
-/* Override off_t if Large File Support is requested on native Windows. */
-#if @WINDOWS_64_BIT_OFF_T@
-/* Same as int64_t in <stdint.h>. */
-# if defined _MSC_VER
-# define off_t __int64
-# else
-# define off_t long long int
-# endif
-/* Indicator, for gnulib internal purposes. */
-# define _GL_WINDOWS_64_BIT_OFF_T 1
-#endif
-
-/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
-/* But avoid namespace pollution on glibc systems. */
-#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
- && ! defined __GLIBC__
-# include <stddef.h>
-#endif
-
-#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
-#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
diff --git a/src/gl/sys_uio.in.h b/src/gl/sys_uio.in.h
deleted file mode 100644
index e70663fda5..0000000000
--- a/src/gl/sys_uio.in.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Substitute for <sys/uio.h>.
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-# if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-# endif
-@PRAGMA_COLUMNS@
-
-#ifndef _@GUARD_PREFIX@_SYS_UIO_H
-
-#if @HAVE_SYS_UIO_H@
-
-/* On OpenBSD 4.4, <sys/uio.h> assumes prior inclusion of <sys/types.h>. */
-# include <sys/types.h>
-
-/* The include_next requires a split double-inclusion guard. */
-# @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@
-
-#endif
-
-#ifndef _@GUARD_PREFIX@_SYS_UIO_H
-#define _@GUARD_PREFIX@_SYS_UIO_H
-
-#if !@HAVE_SYS_UIO_H@
-/* A platform that lacks <sys/uio.h>. */
-/* Get 'size_t' and 'ssize_t'. */
-# include <sys/types.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# if !GNULIB_defined_struct_iovec
-/* All known platforms that lack <sys/uio.h> also lack any declaration
- of struct iovec in any other header. */
-struct iovec {
- void *iov_base;
- size_t iov_len;
-};
-# define GNULIB_defined_struct_iovec 1
-# endif
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-#endif /* _@GUARD_PREFIX@_SYS_UIO_H */
-#endif /* _@GUARD_PREFIX@_SYS_UIO_H */
diff --git a/src/gl/time-internal.h b/src/gl/time-internal.h
deleted file mode 100644
index 0635f28bb9..0000000000
--- a/src/gl/time-internal.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Time internal interface
-
- Copyright 2015-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paul Eggert. */
-
-/* A time zone rule. */
-struct tm_zone
-{
- /* More abbreviations, should they be needed. Their TZ_IS_SET
- members are zero. */
- struct tm_zone *next;
-
-#if HAVE_TZNAME && !HAVE_TM_ZONE
- /* Copies of recent strings taken from tzname[0] and tzname[1].
- The copies are in ABBRS, so that they survive tzset. Null if unknown. */
- char *tzname_copy[2];
-#endif
-
- /* If nonzero, the rule represents the TZ environment variable set
- to the first "abbreviation" (this may be the empty string).
- Otherwise, it represents an unset TZ. */
- char tz_is_set;
-
- /* A sequence of null-terminated strings packed next to each other.
- The strings are followed by an extra null byte. If TZ_IS_SET,
- there must be at least one string and the first string (which is
- actually a TZ environment value value) may be empty. Otherwise
- all strings must be nonempty.
-
- Abbreviations are stored here because otherwise the values of
- tm_zone and/or tzname would be dead after changing TZ and calling
- tzset. Abbreviations never move once allocated, and are live
- until tzfree is called. */
- char abbrs[FLEXIBLE_ARRAY_MEMBER];
-};
diff --git a/src/gl/time.in.h b/src/gl/time.in.h
deleted file mode 100644
index 865c114119..0000000000
--- a/src/gl/time.in.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/* A more-standard <time.h>.
-
- Copyright (C) 2007-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* Don't get in the way of glibc when it includes time.h merely to
- declare a few standard symbols, rather than to declare all the
- symbols. (However, skip this for MinGW as it treats __need_time_t
- incompatibly.) Also, Solaris 8 <time.h> eventually includes itself
- recursively; if that is happening, just include the system <time.h>
- without adding our own declarations. */
-#if (((defined __need_time_t || defined __need_clock_t \
- || defined __need_timespec) \
- && !defined __MINGW32__) \
- || defined _@GUARD_PREFIX@_TIME_H)
-
-# @INCLUDE_NEXT@ @NEXT_TIME_H@
-
-#else
-
-# define _@GUARD_PREFIX@_TIME_H
-
-# @INCLUDE_NEXT@ @NEXT_TIME_H@
-
-/* NetBSD 5.0 mis-defines NULL. */
-# include <stddef.h>
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
- Or they define it with the wrong member names or define it in <sys/time.h>
- (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it,
- but the pthreads-win32 library defines it in <pthread.h>. */
-# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
-# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
-# include <sys/time.h>
-# elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
-# include <pthread.h>
-# elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
-# include <unistd.h>
-# else
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# if !GNULIB_defined_struct_timespec
-# undef timespec
-# define timespec rpl_timespec
-struct timespec
-{
- time_t tv_sec;
- long int tv_nsec;
-};
-# define GNULIB_defined_struct_timespec 1
-# endif
-
-# ifdef __cplusplus
-}
-# endif
-
-# endif
-# endif
-
-# if !GNULIB_defined_struct_time_t_must_be_integral
-/* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
- time_t to be an integer type, even though C99 permits floating
- point. We don't know of any implementation that uses floating
- point, and it is much easier to write code that doesn't have to
- worry about that corner case, so we force the issue. */
-struct __time_t_must_be_integral {
- unsigned int __floating_time_t_unsupported : (time_t) 1;
-};
-# define GNULIB_defined_struct_time_t_must_be_integral 1
-# endif
-
-/* Sleep for at least RQTP seconds unless interrupted, If interrupted,
- return -1 and store the remaining time into RMTP. See
- <http://www.opengroup.org/susv3xsh/nanosleep.html>. */
-# if @GNULIB_NANOSLEEP@
-# if @REPLACE_NANOSLEEP@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define nanosleep rpl_nanosleep
-# endif
-_GL_FUNCDECL_RPL (nanosleep, int,
- (struct timespec const *__rqtp, struct timespec *__rmtp)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (nanosleep, int,
- (struct timespec const *__rqtp, struct timespec *__rmtp));
-# else
-# if ! @HAVE_NANOSLEEP@
-_GL_FUNCDECL_SYS (nanosleep, int,
- (struct timespec const *__rqtp, struct timespec *__rmtp)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (nanosleep, int,
- (struct timespec const *__rqtp, struct timespec *__rmtp));
-# endif
-_GL_CXXALIASWARN (nanosleep);
-# endif
-
-/* Return the 'time_t' representation of TP and normalize TP. */
-# if @GNULIB_MKTIME@
-# if @REPLACE_MKTIME@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define mktime rpl_mktime
-# endif
-_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
-# else
-_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
-# endif
-_GL_CXXALIASWARN (mktime);
-# endif
-
-/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
- <http://www.opengroup.org/susv3xsh/localtime_r.html> and
- <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
-# if @GNULIB_TIME_R@
-# if @REPLACE_LOCALTIME_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef localtime_r
-# define localtime_r rpl_localtime_r
-# endif
-_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
- struct tm *restrict __result)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
- struct tm *restrict __result));
-# else
-# if ! @HAVE_DECL_LOCALTIME_R@
-_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
- struct tm *restrict __result)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
- struct tm *restrict __result));
-# endif
-# if @HAVE_DECL_LOCALTIME_R@
-_GL_CXXALIASWARN (localtime_r);
-# endif
-# if @REPLACE_LOCALTIME_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gmtime_r
-# define gmtime_r rpl_gmtime_r
-# endif
-_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
- struct tm *restrict __result)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
- struct tm *restrict __result));
-# else
-# if ! @HAVE_DECL_LOCALTIME_R@
-_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
- struct tm *restrict __result)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
- struct tm *restrict __result));
-# endif
-# if @HAVE_DECL_LOCALTIME_R@
-_GL_CXXALIASWARN (gmtime_r);
-# endif
-# endif
-
-/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
- <http://www.opengroup.org/susv3xsh/localtime.html> and
- <http://www.opengroup.org/susv3xsh/gmtime.html>. */
-# if @GNULIB_GETTIMEOFDAY@
-# if @REPLACE_LOCALTIME@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef localtime
-# define localtime rpl_localtime
-# endif
-_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
-# else
-_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
-# endif
-_GL_CXXALIASWARN (localtime);
-# endif
-
-# if @GNULIB_GETTIMEOFDAY@
-# if @REPLACE_GMTIME@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gmtime
-# define gmtime rpl_gmtime
-# endif
-_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer));
-# else
-_GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer));
-# endif
-_GL_CXXALIASWARN (gmtime);
-# endif
-
-/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
- the resulting broken-down time into TM. See
- <http://www.opengroup.org/susv3xsh/strptime.html>. */
-# if @GNULIB_STRPTIME@
-# if ! @HAVE_STRPTIME@
-_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
- char const *restrict __format,
- struct tm *restrict __tm)
- _GL_ARG_NONNULL ((1, 2, 3)));
-# endif
-_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
- char const *restrict __format,
- struct tm *restrict __tm));
-_GL_CXXALIASWARN (strptime);
-# endif
-
-# if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@
-typedef struct tm_zone *timezone_t;
-_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name));
-_GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name));
-_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz));
-_GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz));
-_GL_FUNCDECL_SYS (localtime_rz, struct tm *,
- (timezone_t __tz, time_t const *restrict __timer,
- struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_SYS (localtime_rz, struct tm *,
- (timezone_t __tz, time_t const *restrict __timer,
- struct tm *restrict __result));
-_GL_FUNCDECL_SYS (mktime_z, time_t,
- (timezone_t __tz, struct tm *restrict __result)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_SYS (mktime_z, time_t,
- (timezone_t __tz, struct tm *restrict __result));
-# endif
-
-/* Convert TM to a time_t value, assuming UTC. */
-# if @GNULIB_TIMEGM@
-# if @REPLACE_TIMEGM@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef timegm
-# define timegm rpl_timegm
-# endif
-_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
-# else
-# if ! @HAVE_TIMEGM@
-_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
-# endif
-_GL_CXXALIASWARN (timegm);
-# endif
-
-/* Encourage applications to avoid unsafe functions that can overrun
- buffers when given outlandish struct tm values. Portable
- applications should use strftime (or even sprintf) instead. */
-# if defined GNULIB_POSIXCHECK
-# undef asctime
-_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
- "better use strftime (or even sprintf) instead");
-# endif
-# if defined GNULIB_POSIXCHECK
-# undef asctime_r
-_GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - "
- "better use strftime (or even sprintf) instead");
-# endif
-# if defined GNULIB_POSIXCHECK
-# undef ctime
-_GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - "
- "better use strftime (or even sprintf) instead");
-# endif
-# if defined GNULIB_POSIXCHECK
-# undef ctime_r
-_GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - "
- "better use strftime (or even sprintf) instead");
-# endif
-
-#endif
diff --git a/src/gl/time_r.c b/src/gl/time_r.c
deleted file mode 100644
index dc1e16136f..0000000000
--- a/src/gl/time_r.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Reentrant time functions like localtime_r.
-
- Copyright (C) 2003, 2006-2007, 2010-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paul Eggert. */
-
-#include <config.h>
-
-#include <time.h>
-
-static struct tm *
-copy_tm_result (struct tm *dest, struct tm const *src)
-{
- if (! src)
- return 0;
- *dest = *src;
- return dest;
-}
-
-
-struct tm *
-gmtime_r (time_t const * restrict t, struct tm * restrict tp)
-{
- return copy_tm_result (tp, gmtime (t));
-}
-
-struct tm *
-localtime_r (time_t const * restrict t, struct tm * restrict tp)
-{
- return copy_tm_result (tp, localtime (t));
-}
diff --git a/src/gl/time_rz.c b/src/gl/time_rz.c
deleted file mode 100644
index 38afb5fc3c..0000000000
--- a/src/gl/time_rz.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/* Time zone functions such as tzalloc and localtime_rz
-
- Copyright 2015-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paul Eggert. */
-
-/* Although this module is not thread-safe, any races should be fairly
- rare and reasonably benign. For complete thread-safety, use a C
- library with a working timezone_t type, so that this module is not
- needed. */
-
-#include <config.h>
-
-#include <time.h>
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "flexmember.h"
-#include "time-internal.h"
-
-#if !HAVE_TZSET
-static void tzset (void) { }
-#endif
-
-/* The approximate size to use for small allocation requests. This is
- the largest "small" request for the GNU C library malloc. */
-enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 };
-
-/* Minimum size of the ABBRS member of struct abbr. ABBRS is larger
- only in the unlikely case where an abbreviation longer than this is
- used. */
-enum { ABBR_SIZE_MIN = DEFAULT_MXFAST - offsetof (struct tm_zone, abbrs) };
-
-/* Magic cookie timezone_t value, for local time. It differs from
- NULL and from all other timezone_t values. Only the address
- matters; the pointer is never dereferenced. */
-static timezone_t const local_tz = (timezone_t) 1;
-
-#if HAVE_TM_ZONE || HAVE_TZNAME
-
-/* Return true if the values A and B differ according to the rules for
- tm_isdst: A and B differ if one is zero and the other positive. */
-static bool
-isdst_differ (int a, int b)
-{
- return !a != !b && 0 <= a && 0 <= b;
-}
-
-/* Return true if A and B are equal. */
-static int
-equal_tm (const struct tm *a, const struct tm *b)
-{
- return ! ((a->tm_sec ^ b->tm_sec)
- | (a->tm_min ^ b->tm_min)
- | (a->tm_hour ^ b->tm_hour)
- | (a->tm_mday ^ b->tm_mday)
- | (a->tm_mon ^ b->tm_mon)
- | (a->tm_year ^ b->tm_year)
- | isdst_differ (a->tm_isdst, b->tm_isdst));
-}
-
-#endif
-
-/* Copy to ABBRS the abbreviation at ABBR with size ABBR_SIZE (this
- includes its trailing null byte). Append an extra null byte to
- mark the end of ABBRS. */
-static void
-extend_abbrs (char *abbrs, char const *abbr, size_t abbr_size)
-{
- memcpy (abbrs, abbr, abbr_size);
- abbrs[abbr_size] = '\0';
-}
-
-/* Return a newly allocated time zone for NAME, or NULL on failure.
- A null NAME stands for wall clock time (which is like unset TZ). */
-timezone_t
-tzalloc (char const *name)
-{
- size_t name_size = name ? strlen (name) + 1 : 0;
- size_t abbr_size = name_size < ABBR_SIZE_MIN ? ABBR_SIZE_MIN : name_size + 1;
- timezone_t tz = malloc (FLEXSIZEOF (struct tm_zone, abbrs, abbr_size));
- if (tz)
- {
- tz->next = NULL;
-#if HAVE_TZNAME && !HAVE_TM_ZONE
- tz->tzname_copy[0] = tz->tzname_copy[1] = NULL;
-#endif
- tz->tz_is_set = !!name;
- tz->abbrs[0] = '\0';
- if (name)
- extend_abbrs (tz->abbrs, name, name_size);
- }
- return tz;
-}
-
-/* Save into TZ any nontrivial time zone abbreviation used by TM, and
- update *TM (if HAVE_TM_ZONE) or *TZ (if !HAVE_TM_ZONE &&
- HAVE_TZNAME) if they use the abbreviation. Return true if
- successful, false (setting errno) otherwise. */
-static bool
-save_abbr (timezone_t tz, struct tm *tm)
-{
-#if HAVE_TM_ZONE || HAVE_TZNAME
- char const *zone = NULL;
- char *zone_copy = (char *) "";
-
-# if HAVE_TZNAME
- int tzname_index = -1;
-# endif
-
-# if HAVE_TM_ZONE
- zone = tm->tm_zone;
-# endif
-
-# if HAVE_TZNAME
- if (! (zone && *zone) && 0 <= tm->tm_isdst)
- {
- tzname_index = tm->tm_isdst != 0;
- zone = tzname[tzname_index];
- }
-# endif
-
- /* No need to replace null zones, or zones within the struct tm. */
- if (!zone || ((char *) tm <= zone && zone < (char *) (tm + 1)))
- return true;
-
- if (*zone)
- {
- zone_copy = tz->abbrs;
-
- while (strcmp (zone_copy, zone) != 0)
- {
- if (! (*zone_copy || (zone_copy == tz->abbrs && tz->tz_is_set)))
- {
- size_t zone_size = strlen (zone) + 1;
- if (zone_size < tz->abbrs + ABBR_SIZE_MIN - zone_copy)
- extend_abbrs (zone_copy, zone, zone_size);
- else
- {
- tz = tz->next = tzalloc (zone);
- if (!tz)
- return false;
- tz->tz_is_set = 0;
- zone_copy = tz->abbrs;
- }
- break;
- }
-
- zone_copy += strlen (zone_copy) + 1;
- if (!*zone_copy && tz->next)
- {
- tz = tz->next;
- zone_copy = tz->abbrs;
- }
- }
- }
-
- /* Replace the zone name so that its lifetime matches that of TZ. */
-# if HAVE_TM_ZONE
- tm->tm_zone = zone_copy;
-# else
- if (0 <= tzname_index)
- tz->tzname_copy[tzname_index] = zone_copy;
-# endif
-#endif
-
- return true;
-}
-
-/* Free a time zone. */
-void
-tzfree (timezone_t tz)
-{
- if (tz != local_tz)
- while (tz)
- {
- timezone_t next = tz->next;
- free (tz);
- tz = next;
- }
-}
-
-/* Get and set the TZ environment variable. These functions can be
- overridden by programs like Emacs that manage their own environment. */
-
-#ifndef getenv_TZ
-static char *
-getenv_TZ (void)
-{
- return getenv ("TZ");
-}
-#endif
-
-#ifndef setenv_TZ
-static int
-setenv_TZ (char const *tz)
-{
- return tz ? setenv ("TZ", tz, 1) : unsetenv ("TZ");
-}
-#endif
-
-/* Change the environment to match the specified timezone_t value.
- Return true if successful, false (setting errno) otherwise. */
-static bool
-change_env (timezone_t tz)
-{
- if (setenv_TZ (tz->tz_is_set ? tz->abbrs : NULL) != 0)
- return false;
- tzset ();
- return true;
-}
-
-/* Temporarily set the time zone to TZ, which must not be null.
- Return LOCAL_TZ if the time zone setting is already correct.
- Otherwise return a newly allocated time zone representing the old
- setting, or NULL (setting errno) on failure. */
-static timezone_t
-set_tz (timezone_t tz)
-{
- char *env_tz = getenv_TZ ();
- if (env_tz
- ? tz->tz_is_set && strcmp (tz->abbrs, env_tz) == 0
- : !tz->tz_is_set)
- return local_tz;
- else
- {
- timezone_t old_tz = tzalloc (env_tz);
- if (!old_tz)
- return old_tz;
- if (! change_env (tz))
- {
- int saved_errno = errno;
- tzfree (old_tz);
- errno = saved_errno;
- return NULL;
- }
- return old_tz;
- }
-}
-
-/* Restore an old setting returned by set_tz. It must not be null.
- Return true (preserving errno) if successful, false (setting errno)
- otherwise. */
-static bool
-revert_tz (timezone_t tz)
-{
- if (tz == local_tz)
- return true;
- else
- {
- int saved_errno = errno;
- bool ok = change_env (tz);
- if (!ok)
- saved_errno = errno;
- tzfree (tz);
- errno = saved_errno;
- return ok;
- }
-}
-
-/* Use time zone TZ to compute localtime_r (T, TM). */
-struct tm *
-localtime_rz (timezone_t tz, time_t const *t, struct tm *tm)
-{
- if (!tz)
- return gmtime_r (t, tm);
- else
- {
- timezone_t old_tz = set_tz (tz);
- if (old_tz)
- {
- bool abbr_saved = localtime_r (t, tm) && save_abbr (tz, tm);
- if (revert_tz (old_tz) && abbr_saved)
- return tm;
- }
- return NULL;
- }
-}
-
-/* Use time zone TZ to compute mktime (TM). */
-time_t
-mktime_z (timezone_t tz, struct tm *tm)
-{
- if (!tz)
- return timegm (tm);
- else
- {
- timezone_t old_tz = set_tz (tz);
- if (old_tz)
- {
- time_t t = mktime (tm);
-#if HAVE_TM_ZONE || HAVE_TZNAME
- time_t badtime = -1;
- struct tm tm_1;
- if ((t != badtime
- || (localtime_r (&t, &tm_1) && equal_tm (tm, &tm_1)))
- && !save_abbr (tz, tm))
- t = badtime;
-#endif
- if (revert_tz (old_tz))
- return t;
- }
- return -1;
- }
-}
diff --git a/src/gl/timegm.c b/src/gl/timegm.c
deleted file mode 100644
index bf61244acd..0000000000
--- a/src/gl/timegm.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Convert UTC calendar time to simple time. Like mktime but assumes UTC.
-
- Copyright (C) 1994, 1997, 2003-2004, 2006-2007, 2009-2016 Free Software
- Foundation, Inc. This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _LIBC
-# include <config.h>
-#endif
-
-#include <time.h>
-
-#ifdef _LIBC
-typedef time_t mktime_offset_t;
-#else
-# undef __gmtime_r
-# define __gmtime_r gmtime_r
-# define __mktime_internal mktime_internal
-# include "mktime-internal.h"
-#endif
-
-time_t
-timegm (struct tm *tmp)
-{
- static mktime_offset_t gmtime_offset;
- tmp->tm_isdst = 0;
- return __mktime_internal (tmp, __gmtime_r, &gmtime_offset);
-}
diff --git a/src/gl/timespec.c b/src/gl/timespec.c
deleted file mode 100644
index 2b6098ed7b..0000000000
--- a/src/gl/timespec.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <config.h>
-#define _GL_TIMESPEC_INLINE _GL_EXTERN_INLINE
-#include "timespec.h"
diff --git a/src/gl/timespec.h b/src/gl/timespec.h
deleted file mode 100644
index 601394b888..0000000000
--- a/src/gl/timespec.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* timespec -- System time interface
-
- Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2016 Free Software
- Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#if ! defined TIMESPEC_H
-# define TIMESPEC_H
-
-# include <time.h>
-
-#ifndef _GL_INLINE_HEADER_BEGIN
- #error "Please include config.h first."
-#endif
-_GL_INLINE_HEADER_BEGIN
-#ifndef _GL_TIMESPEC_INLINE
-# define _GL_TIMESPEC_INLINE _GL_INLINE
-#endif
-
-/* Resolution of timespec time stamps (in units per second), and log
- base 10 of the resolution. */
-
-enum { TIMESPEC_RESOLUTION = 1000000000 };
-enum { LOG10_TIMESPEC_RESOLUTION = 9 };
-
-/* Return a timespec with seconds S and nanoseconds NS. */
-
-_GL_TIMESPEC_INLINE struct timespec
-make_timespec (time_t s, long int ns)
-{
- struct timespec r;
- r.tv_sec = s;
- r.tv_nsec = ns;
- return r;
-}
-
-/* Return negative, zero, positive if A < B, A == B, A > B, respectively.
-
- For each time stamp T, this code assumes that either:
-
- * T.tv_nsec is in the range 0..999999999; or
- * T.tv_sec corresponds to a valid leap second on a host that supports
- leap seconds, and T.tv_nsec is in the range 1000000000..1999999999; or
- * T.tv_sec is the minimum time_t value and T.tv_nsec is -1; or
- T.tv_sec is the maximum time_t value and T.tv_nsec is 2000000000.
- This allows for special struct timespec values that are less or
- greater than all possible valid time stamps.
-
- In all these cases, it is safe to subtract two tv_nsec values and
- convert the result to integer without worrying about overflow on
- any platform of interest to the GNU project, since all such
- platforms have 32-bit int or wider.
-
- Replacing "(int) (a.tv_nsec - b.tv_nsec)" with something like
- "a.tv_nsec < b.tv_nsec ? -1 : a.tv_nsec > b.tv_nsec" would cause
- this function to work in some cases where the above assumption is
- violated, but not in all cases (e.g., a.tv_sec==1, a.tv_nsec==-2,
- b.tv_sec==0, b.tv_nsec==999999999) and is arguably not worth the
- extra instructions. Using a subtraction has the advantage of
- detecting some invalid cases on platforms that detect integer
- overflow.
-
- The (int) cast avoids a gcc -Wconversion warning. */
-
-_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE
-timespec_cmp (struct timespec a, struct timespec b)
-{
- return (a.tv_sec < b.tv_sec ? -1
- : a.tv_sec > b.tv_sec ? 1
- : (int) (a.tv_nsec - b.tv_nsec));
-}
-
-/* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be
- nonnegative. */
-_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE
-timespec_sign (struct timespec a)
-{
- return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;
-}
-
-struct timespec timespec_add (struct timespec, struct timespec)
- _GL_ATTRIBUTE_CONST;
-struct timespec timespec_sub (struct timespec, struct timespec)
- _GL_ATTRIBUTE_CONST;
-struct timespec dtotimespec (double)
- _GL_ATTRIBUTE_CONST;
-
-/* Return an approximation to A, of type 'double'. */
-_GL_TIMESPEC_INLINE double
-timespectod (struct timespec a)
-{
- return a.tv_sec + a.tv_nsec / 1e9;
-}
-
-void gettime (struct timespec *);
-int settime (struct timespec const *);
-
-_GL_INLINE_HEADER_END
-
-#endif
diff --git a/src/gl/unistd.c b/src/gl/unistd.c
deleted file mode 100644
index 72bad1c052..0000000000
--- a/src/gl/unistd.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <config.h>
-#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
-#include "unistd.h"
-typedef int dummy;
diff --git a/src/gl/unistd.in.h b/src/gl/unistd.in.h
deleted file mode 100644
index c3af07ad21..0000000000
--- a/src/gl/unistd.in.h
+++ /dev/null
@@ -1,1586 +0,0 @@
-/* Substitute for and wrapper around <unistd.h>.
- Copyright (C) 2003-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _@GUARD_PREFIX@_UNISTD_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#ifdef _GL_INCLUDING_UNISTD_H
-/* Special invocation convention:
- - On Mac OS X 10.3.9 we have a sequence of nested includes
- <unistd.h> -> <signal.h> -> <pthread.h> -> <unistd.h>
- In this situation, the functions are not yet declared, therefore we cannot
- provide the C++ aliases. */
-
-#@INCLUDE_NEXT@ @NEXT_UNISTD_H@
-
-#else
-/* Normal invocation convention. */
-
-/* The include_next requires a split double-inclusion guard. */
-#if @HAVE_UNISTD_H@
-# define _GL_INCLUDING_UNISTD_H
-# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
-# undef _GL_INCLUDING_UNISTD_H
-#endif
-
-/* Get all possible declarations of gethostname(). */
-#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
- && !defined _GL_INCLUDING_WINSOCK2_H
-# define _GL_INCLUDING_WINSOCK2_H
-# include <winsock2.h>
-# undef _GL_INCLUDING_WINSOCK2_H
-#endif
-
-#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
-#define _@GUARD_PREFIX@_UNISTD_H
-
-/* NetBSD 5.0 mis-defines NULL. Also get size_t. */
-#include <stddef.h>
-
-/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
-/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
-/* But avoid namespace pollution on glibc systems. */
-#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
- || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
- && defined __CYGWIN__)) \
- && ! defined __GLIBC__
-# include <stdio.h>
-#endif
-
-/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
-/* But avoid namespace pollution on glibc systems. */
-#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
- && ! defined __GLIBC__
-# include <fcntl.h>
-#endif
-
-/* mingw fails to declare _exit in <unistd.h>. */
-/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
- <unistd.h>. */
-/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
-/* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
- included here. */
-/* But avoid namespace pollution on glibc systems. */
-#if !defined __GLIBC__ && !defined __osf__
-# define __need_system_stdlib_h
-# include <stdlib.h>
-# undef __need_system_stdlib_h
-#endif
-
-/* Native Windows platforms declare chdir, getcwd, rmdir in
- <io.h> and/or <direct.h>, not in <unistd.h>.
- They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
- lseek(), read(), unlink(), write() in <io.h>. */
-#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
- || defined GNULIB_POSIXCHECK) \
- && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
-# include <io.h> /* mingw32, mingw64 */
-# include <direct.h> /* mingw64, MSVC 9 */
-#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
- || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
- || defined GNULIB_POSIXCHECK) \
- && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
-# include <io.h>
-#endif
-
-/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
- NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
-/* But avoid namespace pollution on glibc systems. */
-#if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
- || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
- && !defined __GLIBC__
-# include <netdb.h>
-#endif
-
-/* MSVC defines off_t in <sys/types.h>.
- May also define off_t to a 64-bit type on native Windows. */
-#if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
-/* Get off_t. */
-# include <sys/types.h>
-#endif
-
-#if (@GNULIB_READ@ || @GNULIB_WRITE@ \
- || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
- || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
-/* Get ssize_t. */
-# include <sys/types.h>
-#endif
-
-/* Get getopt(), optarg, optind, opterr, optopt.
- But avoid namespace pollution on glibc systems. */
-#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
-# define __need_getopt
-# include <getopt.h>
-#endif
-
-#ifndef _GL_INLINE_HEADER_BEGIN
- #error "Please include config.h first."
-#endif
-_GL_INLINE_HEADER_BEGIN
-#ifndef _GL_UNISTD_INLINE
-# define _GL_UNISTD_INLINE _GL_INLINE
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-
-/* Hide some function declarations from <winsock2.h>. */
-
-#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
-# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef socket
-# define socket socket_used_without_including_sys_socket_h
-# undef connect
-# define connect connect_used_without_including_sys_socket_h
-# undef accept
-# define accept accept_used_without_including_sys_socket_h
-# undef bind
-# define bind bind_used_without_including_sys_socket_h
-# undef getpeername
-# define getpeername getpeername_used_without_including_sys_socket_h
-# undef getsockname
-# define getsockname getsockname_used_without_including_sys_socket_h
-# undef getsockopt
-# define getsockopt getsockopt_used_without_including_sys_socket_h
-# undef listen
-# define listen listen_used_without_including_sys_socket_h
-# undef recv
-# define recv recv_used_without_including_sys_socket_h
-# undef send
-# define send send_used_without_including_sys_socket_h
-# undef recvfrom
-# define recvfrom recvfrom_used_without_including_sys_socket_h
-# undef sendto
-# define sendto sendto_used_without_including_sys_socket_h
-# undef setsockopt
-# define setsockopt setsockopt_used_without_including_sys_socket_h
-# undef shutdown
-# define shutdown shutdown_used_without_including_sys_socket_h
-# else
- _GL_WARN_ON_USE (socket,
- "socket() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (connect,
- "connect() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (accept,
- "accept() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (bind,
- "bind() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (getpeername,
- "getpeername() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (getsockname,
- "getsockname() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (getsockopt,
- "getsockopt() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (listen,
- "listen() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (recv,
- "recv() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (send,
- "send() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (recvfrom,
- "recvfrom() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (sendto,
- "sendto() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (setsockopt,
- "setsockopt() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (shutdown,
- "shutdown() used without including <sys/socket.h>");
-# endif
-# endif
-# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef select
-# define select select_used_without_including_sys_select_h
-# else
- _GL_WARN_ON_USE (select,
- "select() used without including <sys/select.h>");
-# endif
-# endif
-#endif
-
-
-/* OS/2 EMX lacks these macros. */
-#ifndef STDIN_FILENO
-# define STDIN_FILENO 0
-#endif
-#ifndef STDOUT_FILENO
-# define STDOUT_FILENO 1
-#endif
-#ifndef STDERR_FILENO
-# define STDERR_FILENO 2
-#endif
-
-/* Ensure *_OK macros exist. */
-#ifndef F_OK
-# define F_OK 0
-# define X_OK 1
-# define W_OK 2
-# define R_OK 4
-#endif
-
-
-/* Declare overridden functions. */
-
-
-#if defined GNULIB_POSIXCHECK
-/* The access() function is a security risk. */
-_GL_WARN_ON_USE (access, "the access function is a security risk - "
- "use the gnulib module faccessat instead");
-#endif
-
-
-#if @GNULIB_CHDIR@
-_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIASWARN (chdir);
-#elif defined GNULIB_POSIXCHECK
-# undef chdir
-# if HAVE_RAW_DECL_CHDIR
-_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
- "use gnulib module chdir for portability");
-# endif
-#endif
-
-
-#if @GNULIB_CHOWN@
-/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
- to GID (if GID is not -1). Follow symbolic links.
- Return 0 if successful, otherwise -1 and errno set.
- See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
-# if @REPLACE_CHOWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef chown
-# define chown rpl_chown
-# endif
-_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
-# else
-# if !@HAVE_CHOWN@
-_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
-# endif
-_GL_CXXALIASWARN (chown);
-#elif defined GNULIB_POSIXCHECK
-# undef chown
-# if HAVE_RAW_DECL_CHOWN
-_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
- "doesn't treat a uid or gid of -1 on some systems - "
- "use gnulib module chown for portability");
-# endif
-#endif
-
-
-#if @GNULIB_CLOSE@
-# if @REPLACE_CLOSE@
-/* Automatically included by modules that need a replacement for close. */
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef close
-# define close rpl_close
-# endif
-_GL_FUNCDECL_RPL (close, int, (int fd));
-_GL_CXXALIAS_RPL (close, int, (int fd));
-# else
-_GL_CXXALIAS_SYS (close, int, (int fd));
-# endif
-_GL_CXXALIASWARN (close);
-#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
-# undef close
-# define close close_used_without_requesting_gnulib_module_close
-#elif defined GNULIB_POSIXCHECK
-# undef close
-/* Assume close is always declared. */
-_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
- "use gnulib module close for portability");
-#endif
-
-
-#if @GNULIB_DUP@
-# if @REPLACE_DUP@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define dup rpl_dup
-# endif
-_GL_FUNCDECL_RPL (dup, int, (int oldfd));
-_GL_CXXALIAS_RPL (dup, int, (int oldfd));
-# else
-_GL_CXXALIAS_SYS (dup, int, (int oldfd));
-# endif
-_GL_CXXALIASWARN (dup);
-#elif defined GNULIB_POSIXCHECK
-# undef dup
-# if HAVE_RAW_DECL_DUP
-_GL_WARN_ON_USE (dup, "dup is unportable - "
- "use gnulib module dup for portability");
-# endif
-#endif
-
-
-#if @GNULIB_DUP2@
-/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
- NEWFD = OLDFD, otherwise close NEWFD first if it is open.
- Return newfd if successful, otherwise -1 and errno set.
- See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
-# if @REPLACE_DUP2@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define dup2 rpl_dup2
-# endif
-_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
-_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
-# else
-# if !@HAVE_DUP2@
-_GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
-# endif
-_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
-# endif
-_GL_CXXALIASWARN (dup2);
-#elif defined GNULIB_POSIXCHECK
-# undef dup2
-# if HAVE_RAW_DECL_DUP2
-_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
- "use gnulib module dup2 for portability");
-# endif
-#endif
-
-
-#if @GNULIB_DUP3@
-/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
- specified flags.
- The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
- and O_TEXT, O_BINARY (defined in "binary-io.h").
- Close NEWFD first if it is open.
- Return newfd if successful, otherwise -1 and errno set.
- See the Linux man page at
- <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
-# if @HAVE_DUP3@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define dup3 rpl_dup3
-# endif
-_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
-_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
-# else
-_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
-_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
-# endif
-_GL_CXXALIASWARN (dup3);
-#elif defined GNULIB_POSIXCHECK
-# undef dup3
-# if HAVE_RAW_DECL_DUP3
-_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
- "use gnulib module dup3 for portability");
-# endif
-#endif
-
-
-#if @GNULIB_ENVIRON@
-# if !@HAVE_DECL_ENVIRON@
-/* Set of environment variables and values. An array of strings of the form
- "VARIABLE=VALUE", terminated with a NULL. */
-# if defined __APPLE__ && defined __MACH__
-# include <TargetConditionals.h>
-# if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
-# define _GL_USE_CRT_EXTERNS
-# endif
-# endif
-# ifdef _GL_USE_CRT_EXTERNS
-# include <crt_externs.h>
-# define environ (*_NSGetEnviron ())
-# else
-# ifdef __cplusplus
-extern "C" {
-# endif
-extern char **environ;
-# ifdef __cplusplus
-}
-# endif
-# endif
-# endif
-#elif defined GNULIB_POSIXCHECK
-# if HAVE_RAW_DECL_ENVIRON
-_GL_UNISTD_INLINE char ***
-rpl_environ (void)
-{
- return &environ;
-}
-_GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
- "use gnulib module environ for portability");
-# undef environ
-# define environ (*rpl_environ ())
-# endif
-#endif
-
-
-#if @GNULIB_EUIDACCESS@
-/* Like access(), except that it uses the effective user id and group id of
- the current process. */
-# if !@HAVE_EUIDACCESS@
-_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
-_GL_CXXALIASWARN (euidaccess);
-# if defined GNULIB_POSIXCHECK
-/* Like access(), this function is a security risk. */
-_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
- "use the gnulib module faccessat instead");
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef euidaccess
-# if HAVE_RAW_DECL_EUIDACCESS
-_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
- "use gnulib module euidaccess for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FACCESSAT@
-# if !@HAVE_FACCESSAT@
-_GL_FUNCDECL_SYS (faccessat, int,
- (int fd, char const *file, int mode, int flag)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (faccessat, int,
- (int fd, char const *file, int mode, int flag));
-_GL_CXXALIASWARN (faccessat);
-#elif defined GNULIB_POSIXCHECK
-# undef faccessat
-# if HAVE_RAW_DECL_FACCESSAT
-_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
- "use gnulib module faccessat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FCHDIR@
-/* Change the process' current working directory to the directory on which
- the given file descriptor is open.
- Return 0 if successful, otherwise -1 and errno set.
- See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
-# if ! @HAVE_FCHDIR@
-_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
-
-/* Gnulib internal hooks needed to maintain the fchdir metadata. */
-_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
- _GL_ARG_NONNULL ((2));
-_GL_EXTERN_C void _gl_unregister_fd (int fd);
-_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
-_GL_EXTERN_C const char *_gl_directory_name (int fd);
-
-# else
-# if !@HAVE_DECL_FCHDIR@
-_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
-# endif
-# endif
-_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
-_GL_CXXALIASWARN (fchdir);
-#elif defined GNULIB_POSIXCHECK
-# undef fchdir
-# if HAVE_RAW_DECL_FCHDIR
-_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
- "use gnulib module fchdir for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FCHOWNAT@
-# if @REPLACE_FCHOWNAT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef fchownat
-# define fchownat rpl_fchownat
-# endif
-_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
- uid_t owner, gid_t group, int flag)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
- uid_t owner, gid_t group, int flag));
-# else
-# if !@HAVE_FCHOWNAT@
-_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
- uid_t owner, gid_t group, int flag)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
- uid_t owner, gid_t group, int flag));
-# endif
-_GL_CXXALIASWARN (fchownat);
-#elif defined GNULIB_POSIXCHECK
-# undef fchownat
-# if HAVE_RAW_DECL_FCHOWNAT
-_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
- "use gnulib module openat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FDATASYNC@
-/* Synchronize changes to a file.
- Return 0 if successful, otherwise -1 and errno set.
- See POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
-# if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
-_GL_FUNCDECL_SYS (fdatasync, int, (int fd));
-# endif
-_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
-_GL_CXXALIASWARN (fdatasync);
-#elif defined GNULIB_POSIXCHECK
-# undef fdatasync
-# if HAVE_RAW_DECL_FDATASYNC
-_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
- "use gnulib module fdatasync for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FSYNC@
-/* Synchronize changes, including metadata, to a file.
- Return 0 if successful, otherwise -1 and errno set.
- See POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
-# if !@HAVE_FSYNC@
-_GL_FUNCDECL_SYS (fsync, int, (int fd));
-# endif
-_GL_CXXALIAS_SYS (fsync, int, (int fd));
-_GL_CXXALIASWARN (fsync);
-#elif defined GNULIB_POSIXCHECK
-# undef fsync
-# if HAVE_RAW_DECL_FSYNC
-_GL_WARN_ON_USE (fsync, "fsync is unportable - "
- "use gnulib module fsync for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FTRUNCATE@
-/* Change the size of the file to which FD is opened to become equal to LENGTH.
- Return 0 if successful, otherwise -1 and errno set.
- See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
-# if @REPLACE_FTRUNCATE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef ftruncate
-# define ftruncate rpl_ftruncate
-# endif
-_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
-_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
-# else
-# if !@HAVE_FTRUNCATE@
-_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
-# endif
-_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
-# endif
-_GL_CXXALIASWARN (ftruncate);
-#elif defined GNULIB_POSIXCHECK
-# undef ftruncate
-# if HAVE_RAW_DECL_FTRUNCATE
-_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
- "use gnulib module ftruncate for portability");
-# endif
-#endif
-
-
-#if @GNULIB_GETCWD@
-/* Get the name of the current working directory, and put it in SIZE bytes
- of BUF.
- Return BUF if successful, or NULL if the directory couldn't be determined
- or SIZE was too small.
- See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
- Additionally, the gnulib module 'getcwd' guarantees the following GNU
- extension: If BUF is NULL, an array is allocated with 'malloc'; the array
- is SIZE bytes long, unless SIZE == 0, in which case it is as big as
- necessary. */
-# if @REPLACE_GETCWD@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define getcwd rpl_getcwd
-# endif
-_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
-_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
-# else
-/* Need to cast, because on mingw, the second parameter is
- int size. */
-_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
-# endif
-_GL_CXXALIASWARN (getcwd);
-#elif defined GNULIB_POSIXCHECK
-# undef getcwd
-# if HAVE_RAW_DECL_GETCWD
-_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
- "use gnulib module getcwd for portability");
-# endif
-#endif
-
-
-#if @GNULIB_GETDOMAINNAME@
-/* Return the NIS domain name of the machine.
- WARNING! The NIS domain name is unrelated to the fully qualified host name
- of the machine. It is also unrelated to email addresses.
- WARNING! The NIS domain name is usually the empty string or "(none)" when
- not using NIS.
-
- Put up to LEN bytes of the NIS domain name into NAME.
- Null terminate it if the name is shorter than LEN.
- If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
- Return 0 if successful, otherwise set errno and return -1. */
-# if @REPLACE_GETDOMAINNAME@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef getdomainname
-# define getdomainname rpl_getdomainname
-# endif
-_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
-# else
-# if !@HAVE_DECL_GETDOMAINNAME@
-_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
-# endif
-_GL_CXXALIASWARN (getdomainname);
-#elif defined GNULIB_POSIXCHECK
-# undef getdomainname
-# if HAVE_RAW_DECL_GETDOMAINNAME
-_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
- "use gnulib module getdomainname for portability");
-# endif
-#endif
-
-
-#if @GNULIB_GETDTABLESIZE@
-/* Return the maximum number of file descriptors in the current process.
- In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
-# if @REPLACE_GETDTABLESIZE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef getdtablesize
-# define getdtablesize rpl_getdtablesize
-# endif
-_GL_FUNCDECL_RPL (getdtablesize, int, (void));
-_GL_CXXALIAS_RPL (getdtablesize, int, (void));
-# else
-# if !@HAVE_GETDTABLESIZE@
-_GL_FUNCDECL_SYS (getdtablesize, int, (void));
-# endif
-_GL_CXXALIAS_SYS (getdtablesize, int, (void));
-# endif
-_GL_CXXALIASWARN (getdtablesize);
-#elif defined GNULIB_POSIXCHECK
-# undef getdtablesize
-# if HAVE_RAW_DECL_GETDTABLESIZE
-_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
- "use gnulib module getdtablesize for portability");
-# endif
-#endif
-
-
-#if @GNULIB_GETGROUPS@
-/* Return the supplemental groups that the current process belongs to.
- It is unspecified whether the effective group id is in the list.
- If N is 0, return the group count; otherwise, N describes how many
- entries are available in GROUPS. Return -1 and set errno if N is
- not 0 and not large enough. Fails with ENOSYS on some systems. */
-# if @REPLACE_GETGROUPS@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef getgroups
-# define getgroups rpl_getgroups
-# endif
-_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
-_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
-# else
-# if !@HAVE_GETGROUPS@
-_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
-# endif
-_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
-# endif
-_GL_CXXALIASWARN (getgroups);
-#elif defined GNULIB_POSIXCHECK
-# undef getgroups
-# if HAVE_RAW_DECL_GETGROUPS
-_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
- "use gnulib module getgroups for portability");
-# endif
-#endif
-
-
-#if @GNULIB_GETHOSTNAME@
-/* Return the standard host name of the machine.
- WARNING! The host name may or may not be fully qualified.
-
- Put up to LEN bytes of the host name into NAME.
- Null terminate it if the name is shorter than LEN.
- If the host name is longer than LEN, set errno = EINVAL and return -1.
- Return 0 if successful, otherwise set errno and return -1. */
-# if @UNISTD_H_HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gethostname
-# define gethostname rpl_gethostname
-# endif
-_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
-# else
-# if !@HAVE_GETHOSTNAME@
-_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
- _GL_ARG_NONNULL ((1)));
-# endif
-/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
- parameter is
- int len. */
-_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
-# endif
-_GL_CXXALIASWARN (gethostname);
-#elif @UNISTD_H_HAVE_WINSOCK2_H@
-# undef gethostname
-# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
-#elif defined GNULIB_POSIXCHECK
-# undef gethostname
-# if HAVE_RAW_DECL_GETHOSTNAME
-_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
- "use gnulib module gethostname for portability");
-# endif
-#endif
-
-
-#if @GNULIB_GETLOGIN@
-/* Returns the user's login name, or NULL if it cannot be found. Upon error,
- returns NULL with errno set.
-
- See <http://www.opengroup.org/susv3xsh/getlogin.html>.
-
- Most programs don't need to use this function, because the information is
- available through environment variables:
- ${LOGNAME-$USER} on Unix platforms,
- $USERNAME on native Windows platforms.
- */
-# if !@HAVE_GETLOGIN@
-_GL_FUNCDECL_SYS (getlogin, char *, (void));
-# endif
-_GL_CXXALIAS_SYS (getlogin, char *, (void));
-_GL_CXXALIASWARN (getlogin);
-#elif defined GNULIB_POSIXCHECK
-# undef getlogin
-# if HAVE_RAW_DECL_GETLOGIN
-_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
- "use gnulib module getlogin for portability");
-# endif
-#endif
-
-
-#if @GNULIB_GETLOGIN_R@
-/* Copies the user's login name to NAME.
- The array pointed to by NAME has room for SIZE bytes.
-
- Returns 0 if successful. Upon error, an error number is returned, or -1 in
- the case that the login name cannot be found but no specific error is
- provided (this case is hopefully rare but is left open by the POSIX spec).
-
- See <http://www.opengroup.org/susv3xsh/getlogin.html>.
-
- Most programs don't need to use this function, because the information is
- available through environment variables:
- ${LOGNAME-$USER} on Unix platforms,
- $USERNAME on native Windows platforms.
- */
-# if @REPLACE_GETLOGIN_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define getlogin_r rpl_getlogin_r
-# endif
-_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
-# else
-# if !@HAVE_DECL_GETLOGIN_R@
-_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
- _GL_ARG_NONNULL ((1)));
-# endif
-/* Need to cast, because on Solaris 10 systems, the second argument is
- int size. */
-_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
-# endif
-_GL_CXXALIASWARN (getlogin_r);
-#elif defined GNULIB_POSIXCHECK
-# undef getlogin_r
-# if HAVE_RAW_DECL_GETLOGIN_R
-_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
- "use gnulib module getlogin_r for portability");
-# endif
-#endif
-
-
-#if @GNULIB_GETPAGESIZE@
-# if @REPLACE_GETPAGESIZE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define getpagesize rpl_getpagesize
-# endif
-_GL_FUNCDECL_RPL (getpagesize, int, (void));
-_GL_CXXALIAS_RPL (getpagesize, int, (void));
-# else
-# if !@HAVE_GETPAGESIZE@
-# if !defined getpagesize
-/* This is for POSIX systems. */
-# if !defined _gl_getpagesize && defined _SC_PAGESIZE
-# if ! (defined __VMS && __VMS_VER < 70000000)
-# define _gl_getpagesize() sysconf (_SC_PAGESIZE)
-# endif
-# endif
-/* This is for older VMS. */
-# if !defined _gl_getpagesize && defined __VMS
-# ifdef __ALPHA
-# define _gl_getpagesize() 8192
-# else
-# define _gl_getpagesize() 512
-# endif
-# endif
-/* This is for BeOS. */
-# if !defined _gl_getpagesize && @HAVE_OS_H@
-# include <OS.h>
-# if defined B_PAGE_SIZE
-# define _gl_getpagesize() B_PAGE_SIZE
-# endif
-# endif
-/* This is for AmigaOS4.0. */
-# if !defined _gl_getpagesize && defined __amigaos4__
-# define _gl_getpagesize() 2048
-# endif
-/* This is for older Unix systems. */
-# if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
-# include <sys/param.h>
-# ifdef EXEC_PAGESIZE
-# define _gl_getpagesize() EXEC_PAGESIZE
-# else
-# ifdef NBPG
-# ifndef CLSIZE
-# define CLSIZE 1
-# endif
-# define _gl_getpagesize() (NBPG * CLSIZE)
-# else
-# ifdef NBPC
-# define _gl_getpagesize() NBPC
-# endif
-# endif
-# endif
-# endif
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define getpagesize() _gl_getpagesize ()
-# else
-# if !GNULIB_defined_getpagesize_function
-_GL_UNISTD_INLINE int
-getpagesize ()
-{
- return _gl_getpagesize ();
-}
-# define GNULIB_defined_getpagesize_function 1
-# endif
-# endif
-# endif
-# endif
-/* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
-_GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
-# endif
-# if @HAVE_DECL_GETPAGESIZE@
-_GL_CXXALIASWARN (getpagesize);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef getpagesize
-# if HAVE_RAW_DECL_GETPAGESIZE
-_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
- "use gnulib module getpagesize for portability");
-# endif
-#endif
-
-
-#if @GNULIB_GETUSERSHELL@
-/* Return the next valid login shell on the system, or NULL when the end of
- the list has been reached. */
-# if !@HAVE_DECL_GETUSERSHELL@
-_GL_FUNCDECL_SYS (getusershell, char *, (void));
-# endif
-_GL_CXXALIAS_SYS (getusershell, char *, (void));
-_GL_CXXALIASWARN (getusershell);
-#elif defined GNULIB_POSIXCHECK
-# undef getusershell
-# if HAVE_RAW_DECL_GETUSERSHELL
-_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
- "use gnulib module getusershell for portability");
-# endif
-#endif
-
-#if @GNULIB_GETUSERSHELL@
-/* Rewind to pointer that is advanced at each getusershell() call. */
-# if !@HAVE_DECL_GETUSERSHELL@
-_GL_FUNCDECL_SYS (setusershell, void, (void));
-# endif
-_GL_CXXALIAS_SYS (setusershell, void, (void));
-_GL_CXXALIASWARN (setusershell);
-#elif defined GNULIB_POSIXCHECK
-# undef setusershell
-# if HAVE_RAW_DECL_SETUSERSHELL
-_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
- "use gnulib module getusershell for portability");
-# endif
-#endif
-
-#if @GNULIB_GETUSERSHELL@
-/* Free the pointer that is advanced at each getusershell() call and
- associated resources. */
-# if !@HAVE_DECL_GETUSERSHELL@
-_GL_FUNCDECL_SYS (endusershell, void, (void));
-# endif
-_GL_CXXALIAS_SYS (endusershell, void, (void));
-_GL_CXXALIASWARN (endusershell);
-#elif defined GNULIB_POSIXCHECK
-# undef endusershell
-# if HAVE_RAW_DECL_ENDUSERSHELL
-_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
- "use gnulib module getusershell for portability");
-# endif
-#endif
-
-
-#if @GNULIB_GROUP_MEMBER@
-/* Determine whether group id is in calling user's group list. */
-# if !@HAVE_GROUP_MEMBER@
-_GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
-# endif
-_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
-_GL_CXXALIASWARN (group_member);
-#elif defined GNULIB_POSIXCHECK
-# undef group_member
-# if HAVE_RAW_DECL_GROUP_MEMBER
-_GL_WARN_ON_USE (group_member, "group_member is unportable - "
- "use gnulib module group-member for portability");
-# endif
-#endif
-
-
-#if @GNULIB_ISATTY@
-# if @REPLACE_ISATTY@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef isatty
-# define isatty rpl_isatty
-# endif
-_GL_FUNCDECL_RPL (isatty, int, (int fd));
-_GL_CXXALIAS_RPL (isatty, int, (int fd));
-# else
-_GL_CXXALIAS_SYS (isatty, int, (int fd));
-# endif
-_GL_CXXALIASWARN (isatty);
-#elif defined GNULIB_POSIXCHECK
-# undef isatty
-# if HAVE_RAW_DECL_ISATTY
-_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
- "use gnulib module isatty for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LCHOWN@
-/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
- to GID (if GID is not -1). Do not follow symbolic links.
- Return 0 if successful, otherwise -1 and errno set.
- See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
-# if @REPLACE_LCHOWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef lchown
-# define lchown rpl_lchown
-# endif
-_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
-# else
-# if !@HAVE_LCHOWN@
-_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
- _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
-# endif
-_GL_CXXALIASWARN (lchown);
-#elif defined GNULIB_POSIXCHECK
-# undef lchown
-# if HAVE_RAW_DECL_LCHOWN
-_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
- "use gnulib module lchown for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LINK@
-/* Create a new hard link for an existing file.
- Return 0 if successful, otherwise -1 and errno set.
- See POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
-# if @REPLACE_LINK@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define link rpl_link
-# endif
-_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
-# else
-# if !@HAVE_LINK@
-_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
-# endif
-_GL_CXXALIASWARN (link);
-#elif defined GNULIB_POSIXCHECK
-# undef link
-# if HAVE_RAW_DECL_LINK
-_GL_WARN_ON_USE (link, "link is unportable - "
- "use gnulib module link for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LINKAT@
-/* Create a new hard link for an existing file, relative to two
- directories. FLAG controls whether symlinks are followed.
- Return 0 if successful, otherwise -1 and errno set. */
-# if @REPLACE_LINKAT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef linkat
-# define linkat rpl_linkat
-# endif
-_GL_FUNCDECL_RPL (linkat, int,
- (int fd1, const char *path1, int fd2, const char *path2,
- int flag)
- _GL_ARG_NONNULL ((2, 4)));
-_GL_CXXALIAS_RPL (linkat, int,
- (int fd1, const char *path1, int fd2, const char *path2,
- int flag));
-# else
-# if !@HAVE_LINKAT@
-_GL_FUNCDECL_SYS (linkat, int,
- (int fd1, const char *path1, int fd2, const char *path2,
- int flag)
- _GL_ARG_NONNULL ((2, 4)));
-# endif
-_GL_CXXALIAS_SYS (linkat, int,
- (int fd1, const char *path1, int fd2, const char *path2,
- int flag));
-# endif
-_GL_CXXALIASWARN (linkat);
-#elif defined GNULIB_POSIXCHECK
-# undef linkat
-# if HAVE_RAW_DECL_LINKAT
-_GL_WARN_ON_USE (linkat, "linkat is unportable - "
- "use gnulib module linkat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LSEEK@
-/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
- Return the new offset if successful, otherwise -1 and errno set.
- See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
-# if @REPLACE_LSEEK@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define lseek rpl_lseek
-# endif
-_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
-_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
-# else
-_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
-# endif
-_GL_CXXALIASWARN (lseek);
-#elif defined GNULIB_POSIXCHECK
-# undef lseek
-# if HAVE_RAW_DECL_LSEEK
-_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
- "systems - use gnulib module lseek for portability");
-# endif
-#endif
-
-
-#if @GNULIB_PIPE@
-/* Create a pipe, defaulting to O_BINARY mode.
- Store the read-end as fd[0] and the write-end as fd[1].
- Return 0 upon success, or -1 with errno set upon failure. */
-# if !@HAVE_PIPE@
-_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
-_GL_CXXALIASWARN (pipe);
-#elif defined GNULIB_POSIXCHECK
-# undef pipe
-# if HAVE_RAW_DECL_PIPE
-_GL_WARN_ON_USE (pipe, "pipe is unportable - "
- "use gnulib module pipe-posix for portability");
-# endif
-#endif
-
-
-#if @GNULIB_PIPE2@
-/* Create a pipe, applying the given flags when opening the read-end of the
- pipe and the write-end of the pipe.
- The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
- and O_TEXT, O_BINARY (defined in "binary-io.h").
- Store the read-end as fd[0] and the write-end as fd[1].
- Return 0 upon success, or -1 with errno set upon failure.
- See also the Linux man page at
- <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
-# if @HAVE_PIPE2@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define pipe2 rpl_pipe2
-# endif
-_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
-# else
-_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
-# endif
-_GL_CXXALIASWARN (pipe2);
-#elif defined GNULIB_POSIXCHECK
-# undef pipe2
-# if HAVE_RAW_DECL_PIPE2
-_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
- "use gnulib module pipe2 for portability");
-# endif
-#endif
-
-
-#if @GNULIB_PREAD@
-/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
- Return the number of bytes placed into BUF if successful, otherwise
- set errno and return -1. 0 indicates EOF.
- See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
-# if @REPLACE_PREAD@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef pread
-# define pread rpl_pread
-# endif
-_GL_FUNCDECL_RPL (pread, ssize_t,
- (int fd, void *buf, size_t bufsize, off_t offset)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (pread, ssize_t,
- (int fd, void *buf, size_t bufsize, off_t offset));
-# else
-# if !@HAVE_PREAD@
-_GL_FUNCDECL_SYS (pread, ssize_t,
- (int fd, void *buf, size_t bufsize, off_t offset)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (pread, ssize_t,
- (int fd, void *buf, size_t bufsize, off_t offset));
-# endif
-_GL_CXXALIASWARN (pread);
-#elif defined GNULIB_POSIXCHECK
-# undef pread
-# if HAVE_RAW_DECL_PREAD
-_GL_WARN_ON_USE (pread, "pread is unportable - "
- "use gnulib module pread for portability");
-# endif
-#endif
-
-
-#if @GNULIB_PWRITE@
-/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
- Return the number of bytes written if successful, otherwise
- set errno and return -1. 0 indicates nothing written. See the
- POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
-# if @REPLACE_PWRITE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef pwrite
-# define pwrite rpl_pwrite
-# endif
-_GL_FUNCDECL_RPL (pwrite, ssize_t,
- (int fd, const void *buf, size_t bufsize, off_t offset)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (pwrite, ssize_t,
- (int fd, const void *buf, size_t bufsize, off_t offset));
-# else
-# if !@HAVE_PWRITE@
-_GL_FUNCDECL_SYS (pwrite, ssize_t,
- (int fd, const void *buf, size_t bufsize, off_t offset)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (pwrite, ssize_t,
- (int fd, const void *buf, size_t bufsize, off_t offset));
-# endif
-_GL_CXXALIASWARN (pwrite);
-#elif defined GNULIB_POSIXCHECK
-# undef pwrite
-# if HAVE_RAW_DECL_PWRITE
-_GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
- "use gnulib module pwrite for portability");
-# endif
-#endif
-
-
-#if @GNULIB_READ@
-/* Read up to COUNT bytes from file descriptor FD into the buffer starting
- at BUF. See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
-# if @REPLACE_READ@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef read
-# define read rpl_read
-# endif
-_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
-# else
-/* Need to cast, because on mingw, the third parameter is
- unsigned int count
- and the return type is 'int'. */
-_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
-# endif
-_GL_CXXALIASWARN (read);
-#endif
-
-
-#if @GNULIB_READLINK@
-/* Read the contents of the symbolic link FILE and place the first BUFSIZE
- bytes of it into BUF. Return the number of bytes placed into BUF if
- successful, otherwise -1 and errno set.
- See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
-# if @REPLACE_READLINK@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define readlink rpl_readlink
-# endif
-_GL_FUNCDECL_RPL (readlink, ssize_t,
- (const char *file, char *buf, size_t bufsize)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (readlink, ssize_t,
- (const char *file, char *buf, size_t bufsize));
-# else
-# if !@HAVE_READLINK@
-_GL_FUNCDECL_SYS (readlink, ssize_t,
- (const char *file, char *buf, size_t bufsize)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (readlink, ssize_t,
- (const char *file, char *buf, size_t bufsize));
-# endif
-_GL_CXXALIASWARN (readlink);
-#elif defined GNULIB_POSIXCHECK
-# undef readlink
-# if HAVE_RAW_DECL_READLINK
-_GL_WARN_ON_USE (readlink, "readlink is unportable - "
- "use gnulib module readlink for portability");
-# endif
-#endif
-
-
-#if @GNULIB_READLINKAT@
-# if @REPLACE_READLINKAT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define readlinkat rpl_readlinkat
-# endif
-_GL_FUNCDECL_RPL (readlinkat, ssize_t,
- (int fd, char const *file, char *buf, size_t len)
- _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (readlinkat, ssize_t,
- (int fd, char const *file, char *buf, size_t len));
-# else
-# if !@HAVE_READLINKAT@
-_GL_FUNCDECL_SYS (readlinkat, ssize_t,
- (int fd, char const *file, char *buf, size_t len)
- _GL_ARG_NONNULL ((2, 3)));
-# endif
-_GL_CXXALIAS_SYS (readlinkat, ssize_t,
- (int fd, char const *file, char *buf, size_t len));
-# endif
-_GL_CXXALIASWARN (readlinkat);
-#elif defined GNULIB_POSIXCHECK
-# undef readlinkat
-# if HAVE_RAW_DECL_READLINKAT
-_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
- "use gnulib module readlinkat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_RMDIR@
-/* Remove the directory DIR. */
-# if @REPLACE_RMDIR@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define rmdir rpl_rmdir
-# endif
-_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
-# else
-_GL_CXXALIAS_SYS (rmdir, int, (char const *name));
-# endif
-_GL_CXXALIASWARN (rmdir);
-#elif defined GNULIB_POSIXCHECK
-# undef rmdir
-# if HAVE_RAW_DECL_RMDIR
-_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
- "use gnulib module rmdir for portability");
-# endif
-#endif
-
-
-#if @GNULIB_SETHOSTNAME@
-/* Set the host name of the machine.
- The host name may or may not be fully qualified.
-
- Put LEN bytes of NAME into the host name.
- Return 0 if successful, otherwise, set errno and return -1.
-
- Platforms with no ability to set the hostname return -1 and set
- errno = ENOSYS. */
-# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
-_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
- _GL_ARG_NONNULL ((1)));
-# endif
-/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
- and FreeBSD 6.4 the second parameter is int. On Solaris 11
- 2011-10, the first parameter is not const. */
-_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
-_GL_CXXALIASWARN (sethostname);
-#elif defined GNULIB_POSIXCHECK
-# undef sethostname
-# if HAVE_RAW_DECL_SETHOSTNAME
-_GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
- "use gnulib module sethostname for portability");
-# endif
-#endif
-
-
-#if @GNULIB_SLEEP@
-/* Pause the execution of the current thread for N seconds.
- Returns the number of seconds left to sleep.
- See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
-# if @REPLACE_SLEEP@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef sleep
-# define sleep rpl_sleep
-# endif
-_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
-_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
-# else
-# if !@HAVE_SLEEP@
-_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
-# endif
-_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
-# endif
-_GL_CXXALIASWARN (sleep);
-#elif defined GNULIB_POSIXCHECK
-# undef sleep
-# if HAVE_RAW_DECL_SLEEP
-_GL_WARN_ON_USE (sleep, "sleep is unportable - "
- "use gnulib module sleep for portability");
-# endif
-#endif
-
-
-#if @GNULIB_SYMLINK@
-# if @REPLACE_SYMLINK@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef symlink
-# define symlink rpl_symlink
-# endif
-_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
-# else
-# if !@HAVE_SYMLINK@
-_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
- _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
-# endif
-_GL_CXXALIASWARN (symlink);
-#elif defined GNULIB_POSIXCHECK
-# undef symlink
-# if HAVE_RAW_DECL_SYMLINK
-_GL_WARN_ON_USE (symlink, "symlink is not portable - "
- "use gnulib module symlink for portability");
-# endif
-#endif
-
-
-#if @GNULIB_SYMLINKAT@
-# if @REPLACE_SYMLINKAT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef symlinkat
-# define symlinkat rpl_symlinkat
-# endif
-_GL_FUNCDECL_RPL (symlinkat, int,
- (char const *contents, int fd, char const *file)
- _GL_ARG_NONNULL ((1, 3)));
-_GL_CXXALIAS_RPL (symlinkat, int,
- (char const *contents, int fd, char const *file));
-# else
-# if !@HAVE_SYMLINKAT@
-_GL_FUNCDECL_SYS (symlinkat, int,
- (char const *contents, int fd, char const *file)
- _GL_ARG_NONNULL ((1, 3)));
-# endif
-_GL_CXXALIAS_SYS (symlinkat, int,
- (char const *contents, int fd, char const *file));
-# endif
-_GL_CXXALIASWARN (symlinkat);
-#elif defined GNULIB_POSIXCHECK
-# undef symlinkat
-# if HAVE_RAW_DECL_SYMLINKAT
-_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
- "use gnulib module symlinkat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_TTYNAME_R@
-/* Store at most BUFLEN characters of the pathname of the terminal FD is
- open on in BUF. Return 0 on success, otherwise an error number. */
-# if @REPLACE_TTYNAME_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef ttyname_r
-# define ttyname_r rpl_ttyname_r
-# endif
-_GL_FUNCDECL_RPL (ttyname_r, int,
- (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (ttyname_r, int,
- (int fd, char *buf, size_t buflen));
-# else
-# if !@HAVE_DECL_TTYNAME_R@
-_GL_FUNCDECL_SYS (ttyname_r, int,
- (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (ttyname_r, int,
- (int fd, char *buf, size_t buflen));
-# endif
-_GL_CXXALIASWARN (ttyname_r);
-#elif defined GNULIB_POSIXCHECK
-# undef ttyname_r
-# if HAVE_RAW_DECL_TTYNAME_R
-_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
- "use gnulib module ttyname_r for portability");
-# endif
-#endif
-
-
-#if @GNULIB_UNLINK@
-# if @REPLACE_UNLINK@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef unlink
-# define unlink rpl_unlink
-# endif
-_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (unlink, int, (char const *file));
-# else
-_GL_CXXALIAS_SYS (unlink, int, (char const *file));
-# endif
-_GL_CXXALIASWARN (unlink);
-#elif defined GNULIB_POSIXCHECK
-# undef unlink
-# if HAVE_RAW_DECL_UNLINK
-_GL_WARN_ON_USE (unlink, "unlink is not portable - "
- "use gnulib module unlink for portability");
-# endif
-#endif
-
-
-#if @GNULIB_UNLINKAT@
-# if @REPLACE_UNLINKAT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef unlinkat
-# define unlinkat rpl_unlinkat
-# endif
-_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
-# else
-# if !@HAVE_UNLINKAT@
-_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
-# endif
-_GL_CXXALIASWARN (unlinkat);
-#elif defined GNULIB_POSIXCHECK
-# undef unlinkat
-# if HAVE_RAW_DECL_UNLINKAT
-_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
- "use gnulib module openat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_USLEEP@
-/* Pause the execution of the current thread for N microseconds.
- Returns 0 on completion, or -1 on range error.
- See the POSIX:2001 specification
- <http://www.opengroup.org/susv3xsh/usleep.html>. */
-# if @REPLACE_USLEEP@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef usleep
-# define usleep rpl_usleep
-# endif
-_GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
-_GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
-# else
-# if !@HAVE_USLEEP@
-_GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
-# endif
-_GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
-# endif
-_GL_CXXALIASWARN (usleep);
-#elif defined GNULIB_POSIXCHECK
-# undef usleep
-# if HAVE_RAW_DECL_USLEEP
-_GL_WARN_ON_USE (usleep, "usleep is unportable - "
- "use gnulib module usleep for portability");
-# endif
-#endif
-
-
-#if @GNULIB_WRITE@
-/* Write up to COUNT bytes starting at BUF to file descriptor FD.
- See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
-# if @REPLACE_WRITE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef write
-# define write rpl_write
-# endif
-_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
-# else
-/* Need to cast, because on mingw, the third parameter is
- unsigned int count
- and the return type is 'int'. */
-_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
-# endif
-_GL_CXXALIASWARN (write);
-#endif
-
-_GL_INLINE_HEADER_END
-
-#endif /* _@GUARD_PREFIX@_UNISTD_H */
-#endif /* _GL_INCLUDING_UNISTD_H */
-#endif /* _@GUARD_PREFIX@_UNISTD_H */
diff --git a/src/gl/unsetenv.c b/src/gl/unsetenv.c
deleted file mode 100644
index 836874475e..0000000000
--- a/src/gl/unsetenv.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Copyright (C) 1992, 1995-2002, 2005-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
- optimizes away the name == NULL test below. */
-#define _GL_ARG_NONNULL(params)
-
-#include <config.h>
-
-/* Specification. */
-#include <stdlib.h>
-
-#include <errno.h>
-#if !_LIBC
-# define __set_errno(ev) ((errno) = (ev))
-#endif
-
-#include <string.h>
-#include <unistd.h>
-
-#if !_LIBC
-# define __environ environ
-#endif
-
-#if _LIBC
-/* This lock protects against simultaneous modifications of 'environ'. */
-# include <bits/libc-lock.h>
-__libc_lock_define_initialized (static, envlock)
-# define LOCK __libc_lock_lock (envlock)
-# define UNLOCK __libc_lock_unlock (envlock)
-#else
-# define LOCK
-# define UNLOCK
-#endif
-
-/* In the GNU C library we must keep the namespace clean. */
-#ifdef _LIBC
-# define unsetenv __unsetenv
-#endif
-
-#if _LIBC || !HAVE_UNSETENV
-
-int
-unsetenv (const char *name)
-{
- size_t len;
- char **ep;
-
- if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- len = strlen (name);
-
- LOCK;
-
- ep = __environ;
- while (*ep != NULL)
- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
- {
- /* Found it. Remove this pointer by moving later ones back. */
- char **dp = ep;
-
- do
- dp[0] = dp[1];
- while (*dp++);
- /* Continue the loop in case NAME appears again. */
- }
- else
- ++ep;
-
- UNLOCK;
-
- return 0;
-}
-
-#ifdef _LIBC
-# undef unsetenv
-weak_alias (__unsetenv, unsetenv)
-#endif
-
-#else /* HAVE_UNSETENV */
-
-# undef unsetenv
-# if !HAVE_DECL_UNSETENV
-# if VOID_UNSETENV
-extern void unsetenv (const char *);
-# else
-extern int unsetenv (const char *);
-# endif
-# endif
-
-/* Call the underlying unsetenv, in case there is hidden bookkeeping
- that needs updating beyond just modifying environ. */
-int
-rpl_unsetenv (const char *name)
-{
- int result = 0;
- if (!name || !*name || strchr (name, '='))
- {
- errno = EINVAL;
- return -1;
- }
- while (getenv (name))
-# if !VOID_UNSETENV
- result =
-# endif
- unsetenv (name);
- return result;
-}
-
-#endif /* HAVE_UNSETENV */
diff --git a/src/gl/vasnprintf.c b/src/gl/vasnprintf.c
deleted file mode 100644
index f85c69d567..0000000000
--- a/src/gl/vasnprintf.c
+++ /dev/null
@@ -1,5598 +0,0 @@
-/* vsprintf with automatic memory allocation.
- Copyright (C) 1999, 2002-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* This file can be parametrized with the following macros:
- VASNPRINTF The name of the function being defined.
- FCHAR_T The element type of the format string.
- DCHAR_T The element type of the destination (result) string.
- FCHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters
- in the format string are ASCII. MUST be set if
- FCHAR_T and DCHAR_T are not the same type.
- DIRECTIVE Structure denoting a format directive.
- Depends on FCHAR_T.
- DIRECTIVES Structure denoting the set of format directives of a
- format string. Depends on FCHAR_T.
- PRINTF_PARSE Function that parses a format string.
- Depends on FCHAR_T.
- DCHAR_CPY memcpy like function for DCHAR_T[] arrays.
- DCHAR_SET memset like function for DCHAR_T[] arrays.
- DCHAR_MBSNLEN mbsnlen like function for DCHAR_T[] arrays.
- SNPRINTF The system's snprintf (or similar) function.
- This may be either snprintf or swprintf.
- TCHAR_T The element type of the argument and result string
- of the said SNPRINTF function. This may be either
- char or wchar_t. The code exploits that
- sizeof (TCHAR_T) | sizeof (DCHAR_T) and
- alignof (TCHAR_T) <= alignof (DCHAR_T).
- DCHAR_IS_TCHAR Set to 1 if DCHAR_T and TCHAR_T are the same type.
- DCHAR_CONV_FROM_ENCODING A function to convert from char[] to DCHAR[].
- DCHAR_IS_UINT8_T Set to 1 if DCHAR_T is uint8_t.
- DCHAR_IS_UINT16_T Set to 1 if DCHAR_T is uint16_t.
- DCHAR_IS_UINT32_T Set to 1 if DCHAR_T is uint32_t. */
-
-/* Tell glibc's <stdio.h> to provide a prototype for snprintf().
- This must come before <config.h> because <config.h> may include
- <features.h>, and once <features.h> has been included, it's too late. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
-
-#ifndef VASNPRINTF
-# include <config.h>
-#endif
-#ifndef IN_LIBINTL
-# include <alloca.h>
-#endif
-
-/* Specification. */
-#ifndef VASNPRINTF
-# if WIDE_CHAR_VERSION
-# include "vasnwprintf.h"
-# else
-# include "vasnprintf.h"
-# endif
-#endif
-
-#include <locale.h> /* localeconv() */
-#include <stdio.h> /* snprintf(), sprintf() */
-#include <stdlib.h> /* abort(), malloc(), realloc(), free() */
-#include <string.h> /* memcpy(), strlen() */
-#include <errno.h> /* errno */
-#include <limits.h> /* CHAR_BIT */
-#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */
-#if HAVE_NL_LANGINFO
-# include <langinfo.h>
-#endif
-#ifndef VASNPRINTF
-# if WIDE_CHAR_VERSION
-# include "wprintf-parse.h"
-# else
-# include "printf-parse.h"
-# endif
-#endif
-
-/* Checked size_t computations. */
-#include "xsize.h"
-
-#include "verify.h"
-
-#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
-# include <math.h>
-# include "float+.h"
-#endif
-
-#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
-# include <math.h>
-# include "isnand-nolibm.h"
-#endif
-
-#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL
-# include <math.h>
-# include "isnanl-nolibm.h"
-# include "fpucw.h"
-#endif
-
-#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
-# include <math.h>
-# include "isnand-nolibm.h"
-# include "printf-frexp.h"
-#endif
-
-#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
-# include <math.h>
-# include "isnanl-nolibm.h"
-# include "printf-frexpl.h"
-# include "fpucw.h"
-#endif
-
-/* Default parameters. */
-#ifndef VASNPRINTF
-# if WIDE_CHAR_VERSION
-# define VASNPRINTF vasnwprintf
-# define FCHAR_T wchar_t
-# define DCHAR_T wchar_t
-# define TCHAR_T wchar_t
-# define DCHAR_IS_TCHAR 1
-# define DIRECTIVE wchar_t_directive
-# define DIRECTIVES wchar_t_directives
-# define PRINTF_PARSE wprintf_parse
-# define DCHAR_CPY wmemcpy
-# define DCHAR_SET wmemset
-# else
-# define VASNPRINTF vasnprintf
-# define FCHAR_T char
-# define DCHAR_T char
-# define TCHAR_T char
-# define DCHAR_IS_TCHAR 1
-# define DIRECTIVE char_directive
-# define DIRECTIVES char_directives
-# define PRINTF_PARSE printf_parse
-# define DCHAR_CPY memcpy
-# define DCHAR_SET memset
-# endif
-#endif
-#if WIDE_CHAR_VERSION
- /* TCHAR_T is wchar_t. */
-# define USE_SNPRINTF 1
-# if HAVE_DECL__SNWPRINTF
- /* On Windows, the function swprintf() has a different signature than
- on Unix; we use the function _snwprintf() or - on mingw - snwprintf()
- instead. The mingw function snwprintf() has fewer bugs than the
- MSVCRT function _snwprintf(), so prefer that. */
-# if defined __MINGW32__
-# define SNPRINTF snwprintf
-# else
-# define SNPRINTF _snwprintf
-# endif
-# else
- /* Unix. */
-# define SNPRINTF swprintf
-# endif
-#else
- /* TCHAR_T is char. */
- /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'.
- But don't use it on BeOS, since BeOS snprintf produces no output if the
- size argument is >= 0x3000000.
- Also don't use it on Linux libc5, since there snprintf with size = 1
- writes any output without bounds, like sprintf. */
-# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__ && !(__GNU_LIBRARY__ == 1)
-# define USE_SNPRINTF 1
-# else
-# define USE_SNPRINTF 0
-# endif
-# if HAVE_DECL__SNPRINTF
- /* Windows. The mingw function snprintf() has fewer bugs than the MSVCRT
- function _snprintf(), so prefer that. */
-# if defined __MINGW32__
-# define SNPRINTF snprintf
- /* Here we need to call the native snprintf, not rpl_snprintf. */
-# undef snprintf
-# else
-# define SNPRINTF _snprintf
-# endif
-# else
- /* Unix. */
-# define SNPRINTF snprintf
- /* Here we need to call the native snprintf, not rpl_snprintf. */
-# undef snprintf
-# endif
-#endif
-/* Here we need to call the native sprintf, not rpl_sprintf. */
-#undef sprintf
-
-/* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized"
- warnings in this file. Use -Dlint to suppress them. */
-#if defined GCC_LINT || defined lint
-# define IF_LINT(Code) Code
-#else
-# define IF_LINT(Code) /* empty */
-#endif
-
-/* Avoid some warnings from "gcc -Wshadow".
- This file doesn't use the exp() and remainder() functions. */
-#undef exp
-#define exp expo
-#undef remainder
-#define remainder rem
-
-#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && !WIDE_CHAR_VERSION
-# if (HAVE_STRNLEN && !defined _AIX)
-# define local_strnlen strnlen
-# else
-# ifndef local_strnlen_defined
-# define local_strnlen_defined 1
-static size_t
-local_strnlen (const char *string, size_t maxlen)
-{
- const char *end = memchr (string, '\0', maxlen);
- return end ? (size_t) (end - string) : maxlen;
-}
-# endif
-# endif
-#endif
-
-#if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)) && HAVE_WCHAR_T
-# if HAVE_WCSLEN
-# define local_wcslen wcslen
-# else
- /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
- a dependency towards this library, here is a local substitute.
- Define this substitute only once, even if this file is included
- twice in the same compilation unit. */
-# ifndef local_wcslen_defined
-# define local_wcslen_defined 1
-static size_t
-local_wcslen (const wchar_t *s)
-{
- const wchar_t *ptr;
-
- for (ptr = s; *ptr != (wchar_t) 0; ptr++)
- ;
- return ptr - s;
-}
-# endif
-# endif
-#endif
-
-#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && HAVE_WCHAR_T && WIDE_CHAR_VERSION
-# if HAVE_WCSNLEN
-# define local_wcsnlen wcsnlen
-# else
-# ifndef local_wcsnlen_defined
-# define local_wcsnlen_defined 1
-static size_t
-local_wcsnlen (const wchar_t *s, size_t maxlen)
-{
- const wchar_t *ptr;
-
- for (ptr = s; maxlen > 0 && *ptr != (wchar_t) 0; ptr++, maxlen--)
- ;
- return ptr - s;
-}
-# endif
-# endif
-#endif
-
-#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
-/* Determine the decimal-point character according to the current locale. */
-# ifndef decimal_point_char_defined
-# define decimal_point_char_defined 1
-static char
-decimal_point_char (void)
-{
- const char *point;
- /* Determine it in a multithread-safe way. We know nl_langinfo is
- multithread-safe on glibc systems and Mac OS X systems, but is not required
- to be multithread-safe by POSIX. sprintf(), however, is multithread-safe.
- localeconv() is rarely multithread-safe. */
-# if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__))
- point = nl_langinfo (RADIXCHAR);
-# elif 1
- char pointbuf[5];
- sprintf (pointbuf, "%#.0f", 1.0);
- point = &pointbuf[1];
-# else
- point = localeconv () -> decimal_point;
-# endif
- /* The decimal point is always a single byte: either '.' or ','. */
- return (point[0] != '\0' ? point[0] : '.');
-}
-# endif
-#endif
-
-#if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE && !defined IN_LIBINTL
-
-/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */
-static int
-is_infinite_or_zero (double x)
-{
- return isnand (x) || x + x == x;
-}
-
-#endif
-
-#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL
-
-/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */
-static int
-is_infinite_or_zerol (long double x)
-{
- return isnanl (x) || x + x == x;
-}
-
-#endif
-
-#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
-
-/* Converting 'long double' to decimal without rare rounding bugs requires
- real bignums. We use the naming conventions of GNU gmp, but vastly simpler
- (and slower) algorithms. */
-
-typedef unsigned int mp_limb_t;
-# define GMP_LIMB_BITS 32
-verify (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS);
-
-typedef unsigned long long mp_twolimb_t;
-# define GMP_TWOLIMB_BITS 64
-verify (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS);
-
-/* Representation of a bignum >= 0. */
-typedef struct
-{
- size_t nlimbs;
- mp_limb_t *limbs; /* Bits in little-endian order, allocated with malloc(). */
-} mpn_t;
-
-/* Compute the product of two bignums >= 0.
- Return the allocated memory in case of success, NULL in case of memory
- allocation failure. */
-static void *
-multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
-{
- const mp_limb_t *p1;
- const mp_limb_t *p2;
- size_t len1;
- size_t len2;
-
- if (src1.nlimbs <= src2.nlimbs)
- {
- len1 = src1.nlimbs;
- p1 = src1.limbs;
- len2 = src2.nlimbs;
- p2 = src2.limbs;
- }
- else
- {
- len1 = src2.nlimbs;
- p1 = src2.limbs;
- len2 = src1.nlimbs;
- p2 = src1.limbs;
- }
- /* Now 0 <= len1 <= len2. */
- if (len1 == 0)
- {
- /* src1 or src2 is zero. */
- dest->nlimbs = 0;
- dest->limbs = (mp_limb_t *) malloc (1);
- }
- else
- {
- /* Here 1 <= len1 <= len2. */
- size_t dlen;
- mp_limb_t *dp;
- size_t k, i, j;
-
- dlen = len1 + len2;
- dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t));
- if (dp == NULL)
- return NULL;
- for (k = len2; k > 0; )
- dp[--k] = 0;
- for (i = 0; i < len1; i++)
- {
- mp_limb_t digit1 = p1[i];
- mp_twolimb_t carry = 0;
- for (j = 0; j < len2; j++)
- {
- mp_limb_t digit2 = p2[j];
- carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
- carry += dp[i + j];
- dp[i + j] = (mp_limb_t) carry;
- carry = carry >> GMP_LIMB_BITS;
- }
- dp[i + len2] = (mp_limb_t) carry;
- }
- /* Normalise. */
- while (dlen > 0 && dp[dlen - 1] == 0)
- dlen--;
- dest->nlimbs = dlen;
- dest->limbs = dp;
- }
- return dest->limbs;
-}
-
-/* Compute the quotient of a bignum a >= 0 and a bignum b > 0.
- a is written as a = q * b + r with 0 <= r < b. q is the quotient, r
- the remainder.
- Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd,
- q is incremented.
- Return the allocated memory in case of success, NULL in case of memory
- allocation failure. */
-static void *
-divide (mpn_t a, mpn_t b, mpn_t *q)
-{
- /* Algorithm:
- First normalise a and b: a=[a[m-1],...,a[0]], b=[b[n-1],...,b[0]]
- with m>=0 and n>0 (in base beta = 2^GMP_LIMB_BITS).
- If m<n, then q:=0 and r:=a.
- If m>=n=1, perform a single-precision division:
- r:=0, j:=m,
- while j>0 do
- {Here (q[m-1]*beta^(m-1)+...+q[j]*beta^j) * b[0] + r*beta^j =
- = a[m-1]*beta^(m-1)+...+a[j]*beta^j und 0<=r<b[0]<beta}
- j:=j-1, r:=r*beta+a[j], q[j]:=floor(r/b[0]), r:=r-b[0]*q[j].
- Normalise [q[m-1],...,q[0]], yields q.
- If m>=n>1, perform a multiple-precision division:
- We have a/b < beta^(m-n+1).
- s:=intDsize-1-(highest bit in b[n-1]), 0<=s<intDsize.
- Shift a and b left by s bits, copying them. r:=a.
- r=[r[m],...,r[0]], b=[b[n-1],...,b[0]] with b[n-1]>=beta/2.
- For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).}
- Compute q* :
- q* := floor((r[j+n]*beta+r[j+n-1])/b[n-1]).
- In case of overflow (q* >= beta) set q* := beta-1.
- Compute c2 := ((r[j+n]*beta+r[j+n-1]) - q* * b[n-1])*beta + r[j+n-2]
- and c3 := b[n-2] * q*.
- {We have 0 <= c2 < 2*beta^2, even 0 <= c2 < beta^2 if no overflow
- occurred. Furthermore 0 <= c3 < beta^2.
- If there was overflow and
- r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, i.e. c2 >= beta^2,
- the next test can be skipped.}
- While c3 > c2, {Here 0 <= c2 < c3 < beta^2}
- Put q* := q* - 1, c2 := c2 + b[n-1]*beta, c3 := c3 - b[n-2].
- If q* > 0:
- Put r := r - b * q* * beta^j. In detail:
- [r[n+j],...,r[j]] := [r[n+j],...,r[j]] - q* * [b[n-1],...,b[0]].
- hence: u:=0, for i:=0 to n-1 do
- u := u + q* * b[i],
- r[j+i]:=r[j+i]-(u mod beta) (+ beta, if carry),
- u:=u div beta (+ 1, if carry in subtraction)
- r[n+j]:=r[n+j]-u.
- {Since always u = (q* * [b[i-1],...,b[0]] div beta^i) + 1
- < q* + 1 <= beta,
- the carry u does not overflow.}
- If a negative carry occurs, put q* := q* - 1
- and [r[n+j],...,r[j]] := [r[n+j],...,r[j]] + [0,b[n-1],...,b[0]].
- Set q[j] := q*.
- Normalise [q[m-n],..,q[0]]; this yields the quotient q.
- Shift [r[n-1],...,r[0]] right by s bits and normalise; this yields the
- rest r.
- The room for q[j] can be allocated at the memory location of r[n+j].
- Finally, round-to-even:
- Shift r left by 1 bit.
- If r > b or if r = b and q[0] is odd, q := q+1.
- */
- const mp_limb_t *a_ptr = a.limbs;
- size_t a_len = a.nlimbs;
- const mp_limb_t *b_ptr = b.limbs;
- size_t b_len = b.nlimbs;
- mp_limb_t *roomptr;
- mp_limb_t *tmp_roomptr = NULL;
- mp_limb_t *q_ptr;
- size_t q_len;
- mp_limb_t *r_ptr;
- size_t r_len;
-
- /* Allocate room for a_len+2 digits.
- (Need a_len+1 digits for the real division and 1 more digit for the
- final rounding of q.) */
- roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t));
- if (roomptr == NULL)
- return NULL;
-
- /* Normalise a. */
- while (a_len > 0 && a_ptr[a_len - 1] == 0)
- a_len--;
-
- /* Normalise b. */
- for (;;)
- {
- if (b_len == 0)
- /* Division by zero. */
- abort ();
- if (b_ptr[b_len - 1] == 0)
- b_len--;
- else
- break;
- }
-
- /* Here m = a_len >= 0 and n = b_len > 0. */
-
- if (a_len < b_len)
- {
- /* m<n: trivial case. q=0, r := copy of a. */
- r_ptr = roomptr;
- r_len = a_len;
- memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
- q_ptr = roomptr + a_len;
- q_len = 0;
- }
- else if (b_len == 1)
- {
- /* n=1: single precision division.
- beta^(m-1) <= a < beta^m ==> beta^(m-2) <= a/b < beta^m */
- r_ptr = roomptr;
- q_ptr = roomptr + 1;
- {
- mp_limb_t den = b_ptr[0];
- mp_limb_t remainder = 0;
- const mp_limb_t *sourceptr = a_ptr + a_len;
- mp_limb_t *destptr = q_ptr + a_len;
- size_t count;
- for (count = a_len; count > 0; count--)
- {
- mp_twolimb_t num =
- ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr;
- *--destptr = num / den;
- remainder = num % den;
- }
- /* Normalise and store r. */
- if (remainder > 0)
- {
- r_ptr[0] = remainder;
- r_len = 1;
- }
- else
- r_len = 0;
- /* Normalise q. */
- q_len = a_len;
- if (q_ptr[q_len - 1] == 0)
- q_len--;
- }
- }
- else
- {
- /* n>1: multiple precision division.
- beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n ==>
- beta^(m-n-1) <= a/b < beta^(m-n+1). */
- /* Determine s. */
- size_t s;
- {
- mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
- /* Determine s = GMP_LIMB_BITS - integer_length (msd).
- Code copied from gnulib's integer_length.c. */
-# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
- s = __builtin_clz (msd);
-# else
-# if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
- if (GMP_LIMB_BITS <= DBL_MANT_BIT)
- {
- /* Use 'double' operations.
- Assumes an IEEE 754 'double' implementation. */
-# define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)
-# define DBL_EXP_BIAS (DBL_EXP_MASK / 2 - 1)
-# define NWORDS \
- ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
- union { double value; unsigned int word[NWORDS]; } m;
-
- /* Use a single integer to floating-point conversion. */
- m.value = msd;
-
- s = GMP_LIMB_BITS
- - (((m.word[DBL_EXPBIT0_WORD] >> DBL_EXPBIT0_BIT) & DBL_EXP_MASK)
- - DBL_EXP_BIAS);
- }
- else
-# undef NWORDS
-# endif
- {
- s = 31;
- if (msd >= 0x10000)
- {
- msd = msd >> 16;
- s -= 16;
- }
- if (msd >= 0x100)
- {
- msd = msd >> 8;
- s -= 8;
- }
- if (msd >= 0x10)
- {
- msd = msd >> 4;
- s -= 4;
- }
- if (msd >= 0x4)
- {
- msd = msd >> 2;
- s -= 2;
- }
- if (msd >= 0x2)
- {
- msd = msd >> 1;
- s -= 1;
- }
- }
-# endif
- }
- /* 0 <= s < GMP_LIMB_BITS.
- Copy b, shifting it left by s bits. */
- if (s > 0)
- {
- tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t));
- if (tmp_roomptr == NULL)
- {
- free (roomptr);
- return NULL;
- }
- {
- const mp_limb_t *sourceptr = b_ptr;
- mp_limb_t *destptr = tmp_roomptr;
- mp_twolimb_t accu = 0;
- size_t count;
- for (count = b_len; count > 0; count--)
- {
- accu += (mp_twolimb_t) *sourceptr++ << s;
- *destptr++ = (mp_limb_t) accu;
- accu = accu >> GMP_LIMB_BITS;
- }
- /* accu must be zero, since that was how s was determined. */
- if (accu != 0)
- abort ();
- }
- b_ptr = tmp_roomptr;
- }
- /* Copy a, shifting it left by s bits, yields r.
- Memory layout:
- At the beginning: r = roomptr[0..a_len],
- at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len] */
- r_ptr = roomptr;
- if (s == 0)
- {
- memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
- r_ptr[a_len] = 0;
- }
- else
- {
- const mp_limb_t *sourceptr = a_ptr;
- mp_limb_t *destptr = r_ptr;
- mp_twolimb_t accu = 0;
- size_t count;
- for (count = a_len; count > 0; count--)
- {
- accu += (mp_twolimb_t) *sourceptr++ << s;
- *destptr++ = (mp_limb_t) accu;
- accu = accu >> GMP_LIMB_BITS;
- }
- *destptr++ = (mp_limb_t) accu;
- }
- q_ptr = roomptr + b_len;
- q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */
- {
- size_t j = a_len - b_len; /* m-n */
- mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */
- mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */
- mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */
- ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd;
- /* Division loop, traversed m-n+1 times.
- j counts down, b is unchanged, beta/2 <= b[n-1] < beta. */
- for (;;)
- {
- mp_limb_t q_star;
- mp_limb_t c1;
- if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */
- {
- /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow. */
- mp_twolimb_t num =
- ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS)
- | r_ptr[j + b_len - 1];
- q_star = num / b_msd;
- c1 = num % b_msd;
- }
- else
- {
- /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1]. */
- q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */
- /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta
- <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta
- <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta)
- {<= beta !}.
- If yes, jump directly to the subtraction loop.
- (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta
- <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */
- if (r_ptr[j + b_len] > b_msd
- || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd)
- /* r[j+n] >= b[n-1]+1 or
- r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a
- carry. */
- goto subtract;
- }
- /* q_star = q*,
- c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta). */
- {
- mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */
- ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2];
- mp_twolimb_t c3 = /* b[n-2] * q* */
- (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star;
- /* While c2 < c3, increase c2 and decrease c3.
- Consider c3-c2. While it is > 0, decrease it by
- b[n-1]*beta+b[n-2]. Because of b[n-1]*beta+b[n-2] >= beta^2/2
- this can happen only twice. */
- if (c3 > c2)
- {
- q_star = q_star - 1; /* q* := q* - 1 */
- if (c3 - c2 > b_msdd)
- q_star = q_star - 1; /* q* := q* - 1 */
- }
- }
- if (q_star > 0)
- subtract:
- {
- /* Subtract r := r - b * q* * beta^j. */
- mp_limb_t cr;
- {
- const mp_limb_t *sourceptr = b_ptr;
- mp_limb_t *destptr = r_ptr + j;
- mp_twolimb_t carry = 0;
- size_t count;
- for (count = b_len; count > 0; count--)
- {
- /* Here 0 <= carry <= q*. */
- carry =
- carry
- + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++
- + (mp_limb_t) ~(*destptr);
- /* Here 0 <= carry <= beta*q* + beta-1. */
- *destptr++ = ~(mp_limb_t) carry;
- carry = carry >> GMP_LIMB_BITS; /* <= q* */
- }
- cr = (mp_limb_t) carry;
- }
- /* Subtract cr from r_ptr[j + b_len], then forget about
- r_ptr[j + b_len]. */
- if (cr > r_ptr[j + b_len])
- {
- /* Subtraction gave a carry. */
- q_star = q_star - 1; /* q* := q* - 1 */
- /* Add b back. */
- {
- const mp_limb_t *sourceptr = b_ptr;
- mp_limb_t *destptr = r_ptr + j;
- mp_limb_t carry = 0;
- size_t count;
- for (count = b_len; count > 0; count--)
- {
- mp_limb_t source1 = *sourceptr++;
- mp_limb_t source2 = *destptr;
- *destptr++ = source1 + source2 + carry;
- carry =
- (carry
- ? source1 >= (mp_limb_t) ~source2
- : source1 > (mp_limb_t) ~source2);
- }
- }
- /* Forget about the carry and about r[j+n]. */
- }
- }
- /* q* is determined. Store it as q[j]. */
- q_ptr[j] = q_star;
- if (j == 0)
- break;
- j--;
- }
- }
- r_len = b_len;
- /* Normalise q. */
- if (q_ptr[q_len - 1] == 0)
- q_len--;
-# if 0 /* Not needed here, since we need r only to compare it with b/2, and
- b is shifted left by s bits. */
- /* Shift r right by s bits. */
- if (s > 0)
- {
- mp_limb_t ptr = r_ptr + r_len;
- mp_twolimb_t accu = 0;
- size_t count;
- for (count = r_len; count > 0; count--)
- {
- accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS;
- accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s);
- *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS);
- }
- }
-# endif
- /* Normalise r. */
- while (r_len > 0 && r_ptr[r_len - 1] == 0)
- r_len--;
- }
- /* Compare r << 1 with b. */
- if (r_len > b_len)
- goto increment_q;
- {
- size_t i;
- for (i = b_len;;)
- {
- mp_limb_t r_i =
- (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0)
- | (i < r_len ? r_ptr[i] << 1 : 0);
- mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0);
- if (r_i > b_i)
- goto increment_q;
- if (r_i < b_i)
- goto keep_q;
- if (i == 0)
- break;
- i--;
- }
- }
- if (q_len > 0 && ((q_ptr[0] & 1) != 0))
- /* q is odd. */
- increment_q:
- {
- size_t i;
- for (i = 0; i < q_len; i++)
- if (++(q_ptr[i]) != 0)
- goto keep_q;
- q_ptr[q_len++] = 1;
- }
- keep_q:
- if (tmp_roomptr != NULL)
- free (tmp_roomptr);
- q->limbs = q_ptr;
- q->nlimbs = q_len;
- return roomptr;
-}
-
-/* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal
- representation.
- Destroys the contents of a.
- Return the allocated memory - containing the decimal digits in low-to-high
- order, terminated with a NUL character - in case of success, NULL in case
- of memory allocation failure. */
-static char *
-convert_to_decimal (mpn_t a, size_t extra_zeroes)
-{
- mp_limb_t *a_ptr = a.limbs;
- size_t a_len = a.nlimbs;
- /* 0.03345 is slightly larger than log(2)/(9*log(10)). */
- size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1);
- char *c_ptr = (char *) malloc (xsum (c_len, extra_zeroes));
- if (c_ptr != NULL)
- {
- char *d_ptr = c_ptr;
- for (; extra_zeroes > 0; extra_zeroes--)
- *d_ptr++ = '0';
- while (a_len > 0)
- {
- /* Divide a by 10^9, in-place. */
- mp_limb_t remainder = 0;
- mp_limb_t *ptr = a_ptr + a_len;
- size_t count;
- for (count = a_len; count > 0; count--)
- {
- mp_twolimb_t num =
- ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr;
- *ptr = num / 1000000000;
- remainder = num % 1000000000;
- }
- /* Store the remainder as 9 decimal digits. */
- for (count = 9; count > 0; count--)
- {
- *d_ptr++ = '0' + (remainder % 10);
- remainder = remainder / 10;
- }
- /* Normalize a. */
- if (a_ptr[a_len - 1] == 0)
- a_len--;
- }
- /* Remove leading zeroes. */
- while (d_ptr > c_ptr && d_ptr[-1] == '0')
- d_ptr--;
- /* But keep at least one zero. */
- if (d_ptr == c_ptr)
- *d_ptr++ = '0';
- /* Terminate the string. */
- *d_ptr = '\0';
- }
- return c_ptr;
-}
-
-# if NEED_PRINTF_LONG_DOUBLE
-
-/* Assuming x is finite and >= 0:
- write x as x = 2^e * m, where m is a bignum.
- Return the allocated memory in case of success, NULL in case of memory
- allocation failure. */
-static void *
-decode_long_double (long double x, int *ep, mpn_t *mp)
-{
- mpn_t m;
- int exp;
- long double y;
- size_t i;
-
- /* Allocate memory for result. */
- m.nlimbs = (LDBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
- m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t));
- if (m.limbs == NULL)
- return NULL;
- /* Split into exponential part and mantissa. */
- y = frexpl (x, &exp);
- if (!(y >= 0.0L && y < 1.0L))
- abort ();
- /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * 2^LDBL_MANT_BIT), and the
- latter is an integer. */
- /* Convert the mantissa (y * 2^LDBL_MANT_BIT) to a sequence of limbs.
- I'm not sure whether it's safe to cast a 'long double' value between
- 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
- 'long double' values between 0 and 2^16 (to 'unsigned int' or 'int',
- doesn't matter). */
-# if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0
-# if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
- {
- mp_limb_t hi, lo;
- y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2));
- hi = (int) y;
- y -= hi;
- if (!(y >= 0.0L && y < 1.0L))
- abort ();
- y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
- lo = (int) y;
- y -= lo;
- if (!(y >= 0.0L && y < 1.0L))
- abort ();
- m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
- }
-# else
- {
- mp_limb_t d;
- y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS);
- d = (int) y;
- y -= d;
- if (!(y >= 0.0L && y < 1.0L))
- abort ();
- m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d;
- }
-# endif
-# endif
- for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
- {
- mp_limb_t hi, lo;
- y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
- hi = (int) y;
- y -= hi;
- if (!(y >= 0.0L && y < 1.0L))
- abort ();
- y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
- lo = (int) y;
- y -= lo;
- if (!(y >= 0.0L && y < 1.0L))
- abort ();
- m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
- }
-# if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
- precision. */
- if (!(y == 0.0L))
- abort ();
-# endif
- /* Normalise. */
- while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
- m.nlimbs--;
- *mp = m;
- *ep = exp - LDBL_MANT_BIT;
- return m.limbs;
-}
-
-# endif
-
-# if NEED_PRINTF_DOUBLE
-
-/* Assuming x is finite and >= 0:
- write x as x = 2^e * m, where m is a bignum.
- Return the allocated memory in case of success, NULL in case of memory
- allocation failure. */
-static void *
-decode_double (double x, int *ep, mpn_t *mp)
-{
- mpn_t m;
- int exp;
- double y;
- size_t i;
-
- /* Allocate memory for result. */
- m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
- m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t));
- if (m.limbs == NULL)
- return NULL;
- /* Split into exponential part and mantissa. */
- y = frexp (x, &exp);
- if (!(y >= 0.0 && y < 1.0))
- abort ();
- /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * 2^DBL_MANT_BIT), and the
- latter is an integer. */
- /* Convert the mantissa (y * 2^DBL_MANT_BIT) to a sequence of limbs.
- I'm not sure whether it's safe to cast a 'double' value between
- 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
- 'double' values between 0 and 2^16 (to 'unsigned int' or 'int',
- doesn't matter). */
-# if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0
-# if (DBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
- {
- mp_limb_t hi, lo;
- y *= (mp_limb_t) 1 << (DBL_MANT_BIT % (GMP_LIMB_BITS / 2));
- hi = (int) y;
- y -= hi;
- if (!(y >= 0.0 && y < 1.0))
- abort ();
- y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
- lo = (int) y;
- y -= lo;
- if (!(y >= 0.0 && y < 1.0))
- abort ();
- m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
- }
-# else
- {
- mp_limb_t d;
- y *= (mp_limb_t) 1 << (DBL_MANT_BIT % GMP_LIMB_BITS);
- d = (int) y;
- y -= d;
- if (!(y >= 0.0 && y < 1.0))
- abort ();
- m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d;
- }
-# endif
-# endif
- for (i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
- {
- mp_limb_t hi, lo;
- y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
- hi = (int) y;
- y -= hi;
- if (!(y >= 0.0 && y < 1.0))
- abort ();
- y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
- lo = (int) y;
- y -= lo;
- if (!(y >= 0.0 && y < 1.0))
- abort ();
- m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
- }
- if (!(y == 0.0))
- abort ();
- /* Normalise. */
- while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
- m.nlimbs--;
- *mp = m;
- *ep = exp - DBL_MANT_BIT;
- return m.limbs;
-}
-
-# endif
-
-/* Assuming x = 2^e * m is finite and >= 0, and n is an integer:
- Returns the decimal representation of round (x * 10^n).
- Return the allocated memory - containing the decimal digits in low-to-high
- order, terminated with a NUL character - in case of success, NULL in case
- of memory allocation failure. */
-static char *
-scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
-{
- int s;
- size_t extra_zeroes;
- unsigned int abs_n;
- unsigned int abs_s;
- mp_limb_t *pow5_ptr;
- size_t pow5_len;
- unsigned int s_limbs;
- unsigned int s_bits;
- mpn_t pow5;
- mpn_t z;
- void *z_memory;
- char *digits;
-
- if (memory == NULL)
- return NULL;
- /* x = 2^e * m, hence
- y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m)
- = round (2^s * 5^n * m). */
- s = e + n;
- extra_zeroes = 0;
- /* Factor out a common power of 10 if possible. */
- if (s > 0 && n > 0)
- {
- extra_zeroes = (s < n ? s : n);
- s -= extra_zeroes;
- n -= extra_zeroes;
- }
- /* Here y = round (2^s * 5^n * m) * 10^extra_zeroes.
- Before converting to decimal, we need to compute
- z = round (2^s * 5^n * m). */
- /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same
- sign. 2.322 is slightly larger than log(5)/log(2). */
- abs_n = (n >= 0 ? n : -n);
- abs_s = (s >= 0 ? s : -s);
- pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1
- + abs_s / GMP_LIMB_BITS + 1)
- * sizeof (mp_limb_t));
- if (pow5_ptr == NULL)
- {
- free (memory);
- return NULL;
- }
- /* Initialize with 1. */
- pow5_ptr[0] = 1;
- pow5_len = 1;
- /* Multiply with 5^|n|. */
- if (abs_n > 0)
- {
- static mp_limb_t const small_pow5[13 + 1] =
- {
- 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625,
- 48828125, 244140625, 1220703125
- };
- unsigned int n13;
- for (n13 = 0; n13 <= abs_n; n13 += 13)
- {
- mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13];
- size_t j;
- mp_twolimb_t carry = 0;
- for (j = 0; j < pow5_len; j++)
- {
- mp_limb_t digit2 = pow5_ptr[j];
- carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
- pow5_ptr[j] = (mp_limb_t) carry;
- carry = carry >> GMP_LIMB_BITS;
- }
- if (carry > 0)
- pow5_ptr[pow5_len++] = (mp_limb_t) carry;
- }
- }
- s_limbs = abs_s / GMP_LIMB_BITS;
- s_bits = abs_s % GMP_LIMB_BITS;
- if (n >= 0 ? s >= 0 : s <= 0)
- {
- /* Multiply with 2^|s|. */
- if (s_bits > 0)
- {
- mp_limb_t *ptr = pow5_ptr;
- mp_twolimb_t accu = 0;
- size_t count;
- for (count = pow5_len; count > 0; count--)
- {
- accu += (mp_twolimb_t) *ptr << s_bits;
- *ptr++ = (mp_limb_t) accu;
- accu = accu >> GMP_LIMB_BITS;
- }
- if (accu > 0)
- {
- *ptr = (mp_limb_t) accu;
- pow5_len++;
- }
- }
- if (s_limbs > 0)
- {
- size_t count;
- for (count = pow5_len; count > 0;)
- {
- count--;
- pow5_ptr[s_limbs + count] = pow5_ptr[count];
- }
- for (count = s_limbs; count > 0;)
- {
- count--;
- pow5_ptr[count] = 0;
- }
- pow5_len += s_limbs;
- }
- pow5.limbs = pow5_ptr;
- pow5.nlimbs = pow5_len;
- if (n >= 0)
- {
- /* Multiply m with pow5. No division needed. */
- z_memory = multiply (m, pow5, &z);
- }
- else
- {
- /* Divide m by pow5 and round. */
- z_memory = divide (m, pow5, &z);
- }
- }
- else
- {
- pow5.limbs = pow5_ptr;
- pow5.nlimbs = pow5_len;
- if (n >= 0)
- {
- /* n >= 0, s < 0.
- Multiply m with pow5, then divide by 2^|s|. */
- mpn_t numerator;
- mpn_t denominator;
- void *tmp_memory;
- tmp_memory = multiply (m, pow5, &numerator);
- if (tmp_memory == NULL)
- {
- free (pow5_ptr);
- free (memory);
- return NULL;
- }
- /* Construct 2^|s|. */
- {
- mp_limb_t *ptr = pow5_ptr + pow5_len;
- size_t i;
- for (i = 0; i < s_limbs; i++)
- ptr[i] = 0;
- ptr[s_limbs] = (mp_limb_t) 1 << s_bits;
- denominator.limbs = ptr;
- denominator.nlimbs = s_limbs + 1;
- }
- z_memory = divide (numerator, denominator, &z);
- free (tmp_memory);
- }
- else
- {
- /* n < 0, s > 0.
- Multiply m with 2^s, then divide by pow5. */
- mpn_t numerator;
- mp_limb_t *num_ptr;
- num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1)
- * sizeof (mp_limb_t));
- if (num_ptr == NULL)
- {
- free (pow5_ptr);
- free (memory);
- return NULL;
- }
- {
- mp_limb_t *destptr = num_ptr;
- {
- size_t i;
- for (i = 0; i < s_limbs; i++)
- *destptr++ = 0;
- }
- if (s_bits > 0)
- {
- const mp_limb_t *sourceptr = m.limbs;
- mp_twolimb_t accu = 0;
- size_t count;
- for (count = m.nlimbs; count > 0; count--)
- {
- accu += (mp_twolimb_t) *sourceptr++ << s_bits;
- *destptr++ = (mp_limb_t) accu;
- accu = accu >> GMP_LIMB_BITS;
- }
- if (accu > 0)
- *destptr++ = (mp_limb_t) accu;
- }
- else
- {
- const mp_limb_t *sourceptr = m.limbs;
- size_t count;
- for (count = m.nlimbs; count > 0; count--)
- *destptr++ = *sourceptr++;
- }
- numerator.limbs = num_ptr;
- numerator.nlimbs = destptr - num_ptr;
- }
- z_memory = divide (numerator, pow5, &z);
- free (num_ptr);
- }
- }
- free (pow5_ptr);
- free (memory);
-
- /* Here y = round (x * 10^n) = z * 10^extra_zeroes. */
-
- if (z_memory == NULL)
- return NULL;
- digits = convert_to_decimal (z, extra_zeroes);
- free (z_memory);
- return digits;
-}
-
-# if NEED_PRINTF_LONG_DOUBLE
-
-/* Assuming x is finite and >= 0, and n is an integer:
- Returns the decimal representation of round (x * 10^n).
- Return the allocated memory - containing the decimal digits in low-to-high
- order, terminated with a NUL character - in case of success, NULL in case
- of memory allocation failure. */
-static char *
-scale10_round_decimal_long_double (long double x, int n)
-{
- int e IF_LINT(= 0);
- mpn_t m;
- void *memory = decode_long_double (x, &e, &m);
- return scale10_round_decimal_decoded (e, m, memory, n);
-}
-
-# endif
-
-# if NEED_PRINTF_DOUBLE
-
-/* Assuming x is finite and >= 0, and n is an integer:
- Returns the decimal representation of round (x * 10^n).
- Return the allocated memory - containing the decimal digits in low-to-high
- order, terminated with a NUL character - in case of success, NULL in case
- of memory allocation failure. */
-static char *
-scale10_round_decimal_double (double x, int n)
-{
- int e IF_LINT(= 0);
- mpn_t m;
- void *memory = decode_double (x, &e, &m);
- return scale10_round_decimal_decoded (e, m, memory, n);
-}
-
-# endif
-
-# if NEED_PRINTF_LONG_DOUBLE
-
-/* Assuming x is finite and > 0:
- Return an approximation for n with 10^n <= x < 10^(n+1).
- The approximation is usually the right n, but may be off by 1 sometimes. */
-static int
-floorlog10l (long double x)
-{
- int exp;
- long double y;
- double z;
- double l;
-
- /* Split into exponential part and mantissa. */
- y = frexpl (x, &exp);
- if (!(y >= 0.0L && y < 1.0L))
- abort ();
- if (y == 0.0L)
- return INT_MIN;
- if (y < 0.5L)
- {
- while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
- {
- y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
- exp -= GMP_LIMB_BITS;
- }
- if (y < (1.0L / (1 << 16)))
- {
- y *= 1.0L * (1 << 16);
- exp -= 16;
- }
- if (y < (1.0L / (1 << 8)))
- {
- y *= 1.0L * (1 << 8);
- exp -= 8;
- }
- if (y < (1.0L / (1 << 4)))
- {
- y *= 1.0L * (1 << 4);
- exp -= 4;
- }
- if (y < (1.0L / (1 << 2)))
- {
- y *= 1.0L * (1 << 2);
- exp -= 2;
- }
- if (y < (1.0L / (1 << 1)))
- {
- y *= 1.0L * (1 << 1);
- exp -= 1;
- }
- }
- if (!(y >= 0.5L && y < 1.0L))
- abort ();
- /* Compute an approximation for l = log2(x) = exp + log2(y). */
- l = exp;
- z = y;
- if (z < 0.70710678118654752444)
- {
- z *= 1.4142135623730950488;
- l -= 0.5;
- }
- if (z < 0.8408964152537145431)
- {
- z *= 1.1892071150027210667;
- l -= 0.25;
- }
- if (z < 0.91700404320467123175)
- {
- z *= 1.0905077326652576592;
- l -= 0.125;
- }
- if (z < 0.9576032806985736469)
- {
- z *= 1.0442737824274138403;
- l -= 0.0625;
- }
- /* Now 0.95 <= z <= 1.01. */
- z = 1 - z;
- /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...)
- Four terms are enough to get an approximation with error < 10^-7. */
- l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
- /* Finally multiply with log(2)/log(10), yields an approximation for
- log10(x). */
- l *= 0.30102999566398119523;
- /* Round down to the next integer. */
- return (int) l + (l < 0 ? -1 : 0);
-}
-
-# endif
-
-# if NEED_PRINTF_DOUBLE
-
-/* Assuming x is finite and > 0:
- Return an approximation for n with 10^n <= x < 10^(n+1).
- The approximation is usually the right n, but may be off by 1 sometimes. */
-static int
-floorlog10 (double x)
-{
- int exp;
- double y;
- double z;
- double l;
-
- /* Split into exponential part and mantissa. */
- y = frexp (x, &exp);
- if (!(y >= 0.0 && y < 1.0))
- abort ();
- if (y == 0.0)
- return INT_MIN;
- if (y < 0.5)
- {
- while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
- {
- y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
- exp -= GMP_LIMB_BITS;
- }
- if (y < (1.0 / (1 << 16)))
- {
- y *= 1.0 * (1 << 16);
- exp -= 16;
- }
- if (y < (1.0 / (1 << 8)))
- {
- y *= 1.0 * (1 << 8);
- exp -= 8;
- }
- if (y < (1.0 / (1 << 4)))
- {
- y *= 1.0 * (1 << 4);
- exp -= 4;
- }
- if (y < (1.0 / (1 << 2)))
- {
- y *= 1.0 * (1 << 2);
- exp -= 2;
- }
- if (y < (1.0 / (1 << 1)))
- {
- y *= 1.0 * (1 << 1);
- exp -= 1;
- }
- }
- if (!(y >= 0.5 && y < 1.0))
- abort ();
- /* Compute an approximation for l = log2(x) = exp + log2(y). */
- l = exp;
- z = y;
- if (z < 0.70710678118654752444)
- {
- z *= 1.4142135623730950488;
- l -= 0.5;
- }
- if (z < 0.8408964152537145431)
- {
- z *= 1.1892071150027210667;
- l -= 0.25;
- }
- if (z < 0.91700404320467123175)
- {
- z *= 1.0905077326652576592;
- l -= 0.125;
- }
- if (z < 0.9576032806985736469)
- {
- z *= 1.0442737824274138403;
- l -= 0.0625;
- }
- /* Now 0.95 <= z <= 1.01. */
- z = 1 - z;
- /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...)
- Four terms are enough to get an approximation with error < 10^-7. */
- l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
- /* Finally multiply with log(2)/log(10), yields an approximation for
- log10(x). */
- l *= 0.30102999566398119523;
- /* Round down to the next integer. */
- return (int) l + (l < 0 ? -1 : 0);
-}
-
-# endif
-
-/* Tests whether a string of digits consists of exactly PRECISION zeroes and
- a single '1' digit. */
-static int
-is_borderline (const char *digits, size_t precision)
-{
- for (; precision > 0; precision--, digits++)
- if (*digits != '0')
- return 0;
- if (*digits != '1')
- return 0;
- digits++;
- return *digits == '\0';
-}
-
-#endif
-
-#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99
-
-/* Use a different function name, to make it possible that the 'wchar_t'
- parametrization and the 'char' parametrization get compiled in the same
- translation unit. */
-# if WIDE_CHAR_VERSION
-# define MAX_ROOM_NEEDED wmax_room_needed
-# else
-# define MAX_ROOM_NEEDED max_room_needed
-# endif
-
-/* Returns the number of TCHAR_T units needed as temporary space for the result
- of sprintf or SNPRINTF of a single conversion directive. */
-static size_t
-MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
- arg_type type, int flags, size_t width, int has_precision,
- size_t precision, int pad_ourselves)
-{
- size_t tmp_length;
-
- switch (conversion)
- {
- case 'd': case 'i': case 'u':
-# if HAVE_LONG_LONG_INT
- if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
- tmp_length =
- (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
- * 0.30103 /* binary -> decimal */
- )
- + 1; /* turn floor into ceil */
- else
-# endif
- if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
- tmp_length =
- (unsigned int) (sizeof (unsigned long) * CHAR_BIT
- * 0.30103 /* binary -> decimal */
- )
- + 1; /* turn floor into ceil */
- else
- tmp_length =
- (unsigned int) (sizeof (unsigned int) * CHAR_BIT
- * 0.30103 /* binary -> decimal */
- )
- + 1; /* turn floor into ceil */
- if (tmp_length < precision)
- tmp_length = precision;
- /* Multiply by 2, as an estimate for FLAG_GROUP. */
- tmp_length = xsum (tmp_length, tmp_length);
- /* Add 1, to account for a leading sign. */
- tmp_length = xsum (tmp_length, 1);
- break;
-
- case 'o':
-# if HAVE_LONG_LONG_INT
- if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
- tmp_length =
- (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
- * 0.333334 /* binary -> octal */
- )
- + 1; /* turn floor into ceil */
- else
-# endif
- if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
- tmp_length =
- (unsigned int) (sizeof (unsigned long) * CHAR_BIT
- * 0.333334 /* binary -> octal */
- )
- + 1; /* turn floor into ceil */
- else
- tmp_length =
- (unsigned int) (sizeof (unsigned int) * CHAR_BIT
- * 0.333334 /* binary -> octal */
- )
- + 1; /* turn floor into ceil */
- if (tmp_length < precision)
- tmp_length = precision;
- /* Add 1, to account for a leading sign. */
- tmp_length = xsum (tmp_length, 1);
- break;
-
- case 'x': case 'X':
-# if HAVE_LONG_LONG_INT
- if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
- tmp_length =
- (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
- * 0.25 /* binary -> hexadecimal */
- )
- + 1; /* turn floor into ceil */
- else
-# endif
- if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
- tmp_length =
- (unsigned int) (sizeof (unsigned long) * CHAR_BIT
- * 0.25 /* binary -> hexadecimal */
- )
- + 1; /* turn floor into ceil */
- else
- tmp_length =
- (unsigned int) (sizeof (unsigned int) * CHAR_BIT
- * 0.25 /* binary -> hexadecimal */
- )
- + 1; /* turn floor into ceil */
- if (tmp_length < precision)
- tmp_length = precision;
- /* Add 2, to account for a leading sign or alternate form. */
- tmp_length = xsum (tmp_length, 2);
- break;
-
- case 'f': case 'F':
- if (type == TYPE_LONGDOUBLE)
- tmp_length =
- (unsigned int) (LDBL_MAX_EXP
- * 0.30103 /* binary -> decimal */
- * 2 /* estimate for FLAG_GROUP */
- )
- + 1 /* turn floor into ceil */
- + 10; /* sign, decimal point etc. */
- else
- tmp_length =
- (unsigned int) (DBL_MAX_EXP
- * 0.30103 /* binary -> decimal */
- * 2 /* estimate for FLAG_GROUP */
- )
- + 1 /* turn floor into ceil */
- + 10; /* sign, decimal point etc. */
- tmp_length = xsum (tmp_length, precision);
- break;
-
- case 'e': case 'E': case 'g': case 'G':
- tmp_length =
- 12; /* sign, decimal point, exponent etc. */
- tmp_length = xsum (tmp_length, precision);
- break;
-
- case 'a': case 'A':
- if (type == TYPE_LONGDOUBLE)
- tmp_length =
- (unsigned int) (LDBL_DIG
- * 0.831 /* decimal -> hexadecimal */
- )
- + 1; /* turn floor into ceil */
- else
- tmp_length =
- (unsigned int) (DBL_DIG
- * 0.831 /* decimal -> hexadecimal */
- )
- + 1; /* turn floor into ceil */
- if (tmp_length < precision)
- tmp_length = precision;
- /* Account for sign, decimal point etc. */
- tmp_length = xsum (tmp_length, 12);
- break;
-
- case 'c':
-# if HAVE_WINT_T && !WIDE_CHAR_VERSION
- if (type == TYPE_WIDE_CHAR)
- tmp_length = MB_CUR_MAX;
- else
-# endif
- tmp_length = 1;
- break;
-
- case 's':
-# if HAVE_WCHAR_T
- if (type == TYPE_WIDE_STRING)
- {
-# if WIDE_CHAR_VERSION
- /* ISO C says about %ls in fwprintf:
- "If the precision is not specified or is greater than the size
- of the array, the array shall contain a null wide character."
- So if there is a precision, we must not use wcslen. */
- const wchar_t *arg = ap->arg[arg_index].a.a_wide_string;
-
- if (has_precision)
- tmp_length = local_wcsnlen (arg, precision);
- else
- tmp_length = local_wcslen (arg);
-# else
- /* ISO C says about %ls in fprintf:
- "If a precision is specified, no more than that many bytes are
- written (including shift sequences, if any), and the array
- shall contain a null wide character if, to equal the multibyte
- character sequence length given by the precision, the function
- would need to access a wide character one past the end of the
- array."
- So if there is a precision, we must not use wcslen. */
- /* This case has already been handled separately in VASNPRINTF. */
- abort ();
-# endif
- }
- else
-# endif
- {
-# if WIDE_CHAR_VERSION
- /* ISO C says about %s in fwprintf:
- "If the precision is not specified or is greater than the size
- of the converted array, the converted array shall contain a
- null wide character."
- So if there is a precision, we must not use strlen. */
- /* This case has already been handled separately in VASNPRINTF. */
- abort ();
-# else
- /* ISO C says about %s in fprintf:
- "If the precision is not specified or greater than the size of
- the array, the array shall contain a null character."
- So if there is a precision, we must not use strlen. */
- const char *arg = ap->arg[arg_index].a.a_string;
-
- if (has_precision)
- tmp_length = local_strnlen (arg, precision);
- else
- tmp_length = strlen (arg);
-# endif
- }
- break;
-
- case 'p':
- tmp_length =
- (unsigned int) (sizeof (void *) * CHAR_BIT
- * 0.25 /* binary -> hexadecimal */
- )
- + 1 /* turn floor into ceil */
- + 2; /* account for leading 0x */
- break;
-
- default:
- abort ();
- }
-
- if (!pad_ourselves)
- {
-# if ENABLE_UNISTDIO
- /* Padding considers the number of characters, therefore the number of
- elements after padding may be
- > max (tmp_length, width)
- but is certainly
- <= tmp_length + width. */
- tmp_length = xsum (tmp_length, width);
-# else
- /* Padding considers the number of elements, says POSIX. */
- if (tmp_length < width)
- tmp_length = width;
-# endif
- }
-
- tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
-
- return tmp_length;
-}
-
-#endif
-
-DCHAR_T *
-VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
- const FCHAR_T *format, va_list args)
-{
- DIRECTIVES d;
- arguments a;
-
- if (PRINTF_PARSE (format, &d, &a) < 0)
- /* errno is already set. */
- return NULL;
-
-#define CLEANUP() \
- if (d.dir != d.direct_alloc_dir) \
- free (d.dir); \
- if (a.arg != a.direct_alloc_arg) \
- free (a.arg);
-
- if (PRINTF_FETCHARGS (args, &a) < 0)
- {
- CLEANUP ();
- errno = EINVAL;
- return NULL;
- }
-
- {
- size_t buf_neededlength;
- TCHAR_T *buf;
- TCHAR_T *buf_malloced;
- const FCHAR_T *cp;
- size_t i;
- DIRECTIVE *dp;
- /* Output string accumulator. */
- DCHAR_T *result;
- size_t allocated;
- size_t length;
-
- /* Allocate a small buffer that will hold a directive passed to
- sprintf or snprintf. */
- buf_neededlength =
- xsum4 (7, d.max_width_length, d.max_precision_length, 6);
-#if HAVE_ALLOCA
- if (buf_neededlength < 4000 / sizeof (TCHAR_T))
- {
- buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T));
- buf_malloced = NULL;
- }
- else
-#endif
- {
- size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T));
- if (size_overflow_p (buf_memsize))
- goto out_of_memory_1;
- buf = (TCHAR_T *) malloc (buf_memsize);
- if (buf == NULL)
- goto out_of_memory_1;
- buf_malloced = buf;
- }
-
- if (resultbuf != NULL)
- {
- result = resultbuf;
- allocated = *lengthp;
- }
- else
- {
- result = NULL;
- allocated = 0;
- }
- length = 0;
- /* Invariants:
- result is either == resultbuf or == NULL or malloc-allocated.
- If length > 0, then result != NULL. */
-
- /* Ensures that allocated >= needed. Aborts through a jump to
- out_of_memory if needed is SIZE_MAX or otherwise too big. */
-#define ENSURE_ALLOCATION(needed) \
- if ((needed) > allocated) \
- { \
- size_t memory_size; \
- DCHAR_T *memory; \
- \
- allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \
- if ((needed) > allocated) \
- allocated = (needed); \
- memory_size = xtimes (allocated, sizeof (DCHAR_T)); \
- if (size_overflow_p (memory_size)) \
- goto out_of_memory; \
- if (result == resultbuf || result == NULL) \
- memory = (DCHAR_T *) malloc (memory_size); \
- else \
- memory = (DCHAR_T *) realloc (result, memory_size); \
- if (memory == NULL) \
- goto out_of_memory; \
- if (result == resultbuf && length > 0) \
- DCHAR_CPY (memory, result, length); \
- result = memory; \
- }
-
- for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
- {
- if (cp != dp->dir_start)
- {
- size_t n = dp->dir_start - cp;
- size_t augmented_length = xsum (length, n);
-
- ENSURE_ALLOCATION (augmented_length);
- /* This copies a piece of FCHAR_T[] into a DCHAR_T[]. Here we
- need that the format string contains only ASCII characters
- if FCHAR_T and DCHAR_T are not the same type. */
- if (sizeof (FCHAR_T) == sizeof (DCHAR_T))
- {
- DCHAR_CPY (result + length, (const DCHAR_T *) cp, n);
- length = augmented_length;
- }
- else
- {
- do
- result[length++] = *cp++;
- while (--n > 0);
- }
- }
- if (i == d.count)
- break;
-
- /* Execute a single directive. */
- if (dp->conversion == '%')
- {
- size_t augmented_length;
-
- if (!(dp->arg_index == ARG_NONE))
- abort ();
- augmented_length = xsum (length, 1);
- ENSURE_ALLOCATION (augmented_length);
- result[length] = '%';
- length = augmented_length;
- }
- else
- {
- if (!(dp->arg_index != ARG_NONE))
- abort ();
-
- if (dp->conversion == 'n')
- {
- switch (a.arg[dp->arg_index].type)
- {
- case TYPE_COUNT_SCHAR_POINTER:
- *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
- break;
- case TYPE_COUNT_SHORT_POINTER:
- *a.arg[dp->arg_index].a.a_count_short_pointer = length;
- break;
- case TYPE_COUNT_INT_POINTER:
- *a.arg[dp->arg_index].a.a_count_int_pointer = length;
- break;
- case TYPE_COUNT_LONGINT_POINTER:
- *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
- break;
-#if HAVE_LONG_LONG_INT
- case TYPE_COUNT_LONGLONGINT_POINTER:
- *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
- break;
-#endif
- default:
- abort ();
- }
- }
-#if ENABLE_UNISTDIO
- /* The unistdio extensions. */
- else if (dp->conversion == 'U')
- {
- arg_type type = a.arg[dp->arg_index].type;
- int flags = dp->flags;
- int has_width;
- size_t width;
- int has_precision;
- size_t precision;
-
- has_width = 0;
- width = 0;
- if (dp->width_start != dp->width_end)
- {
- if (dp->width_arg_index != ARG_NONE)
- {
- int arg;
-
- if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
- abort ();
- arg = a.arg[dp->width_arg_index].a.a_int;
- width = arg;
- if (arg < 0)
- {
- /* "A negative field width is taken as a '-' flag
- followed by a positive field width." */
- flags |= FLAG_LEFT;
- width = -width;
- }
- }
- else
- {
- const FCHAR_T *digitp = dp->width_start;
-
- do
- width = xsum (xtimes (width, 10), *digitp++ - '0');
- while (digitp != dp->width_end);
- }
- has_width = 1;
- }
-
- has_precision = 0;
- precision = 0;
- if (dp->precision_start != dp->precision_end)
- {
- if (dp->precision_arg_index != ARG_NONE)
- {
- int arg;
-
- if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
- abort ();
- arg = a.arg[dp->precision_arg_index].a.a_int;
- /* "A negative precision is taken as if the precision
- were omitted." */
- if (arg >= 0)
- {
- precision = arg;
- has_precision = 1;
- }
- }
- else
- {
- const FCHAR_T *digitp = dp->precision_start + 1;
-
- precision = 0;
- while (digitp != dp->precision_end)
- precision = xsum (xtimes (precision, 10), *digitp++ - '0');
- has_precision = 1;
- }
- }
-
- switch (type)
- {
- case TYPE_U8_STRING:
- {
- const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string;
- const uint8_t *arg_end;
- size_t characters;
-
- if (has_precision)
- {
- /* Use only PRECISION characters, from the left. */
- arg_end = arg;
- characters = 0;
- for (; precision > 0; precision--)
- {
- int count = u8_strmblen (arg_end);
- if (count == 0)
- break;
- if (count < 0)
- {
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = EILSEQ;
- return NULL;
- }
- arg_end += count;
- characters++;
- }
- }
- else if (has_width)
- {
- /* Use the entire string, and count the number of
- characters. */
- arg_end = arg;
- characters = 0;
- for (;;)
- {
- int count = u8_strmblen (arg_end);
- if (count == 0)
- break;
- if (count < 0)
- {
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = EILSEQ;
- return NULL;
- }
- arg_end += count;
- characters++;
- }
- }
- else
- {
- /* Use the entire string. */
- arg_end = arg + u8_strlen (arg);
- /* The number of characters doesn't matter. */
- characters = 0;
- }
-
- if (characters < width && !(dp->flags & FLAG_LEFT))
- {
- size_t n = width - characters;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_SET (result + length, ' ', n);
- length += n;
- }
-
-# if DCHAR_IS_UINT8_T
- {
- size_t n = arg_end - arg;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_CPY (result + length, arg, n);
- length += n;
- }
-# else
- { /* Convert. */
- DCHAR_T *converted = result + length;
- size_t converted_len = allocated - length;
-# if DCHAR_IS_TCHAR
- /* Convert from UTF-8 to locale encoding. */
- converted =
- u8_conv_to_encoding (locale_charset (),
- iconveh_question_mark,
- arg, arg_end - arg, NULL,
- converted, &converted_len);
-# else
- /* Convert from UTF-8 to UTF-16/UTF-32. */
- converted =
- U8_TO_DCHAR (arg, arg_end - arg,
- converted, &converted_len);
-# endif
- if (converted == NULL)
- {
- int saved_errno = errno;
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = saved_errno;
- return NULL;
- }
- if (converted != result + length)
- {
- ENSURE_ALLOCATION (xsum (length, converted_len));
- DCHAR_CPY (result + length, converted, converted_len);
- free (converted);
- }
- length += converted_len;
- }
-# endif
-
- if (characters < width && (dp->flags & FLAG_LEFT))
- {
- size_t n = width - characters;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_SET (result + length, ' ', n);
- length += n;
- }
- }
- break;
-
- case TYPE_U16_STRING:
- {
- const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string;
- const uint16_t *arg_end;
- size_t characters;
-
- if (has_precision)
- {
- /* Use only PRECISION characters, from the left. */
- arg_end = arg;
- characters = 0;
- for (; precision > 0; precision--)
- {
- int count = u16_strmblen (arg_end);
- if (count == 0)
- break;
- if (count < 0)
- {
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = EILSEQ;
- return NULL;
- }
- arg_end += count;
- characters++;
- }
- }
- else if (has_width)
- {
- /* Use the entire string, and count the number of
- characters. */
- arg_end = arg;
- characters = 0;
- for (;;)
- {
- int count = u16_strmblen (arg_end);
- if (count == 0)
- break;
- if (count < 0)
- {
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = EILSEQ;
- return NULL;
- }
- arg_end += count;
- characters++;
- }
- }
- else
- {
- /* Use the entire string. */
- arg_end = arg + u16_strlen (arg);
- /* The number of characters doesn't matter. */
- characters = 0;
- }
-
- if (characters < width && !(dp->flags & FLAG_LEFT))
- {
- size_t n = width - characters;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_SET (result + length, ' ', n);
- length += n;
- }
-
-# if DCHAR_IS_UINT16_T
- {
- size_t n = arg_end - arg;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_CPY (result + length, arg, n);
- length += n;
- }
-# else
- { /* Convert. */
- DCHAR_T *converted = result + length;
- size_t converted_len = allocated - length;
-# if DCHAR_IS_TCHAR
- /* Convert from UTF-16 to locale encoding. */
- converted =
- u16_conv_to_encoding (locale_charset (),
- iconveh_question_mark,
- arg, arg_end - arg, NULL,
- converted, &converted_len);
-# else
- /* Convert from UTF-16 to UTF-8/UTF-32. */
- converted =
- U16_TO_DCHAR (arg, arg_end - arg,
- converted, &converted_len);
-# endif
- if (converted == NULL)
- {
- int saved_errno = errno;
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = saved_errno;
- return NULL;
- }
- if (converted != result + length)
- {
- ENSURE_ALLOCATION (xsum (length, converted_len));
- DCHAR_CPY (result + length, converted, converted_len);
- free (converted);
- }
- length += converted_len;
- }
-# endif
-
- if (characters < width && (dp->flags & FLAG_LEFT))
- {
- size_t n = width - characters;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_SET (result + length, ' ', n);
- length += n;
- }
- }
- break;
-
- case TYPE_U32_STRING:
- {
- const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string;
- const uint32_t *arg_end;
- size_t characters;
-
- if (has_precision)
- {
- /* Use only PRECISION characters, from the left. */
- arg_end = arg;
- characters = 0;
- for (; precision > 0; precision--)
- {
- int count = u32_strmblen (arg_end);
- if (count == 0)
- break;
- if (count < 0)
- {
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = EILSEQ;
- return NULL;
- }
- arg_end += count;
- characters++;
- }
- }
- else if (has_width)
- {
- /* Use the entire string, and count the number of
- characters. */
- arg_end = arg;
- characters = 0;
- for (;;)
- {
- int count = u32_strmblen (arg_end);
- if (count == 0)
- break;
- if (count < 0)
- {
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = EILSEQ;
- return NULL;
- }
- arg_end += count;
- characters++;
- }
- }
- else
- {
- /* Use the entire string. */
- arg_end = arg + u32_strlen (arg);
- /* The number of characters doesn't matter. */
- characters = 0;
- }
-
- if (characters < width && !(dp->flags & FLAG_LEFT))
- {
- size_t n = width - characters;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_SET (result + length, ' ', n);
- length += n;
- }
-
-# if DCHAR_IS_UINT32_T
- {
- size_t n = arg_end - arg;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_CPY (result + length, arg, n);
- length += n;
- }
-# else
- { /* Convert. */
- DCHAR_T *converted = result + length;
- size_t converted_len = allocated - length;
-# if DCHAR_IS_TCHAR
- /* Convert from UTF-32 to locale encoding. */
- converted =
- u32_conv_to_encoding (locale_charset (),
- iconveh_question_mark,
- arg, arg_end - arg, NULL,
- converted, &converted_len);
-# else
- /* Convert from UTF-32 to UTF-8/UTF-16. */
- converted =
- U32_TO_DCHAR (arg, arg_end - arg,
- converted, &converted_len);
-# endif
- if (converted == NULL)
- {
- int saved_errno = errno;
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = saved_errno;
- return NULL;
- }
- if (converted != result + length)
- {
- ENSURE_ALLOCATION (xsum (length, converted_len));
- DCHAR_CPY (result + length, converted, converted_len);
- free (converted);
- }
- length += converted_len;
- }
-# endif
-
- if (characters < width && (dp->flags & FLAG_LEFT))
- {
- size_t n = width - characters;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_SET (result + length, ' ', n);
- length += n;
- }
- }
- break;
-
- default:
- abort ();
- }
- }
-#endif
-#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && HAVE_WCHAR_T
- else if (dp->conversion == 's'
-# if WIDE_CHAR_VERSION
- && a.arg[dp->arg_index].type != TYPE_WIDE_STRING
-# else
- && a.arg[dp->arg_index].type == TYPE_WIDE_STRING
-# endif
- )
- {
- /* The normal handling of the 's' directive below requires
- allocating a temporary buffer. The determination of its
- length (tmp_length), in the case when a precision is
- specified, below requires a conversion between a char[]
- string and a wchar_t[] wide string. It could be done, but
- we have no guarantee that the implementation of sprintf will
- use the exactly same algorithm. Without this guarantee, it
- is possible to have buffer overrun bugs. In order to avoid
- such bugs, we implement the entire processing of the 's'
- directive ourselves. */
- int flags = dp->flags;
- int has_width;
- size_t width;
- int has_precision;
- size_t precision;
-
- has_width = 0;
- width = 0;
- if (dp->width_start != dp->width_end)
- {
- if (dp->width_arg_index != ARG_NONE)
- {
- int arg;
-
- if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
- abort ();
- arg = a.arg[dp->width_arg_index].a.a_int;
- width = arg;
- if (arg < 0)
- {
- /* "A negative field width is taken as a '-' flag
- followed by a positive field width." */
- flags |= FLAG_LEFT;
- width = -width;
- }
- }
- else
- {
- const FCHAR_T *digitp = dp->width_start;
-
- do
- width = xsum (xtimes (width, 10), *digitp++ - '0');
- while (digitp != dp->width_end);
- }
- has_width = 1;
- }
-
- has_precision = 0;
- precision = 6;
- if (dp->precision_start != dp->precision_end)
- {
- if (dp->precision_arg_index != ARG_NONE)
- {
- int arg;
-
- if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
- abort ();
- arg = a.arg[dp->precision_arg_index].a.a_int;
- /* "A negative precision is taken as if the precision
- were omitted." */
- if (arg >= 0)
- {
- precision = arg;
- has_precision = 1;
- }
- }
- else
- {
- const FCHAR_T *digitp = dp->precision_start + 1;
-
- precision = 0;
- while (digitp != dp->precision_end)
- precision = xsum (xtimes (precision, 10), *digitp++ - '0');
- has_precision = 1;
- }
- }
-
-# if WIDE_CHAR_VERSION
- /* %s in vasnwprintf. See the specification of fwprintf. */
- {
- const char *arg = a.arg[dp->arg_index].a.a_string;
- const char *arg_end;
- size_t characters;
-
- if (has_precision)
- {
- /* Use only as many bytes as needed to produce PRECISION
- wide characters, from the left. */
-# if HAVE_MBRTOWC
- mbstate_t state;
- memset (&state, '\0', sizeof (mbstate_t));
-# endif
- arg_end = arg;
- characters = 0;
- for (; precision > 0; precision--)
- {
- int count;
-# if HAVE_MBRTOWC
- count = mbrlen (arg_end, MB_CUR_MAX, &state);
-# else
- count = mblen (arg_end, MB_CUR_MAX);
-# endif
- if (count == 0)
- /* Found the terminating NUL. */
- break;
- if (count < 0)
- {
- /* Invalid or incomplete multibyte character. */
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = EILSEQ;
- return NULL;
- }
- arg_end += count;
- characters++;
- }
- }
- else if (has_width)
- {
- /* Use the entire string, and count the number of wide
- characters. */
-# if HAVE_MBRTOWC
- mbstate_t state;
- memset (&state, '\0', sizeof (mbstate_t));
-# endif
- arg_end = arg;
- characters = 0;
- for (;;)
- {
- int count;
-# if HAVE_MBRTOWC
- count = mbrlen (arg_end, MB_CUR_MAX, &state);
-# else
- count = mblen (arg_end, MB_CUR_MAX);
-# endif
- if (count == 0)
- /* Found the terminating NUL. */
- break;
- if (count < 0)
- {
- /* Invalid or incomplete multibyte character. */
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = EILSEQ;
- return NULL;
- }
- arg_end += count;
- characters++;
- }
- }
- else
- {
- /* Use the entire string. */
- arg_end = arg + strlen (arg);
- /* The number of characters doesn't matter. */
- characters = 0;
- }
-
- if (characters < width && !(dp->flags & FLAG_LEFT))
- {
- size_t n = width - characters;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_SET (result + length, ' ', n);
- length += n;
- }
-
- if (has_precision || has_width)
- {
- /* We know the number of wide characters in advance. */
- size_t remaining;
-# if HAVE_MBRTOWC
- mbstate_t state;
- memset (&state, '\0', sizeof (mbstate_t));
-# endif
- ENSURE_ALLOCATION (xsum (length, characters));
- for (remaining = characters; remaining > 0; remaining--)
- {
- wchar_t wc;
- int count;
-# if HAVE_MBRTOWC
- count = mbrtowc (&wc, arg, arg_end - arg, &state);
-# else
- count = mbtowc (&wc, arg, arg_end - arg);
-# endif
- if (count <= 0)
- /* mbrtowc not consistent with mbrlen, or mbtowc
- not consistent with mblen. */
- abort ();
- result[length++] = wc;
- arg += count;
- }
- if (!(arg == arg_end))
- abort ();
- }
- else
- {
-# if HAVE_MBRTOWC
- mbstate_t state;
- memset (&state, '\0', sizeof (mbstate_t));
-# endif
- while (arg < arg_end)
- {
- wchar_t wc;
- int count;
-# if HAVE_MBRTOWC
- count = mbrtowc (&wc, arg, arg_end - arg, &state);
-# else
- count = mbtowc (&wc, arg, arg_end - arg);
-# endif
- if (count <= 0)
- /* mbrtowc not consistent with mbrlen, or mbtowc
- not consistent with mblen. */
- abort ();
- ENSURE_ALLOCATION (xsum (length, 1));
- result[length++] = wc;
- arg += count;
- }
- }
-
- if (characters < width && (dp->flags & FLAG_LEFT))
- {
- size_t n = width - characters;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_SET (result + length, ' ', n);
- length += n;
- }
- }
-# else
- /* %ls in vasnprintf. See the specification of fprintf. */
- {
- const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
- const wchar_t *arg_end;
- size_t characters;
-# if !DCHAR_IS_TCHAR
- /* This code assumes that TCHAR_T is 'char'. */
- verify (sizeof (TCHAR_T) == 1);
- TCHAR_T *tmpsrc;
- DCHAR_T *tmpdst;
- size_t tmpdst_len;
-# endif
- size_t w;
-
- if (has_precision)
- {
- /* Use only as many wide characters as needed to produce
- at most PRECISION bytes, from the left. */
-# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
- mbstate_t state;
- memset (&state, '\0', sizeof (mbstate_t));
-# endif
- arg_end = arg;
- characters = 0;
- while (precision > 0)
- {
- char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
- int count;
-
- if (*arg_end == 0)
- /* Found the terminating null wide character. */
- break;
-# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
- count = wcrtomb (cbuf, *arg_end, &state);
-# else
- count = wctomb (cbuf, *arg_end);
-# endif
- if (count < 0)
- {
- /* Cannot convert. */
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = EILSEQ;
- return NULL;
- }
- if (precision < count)
- break;
- arg_end++;
- characters += count;
- precision -= count;
- }
- }
-# if DCHAR_IS_TCHAR
- else if (has_width)
-# else
- else
-# endif
- {
- /* Use the entire string, and count the number of
- bytes. */
-# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
- mbstate_t state;
- memset (&state, '\0', sizeof (mbstate_t));
-# endif
- arg_end = arg;
- characters = 0;
- for (;;)
- {
- char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
- int count;
-
- if (*arg_end == 0)
- /* Found the terminating null wide character. */
- break;
-# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
- count = wcrtomb (cbuf, *arg_end, &state);
-# else
- count = wctomb (cbuf, *arg_end);
-# endif
- if (count < 0)
- {
- /* Cannot convert. */
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = EILSEQ;
- return NULL;
- }
- arg_end++;
- characters += count;
- }
- }
-# if DCHAR_IS_TCHAR
- else
- {
- /* Use the entire string. */
- arg_end = arg + local_wcslen (arg);
- /* The number of bytes doesn't matter. */
- characters = 0;
- }
-# endif
-
-# if !DCHAR_IS_TCHAR
- /* Convert the string into a piece of temporary memory. */
- tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T));
- if (tmpsrc == NULL)
- goto out_of_memory;
- {
- TCHAR_T *tmpptr = tmpsrc;
- size_t remaining;
-# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
- mbstate_t state;
- memset (&state, '\0', sizeof (mbstate_t));
-# endif
- for (remaining = characters; remaining > 0; )
- {
- char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
- int count;
-
- if (*arg == 0)
- abort ();
-# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
- count = wcrtomb (cbuf, *arg, &state);
-# else
- count = wctomb (cbuf, *arg);
-# endif
- if (count <= 0)
- /* Inconsistency. */
- abort ();
- memcpy (tmpptr, cbuf, count);
- tmpptr += count;
- arg++;
- remaining -= count;
- }
- if (!(arg == arg_end))
- abort ();
- }
-
- /* Convert from TCHAR_T[] to DCHAR_T[]. */
- tmpdst =
- DCHAR_CONV_FROM_ENCODING (locale_charset (),
- iconveh_question_mark,
- tmpsrc, characters,
- NULL,
- NULL, &tmpdst_len);
- if (tmpdst == NULL)
- {
- int saved_errno = errno;
- free (tmpsrc);
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = saved_errno;
- return NULL;
- }
- free (tmpsrc);
-# endif
-
- if (has_width)
- {
-# if ENABLE_UNISTDIO
- /* Outside POSIX, it's preferable to compare the width
- against the number of _characters_ of the converted
- value. */
- w = DCHAR_MBSNLEN (result + length, characters);
-# else
- /* The width is compared against the number of _bytes_
- of the converted value, says POSIX. */
- w = characters;
-# endif
- }
- else
- /* w doesn't matter. */
- w = 0;
-
- if (w < width && !(dp->flags & FLAG_LEFT))
- {
- size_t n = width - w;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_SET (result + length, ' ', n);
- length += n;
- }
-
-# if DCHAR_IS_TCHAR
- if (has_precision || has_width)
- {
- /* We know the number of bytes in advance. */
- size_t remaining;
-# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
- mbstate_t state;
- memset (&state, '\0', sizeof (mbstate_t));
-# endif
- ENSURE_ALLOCATION (xsum (length, characters));
- for (remaining = characters; remaining > 0; )
- {
- char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
- int count;
-
- if (*arg == 0)
- abort ();
-# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
- count = wcrtomb (cbuf, *arg, &state);
-# else
- count = wctomb (cbuf, *arg);
-# endif
- if (count <= 0)
- /* Inconsistency. */
- abort ();
- memcpy (result + length, cbuf, count);
- length += count;
- arg++;
- remaining -= count;
- }
- if (!(arg == arg_end))
- abort ();
- }
- else
- {
-# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
- mbstate_t state;
- memset (&state, '\0', sizeof (mbstate_t));
-# endif
- while (arg < arg_end)
- {
- char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
- int count;
-
- if (*arg == 0)
- abort ();
-# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
- count = wcrtomb (cbuf, *arg, &state);
-# else
- count = wctomb (cbuf, *arg);
-# endif
- if (count <= 0)
- {
- /* Cannot convert. */
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = EILSEQ;
- return NULL;
- }
- ENSURE_ALLOCATION (xsum (length, count));
- memcpy (result + length, cbuf, count);
- length += count;
- arg++;
- }
- }
-# else
- ENSURE_ALLOCATION (xsum (length, tmpdst_len));
- DCHAR_CPY (result + length, tmpdst, tmpdst_len);
- free (tmpdst);
- length += tmpdst_len;
-# endif
-
- if (w < width && (dp->flags & FLAG_LEFT))
- {
- size_t n = width - w;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_SET (result + length, ' ', n);
- length += n;
- }
- }
-# endif
- }
-#endif
-#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
- else if ((dp->conversion == 'a' || dp->conversion == 'A')
-# if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE))
- && (0
-# if NEED_PRINTF_DOUBLE
- || a.arg[dp->arg_index].type == TYPE_DOUBLE
-# endif
-# if NEED_PRINTF_LONG_DOUBLE
- || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
-# endif
- )
-# endif
- )
- {
- arg_type type = a.arg[dp->arg_index].type;
- int flags = dp->flags;
- size_t width;
- int has_precision;
- size_t precision;
- size_t tmp_length;
- size_t count;
- DCHAR_T tmpbuf[700];
- DCHAR_T *tmp;
- DCHAR_T *pad_ptr;
- DCHAR_T *p;
-
- width = 0;
- if (dp->width_start != dp->width_end)
- {
- if (dp->width_arg_index != ARG_NONE)
- {
- int arg;
-
- if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
- abort ();
- arg = a.arg[dp->width_arg_index].a.a_int;
- width = arg;
- if (arg < 0)
- {
- /* "A negative field width is taken as a '-' flag
- followed by a positive field width." */
- flags |= FLAG_LEFT;
- width = -width;
- }
- }
- else
- {
- const FCHAR_T *digitp = dp->width_start;
-
- do
- width = xsum (xtimes (width, 10), *digitp++ - '0');
- while (digitp != dp->width_end);
- }
- }
-
- has_precision = 0;
- precision = 0;
- if (dp->precision_start != dp->precision_end)
- {
- if (dp->precision_arg_index != ARG_NONE)
- {
- int arg;
-
- if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
- abort ();
- arg = a.arg[dp->precision_arg_index].a.a_int;
- /* "A negative precision is taken as if the precision
- were omitted." */
- if (arg >= 0)
- {
- precision = arg;
- has_precision = 1;
- }
- }
- else
- {
- const FCHAR_T *digitp = dp->precision_start + 1;
-
- precision = 0;
- while (digitp != dp->precision_end)
- precision = xsum (xtimes (precision, 10), *digitp++ - '0');
- has_precision = 1;
- }
- }
-
- /* Allocate a temporary buffer of sufficient size. */
- if (type == TYPE_LONGDOUBLE)
- tmp_length =
- (unsigned int) ((LDBL_DIG + 1)
- * 0.831 /* decimal -> hexadecimal */
- )
- + 1; /* turn floor into ceil */
- else
- tmp_length =
- (unsigned int) ((DBL_DIG + 1)
- * 0.831 /* decimal -> hexadecimal */
- )
- + 1; /* turn floor into ceil */
- if (tmp_length < precision)
- tmp_length = precision;
- /* Account for sign, decimal point etc. */
- tmp_length = xsum (tmp_length, 12);
-
- if (tmp_length < width)
- tmp_length = width;
-
- tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
-
- if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
- tmp = tmpbuf;
- else
- {
- size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
-
- if (size_overflow_p (tmp_memsize))
- /* Overflow, would lead to out of memory. */
- goto out_of_memory;
- tmp = (DCHAR_T *) malloc (tmp_memsize);
- if (tmp == NULL)
- /* Out of memory. */
- goto out_of_memory;
- }
-
- pad_ptr = NULL;
- p = tmp;
- if (type == TYPE_LONGDOUBLE)
- {
-# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE
- long double arg = a.arg[dp->arg_index].a.a_longdouble;
-
- if (isnanl (arg))
- {
- if (dp->conversion == 'A')
- {
- *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
- }
- else
- {
- *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
- }
- }
- else
- {
- int sign = 0;
- DECL_LONG_DOUBLE_ROUNDING
-
- BEGIN_LONG_DOUBLE_ROUNDING ();
-
- if (signbit (arg)) /* arg < 0.0L or negative zero */
- {
- sign = -1;
- arg = -arg;
- }
-
- if (sign < 0)
- *p++ = '-';
- else if (flags & FLAG_SHOWSIGN)
- *p++ = '+';
- else if (flags & FLAG_SPACE)
- *p++ = ' ';
-
- if (arg > 0.0L && arg + arg == arg)
- {
- if (dp->conversion == 'A')
- {
- *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
- }
- else
- {
- *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
- }
- }
- else
- {
- int exponent;
- long double mantissa;
-
- if (arg > 0.0L)
- mantissa = printf_frexpl (arg, &exponent);
- else
- {
- exponent = 0;
- mantissa = 0.0L;
- }
-
- if (has_precision
- && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1)
- {
- /* Round the mantissa. */
- long double tail = mantissa;
- size_t q;
-
- for (q = precision; ; q--)
- {
- int digit = (int) tail;
- tail -= digit;
- if (q == 0)
- {
- if (digit & 1 ? tail >= 0.5L : tail > 0.5L)
- tail = 1 - tail;
- else
- tail = - tail;
- break;
- }
- tail *= 16.0L;
- }
- if (tail != 0.0L)
- for (q = precision; q > 0; q--)
- tail *= 0.0625L;
- mantissa += tail;
- }
-
- *p++ = '0';
- *p++ = dp->conversion - 'A' + 'X';
- pad_ptr = p;
- {
- int digit;
-
- digit = (int) mantissa;
- mantissa -= digit;
- *p++ = '0' + digit;
- if ((flags & FLAG_ALT)
- || mantissa > 0.0L || precision > 0)
- {
- *p++ = decimal_point_char ();
- /* This loop terminates because we assume
- that FLT_RADIX is a power of 2. */
- while (mantissa > 0.0L)
- {
- mantissa *= 16.0L;
- digit = (int) mantissa;
- mantissa -= digit;
- *p++ = digit
- + (digit < 10
- ? '0'
- : dp->conversion - 10);
- if (precision > 0)
- precision--;
- }
- while (precision > 0)
- {
- *p++ = '0';
- precision--;
- }
- }
- }
- *p++ = dp->conversion - 'A' + 'P';
-# if WIDE_CHAR_VERSION
- {
- static const wchar_t decimal_format[] =
- { '%', '+', 'd', '\0' };
- SNPRINTF (p, 6 + 1, decimal_format, exponent);
- }
- while (*p != '\0')
- p++;
-# else
- if (sizeof (DCHAR_T) == 1)
- {
- sprintf ((char *) p, "%+d", exponent);
- while (*p != '\0')
- p++;
- }
- else
- {
- char expbuf[6 + 1];
- const char *ep;
- sprintf (expbuf, "%+d", exponent);
- for (ep = expbuf; (*p = *ep) != '\0'; ep++)
- p++;
- }
-# endif
- }
-
- END_LONG_DOUBLE_ROUNDING ();
- }
-# else
- abort ();
-# endif
- }
- else
- {
-# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE
- double arg = a.arg[dp->arg_index].a.a_double;
-
- if (isnand (arg))
- {
- if (dp->conversion == 'A')
- {
- *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
- }
- else
- {
- *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
- }
- }
- else
- {
- int sign = 0;
-
- if (signbit (arg)) /* arg < 0.0 or negative zero */
- {
- sign = -1;
- arg = -arg;
- }
-
- if (sign < 0)
- *p++ = '-';
- else if (flags & FLAG_SHOWSIGN)
- *p++ = '+';
- else if (flags & FLAG_SPACE)
- *p++ = ' ';
-
- if (arg > 0.0 && arg + arg == arg)
- {
- if (dp->conversion == 'A')
- {
- *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
- }
- else
- {
- *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
- }
- }
- else
- {
- int exponent;
- double mantissa;
-
- if (arg > 0.0)
- mantissa = printf_frexp (arg, &exponent);
- else
- {
- exponent = 0;
- mantissa = 0.0;
- }
-
- if (has_precision
- && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1)
- {
- /* Round the mantissa. */
- double tail = mantissa;
- size_t q;
-
- for (q = precision; ; q--)
- {
- int digit = (int) tail;
- tail -= digit;
- if (q == 0)
- {
- if (digit & 1 ? tail >= 0.5 : tail > 0.5)
- tail = 1 - tail;
- else
- tail = - tail;
- break;
- }
- tail *= 16.0;
- }
- if (tail != 0.0)
- for (q = precision; q > 0; q--)
- tail *= 0.0625;
- mantissa += tail;
- }
-
- *p++ = '0';
- *p++ = dp->conversion - 'A' + 'X';
- pad_ptr = p;
- {
- int digit;
-
- digit = (int) mantissa;
- mantissa -= digit;
- *p++ = '0' + digit;
- if ((flags & FLAG_ALT)
- || mantissa > 0.0 || precision > 0)
- {
- *p++ = decimal_point_char ();
- /* This loop terminates because we assume
- that FLT_RADIX is a power of 2. */
- while (mantissa > 0.0)
- {
- mantissa *= 16.0;
- digit = (int) mantissa;
- mantissa -= digit;
- *p++ = digit
- + (digit < 10
- ? '0'
- : dp->conversion - 10);
- if (precision > 0)
- precision--;
- }
- while (precision > 0)
- {
- *p++ = '0';
- precision--;
- }
- }
- }
- *p++ = dp->conversion - 'A' + 'P';
-# if WIDE_CHAR_VERSION
- {
- static const wchar_t decimal_format[] =
- { '%', '+', 'd', '\0' };
- SNPRINTF (p, 6 + 1, decimal_format, exponent);
- }
- while (*p != '\0')
- p++;
-# else
- if (sizeof (DCHAR_T) == 1)
- {
- sprintf ((char *) p, "%+d", exponent);
- while (*p != '\0')
- p++;
- }
- else
- {
- char expbuf[6 + 1];
- const char *ep;
- sprintf (expbuf, "%+d", exponent);
- for (ep = expbuf; (*p = *ep) != '\0'; ep++)
- p++;
- }
-# endif
- }
- }
-# else
- abort ();
-# endif
- }
-
- /* The generated string now extends from tmp to p, with the
- zero padding insertion point being at pad_ptr. */
- count = p - tmp;
-
- if (count < width)
- {
- size_t pad = width - count;
- DCHAR_T *end = p + pad;
-
- if (flags & FLAG_LEFT)
- {
- /* Pad with spaces on the right. */
- for (; pad > 0; pad--)
- *p++ = ' ';
- }
- else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
- {
- /* Pad with zeroes. */
- DCHAR_T *q = end;
-
- while (p > pad_ptr)
- *--q = *--p;
- for (; pad > 0; pad--)
- *p++ = '0';
- }
- else
- {
- /* Pad with spaces on the left. */
- DCHAR_T *q = end;
-
- while (p > tmp)
- *--q = *--p;
- for (; pad > 0; pad--)
- *p++ = ' ';
- }
-
- p = end;
- }
-
- count = p - tmp;
-
- if (count >= tmp_length)
- /* tmp_length was incorrectly calculated - fix the
- code above! */
- abort ();
-
- /* Make room for the result. */
- if (count >= allocated - length)
- {
- size_t n = xsum (length, count);
-
- ENSURE_ALLOCATION (n);
- }
-
- /* Append the result. */
- memcpy (result + length, tmp, count * sizeof (DCHAR_T));
- if (tmp != tmpbuf)
- free (tmp);
- length += count;
- }
-#endif
-#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
- else if ((dp->conversion == 'f' || dp->conversion == 'F'
- || dp->conversion == 'e' || dp->conversion == 'E'
- || dp->conversion == 'g' || dp->conversion == 'G'
- || dp->conversion == 'a' || dp->conversion == 'A')
- && (0
-# if NEED_PRINTF_DOUBLE
- || a.arg[dp->arg_index].type == TYPE_DOUBLE
-# elif NEED_PRINTF_INFINITE_DOUBLE
- || (a.arg[dp->arg_index].type == TYPE_DOUBLE
- /* The systems (mingw) which produce wrong output
- for Inf, -Inf, and NaN also do so for -0.0.
- Therefore we treat this case here as well. */
- && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double))
-# endif
-# if NEED_PRINTF_LONG_DOUBLE
- || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
-# elif NEED_PRINTF_INFINITE_LONG_DOUBLE
- || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
- /* Some systems produce wrong output for Inf,
- -Inf, and NaN. Some systems in this category
- (IRIX 5.3) also do so for -0.0. Therefore we
- treat this case here as well. */
- && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble))
-# endif
- ))
- {
-# if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE)
- arg_type type = a.arg[dp->arg_index].type;
-# endif
- int flags = dp->flags;
- size_t width;
- size_t count;
- int has_precision;
- size_t precision;
- size_t tmp_length;
- DCHAR_T tmpbuf[700];
- DCHAR_T *tmp;
- DCHAR_T *pad_ptr;
- DCHAR_T *p;
-
- width = 0;
- if (dp->width_start != dp->width_end)
- {
- if (dp->width_arg_index != ARG_NONE)
- {
- int arg;
-
- if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
- abort ();
- arg = a.arg[dp->width_arg_index].a.a_int;
- width = arg;
- if (arg < 0)
- {
- /* "A negative field width is taken as a '-' flag
- followed by a positive field width." */
- flags |= FLAG_LEFT;
- width = -width;
- }
- }
- else
- {
- const FCHAR_T *digitp = dp->width_start;
-
- do
- width = xsum (xtimes (width, 10), *digitp++ - '0');
- while (digitp != dp->width_end);
- }
- }
-
- has_precision = 0;
- precision = 0;
- if (dp->precision_start != dp->precision_end)
- {
- if (dp->precision_arg_index != ARG_NONE)
- {
- int arg;
-
- if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
- abort ();
- arg = a.arg[dp->precision_arg_index].a.a_int;
- /* "A negative precision is taken as if the precision
- were omitted." */
- if (arg >= 0)
- {
- precision = arg;
- has_precision = 1;
- }
- }
- else
- {
- const FCHAR_T *digitp = dp->precision_start + 1;
-
- precision = 0;
- while (digitp != dp->precision_end)
- precision = xsum (xtimes (precision, 10), *digitp++ - '0');
- has_precision = 1;
- }
- }
-
- /* POSIX specifies the default precision to be 6 for %f, %F,
- %e, %E, but not for %g, %G. Implementations appear to use
- the same default precision also for %g, %G. But for %a, %A,
- the default precision is 0. */
- if (!has_precision)
- if (!(dp->conversion == 'a' || dp->conversion == 'A'))
- precision = 6;
-
- /* Allocate a temporary buffer of sufficient size. */
-# if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE
- tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1);
-# elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE
- tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0);
-# elif NEED_PRINTF_LONG_DOUBLE
- tmp_length = LDBL_DIG + 1;
-# elif NEED_PRINTF_DOUBLE
- tmp_length = DBL_DIG + 1;
-# else
- tmp_length = 0;
-# endif
- if (tmp_length < precision)
- tmp_length = precision;
-# if NEED_PRINTF_LONG_DOUBLE
-# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
- if (type == TYPE_LONGDOUBLE)
-# endif
- if (dp->conversion == 'f' || dp->conversion == 'F')
- {
- long double arg = a.arg[dp->arg_index].a.a_longdouble;
- if (!(isnanl (arg) || arg + arg == arg))
- {
- /* arg is finite and nonzero. */
- int exponent = floorlog10l (arg < 0 ? -arg : arg);
- if (exponent >= 0 && tmp_length < exponent + precision)
- tmp_length = exponent + precision;
- }
- }
-# endif
-# if NEED_PRINTF_DOUBLE
-# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
- if (type == TYPE_DOUBLE)
-# endif
- if (dp->conversion == 'f' || dp->conversion == 'F')
- {
- double arg = a.arg[dp->arg_index].a.a_double;
- if (!(isnand (arg) || arg + arg == arg))
- {
- /* arg is finite and nonzero. */
- int exponent = floorlog10 (arg < 0 ? -arg : arg);
- if (exponent >= 0 && tmp_length < exponent + precision)
- tmp_length = exponent + precision;
- }
- }
-# endif
- /* Account for sign, decimal point etc. */
- tmp_length = xsum (tmp_length, 12);
-
- if (tmp_length < width)
- tmp_length = width;
-
- tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
-
- if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
- tmp = tmpbuf;
- else
- {
- size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
-
- if (size_overflow_p (tmp_memsize))
- /* Overflow, would lead to out of memory. */
- goto out_of_memory;
- tmp = (DCHAR_T *) malloc (tmp_memsize);
- if (tmp == NULL)
- /* Out of memory. */
- goto out_of_memory;
- }
-
- pad_ptr = NULL;
- p = tmp;
-
-# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
-# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
- if (type == TYPE_LONGDOUBLE)
-# endif
- {
- long double arg = a.arg[dp->arg_index].a.a_longdouble;
-
- if (isnanl (arg))
- {
- if (dp->conversion >= 'A' && dp->conversion <= 'Z')
- {
- *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
- }
- else
- {
- *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
- }
- }
- else
- {
- int sign = 0;
- DECL_LONG_DOUBLE_ROUNDING
-
- BEGIN_LONG_DOUBLE_ROUNDING ();
-
- if (signbit (arg)) /* arg < 0.0L or negative zero */
- {
- sign = -1;
- arg = -arg;
- }
-
- if (sign < 0)
- *p++ = '-';
- else if (flags & FLAG_SHOWSIGN)
- *p++ = '+';
- else if (flags & FLAG_SPACE)
- *p++ = ' ';
-
- if (arg > 0.0L && arg + arg == arg)
- {
- if (dp->conversion >= 'A' && dp->conversion <= 'Z')
- {
- *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
- }
- else
- {
- *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
- }
- }
- else
- {
-# if NEED_PRINTF_LONG_DOUBLE
- pad_ptr = p;
-
- if (dp->conversion == 'f' || dp->conversion == 'F')
- {
- char *digits;
- size_t ndigits;
-
- digits =
- scale10_round_decimal_long_double (arg, precision);
- if (digits == NULL)
- {
- END_LONG_DOUBLE_ROUNDING ();
- goto out_of_memory;
- }
- ndigits = strlen (digits);
-
- if (ndigits > precision)
- do
- {
- --ndigits;
- *p++ = digits[ndigits];
- }
- while (ndigits > precision);
- else
- *p++ = '0';
- /* Here ndigits <= precision. */
- if ((flags & FLAG_ALT) || precision > 0)
- {
- *p++ = decimal_point_char ();
- for (; precision > ndigits; precision--)
- *p++ = '0';
- while (ndigits > 0)
- {
- --ndigits;
- *p++ = digits[ndigits];
- }
- }
-
- free (digits);
- }
- else if (dp->conversion == 'e' || dp->conversion == 'E')
- {
- int exponent;
-
- if (arg == 0.0L)
- {
- exponent = 0;
- *p++ = '0';
- if ((flags & FLAG_ALT) || precision > 0)
- {
- *p++ = decimal_point_char ();
- for (; precision > 0; precision--)
- *p++ = '0';
- }
- }
- else
- {
- /* arg > 0.0L. */
- int adjusted;
- char *digits;
- size_t ndigits;
-
- exponent = floorlog10l (arg);
- adjusted = 0;
- for (;;)
- {
- digits =
- scale10_round_decimal_long_double (arg,
- (int)precision - exponent);
- if (digits == NULL)
- {
- END_LONG_DOUBLE_ROUNDING ();
- goto out_of_memory;
- }
- ndigits = strlen (digits);
-
- if (ndigits == precision + 1)
- break;
- if (ndigits < precision
- || ndigits > precision + 2)
- /* The exponent was not guessed
- precisely enough. */
- abort ();
- if (adjusted)
- /* None of two values of exponent is
- the right one. Prevent an endless
- loop. */
- abort ();
- free (digits);
- if (ndigits == precision)
- exponent -= 1;
- else
- exponent += 1;
- adjusted = 1;
- }
- /* Here ndigits = precision+1. */
- if (is_borderline (digits, precision))
- {
- /* Maybe the exponent guess was too high
- and a smaller exponent can be reached
- by turning a 10...0 into 9...9x. */
- char *digits2 =
- scale10_round_decimal_long_double (arg,
- (int)precision - exponent + 1);
- if (digits2 == NULL)
- {
- free (digits);
- END_LONG_DOUBLE_ROUNDING ();
- goto out_of_memory;
- }
- if (strlen (digits2) == precision + 1)
- {
- free (digits);
- digits = digits2;
- exponent -= 1;
- }
- else
- free (digits2);
- }
- /* Here ndigits = precision+1. */
-
- *p++ = digits[--ndigits];
- if ((flags & FLAG_ALT) || precision > 0)
- {
- *p++ = decimal_point_char ();
- while (ndigits > 0)
- {
- --ndigits;
- *p++ = digits[ndigits];
- }
- }
-
- free (digits);
- }
-
- *p++ = dp->conversion; /* 'e' or 'E' */
-# if WIDE_CHAR_VERSION
- {
- static const wchar_t decimal_format[] =
- { '%', '+', '.', '2', 'd', '\0' };
- SNPRINTF (p, 6 + 1, decimal_format, exponent);
- }
- while (*p != '\0')
- p++;
-# else
- if (sizeof (DCHAR_T) == 1)
- {
- sprintf ((char *) p, "%+.2d", exponent);
- while (*p != '\0')
- p++;
- }
- else
- {
- char expbuf[6 + 1];
- const char *ep;
- sprintf (expbuf, "%+.2d", exponent);
- for (ep = expbuf; (*p = *ep) != '\0'; ep++)
- p++;
- }
-# endif
- }
- else if (dp->conversion == 'g' || dp->conversion == 'G')
- {
- if (precision == 0)
- precision = 1;
- /* precision >= 1. */
-
- if (arg == 0.0L)
- /* The exponent is 0, >= -4, < precision.
- Use fixed-point notation. */
- {
- size_t ndigits = precision;
- /* Number of trailing zeroes that have to be
- dropped. */
- size_t nzeroes =
- (flags & FLAG_ALT ? 0 : precision - 1);
-
- --ndigits;
- *p++ = '0';
- if ((flags & FLAG_ALT) || ndigits > nzeroes)
- {
- *p++ = decimal_point_char ();
- while (ndigits > nzeroes)
- {
- --ndigits;
- *p++ = '0';
- }
- }
- }
- else
- {
- /* arg > 0.0L. */
- int exponent;
- int adjusted;
- char *digits;
- size_t ndigits;
- size_t nzeroes;
-
- exponent = floorlog10l (arg);
- adjusted = 0;
- for (;;)
- {
- digits =
- scale10_round_decimal_long_double (arg,
- (int)(precision - 1) - exponent);
- if (digits == NULL)
- {
- END_LONG_DOUBLE_ROUNDING ();
- goto out_of_memory;
- }
- ndigits = strlen (digits);
-
- if (ndigits == precision)
- break;
- if (ndigits < precision - 1
- || ndigits > precision + 1)
- /* The exponent was not guessed
- precisely enough. */
- abort ();
- if (adjusted)
- /* None of two values of exponent is
- the right one. Prevent an endless
- loop. */
- abort ();
- free (digits);
- if (ndigits < precision)
- exponent -= 1;
- else
- exponent += 1;
- adjusted = 1;
- }
- /* Here ndigits = precision. */
- if (is_borderline (digits, precision - 1))
- {
- /* Maybe the exponent guess was too high
- and a smaller exponent can be reached
- by turning a 10...0 into 9...9x. */
- char *digits2 =
- scale10_round_decimal_long_double (arg,
- (int)(precision - 1) - exponent + 1);
- if (digits2 == NULL)
- {
- free (digits);
- END_LONG_DOUBLE_ROUNDING ();
- goto out_of_memory;
- }
- if (strlen (digits2) == precision)
- {
- free (digits);
- digits = digits2;
- exponent -= 1;
- }
- else
- free (digits2);
- }
- /* Here ndigits = precision. */
-
- /* Determine the number of trailing zeroes
- that have to be dropped. */
- nzeroes = 0;
- if ((flags & FLAG_ALT) == 0)
- while (nzeroes < ndigits
- && digits[nzeroes] == '0')
- nzeroes++;
-
- /* The exponent is now determined. */
- if (exponent >= -4
- && exponent < (long)precision)
- {
- /* Fixed-point notation:
- max(exponent,0)+1 digits, then the
- decimal point, then the remaining
- digits without trailing zeroes. */
- if (exponent >= 0)
- {
- size_t ecount = exponent + 1;
- /* Note: count <= precision = ndigits. */
- for (; ecount > 0; ecount--)
- *p++ = digits[--ndigits];
- if ((flags & FLAG_ALT) || ndigits > nzeroes)
- {
- *p++ = decimal_point_char ();
- while (ndigits > nzeroes)
- {
- --ndigits;
- *p++ = digits[ndigits];
- }
- }
- }
- else
- {
- size_t ecount = -exponent - 1;
- *p++ = '0';
- *p++ = decimal_point_char ();
- for (; ecount > 0; ecount--)
- *p++ = '0';
- while (ndigits > nzeroes)
- {
- --ndigits;
- *p++ = digits[ndigits];
- }
- }
- }
- else
- {
- /* Exponential notation. */
- *p++ = digits[--ndigits];
- if ((flags & FLAG_ALT) || ndigits > nzeroes)
- {
- *p++ = decimal_point_char ();
- while (ndigits > nzeroes)
- {
- --ndigits;
- *p++ = digits[ndigits];
- }
- }
- *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
-# if WIDE_CHAR_VERSION
- {
- static const wchar_t decimal_format[] =
- { '%', '+', '.', '2', 'd', '\0' };
- SNPRINTF (p, 6 + 1, decimal_format, exponent);
- }
- while (*p != '\0')
- p++;
-# else
- if (sizeof (DCHAR_T) == 1)
- {
- sprintf ((char *) p, "%+.2d", exponent);
- while (*p != '\0')
- p++;
- }
- else
- {
- char expbuf[6 + 1];
- const char *ep;
- sprintf (expbuf, "%+.2d", exponent);
- for (ep = expbuf; (*p = *ep) != '\0'; ep++)
- p++;
- }
-# endif
- }
-
- free (digits);
- }
- }
- else
- abort ();
-# else
- /* arg is finite. */
- if (!(arg == 0.0L))
- abort ();
-
- pad_ptr = p;
-
- if (dp->conversion == 'f' || dp->conversion == 'F')
- {
- *p++ = '0';
- if ((flags & FLAG_ALT) || precision > 0)
- {
- *p++ = decimal_point_char ();
- for (; precision > 0; precision--)
- *p++ = '0';
- }
- }
- else if (dp->conversion == 'e' || dp->conversion == 'E')
- {
- *p++ = '0';
- if ((flags & FLAG_ALT) || precision > 0)
- {
- *p++ = decimal_point_char ();
- for (; precision > 0; precision--)
- *p++ = '0';
- }
- *p++ = dp->conversion; /* 'e' or 'E' */
- *p++ = '+';
- *p++ = '0';
- *p++ = '0';
- }
- else if (dp->conversion == 'g' || dp->conversion == 'G')
- {
- *p++ = '0';
- if (flags & FLAG_ALT)
- {
- size_t ndigits =
- (precision > 0 ? precision - 1 : 0);
- *p++ = decimal_point_char ();
- for (; ndigits > 0; --ndigits)
- *p++ = '0';
- }
- }
- else if (dp->conversion == 'a' || dp->conversion == 'A')
- {
- *p++ = '0';
- *p++ = dp->conversion - 'A' + 'X';
- pad_ptr = p;
- *p++ = '0';
- if ((flags & FLAG_ALT) || precision > 0)
- {
- *p++ = decimal_point_char ();
- for (; precision > 0; precision--)
- *p++ = '0';
- }
- *p++ = dp->conversion - 'A' + 'P';
- *p++ = '+';
- *p++ = '0';
- }
- else
- abort ();
-# endif
- }
-
- END_LONG_DOUBLE_ROUNDING ();
- }
- }
-# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
- else
-# endif
-# endif
-# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
- {
- double arg = a.arg[dp->arg_index].a.a_double;
-
- if (isnand (arg))
- {
- if (dp->conversion >= 'A' && dp->conversion <= 'Z')
- {
- *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
- }
- else
- {
- *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
- }
- }
- else
- {
- int sign = 0;
-
- if (signbit (arg)) /* arg < 0.0 or negative zero */
- {
- sign = -1;
- arg = -arg;
- }
-
- if (sign < 0)
- *p++ = '-';
- else if (flags & FLAG_SHOWSIGN)
- *p++ = '+';
- else if (flags & FLAG_SPACE)
- *p++ = ' ';
-
- if (arg > 0.0 && arg + arg == arg)
- {
- if (dp->conversion >= 'A' && dp->conversion <= 'Z')
- {
- *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
- }
- else
- {
- *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
- }
- }
- else
- {
-# if NEED_PRINTF_DOUBLE
- pad_ptr = p;
-
- if (dp->conversion == 'f' || dp->conversion == 'F')
- {
- char *digits;
- size_t ndigits;
-
- digits =
- scale10_round_decimal_double (arg, precision);
- if (digits == NULL)
- goto out_of_memory;
- ndigits = strlen (digits);
-
- if (ndigits > precision)
- do
- {
- --ndigits;
- *p++ = digits[ndigits];
- }
- while (ndigits > precision);
- else
- *p++ = '0';
- /* Here ndigits <= precision. */
- if ((flags & FLAG_ALT) || precision > 0)
- {
- *p++ = decimal_point_char ();
- for (; precision > ndigits; precision--)
- *p++ = '0';
- while (ndigits > 0)
- {
- --ndigits;
- *p++ = digits[ndigits];
- }
- }
-
- free (digits);
- }
- else if (dp->conversion == 'e' || dp->conversion == 'E')
- {
- int exponent;
-
- if (arg == 0.0)
- {
- exponent = 0;
- *p++ = '0';
- if ((flags & FLAG_ALT) || precision > 0)
- {
- *p++ = decimal_point_char ();
- for (; precision > 0; precision--)
- *p++ = '0';
- }
- }
- else
- {
- /* arg > 0.0. */
- int adjusted;
- char *digits;
- size_t ndigits;
-
- exponent = floorlog10 (arg);
- adjusted = 0;
- for (;;)
- {
- digits =
- scale10_round_decimal_double (arg,
- (int)precision - exponent);
- if (digits == NULL)
- goto out_of_memory;
- ndigits = strlen (digits);
-
- if (ndigits == precision + 1)
- break;
- if (ndigits < precision
- || ndigits > precision + 2)
- /* The exponent was not guessed
- precisely enough. */
- abort ();
- if (adjusted)
- /* None of two values of exponent is
- the right one. Prevent an endless
- loop. */
- abort ();
- free (digits);
- if (ndigits == precision)
- exponent -= 1;
- else
- exponent += 1;
- adjusted = 1;
- }
- /* Here ndigits = precision+1. */
- if (is_borderline (digits, precision))
- {
- /* Maybe the exponent guess was too high
- and a smaller exponent can be reached
- by turning a 10...0 into 9...9x. */
- char *digits2 =
- scale10_round_decimal_double (arg,
- (int)precision - exponent + 1);
- if (digits2 == NULL)
- {
- free (digits);
- goto out_of_memory;
- }
- if (strlen (digits2) == precision + 1)
- {
- free (digits);
- digits = digits2;
- exponent -= 1;
- }
- else
- free (digits2);
- }
- /* Here ndigits = precision+1. */
-
- *p++ = digits[--ndigits];
- if ((flags & FLAG_ALT) || precision > 0)
- {
- *p++ = decimal_point_char ();
- while (ndigits > 0)
- {
- --ndigits;
- *p++ = digits[ndigits];
- }
- }
-
- free (digits);
- }
-
- *p++ = dp->conversion; /* 'e' or 'E' */
-# if WIDE_CHAR_VERSION
- {
- static const wchar_t decimal_format[] =
- /* Produce the same number of exponent digits
- as the native printf implementation. */
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- { '%', '+', '.', '3', 'd', '\0' };
-# else
- { '%', '+', '.', '2', 'd', '\0' };
-# endif
- SNPRINTF (p, 6 + 1, decimal_format, exponent);
- }
- while (*p != '\0')
- p++;
-# else
- {
- static const char decimal_format[] =
- /* Produce the same number of exponent digits
- as the native printf implementation. */
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- "%+.3d";
-# else
- "%+.2d";
-# endif
- if (sizeof (DCHAR_T) == 1)
- {
- sprintf ((char *) p, decimal_format, exponent);
- while (*p != '\0')
- p++;
- }
- else
- {
- char expbuf[6 + 1];
- const char *ep;
- sprintf (expbuf, decimal_format, exponent);
- for (ep = expbuf; (*p = *ep) != '\0'; ep++)
- p++;
- }
- }
-# endif
- }
- else if (dp->conversion == 'g' || dp->conversion == 'G')
- {
- if (precision == 0)
- precision = 1;
- /* precision >= 1. */
-
- if (arg == 0.0)
- /* The exponent is 0, >= -4, < precision.
- Use fixed-point notation. */
- {
- size_t ndigits = precision;
- /* Number of trailing zeroes that have to be
- dropped. */
- size_t nzeroes =
- (flags & FLAG_ALT ? 0 : precision - 1);
-
- --ndigits;
- *p++ = '0';
- if ((flags & FLAG_ALT) || ndigits > nzeroes)
- {
- *p++ = decimal_point_char ();
- while (ndigits > nzeroes)
- {
- --ndigits;
- *p++ = '0';
- }
- }
- }
- else
- {
- /* arg > 0.0. */
- int exponent;
- int adjusted;
- char *digits;
- size_t ndigits;
- size_t nzeroes;
-
- exponent = floorlog10 (arg);
- adjusted = 0;
- for (;;)
- {
- digits =
- scale10_round_decimal_double (arg,
- (int)(precision - 1) - exponent);
- if (digits == NULL)
- goto out_of_memory;
- ndigits = strlen (digits);
-
- if (ndigits == precision)
- break;
- if (ndigits < precision - 1
- || ndigits > precision + 1)
- /* The exponent was not guessed
- precisely enough. */
- abort ();
- if (adjusted)
- /* None of two values of exponent is
- the right one. Prevent an endless
- loop. */
- abort ();
- free (digits);
- if (ndigits < precision)
- exponent -= 1;
- else
- exponent += 1;
- adjusted = 1;
- }
- /* Here ndigits = precision. */
- if (is_borderline (digits, precision - 1))
- {
- /* Maybe the exponent guess was too high
- and a smaller exponent can be reached
- by turning a 10...0 into 9...9x. */
- char *digits2 =
- scale10_round_decimal_double (arg,
- (int)(precision - 1) - exponent + 1);
- if (digits2 == NULL)
- {
- free (digits);
- goto out_of_memory;
- }
- if (strlen (digits2) == precision)
- {
- free (digits);
- digits = digits2;
- exponent -= 1;
- }
- else
- free (digits2);
- }
- /* Here ndigits = precision. */
-
- /* Determine the number of trailing zeroes
- that have to be dropped. */
- nzeroes = 0;
- if ((flags & FLAG_ALT) == 0)
- while (nzeroes < ndigits
- && digits[nzeroes] == '0')
- nzeroes++;
-
- /* The exponent is now determined. */
- if (exponent >= -4
- && exponent < (long)precision)
- {
- /* Fixed-point notation:
- max(exponent,0)+1 digits, then the
- decimal point, then the remaining
- digits without trailing zeroes. */
- if (exponent >= 0)
- {
- size_t ecount = exponent + 1;
- /* Note: ecount <= precision = ndigits. */
- for (; ecount > 0; ecount--)
- *p++ = digits[--ndigits];
- if ((flags & FLAG_ALT) || ndigits > nzeroes)
- {
- *p++ = decimal_point_char ();
- while (ndigits > nzeroes)
- {
- --ndigits;
- *p++ = digits[ndigits];
- }
- }
- }
- else
- {
- size_t ecount = -exponent - 1;
- *p++ = '0';
- *p++ = decimal_point_char ();
- for (; ecount > 0; ecount--)
- *p++ = '0';
- while (ndigits > nzeroes)
- {
- --ndigits;
- *p++ = digits[ndigits];
- }
- }
- }
- else
- {
- /* Exponential notation. */
- *p++ = digits[--ndigits];
- if ((flags & FLAG_ALT) || ndigits > nzeroes)
- {
- *p++ = decimal_point_char ();
- while (ndigits > nzeroes)
- {
- --ndigits;
- *p++ = digits[ndigits];
- }
- }
- *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
-# if WIDE_CHAR_VERSION
- {
- static const wchar_t decimal_format[] =
- /* Produce the same number of exponent digits
- as the native printf implementation. */
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- { '%', '+', '.', '3', 'd', '\0' };
-# else
- { '%', '+', '.', '2', 'd', '\0' };
-# endif
- SNPRINTF (p, 6 + 1, decimal_format, exponent);
- }
- while (*p != '\0')
- p++;
-# else
- {
- static const char decimal_format[] =
- /* Produce the same number of exponent digits
- as the native printf implementation. */
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- "%+.3d";
-# else
- "%+.2d";
-# endif
- if (sizeof (DCHAR_T) == 1)
- {
- sprintf ((char *) p, decimal_format, exponent);
- while (*p != '\0')
- p++;
- }
- else
- {
- char expbuf[6 + 1];
- const char *ep;
- sprintf (expbuf, decimal_format, exponent);
- for (ep = expbuf; (*p = *ep) != '\0'; ep++)
- p++;
- }
- }
-# endif
- }
-
- free (digits);
- }
- }
- else
- abort ();
-# else
- /* arg is finite. */
- if (!(arg == 0.0))
- abort ();
-
- pad_ptr = p;
-
- if (dp->conversion == 'f' || dp->conversion == 'F')
- {
- *p++ = '0';
- if ((flags & FLAG_ALT) || precision > 0)
- {
- *p++ = decimal_point_char ();
- for (; precision > 0; precision--)
- *p++ = '0';
- }
- }
- else if (dp->conversion == 'e' || dp->conversion == 'E')
- {
- *p++ = '0';
- if ((flags & FLAG_ALT) || precision > 0)
- {
- *p++ = decimal_point_char ();
- for (; precision > 0; precision--)
- *p++ = '0';
- }
- *p++ = dp->conversion; /* 'e' or 'E' */
- *p++ = '+';
- /* Produce the same number of exponent digits as
- the native printf implementation. */
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- *p++ = '0';
-# endif
- *p++ = '0';
- *p++ = '0';
- }
- else if (dp->conversion == 'g' || dp->conversion == 'G')
- {
- *p++ = '0';
- if (flags & FLAG_ALT)
- {
- size_t ndigits =
- (precision > 0 ? precision - 1 : 0);
- *p++ = decimal_point_char ();
- for (; ndigits > 0; --ndigits)
- *p++ = '0';
- }
- }
- else
- abort ();
-# endif
- }
- }
- }
-# endif
-
- /* The generated string now extends from tmp to p, with the
- zero padding insertion point being at pad_ptr. */
- count = p - tmp;
-
- if (count < width)
- {
- size_t pad = width - count;
- DCHAR_T *end = p + pad;
-
- if (flags & FLAG_LEFT)
- {
- /* Pad with spaces on the right. */
- for (; pad > 0; pad--)
- *p++ = ' ';
- }
- else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
- {
- /* Pad with zeroes. */
- DCHAR_T *q = end;
-
- while (p > pad_ptr)
- *--q = *--p;
- for (; pad > 0; pad--)
- *p++ = '0';
- }
- else
- {
- /* Pad with spaces on the left. */
- DCHAR_T *q = end;
-
- while (p > tmp)
- *--q = *--p;
- for (; pad > 0; pad--)
- *p++ = ' ';
- }
-
- p = end;
- }
-
- count = p - tmp;
-
- if (count >= tmp_length)
- /* tmp_length was incorrectly calculated - fix the
- code above! */
- abort ();
-
- /* Make room for the result. */
- if (count >= allocated - length)
- {
- size_t n = xsum (length, count);
-
- ENSURE_ALLOCATION (n);
- }
-
- /* Append the result. */
- memcpy (result + length, tmp, count * sizeof (DCHAR_T));
- if (tmp != tmpbuf)
- free (tmp);
- length += count;
- }
-#endif
- else
- {
- arg_type type = a.arg[dp->arg_index].type;
- int flags = dp->flags;
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
- int has_width;
-#endif
-#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
- size_t width;
-#endif
-#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION
- int has_precision;
- size_t precision;
-#endif
-#if NEED_PRINTF_UNBOUNDED_PRECISION
- int prec_ourselves;
-#else
-# define prec_ourselves 0
-#endif
-#if NEED_PRINTF_FLAG_LEFTADJUST
-# define pad_ourselves 1
-#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
- int pad_ourselves;
-#else
-# define pad_ourselves 0
-#endif
- TCHAR_T *fbp;
- unsigned int prefix_count;
- int prefixes[2] IF_LINT (= { 0 });
- int orig_errno;
-#if !USE_SNPRINTF
- size_t tmp_length;
- TCHAR_T tmpbuf[700];
- TCHAR_T *tmp;
-#endif
-
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
- has_width = 0;
-#endif
-#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
- width = 0;
- if (dp->width_start != dp->width_end)
- {
- if (dp->width_arg_index != ARG_NONE)
- {
- int arg;
-
- if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
- abort ();
- arg = a.arg[dp->width_arg_index].a.a_int;
- width = arg;
- if (arg < 0)
- {
- /* "A negative field width is taken as a '-' flag
- followed by a positive field width." */
- flags |= FLAG_LEFT;
- width = -width;
- }
- }
- else
- {
- const FCHAR_T *digitp = dp->width_start;
-
- do
- width = xsum (xtimes (width, 10), *digitp++ - '0');
- while (digitp != dp->width_end);
- }
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
- has_width = 1;
-#endif
- }
-#endif
-
-#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION
- has_precision = 0;
- precision = 6;
- if (dp->precision_start != dp->precision_end)
- {
- if (dp->precision_arg_index != ARG_NONE)
- {
- int arg;
-
- if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
- abort ();
- arg = a.arg[dp->precision_arg_index].a.a_int;
- /* "A negative precision is taken as if the precision
- were omitted." */
- if (arg >= 0)
- {
- precision = arg;
- has_precision = 1;
- }
- }
- else
- {
- const FCHAR_T *digitp = dp->precision_start + 1;
-
- precision = 0;
- while (digitp != dp->precision_end)
- precision = xsum (xtimes (precision, 10), *digitp++ - '0');
- has_precision = 1;
- }
- }
-#endif
-
- /* Decide whether to handle the precision ourselves. */
-#if NEED_PRINTF_UNBOUNDED_PRECISION
- switch (dp->conversion)
- {
- case 'd': case 'i': case 'u':
- case 'o':
- case 'x': case 'X': case 'p':
- prec_ourselves = has_precision && (precision > 0);
- break;
- default:
- prec_ourselves = 0;
- break;
- }
-#endif
-
- /* Decide whether to perform the padding ourselves. */
-#if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
- switch (dp->conversion)
- {
-# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
- /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
- to perform the padding after this conversion. Functions
- with unistdio extensions perform the padding based on
- character count rather than element count. */
- case 'c': case 's':
-# endif
-# if NEED_PRINTF_FLAG_ZERO
- case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
- case 'a': case 'A':
-# endif
- pad_ourselves = 1;
- break;
- default:
- pad_ourselves = prec_ourselves;
- break;
- }
-#endif
-
-#if !USE_SNPRINTF
- /* Allocate a temporary buffer of sufficient size for calling
- sprintf. */
- tmp_length =
- MAX_ROOM_NEEDED (&a, dp->arg_index, dp->conversion, type,
- flags, width, has_precision, precision,
- pad_ourselves);
-
- if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T))
- tmp = tmpbuf;
- else
- {
- size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T));
-
- if (size_overflow_p (tmp_memsize))
- /* Overflow, would lead to out of memory. */
- goto out_of_memory;
- tmp = (TCHAR_T *) malloc (tmp_memsize);
- if (tmp == NULL)
- /* Out of memory. */
- goto out_of_memory;
- }
-#endif
-
- /* Construct the format string for calling snprintf or
- sprintf. */
- fbp = buf;
- *fbp++ = '%';
-#if NEED_PRINTF_FLAG_GROUPING
- /* The underlying implementation doesn't support the ' flag.
- Produce no grouping characters in this case; this is
- acceptable because the grouping is locale dependent. */
-#else
- if (flags & FLAG_GROUP)
- *fbp++ = '\'';
-#endif
- if (flags & FLAG_LEFT)
- *fbp++ = '-';
- if (flags & FLAG_SHOWSIGN)
- *fbp++ = '+';
- if (flags & FLAG_SPACE)
- *fbp++ = ' ';
- if (flags & FLAG_ALT)
- *fbp++ = '#';
-#if __GLIBC__ >= 2 && !defined __UCLIBC__
- if (flags & FLAG_LOCALIZED)
- *fbp++ = 'I';
-#endif
- if (!pad_ourselves)
- {
- if (flags & FLAG_ZERO)
- *fbp++ = '0';
- if (dp->width_start != dp->width_end)
- {
- size_t n = dp->width_end - dp->width_start;
- /* The width specification is known to consist only
- of standard ASCII characters. */
- if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
- {
- memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T));
- fbp += n;
- }
- else
- {
- const FCHAR_T *mp = dp->width_start;
- do
- *fbp++ = *mp++;
- while (--n > 0);
- }
- }
- }
- if (!prec_ourselves)
- {
- if (dp->precision_start != dp->precision_end)
- {
- size_t n = dp->precision_end - dp->precision_start;
- /* The precision specification is known to consist only
- of standard ASCII characters. */
- if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
- {
- memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T));
- fbp += n;
- }
- else
- {
- const FCHAR_T *mp = dp->precision_start;
- do
- *fbp++ = *mp++;
- while (--n > 0);
- }
- }
- }
-
- switch (type)
- {
-#if HAVE_LONG_LONG_INT
- case TYPE_LONGLONGINT:
- case TYPE_ULONGLONGINT:
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- *fbp++ = 'I';
- *fbp++ = '6';
- *fbp++ = '4';
- break;
-# else
- *fbp++ = 'l';
-# endif
-#endif
- /*FALLTHROUGH*/
- case TYPE_LONGINT:
- case TYPE_ULONGINT:
-#if HAVE_WINT_T
- case TYPE_WIDE_CHAR:
-#endif
-#if HAVE_WCHAR_T
- case TYPE_WIDE_STRING:
-#endif
- *fbp++ = 'l';
- break;
- case TYPE_LONGDOUBLE:
- *fbp++ = 'L';
- break;
- default:
- break;
- }
-#if NEED_PRINTF_DIRECTIVE_F
- if (dp->conversion == 'F')
- *fbp = 'f';
- else
-#endif
- *fbp = dp->conversion;
-#if USE_SNPRINTF
-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
- fbp[1] = '%';
- fbp[2] = 'n';
- fbp[3] = '\0';
-# else
- /* On glibc2 systems from glibc >= 2.3 - probably also older
- ones - we know that snprintf's return value conforms to
- ISO C 99: the tests gl_SNPRINTF_RETVAL_C99 and
- gl_SNPRINTF_TRUNCATION_C99 pass.
- Therefore we can avoid using %n in this situation.
- On glibc2 systems from 2004-10-18 or newer, the use of %n
- in format strings in writable memory may crash the program
- (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
- in this situation. */
- /* On native Windows systems (such as mingw), we can avoid using
- %n because:
- - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
- snprintf does not write more than the specified number
- of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
- '4', '5', '6' into buf, not '4', '5', '\0'.)
- - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
- allows us to recognize the case of an insufficient
- buffer size: it returns -1 in this case.
- On native Windows systems (such as mingw) where the OS is
- Windows Vista, the use of %n in format strings by default
- crashes the program. See
- <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
- <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx>
- So we should avoid %n in this situation. */
- fbp[1] = '\0';
-# endif
-#else
- fbp[1] = '\0';
-#endif
-
- /* Construct the arguments for calling snprintf or sprintf. */
- prefix_count = 0;
- if (!pad_ourselves && dp->width_arg_index != ARG_NONE)
- {
- if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
- abort ();
- prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
- }
- if (!prec_ourselves && dp->precision_arg_index != ARG_NONE)
- {
- if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
- abort ();
- prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
- }
-
-#if USE_SNPRINTF
- /* The SNPRINTF result is appended after result[0..length].
- The latter is an array of DCHAR_T; SNPRINTF appends an
- array of TCHAR_T to it. This is possible because
- sizeof (TCHAR_T) divides sizeof (DCHAR_T) and
- alignof (TCHAR_T) <= alignof (DCHAR_T). */
-# define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T))
- /* Ensure that maxlen below will be >= 2. Needed on BeOS,
- where an snprintf() with maxlen==1 acts like sprintf(). */
- ENSURE_ALLOCATION (xsum (length,
- (2 + TCHARS_PER_DCHAR - 1)
- / TCHARS_PER_DCHAR));
- /* Prepare checking whether snprintf returns the count
- via %n. */
- *(TCHAR_T *) (result + length) = '\0';
-#endif
-
- orig_errno = errno;
-
- for (;;)
- {
- int count = -1;
-
-#if USE_SNPRINTF
- int retcount = 0;
- size_t maxlen = allocated - length;
- /* SNPRINTF can fail if its second argument is
- > INT_MAX. */
- if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
- maxlen = INT_MAX / TCHARS_PER_DCHAR;
- maxlen = maxlen * TCHARS_PER_DCHAR;
-# define SNPRINTF_BUF(arg) \
- switch (prefix_count) \
- { \
- case 0: \
- retcount = SNPRINTF ((TCHAR_T *) (result + length), \
- maxlen, buf, \
- arg, &count); \
- break; \
- case 1: \
- retcount = SNPRINTF ((TCHAR_T *) (result + length), \
- maxlen, buf, \
- prefixes[0], arg, &count); \
- break; \
- case 2: \
- retcount = SNPRINTF ((TCHAR_T *) (result + length), \
- maxlen, buf, \
- prefixes[0], prefixes[1], arg, \
- &count); \
- break; \
- default: \
- abort (); \
- }
-#else
-# define SNPRINTF_BUF(arg) \
- switch (prefix_count) \
- { \
- case 0: \
- count = sprintf (tmp, buf, arg); \
- break; \
- case 1: \
- count = sprintf (tmp, buf, prefixes[0], arg); \
- break; \
- case 2: \
- count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
- arg); \
- break; \
- default: \
- abort (); \
- }
-#endif
-
- errno = 0;
- switch (type)
- {
- case TYPE_SCHAR:
- {
- int arg = a.arg[dp->arg_index].a.a_schar;
- SNPRINTF_BUF (arg);
- }
- break;
- case TYPE_UCHAR:
- {
- unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
- SNPRINTF_BUF (arg);
- }
- break;
- case TYPE_SHORT:
- {
- int arg = a.arg[dp->arg_index].a.a_short;
- SNPRINTF_BUF (arg);
- }
- break;
- case TYPE_USHORT:
- {
- unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
- SNPRINTF_BUF (arg);
- }
- break;
- case TYPE_INT:
- {
- int arg = a.arg[dp->arg_index].a.a_int;
- SNPRINTF_BUF (arg);
- }
- break;
- case TYPE_UINT:
- {
- unsigned int arg = a.arg[dp->arg_index].a.a_uint;
- SNPRINTF_BUF (arg);
- }
- break;
- case TYPE_LONGINT:
- {
- long int arg = a.arg[dp->arg_index].a.a_longint;
- SNPRINTF_BUF (arg);
- }
- break;
- case TYPE_ULONGINT:
- {
- unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint;
- SNPRINTF_BUF (arg);
- }
- break;
-#if HAVE_LONG_LONG_INT
- case TYPE_LONGLONGINT:
- {
- long long int arg = a.arg[dp->arg_index].a.a_longlongint;
- SNPRINTF_BUF (arg);
- }
- break;
- case TYPE_ULONGLONGINT:
- {
- unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint;
- SNPRINTF_BUF (arg);
- }
- break;
-#endif
- case TYPE_DOUBLE:
- {
- double arg = a.arg[dp->arg_index].a.a_double;
- SNPRINTF_BUF (arg);
- }
- break;
- case TYPE_LONGDOUBLE:
- {
- long double arg = a.arg[dp->arg_index].a.a_longdouble;
- SNPRINTF_BUF (arg);
- }
- break;
- case TYPE_CHAR:
- {
- int arg = a.arg[dp->arg_index].a.a_char;
- SNPRINTF_BUF (arg);
- }
- break;
-#if HAVE_WINT_T
- case TYPE_WIDE_CHAR:
- {
- wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
- SNPRINTF_BUF (arg);
- }
- break;
-#endif
- case TYPE_STRING:
- {
- const char *arg = a.arg[dp->arg_index].a.a_string;
- SNPRINTF_BUF (arg);
- }
- break;
-#if HAVE_WCHAR_T
- case TYPE_WIDE_STRING:
- {
- const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
- SNPRINTF_BUF (arg);
- }
- break;
-#endif
- case TYPE_POINTER:
- {
- void *arg = a.arg[dp->arg_index].a.a_pointer;
- SNPRINTF_BUF (arg);
- }
- break;
- default:
- abort ();
- }
-
-#if USE_SNPRINTF
- /* Portability: Not all implementations of snprintf()
- are ISO C 99 compliant. Determine the number of
- bytes that snprintf() has produced or would have
- produced. */
- if (count >= 0)
- {
- /* Verify that snprintf() has NUL-terminated its
- result. */
- if (count < maxlen
- && ((TCHAR_T *) (result + length)) [count] != '\0')
- abort ();
- /* Portability hack. */
- if (retcount > count)
- count = retcount;
- }
- else
- {
- /* snprintf() doesn't understand the '%n'
- directive. */
- if (fbp[1] != '\0')
- {
- /* Don't use the '%n' directive; instead, look
- at the snprintf() return value. */
- fbp[1] = '\0';
- continue;
- }
- else
- {
- /* Look at the snprintf() return value. */
- if (retcount < 0)
- {
-# if !HAVE_SNPRINTF_RETVAL_C99
- /* HP-UX 10.20 snprintf() is doubly deficient:
- It doesn't understand the '%n' directive,
- *and* it returns -1 (rather than the length
- that would have been required) when the
- buffer is too small.
- But a failure at this point can also come
- from other reasons than a too small buffer,
- such as an invalid wide string argument to
- the %ls directive, or possibly an invalid
- floating-point argument. */
- size_t tmp_length =
- MAX_ROOM_NEEDED (&a, dp->arg_index,
- dp->conversion, type, flags,
- width,
- has_precision,
- precision, pad_ourselves);
-
- if (maxlen < tmp_length)
- {
- /* Make more room. But try to do through
- this reallocation only once. */
- size_t bigger_need =
- xsum (length,
- xsum (tmp_length,
- TCHARS_PER_DCHAR - 1)
- / TCHARS_PER_DCHAR);
- /* And always grow proportionally.
- (There may be several arguments, each
- needing a little more room than the
- previous one.) */
- size_t bigger_need2 =
- xsum (xtimes (allocated, 2), 12);
- if (bigger_need < bigger_need2)
- bigger_need = bigger_need2;
- ENSURE_ALLOCATION (bigger_need);
- continue;
- }
-# endif
- }
- else
- count = retcount;
- }
- }
-#endif
-
- /* Attempt to handle failure. */
- if (count < 0)
- {
- /* SNPRINTF or sprintf failed. Save and use the errno
- that it has set, if any. */
- int saved_errno = errno;
- if (saved_errno == 0)
- {
- if (dp->conversion == 'c' || dp->conversion == 's')
- saved_errno = EILSEQ;
- else
- saved_errno = EINVAL;
- }
-
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
-
- errno = saved_errno;
- return NULL;
- }
-
-#if USE_SNPRINTF
- /* Handle overflow of the allocated buffer.
- If such an overflow occurs, a C99 compliant snprintf()
- returns a count >= maxlen. However, a non-compliant
- snprintf() function returns only count = maxlen - 1. To
- cover both cases, test whether count >= maxlen - 1. */
- if ((unsigned int) count + 1 >= maxlen)
- {
- /* If maxlen already has attained its allowed maximum,
- allocating more memory will not increase maxlen.
- Instead of looping, bail out. */
- if (maxlen == INT_MAX / TCHARS_PER_DCHAR)
- goto overflow;
- else
- {
- /* Need at least (count + 1) * sizeof (TCHAR_T)
- bytes. (The +1 is for the trailing NUL.)
- But ask for (count + 2) * sizeof (TCHAR_T)
- bytes, so that in the next round, we likely get
- maxlen > (unsigned int) count + 1
- and so we don't get here again.
- And allocate proportionally, to avoid looping
- eternally if snprintf() reports a too small
- count. */
- size_t n =
- xmax (xsum (length,
- ((unsigned int) count + 2
- + TCHARS_PER_DCHAR - 1)
- / TCHARS_PER_DCHAR),
- xtimes (allocated, 2));
-
- ENSURE_ALLOCATION (n);
- continue;
- }
- }
-#endif
-
-#if NEED_PRINTF_UNBOUNDED_PRECISION
- if (prec_ourselves)
- {
- /* Handle the precision. */
- TCHAR_T *prec_ptr =
-# if USE_SNPRINTF
- (TCHAR_T *) (result + length);
-# else
- tmp;
-# endif
- size_t prefix_count;
- size_t move;
-
- prefix_count = 0;
- /* Put the additional zeroes after the sign. */
- if (count >= 1
- && (*prec_ptr == '-' || *prec_ptr == '+'
- || *prec_ptr == ' '))
- prefix_count = 1;
- /* Put the additional zeroes after the 0x prefix if
- (flags & FLAG_ALT) || (dp->conversion == 'p'). */
- else if (count >= 2
- && prec_ptr[0] == '0'
- && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'))
- prefix_count = 2;
-
- move = count - prefix_count;
- if (precision > move)
- {
- /* Insert zeroes. */
- size_t insert = precision - move;
- TCHAR_T *prec_end;
-
-# if USE_SNPRINTF
- size_t n =
- xsum (length,
- (count + insert + TCHARS_PER_DCHAR - 1)
- / TCHARS_PER_DCHAR);
- length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
- ENSURE_ALLOCATION (n);
- length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
- prec_ptr = (TCHAR_T *) (result + length);
-# endif
-
- prec_end = prec_ptr + count;
- prec_ptr += prefix_count;
-
- while (prec_end > prec_ptr)
- {
- prec_end--;
- prec_end[insert] = prec_end[0];
- }
-
- prec_end += insert;
- do
- *--prec_end = '0';
- while (prec_end > prec_ptr);
-
- count += insert;
- }
- }
-#endif
-
-#if !USE_SNPRINTF
- if (count >= tmp_length)
- /* tmp_length was incorrectly calculated - fix the
- code above! */
- abort ();
-#endif
-
-#if !DCHAR_IS_TCHAR
- /* Convert from TCHAR_T[] to DCHAR_T[]. */
- if (dp->conversion == 'c' || dp->conversion == 's')
- {
- /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING
- TYPE_WIDE_STRING.
- The result string is not certainly ASCII. */
- const TCHAR_T *tmpsrc;
- DCHAR_T *tmpdst;
- size_t tmpdst_len;
- /* This code assumes that TCHAR_T is 'char'. */
- verify (sizeof (TCHAR_T) == 1);
-# if USE_SNPRINTF
- tmpsrc = (TCHAR_T *) (result + length);
-# else
- tmpsrc = tmp;
-# endif
- tmpdst =
- DCHAR_CONV_FROM_ENCODING (locale_charset (),
- iconveh_question_mark,
- tmpsrc, count,
- NULL,
- NULL, &tmpdst_len);
- if (tmpdst == NULL)
- {
- int saved_errno = errno;
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = saved_errno;
- return NULL;
- }
- ENSURE_ALLOCATION (xsum (length, tmpdst_len));
- DCHAR_CPY (result + length, tmpdst, tmpdst_len);
- free (tmpdst);
- count = tmpdst_len;
- }
- else
- {
- /* The result string is ASCII.
- Simple 1:1 conversion. */
-# if USE_SNPRINTF
- /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a
- no-op conversion, in-place on the array starting
- at (result + length). */
- if (sizeof (DCHAR_T) != sizeof (TCHAR_T))
-# endif
- {
- const TCHAR_T *tmpsrc;
- DCHAR_T *tmpdst;
- size_t n;
-
-# if USE_SNPRINTF
- if (result == resultbuf)
- {
- tmpsrc = (TCHAR_T *) (result + length);
- /* ENSURE_ALLOCATION will not move tmpsrc
- (because it's part of resultbuf). */
- ENSURE_ALLOCATION (xsum (length, count));
- }
- else
- {
- /* ENSURE_ALLOCATION will move the array
- (because it uses realloc(). */
- ENSURE_ALLOCATION (xsum (length, count));
- tmpsrc = (TCHAR_T *) (result + length);
- }
-# else
- tmpsrc = tmp;
- ENSURE_ALLOCATION (xsum (length, count));
-# endif
- tmpdst = result + length;
- /* Copy backwards, because of overlapping. */
- tmpsrc += count;
- tmpdst += count;
- for (n = count; n > 0; n--)
- *--tmpdst = *--tmpsrc;
- }
- }
-#endif
-
-#if DCHAR_IS_TCHAR && !USE_SNPRINTF
- /* Make room for the result. */
- if (count > allocated - length)
- {
- /* Need at least count elements. But allocate
- proportionally. */
- size_t n =
- xmax (xsum (length, count), xtimes (allocated, 2));
-
- ENSURE_ALLOCATION (n);
- }
-#endif
-
- /* Here count <= allocated - length. */
-
- /* Perform padding. */
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
- if (pad_ourselves && has_width)
- {
- size_t w;
-# if ENABLE_UNISTDIO
- /* Outside POSIX, it's preferable to compare the width
- against the number of _characters_ of the converted
- value. */
- w = DCHAR_MBSNLEN (result + length, count);
-# else
- /* The width is compared against the number of _bytes_
- of the converted value, says POSIX. */
- w = count;
-# endif
- if (w < width)
- {
- size_t pad = width - w;
-
- /* Make room for the result. */
- if (xsum (count, pad) > allocated - length)
- {
- /* Need at least count + pad elements. But
- allocate proportionally. */
- size_t n =
- xmax (xsum3 (length, count, pad),
- xtimes (allocated, 2));
-
-# if USE_SNPRINTF
- length += count;
- ENSURE_ALLOCATION (n);
- length -= count;
-# else
- ENSURE_ALLOCATION (n);
-# endif
- }
- /* Here count + pad <= allocated - length. */
-
- {
-# if !DCHAR_IS_TCHAR || USE_SNPRINTF
- DCHAR_T * const rp = result + length;
-# else
- DCHAR_T * const rp = tmp;
-# endif
- DCHAR_T *p = rp + count;
- DCHAR_T *end = p + pad;
- DCHAR_T *pad_ptr;
-# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
- if (dp->conversion == 'c'
- || dp->conversion == 's')
- /* No zero-padding for string directives. */
- pad_ptr = NULL;
- else
-# endif
- {
- pad_ptr = (*rp == '-' ? rp + 1 : rp);
- /* No zero-padding of "inf" and "nan". */
- if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z')
- || (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
- pad_ptr = NULL;
- }
- /* The generated string now extends from rp to p,
- with the zero padding insertion point being at
- pad_ptr. */
-
- count = count + pad; /* = end - rp */
-
- if (flags & FLAG_LEFT)
- {
- /* Pad with spaces on the right. */
- for (; pad > 0; pad--)
- *p++ = ' ';
- }
- else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
- {
- /* Pad with zeroes. */
- DCHAR_T *q = end;
-
- while (p > pad_ptr)
- *--q = *--p;
- for (; pad > 0; pad--)
- *p++ = '0';
- }
- else
- {
- /* Pad with spaces on the left. */
- DCHAR_T *q = end;
-
- while (p > rp)
- *--q = *--p;
- for (; pad > 0; pad--)
- *p++ = ' ';
- }
- }
- }
- }
-#endif
-
- /* Here still count <= allocated - length. */
-
-#if !DCHAR_IS_TCHAR || USE_SNPRINTF
- /* The snprintf() result did fit. */
-#else
- /* Append the sprintf() result. */
- memcpy (result + length, tmp, count * sizeof (DCHAR_T));
-#endif
-#if !USE_SNPRINTF
- if (tmp != tmpbuf)
- free (tmp);
-#endif
-
-#if NEED_PRINTF_DIRECTIVE_F
- if (dp->conversion == 'F')
- {
- /* Convert the %f result to upper case for %F. */
- DCHAR_T *rp = result + length;
- size_t rc;
- for (rc = count; rc > 0; rc--, rp++)
- if (*rp >= 'a' && *rp <= 'z')
- *rp = *rp - 'a' + 'A';
- }
-#endif
-
- length += count;
- break;
- }
- errno = orig_errno;
-#undef pad_ourselves
-#undef prec_ourselves
- }
- }
- }
-
- /* Add the final NUL. */
- ENSURE_ALLOCATION (xsum (length, 1));
- result[length] = '\0';
-
- if (result != resultbuf && length + 1 < allocated)
- {
- /* Shrink the allocated memory if possible. */
- DCHAR_T *memory;
-
- memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
- if (memory != NULL)
- result = memory;
- }
-
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- *lengthp = length;
- /* Note that we can produce a big string of a length > INT_MAX. POSIX
- says that snprintf() fails with errno = EOVERFLOW in this case, but
- that's only because snprintf() returns an 'int'. This function does
- not have this limitation. */
- return result;
-
-#if USE_SNPRINTF
- overflow:
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- CLEANUP ();
- errno = EOVERFLOW;
- return NULL;
-#endif
-
- out_of_memory:
- if (!(result == resultbuf || result == NULL))
- free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
- out_of_memory_1:
- CLEANUP ();
- errno = ENOMEM;
- return NULL;
- }
-}
-
-#undef MAX_ROOM_NEEDED
-#undef TCHARS_PER_DCHAR
-#undef SNPRINTF
-#undef USE_SNPRINTF
-#undef DCHAR_SET
-#undef DCHAR_CPY
-#undef PRINTF_PARSE
-#undef DIRECTIVES
-#undef DIRECTIVE
-#undef DCHAR_IS_TCHAR
-#undef TCHAR_T
-#undef DCHAR_T
-#undef FCHAR_T
-#undef VASNPRINTF
diff --git a/src/gl/vasnprintf.h b/src/gl/vasnprintf.h
deleted file mode 100644
index 8e9d84f015..0000000000
--- a/src/gl/vasnprintf.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* vsprintf with automatic memory allocation.
- Copyright (C) 2002-2004, 2007-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _VASNPRINTF_H
-#define _VASNPRINTF_H
-
-/* Get va_list. */
-#include <stdarg.h>
-
-/* Get size_t. */
-#include <stddef.h>
-
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
- The __-protected variants of the attributes 'format' and 'printf' are
- accepted by gcc versions 2.6.4 (effectively 2.7) and later.
- We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
- gnulib and libintl do '#define printf __printf__' when they override
- the 'printf' function. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Write formatted output to a string dynamically allocated with malloc().
- You can pass a preallocated buffer for the result in RESULTBUF and its
- size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
- If successful, return the address of the string (this may be = RESULTBUF
- if no dynamic memory allocation was necessary) and set *LENGTHP to the
- number of resulting bytes, excluding the trailing NUL. Upon error, set
- errno and return NULL.
-
- When dynamic memory allocation occurs, the preallocated buffer is left
- alone (with possibly modified contents). This makes it possible to use
- a statically allocated or stack-allocated buffer, like this:
-
- char buf[100];
- size_t len = sizeof (buf);
- char *output = vasnprintf (buf, &len, format, args);
- if (output == NULL)
- ... error handling ...;
- else
- {
- ... use the output string ...;
- if (output != buf)
- free (output);
- }
- */
-#if REPLACE_VASNPRINTF
-# define asnprintf rpl_asnprintf
-# define vasnprintf rpl_vasnprintf
-#endif
-extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4));
-extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 0));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _VASNPRINTF_H */
diff --git a/src/gl/verify.h b/src/gl/verify.h
deleted file mode 100644
index 5c8381d290..0000000000
--- a/src/gl/verify.h
+++ /dev/null
@@ -1,279 +0,0 @@
-/* Compile-time assert-like macros.
-
- Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
-
-#ifndef _GL_VERIFY_H
-#define _GL_VERIFY_H
-
-
-/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per C11.
- This is supported by GCC 4.6.0 and later, in C mode, and its use
- here generates easier-to-read diagnostics when verify (R) fails.
-
- Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11.
- This will likely be supported by future GCC versions, in C++ mode.
-
- Use this only with GCC. If we were willing to slow 'configure'
- down we could also use it with other compilers, but since this
- affects only the quality of diagnostics, why bother? */
-#if (4 < __GNUC__ + (6 <= __GNUC_MINOR__) \
- && (201112L <= __STDC_VERSION__ || !defined __STRICT_ANSI__) \
- && !defined __cplusplus)
-# define _GL_HAVE__STATIC_ASSERT 1
-#endif
-/* The condition (99 < __GNUC__) is temporary, until we know about the
- first G++ release that supports static_assert. */
-#if (99 < __GNUC__) && defined __cplusplus
-# define _GL_HAVE_STATIC_ASSERT 1
-#endif
-
-/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
- system headers, defines a conflicting _Static_assert that is no
- better than ours; override it. */
-#ifndef _GL_HAVE_STATIC_ASSERT
-# include <stddef.h>
-# undef _Static_assert
-#endif
-
-/* Each of these macros verifies that its argument R is nonzero. To
- be portable, R should be an integer constant expression. Unlike
- assert (R), there is no run-time overhead.
-
- If _Static_assert works, verify (R) uses it directly. Similarly,
- _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct
- that is an operand of sizeof.
-
- The code below uses several ideas for C++ compilers, and for C
- compilers that do not support _Static_assert:
-
- * The first step is ((R) ? 1 : -1). Given an expression R, of
- integral or boolean or floating-point type, this yields an
- expression of integral type, whose value is later verified to be
- constant and nonnegative.
-
- * Next this expression W is wrapped in a type
- struct _gl_verify_type {
- unsigned int _gl_verify_error_if_negative: W;
- }.
- If W is negative, this yields a compile-time error. No compiler can
- deal with a bit-field of negative size.
-
- One might think that an array size check would have the same
- effect, that is, that the type struct { unsigned int dummy[W]; }
- would work as well. However, inside a function, some compilers
- (such as C++ compilers and GNU C) allow local parameters and
- variables inside array size expressions. With these compilers,
- an array size check would not properly diagnose this misuse of
- the verify macro:
-
- void function (int n) { verify (n < 0); }
-
- * For the verify macro, the struct _gl_verify_type will need to
- somehow be embedded into a declaration. To be portable, this
- declaration must declare an object, a constant, a function, or a
- typedef name. If the declared entity uses the type directly,
- such as in
-
- struct dummy {...};
- typedef struct {...} dummy;
- extern struct {...} *dummy;
- extern void dummy (struct {...} *);
- extern struct {...} *dummy (void);
-
- two uses of the verify macro would yield colliding declarations
- if the entity names are not disambiguated. A workaround is to
- attach the current line number to the entity name:
-
- #define _GL_CONCAT0(x, y) x##y
- #define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
- extern struct {...} * _GL_CONCAT (dummy, __LINE__);
-
- But this has the problem that two invocations of verify from
- within the same macro would collide, since the __LINE__ value
- would be the same for both invocations. (The GCC __COUNTER__
- macro solves this problem, but is not portable.)
-
- A solution is to use the sizeof operator. It yields a number,
- getting rid of the identity of the type. Declarations like
-
- extern int dummy [sizeof (struct {...})];
- extern void dummy (int [sizeof (struct {...})]);
- extern int (*dummy (void)) [sizeof (struct {...})];
-
- can be repeated.
-
- * Should the implementation use a named struct or an unnamed struct?
- Which of the following alternatives can be used?
-
- extern int dummy [sizeof (struct {...})];
- extern int dummy [sizeof (struct _gl_verify_type {...})];
- extern void dummy (int [sizeof (struct {...})]);
- extern void dummy (int [sizeof (struct _gl_verify_type {...})]);
- extern int (*dummy (void)) [sizeof (struct {...})];
- extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})];
-
- In the second and sixth case, the struct type is exported to the
- outer scope; two such declarations therefore collide. GCC warns
- about the first, third, and fourth cases. So the only remaining
- possibility is the fifth case:
-
- extern int (*dummy (void)) [sizeof (struct {...})];
-
- * GCC warns about duplicate declarations of the dummy function if
- -Wredundant-decls is used. GCC 4.3 and later have a builtin
- __COUNTER__ macro that can let us generate unique identifiers for
- each dummy function, to suppress this warning.
-
- * This implementation exploits the fact that older versions of GCC,
- which do not support _Static_assert, also do not warn about the
- last declaration mentioned above.
-
- * GCC warns if -Wnested-externs is enabled and verify() is used
- within a function body; but inside a function, you can always
- arrange to use verify_expr() instead.
-
- * In C++, any struct definition inside sizeof is invalid.
- Use a template type to work around the problem. */
-
-/* Concatenate two preprocessor tokens. */
-#define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
-#define _GL_CONCAT0(x, y) x##y
-
-/* _GL_COUNTER is an integer, preferably one that changes each time we
- use it. Use __COUNTER__ if it works, falling back on __LINE__
- otherwise. __LINE__ isn't perfect, but it's better than a
- constant. */
-#if defined __COUNTER__ && __COUNTER__ != __COUNTER__
-# define _GL_COUNTER __COUNTER__
-#else
-# define _GL_COUNTER __LINE__
-#endif
-
-/* Generate a symbol with the given prefix, making it unique if
- possible. */
-#define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
-
-/* Verify requirement R at compile-time, as an integer constant expression
- that returns 1. If R is false, fail at compile-time, preferably
- with a diagnostic that includes the string-literal DIAGNOSTIC. */
-
-#define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \
- (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
-
-#ifdef __cplusplus
-# if !GNULIB_defined_struct__gl_verify_type
-template <int w>
- struct _gl_verify_type {
- unsigned int _gl_verify_error_if_negative: w;
- };
-# define GNULIB_defined_struct__gl_verify_type 1
-# endif
-# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
- _gl_verify_type<(R) ? 1 : -1>
-#elif defined _GL_HAVE__STATIC_ASSERT
-# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
- struct { \
- _Static_assert (R, DIAGNOSTIC); \
- int _gl_dummy; \
- }
-#else
-# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
- struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; }
-#endif
-
-/* Verify requirement R at compile-time, as a declaration without a
- trailing ';'. If R is false, fail at compile-time, preferably
- with a diagnostic that includes the string-literal DIAGNOSTIC.
-
- Unfortunately, unlike C11, this implementation must appear as an
- ordinary declaration, and cannot appear inside struct { ... }. */
-
-#ifdef _GL_HAVE__STATIC_ASSERT
-# define _GL_VERIFY _Static_assert
-#else
-# define _GL_VERIFY(R, DIAGNOSTIC) \
- extern int (*_GL_GENSYM (_gl_verify_function) (void)) \
- [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
-#endif
-
-/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */
-#ifdef _GL_STATIC_ASSERT_H
-# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert
-# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC)
-# endif
-# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert
-# define static_assert _Static_assert /* C11 requires this #define. */
-# endif
-#endif
-
-/* @assert.h omit start@ */
-
-/* Each of these macros verifies that its argument R is nonzero. To
- be portable, R should be an integer constant expression. Unlike
- assert (R), there is no run-time overhead.
-
- There are two macros, since no single macro can be used in all
- contexts in C. verify_true (R) is for scalar contexts, including
- integer constant expression contexts. verify (R) is for declaration
- contexts, e.g., the top level. */
-
-/* Verify requirement R at compile-time, as an integer constant expression.
- Return 1. This is equivalent to verify_expr (R, 1).
-
- verify_true is obsolescent; please use verify_expr instead. */
-
-#define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
-
-/* Verify requirement R at compile-time. Return the value of the
- expression E. */
-
-#define verify_expr(R, E) \
- (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E))
-
-/* Verify requirement R at compile-time, as a declaration without a
- trailing ';'. */
-
-#define verify(R) _GL_VERIFY (R, "verify (" #R ")")
-
-#ifndef __has_builtin
-# define __has_builtin(x) 0
-#endif
-
-/* Assume that R always holds. This lets the compiler optimize
- accordingly. R should not have side-effects; it may or may not be
- evaluated. Behavior is undefined if R is false. */
-
-#if (__has_builtin (__builtin_unreachable) \
- || 4 < __GNUC__ + (5 <= __GNUC_MINOR__))
-# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
-#elif 1200 <= _MSC_VER
-# define assume(R) __assume (R)
-#elif ((defined GCC_LINT || defined lint) \
- && (__has_builtin (__builtin_trap) \
- || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__))))
- /* Doing it this way helps various packages when configured with
- --enable-gcc-warnings, which compiles with -Dlint. It's nicer
- when 'assume' silences warnings even with older GCCs. */
-# define assume(R) ((R) ? (void) 0 : __builtin_trap ())
-#else
-# define assume(R) ((void) (0 && (R)))
-#endif
-
-/* @assert.h omit end@ */
-
-#endif
diff --git a/src/gl/w32sock.h b/src/gl/w32sock.h
deleted file mode 100644
index c78b4bb973..0000000000
--- a/src/gl/w32sock.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* w32sock.h --- internal auxiliary functions for Windows socket functions
-
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <errno.h>
-
-/* Get O_RDWR and O_BINARY. */
-#include <fcntl.h>
-
-/* Get _open_osfhandle(). */
-#include <io.h>
-
-/* Get _get_osfhandle(). */
-#include "msvc-nothrow.h"
-
-#define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd)))
-#define SOCKET_TO_FD(fh) (_open_osfhandle ((intptr_t) (fh), O_RDWR | O_BINARY))
-
-static inline void
-set_winsock_errno (void)
-{
- int err = WSAGetLastError ();
-
- /* Map some WSAE* errors to the runtime library's error codes. */
- switch (err)
- {
- case WSA_INVALID_HANDLE:
- errno = EBADF;
- break;
- case WSA_NOT_ENOUGH_MEMORY:
- errno = ENOMEM;
- break;
- case WSA_INVALID_PARAMETER:
- errno = EINVAL;
- break;
- case WSAENAMETOOLONG:
- errno = ENAMETOOLONG;
- break;
- case WSAENOTEMPTY:
- errno = ENOTEMPTY;
- break;
- case WSAEWOULDBLOCK:
- errno = EWOULDBLOCK;
- break;
- case WSAEINPROGRESS:
- errno = EINPROGRESS;
- break;
- case WSAEALREADY:
- errno = EALREADY;
- break;
- case WSAENOTSOCK:
- errno = ENOTSOCK;
- break;
- case WSAEDESTADDRREQ:
- errno = EDESTADDRREQ;
- break;
- case WSAEMSGSIZE:
- errno = EMSGSIZE;
- break;
- case WSAEPROTOTYPE:
- errno = EPROTOTYPE;
- break;
- case WSAENOPROTOOPT:
- errno = ENOPROTOOPT;
- break;
- case WSAEPROTONOSUPPORT:
- errno = EPROTONOSUPPORT;
- break;
- case WSAEOPNOTSUPP:
- errno = EOPNOTSUPP;
- break;
- case WSAEAFNOSUPPORT:
- errno = EAFNOSUPPORT;
- break;
- case WSAEADDRINUSE:
- errno = EADDRINUSE;
- break;
- case WSAEADDRNOTAVAIL:
- errno = EADDRNOTAVAIL;
- break;
- case WSAENETDOWN:
- errno = ENETDOWN;
- break;
- case WSAENETUNREACH:
- errno = ENETUNREACH;
- break;
- case WSAENETRESET:
- errno = ENETRESET;
- break;
- case WSAECONNABORTED:
- errno = ECONNABORTED;
- break;
- case WSAECONNRESET:
- errno = ECONNRESET;
- break;
- case WSAENOBUFS:
- errno = ENOBUFS;
- break;
- case WSAEISCONN:
- errno = EISCONN;
- break;
- case WSAENOTCONN:
- errno = ENOTCONN;
- break;
- case WSAETIMEDOUT:
- errno = ETIMEDOUT;
- break;
- case WSAECONNREFUSED:
- errno = ECONNREFUSED;
- break;
- case WSAELOOP:
- errno = ELOOP;
- break;
- case WSAEHOSTUNREACH:
- errno = EHOSTUNREACH;
- break;
- default:
- errno = (err > 10000 && err < 10025) ? err - 10000 : err;
- break;
- }
-}
diff --git a/src/gl/wchar.in.h b/src/gl/wchar.in.h
deleted file mode 100644
index 75fb9f0254..0000000000
--- a/src/gl/wchar.in.h
+++ /dev/null
@@ -1,1041 +0,0 @@
-/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
-
- Copyright (C) 2007-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Eric Blake. */
-
-/*
- * ISO C 99 <wchar.h> for platforms that have issues.
- * <http://www.opengroup.org/susv3xbd/wchar.h.html>
- *
- * For now, this just ensures proper prerequisite inclusion order and
- * the declaration of wcwidth().
- */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if (((defined __need_mbstate_t || defined __need_wint_t) \
- && !defined __MINGW32__ && !defined __KLIBC__) \
- || (defined __hpux \
- && ((defined _INTTYPES_INCLUDED && !defined strtoimax) \
- || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \
- || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \
- || defined _GL_ALREADY_INCLUDING_WCHAR_H)
-/* Special invocation convention:
- - Inside glibc and uClibc header files, but not MinGW.
- - On HP-UX 11.00 we have a sequence of nested includes
- <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
- once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
- and once directly. In both situations 'wint_t' is not yet defined,
- therefore we cannot provide the function overrides; instead include only
- the system's <wchar.h>.
- - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of
- <wchar.h> is actually processed, and that doesn't include 'mbstate_t'.
- - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
- the latter includes <wchar.h>. But here, we have no way to detect whether
- <wctype.h> is completely included or is still being included. */
-
-#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
-
-#else
-/* Normal invocation convention. */
-
-#ifndef _@GUARD_PREFIX@_WCHAR_H
-
-#define _GL_ALREADY_INCLUDING_WCHAR_H
-
-#if @HAVE_FEATURES_H@
-# include <features.h> /* for __GLIBC__ */
-#endif
-
-/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
- <wchar.h>.
- BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
- included before <wchar.h>.
- In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
- by <stddef.h>.
- But avoid namespace pollution on glibc systems. */
-#if !(defined __GLIBC__ && !defined __UCLIBC__)
-# include <stddef.h>
-#endif
-#ifndef __GLIBC__
-# include <stdio.h>
-# include <time.h>
-#endif
-
-/* Include the original <wchar.h> if it exists.
- Some builds of uClibc lack it. */
-/* The include_next requires a split double-inclusion guard. */
-#if @HAVE_WCHAR_H@
-# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
-#endif
-
-#undef _GL_ALREADY_INCLUDING_WCHAR_H
-
-#ifndef _@GUARD_PREFIX@_WCHAR_H
-#define _@GUARD_PREFIX@_WCHAR_H
-
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
- The attribute __pure__ was added in gcc 2.96. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define _GL_ATTRIBUTE_PURE /* empty */
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-
-/* Define wint_t and WEOF. (Also done in wctype.in.h.) */
-#if !@HAVE_WINT_T@ && !defined wint_t
-# define wint_t int
-# ifndef WEOF
-# define WEOF -1
-# endif
-#else
-/* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
- This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
- "unchanged by default argument promotions". Override it. */
-# if defined _MSC_VER
-# if !GNULIB_defined_wint_t
-# include <crtdefs.h>
-typedef unsigned int rpl_wint_t;
-# undef wint_t
-# define wint_t rpl_wint_t
-# define GNULIB_defined_wint_t 1
-# endif
-# endif
-# ifndef WEOF
-# define WEOF ((wint_t) -1)
-# endif
-#endif
-
-
-/* Override mbstate_t if it is too small.
- On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
- implementing mbrtowc for encodings like UTF-8. */
-#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
-# if !GNULIB_defined_mbstate_t
-typedef int rpl_mbstate_t;
-# undef mbstate_t
-# define mbstate_t rpl_mbstate_t
-# define GNULIB_defined_mbstate_t 1
-# endif
-#endif
-
-
-/* Convert a single-byte character to a wide character. */
-#if @GNULIB_BTOWC@
-# if @REPLACE_BTOWC@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef btowc
-# define btowc rpl_btowc
-# endif
-_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
-_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
-# else
-# if !@HAVE_BTOWC@
-_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
-# endif
-_GL_CXXALIAS_SYS (btowc, wint_t, (int c));
-# endif
-_GL_CXXALIASWARN (btowc);
-#elif defined GNULIB_POSIXCHECK
-# undef btowc
-# if HAVE_RAW_DECL_BTOWC
-_GL_WARN_ON_USE (btowc, "btowc is unportable - "
- "use gnulib module btowc for portability");
-# endif
-#endif
-
-
-/* Convert a wide character to a single-byte character. */
-#if @GNULIB_WCTOB@
-# if @REPLACE_WCTOB@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef wctob
-# define wctob rpl_wctob
-# endif
-_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
-_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
-# else
-# if !defined wctob && !@HAVE_DECL_WCTOB@
-/* wctob is provided by gnulib, or wctob exists but is not declared. */
-_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
-# endif
-_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
-# endif
-_GL_CXXALIASWARN (wctob);
-#elif defined GNULIB_POSIXCHECK
-# undef wctob
-# if HAVE_RAW_DECL_WCTOB
-_GL_WARN_ON_USE (wctob, "wctob is unportable - "
- "use gnulib module wctob for portability");
-# endif
-#endif
-
-
-/* Test whether *PS is in the initial state. */
-#if @GNULIB_MBSINIT@
-# if @REPLACE_MBSINIT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef mbsinit
-# define mbsinit rpl_mbsinit
-# endif
-_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
-_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
-# else
-# if !@HAVE_MBSINIT@
-_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
-# endif
-_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
-# endif
-_GL_CXXALIASWARN (mbsinit);
-#elif defined GNULIB_POSIXCHECK
-# undef mbsinit
-# if HAVE_RAW_DECL_MBSINIT
-_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
- "use gnulib module mbsinit for portability");
-# endif
-#endif
-
-
-/* Convert a multibyte character to a wide character. */
-#if @GNULIB_MBRTOWC@
-# if @REPLACE_MBRTOWC@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef mbrtowc
-# define mbrtowc rpl_mbrtowc
-# endif
-_GL_FUNCDECL_RPL (mbrtowc, size_t,
- (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
-_GL_CXXALIAS_RPL (mbrtowc, size_t,
- (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
-# else
-# if !@HAVE_MBRTOWC@
-_GL_FUNCDECL_SYS (mbrtowc, size_t,
- (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
-# endif
-_GL_CXXALIAS_SYS (mbrtowc, size_t,
- (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
-# endif
-_GL_CXXALIASWARN (mbrtowc);
-#elif defined GNULIB_POSIXCHECK
-# undef mbrtowc
-# if HAVE_RAW_DECL_MBRTOWC
-_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
- "use gnulib module mbrtowc for portability");
-# endif
-#endif
-
-
-/* Recognize a multibyte character. */
-#if @GNULIB_MBRLEN@
-# if @REPLACE_MBRLEN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef mbrlen
-# define mbrlen rpl_mbrlen
-# endif
-_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
-_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
-# else
-# if !@HAVE_MBRLEN@
-_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
-# endif
-_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
-# endif
-_GL_CXXALIASWARN (mbrlen);
-#elif defined GNULIB_POSIXCHECK
-# undef mbrlen
-# if HAVE_RAW_DECL_MBRLEN
-_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
- "use gnulib module mbrlen for portability");
-# endif
-#endif
-
-
-/* Convert a string to a wide string. */
-#if @GNULIB_MBSRTOWCS@
-# if @REPLACE_MBSRTOWCS@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef mbsrtowcs
-# define mbsrtowcs rpl_mbsrtowcs
-# endif
-_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t len,
- mbstate_t *ps));
-# else
-# if !@HAVE_MBSRTOWCS@
-_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t len,
- mbstate_t *ps));
-# endif
-_GL_CXXALIASWARN (mbsrtowcs);
-#elif defined GNULIB_POSIXCHECK
-# undef mbsrtowcs
-# if HAVE_RAW_DECL_MBSRTOWCS
-_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
- "use gnulib module mbsrtowcs for portability");
-# endif
-#endif
-
-
-/* Convert a string to a wide string. */
-#if @GNULIB_MBSNRTOWCS@
-# if @REPLACE_MBSNRTOWCS@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef mbsnrtowcs
-# define mbsnrtowcs rpl_mbsnrtowcs
-# endif
-_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
- mbstate_t *ps)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
- mbstate_t *ps));
-# else
-# if !@HAVE_MBSNRTOWCS@
-_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
- mbstate_t *ps)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
- mbstate_t *ps));
-# endif
-_GL_CXXALIASWARN (mbsnrtowcs);
-#elif defined GNULIB_POSIXCHECK
-# undef mbsnrtowcs
-# if HAVE_RAW_DECL_MBSNRTOWCS
-_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
- "use gnulib module mbsnrtowcs for portability");
-# endif
-#endif
-
-
-/* Convert a wide character to a multibyte character. */
-#if @GNULIB_WCRTOMB@
-# if @REPLACE_WCRTOMB@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef wcrtomb
-# define wcrtomb rpl_wcrtomb
-# endif
-_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
-_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
-# else
-# if !@HAVE_WCRTOMB@
-_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
-# endif
-_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
-# endif
-_GL_CXXALIASWARN (wcrtomb);
-#elif defined GNULIB_POSIXCHECK
-# undef wcrtomb
-# if HAVE_RAW_DECL_WCRTOMB
-_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
- "use gnulib module wcrtomb for portability");
-# endif
-#endif
-
-
-/* Convert a wide string to a string. */
-#if @GNULIB_WCSRTOMBS@
-# if @REPLACE_WCSRTOMBS@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef wcsrtombs
-# define wcsrtombs rpl_wcsrtombs
-# endif
-_GL_FUNCDECL_RPL (wcsrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (wcsrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t len,
- mbstate_t *ps));
-# else
-# if !@HAVE_WCSRTOMBS@
-_GL_FUNCDECL_SYS (wcsrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (wcsrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t len,
- mbstate_t *ps));
-# endif
-_GL_CXXALIASWARN (wcsrtombs);
-#elif defined GNULIB_POSIXCHECK
-# undef wcsrtombs
-# if HAVE_RAW_DECL_WCSRTOMBS
-_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
- "use gnulib module wcsrtombs for portability");
-# endif
-#endif
-
-
-/* Convert a wide string to a string. */
-#if @GNULIB_WCSNRTOMBS@
-# if @REPLACE_WCSNRTOMBS@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef wcsnrtombs
-# define wcsnrtombs rpl_wcsnrtombs
-# endif
-_GL_FUNCDECL_RPL (wcsnrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
- mbstate_t *ps)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
- mbstate_t *ps));
-# else
-# if !@HAVE_WCSNRTOMBS@
-_GL_FUNCDECL_SYS (wcsnrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
- mbstate_t *ps)
- _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
- mbstate_t *ps));
-# endif
-_GL_CXXALIASWARN (wcsnrtombs);
-#elif defined GNULIB_POSIXCHECK
-# undef wcsnrtombs
-# if HAVE_RAW_DECL_WCSNRTOMBS
-_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
- "use gnulib module wcsnrtombs for portability");
-# endif
-#endif
-
-
-/* Return the number of screen columns needed for WC. */
-#if @GNULIB_WCWIDTH@
-# if @REPLACE_WCWIDTH@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef wcwidth
-# define wcwidth rpl_wcwidth
-# endif
-_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
-_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
-# else
-# if !@HAVE_DECL_WCWIDTH@
-/* wcwidth exists but is not declared. */
-_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
-# elif defined __KLIBC__
-/* On OS/2 kLIBC, wcwidth is a macro that expands to the name of a
- static inline function. The implementation of wcwidth in wcwidth.c
- causes a "conflicting types" error. */
-# undef wcwidth
-# endif
-_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
-# endif
-_GL_CXXALIASWARN (wcwidth);
-#elif defined GNULIB_POSIXCHECK
-# undef wcwidth
-# if HAVE_RAW_DECL_WCWIDTH
-_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
- "use gnulib module wcwidth for portability");
-# endif
-#endif
-
-
-/* Search N wide characters of S for C. */
-#if @GNULIB_WMEMCHR@
-# if !@HAVE_WMEMCHR@
-_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
- _GL_ATTRIBUTE_PURE);
-# endif
- /* On some systems, this function is defined as an overloaded function:
- extern "C++" {
- const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
- wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
- } */
-_GL_CXXALIAS_SYS_CAST2 (wmemchr,
- wchar_t *, (const wchar_t *, wchar_t, size_t),
- const wchar_t *, (const wchar_t *, wchar_t, size_t));
-# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
- && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
-_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
- (const wchar_t *s, wchar_t c, size_t n));
-# else
-_GL_CXXALIASWARN (wmemchr);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef wmemchr
-# if HAVE_RAW_DECL_WMEMCHR
-_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
- "use gnulib module wmemchr for portability");
-# endif
-#endif
-
-
-/* Compare N wide characters of S1 and S2. */
-#if @GNULIB_WMEMCMP@
-# if !@HAVE_WMEMCMP@
-_GL_FUNCDECL_SYS (wmemcmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n)
- _GL_ATTRIBUTE_PURE);
-# endif
-_GL_CXXALIAS_SYS (wmemcmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n));
-_GL_CXXALIASWARN (wmemcmp);
-#elif defined GNULIB_POSIXCHECK
-# undef wmemcmp
-# if HAVE_RAW_DECL_WMEMCMP
-_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
- "use gnulib module wmemcmp for portability");
-# endif
-#endif
-
-
-/* Copy N wide characters of SRC to DEST. */
-#if @GNULIB_WMEMCPY@
-# if !@HAVE_WMEMCPY@
-_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
-# endif
-_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
-_GL_CXXALIASWARN (wmemcpy);
-#elif defined GNULIB_POSIXCHECK
-# undef wmemcpy
-# if HAVE_RAW_DECL_WMEMCPY
-_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
- "use gnulib module wmemcpy for portability");
-# endif
-#endif
-
-
-/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
- overlapping memory areas. */
-#if @GNULIB_WMEMMOVE@
-# if !@HAVE_WMEMMOVE@
-_GL_FUNCDECL_SYS (wmemmove, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
-# endif
-_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
-_GL_CXXALIASWARN (wmemmove);
-#elif defined GNULIB_POSIXCHECK
-# undef wmemmove
-# if HAVE_RAW_DECL_WMEMMOVE
-_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
- "use gnulib module wmemmove for portability");
-# endif
-#endif
-
-
-/* Set N wide characters of S to C. */
-#if @GNULIB_WMEMSET@
-# if !@HAVE_WMEMSET@
-_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
-# endif
-_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
-_GL_CXXALIASWARN (wmemset);
-#elif defined GNULIB_POSIXCHECK
-# undef wmemset
-# if HAVE_RAW_DECL_WMEMSET
-_GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
- "use gnulib module wmemset for portability");
-# endif
-#endif
-
-
-/* Return the number of wide characters in S. */
-#if @GNULIB_WCSLEN@
-# if !@HAVE_WCSLEN@
-_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
-# endif
-_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
-_GL_CXXALIASWARN (wcslen);
-#elif defined GNULIB_POSIXCHECK
-# undef wcslen
-# if HAVE_RAW_DECL_WCSLEN
-_GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
- "use gnulib module wcslen for portability");
-# endif
-#endif
-
-
-/* Return the number of wide characters in S, but at most MAXLEN. */
-#if @GNULIB_WCSNLEN@
-# if !@HAVE_WCSNLEN@
-_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
- _GL_ATTRIBUTE_PURE);
-# endif
-_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
-_GL_CXXALIASWARN (wcsnlen);
-#elif defined GNULIB_POSIXCHECK
-# undef wcsnlen
-# if HAVE_RAW_DECL_WCSNLEN
-_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
- "use gnulib module wcsnlen for portability");
-# endif
-#endif
-
-
-/* Copy SRC to DEST. */
-#if @GNULIB_WCSCPY@
-# if !@HAVE_WCSCPY@
-_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
-# endif
-_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
-_GL_CXXALIASWARN (wcscpy);
-#elif defined GNULIB_POSIXCHECK
-# undef wcscpy
-# if HAVE_RAW_DECL_WCSCPY
-_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
- "use gnulib module wcscpy for portability");
-# endif
-#endif
-
-
-/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
-#if @GNULIB_WCPCPY@
-# if !@HAVE_WCPCPY@
-_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
-# endif
-_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
-_GL_CXXALIASWARN (wcpcpy);
-#elif defined GNULIB_POSIXCHECK
-# undef wcpcpy
-# if HAVE_RAW_DECL_WCPCPY
-_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
- "use gnulib module wcpcpy for portability");
-# endif
-#endif
-
-
-/* Copy no more than N wide characters of SRC to DEST. */
-#if @GNULIB_WCSNCPY@
-# if !@HAVE_WCSNCPY@
-_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
-# endif
-_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
-_GL_CXXALIASWARN (wcsncpy);
-#elif defined GNULIB_POSIXCHECK
-# undef wcsncpy
-# if HAVE_RAW_DECL_WCSNCPY
-_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
- "use gnulib module wcsncpy for portability");
-# endif
-#endif
-
-
-/* Copy no more than N characters of SRC to DEST, returning the address of
- the last character written into DEST. */
-#if @GNULIB_WCPNCPY@
-# if !@HAVE_WCPNCPY@
-_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
-# endif
-_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
-_GL_CXXALIASWARN (wcpncpy);
-#elif defined GNULIB_POSIXCHECK
-# undef wcpncpy
-# if HAVE_RAW_DECL_WCPNCPY
-_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
- "use gnulib module wcpncpy for portability");
-# endif
-#endif
-
-
-/* Append SRC onto DEST. */
-#if @GNULIB_WCSCAT@
-# if !@HAVE_WCSCAT@
-_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
-# endif
-_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
-_GL_CXXALIASWARN (wcscat);
-#elif defined GNULIB_POSIXCHECK
-# undef wcscat
-# if HAVE_RAW_DECL_WCSCAT
-_GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
- "use gnulib module wcscat for portability");
-# endif
-#endif
-
-
-/* Append no more than N wide characters of SRC onto DEST. */
-#if @GNULIB_WCSNCAT@
-# if !@HAVE_WCSNCAT@
-_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
-# endif
-_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
-_GL_CXXALIASWARN (wcsncat);
-#elif defined GNULIB_POSIXCHECK
-# undef wcsncat
-# if HAVE_RAW_DECL_WCSNCAT
-_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
- "use gnulib module wcsncat for portability");
-# endif
-#endif
-
-
-/* Compare S1 and S2. */
-#if @GNULIB_WCSCMP@
-# if !@HAVE_WCSCMP@
-_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
- _GL_ATTRIBUTE_PURE);
-# endif
-_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
-_GL_CXXALIASWARN (wcscmp);
-#elif defined GNULIB_POSIXCHECK
-# undef wcscmp
-# if HAVE_RAW_DECL_WCSCMP
-_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
- "use gnulib module wcscmp for portability");
-# endif
-#endif
-
-
-/* Compare no more than N wide characters of S1 and S2. */
-#if @GNULIB_WCSNCMP@
-# if !@HAVE_WCSNCMP@
-_GL_FUNCDECL_SYS (wcsncmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n)
- _GL_ATTRIBUTE_PURE);
-# endif
-_GL_CXXALIAS_SYS (wcsncmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n));
-_GL_CXXALIASWARN (wcsncmp);
-#elif defined GNULIB_POSIXCHECK
-# undef wcsncmp
-# if HAVE_RAW_DECL_WCSNCMP
-_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
- "use gnulib module wcsncmp for portability");
-# endif
-#endif
-
-
-/* Compare S1 and S2, ignoring case. */
-#if @GNULIB_WCSCASECMP@
-# if !@HAVE_WCSCASECMP@
-_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)
- _GL_ATTRIBUTE_PURE);
-# endif
-_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
-_GL_CXXALIASWARN (wcscasecmp);
-#elif defined GNULIB_POSIXCHECK
-# undef wcscasecmp
-# if HAVE_RAW_DECL_WCSCASECMP
-_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
- "use gnulib module wcscasecmp for portability");
-# endif
-#endif
-
-
-/* Compare no more than N chars of S1 and S2, ignoring case. */
-#if @GNULIB_WCSNCASECMP@
-# if !@HAVE_WCSNCASECMP@
-_GL_FUNCDECL_SYS (wcsncasecmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n)
- _GL_ATTRIBUTE_PURE);
-# endif
-_GL_CXXALIAS_SYS (wcsncasecmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n));
-_GL_CXXALIASWARN (wcsncasecmp);
-#elif defined GNULIB_POSIXCHECK
-# undef wcsncasecmp
-# if HAVE_RAW_DECL_WCSNCASECMP
-_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
- "use gnulib module wcsncasecmp for portability");
-# endif
-#endif
-
-
-/* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
- category of the current locale. */
-#if @GNULIB_WCSCOLL@
-# if !@HAVE_WCSCOLL@
-_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
-# endif
-_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
-_GL_CXXALIASWARN (wcscoll);
-#elif defined GNULIB_POSIXCHECK
-# undef wcscoll
-# if HAVE_RAW_DECL_WCSCOLL
-_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
- "use gnulib module wcscoll for portability");
-# endif
-#endif
-
-
-/* Transform S2 into array pointed to by S1 such that if wcscmp is applied
- to two transformed strings the result is the as applying 'wcscoll' to the
- original strings. */
-#if @GNULIB_WCSXFRM@
-# if !@HAVE_WCSXFRM@
-_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
-# endif
-_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
-_GL_CXXALIASWARN (wcsxfrm);
-#elif defined GNULIB_POSIXCHECK
-# undef wcsxfrm
-# if HAVE_RAW_DECL_WCSXFRM
-_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
- "use gnulib module wcsxfrm for portability");
-# endif
-#endif
-
-
-/* Duplicate S, returning an identical malloc'd string. */
-#if @GNULIB_WCSDUP@
-# if !@HAVE_WCSDUP@
-_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
-# endif
-_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
-_GL_CXXALIASWARN (wcsdup);
-#elif defined GNULIB_POSIXCHECK
-# undef wcsdup
-# if HAVE_RAW_DECL_WCSDUP
-_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
- "use gnulib module wcsdup for portability");
-# endif
-#endif
-
-
-/* Find the first occurrence of WC in WCS. */
-#if @GNULIB_WCSCHR@
-# if !@HAVE_WCSCHR@
-_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
- _GL_ATTRIBUTE_PURE);
-# endif
- /* On some systems, this function is defined as an overloaded function:
- extern "C++" {
- const wchar_t * std::wcschr (const wchar_t *, wchar_t);
- wchar_t * std::wcschr (wchar_t *, wchar_t);
- } */
-_GL_CXXALIAS_SYS_CAST2 (wcschr,
- wchar_t *, (const wchar_t *, wchar_t),
- const wchar_t *, (const wchar_t *, wchar_t));
-# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
- && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
-_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
-# else
-_GL_CXXALIASWARN (wcschr);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef wcschr
-# if HAVE_RAW_DECL_WCSCHR
-_GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
- "use gnulib module wcschr for portability");
-# endif
-#endif
-
-
-/* Find the last occurrence of WC in WCS. */
-#if @GNULIB_WCSRCHR@
-# if !@HAVE_WCSRCHR@
-_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
- _GL_ATTRIBUTE_PURE);
-# endif
- /* On some systems, this function is defined as an overloaded function:
- extern "C++" {
- const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
- wchar_t * std::wcsrchr (wchar_t *, wchar_t);
- } */
-_GL_CXXALIAS_SYS_CAST2 (wcsrchr,
- wchar_t *, (const wchar_t *, wchar_t),
- const wchar_t *, (const wchar_t *, wchar_t));
-# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
- && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
-_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
-# else
-_GL_CXXALIASWARN (wcsrchr);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef wcsrchr
-# if HAVE_RAW_DECL_WCSRCHR
-_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
- "use gnulib module wcsrchr for portability");
-# endif
-#endif
-
-
-/* Return the length of the initial segmet of WCS which consists entirely
- of wide characters not in REJECT. */
-#if @GNULIB_WCSCSPN@
-# if !@HAVE_WCSCSPN@
-_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
- _GL_ATTRIBUTE_PURE);
-# endif
-_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
-_GL_CXXALIASWARN (wcscspn);
-#elif defined GNULIB_POSIXCHECK
-# undef wcscspn
-# if HAVE_RAW_DECL_WCSCSPN
-_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
- "use gnulib module wcscspn for portability");
-# endif
-#endif
-
-
-/* Return the length of the initial segmet of WCS which consists entirely
- of wide characters in ACCEPT. */
-#if @GNULIB_WCSSPN@
-# if !@HAVE_WCSSPN@
-_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
- _GL_ATTRIBUTE_PURE);
-# endif
-_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
-_GL_CXXALIASWARN (wcsspn);
-#elif defined GNULIB_POSIXCHECK
-# undef wcsspn
-# if HAVE_RAW_DECL_WCSSPN
-_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
- "use gnulib module wcsspn for portability");
-# endif
-#endif
-
-
-/* Find the first occurrence in WCS of any character in ACCEPT. */
-#if @GNULIB_WCSPBRK@
-# if !@HAVE_WCSPBRK@
-_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
- (const wchar_t *wcs, const wchar_t *accept)
- _GL_ATTRIBUTE_PURE);
-# endif
- /* On some systems, this function is defined as an overloaded function:
- extern "C++" {
- const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
- wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
- } */
-_GL_CXXALIAS_SYS_CAST2 (wcspbrk,
- wchar_t *, (const wchar_t *, const wchar_t *),
- const wchar_t *, (const wchar_t *, const wchar_t *));
-# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
- && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-_GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
- (wchar_t *wcs, const wchar_t *accept));
-_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
- (const wchar_t *wcs, const wchar_t *accept));
-# else
-_GL_CXXALIASWARN (wcspbrk);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef wcspbrk
-# if HAVE_RAW_DECL_WCSPBRK
-_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
- "use gnulib module wcspbrk for portability");
-# endif
-#endif
-
-
-/* Find the first occurrence of NEEDLE in HAYSTACK. */
-#if @GNULIB_WCSSTR@
-# if !@HAVE_WCSSTR@
-_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
- (const wchar_t *haystack, const wchar_t *needle)
- _GL_ATTRIBUTE_PURE);
-# endif
- /* On some systems, this function is defined as an overloaded function:
- extern "C++" {
- const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
- wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
- } */
-_GL_CXXALIAS_SYS_CAST2 (wcsstr,
- wchar_t *, (const wchar_t *, const wchar_t *),
- const wchar_t *, (const wchar_t *, const wchar_t *));
-# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
- && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
- (wchar_t *haystack, const wchar_t *needle));
-_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
- (const wchar_t *haystack, const wchar_t *needle));
-# else
-_GL_CXXALIASWARN (wcsstr);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef wcsstr
-# if HAVE_RAW_DECL_WCSSTR
-_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
- "use gnulib module wcsstr for portability");
-# endif
-#endif
-
-
-/* Divide WCS into tokens separated by characters in DELIM. */
-#if @GNULIB_WCSTOK@
-# if !@HAVE_WCSTOK@
-_GL_FUNCDECL_SYS (wcstok, wchar_t *,
- (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
-# endif
-_GL_CXXALIAS_SYS (wcstok, wchar_t *,
- (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
-_GL_CXXALIASWARN (wcstok);
-#elif defined GNULIB_POSIXCHECK
-# undef wcstok
-# if HAVE_RAW_DECL_WCSTOK
-_GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
- "use gnulib module wcstok for portability");
-# endif
-#endif
-
-
-/* Determine number of column positions required for first N wide
- characters (or fewer if S ends before this) in S. */
-#if @GNULIB_WCSWIDTH@
-# if @REPLACE_WCSWIDTH@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef wcswidth
-# define wcswidth rpl_wcswidth
-# endif
-_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)
- _GL_ATTRIBUTE_PURE);
-_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
-# else
-# if !@HAVE_WCSWIDTH@
-_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
- _GL_ATTRIBUTE_PURE);
-# endif
-_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
-# endif
-_GL_CXXALIASWARN (wcswidth);
-#elif defined GNULIB_POSIXCHECK
-# undef wcswidth
-# if HAVE_RAW_DECL_WCSWIDTH
-_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
- "use gnulib module wcswidth for portability");
-# endif
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_WCHAR_H */
-#endif /* _@GUARD_PREFIX@_WCHAR_H */
-#endif
diff --git a/src/gl/xalloc-die.c b/src/gl/xalloc-die.c
deleted file mode 100644
index 4c7994bf1e..0000000000
--- a/src/gl/xalloc-die.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Report a memory allocation failure and exit.
-
- Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2016 Free Software
- Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include "xalloc.h"
-
-#include <stdlib.h>
-
-#include "error.h"
-#include "exitfail.h"
-
-#include "gettext.h"
-#define _(msgid) gettext (msgid)
-
-void
-xalloc_die (void)
-{
- error (exit_failure, 0, "%s", _("memory exhausted"));
-
- /* _Noreturn cannot be given to error, since it may return if
- its first argument is 0. To help compilers understand the
- xalloc_die does not return, call abort. Also, the abort is a
- safety feature if exit_failure is 0 (which shouldn't happen). */
- abort ();
-}
diff --git a/src/gl/xalloc-oversized.h b/src/gl/xalloc-oversized.h
deleted file mode 100644
index 53e6556c61..0000000000
--- a/src/gl/xalloc-oversized.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* xalloc-oversized.h -- memory allocation size checking
-
- Copyright (C) 1990-2000, 2003-2004, 2006-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef XALLOC_OVERSIZED_H_
-#define XALLOC_OVERSIZED_H_
-
-#include <stddef.h>
-
-/* Default for (non-Clang) compilers that lack __has_builtin. */
-#ifndef __has_builtin
-# define __has_builtin(x) 0
-#endif
-
-/* True if N * S would overflow in a size calculation.
- This expands to a constant expression if N and S are both constants.
- By gnulib convention, SIZE_MAX represents overflow in size
- calculations, so the conservative dividend to use here is
- SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value.
- However, malloc (SIZE_MAX) fails on all known hosts where
- sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for
- exactly-SIZE_MAX allocations on such hosts; this avoids a test and
- branch when S is known to be 1. */
-#define __xalloc_oversized(n, s) \
- ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
-
-
-/* Return 1 if an array of N objects, each of size S, cannot exist due
- to size arithmetic overflow. S must be positive and N must be
- nonnegative. This is a macro, not a function, so that it
- works correctly even when SIZE_MAX < N. */
-
-#if 7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)
-# define xalloc_oversized(n, s) __builtin_mul_overflow_p (n, s, (size_t) 1)
-#elif ((5 <= __GNUC__ \
- || (__has_builtin (__builtin_mul_overflow) \
- && __has_builtin (__builtin_constant_p))) \
- && !__STRICT_ANSI__)
-# define xalloc_oversized(n, s) \
- (__builtin_constant_p (n) && __builtin_constant_p (s) \
- ? __xalloc_oversized (n, s) \
- : ({ size_t __xalloc_size; __builtin_mul_overflow (n, s, &__xalloc_size); }))
-
-/* Other compilers use integer division; this may be slower but is
- more portable. */
-#else
-# define xalloc_oversized(n, s) __xalloc_oversized (n, s)
-#endif
-
-#endif /* !XALLOC_OVERSIZED_H_ */
diff --git a/src/gl/xalloc.h b/src/gl/xalloc.h
deleted file mode 100644
index a4fddbfb5b..0000000000
--- a/src/gl/xalloc.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/* xalloc.h -- malloc with out-of-memory checking
-
- Copyright (C) 1990-2000, 2003-2004, 2006-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef XALLOC_H_
-#define XALLOC_H_
-
-#include <stddef.h>
-
-#include "xalloc-oversized.h"
-
-#ifndef _GL_INLINE_HEADER_BEGIN
- #error "Please include config.h first."
-#endif
-_GL_INLINE_HEADER_BEGIN
-#ifndef XALLOC_INLINE
-# define XALLOC_INLINE _GL_INLINE
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#if __GNUC__ >= 3
-# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
-#else
-# define _GL_ATTRIBUTE_MALLOC
-#endif
-
-#if ! defined __clang__ && \
- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
-# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
-#else
-# define _GL_ATTRIBUTE_ALLOC_SIZE(args)
-#endif
-
-/* This function is always triggered when memory is exhausted.
- It must be defined by the application, either explicitly
- or by using gnulib's xalloc-die module. This is the
- function to call when one wants the program to die because of a
- memory allocation failure. */
-extern _Noreturn void xalloc_die (void);
-
-void *xmalloc (size_t s)
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1));
-void *xzalloc (size_t s)
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1));
-void *xcalloc (size_t n, size_t s)
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2));
-void *xrealloc (void *p, size_t s)
- _GL_ATTRIBUTE_ALLOC_SIZE ((2));
-void *x2realloc (void *p, size_t *pn);
-void *xmemdup (void const *p, size_t s)
- _GL_ATTRIBUTE_ALLOC_SIZE ((2));
-char *xstrdup (char const *str)
- _GL_ATTRIBUTE_MALLOC;
-
-/* In the following macros, T must be an elementary or structure/union or
- typedef'ed type, or a pointer to such a type. To apply one of the
- following macros to a function pointer or array type, you need to typedef
- it first and use the typedef name. */
-
-/* Allocate an object of type T dynamically, with error checking. */
-/* extern t *XMALLOC (typename t); */
-#define XMALLOC(t) ((t *) xmalloc (sizeof (t)))
-
-/* Allocate memory for N elements of type T, with error checking. */
-/* extern t *XNMALLOC (size_t n, typename t); */
-#define XNMALLOC(n, t) \
- ((t *) (sizeof (t) == 1 ? xmalloc (n) : xnmalloc (n, sizeof (t))))
-
-/* Allocate an object of type T dynamically, with error checking,
- and zero it. */
-/* extern t *XZALLOC (typename t); */
-#define XZALLOC(t) ((t *) xzalloc (sizeof (t)))
-
-/* Allocate memory for N elements of type T, with error checking,
- and zero it. */
-/* extern t *XCALLOC (size_t n, typename t); */
-#define XCALLOC(n, t) \
- ((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t))))
-
-
-/* Allocate an array of N objects, each with S bytes of memory,
- dynamically, with error checking. S must be nonzero. */
-
-XALLOC_INLINE void *xnmalloc (size_t n, size_t s)
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2));
-XALLOC_INLINE void *
-xnmalloc (size_t n, size_t s)
-{
- if (xalloc_oversized (n, s))
- xalloc_die ();
- return xmalloc (n * s);
-}
-
-/* Change the size of an allocated block of memory P to an array of N
- objects each of S bytes, with error checking. S must be nonzero. */
-
-XALLOC_INLINE void *xnrealloc (void *p, size_t n, size_t s)
- _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3));
-XALLOC_INLINE void *
-xnrealloc (void *p, size_t n, size_t s)
-{
- if (xalloc_oversized (n, s))
- xalloc_die ();
- return xrealloc (p, n * s);
-}
-
-/* If P is null, allocate a block of at least *PN such objects;
- otherwise, reallocate P so that it contains more than *PN objects
- each of S bytes. S must be nonzero. Set *PN to the new number of
- objects, and return the pointer to the new block. *PN is never set
- to zero, and the returned pointer is never null.
-
- Repeated reallocations are guaranteed to make progress, either by
- allocating an initial block with a nonzero size, or by allocating a
- larger block.
-
- In the following implementation, nonzero sizes are increased by a
- factor of approximately 1.5 so that repeated reallocations have
- O(N) overall cost rather than O(N**2) cost, but the
- specification for this function does not guarantee that rate.
-
- Here is an example of use:
-
- int *p = NULL;
- size_t used = 0;
- size_t allocated = 0;
-
- void
- append_int (int value)
- {
- if (used == allocated)
- p = x2nrealloc (p, &allocated, sizeof *p);
- p[used++] = value;
- }
-
- This causes x2nrealloc to allocate a block of some nonzero size the
- first time it is called.
-
- To have finer-grained control over the initial size, set *PN to a
- nonzero value before calling this function with P == NULL. For
- example:
-
- int *p = NULL;
- size_t used = 0;
- size_t allocated = 0;
- size_t allocated1 = 1000;
-
- void
- append_int (int value)
- {
- if (used == allocated)
- {
- p = x2nrealloc (p, &allocated1, sizeof *p);
- allocated = allocated1;
- }
- p[used++] = value;
- }
-
- */
-
-XALLOC_INLINE void *
-x2nrealloc (void *p, size_t *pn, size_t s)
-{
- size_t n = *pn;
-
- if (! p)
- {
- if (! n)
- {
- /* The approximate size to use for initial small allocation
- requests, when the invoking code specifies an old size of
- zero. This is the largest "small" request for the GNU C
- library malloc. */
- enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 };
-
- n = DEFAULT_MXFAST / s;
- n += !n;
- }
- }
- else
- {
- /* Set N = floor (1.5 * N) + 1 so that progress is made even if N == 0.
- Check for overflow, so that N * S stays in size_t range.
- The check may be slightly conservative, but an exact check isn't
- worth the trouble. */
- if ((size_t) -1 / 3 * 2 / s <= n)
- xalloc_die ();
- n += n / 2 + 1;
- }
-
- *pn = n;
- return xrealloc (p, n * s);
-}
-
-/* Return a pointer to a new buffer of N bytes. This is like xmalloc,
- except it returns char *. */
-
-XALLOC_INLINE char *xcharalloc (size_t n)
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1));
-XALLOC_INLINE char *
-xcharalloc (size_t n)
-{
- return XNMALLOC (n, char);
-}
-
-#ifdef __cplusplus
-}
-
-/* C++ does not allow conversions from void * to other pointer types
- without a cast. Use templates to work around the problem when
- possible. */
-
-template <typename T> inline T *
-xrealloc (T *p, size_t s)
-{
- return (T *) xrealloc ((void *) p, s);
-}
-
-template <typename T> inline T *
-xnrealloc (T *p, size_t n, size_t s)
-{
- return (T *) xnrealloc ((void *) p, n, s);
-}
-
-template <typename T> inline T *
-x2realloc (T *p, size_t *pn)
-{
- return (T *) x2realloc ((void *) p, pn);
-}
-
-template <typename T> inline T *
-x2nrealloc (T *p, size_t *pn, size_t s)
-{
- return (T *) x2nrealloc ((void *) p, pn, s);
-}
-
-template <typename T> inline T *
-xmemdup (T const *p, size_t s)
-{
- return (T *) xmemdup ((void const *) p, s);
-}
-
-#endif
-
-_GL_INLINE_HEADER_END
-
-#endif /* !XALLOC_H_ */
diff --git a/src/gl/xmalloc.c b/src/gl/xmalloc.c
deleted file mode 100644
index 429b50d994..0000000000
--- a/src/gl/xmalloc.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* xmalloc.c -- malloc with out of memory checking
-
- Copyright (C) 1990-2000, 2002-2006, 2008-2016 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#define XALLOC_INLINE _GL_EXTERN_INLINE
-
-#include "xalloc.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-/* 1 if calloc is known to be compatible with GNU calloc. This
- matters if we are not also using the calloc module, which defines
- HAVE_CALLOC_GNU and supports the GNU API even on non-GNU platforms. */
-#if defined HAVE_CALLOC_GNU || (defined __GLIBC__ && !defined __UCLIBC__)
-enum { HAVE_GNU_CALLOC = 1 };
-#else
-enum { HAVE_GNU_CALLOC = 0 };
-#endif
-
-/* Allocate N bytes of memory dynamically, with error checking. */
-
-void *
-xmalloc (size_t n)
-{
- void *p = malloc (n);
- if (!p && n != 0)
- xalloc_die ();
- return p;
-}
-
-/* Change the size of an allocated block of memory P to N bytes,
- with error checking. */
-
-void *
-xrealloc (void *p, size_t n)
-{
- if (!n && p)
- {
- /* The GNU and C99 realloc behaviors disagree here. Act like
- GNU, even if the underlying realloc is C99. */
- free (p);
- return NULL;
- }
-
- p = realloc (p, n);
- if (!p && n)
- xalloc_die ();
- return p;
-}
-
-/* If P is null, allocate a block of at least *PN bytes; otherwise,
- reallocate P so that it contains more than *PN bytes. *PN must be
- nonzero unless P is null. Set *PN to the new block's size, and
- return the pointer to the new block. *PN is never set to zero, and
- the returned pointer is never null. */
-
-void *
-x2realloc (void *p, size_t *pn)
-{
- return x2nrealloc (p, pn, 1);
-}
-
-/* Allocate S bytes of zeroed memory dynamically, with error checking.
- There's no need for xnzalloc (N, S), since it would be equivalent
- to xcalloc (N, S). */
-
-void *
-xzalloc (size_t s)
-{
- return memset (xmalloc (s), 0, s);
-}
-
-/* Allocate zeroed memory for N elements of S bytes, with error
- checking. S must be nonzero. */
-
-void *
-xcalloc (size_t n, size_t s)
-{
- void *p;
- /* Test for overflow, since some calloc implementations don't have
- proper overflow checks. But omit overflow and size-zero tests if
- HAVE_GNU_CALLOC, since GNU calloc catches overflow and never
- returns NULL if successful. */
- if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s))
- || (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0)))
- xalloc_die ();
- return p;
-}
-
-/* Clone an object P of size S, with error checking. There's no need
- for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any
- need for an arithmetic overflow check. */
-
-void *
-xmemdup (void const *p, size_t s)
-{
- return memcpy (xmalloc (s), p, s);
-}
-
-/* Clone STRING. */
-
-char *
-xstrdup (char const *string)
-{
- return xmemdup (string, strlen (string) + 1);
-}
diff --git a/src/gl/xsize.c b/src/gl/xsize.c
deleted file mode 100644
index 4b4914c2ca..0000000000
--- a/src/gl/xsize.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <config.h>
-#define XSIZE_INLINE _GL_EXTERN_INLINE
-#include "xsize.h"
diff --git a/src/gl/xsize.h b/src/gl/xsize.h
deleted file mode 100644
index 202a87e086..0000000000
--- a/src/gl/xsize.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* xsize.h -- Checked size_t computations.
-
- Copyright (C) 2003, 2008-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _XSIZE_H
-#define _XSIZE_H
-
-/* Get size_t. */
-#include <stddef.h>
-
-/* Get SIZE_MAX. */
-#include <limits.h>
-#if HAVE_STDINT_H
-# include <stdint.h>
-#endif
-
-#ifndef _GL_INLINE_HEADER_BEGIN
- #error "Please include config.h first."
-#endif
-_GL_INLINE_HEADER_BEGIN
-#ifndef XSIZE_INLINE
-# define XSIZE_INLINE _GL_INLINE
-#endif
-
-/* The size of memory objects is often computed through expressions of
- type size_t. Example:
- void* p = malloc (header_size + n * element_size).
- These computations can lead to overflow. When this happens, malloc()
- returns a piece of memory that is way too small, and the program then
- crashes while attempting to fill the memory.
- To avoid this, the functions and macros in this file check for overflow.
- The convention is that SIZE_MAX represents overflow.
- malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc
- implementation that uses mmap --, it's recommended to use size_overflow_p()
- or size_in_bounds_p() before invoking malloc().
- The example thus becomes:
- size_t size = xsum (header_size, xtimes (n, element_size));
- void *p = (size_in_bounds_p (size) ? malloc (size) : NULL);
-*/
-
-/* Convert an arbitrary value >= 0 to type size_t. */
-#define xcast_size_t(N) \
- ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
-
-/* Sum of two sizes, with overflow check. */
-XSIZE_INLINE size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
-xsum (size_t size1, size_t size2)
-{
- size_t sum = size1 + size2;
- return (sum >= size1 ? sum : SIZE_MAX);
-}
-
-/* Sum of three sizes, with overflow check. */
-XSIZE_INLINE size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
-xsum3 (size_t size1, size_t size2, size_t size3)
-{
- return xsum (xsum (size1, size2), size3);
-}
-
-/* Sum of four sizes, with overflow check. */
-XSIZE_INLINE size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
-xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
-{
- return xsum (xsum (xsum (size1, size2), size3), size4);
-}
-
-/* Maximum of two sizes, with overflow check. */
-XSIZE_INLINE size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
-xmax (size_t size1, size_t size2)
-{
- /* No explicit check is needed here, because for any n:
- max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */
- return (size1 >= size2 ? size1 : size2);
-}
-
-/* Multiplication of a count with an element size, with overflow check.
- The count must be >= 0 and the element size must be > 0.
- This is a macro, not a function, so that it works correctly even
- when N is of a wider type and N > SIZE_MAX. */
-#define xtimes(N, ELSIZE) \
- ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX)
-
-/* Check for overflow. */
-#define size_overflow_p(SIZE) \
- ((SIZE) == SIZE_MAX)
-/* Check against overflow. */
-#define size_in_bounds_p(SIZE) \
- ((SIZE) != SIZE_MAX)
-
-_GL_INLINE_HEADER_END
-
-#endif /* _XSIZE_H */