]> The Tcpdump Group git mirrors - tcpdump/blobdiff - CMakeLists.txt
Remove more old-compiler compensation.
[tcpdump] / CMakeLists.txt
index 08d2d249ce71aef7b094b107e08f57865c1a8020..1c5f80da4bea556220bd570d15f538ff7135fc31 100644 (file)
@@ -278,37 +278,28 @@ else(STDLIBS_HAVE_GETSERVENT)
 endif(STDLIBS_HAVE_GETSERVENT)
 cmake_pop_check_state()
 
-check_function_exists(getopt_long HAVE_GETOPT_LONG)
-#
-# For Windows, either
-#
-#   1) we're using VS 2015, in which case we have both snprintf()
-#      and vsnprintf(), and they behave in a C99-compliant fashion,
-#      so we use them
-#
-# or
 #
-#   2) we're not, and we don't have snprintf(), and we either don't
-#      have vsnprintf() or we have one that *doesn't* behave in a
-#      C99-compliant fashion, but we *do* have _snprintf_s() and
-#      _vsnprintf_s(), so we wrap them with #defines
+# Make sure we have vsnprintf() and snprintf(); we require them.
 #
-# and we test for both of them at compile time, so we don't need to
-# check for snprintf() or vsnprintf() here.
-#
-# XXX - do we need to care about UN*Xes that don't have snprintf()
-# or vsnprintf() any more?
+check_function_exists(vsnprintf 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)
+if(NOT HAVE_SNPRINTF)
+    message(FATAL_ERROR "snprintf() is required but wasn't found")
+endif()
+
+check_function_exists(getopt_long HAVE_GETOPT_LONG)
+check_function_exists(strftime HAVE_STRFTIME)
+check_function_exists(setlinebuf HAVE_SETLINEBUF)
 #
-# We also don't need to waste time checking for fork() or vfork().
+# For Windows,  don't need to waste time checking for fork() or vfork().
 #
 if(NOT WIN32)
-  check_function_exists(vsnprintf HAVE_VSNPRINTF)
-  check_function_exists(snprintf HAVE_SNPRINTF)
   check_function_exists(fork HAVE_FORK)
   check_function_exists(vfork HAVE_VFORK)
 endif(NOT WIN32)
-check_function_exists(strftime HAVE_STRFTIME)
-check_function_exists(setlinebuf HAVE_SETLINEBUF)
 
 #
 # Some platforms may need -lnsl for getrpcbynumber.
@@ -1116,11 +1107,6 @@ foreach(FUNC strlcat strlcpy strdup strsep getservent getopt_long)
         set(NETDISSECT_SOURCE_LIST_C ${NETDISSECT_SOURCE_LIST_C} missing/${FUNC}.c)
     endif()
 endforeach()
-if(NOT WIN32)
-    if(NOT HAVE_VSNPRINTF OR NOT HAVE_SNPRINTF)
-        set(NETDISSECT_SOURCE_LIST_C ${NETDISSECT_SOURCE_LIST_C} missing/snprintf.c)
-    endif(NOT HAVE_VSNPRINTF OR NOT HAVE_SNPRINTF)
-endif(NOT WIN32)
 
 add_library(netdissect STATIC
     ${NETDISSECT_SOURCE_LIST_C}