forked from osmocom/wireshark
CMake: Check if vsnprinf() is C99-compliant
This commit is contained in:
parent
a2120e823c
commit
5de2b55663
|
@ -103,7 +103,31 @@ check_struct_has_member("struct tm" tm_zone time.h HAVE_STRUC
|
||||||
#Symbols but NOT enums or types
|
#Symbols but NOT enums or types
|
||||||
check_symbol_exists(tzname "time.h" HAVE_TZNAME)
|
check_symbol_exists(tzname "time.h" HAVE_TZNAME)
|
||||||
|
|
||||||
# Check for stuff that isn't testable via the tests above
|
#
|
||||||
|
# Check if the libc vsnprintf() conforms to C99. If this fails we may
|
||||||
|
# need to fall-back on GLib I/O.
|
||||||
|
#
|
||||||
|
check_c_source_runs("
|
||||||
|
#include <stdio.h>
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
/* Check that snprintf() and vsnprintf() don't return
|
||||||
|
* -1 if the buffer is too small. C99 says this value
|
||||||
|
* is the length that would be written not including
|
||||||
|
* the nul byte. */
|
||||||
|
char buf[3];
|
||||||
|
return snprintf(buf, sizeof(buf), \"%s\", \"ABCDEF\") > 0 ? 0 : 1;
|
||||||
|
}"
|
||||||
|
HAVE_C99_VSNPRINTF
|
||||||
|
)
|
||||||
|
if (NOT HAVE_C99_VSNPRINTF)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Building Wireshark requires a C99 compliant vsnprintf() and this \
|
||||||
|
target does not meet that requirement. Compiling for ${CMAKE_SYSTEM} \
|
||||||
|
using ${CMAKE_C_COMPILER_ID}. Please report this issue to the Wireshark \
|
||||||
|
developers at wireshark-dev@wireshark.org."
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
#
|
#
|
||||||
# *If* we found libnl, check if we can use nl80211 stuff with it.
|
# *If* we found libnl, check if we can use nl80211 stuff with it.
|
||||||
|
|
Loading…
Reference in New Issue