mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Remove use of gnulib (part 1)
* gl/: Remove entire tree. * configure.ac: Remove gnulib tests and the gl/ Makefile. (setenv): Add to AC_CHECK_FUNCS. * autogen.rc (extra_aclocal_flags): Set to empty. * Makefile.am (ACLOCAL_AMFLAGS): Remove -I gl/m4 (SUBDIRS): Remove gl/. * agent/Makefile.am (common_libs): Remove ../gl/gnulib.a * common/Makefile.am (t_common_ldadd): Ditto. * dirmngr/Makefile.am (dirmngr_LDADD): Ditto. (dirmngr_ldap_LDADD, dirmngr_client_LDADD): Ditto. * g10/Makefile.am (needed_libs): Ditto. * g13/Makefile.am (g13_LDADD): Ditto. * kbx/Makefile.am (kbxutil_LDADD): Ditto. ($(PROGRAMS)): Ditto. * scd/Makefile.am (scdaemon_LDADD): Ditto. * sm/Makefile.am (common_libs): Ditto. * tools/Makefile.am (common_libs, commonpth_libs): Ditto. * agent/gpg-agent.c: Remove "mkdtemp.h" * g10/exec.c: Ditto. * scd/scdaemon.c: Ditto. * tools/symcryptrun.c: Ditto. * common/sysutils.c: Remove "setenv.h" * common/t-timestuff.c: Use putenv if setenv is not available. -- gnulib has always been a cause of trouble in GnuPG because we used only a very few functions and the complex include machinery of gnulib is quite complex and the cause for many build problems for example on OS X. This is not gnulib's fault but due to our limited use of gnulib and that we only rarely update the gnulib code to avoid regressions. In part two we will address the functions mkdtemp setenv unsetenv strpbrk which may bot be implemented on all platforms. They are not required on a libc based system. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
7362c8c6e6
commit
1adf719b2d
@ -18,7 +18,7 @@
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4 -I gl/m4
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-symcryptrun --enable-mailto --enable-gpgtar
|
||||
|
||||
GITLOG_TO_CHANGELOG=gitlog-to-changelog
|
||||
@ -99,7 +99,7 @@ else
|
||||
tests =
|
||||
endif
|
||||
|
||||
SUBDIRS = m4 gl common ${kbx} \
|
||||
SUBDIRS = m4 common ${kbx} \
|
||||
${gpg} ${sm} ${agent} ${scd} ${g13} ${dirmngr} \
|
||||
${tools} po ${doc} ${tests}
|
||||
|
||||
|
@ -55,8 +55,8 @@ gpg_agent_SOURCES = \
|
||||
call-scd.c \
|
||||
learncard.c
|
||||
|
||||
common_libs = $(libcommon) ../gl/libgnu.a
|
||||
commonpth_libs = $(libcommonpth) ../gl/libgnu.a
|
||||
common_libs = $(libcommon)
|
||||
commonpth_libs = $(libcommonpth)
|
||||
if HAVE_W32CE_SYSTEM
|
||||
pwquery_libs =
|
||||
else
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include <assuan.h> /* Malloc hooks and socket wrappers. */
|
||||
|
||||
#include "i18n.h"
|
||||
#include "mkdtemp.h" /* Gnulib replacement. */
|
||||
#include "sysutils.h"
|
||||
#include "gc-opt-flags.h"
|
||||
#include "exechelp.h"
|
||||
|
@ -40,6 +40,6 @@ case "$myhost" in
|
||||
esac
|
||||
|
||||
|
||||
extra_aclocal_flags="-I gl/m4"
|
||||
extra_aclocal_flags=""
|
||||
|
||||
final_info="./configure --sysconfdir=/etc --enable-maintainer-mode && make"
|
||||
|
@ -191,7 +191,7 @@ endif
|
||||
|
||||
t_common_cflags = $(KSBA_CFLAGS) $(LIBGCRYPT_CFLAGS) \
|
||||
$(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS)
|
||||
t_common_ldadd = libcommon.a ../gl/libgnu.a \
|
||||
t_common_ldadd = libcommon.a \
|
||||
$(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
|
||||
$(LIBINTL) $(LIBICONV)
|
||||
|
||||
|
@ -69,8 +69,6 @@
|
||||
|
||||
#include <assuan.h>
|
||||
|
||||
#include "setenv.h" /* Gnulib replacement. */
|
||||
|
||||
#include "util.h"
|
||||
#include "i18n.h"
|
||||
|
||||
|
@ -158,7 +158,11 @@ main (int argc, char **argv)
|
||||
UTC in this case so that the 20380118T235959 test does not fail
|
||||
for other timezones. */
|
||||
#ifndef HAVE_TIMEGM
|
||||
# ifdef HAVE_SETENV
|
||||
setenv ("TZ", "UTC", 1);
|
||||
#else
|
||||
putenv (xstrdup ("TZ=UTC"));
|
||||
#endif
|
||||
tzset ();
|
||||
#endif
|
||||
|
||||
|
14
configure.ac
14
configure.ac
@ -1266,7 +1266,8 @@ AC_FUNC_VPRINTF
|
||||
AC_FUNC_FORK
|
||||
AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap canonicalize_file_name])
|
||||
AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r strtoull])
|
||||
AC_CHECK_FUNCS([unsetenv fcntl ftruncate inet_ntop canonicalize_file_name])
|
||||
AC_CHECK_FUNCS([setenv unsetenv fcntl ftruncate inet_ntop])
|
||||
AC_CHECK_FUNCS([canonicalize_file_name])
|
||||
AC_CHECK_FUNCS([gettimeofday getrusage getrlimit setrlimit clock_gettime])
|
||||
AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
|
||||
AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe getaddrinfo])
|
||||
@ -1296,16 +1297,6 @@ AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol \
|
||||
# end jnlib checks.
|
||||
|
||||
|
||||
|
||||
#
|
||||
# gnulib checks
|
||||
#
|
||||
gl_SOURCE_BASE([gl])
|
||||
gl_M4_BASE([gl/m4])
|
||||
gl_MODULES([setenv mkdtemp xsize strpbrk])
|
||||
gl_INIT
|
||||
|
||||
|
||||
#
|
||||
# W32 specific test
|
||||
#
|
||||
@ -1770,7 +1761,6 @@ fi
|
||||
AC_CONFIG_FILES([ m4/Makefile
|
||||
Makefile
|
||||
po/Makefile.in
|
||||
gl/Makefile
|
||||
common/Makefile
|
||||
common/w32info-rc.h
|
||||
kbx/Makefile
|
||||
|
@ -69,7 +69,7 @@ endif
|
||||
|
||||
|
||||
dirmngr_LDADD = $(libcommontlsnpth) $(libcommonpth) \
|
||||
../gl/libgnu.a $(DNSLIBS) $(LIBASSUAN_LIBS) \
|
||||
$(DNSLIBS) $(LIBASSUAN_LIBS) \
|
||||
$(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(NPTH_LIBS) \
|
||||
$(NTBTLS_LIBS) $(LIBGNUTLS_LIBS) $(LIBINTL) $(LIBICONV)
|
||||
if !USE_LDAPWRAPPER
|
||||
@ -81,14 +81,14 @@ if USE_LDAPWRAPPER
|
||||
dirmngr_ldap_SOURCES = dirmngr_ldap.c $(ldap_url)
|
||||
dirmngr_ldap_CFLAGS = $(GPG_ERROR_CFLAGS) $(LIBGCRYPT_CFLAGS)
|
||||
dirmngr_ldap_LDFLAGS =
|
||||
dirmngr_ldap_LDADD = $(libcommon) no-libgcrypt.o ../gl/libgnu.a \
|
||||
dirmngr_ldap_LDADD = $(libcommon) no-libgcrypt.o \
|
||||
$(GPG_ERROR_LIBS) $(LDAPLIBS) $(LBER_LIBS) $(LIBINTL) \
|
||||
$(LIBICONV)
|
||||
endif
|
||||
|
||||
dirmngr_client_SOURCES = dirmngr-client.c
|
||||
dirmngr_client_LDADD = $(libcommon) no-libgcrypt.o \
|
||||
../gl/libgnu.a $(LIBASSUAN_LIBS) \
|
||||
$(LIBASSUAN_LIBS) \
|
||||
$(GPG_ERROR_LIBS) $(NETLIBS) $(LIBINTL) $(LIBICONV)
|
||||
dirmngr_client_LDFLAGS = $(extra_bin_ldflags)
|
||||
|
||||
|
@ -27,7 +27,7 @@ include $(top_srcdir)/am/cmacros.am
|
||||
|
||||
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS)
|
||||
|
||||
needed_libs = ../kbx/libkeybox.a $(libcommon) ../gl/libgnu.a
|
||||
needed_libs = ../kbx/libkeybox.a $(libcommon)
|
||||
|
||||
bin_PROGRAMS = gpg2
|
||||
if !HAVE_W32CE_SYSTEM
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include "i18n.h"
|
||||
#include "iobuf.h"
|
||||
#include "util.h"
|
||||
#include "mkdtemp.h" /* From gnulib. */
|
||||
#include "membuf.h"
|
||||
#include "exec.h"
|
||||
|
||||
|
@ -42,6 +42,6 @@ g13_SOURCES = \
|
||||
be-encfs.c be-encfs.h \
|
||||
be-truecrypt.c be-truecrypt.h
|
||||
|
||||
g13_LDADD = $(libcommonpth) ../gl/libgnu.a \
|
||||
g13_LDADD = $(libcommonpth) \
|
||||
$(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(NPTH_LIBS) \
|
||||
$(GPG_ERROR_LIBS) $(LIBINTL) $(LIBICONV)
|
||||
|
149
gl/Makefile.am
149
gl/Makefile.am
@ -1,149 +0,0 @@
|
||||
## DO NOT EDIT! GENERATED AUTOMATICALLY!
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
# Copyright (C) 2004-2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software, distributed under the terms of the GNU
|
||||
# General Public License. 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 --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --aux-dir=scripts --no-libtool --macro-prefix=gl alloca-opt allocsa mkdtemp setenv strpbrk xsize
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.5 gnits
|
||||
|
||||
noinst_LIBRARIES = libgnu.a
|
||||
|
||||
libgnu_a_SOURCES =
|
||||
libgnu_a_LIBADD = $(LIBOBJS)
|
||||
noinst_HEADERS =
|
||||
EXTRA_DIST =
|
||||
BUILT_SOURCES =
|
||||
SUFFIXES =
|
||||
MOSTLYCLEANFILES = core *.stackdump
|
||||
MOSTLYCLEANDIRS =
|
||||
CLEANFILES =
|
||||
DISTCLEANFILES =
|
||||
MAINTAINERCLEANFILES =
|
||||
|
||||
AM_CPPFLAGS =
|
||||
|
||||
if HAVE_W32CE_SYSTEM
|
||||
AM_CFLAGS = $(GPG_ERROR_CFLAGS)
|
||||
endif
|
||||
|
||||
## begin gnulib module alloca-opt
|
||||
|
||||
BUILT_SOURCES += $(ALLOCA_H)
|
||||
EXTRA_DIST += 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.
|
||||
alloca.h: alloca_.h
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
cat $(srcdir)/alloca_.h; \
|
||||
} > $@-t
|
||||
mv -f $@-t $@
|
||||
MOSTLYCLEANFILES += alloca.h alloca.h-t
|
||||
|
||||
## end gnulib module alloca-opt
|
||||
|
||||
## begin gnulib module allocsa
|
||||
|
||||
libgnu_a_SOURCES += allocsa.h allocsa.c
|
||||
EXTRA_DIST += allocsa.valgrind
|
||||
|
||||
## end gnulib module allocsa
|
||||
|
||||
## begin gnulib module mkdtemp
|
||||
|
||||
libgnu_a_SOURCES += mkdtemp.h
|
||||
|
||||
## end gnulib module mkdtemp
|
||||
|
||||
## begin gnulib module setenv
|
||||
|
||||
libgnu_a_SOURCES += setenv.h
|
||||
|
||||
## end gnulib module setenv
|
||||
|
||||
## begin gnulib module size_max
|
||||
|
||||
libgnu_a_SOURCES += size_max.h
|
||||
|
||||
## end gnulib module size_max
|
||||
|
||||
## begin gnulib module stdint
|
||||
|
||||
BUILT_SOURCES += $(STDINT_H)
|
||||
EXTRA_DIST += 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.
|
||||
stdint.h: stdint_.h
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
|
||||
-e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
|
||||
-e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_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_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
|
||||
-e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/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_.h; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += stdint.h stdint.h-t
|
||||
|
||||
## end gnulib module stdint
|
||||
|
||||
## begin gnulib module strpbrk
|
||||
|
||||
libgnu_a_SOURCES += strpbrk.h
|
||||
|
||||
## end gnulib module strpbrk
|
||||
|
||||
## begin gnulib module unistd
|
||||
|
||||
BUILT_SOURCES += $(UNISTD_H)
|
||||
|
||||
# We need the following in order to create an empty placeholder for
|
||||
# <unistd.h> when the system doesn't have one.
|
||||
unistd.h:
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
echo '/* Empty placeholder for $@. */'; \
|
||||
} > $@
|
||||
MOSTLYCLEANFILES += unistd.h
|
||||
|
||||
## end gnulib module unistd
|
||||
|
||||
## begin gnulib module xsize
|
||||
|
||||
libgnu_a_SOURCES += xsize.h
|
||||
|
||||
## end gnulib module xsize
|
||||
|
||||
|
||||
mostlyclean-local: mostlyclean-generic
|
||||
@test -z "$(MOSTLYCLEANDIRS)" || \
|
||||
for dir in $(MOSTLYCLEANDIRS); do \
|
||||
if test -d $$dir; then \
|
||||
echo "rmdir $$dir"; rmdir $$dir; \
|
||||
fi; \
|
||||
done
|
53
gl/alloca_.h
53
gl/alloca_.h
@ -1,53 +0,0 @@
|
||||
/* Memory allocation on the stack.
|
||||
|
||||
Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004, 2006 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 _GNULIB_ALLOCA_H
|
||||
# define _GNULIB_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
|
||||
# else
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
void *alloca (size_t);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* _GNULIB_ALLOCA_H */
|
136
gl/allocsa.c
136
gl/allocsa.c
@ -1,136 +0,0 @@
|
||||
/* Safe automatic memory allocation.
|
||||
Copyright (C) 2003, 2006 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 2, 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 "allocsa.h"
|
||||
|
||||
/* The speed critical point in this file is freesa() applied to an alloca()
|
||||
result: it must be fast, to match the speed of alloca(). The speed of
|
||||
mallocsa() and freesa() in the other case are not critical, because they
|
||||
are only invoked for big memory sizes. */
|
||||
|
||||
#if HAVE_ALLOCA
|
||||
|
||||
/* Store the mallocsa() results in a hash table. This is needed to reliably
|
||||
distinguish a mallocsa() result and an alloca() result.
|
||||
|
||||
Although it is possible that the same pointer is returned by alloca() and
|
||||
by mallocsa() at different times in the same application, it does not lead
|
||||
to a bug in freesa(), 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 freesa() on it anyway.
|
||||
- Before a pointer returned by mallocsa() can point into the stack, it
|
||||
must be freed. The only function that can free it is freesa(), and
|
||||
when freesa() 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; char room[MAGIC_SIZE]; };
|
||||
/* 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)
|
||||
struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; };
|
||||
/* Verify that HEADER_SIZE == sizeof (struct header). */
|
||||
typedef int verify1[2 * (HEADER_SIZE == sizeof (struct header)) - 1];
|
||||
/* 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 * mallocsa_results[HASH_TABLE_SIZE];
|
||||
|
||||
#endif
|
||||
|
||||
void *
|
||||
mallocsa (size_t n)
|
||||
{
|
||||
#if HAVE_ALLOCA
|
||||
/* Allocate one more word, that serves as an indicator for malloc()ed
|
||||
memory, so that freesa() of an alloca() result is fast. */
|
||||
size_t nplus = n + HEADER_SIZE;
|
||||
|
||||
if (nplus >= n)
|
||||
{
|
||||
char *p = (char *) malloc (nplus);
|
||||
|
||||
if (p != NULL)
|
||||
{
|
||||
size_t slot;
|
||||
|
||||
p += HEADER_SIZE;
|
||||
|
||||
/* Put a magic number into the indicator word. */
|
||||
((int *) p)[-1] = MAGIC_NUMBER;
|
||||
|
||||
/* Enter p into the hash table. */
|
||||
slot = (unsigned long) p % HASH_TABLE_SIZE;
|
||||
((struct header *) (p - HEADER_SIZE))->next = mallocsa_results[slot];
|
||||
mallocsa_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
|
||||
freesa (void *p)
|
||||
{
|
||||
/* mallocsa() may have returned NULL. */
|
||||
if (p != NULL)
|
||||
{
|
||||
/* Attempt to quickly distinguish the mallocsa() 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 mallocsa() result. To see whether it really is one,
|
||||
perform a lookup in the hash table. */
|
||||
size_t slot = (unsigned long) p % HASH_TABLE_SIZE;
|
||||
void **chain = &mallocsa_results[slot];
|
||||
for (; *chain != NULL;)
|
||||
{
|
||||
if (*chain == p)
|
||||
{
|
||||
/* Found it. Remove it from the hash table and free it. */
|
||||
char *p_begin = (char *) p - HEADER_SIZE;
|
||||
*chain = ((struct header *) p_begin)->next;
|
||||
free (p_begin);
|
||||
return;
|
||||
}
|
||||
chain = &((struct header *) ((char *) *chain - HEADER_SIZE))->next;
|
||||
}
|
||||
}
|
||||
/* At this point, we know it was not a mallocsa() result. */
|
||||
}
|
||||
}
|
||||
#endif
|
127
gl/allocsa.h
127
gl/allocsa.h
@ -1,127 +0,0 @@
|
||||
/* Safe automatic memory allocation.
|
||||
Copyright (C) 2003-2006 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 _ALLOCSA_H
|
||||
#define _ALLOCSA_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 an inline function. */
|
||||
# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL)
|
||||
#else
|
||||
# define safe_alloca(N) ((N), NULL)
|
||||
#endif
|
||||
|
||||
/* allocsa(N) is a safe variant of alloca(N). It allocates N bytes of
|
||||
memory allocated on the stack, that must be freed using freesa() before
|
||||
the function returns. Upon failure, it returns NULL. */
|
||||
#if HAVE_ALLOCA
|
||||
# define allocsa(N) \
|
||||
((N) < 4032 - sa_increment \
|
||||
? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \
|
||||
: mallocsa (N))
|
||||
#else
|
||||
# define allocsa(N) \
|
||||
mallocsa (N)
|
||||
#endif
|
||||
extern void * mallocsa (size_t n);
|
||||
|
||||
/* Free a block of memory allocated through allocsa(). */
|
||||
#if HAVE_ALLOCA
|
||||
extern void freesa (void *p);
|
||||
#else
|
||||
# define freesa free
|
||||
#endif
|
||||
|
||||
/* Maybe we should also define a variant
|
||||
nallocsa (size_t n, size_t s) - behaves like allocsa (n * s)
|
||||
If this would be useful in your application. please speak up. */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* ------------------- Auxiliary, non-public definitions ------------------- */
|
||||
|
||||
/* Determine the alignment of a type at compile time. */
|
||||
#if defined __GNUC__
|
||||
# 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),
|
||||
#ifdef HAVE_LONG_LONG_INT
|
||||
sa_alignment_longlong = sa_alignof (long long),
|
||||
#endif
|
||||
#ifdef HAVE_LONG_DOUBLE
|
||||
sa_alignment_longdouble = sa_alignof (long double),
|
||||
#endif
|
||||
sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
|
||||
#ifdef HAVE_LONG_LONG_INT
|
||||
| (sa_alignment_longlong - 1)
|
||||
#endif
|
||||
#ifdef HAVE_LONG_DOUBLE
|
||||
| (sa_alignment_longdouble - 1)
|
||||
#endif
|
||||
) + 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 /* _ALLOCSA_H */
|
@ -1,7 +0,0 @@
|
||||
# Suppress a valgrind message about use of uninitialized memory in freesa().
|
||||
# This use is OK because it provides only a speedup.
|
||||
{
|
||||
freesa
|
||||
Memcheck:Cond
|
||||
fun:freesa
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
# absolute-header.m4 serial 6
|
||||
dnl Copyright (C) 2006 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, assuming 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.
|
||||
AC_DEFUN([gl_ABSOLUTE_HEADER],
|
||||
[AC_LANG_PREPROC_REQUIRE()dnl
|
||||
AC_FOREACH([gl_HEADER_NAME], [$1],
|
||||
[AS_VAR_PUSHDEF([gl_absolute_header],
|
||||
[gl_cv_absolute_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
|
||||
AC_CACHE_CHECK([absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
|
||||
m4_quote(m4_defn([gl_absolute_header])),
|
||||
[AS_VAR_PUSHDEF([ac_header_exists],
|
||||
[ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
|
||||
AC_CHECK_HEADERS_ONCE(m4_quote(m4_defn([gl_HEADER_NAME])))dnl
|
||||
if test AS_VAR_GET(ac_header_exists) = yes; then
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]])])
|
||||
dnl eval is necessary to expand ac_cpp.
|
||||
dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
|
||||
AS_VAR_SET(gl_absolute_header,
|
||||
[`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
|
||||
sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#;s#^/[^/]#//&#;p;q;}'`])
|
||||
fi
|
||||
AS_VAR_POPDEF([ac_header_exists])dnl
|
||||
])dnl
|
||||
AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_quote(m4_defn([gl_HEADER_NAME]))),
|
||||
["AS_VAR_GET(gl_absolute_header)"],
|
||||
[Define this to an absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>.])
|
||||
AS_VAR_POPDEF([gl_absolute_header])dnl
|
||||
])dnl
|
||||
])# gl_ABSOLUTE_HEADER
|
@ -1,42 +0,0 @@
|
||||
# alloca.m4 serial 5
|
||||
dnl Copyright (C) 2002, 2003, 2004 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_ALLOCA],
|
||||
[
|
||||
dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
|
||||
AC_REQUIRE([AC_PROG_CPP])
|
||||
AC_REQUIRE([AC_PROG_EGREP])
|
||||
|
||||
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_EGREP_CPP([Need own alloca], [
|
||||
#if defined __GNUC__ || defined _AIX || defined _MSC_VER
|
||||
Need own alloca
|
||||
#endif
|
||||
],
|
||||
[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],
|
||||
[ALLOCA_H=])
|
||||
else
|
||||
ALLOCA_H=alloca.h
|
||||
fi
|
||||
AC_SUBST([ALLOCA_H])
|
||||
|
||||
AC_DEFINE(HAVE_ALLOCA_H, 1,
|
||||
[Define HAVE_ALLOCA_H for backward compatibility with older code
|
||||
that includes <alloca.h> only if HAVE_ALLOCA_H is defined.])
|
||||
])
|
||||
|
||||
# Prerequisites of lib/alloca.c.
|
||||
# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
|
||||
AC_DEFUN([gl_PREREQ_ALLOCA], [:])
|
@ -1,15 +0,0 @@
|
||||
# allocsa.m4 serial 3
|
||||
dnl Copyright (C) 2003-2004 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_ALLOCSA],
|
||||
[
|
||||
dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables
|
||||
dnl @ALLOCA@ and @LTALLOCA@.
|
||||
AC_REQUIRE([gl_FUNC_ALLOCA])
|
||||
AC_REQUIRE([gl_EEMALLOC])
|
||||
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
||||
AC_REQUIRE([gt_TYPE_LONGDOUBLE])
|
||||
])
|
@ -1,32 +0,0 @@
|
||||
# eealloc.m4 serial 1
|
||||
dnl Copyright (C) 2003 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_REQUIRE([AC_C_INLINE])
|
||||
])
|
||||
|
||||
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.])
|
||||
])
|
@ -1,30 +0,0 @@
|
||||
# Copyright (C) 2004-2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software, distributed under the terms of the GNU
|
||||
# General Public License. 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 using CVS, this file is meant to be stored in CVS,
|
||||
# like the configure.ac and various Makefile.am files.
|
||||
|
||||
|
||||
# Specification in the form of a command-line invocation:
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --aux-dir=scripts --no-libtool --macro-prefix=gl alloca-opt allocsa mkdtemp setenv strpbrk xsize
|
||||
|
||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||
gl_LOCAL_DIR([])
|
||||
gl_MODULES([alloca-opt allocsa mkdtemp setenv strpbrk xsize])
|
||||
gl_AVOID([])
|
||||
gl_SOURCE_BASE([gl])
|
||||
gl_M4_BASE([gl/m4])
|
||||
gl_DOC_BASE([doc])
|
||||
gl_TESTS_BASE([tests])
|
||||
gl_LIB([libgnu])
|
||||
gl_MAKEFILE_NAME([])
|
||||
gl_MACRO_PREFIX([gl])
|
@ -1,82 +0,0 @@
|
||||
# DO NOT EDIT! GENERATED AUTOMATICALLY!
|
||||
# Copyright (C) 2004-2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software, distributed under the terms of the GNU
|
||||
# General Public License. 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 using CVS, 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([gl_EARLY],
|
||||
[
|
||||
m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
|
||||
m4_pattern_allow([^gl_ES$])dnl a valid locale name
|
||||
AC_REQUIRE([AC_PROG_RANLIB])
|
||||
])
|
||||
|
||||
# This macro should be invoked from ./configure.ac, in the section
|
||||
# "Check for header files, types and library functions".
|
||||
AC_DEFUN([gl_INIT],
|
||||
[
|
||||
AM_CONDITIONAL([GL_COND_LIBTOOL], [false])
|
||||
gl_cond_libtool=false
|
||||
gl_libdeps=
|
||||
gl_ltlibdeps=
|
||||
gl_source_base='gl'
|
||||
gl_FUNC_ALLOCA
|
||||
gl_ALLOCSA
|
||||
gt_FUNC_MKDTEMP
|
||||
gt_FUNC_SETENV
|
||||
gl_SIZE_MAX
|
||||
gl_STDINT_H
|
||||
gl_FUNC_STRPBRK
|
||||
gl_HEADER_UNISTD
|
||||
gl_XSIZE
|
||||
LIBGNU_LIBDEPS="$gl_libdeps"
|
||||
AC_SUBST([LIBGNU_LIBDEPS])
|
||||
LIBGNU_LTLIBDEPS="$gl_ltlibdeps"
|
||||
AC_SUBST([LIBGNU_LTLIBDEPS])
|
||||
])
|
||||
|
||||
# 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([gl_FILE_LIST], [
|
||||
lib/alloca_.h
|
||||
lib/allocsa.c
|
||||
lib/allocsa.h
|
||||
lib/allocsa.valgrind
|
||||
lib/mkdtemp.c
|
||||
lib/mkdtemp.h
|
||||
lib/setenv.c
|
||||
lib/setenv.h
|
||||
lib/size_max.h
|
||||
lib/stdint_.h
|
||||
lib/strpbrk.c
|
||||
lib/strpbrk.h
|
||||
lib/unsetenv.c
|
||||
lib/xsize.h
|
||||
m4/absolute-header.m4
|
||||
m4/alloca.m4
|
||||
m4/allocsa.m4
|
||||
m4/eealloc.m4
|
||||
m4/longdouble.m4
|
||||
m4/mkdtemp.m4
|
||||
m4/setenv.m4
|
||||
m4/size_max.m4
|
||||
m4/stdint.m4
|
||||
m4/strpbrk.m4
|
||||
m4/ulonglong.m4
|
||||
m4/unistd_h.m4
|
||||
m4/xsize.m4
|
||||
])
|
@ -1,33 +0,0 @@
|
||||
# gnulib-tool.m4 serial 1
|
||||
dnl Copyright (C) 2004-2005 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_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_LIB([LIBNAME])
|
||||
AC_DEFUN([gl_LIB], [])
|
||||
|
||||
dnl Usage: gl_LGPL
|
||||
AC_DEFUN([gl_LGPL], [])
|
||||
|
||||
dnl Usage: gl_LIBTOOL
|
||||
AC_DEFUN([gl_LIBTOOL], [])
|
||||
|
||||
dnl Usage: gl_MACRO_PREFIX([PREFIX])
|
||||
AC_DEFUN([gl_MACRO_PREFIX], [])
|
@ -1,31 +0,0 @@
|
||||
# longdouble.m4 serial 2 (gettext-0.15)
|
||||
dnl Copyright (C) 2002-2003, 2006 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 the compiler supports the 'long double' type.
|
||||
dnl Prerequisite: AC_PROG_CC
|
||||
|
||||
dnl This file is only needed in autoconf <= 2.59. Newer versions of autoconf
|
||||
dnl have a macro AC_TYPE_LONG_DOUBLE with identical semantics.
|
||||
|
||||
AC_DEFUN([gt_TYPE_LONGDOUBLE],
|
||||
[
|
||||
AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
|
||||
[if test "$GCC" = yes; then
|
||||
gt_cv_c_long_double=yes
|
||||
else
|
||||
AC_TRY_COMPILE([
|
||||
/* The Stardent Vistra knows sizeof(long double), but does not support it. */
|
||||
long double foo = 0.0;
|
||||
/* On Ultrix 4.3 cc, long double is 4 and double is 8. */
|
||||
int array [2*(sizeof(long double) >= sizeof(double)) - 1];
|
||||
], ,
|
||||
gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
|
||||
fi])
|
||||
if test $gt_cv_c_long_double = yes; then
|
||||
AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
|
||||
fi
|
||||
])
|
@ -1,22 +0,0 @@
|
||||
# mkdtemp.m4 serial 4
|
||||
dnl Copyright (C) 2001-2003, 2006 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([gt_FUNC_MKDTEMP],
|
||||
[
|
||||
AC_REPLACE_FUNCS(mkdtemp)
|
||||
if test $ac_cv_func_mkdtemp = no; then
|
||||
gl_PREREQ_MKDTEMP
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/mkdtemp.c
|
||||
AC_DEFUN([gl_PREREQ_MKDTEMP],
|
||||
[
|
||||
AC_REQUIRE([AC_HEADER_STAT])
|
||||
AC_CHECK_HEADERS_ONCE(sys/time.h unistd.h)
|
||||
AC_CHECK_HEADERS(time.h)
|
||||
AC_CHECK_FUNCS(gettimeofday)
|
||||
])
|
@ -1,68 +0,0 @@
|
||||
# setenv.m4 serial 6
|
||||
dnl Copyright (C) 2001-2004, 2006 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([gt_FUNC_SETENV],
|
||||
[
|
||||
AC_REPLACE_FUNCS(setenv unsetenv)
|
||||
if test $ac_cv_func_setenv = no; then
|
||||
gl_PREREQ_SETENV
|
||||
fi
|
||||
if test $ac_cv_func_unsetenv = no; then
|
||||
gl_PREREQ_UNSETENV
|
||||
else
|
||||
AC_CACHE_CHECK([for unsetenv() return type], gt_cv_func_unsetenv_ret,
|
||||
[AC_TRY_COMPILE([#include <stdlib.h>
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
int unsetenv (const char *name);
|
||||
#else
|
||||
int unsetenv();
|
||||
#endif
|
||||
], , 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 if unsetenv() returns void, not int.])
|
||||
fi
|
||||
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_TRY_COMPILE([$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_]translit($2, [a-z], [A-Z])[_DECL], 1,
|
||||
[Define if you have the declaration of $2.])
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/setenv.c.
|
||||
AC_DEFUN([gl_PREREQ_SETENV],
|
||||
[
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])
|
||||
AC_CHECK_HEADERS_ONCE(unistd.h)
|
||||
AC_CHECK_HEADERS(search.h)
|
||||
AC_CHECK_FUNCS(tsearch)
|
||||
gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
|
||||
])
|
||||
|
||||
# Prerequisites of lib/unsetenv.c.
|
||||
AC_DEFUN([gl_PREREQ_UNSETENV],
|
||||
[
|
||||
AC_CHECK_HEADERS_ONCE(unistd.h)
|
||||
gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
|
||||
])
|
@ -1,60 +0,0 @@
|
||||
# size_max.m4 serial 4
|
||||
dnl Copyright (C) 2003, 2005-2006 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_MSG_CHECKING([for SIZE_MAX])
|
||||
result=
|
||||
AC_EGREP_CPP([Found it], [
|
||||
#include <limits.h>
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef SIZE_MAX
|
||||
Found it
|
||||
#endif
|
||||
], result=yes)
|
||||
if test -z "$result"; 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([sizeof (size_t) * CHAR_BIT - 1], size_t_bits_minus_1,
|
||||
[#include <stddef.h>
|
||||
#include <limits.h>], size_t_bits_minus_1=)
|
||||
_AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
|
||||
[#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_TRY_COMPILE([#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
|
||||
result="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
|
||||
else
|
||||
result="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
|
||||
fi
|
||||
else
|
||||
dnl Shouldn't happen, but who knows...
|
||||
result='((size_t)~(size_t)0)'
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT([$result])
|
||||
if test "$result" != yes; then
|
||||
AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
|
||||
[Define as the maximum value of type 'size_t', if the system doesn't define it.])
|
||||
fi
|
||||
])
|
368
gl/m4/stdint.m4
368
gl/m4/stdint.m4
@ -1,368 +0,0 @@
|
||||
# stdint.m4 serial 19
|
||||
dnl Copyright (C) 2001-2002, 2004-2006 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([gl_STDINT_H],
|
||||
[
|
||||
AC_PREREQ(2.59)dnl
|
||||
|
||||
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>.
|
||||
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])
|
||||
|
||||
dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_stdint_h.
|
||||
if test $ac_cv_header_stdint_h = yes; then
|
||||
gl_ABSOLUTE_HEADER([stdint.h])
|
||||
ABSOLUTE_STDINT_H=\"$gl_cv_absolute_stdint_h\"
|
||||
HAVE_STDINT_H=1
|
||||
else
|
||||
ABSOLUTE_STDINT_H=\"no/such/file/stdint.h\"
|
||||
HAVE_STDINT_H=0
|
||||
fi
|
||||
AC_SUBST([ABSOLUTE_STDINT_H])
|
||||
AC_SUBST([HAVE_STDINT_H])
|
||||
|
||||
dnl Now see whether we need a substitute <stdint.h>. Use
|
||||
dnl ABSOLUTE_STDINT_H, not <stdint.h>, so that it also works during
|
||||
dnl a "config.status --recheck" if a stdint.h has been
|
||||
dnl created in the build directory.
|
||||
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([[
|
||||
#include <stddef.h>
|
||||
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
|
||||
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
|
||||
#include ABSOLUTE_STDINT_H
|
||||
#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;
|
||||
struct s {
|
||||
int check_PTRDIFF: PTRDIFF_MIN < 0 && 0 < PTRDIFF_MAX ? 1 : -1;
|
||||
int check_SIG_ATOMIC: SIG_ATOMIC_MIN <= 0 && 0 < SIG_ATOMIC_MAX ? 1 : -1;
|
||||
int check_SIZE: 0 < SIZE_MAX ? 1 : -1;
|
||||
int check_WCHAR: WCHAR_MIN <= 0 && 0 < WCHAR_MAX ? 1 : -1;
|
||||
int check_WINT: WINT_MIN <= 0 && 0 < WINT_MAX ? 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;
|
||||
};
|
||||
]])],
|
||||
[gl_cv_header_working_stdint_h=yes])])
|
||||
fi
|
||||
if test "$gl_cv_header_working_stdint_h" != yes; then
|
||||
|
||||
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
|
||||
else
|
||||
HAVE_SYS_INTTYPES_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_SYS_INTTYPES_H])
|
||||
if test $ac_cv_header_sys_bitypes_h = yes; then
|
||||
HAVE_SYS_BITYPES_H=1
|
||||
else
|
||||
HAVE_SYS_BITYPES_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_SYS_BITYPES_H])
|
||||
|
||||
gl_STDINT_TYPE_PROPERTIES
|
||||
STDINT_H=stdint.h
|
||||
fi
|
||||
AC_SUBST(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.
|
||||
AC_FOREACH([gltype], [$1],
|
||||
[AH_TEMPLATE([BITSIZEOF_]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([sizeof ($gltype) * CHAR_BIT], result,
|
||||
[$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
|
||||
AC_FOREACH([gltype], [$1],
|
||||
[AC_SUBST([BITSIZEOF_]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.
|
||||
AC_FOREACH([gltype], [$1],
|
||||
[AH_TEMPLATE([HAVE_SIGNED_]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
|
||||
AC_FOREACH([gltype], [$1],
|
||||
[AC_SUBST([HAVE_SIGNED_]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.
|
||||
AC_FOREACH([gltype], [$1],
|
||||
[AH_TEMPLATE(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
|
||||
AC_FOREACH([gltype], [$1],
|
||||
[AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
|
||||
])
|
||||
|
||||
dnl gl_STDINT_INCLUDES
|
||||
AC_DEFUN([gl_STDINT_INCLUDES],
|
||||
[[
|
||||
#include <stddef.h>
|
||||
#include <signal.h>
|
||||
#if HAVE_WCHAR_H
|
||||
/* BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
|
||||
<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_.h.
|
||||
AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
|
||||
[
|
||||
gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_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
|
||||
gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
|
||||
[gl_STDINT_INCLUDES])
|
||||
])
|
@ -1,16 +0,0 @@
|
||||
# strpbrk.m4 serial 2
|
||||
dnl Copyright (C) 2002-2003 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_STRPBRK],
|
||||
[
|
||||
AC_REPLACE_FUNCS(strpbrk)
|
||||
if test $ac_cv_func_strpbrk = no; then
|
||||
gl_PREREQ_STRPBRK
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/strpbrk.c.
|
||||
AC_DEFUN([gl_PREREQ_STRPBRK], [:])
|
@ -1,18 +0,0 @@
|
||||
# unistd_h.m4 serial 2
|
||||
dnl Copyright (C) 2006 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
|
||||
|
||||
AC_DEFUN([gl_HEADER_UNISTD],
|
||||
[
|
||||
dnl Prerequisites of lib/unistd.h.
|
||||
AC_CHECK_HEADERS([unistd.h], [
|
||||
UNISTD_H=''
|
||||
], [
|
||||
UNISTD_H='unistd.h'
|
||||
])
|
||||
AC_SUBST(UNISTD_H)
|
||||
])
|
@ -1,13 +0,0 @@
|
||||
# xsize.m4 serial 3
|
||||
dnl Copyright (C) 2003-2004 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_REQUIRE([AC_C_INLINE])
|
||||
AC_CHECK_HEADERS(stdint.h)
|
||||
])
|
218
gl/mkdtemp.c
218
gl/mkdtemp.c
@ -1,218 +0,0 @@
|
||||
/* Copyright (C) 1999, 2001-2003, 2006 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/>. */
|
||||
|
||||
/* Extracted from misc/mkdtemp.c and sysdeps/posix/tempname.c. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "mkdtemp.h"
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef __set_errno
|
||||
# ifdef HAVE_W32CE_SYSTEM
|
||||
# include <gpg-error.h>
|
||||
# define __set_errno(Val) gpg_err_set_errno ((Val))
|
||||
# else
|
||||
# define __set_errno(Val) errno = (Val)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#ifndef TMP_MAX
|
||||
# define TMP_MAX 238328
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#if HAVE_GETTIMEOFDAY || _LIBC
|
||||
# if HAVE_SYS_TIME_H || _LIBC
|
||||
# include <sys/time.h>
|
||||
# endif
|
||||
#else
|
||||
# if HAVE_TIME_H || _LIBC
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#if !defined S_ISDIR && defined S_IFDIR
|
||||
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
#if !S_IRUSR && S_IREAD
|
||||
# define S_IRUSR S_IREAD
|
||||
#endif
|
||||
#if !S_IRUSR
|
||||
# define S_IRUSR 00400
|
||||
#endif
|
||||
#if !S_IWUSR && S_IWRITE
|
||||
# define S_IWUSR S_IWRITE
|
||||
#endif
|
||||
#if !S_IWUSR
|
||||
# define S_IWUSR 00200
|
||||
#endif
|
||||
#if !S_IXUSR && S_IEXEC
|
||||
# define S_IXUSR S_IEXEC
|
||||
#endif
|
||||
#if !S_IXUSR
|
||||
# define S_IXUSR 00100
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_W32CE_SYSTEM
|
||||
#include <windows.h>
|
||||
#define getpid() GetCurrentProcessId ()
|
||||
#endif
|
||||
|
||||
#if !_LIBC
|
||||
# define __getpid getpid
|
||||
# define __gettimeofday gettimeofday
|
||||
# define __mkdir mkdir
|
||||
#endif
|
||||
|
||||
/* Use the widest available unsigned type if uint64_t is not
|
||||
available. The algorithm below extracts a number less than 62**6
|
||||
(approximately 2**35.725) from uint64_t, so ancient hosts where
|
||||
uintmax_t is only 32 bits lose about 3.725 bits of randomness,
|
||||
which is better than not having mkstemp at all. */
|
||||
#if !defined UINT64_MAX && !defined uint64_t
|
||||
# define uint64_t uintmax_t
|
||||
#endif
|
||||
|
||||
/* These are the characters used in temporary filenames. */
|
||||
static const char letters[] =
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
/* Generate a temporary file name based on TMPL. TMPL must match the
|
||||
rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed
|
||||
does not exist at the time of the call to __gen_tempname. TMPL is
|
||||
overwritten with the result.
|
||||
|
||||
KIND is:
|
||||
__GT_DIR: create a directory, which will be mode 0700.
|
||||
|
||||
We use a clever algorithm to get hard-to-predict names. */
|
||||
static int
|
||||
gen_tempname (char *tmpl)
|
||||
{
|
||||
int len;
|
||||
char *XXXXXX;
|
||||
static uint64_t value;
|
||||
uint64_t random_time_bits;
|
||||
unsigned int count;
|
||||
int fd = -1;
|
||||
int save_errno = errno;
|
||||
|
||||
/* A lower bound on the number of temporary files to attempt to
|
||||
generate. The maximum total number of temporary file names that
|
||||
can exist for a given template is 62**6. It should never be
|
||||
necessary to try all these combinations. Instead if a reasonable
|
||||
number of names is tried (we define reasonable as 62**3) fail to
|
||||
give the system administrator the chance to remove the problems. */
|
||||
#define ATTEMPTS_MIN (62 * 62 * 62)
|
||||
|
||||
/* The number of times to attempt to generate a temporary file. To
|
||||
conform to POSIX, this must be no smaller than TMP_MAX. */
|
||||
#if ATTEMPTS_MIN < TMP_MAX
|
||||
unsigned int attempts = TMP_MAX;
|
||||
#else
|
||||
unsigned int attempts = ATTEMPTS_MIN;
|
||||
#endif
|
||||
|
||||
len = strlen (tmpl);
|
||||
if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This is where the Xs start. */
|
||||
XXXXXX = &tmpl[len - 6];
|
||||
|
||||
/* Get some more or less random data. */
|
||||
#ifdef RANDOM_BITS
|
||||
RANDOM_BITS (random_time_bits);
|
||||
#else
|
||||
# if HAVE_GETTIMEOFDAY || _LIBC
|
||||
{
|
||||
struct timeval tv;
|
||||
__gettimeofday (&tv, NULL);
|
||||
random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
|
||||
}
|
||||
# else
|
||||
random_time_bits = time (NULL);
|
||||
# endif
|
||||
#endif
|
||||
value += random_time_bits ^ __getpid ();
|
||||
|
||||
for (count = 0; count < attempts; value += 7777, ++count)
|
||||
{
|
||||
uint64_t v = value;
|
||||
|
||||
/* Fill in the random bits. */
|
||||
XXXXXX[0] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[1] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[2] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[3] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[4] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[5] = letters[v % 62];
|
||||
|
||||
#ifdef MKDIR_TAKES_ONE_ARG
|
||||
fd = mkdir (tmpl);
|
||||
#else
|
||||
fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
|
||||
#endif
|
||||
|
||||
if (fd >= 0)
|
||||
{
|
||||
__set_errno (save_errno);
|
||||
return fd;
|
||||
}
|
||||
else if (errno != EEXIST)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* We got out of the loop because we ran out of combinations to try. */
|
||||
__set_errno (EEXIST);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Generate a unique temporary directory from TEMPLATE.
|
||||
The last six characters of TEMPLATE must be "XXXXXX";
|
||||
they are replaced with a string that makes the filename unique.
|
||||
The directory is created, mode 700, and its name is returned.
|
||||
(This function comes from OpenBSD.) */
|
||||
char *
|
||||
mkdtemp (char *template)
|
||||
{
|
||||
if (gen_tempname (template))
|
||||
return NULL;
|
||||
else
|
||||
return template;
|
||||
}
|
31
gl/mkdtemp.h
31
gl/mkdtemp.h
@ -1,31 +0,0 @@
|
||||
/* Creating a private temporary directory.
|
||||
Copyright (C) 2001-2002 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 HAVE_MKDTEMP
|
||||
|
||||
/* Get mkdtemp() declaration. */
|
||||
#include <stdlib.h>
|
||||
|
||||
#else
|
||||
|
||||
/* 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. */
|
||||
extern char * mkdtemp (char *template);
|
||||
|
||||
#endif
|
332
gl/setenv.c
332
gl/setenv.c
@ -1,332 +0,0 @@
|
||||
/* Copyright (C) 1992,1995-1999,2000-2003,2005,2006 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/>. */
|
||||
|
||||
#if !_LIBC
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include <alloca.h>
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef __set_errno
|
||||
# ifdef HAVE_W32CE_SYSTEM
|
||||
# include <gpg-error.h>
|
||||
# define __set_errno(ev) gpg_err_set_errno ((ev))
|
||||
# else
|
||||
# define __set_errno(ev) ((errno) = (ev))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if _LIBC || HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if !_LIBC
|
||||
# include "allocsa.h"
|
||||
#endif
|
||||
|
||||
#if !_LIBC
|
||||
# define __environ environ
|
||||
# ifndef HAVE_ENVIRON_DECL
|
||||
extern char **environ;
|
||||
# endif
|
||||
#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 *_v = tfind (Str, &known_values, (compar_fn_t) strcmp); \
|
||||
_v != NULL ? *(char **) _v : 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)
|
||||
{
|
||||
register char **ep;
|
||||
register 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)
|
||||
{
|
||||
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 *) allocsa (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
|
||||
freesa (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
|
||||
freesa (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 = allocsa (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 = malloc (namelen + 1 + vallen);
|
||||
if (np == NULL)
|
||||
{
|
||||
#if defined USE_TSEARCH && !defined _LIBC
|
||||
freesa (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
|
||||
freesa (new_value);
|
||||
#endif
|
||||
}
|
||||
|
||||
*ep = np;
|
||||
}
|
||||
|
||||
UNLOCK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
setenv (const char *name, const char *value, int replace)
|
||||
{
|
||||
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
|
53
gl/setenv.h
53
gl/setenv.h
@ -1,53 +0,0 @@
|
||||
/* Setting environment variables.
|
||||
Copyright (C) 2001-2004 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 HAVE_SETENV || HAVE_UNSETENV
|
||||
|
||||
/* Get setenv(), unsetenv() declarations. */
|
||||
# include <stdlib.h>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !HAVE_SETENV
|
||||
|
||||
/* Set NAME to VALUE in the environment.
|
||||
If REPLACE is nonzero, overwrite an existing value. */
|
||||
extern int setenv (const char *name, const char *value, int replace);
|
||||
|
||||
#endif
|
||||
|
||||
#if HAVE_UNSETENV
|
||||
|
||||
# if VOID_UNSETENV
|
||||
/* On some systems, unsetenv() returns void.
|
||||
This is the case for FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */
|
||||
# define unsetenv(name) ((unsetenv)(name), 0)
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
/* Remove the variable NAME from the environment. */
|
||||
extern int unsetenv (const char *name);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1,30 +0,0 @@
|
||||
/* size_max.h -- declare SIZE_MAX through system headers
|
||||
Copyright (C) 2005-2006 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 */
|
508
gl/stdint_.h
508
gl/stdint_.h
@ -1,508 +0,0 @@
|
||||
/* Copyright (C) 2001-2002, 2004-2006 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/>. */
|
||||
|
||||
#ifndef _GL_STDINT_H
|
||||
#define _GL_STDINT_H
|
||||
|
||||
/*
|
||||
* ISO C 99 <stdint.h> for platforms that lack it.
|
||||
* <http://www.opengroup.org/susv3xbd/stdint.h.html>
|
||||
*/
|
||||
|
||||
/* 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 _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_
|
||||
# include_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
|
||||
/* 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
|
||||
_GL_STDINT_H is defined. */
|
||||
# include @ABSOLUTE_STDINT_H@
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* Apple's implementation of <stdint.h> is bugy; we therefore use
|
||||
the source definitions. */
|
||||
# include <_types/_intmax_t.h>
|
||||
# include <_types/_uintmax_t.h>
|
||||
#endif
|
||||
|
||||
/* <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>).
|
||||
MacOS 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 @ABSOLUTE_STDINT_H@. */
|
||||
#if @HAVE_SYS_TYPES_H@
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */
|
||||
#include <limits.h>
|
||||
|
||||
#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. */
|
||||
# define _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
# undef _GL_JUST_INCLUDE_ABSOLUTE_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
|
||||
|
||||
#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
|
||||
|
||||
/* Get WCHAR_MIN, WCHAR_MAX. */
|
||||
# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
|
||||
/* BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
|
||||
<wchar.h>. */
|
||||
# include <stdio.h>
|
||||
# include <time.h>
|
||||
# include <wchar.h>
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values for a 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) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
|
||||
|
||||
#define _STDINT_MAX(signed, bits, zero) \
|
||||
((signed) \
|
||||
? ~ _STDINT_MIN (signed, bits, zero) \
|
||||
: ((((zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1)
|
||||
|
||||
/* 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
|
||||
#define int8_t signed char
|
||||
#define uint8_t unsigned char
|
||||
|
||||
#undef int16_t
|
||||
#undef uint16_t
|
||||
#define int16_t short int
|
||||
#define uint16_t unsigned short int
|
||||
|
||||
#undef int32_t
|
||||
#undef uint32_t
|
||||
#define int32_t int
|
||||
#define uint32_t unsigned int
|
||||
|
||||
#undef int64_t
|
||||
#if LONG_MAX >> 31 >> 31 == 1
|
||||
# define int64_t long int
|
||||
#elif defined _MSC_VER
|
||||
# define int64_t __int64
|
||||
#elif @HAVE_LONG_LONG_INT@
|
||||
# define int64_t long long int
|
||||
#endif
|
||||
|
||||
#undef uint64_t
|
||||
#if ULONG_MAX >> 31 >> 31 >> 1 == 1
|
||||
# define uint64_t unsigned long int
|
||||
#elif defined _MSC_VER
|
||||
# define uint64_t unsigned __int64
|
||||
#elif @HAVE_UNSIGNED_LONG_LONG_INT@
|
||||
# define uint64_t unsigned long long int
|
||||
#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 int64_t
|
||||
# define int_least64_t int64_t
|
||||
#endif
|
||||
#ifdef 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. Assume that 'long int'
|
||||
is fast enough for all narrower integers. */
|
||||
|
||||
#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
|
||||
#define int_fast8_t long int
|
||||
#define uint_fast8_t unsigned int_fast8_t
|
||||
#define int_fast16_t long int
|
||||
#define uint_fast16_t unsigned int_fast16_t
|
||||
#define int_fast32_t long int
|
||||
#define uint_fast32_t unsigned int_fast32_t
|
||||
#ifdef int64_t
|
||||
# define int_fast64_t int64_t
|
||||
#endif
|
||||
#ifdef uint64_t
|
||||
# define uint_fast64_t uint64_t
|
||||
#endif
|
||||
|
||||
/* 7.18.1.4. Integer types capable of holding object pointers */
|
||||
|
||||
#undef intptr_t
|
||||
#undef uintptr_t
|
||||
#define intptr_t long int
|
||||
#define uintptr_t unsigned long int
|
||||
|
||||
/* 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. */
|
||||
|
||||
#undef intmax_t
|
||||
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
|
||||
# define intmax_t long long int
|
||||
#elif defined int64_t
|
||||
# define intmax_t int64_t
|
||||
#else
|
||||
# define intmax_t long int
|
||||
#endif
|
||||
|
||||
#undef uintmax_t
|
||||
#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
|
||||
# define uintmax_t unsigned long long int
|
||||
#elif defined int64_t
|
||||
# define uintmax_t uint64_t
|
||||
#else
|
||||
# define uintmax_t unsigned long int
|
||||
#endif
|
||||
|
||||
/* 7.18.2. Limits of specified-width integer types */
|
||||
|
||||
#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
|
||||
|
||||
/* 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
|
||||
|
||||
# undef INT64_MIN
|
||||
# undef INT64_MAX
|
||||
# ifdef int64_t
|
||||
# define INT64_MIN (~ INT64_MAX)
|
||||
# define INT64_MAX INTMAX_C (9223372036854775807)
|
||||
# endif
|
||||
|
||||
# undef UINT64_MAX
|
||||
# ifdef uint64_t
|
||||
# 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 int64_t
|
||||
# define INT_LEAST64_MIN INT64_MIN
|
||||
# define INT_LEAST64_MAX INT64_MAX
|
||||
# endif
|
||||
|
||||
# undef UINT_LEAST64_MAX
|
||||
# ifdef 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 LONG_MIN
|
||||
# define INT_FAST8_MAX LONG_MAX
|
||||
# define UINT_FAST8_MAX ULONG_MAX
|
||||
|
||||
# undef INT_FAST16_MIN
|
||||
# undef INT_FAST16_MAX
|
||||
# undef UINT_FAST16_MAX
|
||||
# define INT_FAST16_MIN LONG_MIN
|
||||
# define INT_FAST16_MAX LONG_MAX
|
||||
# define UINT_FAST16_MAX ULONG_MAX
|
||||
|
||||
# undef INT_FAST32_MIN
|
||||
# undef INT_FAST32_MAX
|
||||
# undef UINT_FAST32_MAX
|
||||
# define INT_FAST32_MIN LONG_MIN
|
||||
# define INT_FAST32_MAX LONG_MAX
|
||||
# define UINT_FAST32_MAX ULONG_MAX
|
||||
|
||||
# undef INT_FAST64_MIN
|
||||
# undef INT_FAST64_MAX
|
||||
# ifdef int64_t
|
||||
# define INT_FAST64_MIN INT64_MIN
|
||||
# define INT_FAST64_MAX INT64_MAX
|
||||
# endif
|
||||
|
||||
# undef UINT_FAST64_MAX
|
||||
# ifdef 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 */
|
||||
|
||||
# undef INTMAX_MIN
|
||||
# undef INTMAX_MAX
|
||||
# define INTMAX_MIN (~ INTMAX_MAX)
|
||||
# ifdef INT64_MAX
|
||||
# define INTMAX_MAX INT64_MAX
|
||||
# else
|
||||
# define INTMAX_MAX INT32_MAX
|
||||
# endif
|
||||
|
||||
# undef UINTMAX_MAX
|
||||
# ifdef UINT64_MAX
|
||||
# define UINTMAX_MAX UINT64_MAX
|
||||
# else
|
||||
# define UINTMAX_MAX UINT32_MAX
|
||||
# endif
|
||||
|
||||
/* 7.18.3. Limits of other integer types */
|
||||
|
||||
/* ptrdiff_t limits */
|
||||
# undef PTRDIFF_MIN
|
||||
# undef PTRDIFF_MAX
|
||||
# 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@)
|
||||
|
||||
/* 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
|
||||
# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
|
||||
|
||||
/* wchar_t limits */
|
||||
# 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@)
|
||||
|
||||
#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
|
||||
|
||||
/* 7.18.4. Macros for integer constants */
|
||||
|
||||
#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
|
||||
|
||||
/* 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 */
|
||||
|
||||
# undef INTMAX_C
|
||||
# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
|
||||
# define INTMAX_C(x) x##LL
|
||||
# elif defined int64_t
|
||||
# define INTMAX_C(x) INT64_C(x)
|
||||
# else
|
||||
# define INTMAX_C(x) x##L
|
||||
# endif
|
||||
|
||||
# undef UINTMAX_C
|
||||
# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
|
||||
# define UINTMAX_C(x) x##ULL
|
||||
# elif defined uint64_t
|
||||
# define UINTMAX_C(x) UINT64_C(x)
|
||||
# else
|
||||
# define UINTMAX_C(x) x##UL
|
||||
# endif
|
||||
|
||||
#endif /* !(defined __ANDROID__ && ...) */
|
||||
#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
|
||||
#endif /* _GL_STDINT_H */
|
41
gl/strpbrk.c
41
gl/strpbrk.c
@ -1,41 +0,0 @@
|
||||
/* Copyright (C) 1991, 1994, 2000, 2002-2003, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
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, 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 <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#undef strpbrk
|
||||
|
||||
/* Find the first occurrence in S of any character in ACCEPT. */
|
||||
char *
|
||||
strpbrk (const char *s, const char *accept)
|
||||
{
|
||||
while (*s != '\0')
|
||||
{
|
||||
const char *a = accept;
|
||||
while (*a != '\0')
|
||||
if (*a++ == *s)
|
||||
return (char *) s;
|
||||
++s;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
27
gl/strpbrk.h
27
gl/strpbrk.h
@ -1,27 +0,0 @@
|
||||
/* Searching in a string.
|
||||
Copyright (C) 2001-2002 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 HAVE_STRPBRK
|
||||
|
||||
/* Get strpbrk() declaration. */
|
||||
#include <string.h>
|
||||
|
||||
#else
|
||||
|
||||
/* Find the first occurrence in S of any character in ACCEPT. */
|
||||
extern char *strpbrk (const char *s, const char *accept);
|
||||
|
||||
#endif
|
@ -1,96 +0,0 @@
|
||||
/* Copyright (C) 1992,1995-1999,2000-2002,2005-2006 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/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#if !_LIBC
|
||||
# ifdef HAVE_W32CE_SYSTEM
|
||||
# include <gpg-error.h>
|
||||
# define __set_errno(ev) gpg_err_set_errno ((ev))
|
||||
# else
|
||||
# define __set_errno(ev) ((errno) = (ev))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !_LIBC
|
||||
# define __environ environ
|
||||
# ifndef HAVE_ENVIRON_DECL
|
||||
extern char **environ;
|
||||
# endif
|
||||
#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
|
||||
|
||||
|
||||
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
|
107
gl/xsize.h
107
gl/xsize.h
@ -1,107 +0,0 @@
|
||||
/* xsize.h -- Checked size_t computations.
|
||||
|
||||
Copyright (C) 2003 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
|
||||
|
||||
/* 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. */
|
||||
static 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. */
|
||||
static 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. */
|
||||
static 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. */
|
||||
static 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 an inline function, so that it works correctly even
|
||||
when N is of a wider tupe 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)
|
||||
|
||||
#endif /* _XSIZE_H */
|
@ -54,8 +54,8 @@ libkeybox_a_SOURCES = $(common_sources)
|
||||
# requires it - although we don't actually need it. It is easier
|
||||
# to do it this way.
|
||||
kbxutil_SOURCES = kbxutil.c $(common_sources)
|
||||
kbxutil_LDADD = ../common/libcommon.a ../gl/libgnu.a \
|
||||
kbxutil_LDADD = ../common/libcommon.a \
|
||||
$(KSBA_LIBS) $(LIBGCRYPT_LIBS) $(extra_libs) \
|
||||
$(GPG_ERROR_LIBS) $(LIBINTL) $(LIBICONV) $(W32SOCKLIBS)
|
||||
|
||||
$(PROGRAMS) : ../common/libcommon.a ../gl/libgnu.a
|
||||
$(PROGRAMS) : ../common/libcommon.a
|
||||
|
@ -45,7 +45,7 @@ scdaemon_SOURCES = \
|
||||
app.c app-common.h app-help.c $(card_apps)
|
||||
|
||||
|
||||
scdaemon_LDADD = $(libcommonpth) ../gl/libgnu.a \
|
||||
scdaemon_LDADD = $(libcommonpth) \
|
||||
$(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(LIBASSUAN_LIBS) $(NPTH_LIBS) \
|
||||
$(LIBUSB_LIBS) $(GPG_ERROR_LIBS) \
|
||||
$(LIBINTL) $(DL_LIBS) $(NETLIBS) $(LIBICONV) $(resource_objs)
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include "iso7816.h"
|
||||
#include "apdu.h"
|
||||
#include "ccid-driver.h"
|
||||
#include "mkdtemp.h"
|
||||
#include "gc-opt-flags.h"
|
||||
#include "asshelp.h"
|
||||
#include "../common/init.h"
|
||||
|
@ -57,7 +57,7 @@ gpgsm_SOURCES = \
|
||||
qualified.c
|
||||
|
||||
|
||||
common_libs = ../kbx/libkeybox.a $(libcommon) ../gl/libgnu.a
|
||||
common_libs = ../kbx/libkeybox.a $(libcommon)
|
||||
|
||||
gpgsm_LDADD = $(common_libs) ../common/libgpgrl.a \
|
||||
$(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(LIBASSUAN_LIBS) \
|
||||
|
@ -69,8 +69,8 @@ if !HAVE_W32CE_SYSTEM
|
||||
noinst_PROGRAMS = clean-sat mk-tdata make-dns-cert gpgsplit
|
||||
endif
|
||||
|
||||
common_libs = $(libcommon) ../gl/libgnu.a
|
||||
commonpth_libs = $(libcommonpth) ../gl/libgnu.a
|
||||
common_libs = $(libcommon)
|
||||
commonpth_libs = $(libcommonpth)
|
||||
|
||||
# Some modules require PTH under W32CE.
|
||||
if HAVE_W32CE_SYSTEM
|
||||
|
@ -90,7 +90,6 @@
|
||||
#include "i18n.h"
|
||||
#include "../common/util.h"
|
||||
#include "../common/init.h"
|
||||
#include "mkdtemp.h"
|
||||
|
||||
/* FIXME: Bah. For spwq_secure_free. */
|
||||
#define SIMPLE_PWQUERY_IMPLEMENTATION 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user