bug-autoconf
[Top][All Lists]
Advanced

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

Re: autoconf-2.57f: make check: 2 Errors related to fort77 (fink package


From: Akim Demaille
Subject: Re: autoconf-2.57f: make check: 2 Errors related to fort77 (fink package) on Mac OS X
Date: Fri, 31 Oct 2003 09:47:43 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

 > On Mon, 27 Oct 2003, Akim Demaille wrote:
 >> > Actually, Akim, using 'if test "$G77" = yes; then' in tests/fortran.at
 >> > with AC_FC_FREEFORM is currently wrong anyway, because G77 is only set by
 >> > AC_PROG_F77, not by AC_PROG_FC.
 >>
 >> But fortran.at tests Fortran 77, not Fortran.  I don't know how I am
 >> expected to solve this issue.  Please, help me!

 > If fortran.at is only supposed to be testing Fortran 77, then none of the
 > AC_FC_* macros should be in there.  (I'm not sure where you want to put
 > them, though.)

I had not understood this fact.  Then Autoconf itself should complain
loudly.  I'm installing the appended patch, that causes the former
test suite to:

| src/ace/tests % ./testsuite -k fortran
| ## ------------------------------ ##
| ## GNU Autoconf 2.57h test suite. ##
| ## ------------------------------ ##
|  66: GNU Fortran 77                               FAILED (fortran.at:65)
|
| ## ------------- ##
| ## Test results. ##
| ## ------------- ##
|
| ERROR: 1 test was run,
| 1 failed unexpectedly.
| ## -------------------------- ##
| ## testsuite.log was created. ##
| ## -------------------------- ##
|
| Please send `testsuite.log' and all information you think might help:
|
|    To: <address@hidden>
|    Subject: [GNU Autoconf 2.57h] testsuite: 66 failed
|
|
| You may investigate any problem if you feel able to do so, in which
| case the test suite provides a good starting point.
|
| src/ace/tests % less testsuite.dir/066/testsuite.log
| 66. fortran.at:65: testing ...
| fortran.at:65: autoconf -W obsolete
| --- /dev/null   2003-08-25 08:58:39.000000000 +0200
| +++ /home/akim/src/ace/tests/testsuite.dir/at-stderr    2003-10-31 
09:22:14.0000
| 00000 +0100
| @@ -0,0 +1,5 @@
| +configure.ac:29: error: AC_LANG_ASSERT: current language is not Fortran:  
Fortr
| an 77
| +/home/akim/src/ace/lib/autoconf/lang.m4:196: AC_LANG_ASSERT is expanded 
from...
| +/home/akim/src/ace/lib/autoconf/fortran.m4:1214: AC_FC_FREEFORM is expanded 
fro
| m...
| +configure.ac:29: the top level
| +autom4te: /usr/local/bin/m4 failed with exit status: 1
| fortran.at:65: exit code was 1, expected 0
| 66. fortran.at:65: 66. GNU Fortran 77 (fortran.at:65): FAILED (fortran.at:65)

I saw that you have wrapped many macros with AC_LANG_PUSH/POP.  I
don't think this is the right thing to do.  Rather, you should require
from the user to call these macros with the right current language.  I
have appended some notes about this in the documentation.


 > I would just remove the $G77-specific AC_FREEFORM test entirely from
 > fortran.at.  You could, of course, use $ac_cv_fc_compiler_gnu instead of
 > $G77, but that still wouldn't really be right, because in the near future
 > $FC may well be gfortran and not g77, and who knows what flags it will
 > accept.

You are right.  But in the meanwhile, it helped to catch a few
mistakes.  So let's proceed with maybe too fragile a test, but still
efficient.


 > (Isn't AC_FC_FREEFORM already tested in acfortran.at?  I have to admit I
 > don't completely understand these different files in the tests/
 > directory.)

It is, but it is just run.  Consider ac*.at as plain stupid sanity
checks.  fortran.at tries to perform smarter and stricter tests.

Please, review this (installed) patch, and tell me whether the failure
remains.



Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * tests/fortran.at (GNU Fortran 77): Don't run FC macros.
        (GNU Fortran): New.
        * doc/autoconf.texi (Language Choice): Document.
        * lib/autoconf/fortran.m4 (AC_FC_SRCEXT, AC_FC_FREEFORM): Assert
        the current language is Fortran.

Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.317
diff -u -u -r1.317 NEWS
--- NEWS 27 Oct 2003 11:12:50 -0000 1.317
+++ NEWS 31 Oct 2003 08:44:02 -0000
@@ -3,6 +3,9 @@
 ** core.*
   core.* files are no longer removed, as they may be valid user files.
 
+** New macros
+  AC_LANG_ASSERT.
+
 * Major changes in Autoconf 2.57g
 
   Released 2003-10-24, by Akim Demaille
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.771
diff -u -u -r1.771 autoconf.texi
--- doc/autoconf.texi 23 Oct 2003 07:49:16 -0000 1.771
+++ doc/autoconf.texi 31 Oct 2003 08:44:03 -0000
@@ -5624,9 +5624,10 @@
 Fortran standards, and have output variables like @code{FC},
 @code{FCFLAGS}, and @code{FCLIBS}.
 
-Except for two new macros @code{AC_FC_SRCEXT} and @code{AC_FC_FREEFORM}
-(see below), the @code{FC} and @code{F77} macros behave almost identically, 
and so
-they are documented together in this section.
+Except for two new macros @code{AC_FC_SRCEXT} and
address@hidden (see below), the @code{FC} and @code{F77} macros
+behave almost identically, and so they are documented together in this
+section.
 
 
 @defmac AC_PROG_F77 (@ovar{compiler-search-list})
@@ -5957,7 +5958,6 @@
 calls @ovar{action-if-success} (defaults to nothing). If it fails, it
 calls @ovar{action-if-failure} (defaults to exiting with an error
 message).
-
 @end defmac
 
 @node System Services
@@ -6186,8 +6186,6 @@
 Do compilation tests using @code{FC} and use extension @file{.f} (or
 whatever has been set by @code{AC_FC_SRCEXT}) for test programs.  Use
 compilation flags: @code{FCFLAGS}.
-
-
 @end table
 @end defmac
 
@@ -6215,6 +6213,25 @@
 @end example
 @end defmac
 
address@hidden AC_LANG_ASSERT (@var{language})
address@hidden Check statically that the current language is
address@hidden  You should use this in your language specific macros
+to avoid that they be called with an inappropriate language.
+
+This macro runs only at @command{autoconf} time, and incurs no cost at
address@hidden time.  Sadly enough and because Autoconf is a two
+layer language @footnote{Because M4 is not aware of Sh code,
+especially conditionals, some optimizations that look nice statically
+may produce incorrect results at runtime.}, the macros
address@hidden/@code{AC_LANG_POP} cannot be ``optimizing'',
+therefore as much as possible you ought to avoid using them to wrap
+your code, rather, require from the user to run the macro with a
+correct current language, and check it with @code{AC_LANG_ASSERT}.
+And anyway, that may help the user understand she is running a Fortran
+macro while expecting a result about her Fortran 77 compiler...
address@hidden defmac
+
+
 @defmac AC_REQUIRE_CPP
 @acindex{REQUIRE_CPP}
 Ensure that whichever preprocessor would currently be used for tests has
@@ -15707,5 +15724,6 @@
 @bye
 
 @c Local Variables:
address@hidden fill-column: 72
 @c ispell-local-dictionary: "american"
 @c End:
Index: lib/autoconf/fortran.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/fortran.m4,v
retrieving revision 1.180
diff -u -u -r1.180 fortran.m4
--- lib/autoconf/fortran.m4 23 Oct 2003 08:22:28 -0000 1.180
+++ lib/autoconf/fortran.m4 31 Oct 2003 08:44:03 -0000
@@ -699,6 +699,7 @@
 AC_SUBST([]_AC_LANG_PREFIX[]LIBS)
 ])# _AC_FC_LIBRARY_LDFLAGS
 
+
 # AC_F77_LIBRARY_LDFLAGS
 # ----------------------
 AC_DEFUN([AC_F77_LIBRARY_LDFLAGS],
@@ -708,6 +709,7 @@
 AC_LANG_POP(Fortran 77)dnl
 ])# AC_F77_LIBRARY_LDFLAGS
 
+
 # AC_FC_LIBRARY_LDFLAGS
 # ----------------------
 AC_DEFUN([AC_FC_LIBRARY_LDFLAGS],
@@ -803,6 +805,7 @@
             [AC_MSG_FAILURE([linking to Fortran libraries from C fails])])])
 ])# _AC_FC_DUMMY_MAIN
 
+
 # AC_F77_DUMMY_MAIN
 # ----------------------
 AC_DEFUN([AC_F77_DUMMY_MAIN],
@@ -812,6 +815,7 @@
 AC_LANG_POP(Fortran 77)dnl
 ])# AC_F77_DUMMY_MAIN
 
+
 # AC_FC_DUMMY_MAIN
 # ----------------------
 AC_DEFUN([AC_FC_DUMMY_MAIN],
@@ -859,8 +863,9 @@
                     called from a `main' in the Fortran libraries.])
 ])# _AC_FC_MAIN
 
+
 # AC_F77_MAIN
-# ----------------------
+# -----------
 AC_DEFUN([AC_F77_MAIN],
 [AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])dnl
 AC_LANG_PUSH(Fortran 77)dnl
@@ -868,8 +873,9 @@
 AC_LANG_POP(Fortran 77)dnl
 ])# AC_F77_MAIN
 
+
 # AC_FC_MAIN
-# ----------------------
+# ----------
 AC_DEFUN([AC_FC_MAIN],
 [AC_REQUIRE([AC_FC_LIBRARY_LDFLAGS])dnl
 AC_LANG_PUSH(Fortran)dnl
@@ -969,6 +975,7 @@
 # The replacement is empty.
 AU_DEFUN([AC_F77_NAME_MANGLING], [])
 
+
 # _AC_F77_NAME_MANGLING
 # ----------------------
 AC_DEFUN([_AC_F77_NAME_MANGLING],
@@ -979,6 +986,7 @@
 AC_LANG_POP(Fortran 77)dnl
 ])# _AC_F77_NAME_MANGLING
 
+
 # _AC_FC_NAME_MANGLING
 # ----------------------
 AC_DEFUN([_AC_FC_NAME_MANGLING],
@@ -1034,8 +1042,9 @@
 esac
 ])# _AC_FC_WRAPPERS
 
+
 # AC_F77_WRAPPERS
-# ----------------------
+# ---------------
 AC_DEFUN([AC_F77_WRAPPERS],
 [AC_REQUIRE([_AC_F77_NAME_MANGLING])dnl
 AC_LANG_PUSH(Fortran 77)dnl
@@ -1043,8 +1052,9 @@
 AC_LANG_POP(Fortran 77)dnl
 ])# AC_F77_WRAPPERS
 
+
 # AC_FC_WRAPPERS
-# ----------------------
+# --------------
 AC_DEFUN([AC_FC_WRAPPERS],
 [AC_REQUIRE([_AC_FC_NAME_MANGLING])dnl
 AC_LANG_PUSH(Fortran)dnl
@@ -1118,10 +1128,10 @@
 # some versions), the $FCFLAGS_<EXT> variable *must* go immediately before
 # the source file on the command line, unlike other $FCFLAGS.  Ugh.
 AC_DEFUN([AC_FC_SRCEXT],
-[AC_CACHE_CHECK([for Fortran flag to compile .$1 files],
+[AC_LANG_ASSERT(Fortran)dnl
+AC_CACHE_CHECK([for Fortran flag to compile .$1 files],
                 ac_cv_fc_srcext_$1,
-[AC_LANG_PUSH(Fortran)dnl
-ac_ext=$1
+[ac_ext=$1
 ac_fc_srcext_FCFLAGS_SRCEXT_save=$FCFLAGS_SRCEXT
 FCFLAGS_SRCEXT=""
 ac_cv_fc_srcext_$1=unknown
@@ -1131,7 +1141,6 @@
 done
 rm -f conftest.$ac_objext conftest.$1
 FCFLAGS_SRCEXT=$ac_fc_srcext_FCFLAGS_SRCEXT_save
-AC_LANG_POP(Fortran)dnl
 ])
 if test "x$ac_cv_fc_srcext_$1" = xunknown; then
   m4_default([$3],[AC_MSG_ERROR([Fortran could not compile .$1 files])])
@@ -1170,10 +1179,10 @@
 # We try to test the "more popular" flags first, by some prejudiced
 # notion of popularity.
 AC_DEFUN_ONCE([AC_FC_FREEFORM],
-[AC_CACHE_CHECK([for Fortran flag needed to allow free-form source],
+[AC_LANG_ASSERT([Fortran])dnl
+AC_CACHE_CHECK([for Fortran flag needed to allow free-form source],
                 ac_cv_fc_freeform,
-[AC_LANG_PUSH(Fortran)dnl
-ac_cv_fc_freeform=unknown
+[ac_cv_fc_freeform=unknown
 ac_fc_freeform_FCFLAGS_save=$FCFLAGS
 for ac_flag in none -ffree-form -FR -free -qfree -Mfree -Mfreeform \
                -freeform "-f free"
@@ -1189,7 +1198,6 @@
 done
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 FCFLAGS=$ac_fc_freeform_FCFLAGS_save
-AC_LANG_POP(Fortran)dnl
 ])
 if test "x$ac_cv_fc_freeform" = xunknown; then
   m4_default([$2],
Index: tests/fortran.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/fortran.at,v
retrieving revision 1.4
diff -u -u -r1.4 fortran.at
--- tests/fortran.at 30 Sep 2003 13:03:02 -0000 1.4
+++ tests/fortran.at 31 Oct 2003 08:44:03 -0000
@@ -49,6 +49,18 @@
   test "$G77" = yes &&
     AC_MSG_ERROR([incorrectly recognized a GNU Fortran 77 compiler])
 fi
+]])
+
+
+
+## ------------------ ##
+## Fortran Compiler.  ##
+## ------------------ ##
+
+
+AT_CHECK_MACRO([GNU Fortran],
+[[AC_LANG(Fortran)
+AC_LANG_COMPILER
 
 # No Fortran compiler is known not to support "*.f".
 AC_FC_SRCEXT([f])
@@ -56,10 +68,10 @@
 # GNU Fortran is known to support freeform.
 AC_FC_FREEFORM([],
                [AC_MSG_WARN([Fortran does not accept free-form source])])
-if test "$G77" = yes; then
+if test "$ac_compiler_gnu" = yes; then
   case $FCFLAGS in
    *-ffree-form*) ;;
-   *) AC_MSG_ERROR([failed to recognize G77's -ffree-form option.]);;
+   *) AC_MSG_ERROR([failed to recognize GNU Fortran's -ffree-form option.]);;
   esac
 fi
 ]])




reply via email to

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