From 5bfc21cf9e42af13a8d1ad6eb545ab82cb7dbe9d Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 6 Jul 2014 14:02:39 -0700 Subject: Clean up handling of missing functions. With autotools, CMake, and nmake, if we have a function, #define HAVE_{function_name_in_all_caps}, otherwise don't #define it. If we provide our own version of a function in libwsutil, make sure we have a header that declares it, and *ONLY* include that header if HAVE_{function_name_in_all_caps} is *NOT* defined, so that we don't have the system declaration and our declaration colliding. Check for inet_aton, strncasecmp, and strptime with CMake, just as we do with autotools. Simplify the addition of {function_name_in_all_caps}_LO to libwsutil in autotools. Change-Id: Id5be5c73f79f81919a3a865324e400eca7b88889 Reviewed-on: https://code.wireshark.org/review/2903 Reviewed-by: Guy Harris --- ConfigureChecks.cmake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'ConfigureChecks.cmake') diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 918a62803d..cfa63150ea 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -31,7 +31,6 @@ check_include_file("dlfcn.h" HAVE_DLFCN_H) check_include_file("fcntl.h" HAVE_FCNTL_H) check_include_file("getopt.h" HAVE_GETOPT_H) check_include_file("grp.h" HAVE_GRP_H) -check_include_file("inet/aton.h" HAVE_INET_ATON_H) check_include_file("inttypes.h" HAVE_INTTYPES_H) check_include_file("memory.h" HAVE_MEMORY_H) check_include_file("netinet/in.h" HAVE_NETINET_IN_H) @@ -83,6 +82,7 @@ cmake_pop_check_state() check_function_exists("gethostbyname2" HAVE_GETHOSTBYNAME2) check_function_exists("getopt" HAVE_GETOPT) check_function_exists("getprotobynumber" HAVE_GETPROTOBYNUMBER) +check_function_exists("inet_aton" HAVE_INET_ATON) check_function_exists("inet_ntop" HAVE_INET_NTOP_PROTO) check_function_exists("issetugid" HAVE_ISSETUGID) check_function_exists("mmap" HAVE_MMAP) @@ -91,6 +91,18 @@ check_function_exists("mkdtemp" HAVE_MKDTEMP) check_function_exists("mkstemp" HAVE_MKSTEMP) check_function_exists("setresgid" HAVE_SETRESGID) check_function_exists("setresuid" HAVE_SETRESUID) + +# +# Windows doesn't have strncasecmp, but does have stricmp, which has +# the same signature and behavior. We #define strncasecmp to stricmp +# on Windows. +# +if(WIN32) + check_function_exists("stricmp" HAVE_STRNCASECMP) +else() + check_function_exists("strncasecmp" HAVE_STRNCASECMP) +endif() +check_function_exists("strptime" HAVE_STRPTIME) check_function_exists("sysconf" HAVE_SYSCONF) #Struct members -- cgit v1.2.1