AC_FC_DUMMY_MAIN broken with gcc4/gfortran

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Following my last post I have done some digging on AC_FC_DUMMY_MAIN.

The current version of this macro uses a test program like:

#define F77_DUMMY_MAIN some_candidate_for_dummy_main
#ifdef F77_DUMMY_MAIN

#  ifdef __cplusplus
     extern "C"
#  endif
   int F77_DUMMY_MAIN() { return 1; }

#endif
int
main ()
{

  ;
  return 0;
}

Using gcc4 and gfortran FLIBS include '-lgfortranbegin -lgfortran'. libgfortranbegin defines _main and needs _MAIN__

Since the test program also defines _main it will never link because of the multiply defined symbol! So the test for a dummy main will never succeed.

If I use a test program like this (just change the main function from 'main' to 'foo'), the test structure correctly identifies dummy main on my system (Darwin 8.7 ppc or i386 with gcc4.0.3/gfortran) as 'MAIN__'

#define F77_DUMMY_MAIN some_candidate_for_dummy_main
#ifdef F77_DUMMY_MAIN

#  ifdef __cplusplus
     extern "C"
#  endif
   int F77_DUMMY_MAIN() { return 1; }

#endif
int
foo ()
{

  ;
  return 0;
}

Again, I do not understand how such a change might play on other systems.

Cheers
Bill Northcott


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux