Add valgrind support to randpkt-test.sh.
[metze/wireshark/wip.git] / ConfigureChecks.cmake
index 1e7a75ae55c091ad6ed0d82d05863206017fd99d..f6bf312b66ce72cbf7a1f3d88eb91a06af1cecd0 100644 (file)
@@ -23,9 +23,7 @@ check_include_file("sys/ioctl.h"         HAVE_SYS_IOCTL_H)
 check_include_file("sys/select.h"        HAVE_SYS_SELECT_H)
 check_include_file("sys/socket.h"        HAVE_SYS_SOCKET_H)
 check_include_file("sys/sockio.h"        HAVE_SYS_SOCKIO_H)
-check_include_file("sys/stat.h"          HAVE_SYS_STAT_H)
 check_include_file("sys/time.h"          HAVE_SYS_TIME_H)
-check_include_file("sys/types.h"         HAVE_SYS_TYPES_H)
 check_include_file("sys/utsname.h"       HAVE_SYS_UTSNAME_H)
 check_include_file("sys/wait.h"          HAVE_SYS_WAIT_H)
 check_include_file("unistd.h"            HAVE_UNISTD_H)
@@ -63,10 +61,24 @@ endif()
 include(CheckFunctionExists)
 include(CheckSymbolExists)
 
-cmake_push_check_state()
-set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS})
-check_function_exists("dladdr"           HAVE_DLADDR)
-cmake_pop_check_state()
+#
+# Platform-specific functions used in platform-specific code.
+# We check for them only on the platform on which we use them.
+#
+if(CMAKE_SYSTEM_NAME STREQUAL "HP-UX")
+       #
+       # HP-UX
+       #
+       cmake_push_check_state()
+       set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS})
+       check_function_exists("dlget"           HAVE_DLGET)
+       cmake_pop_check_state()
+elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
+       #
+       # Solaris
+       #
+       check_function_exists("getexecname"     HAVE_GETEXECNAME)
+endif()
 
 #
 # Use check_symbol_exists just in case math.h does something magic
@@ -76,21 +88,33 @@ cmake_push_check_state()
 set(CMAKE_REQUIRED_INCLUDES ${M_INCLUDE_DIRS})
 set(CMAKE_REQUIRED_LIBRARIES ${M_LIBRARIES})
 check_symbol_exists("floorl" "math.h"    HAVE_FLOORL)
-check_symbol_exists("lrint"  "math.h"    HAVE_LRINT) # GTK+ only
 cmake_pop_check_state()
 
 check_function_exists("getopt_long"      HAVE_GETOPT_LONG)
 if(HAVE_GETOPT_LONG)
+       #
+       # The OS has getopt_long(), so it might have optreset.
+       # Do we have it?
+       #
        if(HAVE_GETOPT_H)
                check_symbol_exists("optreset" "getopt.h" HAVE_OPTRESET)
        else()
                check_symbol_exists("optreset"           HAVE_OPTRESET)
        endif()
+else()
+       #
+       # The OS doesn't have getopt_long(), so we're using the GNU libc
+       # version that we have in wsutil.  It doesn't have optreset, so we
+       # don't need to check for it.
+       #
+       # However, it uses alloca(), so we may need to include alloca.h;
+       # check for it.
+       #
+       check_include_file("alloca.h"    HAVE_ALLOCA_H)
 endif()
 check_function_exists("getifaddrs"       HAVE_GETIFADDRS)
 check_function_exists("issetugid"        HAVE_ISSETUGID)
 check_function_exists("mkstemps"         HAVE_MKSTEMPS)
-check_function_exists("popcount"         HAVE_POPCOUNT)
 check_function_exists("setresgid"        HAVE_SETRESGID)
 check_function_exists("setresuid"        HAVE_SETRESUID)
 check_function_exists("strptime"         HAVE_STRPTIME)
@@ -120,7 +144,7 @@ check_symbol_exists(tzname "time.h" HAVE_TZNAME)
 if (NL_FOUND)
        check_c_source_compiles(
                "#include <linux/nl80211.h>
-               int main() {
+               int main(void) {
                        int x = NL80211_FREQUENCY_ATTR_MAX_TX_POWER;
                        x |= NL80211_ATTR_SUPPORTED_IFTYPES;
                        x |= NL80211_ATTR_SUPPORTED_COMMANDS;
@@ -132,21 +156,21 @@ if (NL_FOUND)
        )
        check_c_source_compiles(
                "#include <linux/nl80211.h>
-               int main() {
+               int main(void) {
                        enum nl80211_commands x = NL80211_CMD_SET_CHANNEL;
                }"
                HAVE_NL80211_CMD_SET_CHANNEL
        )
        check_c_source_compiles(
                "#include <linux/nl80211.h>
-               int main() {
+               int main(void) {
                        enum nl80211_protocol_features x = NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP;
                }"
                HAVE_NL80211_SPLIT_WIPHY_DUMP
        )
        check_c_source_compiles(
                "#include <linux/nl80211.h>
-               int main() {
+               int main(void) {
                        enum nl80211_attrs x = NL80211_ATTR_VHT_CAPABILITY;
                }"
                HAVE_NL80211_VHT_CAPABILITY