From 85ff35126623e6f26c84d9fa8a35b6762aefb110 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 10 Jul 2015 22:09:15 -0700 Subject: Revamp the CLOEXEC support in Qt The pipe2/dup3/accept4 functions and SOCK_CLOEXEC are quite old nowadays on Linux. They were introduced on Linux 2.6.28 and glibc 2.10, all from 2008. They were also picked up by uClibc in 2011 and FreeBSD as of version 10.0. So we no longer need the runtime detection of whether the feature is available. Instead, if the libc has support for it, use it unconditionally and fail at runtime if the syscall isn't implemented. Change-Id: Ib056b47dde3341ef9a52ffff13efcc39ef8dff7d Reviewed-by: Oswald Buddenhagen --- configure | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'configure') diff --git a/configure b/configure index a53eaff16d..864b747919 100755 --- a/configure +++ b/configure @@ -728,6 +728,7 @@ CFG_IPV6IFNAME=auto CFG_GETIFADDRS=auto CFG_INOTIFY=auto CFG_EVENTFD=auto +CFG_CLOEXEC=no CFG_RPATH=yes CFG_FRAMEWORK=auto CFG_USE_GOLD_LINKER=auto @@ -5869,6 +5870,11 @@ if [ "$CFG_GETIFADDRS" != "no" ]; then fi fi +# find if the platform provides thread-safe CLOEXEC support +if compileTest unix/cloexec; then + CFG_CLOEXEC=yes +fi + # detect OpenSSL if [ "$CFG_OPENSSL" != "no" ]; then if compileTest unix/openssl "OpenSSL"; then @@ -6147,6 +6153,9 @@ fi if [ "$CFG_EVENTFD" = "yes" ]; then QT_CONFIG="$QT_CONFIG eventfd" fi +if [ "$CFG_CLOEXEC" = "yes" ]; then + QT_CONFIG="$QT_CONFIG threadsafe-cloexec" +fi if [ "$CFG_LIBJPEG" = "no" ]; then CFG_JPEG="no" elif [ "$CFG_LIBJPEG" = "system" ]; then @@ -6627,6 +6636,7 @@ QMakeVar set sql-plugins "$SQL_PLUGINS" [ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS" [ "$CFG_INOTIFY" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY" [ "$CFG_EVENTFD" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EVENTFD" +[ "$CFG_CLOEXEC" = "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_THREADSAFE_CLOEXEC=1" [ "$CFG_NIS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS" [ "$CFG_OPENSSL" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL" [ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL" -- cgit v1.2.3