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.
pull/12/head
Daniel Stenberg 11 years ago
parent efdd616118
commit f19387dd72
  1. 18
      acinclude.m4
  2. 25
      ares_nowarn.c
  3. 1
      configure.ac

@ -1743,24 +1743,6 @@ cat >>confdefs.h <<_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 -------------------------------------------------
dnl Find out suitable ares_socklen_t data type definition and size, making

@ -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
* software and its documentation for any purpose and without
@ -21,6 +21,10 @@
# include <assert.h>
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#if defined(__INTEL_COMPILER) && defined(__unix__)
#ifdef HAVE_NETINET_IN_H
@ -65,20 +69,13 @@
# error "SIZEOF_INT not defined"
#endif
#if (CARES_SIZEOF_LONG == 2)
# define CARES_MASK_SLONG 0x7FFFL
# define CARES_MASK_ULONG 0xFFFFUL
#elif (CARES_SIZEOF_LONG == 4)
# 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
#ifndef HAVE_LIMITS_H
/* systems without <limits.h> we guess have 32 bit longs */
#define CARES_MASK_SLONG 0x7FFFFFFFL
#define CARES_MASK_ULONG 0xFFFFFFFFUL
#else
# error "CARES_SIZEOF_LONG not defined"
#define CARES_MASK_ULONG ULONG_MAX
#define CARES_MASK_SLONG LONG_MAX
#endif
/*

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

Loading…
Cancel
Save