Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.1KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_f90_module_flag.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_F90_MODULE_FLAG
  8. #
  9. # DESCRIPTION
  10. #
  11. # Find Fortran 90 modules inclusion flag. The module inclusion flag is
  12. # stored in the cached variable ax_f90_modflag. An error is triggered if
  13. # the flag cannot be found. Supported are the -I GNU compilers flag, the
  14. # -M SUN compilers flag, and the -p Absoft Pro Fortran compiler flag.
  15. #
  16. # LICENSE
  17. #
  18. # Copyright (c) 2009 Luc Maisonobe <luc@spaceroots.org>
  19. # Copyright (c) 2009 Julian C. Cummings <cummings@cacr.caltech.edu>
  20. # Copyright (c) 2009 Alexander Pletzer <pletzer@txcorp.com>
  21. #
  22. # Copying and distribution of this file, with or without modification, are
  23. # permitted in any medium without royalty provided the copyright notice
  24. # and this notice are preserved. This file is offered as-is, without any
  25. # warranty.
  26. #serial 14
  27. AC_DEFUN([AX_F90_MODULE_FLAG],[
  28. AC_CACHE_CHECK([fortran 90 modules inclusion flag],
  29. ax_cv_f90_modflag,
  30. [AC_LANG_PUSH(Fortran)
  31. i=0
  32. while test \( -f tmpdir_$i \) -o \( -d tmpdir_$i \) ; do
  33. i=`expr $i + 1`
  34. done
  35. mkdir tmpdir_$i
  36. cd tmpdir_$i
  37. AC_COMPILE_IFELSE([
  38. !234567
  39. module conftest_module
  40. contains
  41. subroutine conftest_routine
  42. write(*,'(a)') 'gotcha!'
  43. end subroutine conftest_routine
  44. end module conftest_module
  45. ],[],[])
  46. cd ..
  47. ax_cv_f90_modflag="not found"
  48. for ax_flag in "-I " "-I" "-M" "-p"; do
  49. if test "$ax_cv_f90_modflag" = "not found" ; then
  50. ax_save_FCFLAGS="$FCFLAGS"
  51. FCFLAGS="$ax_save_FCFLAGS ${ax_flag}tmpdir_$i"
  52. AC_COMPILE_IFELSE([
  53. !234567
  54. program conftest_program
  55. use conftest_module
  56. call conftest_routine
  57. end program conftest_program
  58. ],[ax_cv_f90_modflag="$ax_flag"],[])
  59. FCFLAGS="$ax_save_FCFLAGS"
  60. fi
  61. done
  62. rm -fr tmpdir_$i
  63. if test "$ax_cv_f90_modflag" = "not found" ; then
  64. AC_MSG_ERROR([unable to find compiler flag for modules inclusion])
  65. fi
  66. AC_LANG_POP(Fortran)
  67. ])])