diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-08-08 22:39:54 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-08-08 23:21:35 -0700 |
commit | 1ed63b5d0630a4b5b4a8d31174d9f3e95a970913 (patch) | |
tree | 47373d65dd7495380858f848fda5368d1dcb180c /CMakeLists.txt | |
parent | dfcccf43766e22aec8793b0a3f963d5ec5a52b80 (diff) | |
download | tcpdump-1ed63b5d0630a4b5b4a8d31174d9f3e95a970913.tar.gz |
Remove more old-compiler compensation.
We require an environment with a C99-compatible snprintf(), so we don't
need to work around older implementations. Make the configuration
process fail if we don't have snprintf() and vsnprintf().
We require at least VS 2015, so we don't have to check for _MSC_VER >=
1400. Make the build fail if we don't have at least VS 2015.
We apparently do, however, have to use __inline, as the VS 2015
documentation doesn't meaning plain old "inline". Update a comment.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 08d2d249..1c5f80da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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} |