diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-04-06 22:58:43 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-04-06 22:58:43 +0200 |
commit | 6e65abbe636f52ba76c2ed6763bb40f9f9bedf15 (patch) | |
tree | 8063394841c4f031af60ed49f54f58cfe62f8b31 | |
parent | bda836d74461b3c06eaeeb906fa6197e5bde42e7 (diff) | |
download | libssh-6e65abbe636f52ba76c2ed6763bb40f9f9bedf15.tar.gz libssh-6e65abbe636f52ba76c2ed6763bb40f9f9bedf15.tar.xz libssh-6e65abbe636f52ba76c2ed6763bb40f9f9bedf15.zip |
Fix vsnprintf symbol on older VS2003 compiler
-rw-r--r-- | ConfigureChecks.cmake | 5 | ||||
-rw-r--r-- | config.h.cmake | 6 | ||||
-rw-r--r-- | include/libssh/priv.h | 9 |
3 files changed, 20 insertions, 0 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index d3dec1ab..03b55282 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -39,6 +39,11 @@ if (WIN32) set(HAVE_GETHOSTBYNAME TRUE) endif (HAVE_WSPIAPI_H OR HAVE_WS2TCPIP_H) + check_function_exists(vsnprintf HAVE_VSNPRINTF) + if(NOT HAVE_VSNPRINTF) + check_function_exists(_vsnprintf HAVE__VSNPRINTF) + endif(NOT HAVE_VSNPRINTF) + set(HAVE_SELECT TRUE) endif (WIN32) diff --git a/config.h.cmake b/config.h.cmake index 8ef29ff2..6aaab2f2 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -37,6 +37,12 @@ /*************************** FUNCTIONS ***************************/ +/* Define to 1 if you have the `vsnprintf' function. */ +#cmakedefine HAVE_VSNPRINTF + +/* Define to 1 if you have the `_vsnprintf' function. */ +#cmakedefine HAVE__VSNPRINTF + /* Define to 1 if you have the `cfmakeraw' function. */ #cmakedefine HAVE_CFMAKERAW 1 diff --git a/include/libssh/priv.h b/include/libssh/priv.h index ed607da7..81bb7510 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -34,6 +34,15 @@ #ifdef _MSC_VER #define snprintf _snprintf + +#ifndef HAVE_VSNPRINTF +#ifdef HAVE__VSNPRINTF +#define vsnprintf _vsnprintf +#else +#error "neither vsnprintf or vnsprintf available, this may fail" +#endif /* HAVE__VSNPRINTF */ +#endif /* HAVE_VSNPRINTF */ + /** Imitate define of inttypes.h */ #define PRIdS "Id" #define strcasecmp _stricmp |