aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2012-12-03 14:00:06 +0100
committerAndreas Schneider <asn@cryptomilk.org>2012-12-03 14:00:06 +0100
commitb14df297fa72a9c40a6548b11e70185877abe0de (patch)
tree9bcbdd0de87f33039cfc57e9be659bf79dc0b208
parent3896aa43ffe5d4e55f42065529ecaa8fdb39ed04 (diff)
downloadlibssh-b14df297fa72a9c40a6548b11e70185877abe0de.tar.gz
libssh-b14df297fa72a9c40a6548b11e70185877abe0de.tar.xz
libssh-b14df297fa72a9c40a6548b11e70185877abe0de.zip
BUG 97: Fix strtoull() detection on serveral platforms.
-rw-r--r--ConfigureChecks.cmake2
-rw-r--r--config.h.cmake6
-rw-r--r--include/libssh/priv.h14
3 files changed, 21 insertions, 1 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index dba176ed..b0485d98 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -139,6 +139,8 @@ if (UNIX)
check_function_exists(cfmakeraw HAVE_CFMAKERAW)
check_function_exists(ntohll HAVE_NTOHLL)
check_function_exists(htonll HAVE_HTONLL)
+ check_function_exists(strtoull HAVE_STRTOULL)
+ check_function_exists(__strtoull HAVE___STRTOULL)
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 4f0f9570..2014e8d9 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -100,6 +100,12 @@
/* Define to 1 if you have the `htonll' function. */
#cmakedefine HAVE_HTONLL 1
+/* Define to 1 if you have the `strtoull' function. */
+#cmakedefine HAVE_STRTOULL 1
+
+/* Define to 1 if you have the `__strtoull' function. */
+#cmakedefine HAVE___STRTOULL 1
+
/*************************** LIBRARIES ***************************/
/* Define to 1 if you have the `crypto' library (-lcrypto). */
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 4e51e0fd..89df493d 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -47,6 +47,16 @@
# endif /* __WORDSIZE */
# endif /* PRIu64 */
+#if !defined(HAVE_STRTOULL)
+# if defined(HAVE___STRTOULL)
+# define strtoull __strtoull
+# elif defined(__hpux) && defined(__LP64__)
+# define strtoull strtoul
+# else
+# error "no strtoull function found"
+# endif
+#endif /* !defined(HAVE_STRTOULL) */
+
# ifdef _MSC_VER
# include <stdio.h>
@@ -56,7 +66,9 @@
# define strcasecmp _stricmp
# define strncasecmp _strnicmp
-# define strtoull _strtoui64
+# if !defined(HAVE_STRTOULL)
+# define strtoull _strtoui64
+# endif
# define isblank(ch) ((ch) == ' ' || (ch) == '\t' || (ch) == '\n' || (ch) == '\r')
# define usleep(X) Sleep(((X)+1000)/1000)