summaryrefslogtreecommitdiff
path: root/src/net/sf/antcontrib/cpptasks/gcc
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2007-07-06 19:06:29 +0000
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2007-07-06 19:06:29 +0000
commit2dac20493cf190fb56f04d1fe22f58c30eac1869 (patch)
treeebbcea6f539fbb3a474217c45502632f0c84289a /src/net/sf/antcontrib/cpptasks/gcc
parent502ee6ac6df5cd8aa19c2c1f9db87861d763ac1b (diff)
downloadcpptasks-parallel-2dac20493cf190fb56f04d1fe22f58c30eac1869.tar.gz
cpptasks-parallel-2dac20493cf190fb56f04d1fe22f58c30eac1869.tar.bz2
cpptasks-parallel-2dac20493cf190fb56f04d1fe22f58c30eac1869.tar.xz
cpptasks-parallel-2dac20493cf190fb56f04d1fe22f58c30eac1869.zip
Fixed NARPLUGIN-106
Diffstat (limited to 'src/net/sf/antcontrib/cpptasks/gcc')
-rw-r--r--src/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java26
-rw-r--r--src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java13
-rw-r--r--src/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java13
-rw-r--r--src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java22
-rw-r--r--src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java66
5 files changed, 76 insertions, 64 deletions
diff --git a/src/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java b/src/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java
index 27cbfa5..5b743d3 100644
--- a/src/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java
+++ b/src/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java
@@ -55,17 +55,18 @@ public abstract class AbstractLdLinker extends CommandLineLinker {
args.addElement("-g");
}
if (isDarwin()) {
- if (linkType.isPluginModule()) {
+ if (linkType.isPluginModule()) {
args.addElement("-bundle");
-// FREEHEP
+// BEGINFREEHEP
} else if (linkType.isJNIModule()) {
args.addElement("-dynamic");
args.addElement("-bundle");
+// ENDFREEHEP
} else {
if (linkType.isSharedLibrary()) {
-// No longer needed for 10.4 and up.
-// args.addElement("-prebind");
- args.addElement("-dynamiclib");
+// FREEHEP no longer needed for 10.4+
+// args.addElement("-prebind");
+ args.addElement("-dynamiclib");
}
}
} else {
@@ -120,14 +121,15 @@ public abstract class AbstractLdLinker extends CommandLineLinker {
//
if (set.getType() != previousLibraryType) {
if (set.getType() != null && "static".equals(set.getType().getValue())) {
- // FREEHEP
- if (!isDarwin()) {
+// BEGINFREEHEP not on MacOS X
+ if (!isDarwin()) {
endargs.addElement("-Bstatic");
previousLibraryType = set.getType();
- }
+ }
+//ENDFREEHEP
} else {
- // FREEHEP FIXME, recheck this, works on MacOSX
- if (set.getType() == null &&
+// FREEHEP not on MacOS X, recheck this!
+ if (set.getType() == null ||
!"framework".equals(set.getType().getValue()) &&
!isDarwin()) {
endargs.addElement("-Bdynamic");
@@ -140,8 +142,8 @@ public abstract class AbstractLdLinker extends CommandLineLinker {
"framework".equals(set.getType().getValue()) &&
isDarwin()) {
buf.setLength(0);
-// buf.append("-framework ");
- endargs.addElement("-framework");
+// FREEHEP
+ endargs.addElement("-framework ");
}
int initialLength = buf.length();
for (int j = 0; j < libs.length; j++) {
diff --git a/src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java b/src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
index 49a3e35..409655b 100644
--- a/src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
+++ b/src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
@@ -84,13 +84,14 @@ public final class GccCCompiler extends GccCompatibleCCompiler {
public static GccCCompiler getG77Instance() {
return g77Instance;
}
-// FREEHEP
/**
- * Gets g95 adapter
+ * Gets g77 adapter
*/
+// FREEHEPBEGIN
public static GccCCompiler getGFortranInstance() {
return gfortranInstance;
}
+// FREEHEPEND
/**
* Gets gpp adapter
*/
@@ -130,10 +131,12 @@ public final class GccCCompiler extends GccCompatibleCCompiler {
if (isPICMeaningful && linkType.isSharedLibrary()) {
args.addElement("-fPIC");
}
- // FREEHEP -fno-rtti only valid for g++ and c++
- if (!getCommand().equals("g77") && !getCommand().equals("gcc") && (rtti != null) && !rtti.booleanValue()) {
- args.addElement("-fno-rtti");
+// BEGINFREEHEP
+ // Add -fno_rtti only for g++ and c++
+ if (!getCommand().equals("g77") && !getCommand().equals("gcc") && (rtti != null) && (!rtti.booleanValue())) {
+ args.addElement("-fno_rtti");
}
+// ENDFREEHEP
}
public Processor changeEnvironment(boolean newEnvironment, Environment env) {
if (newEnvironment || env != null) {
diff --git a/src/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java b/src/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java
index ea42faf..fa134f0 100644
--- a/src/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java
+++ b/src/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java
@@ -98,15 +98,16 @@ public abstract class GccCompatibleCCompiler extends CommandLineCCompiler {
args.addElement("-mwindows");
}
}
-// FREEHEP, moved to GccCCompiler
+// BEGINFREEHEP
+ if (!exceptions) {
+ args.addElement("-fno-exceptions");
+ }
+// ENDFREEHEP
+// BEGINFREEHEP moved to GccCCompiler
// if (rtti != null && !rtti.booleanValue()) {
// args.addElement("-fno-rtti");
// }
-// FREEHEP
- if (!exceptions) {
- args.addElement("-fno-exceptions");
- }
-
+// ENDFREEHEP
}
/**
* Adds an include path to the command.
diff --git a/src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java b/src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java
index 4c82743..ed1a052 100644
--- a/src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java
+++ b/src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java
@@ -33,7 +33,9 @@ public class GccLinker extends AbstractLdLinker {
private static final String[] libtoolObjFiles = new String[]{".fo", ".a",
".lib", ".dll", ".so", ".sl"};
private static String[] linkerOptions = new String[]{"-bundle",
- "-dynamic", "-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind", "-s",
+// FREEHEP
+ "-dynamic",
+ "-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind", "-s",
"-static", "-shared", "-symbolic", "-Xlinker",
"--export-all-symbols", "-static-libgcc",};
private static final GccLinker dllLinker = new GccLinker("gcc", objFiles,
@@ -43,11 +45,10 @@ public class GccLinker extends AbstractLdLinker {
discardFiles, "", "", false, null);
private static final GccLinker machBundleLinker = new GccLinker("gcc",
objFiles, discardFiles, "lib", ".bundle", false, null);
-// FREEHEP
- private static final GccLinker machJNILinker = new GccLinker("gcc",
- objFiles, discardFiles, "lib", ".jnilib", false, null);
private static final GccLinker machDllLinker = new GccLinker("gcc",
objFiles, discardFiles, "lib", ".dylib", false, null);
+ private static final GccLinker machJNILinker = new GccLinker("gcc",
+ objFiles, discardFiles, "lib", ".jnilib", false, null);
public static GccLinker getInstance() {
return instance;
}
@@ -194,14 +195,15 @@ public class GccLinker extends AbstractLdLinker {
if (type.isStaticLibrary()) {
return GccLibrarian.getInstance();
}
-// FREEHEP
+// BEGINFREEHEP
if (type.isJNIModule()) {
- if (isDarwin()) {
- return machJNILinker;
- } else {
- return dllLinker;
- }
+ if (isDarwin()) {
+ return machJNILinker;
+ } else {
+ return dllLinker;
+ }
}
+// ENDFREEHEP
if (type.isPluginModule()) {
if (isDarwin()) {
return machBundleLinker;
diff --git a/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java b/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
index 7b9af5f..9a70451 100644
--- a/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
+++ b/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
@@ -48,16 +48,17 @@ public class GppLinker extends AbstractLdLinker {
discardFiles, "", "", false, null);
private static final GppLinker machDllLinker = new GppLinker("gcc",
objFiles, discardFiles, "lib", ".dylib", false, null);
-// FREEHEP
- private static final GppLinker machJNILinker = new GppLinker("gcc",
- objFiles, discardFiles, "lib", ".jnilib", false, null);
private static final GppLinker machPluginLinker = new GppLinker("gcc",
objFiles, discardFiles, "lib", ".bundle", false, null);
+// FREEHEP
+ private static final GppLinker machJNILinker = new GppLinker("gcc",
+ objFiles, discardFiles, "lib", ".jnilib", false, null);
public static GppLinker getInstance() {
return instance;
}
private File[] libDirs;
private String runtimeLibrary;
+// FREEEHEP
private String gccLibrary;
protected GppLinker(String command, String[] extensions,
String[] ignoredExtensions, String outputPrefix,
@@ -75,34 +76,34 @@ public class GppLinker extends AbstractLdLinker {
args.addElement("-mwindows");
}
}
-// FREEHEP, avoid stdc++ if requested
+// BEGINFREEHEP link or not with libstdc++
runtimeLibrary = null;
gccLibrary = null;
if (linkType.linkCPP()) {
- if (linkType.isStaticRuntime()) {
- String[] cmdin = new String[]{"g++", "-print-file-name=libstdc++.a"};
- String[] cmdout = CaptureStreamHandler.run(cmdin);
- if (cmdout.length > 0) {
- runtimeLibrary = cmdout[0];
- } else {
- runtimeLibrary = null;
- }
- gccLibrary = "-static-libgcc";
- } else {
- runtimeLibrary = "-lstdc++";
-// FIXME, needed to add exceptions here for MacOS X.
- gccLibrary = "-fexceptions";
- }
+ if (linkType.isStaticRuntime()) {
+ String[] cmdin = new String[]{"g++", "-print-file-name=libstdc++.a"};
+ String[] cmdout = CaptureStreamHandler.run(cmdin);
+ if (cmdout.length > 0) {
+ runtimeLibrary = cmdout[0];
+ } else {
+ runtimeLibrary = null;
+ }
+ gccLibrary = "-static-libgcc";
+ } else {
+ runtimeLibrary = "-lstdc++";
+ // NOTE: added -fexceptions here for MacOS X
+ gccLibrary = "-fexceptions";
+ }
} else {
- if (linkType.isStaticRuntime()) {
- gccLibrary = "-static-libgcc";
- } else {
- gccLibrary = "-shared-libgcc";
- }
+ if (linkType.isStaticRuntime()) {
+ gccLibrary = "-static-libgcc";
+ } else {
+ gccLibrary = "-shared-libgcc";
+ }
}
- // FREEHEP: set flag
- linkType.callAddLibrarySets = true;
+// ENDFREEHEP
}
+
public String[] addLibrarySets(CCTask task, LibrarySet[] libsets,
Vector preargs, Vector midargs, Vector endargs) {
String[] rs = super.addLibrarySets(task, libsets, preargs, midargs,
@@ -110,9 +111,11 @@ public class GppLinker extends AbstractLdLinker {
if (runtimeLibrary != null) {
endargs.addElement(runtimeLibrary);
}
+// BEGINFREEHEP
if (gccLibrary != null) {
endargs.addElement(gccLibrary);
}
+// ENDFREEHEP
return rs;
}
/**
@@ -209,14 +212,15 @@ public class GppLinker extends AbstractLdLinker {
if (type.isStaticLibrary()) {
return GccLibrarian.getInstance();
}
-// FREEHEP
+// BEGINFREEHEP
if (type.isJNIModule()) {
- if (isDarwin()) {
- return machJNILinker;
- } else {
- return dllLinker;
- }
+ if (GccProcessor.getMachine().indexOf("darwin") >= 0) {
+ return machJNILinker;
+ } else {
+ return dllLinker;
+ }
}
+// ENDFREEHEP
if (type.isPluginModule()) {
if (GccProcessor.getMachine().indexOf("darwin") >= 0) {
return machPluginLinker;