[commit: packages/directory] master: Ignore --with-gcc if it contains spaces (81d95c9)

git at git.haskell.org git at git.haskell.org
Fri Dec 18 09:52:30 UTC 2015


Repository : ssh://git@git.haskell.org/directory

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/81d95c9880d6168c2e205da6fdd74c0ef45d8215/directory

>---------------------------------------------------------------

commit 81d95c9880d6168c2e205da6fdd74c0ef45d8215
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Fri Aug 28 19:35:16 2015 -0400

    Ignore --with-gcc if it contains spaces
    
    Autoconf chokes on spaces, but we may receive a full path from Cabal
    containing spaces, so if that happens we just ignore Cabal's suggestion.
    Terrible hack, but what can you do?  We can't just bail because Windows
    users might have their compiler under "Program Files", so we'll just
    print a warning and hope for the best.


>---------------------------------------------------------------

81d95c9880d6168c2e205da6fdd74c0ef45d8215
 configure.ac | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index a9dbd12..448e7b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,12 +5,24 @@ AC_CONFIG_SRCDIR([include/HsDirectory.h])
 
 AC_CONFIG_HEADERS([include/HsDirectoryConfig.h])
 
-AC_ARG_WITH([cc],
-            [C compiler],
-            [CC=$withval])
-# inherit the C compiler from Cabal
+# Autoconf chokes on spaces, but we may receive a path from Cabal containing
+# spaces.  In that case, we just ignore Cabal's suggestion.
+set_with_gcc() {
+    case $withval in
+        *" "*)
+            AC_MSG_WARN([--with-gcc ignored due to presence of spaces]);;
+        *)
+            CC=$withval
+    esac
+}
+
+# inherit the C compiler from Cabal but allow it to be overridden by --with-cc
+# because Cabal puts its own flags at the end
 AC_ARG_WITH([gcc],
             [C compiler],
+            [set_with_gcc])
+AC_ARG_WITH([cc],
+            [C compiler],
             [CC=$withval])
 # avoid warnings when run via Cabal
 AC_ARG_WITH([compiler],



More information about the ghc-commits mailing list