I am having a problem with a configure script verifying the presence of some basic functions,
AC_CHECK_FUNCS([floor gettimeofday memset pow sqrt sin exp])
Under certain criteria, the results are expected (checking for x... yes). Otherwise the math functions above are claimed to be not defined. The difference is a call to verify some lapack routines first. These are checked by, AC_CHECK_LIB([lapack],[dsyev_],.... If these checks are not done first, then the above math functions fail to check (final compilation works).
I’ve reduced the configure script to the following that recreates the issue,
AC_INIT([TEST], [0.0], [none@none.com])
#AC_CHECK_LIB([lapack],[dsyev_], , AC_MSG_FAILURE([Missing lapack]))
AC_CHECK_FUNCS([floor gettimeofday memset pow sqrt sin exp])
Uncommenting the second line results in proper visual results. I imagine that the math library isn’t included or checked for some reason. In fact, AC_CHECK_LIB([m],[exp]) works fine.
What’s the cause of this, and what is the proper way to use this directive? What kind of x-platform considerations should I observe?
The math functions are in the math library, so if you want them, you need to pull the math library into the link arguments that
configureuses.AC_CHECK_LIB([m],[exp])is one way to do that. The reason thatAC_CHECK_LIB([lapack],...)also has that effect is that it quite probably pulls in-lmitself (not knowing the library, but I read it’s for linear algebra).I suggest that you avoid
AC_CHECK_LIBand instead useAC_SEARCH_LIBSfor functions that are potentially not in the standard C library. So(But using
AC_CHECK_LIBis not actually wrong.)