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

📄 aclocal_f77.m4

📁 MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程环境.
💻 M4
📖 第 1 页 / 共 3 页
字号:
        if test ! -d conftest ; then mkdir conftest2 ; fi	dnl Use arcmd incase AR is defined as "ar cr"        AC_TRY_COMMAND(${ARCMD-"ar"} cr conftest2/libconftest.a conftest1.o)        AC_TRY_COMMAND(${RANLIB-ranlib} conftest2/libconftest.a)        ac_fcompileldtest='${F77-f77} -o conftest $FFLAGS ${ldir}conftest2 conftest.f -lconftest $LDFLAGS 1>&AC_FD_CC'        for ldir in "-L" "-Wl,-L," ; do            if AC_TRY_EVAL(ac_fcompileldtest) && test -s conftest ; then	        pac_cv_prog_f77_library_dir_flag="$ldir"	        break            fi        done        rm -rf ./conftest2    else        echo "configure: failed program was:" >&AC_FD_CC        cat conftest1.f >&AC_FD_CC    fi    rm -f conftest*])    AC_SUBST(F77_LIBDIR_LEADER)    if test "X$pac_cv_prog_f77_library_dir_flag" != "X" ; then        F77_LIBDIR_LEADER="$pac_cv_prog_f77_library_dir_flag"    fifi])dnl/*D dnl PAC_PROG_F77_HAS_INCDIR - Check whether Fortran accepts -Idir flagdnldnl Syntax:dnl   PAC_PROG_F77_HAS_INCDIR(directory,action-if-true,action-if-false)dnldnl Output Effect:dnl  Sets 'F77_INCDIR' to the flag used to choose the directory.  dnldnl Notes:dnl This refers to the handling of the common Fortran include extension,dnl not to the use of '#include' with the C preprocessor.dnl If directory does not exist, it will be created.  In that case, the dnl directory should be a direct descendant of the current directory.dnldnlD*/ AC_DEFUN(PAC_PROG_F77_HAS_INCDIR,[checkdir=$1AC_CACHE_CHECK([for include directory flag for Fortran],pac_cv_prog_f77_has_incdir,[if test ! -d $checkdir ; then mkdir $checkdir ; ficat >$checkdir/conftestf.h <<EOF       call sub()EOFcat >conftest.f <<EOF       program main       include 'conftestf.h'       endEOFac_fcompiletest='${F77-f77} -c $FFLAGS ${idir}$checkdir conftest.f 1>&AC_FD_CC'pac_cv_prog_f77_has_incdir="none"# SGI wants -Wf,-Ifor idir in "-I" "-Wf,-I" ; do    if AC_TRY_EVAL(ac_fcompiletest) && test -s conftest.o ; then        pac_cv_prog_f77_has_incdir="$idir"	break    fidonerm -f conftest*rm -f $checkdir/conftestf.h])AC_SUBST(F77_INCDIR)if test "X$pac_cv_prog_f77_has_incdir" != "Xnone" ; then    F77_INCDIR="$pac_cv_prog_f77_has_incdir"fi])dnldnl/*Ddnl PAC_PROG_F77_ALLOWS_UNUSED_EXTERNALS - Check whether the Fortran compilerdnl allows unused and undefined functions to be listed in an external dnl statementdnldnl Syntax:dnl   PAC_PROG_F77_ALLOWS_UNUSED_EXTERNALS(action-if-true,action-if-false)dnldnlD*/AC_DEFUN(PAC_PROG_F77_ALLOWS_UNUSED_EXTERNALS,[AC_CACHE_CHECK([whether Fortran allows unused externals],pac_cv_prog_f77_allows_unused_externals,[AC_LANG_SAVEAC_LANG_FORTRAN77dnl We can't use TRY_LINK, because it wants a routine name, not a dnl declaration.  The following is the body of TRY_LINK, slightly modified.cat > conftest.$ac_ext <<EOF       program main       external bar       endEOFif AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then  rm -rf conftest*  pac_cv_prog_f77_allows_unused_externals="yes"else  echo "configure: failed program was:" >&AC_FD_CC  cat conftest.$ac_ext >&AC_FD_CC  rm -rf conftest*  pac_cv_prog_f77_allows_unused_externals="no"  $4firm -f conftest*#AC_LANG_RESTORE])if test "X$pac_cv_prog_f77_allows_unused_externals" = "Xyes" ; then   ifelse([$1],,:,[$1])else   ifelse([$2],,:,[$2])fi])dnl /*D dnl PAC_PROG_F77_HAS_POINTER - Determine if Fortran allows pointer typednldnl Synopsis:dnl   PAC_PROG_F77_HAS_POINTER(action-if-true,action-if-false)dnl D*/AC_DEFUN(PAC_PROG_F77_HAS_POINTER,[AC_CACHE_CHECK([whether Fortran has pointer declaration],pac_cv_prog_f77_has_pointer,[AC_LANG_SAVEAC_LANG_FORTRAN77AC_TRY_COMPILE(,[        integer M        pointer (MPTR,M)        data MPTR/0/],pac_cv_prog_f77_has_pointer="yes",pac_cv_prog_f77_has_pointer="no")AC_LANG_RESTORE])if test "$pac_cv_prog_f77_has_pointer" = "yes" ; then    ifelse([$1],,:,[$1])else    ifelse([$2],,:,[$2])fi])dnldnl pac_prog_f77_run_proc_from_c( c main program, fortran routine, dnl                               action-if-works, action-if-fails, dnl                               cross-action )dnl Fortran routine MUST be named ftest unless you include codednl to select the appropriate Fortran name.dnl AC_DEFUN(PAC_PROG_F77_RUN_PROC_FROM_C,[/bin/rm -f conftest*cat <<EOF > conftest.f$2EOFdnlif test "X$ac_fcompile" = "X" ; then    ac_fcompile='${F77-f77} -c $FFLAGS conftest.f 1>&AC_FD_CC'fiif AC_TRY_EVAL(ac_fcompile) && test -s conftest.o ; then    mv conftest.o conftestf.o    AC_LANG_SAVE    AC_LANG_C    save_LIBS="$LIBS"    LIBS="conftestf.o $FLIBS $LIBS"    AC_TRY_RUN([#include <stdio.h>#ifdef F77_NAME_UPPER#define ftest_ FTEST#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)#define ftest_ ftest#endif$1], [$3], [$4], [$5] )    LIBS="$save_LIBS"    AC_LANG_RESTOREelse     echo "configure: failed program was:" >&AC_FD_CC    cat conftest.f >&AC_FD_CCfirm -f conftest*])dnldnl PAC_PROG_F77_IN_C_LIBSdnldnl Find the essential libraries that are needed to use the C linker to dnl create a program that includes a trival Fortran code.  dnldnl For example, all pgf90 compiled objects include a reference to thednl symbol pgf90_compiled, found in libpgf90 .dnlAC_DEFUN(PAC_PROG_F77_IN_C_LIBS,[AC_MSG_CHECKING([what Fortran libraries are needed to link C with Fortran])F77_IN_C_LIBS="$FLIBS"/bin/rm -f conftest*cat <<EOF > conftest.f        subroutine ftest        endEOFdnlif test "X$ac_fcompile" = "X" ; then    ac_fcompile='${F77-f77} -c $FFLAGS conftest.f 1>&AC_FD_CC'fiif AC_TRY_EVAL(ac_fcompile) && test -s conftest.o ; then    mv conftest.o mconftestf.o    AC_LANG_SAVE    AC_LANG_C    save_LIBS="$LIBS"    dnl First try with no libraries    LIBS="mconftestf.o $save_LIBS"    AC_TRY_LINK([#include <stdio.h>],[#ifdef F77_NAME_UPPER#define ftest_ FTEST#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)#define ftest_ ftest#endifftest_();], [link_worked=yes], [link_worked=no] )    if test "$link_worked" = "no" ; then        flibdirs=`echo $FLIBS | tr ' ' '\012' | grep '\-L' | tr '\012' ' '`        fliblibs=`echo $FLIBS | tr ' ' '\012' | grep -v '\-L' | tr '\012' ' '`        for flibs in $fliblibs ; do            LIBS="mconftestf.o $flibdirs $flibs $save_LIBS"            AC_TRY_LINK([#include <stdio.h>],[#ifdef F77_NAME_UPPER#define ftest_ FTEST#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)#define ftest_ ftest#endifftest_();], [link_worked=yes], [link_worked=no] )            if test "$link_worked" = "yes" ; then 	        F77_IN_C_LIBS="$flibdirs $flibs"                break            fi        done    if test "$link_worked" = "no" ; then	# try to add libraries until it works...        flibscat=""        for flibs in $fliblibs ; do	    flibscat="$flibscat $flibs"            LIBS="mconftestf.o $flibdirs $flibscat $save_LIBS"            AC_TRY_LINK([#include <stdio.h>],[#ifdef F77_NAME_UPPER#define ftest_ FTEST#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)#define ftest_ ftest#endifftest_();], [link_worked=yes], [link_worked=no] )            if test "$link_worked" = "yes" ; then 	        F77_IN_C_LIBS="$flibdirs $flibscat"                break            fi        done    fi    else	# No libraries needed	F77_IN_C_LIBS=""    fi    LIBS="$save_LIBS"    AC_LANG_RESTOREelse     echo "configure: failed program was:" >&AC_FD_CC    cat conftest.f >&AC_FD_CCfirm -f conftest* mconftest*if test -z "$F77_IN_C_LIBS" ; then    AC_MSG_RESULT(none)else    AC_MSG_RESULT($F77_IN_C_LIBS)fi])dnldnl Test to see if we should use C or Fortran to link programs whosednl main program is in Fortran.  We may find that neither work because dnl we need special libraries in each case.dnlAC_DEFUN([PAC_PROG_F77_LINKER_WITH_C],[AC_TRY_COMPILE(,long long a;,AC_DEFINE(HAVE_LONG_LONG,1,[Define if long long allowed]))AC_MSG_CHECKING([for linker for Fortran main programs])dnldnl Create a program that uses multiplication and division in casednl that requires special librariescat > conftest.c <<EOF#include "confdefs.h"#ifdef HAVE_LONG_LONGint f(int a, long long b) { int c; c = a * ( b / 3 ) / (b-1); return c ; }#elseint f(int a, long b) { int c; c = a * b / (b-1); return c ; }#endifEOFAC_LANG_SAVEAC_LANG_Cif AC_TRY_EVAL(ac_compile); then    mv conftest.o conftest1.oelse    AC_MSG_ERROR([Could not compile C test program])fiAC_LANG_FORTRAN77cat > conftest.f <<EOF        program main        double precision d        print *, "hi"        endEOFif AC_TRY_EVAL(ac_compile); then    if ${F77} -o conftest conftest.o conftest1.o $LDFLAGS 2>&AC_FD_CC ; then	AC_MSG_RESULT([Use Fortran to link programs])    elif ${CC} -o conftest conftest.o conftest1.o $LDFLAGS $FLIBS 2>&AC_FD_CC ; then	AC_MSG_RESULT([Use C with FLIBS to link programs])	F77LINKER="$CC"        F77_LDFLAGS="$F77_LDFLAGS $FLIBS"    else	AC_MSG_RESULT([Unable to determine how to link Fortran programs with C])    fielse    AC_MSG_ERROR([Could not compile Fortran test program])fiAC_LANG_RESTORE])dnldnldnlAC_DEFUN(PAC_PROG_F77_CHECK_FLIBS,[AC_MSG_CHECKING([whether C can link with $FLIBS])# Try to link a C program with all of these librariessave_LIBS="$LIBS"LIBS="$LIBS $FLIBS"AC_TRY_LINK(,[int a;],runs=yes,runs=no)LIBS="$save_LIBS"AC_MSG_RESULT($runs)if test "$runs" = "no" ; then    AC_MSG_CHECKING([which libraries can be used])    pac_ldirs=""    pac_libs=""    pac_other=""    for name in $FLIBS ; do        case $name in         -l*) pac_libs="$pac_libs $name" ;;        -L*) pac_ldirs="$pac_ldirs $name" ;;        *)   pac_other="$pac_other $name" ;;        esac    done    save_LIBS="$LIBS"    keep_libs=""    for name in $pac_libs ; do         LIBS="$save_LIBS $pac_ldirs $pac_other $name"        AC_TRY_LINK(,[int a;],runs=yes,runs=no)        if test $runs = "yes" ; then keep_libs="$keep_libs $name" ; fi    done    AC_MSG_RESULT($keep_libs)    LIBS="$save_LIBS"    FLIBS="$pac_ldirs $pac_other $keep_libs"fi])AC_DEFUN(PAC_PROG_F77_NEW_CHAR_DECL,[AC_CACHE_CHECK([whether Fortran supports new-style character declarations],pac_cv_prog_f77_new_char_decl,[AC_LANG_SAVEAC_LANG_FORTRAN77AC_TRY_COMPILE(,[       character (len=10) s],pac_cv_prog_f77_new_char_decl="yes",pac_cv_prog_f77_new_char_decl="no")AC_LANG_RESTORE])if test "$pac_cv_prog_f77_new_char_decl" = "yes" ; then    ifelse([$1],,:,$1)else    ifelse([$2],,:,$2)fi])dnl

⌨️ 快捷键说明

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