@@ -118,67 +118,65 @@ let version = "4.9.4";
118118 crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
119119 crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
120120 crossConfigureFlags =
121− mkPlatformFlags targetPlatform ++
122−
123− # Ensure that -print-prog-name is able to find the correct programs.
124− [ "--with-as=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as"
125− "--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] ++
126− (if crossMingw && crossStageStatic then
127− [ "--with-headers=${libcCross}/include"
128− "--with-gcc"
129− "--with-gnu-as"
130− "--with-gnu-ld"
131− "--with-gnu-ld"
132− "--disable-shared"
133− "--disable-nls"
134− "--disable-debug"
135− "--enable-sjlj-exceptions"
136− "--enable-threads=win32"
137− "--disable-win32-registry"
138− ] else if crossStageStatic then
139− [ "--disable-libssp"
140− "--disable-nls"
141− "--without-headers"
142− "--disable-threads "
143− "--disable-libgomp "
144− "--disable-libquadmath"
145− "--disable-shared"
146− "--disable-libatomic " # libatomic requires libc
147− "--disable-decimal-float" # libdecnumber requires libc
148− ] else
149− (if crossDarwin then ["--with-sysroot=${getLib libcCross}/share/sysroot"]
150− else ["--with-headers=${getDev libcCross}/include"]) ++
151− [ "--enable-__cxa_atexit"
152− "--enable-long-long"
153− ] ++
154−
155− (if crossMingw then [
156− "--enable-threads=win32"
157− "--enable-sjlj-exceptions"
158− "--enable-hash-synchronization"
159− "--disable-libssp"
160− "--disable-nls"
161− "--with-dwarf2"
162− # I think noone uses shared gcc libs in mingw, so we better do the same.
163− # In any case, mingw32 g++ linking is broken by default with shared libs,
164− # unless adding "-lsupc++" to any linking command. I don't know why.
165− "--disable-shared"
166− # To keep ABI compatibility with upstream mingw-w64
167− "--enable-fully-dynamic-string"
168− ] else
169− optionals (targetPlatform.libc == "uclibc") [
170− # libsanitizer requires netrom/netrom.h which is not
171− # available in uclibc.
172− "--disable-libsanitizer"
173− # In uclibc cases, libgomp needs an additional '-ldl'
174− # and as I don't know how to pass it, I disable libgomp.
175− "--disable-libgomp"
176− ] ++
177− [ "--enable-threads=posix"
178− "--enable-nls"
179− "--disable-decimal-float" # No final libdecnumber (it may work only in 386)
180− ])
181− );
121+ mkPlatformFlags targetPlatform ++
122+
123+ # Ensure that -print-prog-name is able to find the correct programs.
124+ [ "--with-as=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as"
125+ "--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] ++
126+ (if crossMingw && crossStageStatic then [
127+ "--with-headers=${libcCross}/include"
128+ "--with-gcc"
129+ "--with-gnu-as"
130+ "--with-gnu-ld"
131+ "--with-gnu-ld"
132+ "--disable-shared"
133+ "--disable-nls"
134+ "--disable-debug"
135+ "--enable-sjlj-exceptions"
136+ "--enable-threads=win32"
137+ "--disable-win32-registry"
138+ ] else if crossStageStatic then [
139+ "--disable-libssp"
140+ "--disable-nls"
141+ "--without-headers"
142+ "--disable-threads"
143+ "--disable-libgomp"
144+ "--disable-libquadmath"
145+ "--disable-shared"
146+ "--disable-libatomic" # libatomic requires libc
147+ "--disable-decimal-float" # libdecnumber requires libc
148+ ] else [
149+ (if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
150+ else "--with-headers=${getDev libcCross}/include")
151+ "--enable-__cxa_atexit"
152+ "--enable-long-long"
153+ ] ++
154+ (if crossMingw then [
155+ "--enable-threads=win32"
156+ "--enable-sjlj-exceptions"
157+ "--enable-hash-synchronization"
158+ "--disable-libssp"
159+ "--disable-nls"
160+ "--with-dwarf2"
161+ # I think noone uses shared gcc libs in mingw, so we better do the same.
162+ # In any case, mingw32 g++ linking is broken by default with shared libs,
163+ # unless adding "-lsupc++" to any linking command. I don't know why.
164+ "--disable-shared"
165+ # To keep ABI compatibility with upstream mingw-w64
166+ "--enable-fully-dynamic-string"
167+ ] else
168+ optionals (targetPlatform.libc == "uclibc") [
169+ # libsanitizer requires netrom/netrom.h which is not
170+ # available in uclibc.
171+ "--disable-libsanitizer"
172+ # In uclibc cases, libgomp needs an additional '-ldl'
173+ # and as I don't know how to pass it, I disable libgomp.
174+ "--disable-libgomp"
175+ ] ++ [
176+ "--enable-threads=posix"
177+ "--enable-nls"
178+ "--disable-decimal-float" # No final libdecnumber (it may work only in 386)
179+ ]));
182180 stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
183181 crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else "";
184182
@@ -353,15 +351,20 @@ stdenv.mkDerivation ({
353351
354352 # Optional features
355353 optional (isl != null) "--with-isl=${isl}" ++
356− optional (cloog != null) "--with-cloog=${cloog} --disable-cloog-version-check --enable-cloog-backend=isl" ++
354+ optionals (cloog != null) [
355+ "--with-cloog=${cloog}"
356+ "--disable-cloog-version-check"
357+ "--enable-cloog-backend=isl"
358+ ] ++
357359
358360 # Java options
359361 optionals langJava [
360− "--with-ecj-jar=${javaEcj} "
362+ "--with-ecj-jar=${javaEcj}"
361363
362364 # Follow Sun's layout for the convenience of IcedTea/OpenJDK. See
363365 # <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2010-April/008888.html>.
364− "--enable-java-home --with-java-home=\${prefix}/lib/jvm/jre "
366+ "--enable-java-home"
367+ "--with-java-home=\${prefix}/lib/jvm/jre"
365368 ] ++
366369 optional javaAwtGtk "--enable-java-awt=gtk" ++
367370 optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++
@@ -384,9 +387,9 @@ stdenv.mkDerivation ({
384387 # Platform-specific flags
385388 optional (targetPlatform == hostPlatform && targetPlatform.isi686) "--with-arch=i686" ++
386389 optionals hostPlatform.isSunOS [
387− "--enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit"
390+ "--enable-long-long" "--enable-libssp" "--enable-threads=posix" "--disable-nls" "--enable-__cxa_atexit"
388391 # On Illumos/Solaris GNU as is preferred
389− "--with-gnu-as --without-gnu-ld"
392+ "--with-gnu-as" "--without-gnu-ld"
390393 ]
391394 ;
392395
@@ -427,7 +430,7 @@ stdenv.mkDerivation ({
427430 optional langJava "--with-ecj-jar=${javaEcj.crossDrv}" ++
428431 optional javaAwtGtk "--enable-java-awt=gtk" ++
429432 optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr.crossDrv}" ++
430− optional (cloog != null) "--with-cloog=${cloog.crossDrv} --enable-cloog-backend=isl" ++
433+ optional (cloog != null) "--with-cloog=${cloog.crossDrv}" "--enable-cloog-backend=isl" ++
431434 [
432435 "--with-gmp=${gmp.crossDrv}"
433436 "--with-mpfr=${mpfr.crossDrv}"