From: Marc W. <Mar...@si...> - 2004-10-15 08:41:26
|
Now I have a C++ compiler executable named "trace", which changes all classes by adding function trace to all member functions. If I compile with trace -I /path/to/fntrace -d-include -dfntrace.hxx \ -- -o x x.cpp instead of g++ -o x x.cpp Then my classes in x.cpp print a very verbose function trace. Now I have created a huge project with GNU Autotools, so to build it, simply call: ./configure && make Question: Can I exchange the GNU g++ by my own "trace" without changing a single line in my project? Approach: The first approach is: CXX="trace -I <path> -d-include -dfntrace.hxx --" \ ./configure && make But unfortunately configure fails because link options are not passed to the linker, i.e. The following does not work: trace <as-above> -- -o x x.cpp -liberty But I get the error message: [MetaclassRegistration...] EXECUTING g++ g++ -I <path> -include fntrace.hxx \ -liberty -D__opencxx -E -o conftest.occ \ -x c++ conftest.cc g++: -liberty: linker input file unused because \ linking not done EXECUTING g++ g++ -o conftest -g -O2 conftest.ii -> Link errors, because the second, not the first call, must be with -liberty, but the second call is missing the link option. Why? Is this a bug or missing feature in OpenC++? I think so. Any other idea? Other question: How do I split my homebrew enhanced compiler "trace" into the three common steps: Preprocessing, compiling, linking? I suppose, I only need my own compiler for preprocessing, i.e. to generate x.ii, then for compiling and linking, I can use the normal g++? Thank you Regards Marc |