Bizarre test for main in libm
Loren James Rittle
rittle@latour.rsch.comm.mot.com
Thu May 1 21:02:00 GMT 2003
In article <200305011038.h41AcJm15772@pc960.cambridge.arm.com> you write:
> libstdc++-v3/aclocal.m4 contains the following test:
>
> dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
> AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
> dnl Check for complex versions of math functions of platform.
> AC_CHECK_LIB(m, main)
>
> Now this test for main in libm is broken as best I can see, since it is
> expanded into
>
> int main() {
> main()
> ; return 0; }
>
> Which of course always compiles and links without error (since it's
> recursive).
>
> Does anyone know why that test is there in the first place?
I didn't know the answer off hand. I'll take a stab with how I did it.
(First, realize that acinclude.m4 begets aclocal.m4 .)
; ccvs annotate libstdc++-v3/acinclude.m4 |grep 'm, main'
Annotations for libstdc++-v3/acinclude.m4
***************
1.77 (mmitchel 30-Oct-00): AC_CHECK_LIB(m, main)
(Consult gcc-patches circa Oct 2000.)
http://gcc.gnu.org/ml/gcc-patches/2000-10/msg01007.html
Mark, mentioned that the patch was sort-a-ugly. Are there any systems
where there is no -lm? The above test would not link if -lm was not
found. Correct?
Regards,
Loren
More information about the Libstdc++
mailing list