toolchain: rework thread options
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 13 Dec 2010 16:27:44 +0000 (17:27 +0100)
committerPeter Korsgaard <jacmet@sunsite.dk>
Mon, 13 Dec 2010 21:26:41 +0000 (22:26 +0100)
The selection of linuxthreads, linuxthreads old or NPTL doesn't make a
lot of sense for external toolchains. So, instead, we :

 * Introduce an hidden BR2_TOOLCHAIN_HAS_THREADS option, which must be
   selected by toolchain specific options when thread support is
   available. Package needing to test thread support should use this
   option.

 * Move the none/linuxthreads/linuxthreads old/NPTL selection to
   Buildroot internal toolchain configuration.

 * Add an option in external toolchain to tell if thread support is
   available or not in the external toolchain. We assume that glibc
   without threads is not possible, as Ulrich Drepper said in
   http://sourceware.org/ml/libc-alpha/2005-08/msg00091.html

ffmpeg, dmalloc and openvpn are fixed to use the new
BR2_TOOLCHAIN_HAS_THREADS option. For openvpn, --enable-threads=posix
is no longer used, as the configure script doesn't even understand
this option.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
CHANGES
package/dmalloc/dmalloc.mk
package/ltp-testsuite/Config.in
package/multimedia/ffmpeg/ffmpeg.mk
package/openvpn/openvpn.mk
toolchain/Makefile.in
toolchain/gcc/gcc-uclibc-4.x.mk
toolchain/toolchain-buildroot/Config.in.2
toolchain/toolchain-common.in
toolchain/toolchain-external/Config.in
toolchain/toolchain-external/ext-tool.mk

diff --git a/CHANGES b/CHANGES
index ab6eabca28ee50c038a926ad28619f5fd99331a3..2d3bbb60b9de071fd6b0c7d5f9985ea30a597138 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,10 +3,11 @@
        Ccache support reworked. Now used for both host and target
        compilation, and cache is stored in ~/.buildroot-ccache.
 
-       Updated/fixed packages: at, busybox, bzip2, direcfb-examples,
-       dbus, cloop, cups, gdk-pixbuf, hostapd, i2c-tools, libconfig,
-       ltp-testsuite, m4, openssh, openssl, pango, qt, rsync,
-       sdl_gfx, sdl_sound, udev, usbutils, xz, zlib
+       Updated/fixed packages: at, busybox, bzip2, dbus,
+       direcfb-examples, dmalloc, cloop, cups, ffmpeg, gdk-pixbuf,
+       hostapd, i2c-tools, libconfig, ltp-testsuite, m4, openssh,
+       openssl, openvpn, pango, qt, rsync, sdl_gfx, sdl_sound, udev,
+       usbutils, xz, zlib
 
        New packages: dhrystone, fbgrab, lsuio, rsh-redone, whetstone
 
index 60ad76393b234015c1e51d643ca629d3624e95e0..dca0488d5354e2e3817d62ce2214d80a931ef379 100644 (file)
@@ -16,10 +16,10 @@ else
 DMALLOC_CONF_OPT+=--disable-cxx
 endif
 
-ifeq ($(BR2_PTHREADS_NONE),y)
-DMALLOC_CONF_OPT+=--disable-threads
-else
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
 DMALLOC_CONF_OPT+=--enable-threads
+else
+DMALLOC_CONF_OPT+=--disable-threads
 endif
 
 define DMALLOC_POST_PATCH
index 2ab4134b54b9ebcf6d3fa8a6a512ecaec458028b..86aa4fb8cd96326d46cb3b2e23f0d390f5bd877e 100644 (file)
@@ -1,6 +1,6 @@
 config BR2_PACKAGE_LTP_TESTSUITE
        bool "ltp-testsuite"
-       depends on !BR2_PTHREADS_NONE
+       depends on BR2_TOOLCHAIN_HAS_THREADS
        help
          The Linux Test Project provides a huge testsuite for Linux.
 
@@ -13,4 +13,4 @@ config BR2_PACKAGE_LTP_TESTSUITE
          http://ltp.sourceforge.net/
 
 comment "ltp-testsuite requires a toolchain with thread support"
-       depends on BR2_PTHREADS_NONE
+       depends on !BR2_TOOLCHAIN_HAS_THREADS
index 959efa39b2d97985e544be1f4e4e4938158b000a..f0ec93075b6f65fd0a518bd1df71a478ffd4252e 100644 (file)
@@ -111,10 +111,10 @@ else
 FFMPEG_CONF_OPT += --disable-outdevs
 endif
 
-ifeq ($(BR2_PTHREADS_NONE),y)
-FFMPEG_CONF_OPT += --disable-pthreads
-else
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
 FFMPEG_CONF_OPT += --enable-pthreads
+else
+FFMPEG_CONF_OPT += --disable-pthreads
 endif
 
 ifeq ($(BR2_PACKAGE_ZLIB),y)
index 7d8fb0c6f3d4ae7f08562f669b5571c9790536fc..ba91690860f30d3b1ccece531439ca0157dc778d 100644 (file)
@@ -8,10 +8,10 @@ OPENVPN_VERSION = 2.1.3
 OPENVPN_SITE = http://openvpn.net/release
 OPENVPN_CONF_OPT = --enable-small
 
-ifeq ($(BR2_PTHREADS_NATIVE),y)
-       OPENVPN_CONF_OPT += --enable-threads=posix
-else
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
        OPENVPN_CONF_OPT += --enable-pthread
+else
+       OPENVPN_CONF_OPT += --disable-pthread
 endif
 
 ifeq ($(BR2_PACKAGE_OPENVPN_LZO),y)
index 371509f4ebdc5530fe31329357a1ebdca83509b8..2cb6e95f21a230516d2449aff34620c6370ddba6 100644 (file)
@@ -1,9 +1,3 @@
-ifeq ($(BR2_PTHREADS_NONE),y)
-THREADS:=--disable-threads
-else
-THREADS:=--enable-threads
-endif
-
 BR2_CONFIGURE_DEVEL_SYSROOT=--with-sysroot=$(TOOLCHAIN_DIR)/uClibc_dev/
 BR2_CONFIGURE_STAGING_SYSROOT=--with-sysroot=$(STAGING_DIR)
 BR2_CONFIGURE_BUILD_TOOLS=--with-build-time-tools=$(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin
index eec652343ee8b52fe83a598e5bc24f47e2737cb3..5f69906cabf102e447e10c4379fc4117cf92171a 100644 (file)
@@ -138,6 +138,12 @@ else
 GCC_TLS:=--disable-tls
 endif
 
+ifeq ($(BR2_PTHREADS_NONE),y)
+THREADS:=--disable-threads
+else
+THREADS:=--enable-threads
+endif
+
 ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y)
 GCC_DECIMAL_FLOAT:=--disable-decimal-float
 endif
index f1b0a7c58c4203c4803f564e3c4cb803c20c8514..fe93e70d51ef57e1ff775542706d47c2c3e12935 100644 (file)
@@ -76,6 +76,33 @@ config BR2_TOOLCHAIN_BUILDROOT_USE_SSP
          See http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt
          for details.
 
+choice
+       prompt "Thread library implementation"
+       default BR2_PTHREADS_OLD
+       help
+         Use this option to select the thread library implementation
+         that should be used in your toolchain. Not all thread
+         variants work with all versions of uClibc, the "linuxthreads
+         (stable/old)" may be a working fallback if you need
+         threading at all.
+
+       config BR2_PTHREADS_NONE
+               bool "none"
+
+       config BR2_PTHREADS
+               bool "linuxthreads"
+               select BR2_TOOLCHAIN_HAS_THREADS
+
+       config BR2_PTHREADS_OLD
+               bool "linuxthreads (stable/old)"
+               select BR2_TOOLCHAIN_HAS_THREADS
+
+       config BR2_PTHREADS_NATIVE
+               bool "Native POSIX Threading (NPTL)"
+               select BR2_TOOLCHAIN_HAS_THREADS
+               depends on BR2_UCLIBC_VERSION_SNAPSHOT
+endchoice
+
 source "toolchain/elf2flt/Config.in"
 source "toolchain/mklibs/Config.in"
 source "toolchain/sstrip/Config.in"
index 5502ab4ff7cd437be6ff2dc487274d3dac28d11c..34d70a0fae028e8b01198366085ab1251e8681a7 100644 (file)
@@ -26,6 +26,9 @@ config BR2_PROGRAM_INVOCATION
 config BR2_INSTALL_LIBSTDCPP
        bool
 
+config BR2_TOOLCHAIN_HAS_THREADS
+       bool
+
 config BR2_ENABLE_LOCALE_PURGE
        bool "Purge unwanted locales"
        help
@@ -76,32 +79,6 @@ config BR2_SOFT_FLOAT
          functions, then everything will need to be compiled with soft
          floating point support (-msoft-float).
 
-choice
-       prompt "Thread library implementation"
-       default BR2_PTHREADS_OLD
-       help
-         If you are building your own toolchain then select the type of 
-         libpthreads you want to use.
-         Not all thread variants work with all versions of uClibc,
-         the "linuxthreads (stable/old)" may be a working fallback
-         if you need threading at all.
-         If you have an external binary toolchain then select the type 
-         of libpthreads it was built with.
-
-       config BR2_PTHREADS_NONE
-               bool "none"
-
-       config BR2_PTHREADS
-               bool "linuxthreads"
-
-       config BR2_PTHREADS_OLD
-               bool "linuxthreads (stable/old)"
-
-       config BR2_PTHREADS_NATIVE
-               bool "Native POSIX Threading (NPTL)"
-               depends on BR2_UCLIBC_VERSION_SNAPSHOT
-endchoice
-
 config BR2_TARGET_OPTIMIZATION
        string "Target Optimizations"
        default "-pipe"
index bd22e0cc38224531052dfe9c28c2ec6126d658e8..2ed65bf305cf9ee49746374f818ccdc2f93197e8 100644 (file)
@@ -149,6 +149,7 @@ config BR2_TOOLCHAIN_EXTERNAL_GLIBC
        select BR2_USE_WCHAR
        select BR2_ENABLE_LOCALE
        select BR2_PROGRAM_INVOCATION
+       select BR2_TOOLCHAIN_HAS_THREADS
 
 config BR2_TOOLCHAIN_EXTERNAL_UCLIBC
        bool
@@ -220,6 +221,14 @@ config BR2_TOOLCHAIN_EXTERNAL_PROGRAM_INVOCATION
          invocation support. If you don't know, leave the default
          value, Buildroot will tell you if it's correct or not.
 
+config BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS
+       bool "Toolchain has threads support?"
+       select BR2_TOOLCHAIN_HAS_THREADS
+       help
+         Select this option if your external toolchain has thread
+         support. If you don't know, leave the default value,
+         Buildroot will tell you if it's correct or not.
+
 endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC
 
 config BR2_TOOLCHAIN_EXTERNAL_CXX
index 027fbbdf584bd781adede358b253113b05bcdef9..d6153f14d16285045d0213bd9b213de41b613ee3 100644 (file)
@@ -53,7 +53,7 @@ ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
 USR_LIB_EXTERNAL_LIBS+=libstdc++.so
 endif
 
-ifneq ($(BR2_PTHREADS_NONE),y)
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
 LIB_EXTERNAL_LIBS+=libpthread.so
 ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
 LIB_EXTERNAL_LIBS+=libthread_db.so