Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/e6bfc5962e7d889a9cafcf1829c5177206ccabfd >--------------------------------------------------------------- commit e6bfc5962e7d889a9cafcf1829c5177206ccabfd Author: David Terei <[email protected]> Date: Tue Jan 10 11:58:59 2012 -0800 Enable llvm tool paths to be set with ./configure Patch from Karel Gardas! >--------------------------------------------------------------- aclocal.m4 | 43 +++++++++++++++++++++++++++++++++++++++++++ compiler/main/SysTools.lhs | 4 ++-- configure.ac | 12 ++++++++++++ mk/config.mk.in | 3 +++ settings.in | 4 +++- 5 files changed, 63 insertions(+), 3 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 421da0e..c54918e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -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. diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs index 75b4d54..b46ca17 100644 --- a/compiler/main/SysTools.lhs +++ b/compiler/main/SysTools.lhs @@ -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 { diff --git a/configure.ac b/configure.ac index b9f000d..252f077 100644 --- a/configure.ac +++ b/configure.ac @@ -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], diff --git a/mk/config.mk.in b/mk/config.mk.in index 7e24ead..58e22cb 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -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. diff --git a/settings.in b/settings.in index baf04d5..02e1e0e 100644 --- a/settings.in +++ b/settings.in @@ -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@") ] _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
