fort5.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #! /bin/sh
  2. # Copyright (C) 2006-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Test mixing Fortran 77 and Fortran (FC), libtool version.
  17. # For now, require the GNU compilers (to avoid some Libtool/Autoconf
  18. # issues).
  19. required='libtoolize g77 gfortran'
  20. . test-init.sh
  21. mkdir sub
  22. cat >hello.f <<'END'
  23. program hello
  24. call foo
  25. call bar
  26. call goodbye
  27. stop
  28. end
  29. END
  30. cat >bye.f90 <<'END'
  31. subroutine goodbye
  32. call baz
  33. return
  34. end
  35. END
  36. cat >foo.f90 <<'END'
  37. subroutine foo
  38. return
  39. end
  40. END
  41. sed s,foo,bar, foo.f90 > sub/bar.f90
  42. sed s,foo,baz, foo.f90 > sub/baz.f
  43. cat >>configure.ac <<'END'
  44. AC_PROG_F77
  45. AC_PROG_FC
  46. AC_FC_SRCEXT([f90], [],
  47. [AC_MSG_FAILURE([$FC compiler cannot create executables], 77)])
  48. AC_FC_LIBRARY_LDFLAGS
  49. AM_PROG_AR
  50. LT_PREREQ([2.0])
  51. AC_PROG_LIBTOOL
  52. AC_OUTPUT
  53. END
  54. cat >Makefile.am <<'END'
  55. bin_PROGRAMS = hello
  56. lib_LTLIBRARIES = libhello.la
  57. noinst_LTLIBRARIES = libgoodbye.la
  58. hello_SOURCES = hello.f
  59. hello_LDADD = libhello.la
  60. libhello_la_SOURCES = foo.f90 sub/bar.f90
  61. libhello_la_LIBADD = libgoodbye.la
  62. libgoodbye_la_SOURCES = bye.f90 sub/baz.f
  63. libgoodbye_la_FCFLAGS =
  64. LDADD = $(FCLIBS)
  65. END
  66. libtoolize --force
  67. $ACLOCAL
  68. # FIXME: stop disabling the warnings in the 'unsupported' category
  69. # FIXME: once the 'subdir-objects' option has been mandatory.
  70. $AUTOMAKE -a -Wno-unsupported
  71. $AUTOCONF
  72. # This test requires Libtool >= 2.0. Earlier Libtool does not
  73. # have the LT_PREREQ macro to cause autoconf failure.
  74. grep LT_PREREQ configure && skip_ "libtool is too old (probably < 2.0)"
  75. # Ensure we use --tag for f90, too.
  76. grep " --tag=FC" Makefile.in
  77. # ./configure may exit with status 77 if no compiler is found,
  78. # or if the compiler cannot compile Fortran 90 files).
  79. ./configure
  80. $MAKE
  81. subobjs=$(echo sub/*.lo)
  82. test "$subobjs" = 'sub/*.lo'
  83. $MAKE distcheck
  84. # The following will be fixed in a later patch:
  85. $MAKE distclean
  86. echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am
  87. $AUTOMAKE -a
  88. ./configure
  89. $MAKE
  90. test ! -e bar.lo
  91. test ! -e baz.lo
  92. test ! -e libgoodbye_la-baz.lo
  93. $MAKE distcheck
  94. :