Enable llvm tool paths to be set with ./configure
authorDavid Terei <davidterei@gmail.com>
Tue, 10 Jan 2012 19:58:59 +0000 (11:58 -0800)
committerDavid Terei <davidterei@gmail.com>
Tue, 10 Jan 2012 19:58:59 +0000 (11:58 -0800)
Patch from Karel Gardas!

aclocal.m4
compiler/main/SysTools.lhs
configure.ac
mk/config.mk.in
settings.in

index 421da0e..c54918e 100644 (file)
@@ -370,6 +370,18 @@ AC_DEFUN([FP_SETTINGS],
         SettingsDllWrapCommand="/bin/false"
         SettingsWindresCommand="/bin/false"
         SettingsTouchCommand='touch'
+        if test -z "$LlcCmd"
+        then
+          SettingsLlcCommand="llc"
+        else
+          SettingsLlcCommand="$LlcCmd"
+        fi
+        if test -z "$OptCmd"
+        then
+          SettingsOptCommand="opt"
+        else
+          SettingsOptCommand="$OptCmd"
+        fi
     fi
     AC_SUBST(SettingsCCompilerCommand)
     AC_SUBST(SettingsCCompilerFlags)
@@ -377,6 +389,8 @@ AC_DEFUN([FP_SETTINGS],
     AC_SUBST(SettingsDllWrapCommand)
     AC_SUBST(SettingsWindresCommand)
     AC_SUBST(SettingsTouchCommand)
+    AC_SUBST(SettingsLlcCommand)
+    AC_SUBST(SettingsOptCommand)
 ])
 
 
@@ -538,6 +552,35 @@ AC_ARG_WITH($2,
 ]) # FP_ARG_WITH_PATH_GNU_PROG
 
 
+# FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL
+# --------------------
+# XXX
+#
+# $1 = the variable to set
+# $2 = the command to look for
+#
+AC_DEFUN([FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL],
+[
+AC_ARG_WITH($2,
+[AC_HELP_STRING([--with-$2=ARG],
+        [Use ARG as the path to $2 [default=autodetect]])],
+[
+    if test "$HostOS" = "mingw32"
+    then
+        AC_MSG_WARN([Request to use $withval will be ignored])
+    else
+        $1=$withval
+    fi
+],
+[
+    if test "$HostOS" != "mingw32"
+    then
+        AC_PATH_PROG([$1], [$2])
+    fi
+]
+)
+]) # FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL
+
 # FP_PROG_CONTEXT_DIFF
 # --------------------
 # Figure out how to do context diffs. Sets the output variable ContextDiffCmd.
index 75b4d54..b46ca17 100644 (file)
@@ -251,8 +251,8 @@ initSysTools mbMinusB
                 ld_args  = gcc_args
 
         -- We just assume on command line
-        ; let lc_prog = "llc"
-              lo_prog = "opt"
+        ; lc_prog <- getSetting "LLVM llc command"
+        ; lo_prog <- getSetting "LLVM opt command"
 
         ; return $ Settings {
                         sTargetPlatform = Platform {
index b9f000d..252f077 100644 (file)
@@ -349,6 +349,18 @@ FP_ARG_WITH_PATH_GNU_PROG([NM], [nm])
 NmCmd="$NM"
 AC_SUBST([NmCmd])
 
+dnl ** Which LLVM llc to use?
+dnl --------------------------------------------------------------
+FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([LLC], [llc])
+LlcCmd="$LLC"
+AC_SUBST([LlcCmd])
+
+dnl ** Which LLVM opt to use?
+dnl --------------------------------------------------------------
+FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([OPT], [opt])
+OptCmd="$OPT"
+AC_SUBST([OptCmd])
+
 dnl ** Mac OS X: explicit deployment target
 dnl --------------------------------------------------------------
 AC_ARG_WITH([macosx-deployment-target],
index 7e24ead..58e22cb 100644 (file)
@@ -678,6 +678,9 @@ DTRACE                      = @DtraceCmd@
 LD = @LdCmd@
 NM = @NmCmd@
 
+LLC = @LlcCmd@
+OPT = @OptCmd@
+
 # Some ld's support the -x flag and some don't, so the configure
 # script detects which we have and sets LdXFlag to "-x" or ""
 # respectively.
index baf04d5..02e1e0e 100644 (file)
@@ -13,6 +13,8 @@
  ("target word size", "@WordSize@"),
  ("target has GNU nonexec stack", "@HaskellHaveGnuNonexecStack@"),
  ("target has .ident directive", "@HaskellHaveIdentDirective@"),
- ("target has subsections via symbols", "@HaskellHaveSubsectionsViaSymbols@")
+ ("target has subsections via symbols", "@HaskellHaveSubsectionsViaSymbols@"),
+ ("LLVM llc command", "@SettingsLlcCommand@"),
+ ("LLVM opt command", "@SettingsOptCommand@")
  ]