[Top][All Lists]

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

Re: Fortran linking on NetBSD (was: autoconf-2.50 docs...)

From: Akim Demaille
Subject: Re: Fortran linking on NetBSD (was: autoconf-2.50 docs...)
Date: 28 Jun 2001 18:09:43 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor)

Hi Steven,

Thanks a lot for your work!  It's very nice!

| This is, in some sense, a fairly major change, as most users of the
| current AC_F77_WRAPPERS should alter their code to take advantage of this
| new macro.  Also, I had to modify AC_LANG_PROGRAM(C) to define the dummy
| main, if it is known; otherwise, any link test against Fortran libraries
| will fail.  However, I don't see any viable alternative.

I have not understood why you don't systematically check for such a
main.  After all, the user is still free to use it or not, but why
should she have to know this macro exists, and to know she needs to
include it in

I'm very much in favor of having this run by default.

| Index: aclang.m4
| ===================================================================
| RCS file: /cvs/autoconf/aclang.m4,v
| retrieving revision 1.137
| diff -u -r1.137 aclang.m4
| --- aclang.m4 2001/06/25 06:14:43     1.137
| +++ aclang.m4 2001/06/26 14:11:46
| @@ -356,6 +356,12 @@
|  # --------------------------------------
|  m4_define([AC_LANG_PROGRAM(C)],
|  [$1
| +#ifdef F77_DUMMY_MAIN
| +#  ifdef __cplusplus
| +     extern "C"
| +#  endif
| +   int F77_DUMMY_MAIN() { return 1; }
| +#endif

This main is not expected to be run, right?  So maybe abort would be
more adequate?

Can't we set up say AC_LIBOBJ(fortran_main) which would define this

| +[AC_LANG_PUSH(C)dnl
| + ac_save_LIBS=$LIBS

Watch out, ac_save_LIBS is heavily used, and we already had some
conflicts on it!  Please, take something even more private.

| + # First, try linking without a dummy main:
| + AC_TRY_LINK([],[],ac_cv_f77_dummy_main=none,ac_cv_f77_dummy_main=unknown)

If you feel brave enough, please use AC_LINK_IFELSE, AC_TRY_LINK is to
be obsoleted.

| +    [AC_DEFINE_UNQUOTED([F77_DUMMY_MAIN], $ac_cv_f77_dummy_main,
| +       [Define to dummy "main" function (if any) required to link to the 
Fortran 77 libraries.])])

You can split as

| +    [AC_DEFINE_UNQUOTED([F77_DUMMY_MAIN], $ac_cv_f77_dummy_main,
| +       [Define to dummy "main" function (if any) required to link
           to the Fortran 77 libraries.])])

which looks better.

Feel free to apply your changes, and please, include a NEWS.

Thanks again!

reply via email to

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