Revert "In get_unicode_or_ascii_string(), check if the length is odd/even, not the...
[metze/wireshark/wip.git] / ConfigureChecks.cmake
index f36ada153bc6dc2f5d623fbac66c4a2bbc0422ad..b4402b0ab27e3bb70ff2e92eead97264a3142214 100644 (file)
@@ -21,7 +21,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
 
-# todo: result for NEED_... is wrong (inverted)
+include(CMakePushCheckState)
 
 #check system for includes
 include(CheckIncludeFile)
@@ -33,15 +33,16 @@ 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("g_ascii_strtoull.h"  NEED_G_ASCII_STRTOULL_H)
-check_include_file("inet/aton.h"         NEED_INET_ATON_H)
+check_include_file("inet/aton.h"         HAVE_INET_ATON_H)
 check_include_file("inttypes.h"          HAVE_INTTYPES_H)
-check_include_file("lauxlib.h"           HAVE_LAUXLIB_H)
 check_include_file("memory.h"            HAVE_MEMORY_H)
 check_include_file("netinet/in.h"        HAVE_NETINET_IN_H)
 check_include_file("netdb.h"             HAVE_NETDB_H)
-# XXX: We need to set the path to Wpdpack in order to find Ntddndis.h
-check_include_file("Ntddndis.h"          HAVE_NTDDNDIS_H)
+# We need to set the path to Wpdpack in order to find Ntddndis.h
+#cmake_push_check_state()
+#set(CMAKE_REQUIRED_INCLUDES %{PCAP_INCLUDE_DIRS})
+#check_include_file("Ntddndis.h"          HAVE_NTDDNDIS_H)
+#cmake_pop_check_state()
 check_include_file("portaudio.h"         HAVE_PORTAUDIO_H)
 check_include_file("pwd.h"               HAVE_PWD_H)
 check_include_file("stdarg.h"            HAVE_STDARG_H)
@@ -66,6 +67,21 @@ check_include_file("winsock2.h"          HAVE_WINSOCK2_H)
 #Functions
 include(CheckFunctionExists)
 check_function_exists("chown"            HAVE_CHOWN)
+
+cmake_push_check_state()
+#
+# XXX - this is *not* finding dladdr() on OS X (at least not on
+# Mountain Lion), even though it's available; autoconf does find
+# it.  The dl* functions can be tricky, in that they might be
+# exported by the run-time linker rather than by any library,
+# so the only way to check for it that might work is "can I link
+# a program that calls this function?", not, for example, "do
+# any of these libraries define this function?"
+#
+set(CMAKE_REQUIRED_LIBRARIES %{CMAKE_DL_LIBS})
+check_function_exists("dladdr"           HAVE_DLADDR)
+cmake_pop_check_state()
+
 check_function_exists("gethostbyname2"   HAVE_GETHOSTBYNAME2)
 check_function_exists("getopt"           HAVE_GETOPT)
 check_function_exists("getprotobynumber" HAVE_GETPROTOBYNUMBER)
@@ -75,11 +91,15 @@ check_function_exists("mmap"             HAVE_MMAP)
 check_function_exists("mprotect"         HAVE_MPROTECT)
 check_function_exists("mkdtemp"          HAVE_MKDTEMP)
 check_function_exists("mkstemp"          HAVE_MKSTEMP)
+check_function_exists("setresgid"        HAVE_SETRESGID)
+check_function_exists("setresuid"        HAVE_SETRESUID)
 check_function_exists("sysconf"          HAVE_SYSCONF)
 
 #Struct members
 include(CheckStructHasMember)
-check_struct_has_member("struct tm"  tm_zone  time.h  HAVE_TM_ZONE)
+check_struct_has_member("struct sockaddr" sa_len   sys/socket.h HAVE_SA_LEN)
+check_struct_has_member("struct stat"     st_flags sys/stat.h   HAVE_ST_FLAGS)
+check_struct_has_member("struct tm"       tm_zone  time.h       HAVE_TM_ZONE)
 
 #Symbols but NOT enums or types
 include(CheckSymbolExists)