summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-11-30 09:11:43 +0100
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-11-30 09:11:43 +0100
commit82b3d2e292355c7b30f35e68e9506ccbd3c48a34 (patch)
tree4e3972614993e8eafd6d0cb4f404f2b7f6211ea5 /src
parent97c4b6bd774960fe9301829cf2d1ac23882e8958 (diff)
downloadcpptasks-parallel-82b3d2e292355c7b30f35e68e9506ccbd3c48a34.tar.gz
cpptasks-parallel-82b3d2e292355c7b30f35e68e9506ccbd3c48a34.tar.bz2
cpptasks-parallel-82b3d2e292355c7b30f35e68e9506ccbd3c48a34.tar.xz
cpptasks-parallel-82b3d2e292355c7b30f35e68e9506ccbd3c48a34.zip
Fixed NAR-112
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/CCTask.java3
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/compiler/LinkType.java11
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java21
3 files changed, 33 insertions, 2 deletions
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/CCTask.java b/src/main/java/net/sf/antcontrib/cpptasks/CCTask.java
index fec91af..2e2065f 100644
--- a/src/main/java/net/sf/antcontrib/cpptasks/CCTask.java
+++ b/src/main/java/net/sf/antcontrib/cpptasks/CCTask.java
@@ -1389,6 +1389,9 @@ public class CCTask extends Task {
linkType.setLinkFortran(linkFortran);
}
+ public void setLinkFortranMain(boolean linkFortranMain) {
+ linkType.setLinkFortranMain(linkFortranMain);
+ }
// ENDFREEHEP
/**
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/LinkType.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/LinkType.java
index 67d7e6b..aae520d 100644
--- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/LinkType.java
+++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/LinkType.java
@@ -31,6 +31,7 @@ public class LinkType {
// BEGINFREEHEP
private boolean linkCPP = true;
private boolean linkFortran = false;
+ private boolean linkFortranMain = false;
// ENDFREEHEP
/**
@@ -176,6 +177,14 @@ public class LinkType {
public boolean linkFortran() {
return linkFortran;
}
-// ENDFREEHEP
+
+ public void setLinkFortranMain(boolean linkFortranMain) {
+ this.linkFortranMain = linkFortranMain;
+ }
+
+ public boolean linkFortranMain() {
+ return linkFortranMain;
+ }
+ // ENDFREEHEP
}
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
index 043720d..ce9f2fb 100644
--- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
+++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
@@ -63,7 +63,7 @@ public class GppLinker extends AbstractLdLinker {
private File[] libDirs;
private String runtimeLibrary;
// FREEEHEP
- private String gccLibrary, gfortranLibrary;
+ private String gccLibrary, gfortranLibrary, gfortranMainLibrary;
protected GppLinker(String command, String[] extensions,
String[] ignoredExtensions, String outputPrefix,
@@ -97,6 +97,22 @@ public class GppLinker extends AbstractLdLinker {
gfortranLibrary = "-lgfortran";
}
}
+
+ gfortranMainLibrary = null;
+ if (linkType.linkFortran()) {
+ if (linkType.isExecutable() && linkType.linkFortranMain() && !isDarwin()) {
+ if (linkType.isStaticRuntime()) {
+ String[] cmdin = new String[] { "gfortran",
+ "-print-file-name=libgfortranbegin.a" };
+ String[] cmdout = CaptureStreamHandler.run(cmdin);
+ if ((cmdout.length > 0) && (cmdout[0].indexOf('/') >= 0)) {
+ gfortranMainLibrary = cmdout[0];
+ }
+ } else {
+ gfortranMainLibrary = "-lgfortranbegin";
+ }
+ }
+ }
runtimeLibrary = null;
if (linkType.linkCPP()) {
@@ -137,6 +153,9 @@ public class GppLinker extends AbstractLdLinker {
if (gfortranLibrary != null) {
endargs.addElement(gfortranLibrary);
}
+ if (gfortranMainLibrary != null) {
+ endargs.addElement(gfortranMainLibrary);
+ }
if (gccLibrary != null) {
endargs.addElement(gccLibrary);
}