From: Ralf Wildenhues Date: Mon, 16 Oct 2006 05:13:02 +0000 (+0000) Subject: For PR automake/480. X-Git-Tag: v1.10b~282 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=874adddca7b33adafe9feaa0ea38f37bc9a2b7db;p=thirdparty%2Fautomake.git For PR automake/480. * automake.in (lang_f77_rewrite, lang_fc_rewrite) (lang_ppfc_rewrite, lang_ppf77_rewrite, lang_ratfor_rewrite): return `lang_sub_obj' to support subdir-object mode for the Fortran dialects. * tests/fort4.test, tests/fort5.test: New tests. * tests/Makefile.am: Update. * NEWS, THANKS: Update. Report by Davyd Madeley and Shannon L. Brown. --- diff --git a/ChangeLog b/ChangeLog index fa263b254..638c0c9b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2006-10-16 Ralf Wildenhues + For PR automake/480. + * automake.in (lang_f77_rewrite, lang_fc_rewrite) + (lang_ppfc_rewrite, lang_ppf77_rewrite, lang_ratfor_rewrite): + return `lang_sub_obj' to support subdir-object mode for the + Fortran dialects. + * tests/fort4.test, tests/fort5.test: New tests. + * tests/Makefile.am: Update. + * NEWS, THANKS: Update. + Report by Davyd Madeley and Shannon L. Brown. + * lib/am/header-vars.am (pkglibexecdir): New variable. * automake.in (%standard_prefix): Add it. * doc/automake.texi (Uniform): Document it. diff --git a/NEWS b/NEWS index 2b222ace8..f93bc1bac 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,10 @@ New in 1.10a: +* Languages changes: + + - subdir-object mode works now with Fortran (F77, FC, preprocessed + Fortran, and Ratfor). + * Miscellaneous changes: - New shorthand `$(pkglibexecdir)' for `$(libexecdir)/@PACKAGE@'. diff --git a/THANKS b/THANKS index 2fc572c3c..9a091cea4 100644 --- a/THANKS +++ b/THANKS @@ -54,6 +54,7 @@ Daniel Jacobowitz drow@false.org Dave Brolley brolley@redhat.com Dave Morrison dave@bnl.gov David A. Swierczek swiercze@mr.med.ge.com +Davyd Madeley davyd@fugro-fsi.com.au David Pashley david@davidpashley.com David Zaroski cz253@cleveland.Freenet.Edu Dean Povey dpovey@wedgetail.com @@ -263,6 +264,7 @@ Santiago Vila sanvila@unex.es Scott James Remnant scott@netsplit.com Sergey Vlasov vsu@mivlgu.murom.ru Seth Alves alves@hungry.com +Shannon L. Brown slbrow@sandia.gov Shuhei Amakawa sa264@cam.ac.uk Shigio Yamaguchi shigio@tamacom.com Simon Josefsson jas@extundo.com diff --git a/automake.in b/automake.in index 985948c6a..1be6959e0 100755 --- a/automake.in +++ b/automake.in @@ -5340,31 +5340,31 @@ sub lang_cppasm_rewrite # Rewrite a single Fortran 77 file. sub lang_f77_rewrite { - return LANG_PROCESS; + return &lang_sub_obj; } # Rewrite a single Fortran file. sub lang_fc_rewrite { - return LANG_PROCESS; + return &lang_sub_obj; } # Rewrite a single preprocessed Fortran file. sub lang_ppfc_rewrite { - return LANG_PROCESS; + return &lang_sub_obj; } # Rewrite a single preprocessed Fortran 77 file. sub lang_ppf77_rewrite { - return LANG_PROCESS; + return &lang_sub_obj; } # Rewrite a single ratfor file. sub lang_ratfor_rewrite { - return LANG_PROCESS; + return &lang_sub_obj; } # Rewrite a single Objective C file. diff --git a/tests/Makefile.am b/tests/Makefile.am index 468d73d76..ff98dd011 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -247,6 +247,8 @@ fn99subdir.test \ fnoc.test \ fo.test \ fort1.test \ +fort4.test \ +fort5.test \ fonly.test \ fortdep.test \ fpinst2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 80b3c19b4..44dd34204 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -380,6 +380,8 @@ fn99subdir.test \ fnoc.test \ fo.test \ fort1.test \ +fort4.test \ +fort5.test \ fonly.test \ fortdep.test \ fpinst2.test \ diff --git a/tests/fort4.test b/tests/fort4.test new file mode 100755 index 000000000..094546388 --- /dev/null +++ b/tests/fort4.test @@ -0,0 +1,98 @@ +#! /bin/sh +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Automake is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +# Test mixing Fortran 77 and Fortran (FC). + +# For now, require the GNU compilers (to avoid some Libtool/Autoconf +# issues). +required='g77 gfortran' +. ./defs || exit 1 + +set -e + +mkdir sub + +cat >hello.f <<'END' + program hello + call foo + call bar + stop + end +END + +cat >bye.f90 <<'END' +program goodbye + call baz + stop +end +END + +cat >foo.f90 <<'END' + subroutine foo + return + end +END + +sed s,foo,bar, foo.f90 > sub/bar.f90 +sed s,foo,baz, foo.f90 > sub/baz.f + +cat >>configure.in <<'END' +AC_PROG_F77 +AC_PROG_FC +AC_FC_SRCEXT([f90], [], + [AC_MSG_FAILURE([$FC compiler cannot create executables], 77)]) +AC_FC_LIBRARY_LDFLAGS +AC_OUTPUT +END + +cat >Makefile.am <<'END' +bin_PROGRAMS = hello goodbye +hello_SOURCES = hello.f foo.f90 sub/bar.f90 +goodbye_SOURCES = bye.f90 sub/baz.f +goodbye_FCFLAGS = +LDADD = $(FCLIBS) +END + +$ACLOCAL +$AUTOMAKE +# The Fortran 77 linker should be preferred: +grep '.\$(FCLINK)' Makefile.in && exit 1 + +$AUTOCONF +# configure may exit 77 if no compiler is found, +# or if the compiler cannot compile Fortran 90 files). +./configure +$MAKE +subobjs=`echo sub/*.o sub/*.obj` +test "$subobjs" = 'sub/*.o sub/*.obj' +$MAKE distcheck + +$MAKE distclean +echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am +$AUTOMAKE +./configure +$MAKE +test ! -f bar.o +test ! -f bar.obj +test ! -f baz.o +test ! -f baz.obj +test ! -f goodbye-baz.o +test ! -f goodbye-baz.obj +$MAKE distcheck diff --git a/tests/fort5.test b/tests/fort5.test new file mode 100755 index 000000000..c3f3e4f16 --- /dev/null +++ b/tests/fort5.test @@ -0,0 +1,108 @@ +#! /bin/sh +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Automake is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +# Test mixing Fortran 77 and Fortran (FC), libtool version. + +# For now, require the GNU compilers (to avoid some Libtool/Autoconf +# issues). +required='libtoolize g77 gfortran' +. ./defs || exit 1 + +set -e + +mkdir sub + +cat >hello.f <<'END' + program hello + call foo + call bar + call goodbye + stop + end +END + +cat >bye.f90 <<'END' +subroutine goodbye + call baz + return +end +END + +cat >foo.f90 <<'END' + subroutine foo + return + end +END + +sed s,foo,bar, foo.f90 > sub/bar.f90 +sed s,foo,baz, foo.f90 > sub/baz.f + +cat >>configure.in <<'END' +AC_PROG_F77 +AC_PROG_FC +AC_FC_SRCEXT([f90], [], + [AC_MSG_FAILURE([$FC compiler cannot create executables], 77)]) +AC_FC_LIBRARY_LDFLAGS +LT_PREREQ([2.0]) +AC_PROG_LIBTOOL +AC_OUTPUT +END + +cat >Makefile.am <<'END' +bin_PROGRAMS = hello +lib_LTLIBRARIES = libhello.la +noinst_LTLIBRARIES = libgoodbye.la +hello_SOURCES = hello.f +hello_LDADD = libhello.la +libhello_la_SOURCES = foo.f90 sub/bar.f90 +libhello_la_LIBADD = libgoodbye.la +libgoodbye_la_SOURCES = bye.f90 sub/baz.f +libgoodbye_la_FCFLAGS = +LDADD = $(FCLIBS) +END + +libtoolize --force +$ACLOCAL +$AUTOMAKE -a +$AUTOCONF + +# This test requires Libtool >= 2.0. Earlier Libtool does not +# have the LT_PREREQ macro to cause autoconf failure, so let's +# skip in this case: +grep LT_PREREQ configure && exit 77 + +# configure may exit 77 if no compiler is found, +# or if the compiler cannot compile Fortran 90 files). +./configure +$MAKE +subobjs=`echo sub/*.lo` +test "$subobjs" = 'sub/*.lo' +$MAKE distcheck + +# The following will be fixed in a later patch: +$MAKE distclean +echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am +$AUTOMAKE -a +./configure +$MAKE +test ! -f bar.lo +test ! -f baz.lo +test ! -f libgoodbye_la-baz.lo +$MAKE distcheck