changeset 1096:324c9ffe8ff9

Protocol-specific compiler options
author Adam Chlipala <adamc@hcoop.net>
date Sun, 27 Dec 2009 14:25:22 -0500
parents bed675db3aff
children 80d048a8efe5
files src/cgi.sml src/compiler.sml src/fastcgi.sml src/http.sml src/settings.sig src/settings.sml
diffstat 6 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/cgi.sml	Sun Dec 27 13:18:32 2009 -0500
+++ b/src/cgi.sml	Sun Dec 27 14:25:22 2009 -0500
@@ -30,6 +30,7 @@
 open Settings
 
 val () = addProtocol {name = "cgi",
+                      compile = "",
                       linkStatic = clibFile "cgi.o",
                       linkDynamic = "-lurweb_cgi",
                       persistent = false}
--- a/src/compiler.sml	Sun Dec 27 13:18:32 2009 -0500
+++ b/src/compiler.sml	Sun Dec 27 14:25:22 2009 -0500
@@ -529,7 +529,8 @@
                                  timeout := SOME (valOf (Int.fromString arg)))
                               | "ffi" => ffi := relify arg :: !ffi
                               | "link" => let
-                                    val arg = if size arg >= 2 andalso String.substring (arg, 0, 2) = "-l" then
+                                    val arg = if size arg >= 1
+                                                 andalso String.sub (arg, 0) = #"-" then
                                                   arg
                                               else
                                                   relifyA arg
@@ -1033,7 +1034,9 @@
                       "-L" ^ Config.libC ^ " -lurweb " ^ #linkDynamic proto
 
         val compile = "gcc " ^ Config.gccArgs ^ " -Wimplicit -Werror -O3 -fno-inline -I " ^ Config.includ
+                      ^ " " ^ #compile proto
                       ^ " -c " ^ cname ^ " -o " ^ oname
+
         val link = "gcc -Werror -O3 -lm -lmhash -pthread " ^ Config.gccArgs ^ " " ^ libs ^ " " ^ lib ^ " " ^ oname
                    ^ " -o " ^ ename
 
--- a/src/fastcgi.sml	Sun Dec 27 13:18:32 2009 -0500
+++ b/src/fastcgi.sml	Sun Dec 27 14:25:22 2009 -0500
@@ -30,6 +30,7 @@
 open Settings
 
 val () = addProtocol {name = "fastcgi",
+                      compile = "",
                       linkStatic = clibFile "fastcgi.o",
                       linkDynamic = "-lurweb_fastcgi",
                       persistent = true}
--- a/src/http.sml	Sun Dec 27 13:18:32 2009 -0500
+++ b/src/http.sml	Sun Dec 27 14:25:22 2009 -0500
@@ -30,6 +30,7 @@
 open Settings
 
 val () = addProtocol {name = "http",
+                      compile = "",
                       linkStatic = clibFile "http.o",
                       linkDynamic = "-lurweb_http",
                       persistent = true}
--- a/src/settings.sig	Sun Dec 27 13:18:32 2009 -0500
+++ b/src/settings.sig	Sun Dec 27 14:25:22 2009 -0500
@@ -93,6 +93,7 @@
     (* Web protocols that generated programs may speak *)
     type protocol = {
         name : string,       (* Call it this on the command line *)
+        compile : string,    (* Pass these `gcc -c' arguments *)
         linkStatic : string, (* Pass these static linker arguments *)
         linkDynamic : string,(* Pass these dynamic linker arguments *)
         persistent : bool    (* Multiple requests per process? *)
--- a/src/settings.sml	Sun Dec 27 13:18:32 2009 -0500
+++ b/src/settings.sml	Sun Dec 27 14:25:22 2009 -0500
@@ -270,6 +270,7 @@
 
 type protocol = {
      name : string,
+     compile : string,
      linkStatic : string,
      linkDynamic : string,
      persistent : bool
@@ -282,6 +283,7 @@
                                       file = s}
 
 val curProto = ref {name = "",
+                    compile = "",
                     linkStatic = "",
                     linkDynamic = "",
                     persistent = false}