summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-12-27 14:25:22 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-12-27 14:25:22 -0500
commita26a03c0de18158614e0d374fd49a281444871db (patch)
treecfafe28760c47460a4ffe49b3e1458e20f439ad9
parent834b3a5799b14cc722dfca9205c4b37e2faedce4 (diff)
Protocol-specific compiler options
-rw-r--r--src/cgi.sml1
-rw-r--r--src/compiler.sml5
-rw-r--r--src/fastcgi.sml1
-rw-r--r--src/http.sml1
-rw-r--r--src/settings.sig1
-rw-r--r--src/settings.sml2
6 files changed, 10 insertions, 1 deletions
diff --git a/src/cgi.sml b/src/cgi.sml
index f853a12c..f43ef211 100644
--- a/src/cgi.sml
+++ b/src/cgi.sml
@@ -30,6 +30,7 @@ structure Cgi :> CGI = struct
open Settings
val () = addProtocol {name = "cgi",
+ compile = "",
linkStatic = clibFile "cgi.o",
linkDynamic = "-lurweb_cgi",
persistent = false}
diff --git a/src/compiler.sml b/src/compiler.sml
index 1ef8c5b1..28b8dc2c 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -529,7 +529,8 @@ fun parseUrp' accLibs fname =
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 @@ fun compileC {cname, oname, ename, libs, profile, debug, link = link'} =
"-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
diff --git a/src/fastcgi.sml b/src/fastcgi.sml
index 16836f30..c0f8bc12 100644
--- a/src/fastcgi.sml
+++ b/src/fastcgi.sml
@@ -30,6 +30,7 @@ structure Fastcgi :> FASTCGI = struct
open Settings
val () = addProtocol {name = "fastcgi",
+ compile = "",
linkStatic = clibFile "fastcgi.o",
linkDynamic = "-lurweb_fastcgi",
persistent = true}
diff --git a/src/http.sml b/src/http.sml
index 3f6fc2df..499c9966 100644
--- a/src/http.sml
+++ b/src/http.sml
@@ -30,6 +30,7 @@ structure Http :> HTTP = struct
open Settings
val () = addProtocol {name = "http",
+ compile = "",
linkStatic = clibFile "http.o",
linkDynamic = "-lurweb_http",
persistent = true}
diff --git a/src/settings.sig b/src/settings.sig
index 8eb4bc13..12182ae6 100644
--- a/src/settings.sig
+++ b/src/settings.sig
@@ -93,6 +93,7 @@ signature SETTINGS = sig
(* 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? *)
diff --git a/src/settings.sml b/src/settings.sml
index 39398490..b316b489 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -270,6 +270,7 @@ val checkMime = check
type protocol = {
name : string,
+ compile : string,
linkStatic : string,
linkDynamic : string,
persistent : bool
@@ -282,6 +283,7 @@ fun clibFile s = OS.Path.joinDirFile {dir = Config.libC,
file = s}
val curProto = ref {name = "",
+ compile = "",
linkStatic = "",
linkDynamic = "",
persistent = false}