Reputation: 1268
I'm confused why a configure script generated by autoscan and autoconf tells me it can't find the functions pow
and sqrt
in a c++ code that includes the cmath
header file. I am calling AC_CHECK_FUNCS([pow sqrt])
(which returns a "no" answer). The code compiles and runs just fine, no errors whatsoever.
C++ code:
#include <cmath>
...
x = sqrt(y);
configure.ac:
AC_CHECK_FUNCS([pow sqrt])
There are no library checks, but I don't need to link -lm
on the command line for cmath. I'm not sure if this is the holdup. Seems fairly simple, so I'm confused why it's not working. FYI, g++ 4.1.2, autoconf 2.59, RedHat EL 5.3.
Upvotes: 2
Views: 757
Reputation: 58794
Since you are compiling C++ code you should switch autoconf to run its tests with C++, e.g. add
AC_LANG(C++)
before your checks. This will run the tests with C++, but still only check existence of the corresponding C function. See caveats here.
Upvotes: 3