summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Koenig <tobias.koenig@kdab.com>2014-12-22 10:27:53 +0100
committerTobias Koenig <tobias.koenig@kdab.com>2015-01-09 10:58:42 +0100
commitc3e50db19990c5b1d9088c4418e2804560d35582 (patch)
tree0d73692b91bc17c90edcc60cae43cf55dc30fb05
parent3d17b73377b4dbab9cc0b989cae44c1791cb726c (diff)
Add a configure-time check for an IPC support
Adds a configure check for System V and POSIX IPC. System V takes precedence over POSIX IPC, and if both are not supported, QT_NO_SHAREDMEMORY and QT_NO_SYSTEMSEMAPHORE are defined. This patch is a forward-port from 4.8 branch (6ef4abaa9cd7d465cbae5cbf8cb4664bef387d10). Change-Id: I3ec20342f0f0266843479634109b67c6989dd296 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--config.tests/unix/ipc_posix/ipc.cpp58
-rw-r--r--config.tests/unix/ipc_posix/ipc_posix.pro4
-rw-r--r--config.tests/unix/ipc_sysv/ipc.cpp59
-rw-r--r--config.tests/unix/ipc_sysv/ipc_sysv.pro3
-rwxr-xr-xconfigure12
5 files changed, 136 insertions, 0 deletions
diff --git a/config.tests/unix/ipc_posix/ipc.cpp b/config.tests/unix/ipc_posix/ipc.cpp
new file mode 100644
index 0000000000..cdb3b9afba
--- /dev/null
+++ b/config.tests/unix/ipc_posix/ipc.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/mman.h>
+#include <semaphore.h>
+#include <fcntl.h>
+
+int main(int, char **)
+{
+ sem_t *semaphore = sem_open("test", O_CREAT | O_EXCL, 0666, 0);
+ if (semaphore != SEM_FAILED)
+ sem_close(semaphore);
+
+ shm_open("test", O_RDWR | O_CREAT | O_EXCL, 0666);
+ shm_unlink("test");
+
+ return 0;
+}
diff --git a/config.tests/unix/ipc_posix/ipc_posix.pro b/config.tests/unix/ipc_posix/ipc_posix.pro
new file mode 100644
index 0000000000..a8bcb397bb
--- /dev/null
+++ b/config.tests/unix/ipc_posix/ipc_posix.pro
@@ -0,0 +1,4 @@
+SOURCES = ipc.cpp
+CONFIG -= qt dylib
+mac:CONFIG -= app_bundle
+linux:LIBS += -lpthread -lrt
diff --git a/config.tests/unix/ipc_sysv/ipc.cpp b/config.tests/unix/ipc_sysv/ipc.cpp
new file mode 100644
index 0000000000..751354d1ff
--- /dev/null
+++ b/config.tests/unix/ipc_sysv/ipc.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <sys/shm.h>
+#include <fcntl.h>
+
+int main(int, char **)
+{
+ key_t unix_key = ftok("test", 'Q');
+ int semaphore = semget(unix_key, 1, 0666 | IPC_CREAT | IPC_EXCL);
+ if (semaphore != -1)
+ semctl(semaphore, 0, IPC_RMID, 0);
+
+ shmget(unix_key, 0, 0666 | IPC_CREAT | IPC_EXCL);
+ shmctl(0, 0, static_cast<struct shmid_ds *>(0));
+
+ return 0;
+}
diff --git a/config.tests/unix/ipc_sysv/ipc_sysv.pro b/config.tests/unix/ipc_sysv/ipc_sysv.pro
new file mode 100644
index 0000000000..1b6de0296f
--- /dev/null
+++ b/config.tests/unix/ipc_sysv/ipc_sysv.pro
@@ -0,0 +1,3 @@
+SOURCES = ipc.cpp
+CONFIG -= qt dylib
+mac:CONFIG -= app_bundle
diff --git a/configure b/configure
index 9541ee3495..43be7223c6 100755
--- a/configure
+++ b/configure
@@ -4310,6 +4310,18 @@ fi
[ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"
[ "$XPLATFORM_ANDROID" = "yes" ] && QMakeVar add styles "android"
+# check IPC support
+if ! compileTest unix/ipc_sysv "ipc_sysv" ; then
+ # SYSV IPC is not supported - check POSIX IPC
+ if compileTest unix/ipc_posix "ipc_posix" ; then
+ QCONFIG_FLAGS="$QCONFIG_FLAGS QT_POSIX_IPC"
+ else
+ if [ "$XPLATFORM_ANDROID" = "no" ] ; then
+ QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SYSTEMSEMAPHORE QT_NO_SHAREDMEMORY"
+ fi
+ fi
+fi
+
# detect zlib
if [ "$CFG_ZLIB" = "no" ]; then
# Note: Qt no longer support builds without zlib