diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | configure.ac | 15 | ||||
-rw-r--r-- | m4/ChangeLog | 4 | ||||
-rw-r--r-- | m4/fallback.m4 | 180 | ||||
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/gcrypt.h.in (renamed from src/gcrypt.h) | 2 |
7 files changed, 214 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2006-10-10 Marcus Brinkmann <marcus@g10code.de> + + * configure.ac: Invoke AC_CHECK_SOCKLEN_TYPE. + (AC_CONFIG_FILES): Add src/gcrypt.h. + (AC_CONFIG_SRCDIR): Change to src/libgcrypt.vers. + 2006-08-29 Werner Koch <wk@g10code.com> * configure.ac (USE_SEED): New. diff --git a/configure.ac b/configure.ac index bcbea2e5..bc6c876b 100644 --- a/configure.ac +++ b/configure.ac @@ -46,7 +46,7 @@ NEED_GPG_ERROR_VERSION=1.0 PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION -AC_CONFIG_SRCDIR([src/gcrypt.h]) +AC_CONFIG_SRCDIR([src/libgcrypt.vers]) AC_CANONICAL_TARGET() AM_INIT_AUTOMAKE($PACKAGE, $VERSION) AM_CONFIG_HEADER(config.h) @@ -851,12 +851,25 @@ AC_SUBST(LIBGCRYPT_CIPHERS, $enabled_ciphers) AC_SUBST(LIBGCRYPT_PUBKEY_CIPHERS, $enabled_pubkey_ciphers) AC_SUBST(LIBGCRYPT_DIGESTS, $enabled_digests) +dnl # Fallback definitions for gcrypt.h: +dnl # +dnl # check for network/socket size type +AC_CHECK_SOCKLENTYPE([ +FALLBACK_SOCKLEN_T="typedef ${ac_type} socklen_t;" +if test ".$ac_type" = ".socklen_t"; then + FALLBACK_SOCKLEN_T="/* $FALLBACK_SOCKLEN_T */" +fi +AC_SUBST(FALLBACK_SOCKLEN_T) +]) + + AC_CONFIG_FILES([ Makefile mpi/Makefile cipher/Makefile doc/Makefile src/Makefile +src/gcrypt.h src/libgcrypt-config tests/Makefile w32-dll/Makefile diff --git a/m4/ChangeLog b/m4/ChangeLog index d0d29b46..f365a8f1 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,7 @@ +2006-10-10 Marcus Brinkmann <marcus@g10code.de> + + * fallback.m4: New file from Pth. + 2006-07-04 Marcus Brinkmann <marcus@g10code.de> * sys_socket_h.m4, socklen.m4, onceonly.m4: New files from gnulib. diff --git a/m4/fallback.m4 b/m4/fallback.m4 new file mode 100644 index 00000000..ed560c74 --- /dev/null +++ b/m4/fallback.m4 @@ -0,0 +1,180 @@ +dnl ## +dnl ## GNU Pth - The GNU Portable Threads +dnl ## Copyright (c) 1999-2004 Ralf S. Engelschall <rse@engelschall.com> +dnl ## +dnl ## This file is part of GNU Pth, a non-preemptive thread scheduling +dnl ## library which can be found at http://www.gnu.org/software/pth/. +dnl ## +dnl ## This library is free software; you can redistribute it and/or +dnl ## modify it under the terms of the GNU Lesser General Public +dnl ## License as published by the Free Software Foundation; either +dnl ## version 2.1 of the License, or (at your option) any later version. +dnl ## +dnl ## This library is distributed in the hope that it will be useful, +dnl ## but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl ## Lesser General Public License for more details. +dnl ## +dnl ## You should have received a copy of the GNU Lesser General Public +dnl ## License along with this library; if not, write to the Free Software +dnl ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +dnl ## USA, or contact Ralf S. Engelschall <rse@engelschall.com>. +dnl ## +dnl ## aclocal.m4: Pth Autoconf macros +dnl ## + dnl # ``"Reuse an expert's code" is the right + dnl # advice for most people. But it's a useless + dnl # advice for the experts writing the code + dnl # in the first place.' + dnl # -- Dan J. Bernstein + +dnl ## +dnl ## Check for socket/network size type +dnl ## +dnl ## configure.ac: +dnl ## AC_CHECK_SOCKLENTYPE(<action-with-${ac_type}>) +dnl ## + + +dnl ## +dnl ## Check for an ANSI C typedef in a header +dnl ## +dnl ## configure.ac: +dnl ## AC_CHECK_TYPEDEF(<typedef>, <header>) +dnl ## acconfig.h: +dnl ## #undef HAVE_<typedef> +dnl ## + +AC_DEFUN(AC_CHECK_TYPEDEF,[dnl +AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for typedef $1) +AC_CACHE_VAL(ac_cv_typedef_$1, +[AC_EGREP_CPP(dnl +changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl +changequote([,]), [ +#include <$2> +], ac_cv_typedef_$1=yes, ac_cv_typedef_$1=no)])dnl +AC_MSG_RESULT($ac_cv_typedef_$1) +if test $ac_cv_typedef_$1 = yes; then + AC_DEFINE(HAVE_[]translit($1, [a-z], [A-Z]), 1, + [define if typedef $1 exists in header $2]) +fi +]) + + +dnl ## +dnl ## Check for argument type of a function +dnl ## +dnl ## configure.ac: +dnl ## AC_CHECK_ARGTYPE(<header> [...], <func>, <arg-number>, +dnl ## <max-arg-number>, <action-with-${ac_type}>) +dnl ## + +AC_DEFUN(AC_CHECK_ARGTYPE,[dnl +AC_REQUIRE_CPP()dnl +AC_MSG_CHECKING([for type of argument $3 for $2()]) +AC_CACHE_VAL([ac_cv_argtype_$2$3],[ +cat >conftest.$ac_ext <<EOF +[#]line __oline__ "configure" +#include "confdefs.h" +EOF +for ifile in $1; do + echo "#include <$ifile>" >>conftest.$ac_ext +done +gpat='' +spat='' +i=1 +changequote(, )dnl +while test $i -le $4; do + gpat="$gpat[^,]*" + if test $i -eq $3; then + spat="$spat\\([^,]*\\)" + else + spat="$spat[^,]*" + fi + if test $i -lt $4; then + gpat="$gpat," + spat="$spat," + fi + i=`expr $i + 1` +done +changequote([, ])dnl +(eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |\ +changequote(, )dnl +sed -e ':join' \ + -e '/,[ ]*$/N' \ + -e 's/,[ ]*\n[ ]*/, /' \ + -e 'tjoin' |\ +egrep "[^a-zA-Z0-9_]$2[ ]*\\($gpat\\)" | head -1 |\ +sed -e "s/.*[^a-zA-Z0-9_]$2[ ]*($spat).*/\\1/" \ + -e 's/(\*[a-zA-Z_][a-zA-Z_0-9]*)/(*)/' \ + -e 's/^[ ]*//' -e 's/[ ]*$//' \ + -e 's/^/arg:/' \ + -e 's/^arg:\([^ ]*\)$/type:\1/' \ + -e 's/^arg:\(.*_t\)*$/type:\1/' \ + -e 's/^arg:\(.*\*\)$/type:\1/' \ + -e 's/^arg:\(.*[ ]\*\)[_a-zA-Z][_a-zA-Z0-9]*$/type:\1/' \ + -e 's/^arg:\(.*[ ]char\)$/type:\1/' \ + -e 's/^arg:\(.*[ ]short\)$/type:\1/' \ + -e 's/^arg:\(.*[ ]int\)$/type:\1/' \ + -e 's/^arg:\(.*[ ]long\)$/type:\1/' \ + -e 's/^arg:\(.*[ ]float\)$/type:\1/' \ + -e 's/^arg:\(.*[ ]double\)$/type:\1/' \ + -e 's/^arg:\(.*[ ]unsigned\)$/type:\1/' \ + -e 's/^arg:\(.*[ ]signed\)$/type:\1/' \ + -e 's/^arg:\(.*struct[ ][_a-zA-Z][_a-zA-Z0-9]*\)$/type:\1/' \ + -e 's/^arg:\(.*\)[ ]_[_a-zA-Z0-9]*$/type:\1/' \ + -e 's/^arg:\(.*\)[ ]\([^ ]*\)$/type:\1/' \ + -e 's/^type://' >conftest.output +ac_cv_argtype_$2$3=`cat conftest.output` +changequote([, ])dnl +rm -f conftest* +]) +AC_MSG_RESULT([$ac_cv_argtype_$2$3]) +ac_type="$ac_cv_argtype_$2$3" +[$5] +]) + + +dnl # Background: +dnl # this exists because of shortsightedness on the POSIX committee. +dnl # BSD systems used "int *" as the parameter to accept(2), +dnl # getsockname(2), getpeername(2) et al. Consequently many Unix +dnl # flavors took an "int *" for that parameter. The POSIX committee +dnl # decided that "int" was just too generic and had to be replaced +dnl # with "size_t" almost everywhere. There's no problem with that +dnl # when you're passing by value. But when you're passing by +dnl # reference (as it is the case for accept(2) and friends) this +dnl # creates a gross source incompatibility with existing programs. +dnl # On 32-bit architectures it creates only a warning. On 64-bit +dnl # architectures it creates broken code -- because "int *" is a +dnl # pointer to a 64-bit quantity and "size_t *" is usually a pointer +dnl # to a 32-bit quantity. Some Unix flavors adopted "size_t *" for +dnl # the sake of POSIX compliance. Others ignored it because it was +dnl # such a broken interface. Chaos ensued. POSIX finally woke up +dnl # and decided that it was wrong and created a new type socklen_t. +dnl # The only useful value for socklen_t is "int", and that's how +dnl # everyone who has a clue implements it. It is almost always the +dnl # case that this type should be defined to be an "int", unless the +dnl # system being compiled for was created in the window of POSIX +dnl # madness. + +AC_DEFUN(AC_CHECK_SOCKLENTYPE,[dnl +AC_CHECK_TYPEDEF(socklen_t, sys/socket.h) +AC_CHECK_ARGTYPE(sys/types.h sys/socket.h, accept, 3, 3, [:]) +AC_MSG_CHECKING(for fallback socklen_t) +AC_CACHE_VAL(ac_cv_check_socklentype, [ +if test ".$ac_cv_typedef_socklen_t" = .yes; then + ac_cv_check_socklentype='socklen_t' +elif test ".$ac_type" != .; then + ac_cv_check_socklentype=`echo "$ac_type" | sed -e 's/[ ]*\*$//'` +else + ac_cv_check_socklentype='int' +fi +]) +AC_MSG_RESULT([$ac_cv_check_socklentype]) +ac_type="$ac_cv_check_socklentype" +ifelse([$1], , :, [$1]) +]) + diff --git a/src/ChangeLog b/src/ChangeLog index f36744d0..c6f4df44 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2006-10-10 Marcus Brinkmann <marcus@g10code.de> + + * gcrypt.h: Add fallback type for socklen_t. Move to ... + * gcrypt.h.in: ... this file. + * Makefile.am (EXTRA_DIST): Add gcrypt.h.in. + 2006-08-29 Werner Koch <wk@g10code.com> * gcrypt.h (GCRY_CIPHER_SEED): New. diff --git a/src/Makefile.am b/src/Makefile.am index 1ca2f3ed..a5f3e4f0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,7 +18,8 @@ ## Process this file with automake to produce Makefile.in -EXTRA_DIST = Manifest libgcrypt-config.in libgcrypt.m4 libgcrypt.vers +EXTRA_DIST = Manifest libgcrypt-config.in libgcrypt.m4 libgcrypt.vers \ + gcrypt.h.in bin_SCRIPTS = libgcrypt-config m4datadir = $(datadir)/aclocal m4data_DATA = libgcrypt.m4 diff --git a/src/gcrypt.h b/src/gcrypt.h.in index fe4af3f7..e9debf8b 100644 --- a/src/gcrypt.h +++ b/src/gcrypt.h.in @@ -29,6 +29,8 @@ #include <sys/types.h> +@FALLBACK_SOCKLEN_T@ + #if defined _WIN32 || defined __WIN32__ # include <winsock2.h> # include <ws2tcpip.h> |