])
+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
;;
esac
CARES_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SOCKLEN_T], [$cares_typeof_ares_socklen_t])
+ CARES_DEFINE_UNQUOTED([CARES_SIZEOF_ARES_SOCKLEN_T], [$cares_sizeof_ares_socklen_t])
])
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
/* ================================================================ */
+#ifdef CARES_SIZEOF_LONG
+# error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h"
+ Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined
+#endif
+
#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
#endif
+#ifdef CARES_SIZEOF_ARES_SOCKLEN_T
+# error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
+ Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined
+#endif
+
/* ================================================================ */
/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */
/* ================================================================ */
# include <sys/socket.h>
#endif
+/* The size of `long', as computed by sizeof. */
+#undef CARES_SIZEOF_LONG
+
/* Integral data type used for ares_socklen_t. */
#undef CARES_TYPEOF_ARES_SOCKLEN_T
+/* The size of `ares_socklen_t', as computed by sizeof. */
+#undef CARES_SIZEOF_ARES_SOCKLEN_T
+
/* Data type definition of ares_socklen_t. */
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
* Verify that some macros are actually defined.
*/
+#ifndef CARES_SIZEOF_LONG
+# error "CARES_SIZEOF_LONG definition is missing!"
+ Error Compilation_aborted_CARES_SIZEOF_LONG_is_missing
+#endif
+
#ifndef CARES_TYPEOF_ARES_SOCKLEN_T
# error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!"
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing
#endif
+#ifndef CARES_SIZEOF_ARES_SOCKLEN_T
+# error "CARES_SIZEOF_ARES_SOCKLEN_T definition is missing!"
+ Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_is_missing
+#endif
+
/*
* Macros private to this header file.
*/
#define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
/*
+ * Verify that the size previously defined and expected for long
+ * is the same as the one reported by sizeof() at compile time.
+ */
+
+typedef char
+ __cares_rule_01__
+ [CareschkszEQ(long, CARES_SIZEOF_LONG)];
+
+/*
+ * Verify that the size previously defined and expected for
+ * ares_socklen_t is actually the the same as the one reported
+ * by sizeof() at compile time.
+ */
+
+typedef char
+ __cares_rule_02__
+ [CareschkszEQ(ares_socklen_t, CARES_SIZEOF_ARES_SOCKLEN_T)];
+
+/*
* Verify at compile time that the size of ares_socklen_t as reported
* by sizeof() is greater or equal than the one reported for int for
* the current compilation.
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
+CARES_CONFIGURE_LONG
AC_CHECK_SIZEOF(time_t)
AC_CHECK_TYPE(long long,