Reputation: 821
I am having some source package whose developer is comfortably using an ancient GCC version, where compilation requires the -lz flags before the object specs. The package is very "branchy" and the automake and autoconf very "stuffy" so I have two questions:
First question is how to configure my autotools to set the -lz flag behind?
Second, is it possible to force setting at back of this -lz flag without messing with the makefile.ac and configure.ac files? Since this is not my software package always editing these files whenever I am doing a new build is simply not an option.
Note that if I copy the compilation line that throws the error and just put the -lz and -lxerces-c flags at the end then it works. So I have to somehow change this in autotools.
UPDATE:
Well I managed to somehow fix it by running the badly configured line with
$ g++ line_contents -lz -lxerces-c
(making sure to be in the right directory)
And then I just had the idea of running make again, it seemed that automake considered that step passed and just went forward.
Still, it would be nice to find an answer on how to change the order with the autotools!
Upvotes: 0
Views: 237
Reputation: 9394
You can write your own "gcc" for that task.
Python or bash script that check if one of arguments is -lz
,
and reoder them and then call real gcc
.
After that just run CC=path/to/your/gcc ./configure
and all stuff should work.
Upvotes: 1