"Fossies" - the Fresh Open Source Software Archive

Member "openmpi-4.1.2/ompi/mca/io/romio321/romio/confdb/aclocal_romio.m4" (24 Nov 2021, 25306 Bytes) of package /linux/misc/openmpi-4.1.2.tar.bz2:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "aclocal_romio.m4": 4.1.1_vs_5.0.0rc2.

    1 dnl
    2 dnl This files contains additional macros for using autoconf to 
    3 dnl build configure scripts.
    4 dnl
    5 dnl Almost all of this file is taken from the aclocal.m4 of MPICH
    6 dnl
    7 dnl Get the format of Fortran names.  Uses F77, FFLAGS, and sets WDEF.
    8 dnl If the test fails, sets NOF77 to 1, HAVE_FORTRAN to 0.
    9 dnl
   10 dnl
   11 AC_DEFUN([PAC_GET_FORTNAMES],[
   12    rm -f confftest.f confftest.$OBJEXT
   13    cat > confftest.f <<EOF
   14        subroutine mpir_init_fop( a )
   15        integer a
   16        a = 1
   17        return
   18        end
   19 EOF
   20    $F77 $FFLAGS -c confftest.f > /dev/null 2>&1
   21    if test ! -s confftest.$OBJEXT ; then
   22 	AC_MSG_WARN([Unable to test Fortran compiler.  Compiling a test 
   23 program failed to produce an object file])
   24 	NOF77=1
   25    elif test -z "$FORTRANNAMES" ; then
   26      # MAC OS X (and probably FreeBSD need strings - (not strings -a)
   27      # Cray doesn't accept -a ...
   28      allstrings="-a"
   29      if test $arch_CRAY ; then 
   30 	allstrings="" 
   31      elif strings - confftest.$OBJEXT < /dev/null >/dev/null 2>&1 ; then
   32          allstrings="-"
   33      elif strings -a confftest.$OBJEXT < /dev/null >/dev/null 2>&1 ; then
   34          allstrings="-a"
   35      fi
   36     
   37      nameform1=`strings $allstrings confftest.$OBJEXT | grep mpir_init_fop_  | head -1`
   38      nameform2=`strings $allstrings confftest.$OBJEXT | grep MPIR_INIT_FOP   | head -1`
   39      nameform3=`strings $allstrings confftest.$OBJEXT | grep mpir_init_fop   | head -1`
   40      nameform4=`strings $allstrings confftest.$OBJEXT | grep mpir_init_fop__ | head -1`
   41     rm -f confftest.f confftest.$OBJEXT
   42     if test -n "$nameform4" ; then
   43 	echo "Fortran externals are lower case and have two trailing underscores"
   44 	FORTRANNAMES="FORTRANDOUBLEUNDERSCORE"
   45     elif test -n "$nameform1" ; then
   46         # We don't set this in CFLAGS; it is a default case
   47         echo "Fortran externals have a trailing underscore and are lowercase"
   48 	FORTRANNAMES="FORTRANUNDERSCORE"
   49     elif test -n "$nameform2" ; then
   50 	echo "Fortran externals are uppercase"     
   51 	FORTRANNAMES="FORTRANCAPS" 
   52     elif test -n "$nameform3" ; then
   53 	echo "Fortran externals are lower case"
   54 	FORTRANNAMES="FORTRANNOUNDERSCORE"
   55     else
   56 	AC_MSG_WARN([Unable to determine the form of Fortran external names.
   57 Make sure that the compiler $F77 can be run on this system.
   58 Turning off Fortran (-nof77 being assumed)])
   59 	NOF77=1
   60     fi
   61     fi
   62     if test -n "$FORTRANNAMES" ; then
   63         WDEF="-D$FORTRANNAMES"
   64     fi
   65     # Delete confftest files with any extension.  This catches the case
   66     # where auxillary files, such as coverage files, are removed.
   67     rm -f confftest.*
   68     ])dnl
   69 dnl
   70 define(PAC_GET_SPECIAL_SYSTEM_INFO,[
   71 #
   72 if test -n "$arch_IRIX"; then
   73    AC_MSG_CHECKING(for IRIX OS version)
   74    dnl This block of code replaces a generic "IRIX" arch value with
   75    dnl  IRIX_<version>_<chip>
   76    dnl  For example
   77    dnl  IRIX_5_4400 (IRIX 5.x, using MIPS 4400)
   78    osversion=`uname -r | sed 's/\..*//'`
   79    dnl Note that we need to allow brackets here, so we briefly turn off 
   80    dnl the macro quotes
   81    changequote(,)dnl
   82    dnl Get the second field (looking for 6.1)
   83    osvminor=`uname -r | sed 's/[0-9]\.\([0-9]*\)\..*/\1/'`
   84    changequote([,])dnl
   85    AC_MSG_RESULT($osversion)
   86    dnl Get SGI processor count by quick hack
   87    AC_MSG_CHECKING(for IRIX cpucount)
   88    changequote(,)dnl
   89    cpucount=`hinv | grep '[0-9]* [0-9]* MHZ IP[0-9]* Proc' | cut -f 1 -d' '`
   90    if test "$cpucount" = "" ; then
   91      cpucount=`hinv | grep 'Processor [0-9]*:' | wc -l | sed -e 's/ //g'`
   92    fi
   93    changequote([,])dnl
   94    if test "$cpucount" = "" ; then
   95      AC_MSG_RESULT([Could not determine cpucount.  Please send])
   96      hinv
   97      AC_MSG_ERROR([to romio-maint@mcs.anl.gov])
   98    fi
   99    AC_MSG_RESULT($cpucount)
  100    dnl
  101    AC_MSG_CHECKING(for IRIX cpumodel)
  102    dnl The tail -1 is necessary for multiple processor SGI boxes
  103    dnl We might use this to detect SGI multiprocessors and recommend
  104    dnl -comm=shared
  105    cputype=`hinv -t cpu | tail -1 | cut -f 3 -d' '`
  106    if test -z "$cputype" ; then
  107         AC_MSG_RESULT([Could not get cputype from hinv -t cpu command. Please send])
  108         hinv -t cpu 2>&1
  109         hinv -t cpu | cut -f 3 -d' ' 2>&1
  110 	AC_MSG_ERROR([to romio-maint@mcs.anl.gov])
  111    fi
  112    AC_MSG_RESULT($cputype)
  113    dnl echo "checking for osversion and cputype"
  114    dnl cputype may contain R4400, R2000A/R3000, or something else.  
  115    dnl We may eventually need to look at it.
  116    if test -z "$osversion" ; then
  117         AC_MSG_RESULT([Could not determine OS version.  Please send])
  118         uname -a
  119         AC_MSG_ERROR([to romio-maint@mcs.anl.gov])
  120    elif test $osversion = 4 ; then
  121         true
  122    elif test $osversion = 5 ; then
  123         true
  124    elif test $osversion = 6 ; then
  125         true
  126    else 
  127        AC_MSG_RESULT([Could not recognize the version of IRIX (got $osversion).
  128 ROMIO knows about versions 4, 5 and 6; the version being returned from 
  129 uname -r is $osversion.  Please send])
  130        uname -a 2>&1
  131        hinv 2>&1
  132        AC_MSG_ERROR([to romio-maint@mcs.anl.gov])
  133    fi
  134    AC_MSG_CHECKING(for cputype)
  135    OLD_ARCH=IRIX
  136    IRIXARCH="$ARCH_$osversion"
  137    dnl Now, handle the chip set
  138    changequote(,)dnl
  139    cputype=`echo $cputype | sed -e 's%.*/%%' -e 's/R//' | tr -d "[A-Z]"`
  140    changequote([,])dnl
  141    case $cputype in 
  142         3000) ;;
  143         4000) ;;
  144         4400) ;;
  145         4600) ;;
  146         5000) ;;
  147         8000) ;;
  148         10000);;
  149 	12000);;
  150         *)
  151 	AC_MSG_WARN([Unexpected IRIX/MIPS chipset $cputype.  Please send the output])
  152         uname -a 2>&1
  153         hinv 2>&1 
  154         AC_MSG_WARN([to romio-maint@mcs.anl.gov
  155 ROMIO will continue and assume that the cputype is
  156 compatible with a MIPS 4400 processor.])
  157         cputype=4400
  158         ;;
  159    esac
  160    AC_MSG_RESULT($cputype)
  161    IRIXARCH="$IRIXARCH_$cputype"
  162    echo "IRIX-specific architecture is $IRIXARCH"
  163 fi
  164 ])dnl
  165 dnl
  166 dnl
  167 define(PAC_TEST_MPI,[
  168   AC_MSG_CHECKING(if a simple MPI program compiles and links)
  169   rm -f mpitest.c
  170   cat > mpitest.c <<EOF
  171 #include "mpi.h"
  172      main(int argc, char **argv)
  173      {
  174          MPI_Init(&argc,&argv);
  175          MPI_Finalize(); 
  176      }
  177 EOF
  178   rm -f conftest$EXEEXT
  179   cmd="$CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB"
  180   echo "$as_me:$LINENO: $cmd" >&5
  181   $cmd >&5 2>&5
  182   if test ! -x conftest$EXEEXT ; then
  183       echo "$as_me:$LINENO: failed program was:" >&5
  184       sed 's/^/| /' mpitest.c >&5
  185       rm -f conftest$EXEEXT mpitest.c
  186       AC_MSG_ERROR([Unable to compile a simple MPI program.
  187 Use environment variables to provide the location of MPI libraries and
  188 include directories])
  189   else
  190       rm -f conftest$EXEEXT mpitest.c
  191   fi
  192 AC_MSG_RESULT(yes)
  193 ])dnl
  194 dnl
  195 dnl
  196 dnl
  197 define(PAC_NEEDS_FINT,[
  198   AC_MSG_CHECKING(if MPI_Fint is defined in the MPI implementation)
  199   cat > mpitest1.c <<EOF
  200 #include "mpi.h"
  201      main()
  202      {
  203          MPI_Fint i;
  204          i = 0;
  205      }
  206 EOF
  207   rm -f mpitest1.$OBJEXT
  208   $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -c mpitest1.c > /dev/null 2>&1
  209   if test ! -s mpitest1.$OBJEXT ; then
  210       NEEDS_MPI_FINT="#define NEEDS_MPI_FINT"
  211       CFLAGS="$CFLAGS -DNEEDS_MPI_FINT"
  212       AC_MSG_RESULT(no)
  213       rm -f mpitest1.$OBJEXT mpitest1.c
  214   else
  215       NEEDS_MPI_FINT=""
  216       AC_MSG_RESULT(yes)
  217       rm -f mpitest1.$OBJEXT mpitest1.c
  218   fi
  219 ])dnl
  220 dnl
  221 define(PAC_MPI_LONG_LONG_INT,[
  222   AC_MSG_CHECKING(if MPI_LONG_LONG_INT is defined in mpi.h)
  223   rm -f mpitest.c
  224   cat > mpitest.c <<EOF
  225 #include "mpi.h"
  226      main(int argc, char **argv)
  227      {
  228          long long i;   
  229          MPI_Init(&argc,&argv);
  230          MPI_Send(&i, 1, MPI_LONG_LONG_INT, 0, 0, MPI_COMM_WORLD);
  231          MPI_Finalize(); 
  232      }
  233 EOF
  234   rm -f conftest$EXEEXT
  235   $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1
  236   if test -x conftest$EXEEXT ; then
  237       AC_MSG_RESULT(yes)
  238       AC_DEFINE(HAVE_MPI_LONG_LONG_INT,,[Define if mpi has long long it])
  239   else
  240       AC_MSG_RESULT(no)
  241   fi
  242   rm -f conftest$EXEEXT mpitest.c
  243 ])dnl
  244 dnl
  245 dnl PAC_LONG_LONG_64: check if there is a 64-bit long long
  246 dnl
  247 define(PAC_LONG_LONG_64,[
  248 if test -n "$longlongsize" ; then
  249     if test "$longlongsize" = 8 ; then
  250        echo "defining MPI_Offset as long long in C and integer*8 in Fortran" 
  251        AC_DEFINE(HAVE_LONG_LONG_64,,[Define if long long is 64 bits])
  252        DEFINE_MPI_OFFSET="typedef long long MPI_Offset;"
  253        FORTRAN_MPI_OFFSET="integer*8"
  254        LL="\%lld"
  255     elif test "$longlongsize" = "int" ; then  # a hack to set MPI_Offset as int
  256        echo "defining MPI_Offset as int in C and integer in Fortran"
  257        DEFINE_MPI_OFFSET="typedef int MPI_Offset;"
  258        FORTRAN_MPI_OFFSET="integer"
  259        AC_DEFINE(MPI_OFFSET_IS_INT,,[Define if MPI_Offset is int])
  260        LL="\%d"
  261        MPI_OFFSET_KIND1="!"
  262        MPI_OFFSET_KIND2="!"
  263     else 
  264        echo "defining MPI_Offset as long in C and integer in Fortran" 
  265        DEFINE_MPI_OFFSET="typedef long MPI_Offset;"
  266        FORTRAN_MPI_OFFSET="integer"
  267        LL="\%ld"
  268        MPI_OFFSET_KIND1="!"
  269        MPI_OFFSET_KIND2="!"
  270     fi
  271 else
  272    PAC_GET_TYPE_SIZE(long long, longlongsize)
  273    if test -n "$longlongsize" ; then
  274       if test "$longlongsize" = 8 ; then
  275          PAC_TEST_LONG_LONG()
  276       else
  277          echo "defining MPI_Offset as long in C and integer in Fortran" 
  278          DEFINE_MPI_OFFSET="typedef long MPI_Offset;"
  279          FORTRAN_MPI_OFFSET="integer"
  280          LL="\%ld"
  281          MPI_OFFSET_KIND1="!"
  282          MPI_OFFSET_KIND2="!"
  283       fi
  284    else 
  285 dnl   check if longlong is not supported or only its size cannot be determined
  286 dnl   because the program cannot be run.
  287       rm -f ltest.c
  288       cat > ltest.c <<EOF
  289         main()
  290         {
  291            long long i=8;
  292            return 0;
  293         }
  294 EOF
  295       rm -f conftest$EXEEXT
  296       $CC $USER_CFLAGS -o conftest$EXEEXT ltest.c > /dev/null 2>&1
  297       if test -x conftest$EXEEXT ; then
  298          echo "assuming size of long long is 8bytes; use '-longlongsize' to indicate otherwise"
  299          rm -f conftest$EXEEXT ltest.c
  300          echo "defining MPI_Offset as long long in C and integer*8 in Fortran" 
  301          AC_DEFINE(HAVE_LONG_LONG_64,,[Define if long long is 64 bits])
  302          DEFINE_MPI_OFFSET="typedef long long MPI_Offset;"
  303          FORTRAN_MPI_OFFSET="integer*8"
  304          LL="\%lld"
  305       else 
  306          echo "assuming long long is not available; use '-longlongsize' to indicate otherwise"
  307          echo "defining MPI_Offset as long in C and integer in Fortran" 
  308          DEFINE_MPI_OFFSET="typedef long MPI_Offset;"
  309          FORTRAN_MPI_OFFSET="integer"
  310          LL="\%ld"
  311          MPI_OFFSET_KIND1="!"
  312          MPI_OFFSET_KIND2="!"
  313       fi
  314    fi
  315 fi
  316 ])dnl
  317 dnl
  318 dnl
  319 define(PAC_MPI_INFO,[
  320   AC_MSG_CHECKING(if MPI_Info functions are defined in the MPI implementation)
  321   rm -f mpitest.c
  322   cat > mpitest.c <<EOF
  323 #include "mpi.h"
  324      main(int argc, char **argv)
  325      {
  326          MPI_Info info;
  327          MPI_Init(&argc,&argv);
  328          MPI_Info_create(&info);
  329          MPI_Finalize(); 
  330      }
  331 EOF
  332   rm -f conftest$EXEEXT
  333   $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1
  334   if test -x conftest$EXEEXT ; then
  335       AC_MSG_RESULT(yes)
  336       AC_DEFINE(HAVE_MPI_INFO,1,[Define if MPI_Info available])
  337       HAVE_MPI_INFO="#define HAVE_MPI_INFO"
  338       MPI_FINFO1="!"
  339       MPI_FINFO2="!"
  340       MPI_FINFO3="!"
  341       MPI_FINFO4="!"
  342   else
  343       AC_MSG_RESULT(no)
  344       BUILD_MPI_INFO=1
  345       MPI_FINFO1="      INTEGER MPI_MAX_INFO_KEY, MPI_MAX_INFO_VAL"
  346       MPI_FINFO2="      PARAMETER (MPI_MAX_INFO_KEY=255, MPI_MAX_INFO_VAL=1024)"
  347       MPI_FINFO3="      INTEGER MPI_INFO_NULL"
  348       MPI_FINFO4="      PARAMETER (MPI_INFO_NULL=0)"
  349   fi
  350   rm -f conftest$EXEEXT mpitest.c
  351 ])dnl
  352 dnl
  353 dnl
  354 define(PAC_MPI_DARRAY_SUBARRAY,[
  355   AC_MSG_CHECKING(if darray and subarray constructors are defined in the MPI implementation)
  356   rm -f mpitest.c
  357   cat > mpitest.c <<EOF
  358 #include "mpi.h"
  359      main(int argc, char **argv)
  360      {
  361          int i=MPI_DISTRIBUTE_CYCLIC;
  362          MPI_Datatype t;
  363          MPI_Init(&argc,&argv);
  364          MPI_Type_create_darray(i, i, i, &i, &i, &i, &i, i, MPI_INT, &t);
  365          MPI_Type_create_subarray(i, &i, &i, &i, i, MPI_INT, &t);
  366          MPI_Finalize(); 
  367      }
  368 EOF
  369   rm -f conftest$EXEEXT
  370   $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1
  371   if test -x conftest$EXEEXT ; then
  372       AC_MSG_RESULT(yes)
  373       AC_DEFINE(HAVE_MPI_DARRAY_SUBARRAY,,[Define if MPI Darray available])
  374       HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY"
  375       MPI_FARRAY1="!"
  376       MPI_FARRAY2="!"
  377       MPI_FARRAY3="!"
  378       MPI_FARRAY4="!"
  379       MPI_FARRAY5="!"
  380       MPI_FARRAY6="!"
  381       MPI_FARRAY7="!"
  382   else
  383       AC_MSG_RESULT(no)
  384       BUILD_MPI_ARRAY=1
  385       MPI_FARRAY1="      INTEGER MPI_ORDER_C, MPI_ORDER_FORTRAN"
  386       MPI_FARRAY2="      PARAMETER (MPI_ORDER_C=56, MPI_ORDER_FORTRAN=57)"
  387       MPI_FARRAY3="      INTEGER MPI_DISTRIBUTE_BLOCK, MPI_DISTRIBUTE_CYCLIC"
  388       MPI_FARRAY4="      INTEGER MPI_DISTRIBUTE_NONE, MPI_DISTRIBUTE_DFLT_DARG"
  389       MPI_FARRAY5="      PARAMETER (MPI_DISTRIBUTE_BLOCK=121, MPI_DISTRIBUTE_CYCLIC=122)"
  390       MPI_FARRAY6="      PARAMETER (MPI_DISTRIBUTE_NONE=123)"
  391       MPI_FARRAY7="      PARAMETER (MPI_DISTRIBUTE_DFLT_DARG=-49767)"
  392   fi
  393   rm -f conftest$EXEEXT mpitest.c
  394 ])dnl
  395 dnl
  396 dnl
  397 define(PAC_CHECK_MPI_SGI_INFO_NULL,[
  398   AC_MSG_CHECKING([if MPI_INFO_NULL is defined in mpi.h])
  399   rm -f mpitest.c
  400   cat > mpitest.c <<EOF
  401 #include "mpi.h"
  402      main(int argc, char **argv)
  403      {
  404 	int i;
  405 	i = MPI_INFO_NULL;
  406      }
  407 EOF
  408   rm -f conftest$EXEEXT
  409   $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1
  410   if test -x conftest$EXEEXT ; then
  411       AC_MSG_RESULT(yes)
  412       cp adio/sgi/mpi3.1/*.h include
  413   else
  414       AC_MSG_RESULT(no)
  415   fi
  416   rm -f conftest$EXEEXT mpitest.c
  417 ])dnl
  418 dnl
  419 dnl
  420 dnl
  421 define(PAC_CHECK_MPIOF_H,[
  422   AC_MSG_CHECKING(if mpiof.h is included in mpif.h)
  423   rm -f mpitest.f
  424   cat > mpitest.f <<EOF
  425       program main
  426       implicit none
  427       include 'mpif.h'
  428       integer i
  429       i = MPI_MODE_RDWR
  430       stop
  431       end
  432 EOF
  433   rm -f conftest$EXEEXT
  434   $F77 $FFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.f $MPI_LIB > /dev/null 2>&1
  435   if test -x conftest$EXEEXT ; then
  436       AC_MSG_RESULT(yes)
  437       MPIOF_H_INCLUDED=1
  438   else
  439       AC_MSG_RESULT(no)
  440   fi
  441   rm -f conftest$EXEEXT mpitest.f
  442 ])dnl
  443 dnl
  444 dnl
  445 dnl check if pread64 is defined in IRIX. needed on IRIX 6.5
  446 dnl
  447 define(PAC_HAVE_PREAD64,[
  448   AC_MSG_CHECKING(if pread64 is defined)
  449   rm -f conftest.c
  450   cat > conftest.c <<EOF
  451 #include <unistd.h>
  452      main()
  453      {
  454          int fd=0, buf=0, i=0;
  455          off64_t off=0;
  456          pread64(fd, &buf, i, off);
  457      }
  458 EOF
  459   rm -f conftest$EXEEXT
  460   $CC $USER_CFLAGS -o conftest$EXEEXT conftest.c > /dev/null 2>&1
  461   if test -x conftest$EXEEXT ; then
  462       AC_MSG_RESULT(yes)
  463       AC_DEFINE(HAVE_PREAD64,,[Define if pread64 available])
  464   else
  465       AC_MSG_RESULT(no)
  466   fi
  467 rm -f conftest$EXEEXT conftest.c
  468 ])dnl
  469 dnl
  470 dnl
  471 define(PAC_TEST_MPI_SGI_type_is_contig,[
  472   AC_MSG_CHECKING(if MPI_SGI_type_is_contig is defined)
  473   rm -f mpitest.c
  474   cat > mpitest.c <<EOF
  475 #include "mpi.h"
  476      main(int argc, char **argv)
  477      {
  478          MPI_Datatype type;
  479          int i;
  480 
  481          MPI_Init(&argc,&argv);
  482          i = MPI_SGI_type_is_contig(type);
  483          MPI_Finalize(); 
  484      }
  485 EOF
  486   rm -f conftest$EXEEXT
  487   $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1
  488   if test -x conftest$EXEEXT ; then
  489      AC_MSG_RESULT(yes)
  490   else
  491      AC_MSG_RESULT(no)
  492      AC_DEFINE(NO_MPI_SGI_type_is_contig,,[Define if no MPI type is contig])
  493   fi
  494   rm -f conftest$EXEEXT mpitest.c
  495 ])dnl
  496 dnl
  497 dnl
  498 dnl
  499 define(PAC_TEST_MPI_COMBINERS,[
  500   AC_MSG_CHECKING(if MPI-2 combiners are defined in mpi.h)
  501   rm -f mpitest.c
  502   cat > mpitest.c <<EOF
  503 #include "mpi.h"
  504      main(int argc, char **argv)
  505      {
  506          int i;
  507 
  508          MPI_Init(&argc,&argv);
  509          i = MPI_COMBINER_STRUCT;
  510          MPI_Finalize(); 
  511      }
  512 EOF
  513   rm -f conftest$EXEEXT
  514   $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1
  515   if test -x conftest$EXEEXT ; then
  516      AC_MSG_RESULT(yes)
  517      AC_DEFINE(HAVE_MPI_COMBINERS,,[Define if MPI combiners available])
  518   else
  519      AC_MSG_RESULT(no)
  520   fi
  521   rm -f conftest$EXEEXT mpitest.c
  522 ])dnl
  523 dnl
  524 dnl
  525 dnl PAC_MPI_OFFSET_KIND()
  526 dnl
  527 dnl tries to determine the Fortran 90 kind parameter for 8-byte integers
  528 dnl
  529 define(PAC_MPI_OFFSET_KIND,
  530 [
  531 # This is needed for Mac OSX 10.5
  532 rm -rf conftest.dSYM
  533 rm -f conftest*
  534 # Determine the extension for Fortran 90 files (not all compilers accept
  535 # .f and not all accept .f90)
  536 if test -z "$ac_f90ext" ; then
  537     if test -z "$FC" ; then
  538        # This list should correspond to the list in aclocal_fc.m4
  539        AC_CHECK_PROGS(FC,ifort pgf90 pathf90 pathf95 xlf90 xlf95 f90 epcf90 \
  540        f95 fort lf95 gfortran g95 ifc efc)
  541     fi
  542     AC_MSG_CHECKING([for extension for Fortran 90 programs])
  543     ac_f90ext="f90"
  544     ac_f90compile='${FC-f90} -c $FCFLAGS conftest.$ac_f90ext 1>&AC_FD_CC'
  545     cat > conftest.$ac_f90ext <<EOF
  546       program conftest
  547       end
  548 EOF
  549     if AC_TRY_EVAL(ac_f90compile) ; then
  550         AC_MSG_RESULT([f90])
  551     else
  552 	# This is needed for Mac OSX 10.5
  553 	rm -rf conftest.dSYM
  554         rm -f conftest*
  555         ac_f90ext="f"
  556         cat > conftest.$ac_f90ext <<EOF
  557       program conftest
  558       end
  559 EOF
  560         if AC_TRY_EVAL(ac_f90compile) ; then
  561             AC_MSG_RESULT([f])
  562         else
  563             AC_MSG_RESULT([unknown!])
  564         fi
  565     fi
  566 fi
  567 AC_MSG_CHECKING([for Fortran 90 KIND parameter for 8-byte integers])
  568 cat <<EOF > conftest.$ac_f90ext
  569       program main
  570       integer i
  571       i = selected_int_kind(16)
  572       open(8, file="conftest.out", form="formatted")
  573       write (8,*) i
  574       close(8)
  575       stop
  576       end
  577 EOF
  578 if test -z "$FC" ; then
  579    FC=f90
  580 fi
  581 KINDVAL=""
  582 if $FC -o conftest$EXEEXT conftest.$ac_f90ext >/dev/null 2>&1 ; then
  583     ./conftest$EXEEXT >/dev/null 2>&1
  584     if test -s conftest.out ; then 
  585         KINDVAL=`cat conftest.out`
  586     fi
  587 fi
  588 # This is needed for Mac OSX 10.5
  589 rm -rf conftest.dSYM
  590 rm -f conftest*
  591 if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then
  592    AC_MSG_RESULT($KINDVAL)
  593    MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
  594    MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=$KINDVAL)"
  595 else
  596     AC_MSG_RESULT(unavailable)
  597 fi
  598 ])dnl
  599 dnl
  600 dnl
  601 define(PAC_TEST_MPI_HAVE_OFFSET_KIND,[
  602   AC_MSG_CHECKING(if MPI_OFFSET_KIND is defined in mpif.h)
  603   rm -f mpitest.f
  604   cat > mpitest.f <<EOF
  605       program main
  606       implicit none
  607       include 'mpif.h'
  608       integer i
  609       i = MPI_OFFSET_KIND
  610       stop
  611       end
  612 EOF
  613   rm -f conftest$EXEEXT
  614   $F77 $FFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.f $MPI_LIB > /dev/null 2>&1
  615   if test -x conftest$EXEEXT ; then
  616      AC_MSG_RESULT(yes)
  617      MPI_OFFSET_KIND1="!"
  618      MPI_OFFSET_KIND2="!"
  619   else
  620      AC_MSG_RESULT(no)
  621   fi
  622   rm -f conftest$EXEEXT mpitest.f
  623 ])dnl
  624 dnl
  625 dnl
  626 dnl PAC_GET_XFS_MEMALIGN
  627 dnl 
  628 dnl
  629 define(PAC_GET_XFS_MEMALIGN,
  630 [AC_MSG_CHECKING([for memory alignment needed for direct I/O])
  631 rm -f memalignval
  632 rm -f /tmp/romio_tmp.bin
  633 AC_TEST_PROGRAM([#include <stdio.h>
  634 #include <unistd.h>
  635 #include <fcntl.h>
  636 #include <stdio.h>
  637 main() { 
  638   struct dioattr st;
  639   int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644);
  640   FILE *f=fopen("memalignval","w");
  641   if (fd == -1) exit(1);
  642   if (!f) exit(1);
  643   fcntl(fd, F_DIOINFO, &st);
  644   fprintf( f, "%u\n", st.d_mem);
  645   exit(0);
  646 }],Pac_CV_NAME=`cat memalignval`,Pac_CV_NAME="")
  647 rm -f memalignval
  648 rm -f /tmp/romio_tmp.bin
  649 if test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then
  650     AC_MSG_RESULT($Pac_CV_NAME)
  651     CFLAGS="$CFLAGS -DXFS_MEMALIGN=$Pac_CV_NAME"
  652 else
  653     AC_MSG_RESULT(unavailable, assuming 128)
  654     CFLAGS="$CFLAGS -DXFS_MEMALIGN=128"
  655 fi
  656 ])dnl
  657 dnl
  658 
  659 define(PAC_HAVE_MOUNT_NFS,[
  660   AC_MSG_CHECKING([if MOUNT_NFS is defined in the include files])
  661   rm -f conftest.c
  662   cat > conftest.c <<EOF
  663 #include <sys/param.h>
  664 #include <sys/mount.h>
  665      main()
  666      {
  667          int i=MOUNT_NFS;
  668      }
  669 EOF
  670   rm -f conftest$EXEEXT
  671   $CC $USER_CFLAGS -o conftest$EXEEXT conftest.c > /dev/null 2>&1
  672   if test -x conftest$EXEEXT ; then
  673      AC_MSG_RESULT(yes)
  674      ROMIO_HAVE_MOUNT_NFS=1
  675      AC_DEFINE(HAVE_MOUNT_NFS,,[Define if MOUNT_NFS defined])
  676   else
  677      ROMIO_HAVE_MOUNT_NFS=0
  678      AC_MSG_RESULT(no)
  679   fi
  680   rm -f conftest$EXEEXT conftest.c
  681 ])dnl
  682 dnl
  683 dnl
  684 dnl PAC_MPI_OFFSET_KIND_4BYTE()
  685 dnl
  686 dnl tries to determine the Fortran 90 kind parameter for 4-byte integers
  687 dnl
  688 define(PAC_MPI_OFFSET_KIND_4BYTE,
  689 [AC_MSG_CHECKING([for Fortran 90 KIND parameter for 4-byte integers])
  690 rm -f kind.f kind.$OBJEXT kind$EXEEXT
  691 cat <<EOF > kind.f
  692       program main
  693       integer i
  694       i = selected_int_kind(8)
  695       open(8, file="k.out", form="formatted")
  696       write (8,*) i
  697       close(8)
  698       stop
  699       end
  700 EOF
  701 if test -z "$FC" ; then
  702    FC=f90
  703 fi
  704 KINDVAL=""
  705 if $FC -o kind$EXEEXT kind.f >/dev/null 2>&1 ; then
  706     ./kind >/dev/null 2>&1
  707     if test -s k.out ; then 
  708         KINDVAL=`cat k.out`
  709     fi
  710 fi
  711 rm -f kind$EXEEXT k.out kind.f kind.$OBJEXT
  712 if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then
  713    AC_MSG_RESULT($KINDVAL)
  714    MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
  715    MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=$KINDVAL)"
  716 else
  717     AC_MSG_RESULT(unavailable)
  718 fi
  719 ])dnl
  720 dnl
  721 dnl
  722 define(PAC_FUNC_STRERROR,[
  723   AC_MSG_CHECKING([for strerror()])
  724   rm -f conftest.c
  725   cat > conftest.c <<EOF
  726 #include <string.h>
  727      main()
  728      {
  729         char *s = strerror(5);
  730      }
  731 EOF
  732   rm -f conftest$EXEEXT
  733   $CC $USER_CFLAGS -o conftest$EXEXT conftest.c >> config.log 2>&1
  734   if test -x conftest$EXEEXT ; then
  735      AC_MSG_RESULT(yes)
  736      AC_DEFINE(HAVE_STRERROR,,[Define if strerror available])
  737   else
  738      AC_MSG_RESULT(no)
  739      AC_MSG_CHECKING([for sys_errlist])
  740      rm -f conftest.c
  741 changequote(,)
  742      cat > conftest.c <<EOF
  743 #include <stdio.h>
  744         main()
  745         {
  746            extern char *sys_errlist[];
  747 	   printf("%s\n", sys_errlist[34]);
  748         }
  749 EOF
  750 changequote([,])
  751      rm -f conftest$EXEEXT
  752      $CC $USER_CFLAGS -o conftest$EXEEXT conftest.c > config.log 2>&1
  753      if test -x conftest$EXEEXT ; then
  754         AC_MSG_RESULT(yes)
  755         AC_DEFINE(HAVE_SYSERRLIST,,[Define if syserrlist available])
  756      else
  757         AC_MSG_RESULT(no)
  758      fi
  759   fi
  760   rm -f conftest$EXEEXT conftest.c
  761 ])dnl
  762 dnl
  763 define(PAC_TEST_MPIR_STATUS_SET_BYTES,[
  764   AC_MSG_CHECKING(if MPIR_Status_set_bytes is defined)
  765   rm -f mpitest.c
  766   cat > mpitest.c <<EOF
  767 #include "mpi.h"
  768      main(int argc, char **argv)
  769      {
  770      	 MPI_Status status;
  771          MPI_Datatype type;
  772 	 int err;
  773 
  774          MPI_Init(&argc,&argv);
  775          MPIR_Status_set_bytes(status,type,err);
  776          MPI_Finalize(); 
  777      }
  778 EOF
  779   rm -f conftest$EXEEXT
  780   $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1
  781   if test -x conftest$EXEEXT ; then
  782      AC_MSG_RESULT(yes)
  783      AC_DEFINE(HAVE_STATUS_SET_BYTES,,[Define if status set bytes available])
  784   else
  785      AC_MSG_RESULT(no)
  786   fi
  787   rm -f conftest$EXEEXT mpitest.c
  788 ])dnl
  789 define(PAC_TEST_MPIU_FUNCS,[
  790   AC_MSG_CHECKING(support for MPICH memory macros)
  791   rm -f mpitest.c
  792   cat > mpitest.c <<EOF
  793 #include "mpi.h"
  794 #include "stdio.h"
  795   main(Int argc, char **argv)
  796   {
  797       MPIU_Free(NULL);
  798   }
  799 EOF
  800   rm -f conftest$EXEEXT
  801   $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1
  802   if test -x conftest$EXEEXT ; then
  803      AC_MSG_RESULT(yes)
  804      AC_DEFINE(HAVE_MPIU_FUNCS,1,[Define if MPICH memory tracing macros defined])
  805   else
  806      AC_MSG_RESULT(no)
  807   fi
  808   rm -f conftest$EXEEXT mpitest.c
  809 ])dnl
  810 dnl
  811 define(PAC_TEST_MPI_GREQUEST,[
  812   AC_MSG_CHECKING(support for generalized requests)
  813   rm -f mpitest.c
  814   cat > mpitest.c <<EOF
  815 #include "mpi.h"
  816 #include "stdio.h"
  817     main(int argc, char **argv)
  818     {
  819        MPI_Request request;
  820        MPI_Init(&argc, &argv);
  821        MPI_Grequest_start(NULL, NULL, NULL, NULL, &request);
  822        MPI_Finalize();
  823      }
  824 EOF
  825   rm -f conftest$EXEEXT
  826   $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1
  827   if test -x conftest$EXEEXT ; then
  828      AC_MSG_RESULT(yes)
  829      AC_DEFINE(HAVE_MPI_GREQUEST,1,[Define if generalized requests avaliable])
  830      DEFINE_HAVE_MPI_GREQUEST="#define HAVE_MPI_GREQUEST 1"
  831   else
  832      AC_MSG_RESULT(no)
  833   fi
  834   rm -f conftest$EXEEXT mpitest.c
  835 ])dnl
  836 
  837 define(PAC_TEST_MPI_GREQUEST_EXTENSIONS,[
  838   AC_MSG_CHECKING(support for non-standard extended generalized requests)
  839   rm -f mpitest.c
  840   cat > mpitest.c <<EOF
  841 #include "mpi.h"
  842 #include "stdio.h"
  843     main(int argc, char **argv)
  844     {
  845        MPIX_Grequest_class classtest
  846     }
  847 EOF
  848   rm -f conftest$EXEEXT
  849   $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1
  850   if test -x conftest$EXEEXT ; then
  851      AC_MSG_RESULT(yes)
  852      AC_DEFINE(HAVE_MPI_GREQUEST_EXTENTIONS,1,[Define if non-standard generalized requests extensions avaliable])
  853      DEFINE_HAVE_MPI_GREQUEST_EXTENSIONS="#define HAVE_MPI_GREQUEST_EXTENSIONS 1"
  854   else
  855      AC_MSG_RESULT(no)
  856   fi
  857   rm -f conftest$EXEEXT mpitest.c
  858 ])dnl
  859 
  860 define(PAC_TEST_NEEDS_CONST,[
  861    AC_MSG_CHECKING([const declarations needed in MPI routines])
  862    AC_COMPILE_IFELSE([AC_LANG_SOURCE(
  863    [ #include <mpi.h>
  864      int MPI_File_delete(char *filename, MPI_Info info) { return (0); }
  865    ] )],
  866    [
  867     AC_MSG_RESULT(no)
  868    ],[
  869     AC_MSG_RESULT(yes)
  870     AC_DEFINE(HAVE_MPIIO_CONST, const, [Define if MPI-IO routines need a const qualifier])
  871    ])
  872    ])