summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNiclas Rosenvik <nros@netbsd.org>2021-04-14 08:09:17 +0000
committerNiclas Rosenvik <nros@netbsd.org>2021-04-21 20:57:04 +0000
commitfadd87ed15b5f7bf6e7aaed1263e2f2d661a623d (patch)
tree539e910d897c896c223d2f627b7a99ec70d63b78 /src
parent284d4e71258ad3afeda6d5bb83eb50e25137824c (diff)
Add Solaris support in cmake build
Add SOLARIS cmake platform definition. Add settings for QT_DEFAULT_MKSPEC so that qplatformdefs.h can be found. Solaris has its gssapi symbols in libgss. Solaris supports @ORIGIN. Solaris ld does not support --dynamic-list needed for reduce relocations. Make solaris fail the reduce relocation test. getauxval is specific to GNU libc and some other libc implementations on Linux but sys/auxv.h is not. The bootstrap uses sys/aux.h as the only indication for getauxval. This breaks builds on Solaris, so only make sys/auxv.h an indicator for getauxval on linux or glibc based systems. Solaris uses X11 so add it to the X11_SUPPORTED list. Solaris network libraries for sockets etc are in socket and nsl. ifreq does not have a member ifr_ifindex on Solaris, it uses ifr_index. Add test to check if ifr_index is a member of ifreq. The first struct in the in_addr union on solaris is defined as four uint8_t, therefore four arguments are needed for its initializer list. Change-Id: Ieed4c1bbac8559a7ae1db9c4e1e91f609f150270 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h4
-rw-r--r--src/gui/configure.cmake2
-rw-r--r--src/network/CMakeLists.txt2
-rw-r--r--src/network/configure.cmake20
-rw-r--r--src/network/configure.json16
-rw-r--r--src/network/kernel/qnetworkinterface_unix.cpp10
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp4
7 files changed, 56 insertions, 2 deletions
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
index a3db9231a9..9019bfd089 100644
--- a/src/corelib/global/qconfig-bootstrapped.h
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -84,7 +84,11 @@
#define QT_FEATURE_datetimeparser -1
#define QT_FEATURE_easingcurve -1
#define QT_FEATURE_etw -1
+#if defined(__linux__) || defined(__GLIBC__)
#define QT_FEATURE_getauxval (__has_include(<sys/auxv.h>) ? 1 : -1)
+#else
+#define QT_FEATURE_getauxval -1
+#endif
#define QT_FEATURE_getentropy -1
#define QT_NO_GEOM_VARIANT
#define QT_FEATURE_hijricalendar -1
diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake
index a26610bf98..cb6b0a5cc2 100644
--- a/src/gui/configure.cmake
+++ b/src/gui/configure.cmake
@@ -25,7 +25,7 @@ set_property(CACHE INPUT_libpng PROPERTY STRINGS undefined no qt system)
#### Libraries
-qt_set01(X11_SUPPORTED LINUX OR HPUX OR FREEBSD OR NETBSD OR OPENBSD) # special case
+qt_set01(X11_SUPPORTED LINUX OR HPUX OR FREEBSD OR NETBSD OR OPENBSD OR SOLARIS) # special case
qt_find_package(ATSPI2 PROVIDED_TARGETS PkgConfig::ATSPI2 MODULE_NAME gui QMAKE_LIB atspi)
qt_find_package(DirectFB PROVIDED_TARGETS PkgConfig::DirectFB MODULE_NAME gui QMAKE_LIB directfb)
qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm MODULE_NAME gui QMAKE_LIB drm)
diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt
index e49b8d8930..f3802e37e9 100644
--- a/src/network/CMakeLists.txt
+++ b/src/network/CMakeLists.txt
@@ -427,6 +427,8 @@ qt_internal_extend_target(Network CONDITION WIN32 PUBLIC_LIBRARIES ws2_32) # spe
qt_internal_extend_target(Network CONDITION QNX PUBLIC_LIBRARIES socket) # special case: mkspecs/common/qcc-base-qnx.conf
+qt_internal_extend_target(Network CONDITION SOLARIS PUBLIC_LIBRARIES socket nsl) # special case
+
# include the snippet projects for developer-builds
if(QT_FEATURE_private_tests)
add_subdirectory(doc/snippets/network)
diff --git a/src/network/configure.cmake b/src/network/configure.cmake
index be4c532df6..f1885a6ff8 100644
--- a/src/network/configure.cmake
+++ b/src/network/configure.cmake
@@ -81,6 +81,22 @@ freeifaddrs(list);
"# FIXME: use: unmapped library: network
)
+# ifr_index
+qt_config_compile_test(ifr_index
+ LABEL "ifr_index"
+ CODE
+"#include <net/if.h>
+
+int main(void)
+{
+ /* BEGIN TEST: */
+struct ifreq req;
+req.ifr_index = 0;
+ /* END TEST: */
+ return 0;
+}
+")
+
# ipv6ifname
qt_config_compile_test(ipv6ifname
LABEL "IPv6 ifname"
@@ -220,6 +236,10 @@ qt_feature("getifaddrs" PUBLIC
CONDITION TEST_getifaddrs
)
qt_feature_definition("getifaddrs" "QT_NO_GETIFADDRS" NEGATE VALUE "1")
+qt_feature("ifr_index" PRIVATE
+ LABEL "ifr_index"
+ CONDITION TEST_ifr_index
+)
qt_feature("ipv6ifname" PUBLIC
LABEL "IPv6 ifname"
CONDITION TEST_ipv6ifname
diff --git a/src/network/configure.json b/src/network/configure.json
index b037eee75c..d1ee15d80b 100644
--- a/src/network/configure.json
+++ b/src/network/configure.json
@@ -142,6 +142,17 @@
},
"use": "network"
},
+ "ifr_index": {
+ "label": "ifr_index",
+ "type": "compile",
+ "test": {
+ "include": "net/if.h",
+ "main": [
+ "struct ifreq req;",
+ "req.ifr_index = 0;"
+ ]
+ }
+ },
"ipv6ifname": {
"label": "IPv6 ifname",
"type": "compile",
@@ -238,6 +249,11 @@
"condition": "tests.getifaddrs",
"output": [ "feature" ]
},
+ "ifr_index": {
+ "label": "ifr_index",
+ "condition": "tests.ifr_index",
+ "output": [ "privateFeature" ]
+ },
"ipv6ifname": {
"label": "IPv6 ifname",
"condition": "tests.ipv6ifname",
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp
index 5b34b99caa..b1e351a289 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -111,7 +111,11 @@ uint QNetworkInterfaceManager::interfaceIndexFromName(const QString &name)
uint id = 0;
if (qt_safe_ioctl(socket, SIOCGIFINDEX, &req) >= 0)
+# if QT_CONFIG(ifr_index)
+ id = req.ifr_index;
+# else
id = req.ifr_ifindex;
+# endif
qt_safe_close(socket);
return id;
#else
@@ -130,7 +134,11 @@ QString QNetworkInterfaceManager::interfaceNameFromIndex(uint index)
int socket = qt_safe_socket(AF_INET, SOCK_STREAM, 0);
if (socket >= 0) {
memset(&req, 0, sizeof(ifreq));
+# if QT_CONFIG(ifr_index)
+ req.ifr_index = index;
+# else
req.ifr_ifindex = index;
+# endif
if (qt_safe_ioctl(socket, SIOCGIFNAME, &req) >= 0) {
qt_safe_close(socket);
@@ -216,7 +224,7 @@ static QNetworkInterfacePrivate *findInterface(int socket, QList<QNetworkInterfa
// Get the interface index
# ifdef SIOCGIFINDEX
if (qt_safe_ioctl(socket, SIOCGIFINDEX, &req) >= 0)
-# if defined(Q_OS_HAIKU)
+# if QT_CONFIG(ifr_index)
ifindex = req.ifr_index;
# else
ifindex = req.ifr_ifindex;
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index a817bb8300..09d16fa908 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -783,7 +783,11 @@ QNetworkInterface QNativeSocketEnginePrivate::nativeMulticastInterface() const
return QNetworkInterface::interfaceFromIndex(v);
}
+#if defined(Q_OS_SOLARIS)
+ struct in_addr v = { 0, 0, 0, 0};
+#else
struct in_addr v = { 0 };
+#endif
QT_SOCKOPTLEN_T sizeofv = sizeof(v);
if (::getsockopt(socketDescriptor, IPPROTO_IP, IP_MULTICAST_IF, &v, &sizeofv) == -1)
return QNetworkInterface();