source: CPL/oasis3-mct/branches/OASIS3-MCT_2.0_branch/lib/mct/m4/ax_fc_version.m4 @ 4775

Last change on this file since 4775 was 4775, checked in by aclsce, 5 years ago
  • Imported oasis3-mct from Cerfacs svn server (not suppotred anymore).

The version has been extracted from https://oasis3mct.cerfacs.fr/svn/branches/OASIS3-MCT_2.0_branch/oasis3-mct@1818

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