summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2010-07-13 16:32:26 +0000
committerLudovic Courtès <ludo@gnu.org>2010-07-13 16:32:26 +0000
commit97ab4c05b2df1d978ebec84e8fa7d524ab07c3c2 (patch)
tree0c69971e93dadc79291b0904621daae78f7c0c28 /pkgs/development
parentf0ef9cdb407c45c198b0f9184c646b69029c4e2a (diff)
downloadnixpkgs-97ab4c05b2df1d978ebec84e8fa7d524ab07c3c2.tar
nixpkgs-97ab4c05b2df1d978ebec84e8fa7d524ab07c3c2.tar.gz
nixpkgs-97ab4c05b2df1d978ebec84e8fa7d524ab07c3c2.tar.bz2
nixpkgs-97ab4c05b2df1d978ebec84e8fa7d524ab07c3c2.tar.lz
nixpkgs-97ab4c05b2df1d978ebec84e8fa7d524ab07c3c2.tar.xz
nixpkgs-97ab4c05b2df1d978ebec84e8fa7d524ab07c3c2.tar.zst
nixpkgs-97ab4c05b2df1d978ebec84e8fa7d524ab07c3c2.zip
GCC 4.5: Fix pthread support for GNU.
svn path=/nixpkgs/trunk/; revision=22583
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/gcc-4.5/default.nix17
1 files changed, 13 insertions, 4 deletions
diff --git a/pkgs/development/compilers/gcc-4.5/default.nix b/pkgs/development/compilers/gcc-4.5/default.nix
index 1dcae1f2b69..d420582ede5 100644
--- a/pkgs/development/compilers/gcc-4.5/default.nix
+++ b/pkgs/development/compilers/gcc-4.5/default.nix
@@ -150,19 +150,28 @@ stdenv.mkDerivation ({
         || (cross != null && cross.config == "i586-pc-gnu"
             && libcCross != null))
     then
-      # On GNU/Hurd glibc refers to Hurd & Mach headers so add the right `-I'
-      # flags to the default spec string.
+      # On GNU/Hurd glibc refers to Hurd & Mach headers and libpthread is not
+      # in glibc, so add the right `-I' flags to the default spec string.
       let
         libc = if cross != null then libcCross else stdenv.glibc;
         config_h = "gcc/config/i386/gnu.h";
+        extraCPPDeps =
+             libc.propagatedBuildInputs
+          ++ stdenv.lib.optional (libpthreadCross != null) libpthreadCross
+          ++ stdenv.lib.optional (libpthread != null) libpthread;
         extraCPPSpec =
           concatStrings (intersperse " "
-                          (map (x: "-I${x}/include")
-                               libc.propagatedBuildInputs));
+                          (map (x: "-I${x}/include") extraCPPDeps));
+        pthreadLib =
+          if libpthreadCross != null then libpthreadCross else libpthread;
       in
         '' echo "augmenting \`CPP_SPEC' in \`${config_h}' with \`${extraCPPSpec}'..."
            sed -i "${config_h}" \
                -es'|CPP_SPEC *"\(.*\)$|CPP_SPEC "${extraCPPSpec} \1|g'
+
+           echo "augmenting \`LIB_SPEC' in \`${config_h}' for libpthread at \`${pthreadLib}'..."
+           sed -i "${config_h}" \
+               -es'|-lpthread|-L${pthreadLib}/lib -lpthread|g'
         ''
     else null;