summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-02-13 01:21:43 +0100
committerAraq <rumpf_a@web.de>2015-02-13 01:21:55 +0100
commitb226618ce78443d3001d8f5f80b3225a6ad6485d (patch)
treebc476d7c699919a494d552994ce84739a505778c
parentc44d947ac55b46425d25a5355416fbb39adbdb87 (diff)
downloadNim-b226618ce78443d3001d8f5f80b3225a6ad6485d.tar.gz
'passL' is not smart anymore about already known switches; -ldl is now properly appended to the linking command
-rw-r--r--compiler/extccomp.nim22
1 files changed, 12 insertions, 10 deletions
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim
index 1083b7590..546849c0b 100644
--- a/compiler/extccomp.nim
+++ b/compiler/extccomp.nim
@@ -380,7 +380,7 @@ proc setCC*(ccname: string) =
   cCompiler = nameToCC(ccname)
   if cCompiler == ccNone: rawMessage(errUnknownCcompiler, ccname)
   compileOptions = getConfigVar(cCompiler, ".options.always")
-  linkOptions = getConfigVar(cCompiler, ".options.linker")
+  linkOptions = ""
   ccompilerpath = getConfigVar(cCompiler, ".path")
   for i in countup(low(CC), high(CC)): undefSymbol(CC[i].name)
   defineSymbol(CC[cCompiler].name)
@@ -389,8 +389,8 @@ proc addOpt(dest: var string, src: string) =
   if len(dest) == 0 or dest[len(dest)-1] != ' ': add(dest, " ")
   add(dest, src)
 
-proc addLinkOption*(option: string) = 
-  if find(linkOptions, option, 0) < 0: addOpt(linkOptions, option)
+proc addLinkOption*(option: string) =
+  addOpt(linkOptions, option)
 
 proc addCompileOption*(option: string) = 
   if strutils.find(compileOptions, option, 0) < 0: 
@@ -401,7 +401,7 @@ proc initVars*() =
   for i in countup(low(CC), high(CC)): undefSymbol(CC[i].name)
   defineSymbol(CC[cCompiler].name)
   addCompileOption(getConfigVar(cCompiler, ".options.always"))
-  addLinkOption(getConfigVar(cCompiler, ".options.linker"))
+  #addLinkOption(getConfigVar(cCompiler, ".options.linker"))
   if len(ccompilerpath) == 0:
     ccompilerpath = getConfigVar(cCompiler, ".path")
 
@@ -553,13 +553,13 @@ proc getCompileCFileCmd*(cfilename: string, isExternal = false): string =
   cfile = quoteShell(cfile)
   result = quoteShell(compilePattern % [
     "file", cfile, "objfile", objfile, "options", options,
-    "include", includeCmd, "nimrod", getPrefixDir(),
+    "include", includeCmd, "nim", getPrefixDir(),
     "nim", getPrefixDir(), "lib", libpath])
   add(result, ' ')
   addf(result, CC[c].compileTmpl, [
     "file", cfile, "objfile", objfile,
     "options", options, "include", includeCmd,
-    "nimrod", quoteShell(getPrefixDir()),
+    "nim", quoteShell(getPrefixDir()),
     "nim", quoteShell(getPrefixDir()),
     "lib", quoteShell(libpath)])
 
@@ -679,15 +679,16 @@ proc callCCompiler*(projectfile: string) =
         if not exefile.isAbsolute():
           exefile = joinPath(splitFile(projectfile).dir, exefile)
       exefile = quoteShell(exefile)
-      let linkOptions = getLinkOptions()
+      let linkOptions = getLinkOptions() & " " & 
+                        getConfigVar(cCompiler, ".options.linker")
       linkCmd = quoteShell(linkCmd % ["builddll", builddll,
           "buildgui", buildgui, "options", linkOptions, "objfiles", objfiles,
-          "exefile", exefile, "nimrod", getPrefixDir(), "lib", libpath])
+          "exefile", exefile, "nim", getPrefixDir(), "lib", libpath])
       linkCmd.add ' '
       addf(linkCmd, CC[c].linkTmpl, ["builddll", builddll,
           "buildgui", buildgui, "options", linkOptions,
           "objfiles", objfiles, "exefile", exefile,
-          "nimrod", quoteShell(getPrefixDir()),
+          "nim", quoteShell(getPrefixDir()),
           "lib", quoteShell(libpath)])
     if optCompileOnly notin gGlobalOptions:
       if gVerbosity == 1:
@@ -716,7 +717,8 @@ proc writeMapping*(gSymbolMapping: PRope) =
   app(code, strutils.escape(getCompileOptions()))
   
   app(code, "\n[Linker]\nFlags=")
-  app(code, strutils.escape(getLinkOptions()))
+  app(code, strutils.escape(getLinkOptions() & " " & 
+                            getConfigVar(cCompiler, ".options.linker")))
 
   app(code, "\n[Environment]\nlibpath=")
   app(code, strutils.escape(libpath))