From 35602ac111564b7908cfbe54c6fd85671f5623d5 Mon Sep 17 00:00:00 2001 From: "Manuel Sanmartin (no email)" Date: Tue, 9 Mar 2010 16:12:51 +0100 Subject: [PATCH] configure.in: Check for "htonll". The first patch adds support to check if the htonl and htonll functions (which are used in AIX port) are available in configure. Until now the AIX port used these functions without perform any existence test. Signed-off-by: Florian Forster --- configure.in | 21 +++++++++++++++++++++ src/common.c | 2 ++ src/common.h | 2 ++ 3 files changed, 25 insertions(+) diff --git a/configure.in b/configure.in index 5daf533d..f46a3624 100644 --- a/configure.in +++ b/configure.in @@ -906,6 +906,27 @@ if test "x$have_getmntent" = "xgen"; then [Define if the function getmntent exists. It's the version from libgen.]) fi +# Check for htonll +AC_MSG_CHECKING([if have htonll defined]) + + have_htonll="no" + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([ +#include +#include +#ifdef HAVE_INTTYPES_H +#include +#endif + ], [ + return htonll(0); + ]) + ], [ + have_htonll="yes" + AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.]) + ]) + +AC_MSG_RESULT([$have_htonll]) + # Check for structures AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors], [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])], diff --git a/src/common.c b/src/common.c index 7c2c30ec..b9e41b1d 100644 --- a/src/common.c +++ b/src/common.c @@ -659,6 +659,7 @@ long long get_kstat_value (kstat_t *ksp, char *name) } #endif /* HAVE_LIBKSTAT */ +#ifndef HAVE_HTONLL unsigned long long ntohll (unsigned long long n) { #if BYTE_ORDER == BIG_ENDIAN @@ -676,6 +677,7 @@ unsigned long long htonll (unsigned long long n) return (((unsigned long long) htonl (n)) << 32) + htonl (n >> 32); #endif } /* unsigned long long htonll */ +#endif /* HAVE_HTONLL */ #if FP_LAYOUT_NEED_NOTHING /* Well, we need nothing.. */ diff --git a/src/common.h b/src/common.h index 6682e1c8..8a9f3357 100644 --- a/src/common.h +++ b/src/common.h @@ -236,8 +236,10 @@ int get_kstat (kstat_t **ksp_ptr, char *module, int instance, char *name); long long get_kstat_value (kstat_t *ksp, char *name); #endif +#ifndef HAVE_HTONLL unsigned long long ntohll (unsigned long long n); unsigned long long htonll (unsigned long long n); +#endif #if FP_LAYOUT_NEED_NOTHING # define ntohd(d) (d) -- 2.11.0