⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fortran.m4

📁 autoconf是一个产生可以自动配置源代码包
💻 M4
📖 第 1 页 / 共 3 页
字号:
            [AC_MSG_FAILURE([linking to Fortran libraries from C fails])])])])# _AC_FC_DUMMY_MAIN# AC_F77_DUMMY_MAIN# ----------------------AC_DEFUN([AC_F77_DUMMY_MAIN],[AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])dnlAC_LANG_PUSH(Fortran 77)dnl_AC_FC_DUMMY_MAIN($@)AC_LANG_POP(Fortran 77)dnl])# AC_F77_DUMMY_MAIN# AC_FC_DUMMY_MAIN# ----------------------AC_DEFUN([AC_FC_DUMMY_MAIN],[AC_REQUIRE([AC_FC_LIBRARY_LDFLAGS])dnlAC_LANG_PUSH(Fortran)dnl_AC_FC_DUMMY_MAIN($@)AC_LANG_POP(Fortran)dnl])# AC_FC_DUMMY_MAIN# _AC_FC_MAIN# -----------# Define {F77,FC}_MAIN to name of alternate main() function for use with# the Fortran libraries.  (Typically, the libraries may define their# own main() to initialize I/O, etcetera, that then call your own# routine called MAIN__ or whatever.)  See _AC_FC_DUMMY_MAIN, above.# If no such alternate name is found, just define {F77,FC}_MAIN to main.#AC_DEFUN([_AC_FC_MAIN],[_AC_FORTRAN_ASSERT()dnlAC_CACHE_CHECK([for alternate main to link with _AC_LANG libraries],               ac_cv_[]_AC_LANG_ABBREV[]_main,[ac_[]_AC_LANG_ABBREV[]_m_save_LIBS=$LIBS LIBS="$LIBS $[]_AC_LANG_PREFIX[]LIBS" ac_fortran_dm_var=[]_AC_FC[]_DUMMY_MAIN AC_LANG_PUSH(C)dnl ac_cv_fortran_main="main" # default entry point name for ac_func in MAIN__ MAIN_ __main MAIN _MAIN __MAIN main_ main__ _main; do   AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@ifdef FC_DUMMY_MAIN_EQ_F77@%:@  undef F77_DUMMY_MAIN@%:@  undef FC_DUMMY_MAIN@%:@else@%:@  undef $ac_fortran_dm_var@%:@endif@%:@define main $ac_func])],                  [ac_cv_fortran_main=$ac_func; break]) done AC_LANG_POP(C)dnl ac_cv_[]_AC_LANG_ABBREV[]_main=$ac_cv_fortran_main rm -f conftest* LIBS=$ac_[]_AC_LANG_ABBREV[]_m_save_LIBS])AC_DEFINE_UNQUOTED([]_AC_FC[]_MAIN, $ac_cv_[]_AC_LANG_ABBREV[]_main,                   [Define to alternate name for `main' routine that is                    called from a `main' in the Fortran libraries.])])# _AC_FC_MAIN# AC_F77_MAIN# -----------AC_DEFUN([AC_F77_MAIN],[AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])dnlAC_LANG_PUSH(Fortran 77)dnl_AC_FC_MAINAC_LANG_POP(Fortran 77)dnl])# AC_F77_MAIN# AC_FC_MAIN# ----------AC_DEFUN([AC_FC_MAIN],[AC_REQUIRE([AC_FC_LIBRARY_LDFLAGS])dnlAC_LANG_PUSH(Fortran)dnl_AC_FC_MAINAC_LANG_POP(Fortran)dnl])# AC_FC_MAIN# __AC_FC_NAME_MANGLING# ---------------------# Test for the name mangling scheme used by the Fortran compiler.## Sets ac_cv_{f77,fc}_mangling. The value contains three fields, separated# by commas:## lower case / upper case:#    case translation of the Fortran symbols# underscore / no underscore:#    whether the compiler appends "_" to symbol names# extra underscore / no extra underscore:#    whether the compiler appends an extra "_" to symbol names already#    containing at least one underscore#AC_DEFUN([__AC_FC_NAME_MANGLING],[_AC_FORTRAN_ASSERT()dnlAC_CACHE_CHECK([for _AC_LANG name-mangling scheme],               ac_cv_[]_AC_LANG_ABBREV[]_mangling,[AC_COMPILE_IFELSE([      subroutine foobar()      return      end      subroutine foo_bar()      return      end],[mv conftest.$ac_objext cfortran_test.$ac_objext  ac_save_LIBS=$LIBS  LIBS="cfortran_test.$ac_objext $LIBS $[]_AC_LANG_PREFIX[]LIBS"  AC_LANG_PUSH(C)dnl  ac_success=no  for ac_foobar in foobar FOOBAR; do    for ac_underscore in "" "_"; do      ac_func="$ac_foobar$ac_underscore"      AC_LINK_IFELSE([AC_LANG_CALL([], [$ac_func])],		     [ac_success=yes; break 2])    done  done  AC_LANG_POP(C)dnl  if test "$ac_success" = "yes"; then     case $ac_foobar in	foobar)	   ac_case=lower	   ac_foo_bar=foo_bar	   ;;	FOOBAR)	   ac_case=upper	   ac_foo_bar=FOO_BAR	   ;;     esac     AC_LANG_PUSH(C)dnl     ac_success_extra=no     for ac_extra in "" "_"; do	ac_func="$ac_foo_bar$ac_underscore$ac_extra"	AC_LINK_IFELSE([AC_LANG_CALL([], [$ac_func])],		       [ac_success_extra=yes; break])     done     AC_LANG_POP(C)dnl     if test "$ac_success_extra" = "yes"; then	ac_cv_[]_AC_LANG_ABBREV[]_mangling="$ac_case case"        if test -z "$ac_underscore"; then           ac_cv_[]_AC_LANG_ABBREV[]_mangling="$ac_cv_[]_AC_LANG_ABBREV[]_mangling, no underscore"	else           ac_cv_[]_AC_LANG_ABBREV[]_mangling="$ac_cv_[]_AC_LANG_ABBREV[]_mangling, underscore"        fi        if test -z "$ac_extra"; then           ac_cv_[]_AC_LANG_ABBREV[]_mangling="$ac_cv_[]_AC_LANG_ABBREV[]_mangling, no extra underscore"	else           ac_cv_[]_AC_LANG_ABBREV[]_mangling="$ac_cv_[]_AC_LANG_ABBREV[]_mangling, extra underscore"        fi      else	ac_cv_[]_AC_LANG_ABBREV[]_mangling="unknown"      fi  else     ac_cv_[]_AC_LANG_ABBREV[]_mangling="unknown"  fi  LIBS=$ac_save_LIBS  rm -f cfortran_test* conftest*],  [AC_MSG_FAILURE([cannot compile a simple Fortran program])])])])# __AC_FC_NAME_MANGLING# The replacement is empty.AU_DEFUN([AC_F77_NAME_MANGLING], [])# _AC_F77_NAME_MANGLING# ----------------------AC_DEFUN([_AC_F77_NAME_MANGLING],[AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])dnlAC_REQUIRE([AC_F77_DUMMY_MAIN])dnlAC_LANG_PUSH(Fortran 77)dnl__AC_FC_NAME_MANGLINGAC_LANG_POP(Fortran 77)dnl])# _AC_F77_NAME_MANGLING# _AC_FC_NAME_MANGLING# ----------------------AC_DEFUN([_AC_FC_NAME_MANGLING],[AC_REQUIRE([AC_FC_LIBRARY_LDFLAGS])dnlAC_REQUIRE([AC_FC_DUMMY_MAIN])dnlAC_LANG_PUSH(Fortran)dnl__AC_FC_NAME_MANGLINGAC_LANG_POP(Fortran)dnl])# _AC_FC_NAME_MANGLING# _AC_FC_WRAPPERS# ---------------# Defines C macros {F77,FC}_FUNC(name,NAME) and {F77,FC}_FUNC_(name,NAME) to# properly mangle the names of C identifiers, and C identifiers with# underscores, respectively, so that they match the name mangling# scheme used by the Fortran compiler.AC_DEFUN([_AC_FC_WRAPPERS],[_AC_FORTRAN_ASSERT()dnlAH_TEMPLATE(_AC_FC[_FUNC],    [Define to a macro mangling the given C identifier (in lower and upper     case), which must not contain underscores, for linking with Fortran.])dnlAH_TEMPLATE(_AC_FC[_FUNC_],    [As ]_AC_FC[_FUNC, but for C identifiers containing underscores.])dnlcase $ac_cv_[]_AC_LANG_ABBREV[]_mangling in  "lower case, no underscore, no extra underscore")          AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [name])          AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [name]) ;;  "lower case, no underscore, extra underscore")          AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [name])          AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [name ## _]) ;;  "lower case, underscore, no extra underscore")          AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [name ## _])          AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [name ## _]) ;;  "lower case, underscore, extra underscore")          AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [name ## _])          AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [name ## __]) ;;  "upper case, no underscore, no extra underscore")          AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [NAME])          AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [NAME]) ;;  "upper case, no underscore, extra underscore")          AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [NAME])          AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [NAME ## _]) ;;  "upper case, underscore, no extra underscore")          AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [NAME ## _])          AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [NAME ## _]) ;;  "upper case, underscore, extra underscore")          AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [NAME ## _])          AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [NAME ## __]) ;;  *)          AC_MSG_WARN([unknown Fortran name-mangling scheme])          ;;esac])# _AC_FC_WRAPPERS# AC_F77_WRAPPERS# ---------------AC_DEFUN([AC_F77_WRAPPERS],[AC_REQUIRE([_AC_F77_NAME_MANGLING])dnlAC_LANG_PUSH(Fortran 77)dnl_AC_FC_WRAPPERSAC_LANG_POP(Fortran 77)dnl])# AC_F77_WRAPPERS# AC_FC_WRAPPERS# --------------AC_DEFUN([AC_FC_WRAPPERS],[AC_REQUIRE([_AC_FC_NAME_MANGLING])dnlAC_LANG_PUSH(Fortran)dnl_AC_FC_WRAPPERSAC_LANG_POP(Fortran)dnl])# AC_FC_WRAPPERS# _AC_FC_FUNC(NAME, [SHELLVAR = NAME])# ------------------------------------# For a Fortran subroutine of given NAME, define a shell variable# $SHELLVAR to the Fortran-mangled name.  If the SHELLVAR# argument is not supplied, it defaults to NAME.AC_DEFUN([_AC_FC_FUNC],[_AC_FORTRAN_ASSERT()dnlcase $ac_cv_[]_AC_LANG_ABBREV[]_mangling in  upper*) ac_val="m4_toupper([$1])" ;;  lower*) ac_val="m4_tolower([$1])" ;;  *)      ac_val="unknown" ;;esaccase $ac_cv_[]_AC_LANG_ABBREV[]_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esacm4_if(m4_index([$1],[_]),-1,[],[case $ac_cv_[]_AC_LANG_ABBREV[]_mangling in *," extra underscore"*) ac_val="$ac_val"_ ;; esac])m4_default([$2],[$1])="$ac_val"])# _AC_FC_FUNC# AC_F77_FUNC(NAME, [SHELLVAR = NAME])# ------------------------------------AC_DEFUN([AC_F77_FUNC],[AC_REQUIRE([_AC_F77_NAME_MANGLING])dnlAC_LANG_PUSH(Fortran 77)dnl_AC_FC_FUNC([$1],[$2])AC_LANG_POP(Fortran 77)dnl])# AC_F77_FUNC# AC_FC_FUNC(NAME, [SHELLVAR = NAME])# -----------------------------------AC_DEFUN([AC_FC_FUNC],[AC_REQUIRE([_AC_FC_NAME_MANGLING])dnlAC_LANG_PUSH(Fortran)dnl_AC_FC_FUNC([$1],[$2])AC_LANG_POP(Fortran)dnl])# AC_FC_FUNC# AC_FC_SRCEXT(EXT, [ACTION-IF-SUCCESS], [ACTION-IF-FAILURE])# -----------------------------------------------------------# Set the source-code extension used in Fortran (FC) tests to EXT (which# defaults to f).  Also, look for any necessary additional FCFLAGS needed# to allow this extension, and store them in the output variable# FCFLAGS_<EXT> (e.g. FCFLAGS_f90 for EXT=f90).  If successful,# call ACTION-IF-SUCCESS.  If unable to compile source code with EXT,# call ACTION-IF-FAILURE, which defaults to failing with an error# message.## (The flags for the current source-code extension, if any, are stored in# $ac_fcflags_srcext and used automatically in subsequent autoconf tests.)## For ordinary extensions like f90, etcetera, the modified FCFLAGS# are currently needed for IBM's xlf* and Intel's ifc (grrr).  Unfortunately,# xlf* will only take flags to recognize one extension at a time, so if the# user wants to compile multiple extensions (.f90 and .f95, say), she# will need to use the FCFLAGS_F90 and FCFLAGS_F95 individually rather# than just adding them all to FCFLAGS, for example.## Also, for Intel's ifc compiler (which does not accept .f95 by default in# some versions), the $FCFLAGS_<EXT> variable *must* go immediately before# the source file on the command line, unlike other $FCFLAGS.  Ugh.AC_DEFUN([AC_FC_SRCEXT],[AC_LANG_PUSH(Fortran)dnlAC_CACHE_CHECK([for Fortran flag to compile .$1 files],                ac_cv_fc_srcext_$1,[ac_ext=$1ac_fcflags_srcext_save=$ac_fcflags_srcextac_fcflags_srcext=ac_cv_fc_srcext_$1=unknownfor ac_flag in none -qsuffix=f=$1 -Tf; do  test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag"  AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_fc_srcext_$1=$ac_flag; break])donerm -f conftest.$ac_objext conftest.$1ac_fcflags_srcext=$ac_fcflags_srcext_save])if test "x$ac_cv_fc_srcext_$1" = xunknown; then  m4_default([$3],[AC_MSG_ERROR([Fortran could not compile .$1 files])])else  ac_fc_srcext=$1  if test "x$ac_cv_fc_srcext_$1" = xnone; then    ac_fcflags_srcext=""    FCFLAGS_[]$1[]=""  else    ac_fcflags_srcext=$ac_cv_fc_srcext_$1    FCFLAGS_[]$1[]=$ac_cv_fc_srcext_$1  fi  AC_SUBST(FCFLAGS_[]$1)  $2fiAC_LANG_POP(Fortran)dnl])# AC_FC_SRCEXT# AC_FC_FREEFORM([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])# ------------------------------------------------------------------# Look for a compiler flag to make the Fortran (FC) compiler accept# free-format source code, and adds it to FCFLAGS.  Call# ACTION-IF-SUCCESS (defaults to nothing) if successful (i.e. can# compile code using new extension) and ACTION-IF-FAILURE (defaults to# failing with an error message) if not.  (Defined via DEFUN_ONCE to# prevent flag from being added to FCFLAGS multiple times.)## The known flags are:#        -ffree-form: GNU g77#                -FR: Intel compiler (icc, ecc)#              -free: Compaq compiler (fort)#             -qfree: IBM compiler (xlf)# -Mfree, -Mfreeform: Portland Group compiler#          -freeform: SGI compiler#            -f free: Absoft Fortran# We try to test the "more popular" flags first, by some prejudiced# notion of popularity.AC_DEFUN_ONCE([AC_FC_FREEFORM],[AC_LANG_PUSH(Fortran)dnlAC_CACHE_CHECK([for Fortran flag needed to allow free-form source],                ac_cv_fc_freeform,[ac_cv_fc_freeform=unknownac_fc_freeform_FCFLAGS_save=$FCFLAGSfor ac_flag in none -ffree-form -FR -free -qfree -Mfree -Mfreeform \               -freeform "-f free"do  test "x$ac_flag" != xnone && FCFLAGS="$ac_fc_freeform_FCFLAGS_save $ac_flag"  AC_COMPILE_IFELSE([  program freeform       ! FIXME: how to best confuse non-freeform compilers?       print *, 'Hello ', &           'world.'       end],                    [ac_cv_fc_freeform=$ac_flag; break])donerm -f conftest.err conftest.$ac_objext conftest.$ac_extFCFLAGS=$ac_fc_freeform_FCFLAGS_save])if test "x$ac_cv_fc_freeform" = xunknown; then  m4_default([$2],             [AC_MSG_ERROR([Fortran does not accept free-form source], 77)])else  if test "x$ac_cv_fc_freeform" != xnone; then    FCFLAGS="$FCFLAGS $ac_cv_fc_freeform"  fi  $1fiAC_LANG_POP(Fortran)dnl])# AC_FC_FREEFORM

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -