libtool-patches
[Top][All Lists]
Advanced

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

Re: Fortran 90/95 (FC) support


From: Ralf Wildenhues
Subject: Re: Fortran 90/95 (FC) support
Date: Fri, 12 Aug 2005 17:41:52 +0200
User-agent: Mutt/1.4.1i

Hi Patrick,

Thanks or reporting this!  I've copied the libtool-patches list.

* Patrick Welche wrote on Thu, Aug 11, 2005 at 07:48:29PM CEST:
> On Mon, Aug 08, 2005 at 11:28:51AM +0200, Ralf Wildenhues wrote:
> > * Ralf Wildenhues wrote on Fri, Jun 10, 2005 at 12:24:00AM CEST:
> > > In order to make the Libtool build and test suite a bit slower  :->
> > > I hacked in initial `modern Fortran' support, i.e., support for
> > > Autoconf's FC interface.
*snip*

> Just one thing: I don't have fc, the only just gnu fortran 3.3.3, so the
> fcdemo tests should fail for me right? Maybe they should be skipped?

Hmm.  g77 should in principle work fine with the FC Autoconf/Automake
interface, and is intended to work with Libtool's FC support as well.
OTOH, it does not work with .f90 files, and that is what we test
specifically in the fcdemo tests (using "-x f77" is not really
appropriate for the test).

> checking dependency style of gcc... gcc3
> checking whether we are using the GNU Fortran compiler... yes
> checking whether g77 accepts -g... yes
> checking how to get verbose linking output from g77... -v
> checking for Fortran libraries of g77...  -L/usr/bin/../libexec -lfrtbegin 
> -lg2c -lm -lgcc_s
> checking for dummy main to link with Fortran libraries... none
> checking for Fortran name-mangling scheme... lower case, underscore, extra 
> underscore
> checking for Fortran flag to compile .f90 files... unknown
> configure: error: Fortran could not compile .f90 files
> fcdemo-static.test: ===  FAILED: Configuring in 
> /usr/src/local/libtool/tests/fcdemo

For maximum portability, we could of course change the fcdemo test to be
as restrictive as the f77demo test.  But I don't really like to do that,
the test is also nice for checking the relatively recent Autoconf
improvements in that area, also I expect users will use FC for Fortran
90/95 rather than plain 77.

Since f77demo should provide enough coverage in that case, how about
this patch to skip instead of fail if we can assume the compiler to
be Fortran 77-only?

Let's see: I don't mind the configure script failing -- in a real-world
example, it should do precisely that.  So here's a hack which should
cause the configure failure to report a SKIP to the testsuite when we
can reasonably believe this to be a Fortran 77 compiler (the names are
taken from Autoconf's list of F77 compilers).

OK to apply to HEAD and branch-2-0?

Cheers,
Ralf
        * tests/defs.m4sh (func_configure): Rename to ..
        (func_configure_nofail): this, call from old.
        * tests/fcdemo-conf.test, tests/fcdemo-shared.test,
        tests/fcdemo-static.test: Use.  Do not fail gratuitously but
        SKIP on compilers that look like they could be Fortran 77-only.
        Reported by Patrick Welche <address@hidden>.

Index: tests/defs.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/defs.m4sh,v
retrieving revision 1.12
diff -u -r1.12 defs.m4sh
--- tests/defs.m4sh     27 Apr 2005 11:37:29 -0000      1.12
+++ tests/defs.m4sh     12 Aug 2005 19:01:08 -0000
@@ -171,14 +171,15 @@
     done
 }
 
-# func_configure [args ...]
+# func_configure_nofail [args ...]
 # Configure the demonstration.
-func_configure ()
+func_configure_nofail ()
 {
     $opt_debug
     my_args=${1+"$@"}
     my_dir=`pwd | $SED "$basename"`
     my_testdir="$srcdir/tests/$my_dir"
+    conf_status=$EXIT_FAILURE
 
     test -n "$my_args" && my_args=" $my_args"
     my_args="--srcdir="\""$my_testdir"\"" --prefix="\""$prefix"\""$my_args"
@@ -187,14 +188,26 @@
     func_msg "Configuring in $my_dir"
 
     test -f "$my_testdir/configure" || autoreconf --force --install $my_testdir
-    test -f "$my_testdir/configure" || exit $EXIT_FAILURE
+    if test -f "$my_testdir/configure"; then
+
+      eval func_msg $SHELL "$my_testdir/configure" $my_args
+      if eval $SHELL "$my_testdir/configure" $my_args; then
+       conf_status=$EXIT_SUCCESS
+      else
+       func_msg "FAILED: Configuring in $my_testdir"
+       ls -ltr $my_testdir
+      fi
+    fi
+}
 
-    eval func_msg $SHELL "$my_testdir/configure" $my_args
-    eval $SHELL "$my_testdir/configure" $my_args || \
-      { func_msg "FAILED: Configuring in $my_testdir"
-        ls -ltr $my_testdir
-       exit $EXIT_FAILURE;
-      }
+# func_configure [args ...]
+# Configure the demonstration, fail on error.
+func_configure ()
+{
+    func_configure_nofail
+    if test "$conf_status" -eq "$EXIT_FAILURE"; then
+      exit $EXIT_FAILURE
+    fi
 }
 
 # func_check_static_shared staticp sharedp
Index: tests/fcdemo-conf.test
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/fcdemo-conf.test,v
retrieving revision 1.1
diff -u -r1.1 fcdemo-conf.test
--- tests/fcdemo-conf.test      8 Aug 2005 09:23:57 -0000       1.1
+++ tests/fcdemo-conf.test      12 Aug 2005 19:01:08 -0000
@@ -26,7 +26,15 @@
 func_mkprefixdir
 func_cd "tests/fcdemo"
 func_make_distclean
-func_configure
+# We do not want to fail if all we got was a Fortran 77 compiler.
+func_configure_nofail
+if test "$conf_status" -eq "$EXIT_FAILURE"; then
+  case `echo $FC | $SED $basename` in
+    g77* | f77* | xlf | xlf[_-]* | frt* | pgf77* | cf77* | fort77* | fl32* | 
af77*)
+       func_skip "The FC fortran tests do not work with Fortran 77 compilers" 
;;
+    *) exit $EXIT_FAILURE
+  esac
+fi
 func_check_static_shared "yes" "yes"
 
 exit 0
Index: tests/fcdemo-shared.test
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/fcdemo-shared.test,v
retrieving revision 1.1
diff -u -r1.1 fcdemo-shared.test
--- tests/fcdemo-shared.test    8 Aug 2005 09:23:57 -0000       1.1
+++ tests/fcdemo-shared.test    12 Aug 2005 19:01:08 -0000
@@ -26,7 +26,15 @@
 func_mkprefixdir
 func_cd "tests/fcdemo"
 func_make_distclean
-func_configure "--disable-static"
+# We do not want to fail if all we got was a Fortran 77 compiler.
+func_configure_nofail "--disable-static"
+if test "$conf_status" -eq "$EXIT_FAILURE"; then
+  case `echo $FC | $SED $basename` in
+    g77* | f77* | xlf | xlf[_-]* | frt* | pgf77* | cf77* | fort77* | fl32* | 
af77*)
+       func_skip "The FC fortran tests do not work with Fortran 77 compilers" 
;;
+    *) exit $EXIT_FAILURE
+  esac
+fi
 func_check_static_shared "no" "yes"
 
 exit 0
Index: tests/fcdemo-static.test
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/fcdemo-static.test,v
retrieving revision 1.1
diff -u -r1.1 fcdemo-static.test
--- tests/fcdemo-static.test    8 Aug 2005 09:23:57 -0000       1.1
+++ tests/fcdemo-static.test    12 Aug 2005 19:01:08 -0000
@@ -26,7 +26,15 @@
 func_mkprefixdir
 func_cd "tests/fcdemo"
 func_make_distclean
-func_configure "--disable-shared"
+# We do not want to fail if all we got was a Fortran 77 compiler.
+func_configure_nofail "--disable-shared"
+if test "$conf_status" -eq "$EXIT_FAILURE"; then
+  case `echo $FC | $SED $basename` in
+    g77* | f77* | xlf | xlf[_-]* | frt* | pgf77* | cf77* | fort77* | fl32* | 
af77*)
+       func_skip "The FC fortran tests do not work with Fortran 77 compilers" 
;;
+    *) exit $EXIT_FAILURE
+  esac
+fi
 func_check_static_shared "yes" "no"
 
 exit 0




reply via email to

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