]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use check_symbol_exists() for vsnprintf() and snprintf().
authorGuy Harris <[email protected]>
Fri, 9 Aug 2019 18:46:19 +0000 (11:46 -0700)
committerGuy Harris <[email protected]>
Fri, 9 Aug 2019 18:46:19 +0000 (11:46 -0700)
At least with Visual Studio, they're inline functions that call a common
external function, so check_function_exists() doesn't find them.

Clean up indentation while we're at it.

CMakeLists.txt

index 1c5f80da4bea556220bd570d15f538ff7135fc31..033cef25740b6ad9ce1bce525b58635ca9ceddc3 100644 (file)
@@ -280,12 +280,15 @@ cmake_pop_check_state()
 
 #
 # Make sure we have vsnprintf() and snprintf(); we require them.
+# We use check_symbol_exists(), as they aren't necessarily external
+# functions - in Visual Studio, for example, they're inline functions
+# calling a common external function.
 #
-check_function_exists(vsnprintf HAVE_VSNPRINTF)
+check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF)
 if(NOT HAVE_VSNPRINTF)
     message(FATAL_ERROR "vsnprintf() is required but wasn't found")
 endif(NOT HAVE_VSNPRINTF)
-check_function_exists(snprintf HAVE_SNPRINTF)
+check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
 if(NOT HAVE_SNPRINTF)
     message(FATAL_ERROR "snprintf() is required but wasn't found")
 endif()
@@ -297,8 +300,8 @@ check_function_exists(setlinebuf HAVE_SETLINEBUF)
 # For Windows,  don't need to waste time checking for fork() or vfork().
 #
 if(NOT WIN32)
-  check_function_exists(fork HAVE_FORK)
-  check_function_exists(vfork HAVE_VFORK)
+    check_function_exists(fork HAVE_FORK)
+    check_function_exists(vfork HAVE_VFORK)
 endif(NOT WIN32)
 
 #