aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-06-06 18:56:30 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-06-06 18:57:50 +0200
commita493a90c5925d44aa11dbad0962d5fcb75001c22 (patch)
treedbf71774f4dbd21ec2d832104f32511657d38d09
parent4a18df8574e97f13a6f96d6704180a6f6010ff44 (diff)
downloadlibssh-a493a90c5925d44aa11dbad0962d5fcb75001c22.tar.gz
libssh-a493a90c5925d44aa11dbad0962d5fcb75001c22.tar.xz
libssh-a493a90c5925d44aa11dbad0962d5fcb75001c22.zip
build: Check for ntohll().
This function is available on AIX. (cherry picked from commit 640e3830f295baae596cc34ec2fc79fc08807d0f)
-rw-r--r--ConfigureChecks.cmake1
-rw-r--r--config.h.cmake3
-rw-r--r--src/misc.c6
3 files changed, 8 insertions, 2 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index b2774776..e140f266 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -119,6 +119,7 @@ if (UNIX)
check_function_exists(select HAVE_SELECT)
check_function_exists(cfmakeraw HAVE_CFMAKERAW)
check_function_exists(regcomp HAVE_REGCOMP)
+ check_function_exists(ntohll HAVE_NTOHLL)
endif (UNIX)
set(LIBSSH_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "libssh required system libraries")
diff --git a/config.h.cmake b/config.h.cmake
index 9c2e98ca..a40fa389 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -80,6 +80,9 @@
/* Define to 1 if you have the `clock_gettime' function. */
#cmakedefine HAVE_CLOCK_GETTIME 1
+/* Define to 1 if you have the `ntohll' function. */
+#cmakedefine HAVE_NTOHLL 1
+
/*************************** LIBRARIES ***************************/
/* Define to 1 if you have the `crypto' library (-lcrypto). */
diff --git a/src/misc.c b/src/misc.c
index 008be1b7..43ac7013 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -286,18 +286,20 @@ int ssh_is_ipaddr(const char *str) {
#endif /* _WIN32 */
+#ifndef HAVE_NTOHLL
uint64_t ntohll(uint64_t a) {
#ifdef WORDS_BIGENDIAN
return a;
-#else
+#else /* WORDS_BIGENDIAN */
uint32_t low = (uint32_t)(a & 0xffffffff);
uint32_t high = (uint32_t)(a >> 32);
low = ntohl(low);
high = ntohl(high);
return ((((uint64_t) low) << 32) | ( high));
-#endif
+#endif /* WORDS_BIGENDIAN */
}
+#endif /* HAVE_NTOHLL */
char *ssh_lowercase(const char* str) {
char *new, *p;