nowarn: use <limits.h> instead of configure for size of long

This makes the header file much more multi-arch friendly and can be used
as-is with both 32 bit and 64 bit builds.
This commit is contained in:
Daniel Stenberg 2013-08-27 13:36:41 +02:00
parent efdd616118
commit f19387dd72
3 changed files with 11 additions and 33 deletions

View File

@ -1743,24 +1743,6 @@ cat >>confdefs.h <<_EOF
_EOF _EOF
]) ])
dnl CARES_CONFIGURE_LONG
dnl -------------------------------------------------
dnl Find out the size of long as reported by sizeof() and define
dnl CARES_SIZEOF_LONG as appropriate to be used in template file
dnl ares_build.h.in to properly configure the library.
dnl The size of long is a build time characteristic and as such
dnl must be recorded in ares_build.h
AC_DEFUN([CARES_CONFIGURE_LONG], [
if test -z "$ac_cv_sizeof_long" ||
test "$ac_cv_sizeof_long" -eq "0"; then
AC_MSG_ERROR([cannot find out size of long.])
fi
CARES_DEFINE_UNQUOTED([CARES_SIZEOF_LONG], [$ac_cv_sizeof_long])
])
dnl CARES_CONFIGURE_ARES_SOCKLEN_T dnl CARES_CONFIGURE_ARES_SOCKLEN_T
dnl ------------------------------------------------- dnl -------------------------------------------------
dnl Find out suitable ares_socklen_t data type definition and size, making dnl Find out suitable ares_socklen_t data type definition and size, making

View File

@ -1,5 +1,5 @@
/* Copyright (C) 2010-2012 by Daniel Stenberg /* Copyright (C) 2010-2013 by Daniel Stenberg
* *
* Permission to use, copy, modify, and distribute this * Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without * software and its documentation for any purpose and without
@ -21,6 +21,10 @@
# include <assert.h> # include <assert.h>
#endif #endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#if defined(__INTEL_COMPILER) && defined(__unix__) #if defined(__INTEL_COMPILER) && defined(__unix__)
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
@ -65,20 +69,13 @@
# error "SIZEOF_INT not defined" # error "SIZEOF_INT not defined"
#endif #endif
#if (CARES_SIZEOF_LONG == 2) #ifndef HAVE_LIMITS_H
# define CARES_MASK_SLONG 0x7FFFL /* systems without <limits.h> we guess have 32 bit longs */
# define CARES_MASK_ULONG 0xFFFFUL #define CARES_MASK_SLONG 0x7FFFFFFFL
#elif (CARES_SIZEOF_LONG == 4) #define CARES_MASK_ULONG 0xFFFFFFFFUL
# define CARES_MASK_SLONG 0x7FFFFFFFL
# define CARES_MASK_ULONG 0xFFFFFFFFUL
#elif (CARES_SIZEOF_LONG == 8)
# define CARES_MASK_SLONG 0x7FFFFFFFFFFFFFFFL
# define CARES_MASK_ULONG 0xFFFFFFFFFFFFFFFFUL
#elif (CARES_SIZEOF_LONG == 16)
# define CARES_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL
# define CARES_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL
#else #else
# error "CARES_SIZEOF_LONG not defined" #define CARES_MASK_ULONG ULONG_MAX
#define CARES_MASK_SLONG LONG_MAX
#endif #endif
/* /*

View File

@ -457,7 +457,6 @@ AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(short)
CARES_CONFIGURE_LONG
AC_CHECK_SIZEOF(time_t) AC_CHECK_SIZEOF(time_t)
AC_CHECK_TYPE(long long, AC_CHECK_TYPE(long long,