Discussion:
Invocation of compiler by AC_LINK_IFELSE
Miguel Guedes
2013-07-18 10:59:47 UTC
Permalink
Hello,


I am using AC_LANG_PROGRAM wrapped inside AC_LINK_IFELSE to test for
libboost_system and it invokes gcc/g++ in the following way:

configure:3975: g++ -o conftest -g -O2 -lboost_system conftest.cpp

The above results in a few errors and doesn't link even though the
library in question is present in the system. This is because the source
file should be at the front in the call to g++, e.g.:

g++ conftest.cpp -o conftest -g -O2 -lboost_system

What can be done to overcome this limitation? Can the parameter order be
customized somehow or perhaps some other macro be used?


Miguel
Thomas Jahns
2013-07-18 11:12:31 UTC
Permalink
Post by Miguel Guedes
I am using AC_LANG_PROGRAM wrapped inside AC_LINK_IFELSE to test for
configure:3975: g++ -o conftest -g -O2 -lboost_system conftest.cpp
The above results in a few errors and doesn't link even though the
library in question is present in the system. This is because the source
g++ conftest.cpp -o conftest -g -O2 -lboost_system
What can be done to overcome this limitation? Can the parameter order be
customized somehow or perhaps some other macro be used?
this is probably a user error. Would you mind showing the contents of the LIBS
and LDFLAGS variables? You probably put your -lboost_system into LDFLAGS but it
has to go into LIBS.

Ciao, Thomas
--
Thomas Jahns
DKRZ GmbH, Department: Application software

Deutsches Klimarechenzentrum
Bundesstraße 45a
D-20146 Hamburg

Phone: +49-40-460094-151
Fax: +49-40-460094-270
Email: Thomas Jahns <***@dkrz.de>
Miguel Guedes
2013-07-18 11:33:28 UTC
Permalink
Post by Thomas Jahns
this is probably a user error. Would you mind showing the contents of
the LIBS and LDFLAGS variables? You probably put your -lboost_system
into LDFLAGS but it has to go into LIBS.
You're right - it was a user error. I was indeed using LDFLAGS rather
than LIBS.

Thanks, Thomas!

Loading...