ax_fc_version.m4 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #AX_FC_VERSION_OUTPUT([FLAG = $ac_cv_prog_fc_version])
  2. # -------------------------------------------------
  3. # Link a trivial Fortran program, compiling with a version output FLAG
  4. # (which default value, $ac_cv_prog_fc_version, is computed by
  5. # AX_FC_VERSION), and return the output in $ac_fc_version_output.
  6. AC_DEFUN([AX_FC_VERSION_OUTPUT],
  7. [AC_REQUIRE([AC_PROG_FC])dnl
  8. AC_LANG_PUSH(Fortran)dnl
  9. AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
  10. # Compile and link our simple test program by passing a flag (argument
  11. # 1 to this macro) to the Fortran 90 compiler in order to get "version" output
  12. ac_save_FCFLAGS=$FCFLAGS
  13. FCFLAGS="$FCFLAGS m4_default([$1], [$ac_cv_prog_fc_version])"
  14. (eval echo $as_me:__oline__: \"$ac_link\") >&AS_MESSAGE_LOG_FD
  15. ac_fc_version_output=`eval $ac_link AS_MESSAGE_LOG_FD>&1 2>&1 | grep -v 'Driving:'`
  16. echo "$ac_fc_version_output" >&AS_MESSAGE_LOG_FD
  17. FCFLAGS=$ac_save_FCFLAGS
  18. rm -f conftest.*
  19. AC_LANG_POP(Fortran)dnl
  20. ])# AX_FC_VERSION_OUTPUT
  21. # AX_FC_VERSION
  22. # --------------
  23. #
  24. AC_DEFUN([AX_FC_VERSION],
  25. [AC_CACHE_CHECK([how to get the version output from $FC],
  26. [ac_cv_prog_fc_version],
  27. [AC_LANG_ASSERT(Fortran)
  28. AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  29. [ac_cv_prog_fc_version=
  30. # Try some options frequently used verbose output
  31. for ac_version in -V -version --version +version -qversion; do
  32. AX_FC_VERSION_OUTPUT($ac_version)
  33. # look for "copyright" constructs in the output
  34. for ac_arg in $ac_fc_version_output; do
  35. case $ac_arg in
  36. COPYRIGHT | copyright | Copyright | '(c)' | '(C)' | Compiler | Compilers | Version | Version:)
  37. ac_cv_prog_fc_version=$ac_version
  38. break 2 ;;
  39. esac
  40. done
  41. done
  42. if test -z "$ac_cv_prog_fc_version"; then
  43. AC_MSG_WARN([cannot determine how to obtain version information from $FC])
  44. fi],
  45. [AC_MSG_WARN([compilation failed])])
  46. ])])# AX_FC_VERSION