📄 acinclude.m4
字号:
cat > mpitest.c <<EOF#include "mpi.h" main(int argc, char **argv) { int i; MPI_Init(&argc,&argv); i = MPI_COMBINER_STRUCT; MPI_Finalize(); }EOF rm -f conftest $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1 if test -x conftest ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_MPI_COMBINERS,,[Define if MPI combiners available]) else AC_MSG_RESULT(no) fi rm -f conftest mpitest.c])dnldnldnldnl PAC_MPI_OFFSET_KIND()dnldnl tries to determine the Fortran 90 kind parameter for 8-byte integersdnldefine(PAC_MPI_OFFSET_KIND,[rm -f conftest*# Determine the extension for Fortran 90 files (not all compilers accept# .f and not all accept .f90)if test -z "$ac_f90ext" ; then if test -z "$F90" ; then AC_CHECK_PROGS(F90,f90 xlf90 pgf90 ifort epcf90 f95 fort xlf95 lf95 pathf90 g95 fc ifc efc) fi AC_MSG_CHECKING([for extension for Fortran 90 programs]) ac_f90ext="f90" ac_f90compile='${F90-f90} -c $F90FLAGS conftest.$ac_f90ext 1>&AC_FD_CC' cat > conftest.$ac_f90ext <<EOF program conftest endEOF if AC_TRY_EVAL(ac_f90compile) ; then AC_MSG_RESULT([f90]) else rm -f conftest* ac_f90ext="f" cat > conftest.$ac_f90ext <<EOF program conftest endEOF if AC_TRY_EVAL(ac_f90compile) ; then AC_MSG_RESULT([f]) else AC_MSG_RESULT([unknown!]) fi fifiAC_MSG_CHECKING([for Fortran 90 KIND parameter for 8-byte integers])cat <<EOF > conftest.$ac_f90ext program main integer i i = selected_int_kind(16) open(8, file="conftest.out", form="formatted") write (8,*) i close(8) stop endEOFif test -z "$F90" ; then F90=f90fiKINDVAL=""if $F90 -o conftest conftest.$ac_f90ext >/dev/null 2>&1 ; then ./conftest >/dev/null 2>&1 if test -s conftest.out ; then KINDVAL=`cat conftest.out` fifirm -f conftest*if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then AC_MSG_RESULT($KINDVAL) MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$KINDVAL)"else AC_MSG_RESULT(unavailable)fi])dnldnldnldefine(PAC_TEST_MPI_HAVE_OFFSET_KIND,[ AC_MSG_CHECKING(if MPI_OFFSET_KIND is defined in mpif.h) rm -f mpitest.f cat > mpitest.f <<EOF program main implicit none include 'mpif.h' integer i i = MPI_OFFSET_KIND stop endEOF rm -f conftest $F77 $FFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.f $MPI_LIB > /dev/null 2>&1 if test -x conftest ; then AC_MSG_RESULT(yes) MPI_OFFSET_KIND1="!" MPI_OFFSET_KIND2="!" else AC_MSG_RESULT(no) fi rm -f conftest mpitest.f])dnldnldnldnl PAC_GET_XFS_MEMALIGNdnl dnldefine(PAC_GET_XFS_MEMALIGN,[AC_MSG_CHECKING([for memory alignment needed for direct I/O])/bin/rm -f memalignval/bin/rm -f /tmp/romio_tmp.binAC_TEST_PROGRAM([#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <stdio.h>main() { struct dioattr st; int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644); FILE *f=fopen("memalignval","w"); if (fd == -1) exit(1); if (!f) exit(1); fcntl(fd, F_DIOINFO, &st); fprintf( f, "%u\n", st.d_mem); exit(0);}],Pac_CV_NAME=`cat memalignval`,Pac_CV_NAME="")/bin/rm -f memalignval/bin/rm -f /tmp/romio_tmp.binif test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then AC_MSG_RESULT($Pac_CV_NAME) CFLAGS="$CFLAGS -DXFS_MEMALIGN=$Pac_CV_NAME"else AC_MSG_RESULT(unavailable, assuming 128) CFLAGS="$CFLAGS -DXFS_MEMALIGN=128"fi])dnldnldnldnl Look for a style of VPATH. Known forms arednl VPATH = .:dirdnl .PATH: . dirdnldnl Defines VPATH or .PATH with . $(srcdir)dnl Requires that vpath work with implicit targetsdnl NEED TO DO: Check that $< works on explicit targets.dnldefine(PAC_MAKE_VPATH,[AC_SUBST(VPATH)AC_MSG_CHECKING(for virtual path format)rm -rf conftest*mkdir conftestdircat >conftestdir/a.c <<EOFA sample fileEOFcat > conftest <<EOFall: a.oVPATH=.:conftestdir.c.o: @echo \$<EOFac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'`if test -n "$ac_out" ; then AC_MSG_RESULT(VPATH) VPATH='VPATH=.:$(srcdir)'else rm -f conftest cat > conftest <<EOFall: a.o.PATH: . conftestdir.c.o: @echo \$<EOF ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'` if test -n "$ac_out" ; then AC_MSG_RESULT(.PATH) VPATH='.PATH: . $(srcdir)' else AC_MSG_RESULT(neither VPATH nor .PATH works) fifirm -rf conftest*])dnldnldefine(PAC_HAVE_MOUNT_NFS,[ AC_MSG_CHECKING([if MOUNT_NFS is defined in the include files]) rm -f conftest.c cat > conftest.c <<EOF#include <sys/param.h>#include <sys/mount.h> main() { int i=MOUNT_NFS; }EOF rm -f conftest $CC $USER_CFLAGS -o conftest conftest.c > /dev/null 2>&1 if test -x conftest ; then AC_MSG_RESULT(yes) ROMIO_HAVE_MOUNT_NFS=1 AC_DEFINE(HAVE_MOUNT_NFS,,[Define if MOUNT_NFS defined]) else ROMIO_HAVE_MOUNT_NFS=0 AC_MSG_RESULT(no) fi rm -f conftest conftest.c])dnldnldnldnl PAC_MPI_OFFSET_KIND_4BYTE()dnldnl tries to determine the Fortran 90 kind parameter for 4-byte integersdnldefine(PAC_MPI_OFFSET_KIND_4BYTE,[AC_MSG_CHECKING([for Fortran 90 KIND parameter for 4-byte integers])rm -f kind.f kind.o kindcat <<EOF > kind.f program main integer i i = selected_int_kind(8) open(8, file="k.out", form="formatted") write (8,*) i close(8) stop endEOFif test -z "$F90" ; then F90=f90fiKINDVAL=""if $F90 -o kind kind.f >/dev/null 2>&1 ; then ./kind >/dev/null 2>&1 if test -s k.out ; then KINDVAL=`cat k.out` fifirm -f kind k.out kind.f kind.oif test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then AC_MSG_RESULT($KINDVAL) MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$KINDVAL)"else AC_MSG_RESULT(unavailable)fi])dnldnldnldefine(PAC_FUNC_STRERROR,[ AC_MSG_CHECKING([for strerror()]) rm -f conftest.c cat > conftest.c <<EOF#include <string.h> main() { char *s = strerror(5); }EOF rm -f conftest $CC $USER_CFLAGS -o conftest conftest.c >> config.log 2>&1 if test -x conftest ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_STRERROR,,[Define if strerror available]) else AC_MSG_RESULT(no) AC_MSG_CHECKING([for sys_errlist]) rm -f conftest.cchangequote(,) cat > conftest.c <<EOF#include <stdio.h> main() { extern char *sys_errlist[]; printf("%s\n", sys_errlist[34]); }EOFchangequote([,]) rm -f conftest $CC $USER_CFLAGS -o conftest conftest.c > config.log 2>&1 if test -x conftest ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SYSERRLIST,,[Define if syserrlist available]) else AC_MSG_RESULT(no) fi fi rm -f conftest conftest.c])dnldnldefine(PAC_TEST_MPIR_STATUS_SET_BYTES,[ AC_MSG_CHECKING(if MPIR_Status_set_bytes is defined) rm -f mpitest.c cat > mpitest.c <<EOF#include "mpi.h" main(int argc, char **argv) { MPI_Status status; MPI_Datatype type; int err; MPI_Init(&argc,&argv); MPIR_Status_set_bytes(status,type,err); MPI_Finalize(); }EOF rm -f conftest $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1 if test -x conftest ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_STATUS_SET_BYTES,,[Define if status set bytes available]) else AC_MSG_RESULT(no) fi rm -f conftest mpitest.c])dnldefine(PAC_TEST_MPI_GREQUEST,[ AC_MSG_CHECKING(support for generalized requests) rm -f mpitest.c cat > mpitest.c <<EOF#include "mpi.h"#include "stdio.h" main(int argc, char **argv) { MPI_Request request; MPI_Init(&argc, &argv); MPI_Grequest_start(NULL, NULL, NULL, NULL, &request); MPI_Finalize(); }EOF rm -f conftest $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1 if test -x conftest ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_MPI_GREQUEST,,[Define if generalized requests avaliable]) else AC_MSG_RESULT(no) fi rm -f conftest mpitest.c])dnldnldnl/*Ddnl PAC_FUNC_NEEDS_DECL - Set NEEDS_<funcname>_DECL if a declaration is neededdnldnl Synopsis:dnl PAC_FUNC_NEEDS_DECL(headerfiles,funcname)dnldnl Output Effect:dnl Sets 'NEEDS_<funcname>_DECL' if 'funcname' is not declared by the dnl headerfiles.dnldnl Approach:dnl Try to compile a program with the function, but passed with an incorrectdnl calling sequence. If the compilation fails, then the declarationdnl is provided within the header files. If the compilation succeeds,dnl the declaration is required.dnldnl We use a 'double' as the first argument to try and catch varargsdnl routines that may use an int or pointer as the first argument.dnl dnl D*/AC_DEFUN([PAC_FUNC_NEEDS_DECL],[AC_CACHE_CHECK([whether $2 needs a declaration],[pac_cv_func_decl_$2],[AC_TRY_COMPILE([$1],[int a=$2(1.0,27,1.0,"foo");],pac_cv_func_decl_$2=yes,pac_cv_func_decl_$2=no)])if test "$pac_cv_func_decl_$2" = "yes" ; thenchangequote(<<,>>)dnldefine(<<PAC_FUNC_NAME>>, translit(NEEDS_$2_DECL, [a-z *], [A-Z__]))dnlchangequote([, ])dnl AC_DEFINE_UNQUOTED(PAC_FUNC_NAME,1,[Define if $2 needs a declaration])undefine([PAC_FUNC_NAME])fi])dnldnldnl/*Ddnl PAC_C_RESTRICT - Check if C supports restrictdnldnl Synopsis:dnl PAC_C_RESTRICTdnldnl Output Effect:dnl Defines 'restrict' if some version of restrict is supported; otherwisednl defines 'restrict' as empty. This allows you to include 'restrict' in dnl declarations in the same way that 'AC_C_CONST' allows you to use 'const'dnl in declarations even when the C compiler does not support 'const'dnldnl Note that some compilers accept restrict only with additional options.dnl DEC/Compaq/HP Alpha Unix (Tru64 etc.) -accept restrict_keyworddnldnl D*/AC_DEFUN([PAC_C_RESTRICT],[AC_CACHE_CHECK([for restrict],[pac_cv_c_restrict],[AC_TRY_COMPILE(,[int * restrict a;],pac_cv_c_restrict="restrict",pac_cv_c_restrict="no")if test "$pac_cv_c_restrict" = "no" ; then AC_TRY_COMPILE(,[int * _Restrict a;],pac_cv_c_restrict="_Restrict", pac_cv_c_restrict="no")fiif test "$pac_cv_c_restrict" = "no" ; then AC_TRY_COMPILE(,[int * __restrict a;],pac_cv_c_restrict="__restrict", pac_cv_c_restrict="no")fi])if test "$pac_cv_c_restrict" = "no" ; then restrict_val=""elif test "$pac_cv_c_restrict" != "restrict" ; then restrict_val=$pac_cv_c_restrictfiif test "$restrict_val" != "restrict" ; then AC_DEFINE_UNQUOTED(restrict,$restrict_val,[if C does not support restrict])fi])dnldnldnldnldnl This is a replacement for AC_PROG_CC that does not prefer gcc anddnl that does not mess with CFLAGS. See acspecific.m4 for the original defn.dnldnl/*Ddnl PAC_PROG_CC - Find a working C compilerdnldnl Synopsis:dnl PAC_PROG_CCdnldnl Output Effect:dnl Sets the variable CC if it is not already setdnldnl Notes:dnl Unlike AC_PROG_CC, this does not prefer gcc and does not set CFLAGS.dnl It does check that the compiler can compile a simple C program.dnl It also sets the variable GCC to yes if the compiler is gcc. It doesdnl not yet check for some special options needed in particular for dnl parallel computers, such as -Tcray-t3e, or special options to getdnl full ANSI/ISO C, such as -Aa for HP.dnldnl D*/dnl 2.52 doesn't have AC_PROG_CC_GNUifdef([AC_PROG_CC_GNU],,[AC_DEFUN([AC_PROG_CC_GNU],)])AC_DEFUN([PAC_PROG_CC],[AC_PROVIDE([AC_PROG_CC])AC_CHECK_PROGS([CC, cc xlC xlc pgcc icc gcc])test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])PAC_PROG_CC_WORKSAC_PROG_CC_GNUif test "$ac_cv_prog_gcc" = yes; then GCC=yeselse GCC=fi])dnldnldnl PAC_C_GNU_ATTRIBUTE - See if the GCC __attribute__ specifier is allow.dnl Use the followingdnl #ifndef HAVE_GCC_ATTRIBUTEdnl #define __attribute__(a)dnl #endifdnl If *not*, define __attribute__(a) as nulldnldnl We start by requiring Gcc. Some other compilers accept __attribute__dnl but generate warning messages, or have different interpretations dnl (which seems to make __attribute__ just as bad as #pragma) dnl For example, the Intel icc compiler accepts __attribute__ anddnl __attribute__((pure)) but generates warnings for __attribute__((format...))dnlAC_DEFUN([PAC_C_GNU_ATTRIBUTE],[AC_REQUIRE([AC_PROG_CC])if test "$ac_cv_prog_gcc" = "yes" ; then AC_CACHE_CHECK([whether __attribute__ allowed],pac_cv_gnu_attr_pure,[AC_TRY_COMPILE([int foo(int) __attribute__ ((pure));],[int a;],pac_cv_gnu_attr_pure=yes,pac_cv_gnu_attr_pure=no)])AC_CACHE_CHECK([whether __attribute__((format)) allowed],pac_cv_gnu_attr_format,[AC_TRY_COMPILE([int foo(char *,...) __attribute__ ((format(printf,1,2)));],[int a;],pac_cv_gnu_attr_format=yes,pac_cv_gnu_attr_format=no)]) if test "$pac_cv_gnu_attr_pure" = "yes" -a "$pac_cv_gnu_attr_format" = "yes" ; then AC_DEFINE(HAVE_GCC_ATTRIBUTE,1,[Define if GNU __attribute__ is supported]) fifi])dnl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -