changeset 1871:c3119c263bd3

Add -ccompiler command line argument This allows user to overwrite the compiler set during the configure phase
author Sergey Mironov <grrwlf@gmail.com>
date Tue, 20 Aug 2013 17:13:50 +0400
parents 434921f54f54
children 6507e973af84
files src/compiler.sml src/main.mlton.sml src/settings.sig src/settings.sml
diffstat 4 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/compiler.sml	Tue Oct 01 07:33:20 2013 -0400
+++ b/src/compiler.sml	Tue Aug 20 17:13:50 2013 +0400
@@ -1479,12 +1479,12 @@
                   else
                       " -O3"
 
-        val compile = Config.ccompiler ^ " " ^ Config.ccArgs ^ " " ^ Config.pthreadCflags ^ " -Wimplicit -Werror -Wno-unused-value"
+        val compile = (Settings.getCCompiler ()) ^ " " ^ Config.ccArgs ^ " " ^ Config.pthreadCflags ^ " -Wimplicit -Werror -Wno-unused-value"
                       ^ opt ^ " -I " ^ !Settings.configInclude
                       ^ " " ^ #compile proto
                       ^ " -c " ^ escapeFilename cname ^ " -o " ^ escapeFilename oname
 
-        val linker = Option.getOpt (linker, Config.ccompiler ^ " -Werror" ^ opt ^ " " ^ Config.ccArgs ^ " " ^ Config.pthreadCflags ^ " " ^ Config.pthreadLibs)
+        val linker = Option.getOpt (linker, (Settings.getCCompiler ()) ^ " -Werror" ^ opt ^ " " ^ Config.ccArgs ^ " " ^ Config.pthreadCflags ^ " " ^ Config.pthreadLibs)
 
         val ssl = if Settings.getStaticLinking () then
                       Config.openssl ^ " -ldl -lz"
--- a/src/main.mlton.sml	Tue Oct 01 07:33:20 2013 -0400
+++ b/src/main.mlton.sml	Tue Aug 20 17:13:50 2013 +0400
@@ -61,12 +61,15 @@
             case args of
                 [] => ()
               | "-version" :: rest => 
-	        printVersion ()
+                  printVersion ()
               | "-numeric-version" :: rest =>
-	        printNumericVersion ()
+                  printNumericVersion ()
               | "-css" :: rest =>
                 (css := true;
                  doArgs rest)
+              | "-ccompiler" :: ccomp :: rest =>
+                (Settings.setCCompiler ccomp;
+                 doArgs rest)
               | "-demo" :: prefix :: rest =>
                 (demo := SOME (prefix, false);
                  doArgs rest)
--- a/src/settings.sig	Tue Oct 01 07:33:20 2013 -0400
+++ b/src/settings.sig	Tue Aug 20 17:13:50 2013 +0400
@@ -256,4 +256,7 @@
 
     val setTimeFormat : string -> unit
     val getTimeFormat : unit -> string
+
+	val getCCompiler : unit -> string
+	val setCCompiler : string -> unit
 end
--- a/src/settings.sml	Tue Oct 01 07:33:20 2013 -0400
+++ b/src/settings.sml	Tue Aug 20 17:13:50 2013 +0400
@@ -33,6 +33,11 @@
 val configInclude = ref Config.includ
 val configSitelisp = ref Config.sitelisp
 
+val configCCompiler = ref Config.ccompiler
+
+fun getCCompiler () = !configCCompiler
+fun setCCompiler cc = configCCompiler := cc
+
 fun libUr () = OS.Path.joinDirFile {dir = !configSrcLib,
                                     file = "ur"}
 fun libC () = OS.Path.joinDirFile {dir = !configSrcLib,