From 03605f653bdd50bedb38a77759a61d2e978fbeb2 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 27 Dec 2009 14:25:22 -0500 Subject: Protocol-specific compiler options --- src/cgi.sml | 1 + src/compiler.sml | 5 ++++- src/fastcgi.sml | 1 + src/http.sml | 1 + src/settings.sig | 1 + src/settings.sml | 2 ++ 6 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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} -- cgit v1.2.3