Actually it makes not much sense to ask about why autoconf a/o libtool does this or that, as the tools themselves are coded beyond understanding or readability. They just do on some systems what they are expected to do.
Of course AC_CHECK_LIB([m],[main]), shouldn't return true as main is no member of libm. On the other hand AC_CHECK_LIB or other AC macros aren't meant to be tested against transzendental usage and it should be quite clear by definition that main is not part of the true set of AC_CHECK_LIB([x],main) ∀ (x,main). If this returns true its just a trivial true signal, that is to expensive and transzendental to get blocked. > I've changed AC_CHECK_LIB([m], [ceil]) to AC_CHECK_LIB([m], [main]) and it > works. according to conftest.c, libtool generate a small peace of code to > check whether the specific function exists or not. for AC_CHECK_LIB([m], > [main]), the code is: > main() > { > return main(); > ; > return 0; > } > call main itself in gcc will cause a crash, why it can works here? > > > On Thu, Jul 3, 2014 at 2:46 PM, Minxuan Zhuang <z82507...@gmail.com> wrote: > >> hi: >> I have a configure.ac file includes: AC_CHECK_LIB([m], [ceil]) >> then I got this result: checking for ceil in -lm... no >> but a .c file contains ceil function works very well with or without -lm, >> why is that? >> >> libtool version: 2.4.2 >> system: Ubuntu 13.04 >> _______________________________________________ https://lists.gnu.org/mailman/listinfo/libtool