autoconf
[Top][All Lists]
Advanced

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

AC_FC_DUMMY_MAIN broken with gcc4/gfortran


From: Bill Northcott
Subject: AC_FC_DUMMY_MAIN broken with gcc4/gfortran
Date: Thu, 24 Aug 2006 22:34:43 +1000

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]