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 <octo@leeloo.lan.home.verplant.org>
[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 <sys/types.h>
+#include <netinet/in.h>
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#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.])],
}
#endif /* HAVE_LIBKSTAT */
+#ifndef HAVE_HTONLL
unsigned long long ntohll (unsigned long long n)
{
#if BYTE_ORDER == BIG_ENDIAN
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.. */
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)