Commit 1adf719b authored by Werner Koch's avatar Werner Koch

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: 's avatarWerner Koch <wk@gnupg.org>
parent 7362c8c6
......@@ -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
......
......@@ -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)
## 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
/* 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 */
/* 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
/* 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 */
# 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
}
# 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
# 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], [:])
# 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])
])
# 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])