2 dnl This files contains additional macros for using autoconf to
3 dnl build configure scripts.
5 dnl Almost all of this file is taken from the aclocal.m4 of MPICH
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.
11 define(PAC_GET_FORTNAMES,[
12 rm -f confftest.f confftest.o
13 cat > confftest.f <<EOF
14 subroutine mpir_init_fop( a )
20 $F77 $FFLAGS -c confftest.f > /dev/null 2>&1
21 if test ! -s confftest.o ; then
22 print_error "Unable to test Fortran compiler"
23 print_error "(compiling a test program failed to produce an "
24 print_error "object file)."
26 elif test -z "$FORTRANNAMES" ; then
27 if test $arch_CRAY ; then
28 # Cray doesn't accept -a ...
29 nameform1=`strings confftest.o | grep mpir_init_fop_ | head -1`
30 nameform2=`strings confftest.o | grep MPIR_INIT_FOP | head -1`
31 nameform3=`strings confftest.o | grep mpir_init_fop | head -1`
32 nameform4=`strings confftest.o | grep mpir_init_fop__ | head -1`
34 nameform1=`strings -a confftest.o | grep mpir_init_fop_ | head -1`
35 nameform2=`strings -a confftest.o | grep MPIR_INIT_FOP | head -1`
36 nameform3=`strings -a confftest.o | grep mpir_init_fop | head -1`
37 nameform4=`strings -a confftest.o | grep mpir_init_fop__ | head -1`
39 rm -f confftest.f confftest.o
40 if test -n "$nameform4" ; then
41 echo "Fortran externals are lower case and have two trailing underscores"
42 FORTRANNAMES="FORTRANDOUBLEUNDERSCORE"
43 elif test -n "$nameform1" ; then
44 # We don't set this in CFLAGS; it is a default case
45 echo "Fortran externals have a trailing underscore and are lowercase"
46 FORTRANNAMES="FORTRANUNDERSCORE"
47 elif test -n "$nameform2" ; then
48 echo "Fortran externals are uppercase"
49 FORTRANNAMES="FORTRANCAPS"
50 elif test -n "$nameform3" ; then
51 echo "Fortran externals are lower case"
52 FORTRANNAMES="FORTRANNOUNDERSCORE"
54 print_error "Unable to determine the form of Fortran external names"
55 print_error "Make sure that the compiler $F77 can be run on this system"
56 print_error "Turning off Fortran (-nof77 being assumed)."
60 if test -n "$FORTRANNAMES" ; then
61 WDEF="-D$FORTRANNAMES"
67 dnl PAC_GETWD(varname [, filename ] )
69 dnl This is from the aclocal.m4 of MPICH.
70 dnl Set varname to current directory. Use filename (relative to current
71 dnl directory) if provided to double check.
73 dnl Need a way to use "automounter fix" for this.
77 if test "${$1}" != "" -a -d "${$1}" ; then
78 if test -r ${$1}/.foo$$ ; then
79 /bin/rm -f ${$1}/.foo$$
82 if test -r ${$1}/.foo$$ -o -r .foo$$ ; then
85 echo "test" > ${$1}/.foo$$
86 if test ! -r .foo$$ ; then
87 /bin/rm -f ${$1}/.foo$$
90 /bin/rm -f ${$1}/.foo$$
94 if test "${$1}" = "" ; then
95 $1=`pwd | sed -e 's%/tmp_mnt/%/%g'`
98 dnl First, test the PWD is sensible
100 if test ! -r ${$1}/$2 ; then
101 dnl PWD must be messed up
103 if test ! -r ${$1}/$2 ; then
104 print_error "Cannot determine the root directory!"
107 $1=`pwd | sed -e 's%/tmp_mnt/%/%g'`
108 if test ! -d ${$1} ; then
109 print_error "Warning: your default path uses the automounter; this may"
110 print_error "cause some problems if you use other NFS-connected systems.
115 if test -z "${$1}" ; then
116 $1=`pwd | sed -e 's%/tmp_mnt/%/%g'`
117 if test ! -d ${$1} ; then
118 print_error "Warning: your default path uses the automounter; this may"
119 print_error "cause some problems if you use other NFS-connected systems.
127 dnl PAC_GET_TYPE_SIZE(typename,var_for_size)
129 dnl sets var_for_size to the size. Ignores if the size cannot be determined
130 dnl (see aclocal.m4 in MPICH)
132 define(PAC_GET_TYPE_SIZE,
134 Pac_varname=`echo "$Pac_name" | sed -e 's/ /_/g' -e 's/\*/star/g'`
135 eval Pac_testval=\$"${Pac_varname}_len"
136 if test -z "$Pac_testval" ; then
138 define(<<AC_TYPE_NAME>>,translit(CROSS_SIZEOF_$1,[a-z *],[A-Z_P]))dnl
140 eval Pac_testval=\$"AC_TYPE_NAME"
142 if test -n "$Pac_testval" ; then
143 Pac_CV_NAME=$Pac_testval
145 AC_MSG_CHECKING([for size of $1])
146 dnl Check for existing size or for CROSS_SIZEOF_name
147 /bin/rm -f conftestval
148 AC_TEST_PROGRAM([#include <stdio.h>
150 FILE *f=fopen("conftestval","w");
152 fprintf( f, "%d\n", sizeof($1));
154 }],Pac_CV_NAME=`cat conftestval`,Pac_CV_NAME="")
155 /bin/rm -f conftestval
156 if test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then
157 AC_MSG_RESULT($Pac_CV_NAME)
158 eval ${Pac_varname}_len=$Pac_CV_NAME
160 AC_MSG_RESULT(unavailable)
168 define(PAC_INT_LT_POINTER,[
169 if test -z "$intsize" ; then
170 PAC_GET_TYPE_SIZE(int,intsize)
172 if test -z "$pointersize" ; then
173 PAC_GET_TYPE_SIZE(void *,pointersize)
175 AC_MSG_CHECKING([for int large enough for pointers])
176 if test -n "$pointersize" -a -n "$intsize" ; then
177 if test $pointersize -le $intsize ; then
180 AC_DEFINE(INT_LT_POINTER,,[Define if int smaller than pointer])
184 AC_MSG_RESULT(cannot determine; assuming it is;)
185 echo "use '-intsize' and '-ptrsize' to indicate otherwise"
190 dnl Check whether to use -n, \c, or newline-tab to separate
191 dnl checking messages from result messages.
193 define(AC_PROG_ECHO_N,
195 [if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
196 if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
203 ac_n= ac_c='\c' ac_t=
205 ac_echo_test=`echo foo 1>&1`
206 if test -z "$ac_echo_test" ; then
207 print_error "Your sh shell does not handle the output redirection"
208 print_error "1>&1 correctly. Configure will work around this problem,"
209 print_error "but you should report the problem to your vendor."
212 dnl AC_MSG_CHECKING(FEATURE-DESCRIPTION)
213 define(AC_FD_MSG,1)dnl
214 define(AC_MSG_CHECKING,[dnl
215 if test -z "$ac_echo_n" ; then
218 if test -z "$ac_echo_test" -a AC_FD_MSG = 1 ; then
219 echo $ac_n "checking $1""... $ac_c"
221 echo $ac_n "checking $1""... $ac_c" 1>&AC_FD_MSG
225 dnl generates "msg..." (no newline)
227 if test -z "$ac_echo_n" ; then
230 if test -z "$ac_echo_test" -a AC_FD_MSG = 1 ; then
231 echo $ac_n "$1""... $ac_c"
233 echo $ac_n "$1""... $ac_c" 1>&AC_FD_MSG
236 dnl AC_CHECKING(FEATURE-DESCRIPTION)
237 define(AC_CHECKING,dnl
238 [echo "checking $1" 1>&AC_FD_MSG])dnl
240 dnl AC_MSG_RESULT(RESULT-DESCRIPTION)
241 define(AC_MSG_RESULT,dnl
242 if test -z "$ac_echo_test" -a AC_FD_MSG = 1 ; then
245 [echo "$ac_t""$1" 1>&AC_FD_MSG]
248 define(PAC_GET_SPECIAL_SYSTEM_INFO,[
250 if test -n "$arch_IRIX"; then
251 AC_MSG_CHECKING(for IRIX OS version)
252 dnl This block of code replaces a generic "IRIX" arch value with
253 dnl IRIX_<version>_<chip>
255 dnl IRIX_5_4400 (IRIX 5.x, using MIPS 4400)
256 osversion=`uname -r | sed 's/\..*//'`
257 dnl Note that we need to allow brackets here, so we briefly turn off
260 dnl Get the second field (looking for 6.1)
261 osvminor=`uname -r | sed 's/[0-9]\.\([0-9]*\)\..*/\1/'`
262 AC_MSG_RESULT($osversion)
263 dnl Get SGI processor count by quick hack
264 AC_MSG_CHECKING(for IRIX cpucount)
265 cpucount=`hinv | grep '[0-9]* [0-9]* MHZ IP[0-9]* Proc' | cut -f 1 -d' '`
266 if test "$cpucount" = "" ; then
267 cpucount=`hinv | grep 'Processor [0-9]*:' | wc -l | sed -e 's/ //g'`
270 if test "$cpucount" = "" ; then
271 print_error "Could not determine cpucount."
272 print_error "Please send "
274 print_error "to romio-maint@mcs.anl.gov"
277 AC_MSG_RESULT($cpucount)
279 AC_MSG_CHECKING(for IRIX cpumodel)
280 dnl The tail -1 is necessary for multiple processor SGI boxes
281 dnl We might use this to detect SGI multiprocessors and recommend
283 cputype=`hinv -t cpu | tail -1 | cut -f 3 -d' '`
284 if test -z "$cputype" ; then
285 print_error "Could not get cputype from hinv -t cpu command."
286 print_error "Please send "
288 hinv -t cpu | cut -f 3 -d' ' 2>&1
289 print_error "to romio-maint@mcs.anl.gov"
292 AC_MSG_RESULT($cputype)
293 dnl echo "checking for osversion and cputype"
294 dnl cputype may contain R4400, R2000A/R3000, or something else.
295 dnl We may eventually need to look at it.
296 if test -z "$osversion" ; then
297 print_error "Could not determine OS version. Please send"
300 print_error "to romio-maint@mcs.anl.gov"
302 elif test $osversion = 4 ; then
304 elif test $osversion = 5 ; then
306 elif test $osversion = 6 ; then
309 print_error "Could not recognize the version of IRIX (got $osversion)"
310 print_error "ROMIO knows about versions 4, 5 and 6; the version being"
311 print_error "returned from uname -r is $osversion."
312 print_error "Please send"
315 print_error "to romio-maint@mcs.anl.gov"
318 AC_MSG_CHECKING(for cputype)
320 IRIXARCH="$ARCH_$osversion"
321 dnl Now, handle the chip set
323 cputype=`echo $cputype | sed -e 's%.*/%%' -e 's/R//' | tr -d "[A-Z]"`
335 print_error "Unexpected IRIX/MIPS chipset $cputype. Please send the output"
340 print_error "to romio-maint@mcs.anl.gov"
341 print_error "ROMIO will continue and assume that the cputype is"
342 print_error "compatible with a MIPS 4400 processor."
347 AC_MSG_RESULT($cputype)
348 IRIXARCH="$IRIXARCH_$cputype"
349 echo "IRIX-specific architecture is $IRIXARCH"
354 dnl On an SGI check whether to link 32 bit objects or 64 bit objects
355 dnl for the MPI-2 datatype accessor functions
357 define(PAC_CHECK_SGI_3264,[
358 AC_MSG_CHECKING(for 32-bit or 64-bit objects)
366 $CC $CFLAGS -c bittest.c > /dev/null 2>&1
367 if test $MIPS = 4 ; then
368 testlink='$CC $CFLAGS -o bittest bittest.o adio/sgi/mpi2/mips4.64/get_contents.o $MPI_LIB >/dev/null 2>&1'
369 if eval $testlink ; then
372 testlink='$CC $CFLAGS -o bittest bittest.o adio/sgi/mpi2/mips4.32/get_contents.o $MPI_LIB >/dev/null 2>&1'
373 if eval $testlink ; then
376 echo "Error: Can't link with either 32-bit or 64-bit"
377 echo "Send email to romio-maint@mcs.anl.gov"
382 testlink='$CC $CFLAGS -o bittest bittest.o adio/sgi/mpi2/mips3.64/get_contents.o $MPI_LIB >/dev/null 2>&1'
383 if eval $testlink ; then
386 testlink='$CC $CFLAGS -o bittest bittest.o adio/sgi/mpi2/mips3.32/get_contents.o $MPI_LIB >/dev/null 2>&1'
387 if eval $testlink ; then
390 echo "Error: Can't link with either 32-bit or 64-bit"
391 echo "Send email to romio-maint@mcs.anl.gov"
397 AC_MSG_RESULT($BITS bit)
402 define(PAC_TEST_MPI,[
403 AC_MSG_CHECKING(if a simple MPI program compiles and links)
405 cat > mpitest.c <<EOF
407 int main(int argc, char **argv)
409 MPI_Init(&argc,&argv);
414 $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1
415 if test ! -x conftest ; then
417 print_error "Unable to compile a simple MPI program"
418 print_error "Use the -mpi, -mpiincdir, and -mpilib options to configure to specify the"
419 print_error "MPI implementation, the include path for mpi.h, and the MPI library to link"
420 rm -f conftest mpitest.c
423 rm -f conftest mpitest.c
430 define(PAC_NEEDS_FINT,[
431 AC_MSG_CHECKING(if MPI_Fint is defined in the MPI implementation)
432 cat > mpitest1.c <<EOF
441 $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -c mpitest1.c > /dev/null 2>&1
442 if test ! -s mpitest1.o ; then
443 NEEDS_MPI_FINT="#define NEEDS_MPI_FINT"
444 CFLAGS="$CFLAGS -DNEEDS_MPI_FINT"
446 rm -f mpitest1.o mpitest1.c
450 rm -f mpitest1.o mpitest1.c
457 if test -z "$longsize" ; then
458 PAC_GET_TYPE_SIZE(long,longsize)
460 if test -n "$longsize" ; then
461 if test $longsize = 8 ; then
462 AC_DEFINE(HAVE_LONG_64,,[Define if long is 64 bits])
465 echo "assuming size of long is NOT 8 bytes; use '-longsize' to indicate otherwise"
470 define(PAC_MPI_LONG_LONG_INT,[
471 AC_MSG_CHECKING(if MPI_LONG_LONG_INT is defined in mpi.h)
473 cat > mpitest.c <<EOF
475 main(int argc, char **argv)
478 MPI_Init(&argc,&argv);
479 MPI_Send(&i, 1, MPI_LONG_LONG_INT, 0, 0, MPI_COMM_WORLD);
484 $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1
485 if test -x conftest ; then
487 AC_DEFINE(HAVE_MPI_LONG_LONG_INT,,[Define if mpi has long long it])
491 rm -f conftest mpitest.c
494 dnl Check that the compile accepts ANSI prototypes.
495 dnl PAC_CHECK_CC_PROTOTYPES()
497 define(PAC_CHECK_CC_PROTOTYPES,[
498 AC_MSG_CHECKING(that the compiler $CC accepts ANSI prototypes)
499 AC_COMPILE_CHECK(,[int f(double a){return 0;}],,eval "ac_cv_ccworks=yes",eval "ac_cv_ccworks=no")
500 AC_MSG_RESULT($ac_cv_ccworks)
501 if test $ac_cv_ccworks = "yes" ; then
502 AC_DEFINE(HAVE_PROTOTYPES,,[Define if C compiler supports prototypes])
507 dnl PAC_TEST_LONG_LONG()
509 dnl tests if the compiler prints long long correctly and whether to use
510 dnl %ld or %lld. Called from within PAC_LONG_LONG_64.
512 define(PAC_TEST_LONG_LONG,
513 [AC_MSG_CHECKING([if the compiler prints long longs correctly with %lld])
515 AC_TEST_PROGRAM([#include <stdio.h>
518 FILE *f=fopen("conftestll","w");
520 fprintf( f, "%lld\n", i);
522 }],Pac_CV_NAME=`cat conftestll`,Pac_CV_NAME="")
524 if test "$Pac_CV_NAME" = 8 ; then
526 AC_DEFINE(HAVE_LONG_LONG_64,,[Define if have 64 bit long long])
527 DEFINE_MPI_OFFSET="typedef long long MPI_Offset;"
528 FORTRAN_MPI_OFFSET="integer*8"
529 echo "defining MPI_Offset as long long in C and integer*8 in Fortran"
533 AC_MSG_CHECKING([if the compiler prints long longs correctly with %ld])
534 AC_TEST_PROGRAM([#include <stdio.h>
537 FILE *f=fopen("conftestll","w");
539 fprintf( f, "%ld\n", i);
541 }],Pac_CV_NAME=`cat conftestll`,Pac_CV_NAME="")
543 if test "$Pac_CV_NAME" = 8 ; then
545 AC_DEFINE(HAVE_LONG_LONG_64,,[Define if long long is 64 bits])
546 DEFINE_MPI_OFFSET="typedef long long MPI_Offset;"
547 FORTRAN_MPI_OFFSET="integer*8"
548 echo "defining MPI_Offset as long long in C and integer*8 in Fortran"
552 echo "the compiler doesn't print long longs correctly!"
553 echo "defining MPI_Offset as long in C and integer in Fortran"
554 DEFINE_MPI_OFFSET="typedef long MPI_Offset;"
555 FORTRAN_MPI_OFFSET="integer"
564 dnl PAC_LONG_LONG_64: check if there is a 64-bit long long
566 define(PAC_LONG_LONG_64,[
567 if test -n "$longlongsize" ; then
568 if test "$longlongsize" = 8 ; then
569 echo "defining MPI_Offset as long long in C and integer*8 in Fortran"
570 AC_DEFINE(HAVE_LONG_LONG_64,,[Define if long long is 64 bits])
571 DEFINE_MPI_OFFSET="typedef long long MPI_Offset;"
572 FORTRAN_MPI_OFFSET="integer*8"
574 elif test "$longlongsize" = "int" ; then # a hack to set MPI_Offset as int
575 echo "defining MPI_Offset as int in C and integer in Fortran"
576 DEFINE_MPI_OFFSET="typedef int MPI_Offset;"
577 FORTRAN_MPI_OFFSET="integer"
578 AC_DEFINE(MPI_OFFSET_IS_INT,,[Define if MPI_Offset is int])
583 echo "defining MPI_Offset as long in C and integer in Fortran"
584 DEFINE_MPI_OFFSET="typedef long MPI_Offset;"
585 FORTRAN_MPI_OFFSET="integer"
591 PAC_GET_TYPE_SIZE(long long, longlongsize)
592 if test -n "$longlongsize" ; then
593 if test "$longlongsize" = 8 ; then
596 echo "defining MPI_Offset as long in C and integer in Fortran"
597 DEFINE_MPI_OFFSET="typedef long MPI_Offset;"
598 FORTRAN_MPI_OFFSET="integer"
604 dnl check if longlong is not supported or only its size cannot be determined
605 dnl because the program cannot be run.
615 $CC $USER_CFLAGS -o conftest ltest.c > /dev/null 2>&1
616 if test -x conftest ; then
617 echo "assuming size of long long is 8bytes; use '-longlongsize' to indicate otherwise"
618 rm -f conftest ltest.c
619 echo "defining MPI_Offset as long long in C and integer*8 in Fortran"
620 AC_DEFINE(HAVE_LONG_LONG_64,,[Define if long long is 64 bits])
621 DEFINE_MPI_OFFSET="typedef long long MPI_Offset;"
622 FORTRAN_MPI_OFFSET="integer*8"
625 echo "assuming long long is not available; use '-longlongsize' to indicate otherwise"
626 echo "defining MPI_Offset as long in C and integer in Fortran"
627 DEFINE_MPI_OFFSET="typedef long MPI_Offset;"
628 FORTRAN_MPI_OFFSET="integer"
638 define(PAC_MPI_INFO,[
639 AC_MSG_CHECKING(if MPI_Info functions are defined in the MPI implementation)
641 cat > mpitest.c <<EOF
643 main(int argc, char **argv)
646 MPI_Init(&argc,&argv);
647 MPI_Info_create(&info);
652 $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1
653 if test -x conftest ; then
655 AC_DEFINE(HAVE_MPI_INFO,,[Define if MPI_Info available])
656 HAVE_MPI_INFO="#define HAVE_MPI_INFO"
664 MPI_FINFO1=" INTEGER MPI_MAX_INFO_KEY, MPI_MAX_INFO_VAL"
665 MPI_FINFO2=" PARAMETER (MPI_MAX_INFO_KEY=255, MPI_MAX_INFO_VAL=1024)"
666 MPI_FINFO3=" INTEGER MPI_INFO_NULL"
667 MPI_FINFO4=" PARAMETER (MPI_INFO_NULL=0)"
669 rm -f conftest mpitest.c
673 define(PAC_MPI_DARRAY_SUBARRAY,[
674 AC_MSG_CHECKING(if darray and subarray constructors are defined in the MPI implementation)
676 cat > mpitest.c <<EOF
678 main(int argc, char **argv)
680 int i=MPI_DISTRIBUTE_CYCLIC;
682 MPI_Init(&argc,&argv);
683 MPI_Type_create_darray(i, i, i, &i, &i, &i, &i, i, MPI_INT, &t);
684 MPI_Type_create_subarray(i, &i, &i, &i, i, MPI_INT, &t);
689 $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1
690 if test -x conftest ; then
692 AC_DEFINE(HAVE_MPI_DARRAY_SUBARRAY,,[Define if MPI Darray available])
693 HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY"
704 MPI_FARRAY1=" INTEGER MPI_ORDER_C, MPI_ORDER_FORTRAN"
705 MPI_FARRAY2=" PARAMETER (MPI_ORDER_C=56, MPI_ORDER_FORTRAN=57)"
706 MPI_FARRAY3=" INTEGER MPI_DISTRIBUTE_BLOCK, MPI_DISTRIBUTE_CYCLIC"
707 MPI_FARRAY4=" INTEGER MPI_DISTRIBUTE_NONE, MPI_DISTRIBUTE_DFLT_DARG"
708 MPI_FARRAY5=" PARAMETER (MPI_DISTRIBUTE_BLOCK=121, MPI_DISTRIBUTE_CYCLIC=122)"
709 MPI_FARRAY6=" PARAMETER (MPI_DISTRIBUTE_NONE=123)"
710 MPI_FARRAY7=" PARAMETER (MPI_DISTRIBUTE_DFLT_DARG=-49767)"
712 rm -f conftest mpitest.c
716 define(PAC_CHECK_MPI_SGI_INFO_NULL,[
717 AC_MSG_CHECKING(if MPI_INFO_NULL is defined in mpi.h)
719 cat > mpitest.c <<EOF
721 main(int argc, char **argv)
728 $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1
729 if test -x conftest ; then
731 cp adio/sgi/mpi3.1/*.h include
735 rm -f conftest mpitest.c
740 define(PAC_CHECK_MPIOF_H,[
741 AC_MSG_CHECKING(if mpiof.h is included in mpif.h)
743 cat > mpitest.f <<EOF
753 $F77 $FFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.f $MPI_LIB > /dev/null 2>&1
754 if test -x conftest ; then
760 rm -f conftest mpitest.f
764 dnl check if pread64 is defined in IRIX. needed on IRIX 6.5
766 define(PAC_HAVE_PREAD64,[
767 AC_MSG_CHECKING(if pread64 is defined)
769 cat > conftest.c <<EOF
773 int fd=0, buf=0, i=0;
775 pread64(fd, &buf, i, off);
779 $CC $USER_CFLAGS -o conftest conftest.c > /dev/null 2>&1
780 if test -x conftest ; then
782 AC_DEFINE(HAVE_PREAD64,,[Define if pread64 available])
786 rm -f conftest conftest.c
790 define(PAC_TEST_MPI_SGI_type_is_contig,[
791 AC_MSG_CHECKING(if MPI_SGI_type_is_contig is defined)
793 cat > mpitest.c <<EOF
795 main(int argc, char **argv)
800 MPI_Init(&argc,&argv);
801 i = MPI_SGI_type_is_contig(type);
806 $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1
807 if test -x conftest ; then
811 AC_DEFINE(NO_MPI_SGI_type_is_contig,,[Define if no MPI type is contig])
813 rm -f conftest mpitest.c
818 define(PAC_TEST_MPI_COMBINERS,[
819 AC_MSG_CHECKING(if MPI-2 combiners are defined in mpi.h)
821 cat > mpitest.c <<EOF
823 main(int argc, char **argv)
827 MPI_Init(&argc,&argv);
828 i = MPI_COMBINER_STRUCT;
833 $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1
834 if test -x conftest ; then
836 AC_DEFINE(HAVE_MPI_COMBINERS,,[Define if MPI combiners available])
840 rm -f conftest mpitest.c
844 dnl PAC_MPI_OFFSET_KIND()
846 dnl tries to determine the Fortran 90 kind parameter for 8-byte integers
848 define(PAC_MPI_OFFSET_KIND,
849 [AC_MSG_CHECKING([for Fortran 90 KIND parameter for 8-byte integers])
850 rm -f kind.f kind.o kind
854 i = selected_int_kind(16)
855 open(8, file="k.out", form="formatted")
861 if test -z "$F90" ; then
865 if $F90 -o kind kind.f >/dev/null 2>&1 ; then
866 ./kind >/dev/null 2>&1
867 if test -s k.out ; then
871 rm -f kind k.out kind.f kind.o k.out
872 if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then
873 AC_MSG_RESULT($KINDVAL)
874 MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND"
875 MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$KINDVAL)"
877 AC_MSG_RESULT(unavailable)
882 define(PAC_TEST_MPI_HAVE_OFFSET_KIND,[
883 AC_MSG_CHECKING(if MPI_OFFSET_KIND is defined in mpif.h)
885 cat > mpitest.f <<EOF
895 $F77 $FFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.f $MPI_LIB > /dev/null 2>&1
896 if test -x conftest ; then
903 rm -f conftest mpitest.f
907 dnl PAC_GET_XFS_MEMALIGN
910 define(PAC_GET_XFS_MEMALIGN,
911 [AC_MSG_CHECKING([for memory alignment needed for direct I/O])
912 /bin/rm -f memalignval
913 /bin/rm -f /tmp/romio_tmp.bin
914 AC_TEST_PROGRAM([#include <stdio.h>
920 int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644);
921 FILE *f=fopen("memalignval","w");
922 if (fd == -1) exit(1);
924 fcntl(fd, F_DIOINFO, &st);
925 fprintf( f, "%u\n", st.d_mem);
927 }],Pac_CV_NAME=`cat memalignval`,Pac_CV_NAME="")
928 /bin/rm -f memalignval
929 /bin/rm -f /tmp/romio_tmp.bin
930 if test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then
931 AC_MSG_RESULT($Pac_CV_NAME)
932 CFLAGS="$CFLAGS -DXFS_MEMALIGN=$Pac_CV_NAME"
934 AC_MSG_RESULT(unavailable, assuming 128)
935 CFLAGS="$CFLAGS -DXFS_MEMALIGN=128"
940 dnl Look for a style of VPATH. Known forms are
944 dnl Defines VPATH or .PATH with . $(srcdir)
945 dnl Requires that vpath work with implicit targets
946 dnl NEED TO DO: Check that $< works on explicit targets.
948 define(PAC_MAKE_VPATH,[
950 AC_MSG_CHECKING(for virtual path format)
953 cat >conftestdir/a.c <<EOF
962 ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'`
963 if test -n "$ac_out" ; then
965 VPATH='VPATH=.:$(srcdir)'
974 ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'`
975 if test -n "$ac_out" ; then
977 VPATH='.PATH: . $(srcdir)'
979 AC_MSG_RESULT(neither VPATH nor .PATH works)
986 dnl There is a bug in AC_PREPARE that sets the srcdir incorrectly (it
987 dnl is correct in configure, but it puts an absolute path into config.status,
988 dnl which is a big problem for scripts like mpireconfig that are wrappers
989 dnl around config.status). The bug is in not recognizing that ./ and .//
990 dnl are the same directory as . (in fact, ./[/]* is the same).
992 define(PAC_FIXUP_SRCDIR,[
993 # Find the source files, if location was not specified.
994 if test "$srcdirdefaulted" = "yes" ; then
996 # Try the directory containing this script, then `..'.
999 confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
1000 # Remove all trailing /'s
1001 confdir=`echo $confdir|sed 's%[/*]$%%'`
1003 test "X$confdir" = "X$prog" && confdir=.
1005 if test ! -r $srcdir/$unique_file; then
1009 if test ! -r $srcdir/$unique_file; then
1010 if test x$srcdirdefaulted = xyes; then
1011 echo "configure: Cannot find sources in \`${confdir}' or \`..'." 1>&2
1013 echo "configure: Cannot find sources in \`${srcdir}'." 1>&2
1017 # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
1018 # (and preserve ./ and .//)
1019 # But we can't avoid them for `..', to make subdirectories work.
1022 *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
1027 dnl AC_TRY_LINK(INCLUDES, FUNCTION-BODY,
1028 dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
1030 if test -z "$ac_ext" ; then
1033 [cat > conftest.$ac_ext <<EOF
1034 dnl This sometimes fails to find confdefs.h, for some reason.
1035 dnl [#]line __oline__ "[$]0"
1036 dnl [#]line __oline__ "configure"
1037 #include "confdefs.h"
1039 int main() { return 0; }
1045 if test -z "$ac_link" ; then
1046 ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >conftest.out 2>&1'
1048 if eval $ac_link; then
1049 ifelse([$3], , :, [rm -rf conftest*
1052 if test -s conftest.out ; then cat conftest.out >> config.log ; fi
1053 ifelse([$4], , , [rm -rf conftest*
1061 define(PAC_HAVE_MOUNT_NFS,[
1062 AC_MSG_CHECKING([if MOUNT_NFS is defined in the include files])
1064 cat > conftest.c <<EOF
1065 #include <sys/param.h>
1066 #include <sys/mount.h>
1073 $CC $USER_CFLAGS -o conftest conftest.c > /dev/null 2>&1
1074 if test -x conftest ; then
1076 AC_DEFINE(HAVE_MOUNT_NFS,,[Define if MOUNT_NFS defined])
1080 rm -f conftest conftest.c
1084 dnl PAC_MPI_OFFSET_KIND_4BYTE()
1086 dnl tries to determine the Fortran 90 kind parameter for 4-byte integers
1088 define(PAC_MPI_OFFSET_KIND_4BYTE,
1089 [AC_MSG_CHECKING([for Fortran 90 KIND parameter for 4-byte integers])
1090 rm -f kind.f kind.o kind
1094 i = selected_int_kind(8)
1095 open(8, file="k.out", form="formatted")
1101 if test -z "$F90" ; then
1105 if $F90 -o kind kind.f >/dev/null 2>&1 ; then
1106 ./kind >/dev/null 2>&1
1107 if test -s k.out ; then
1111 rm -f kind k.out kind.f kind.o
1112 if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then
1113 AC_MSG_RESULT($KINDVAL)
1114 MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND"
1115 MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$KINDVAL)"
1117 AC_MSG_RESULT(unavailable)
1122 define(PAC_FUNC_STRERROR,[
1123 AC_MSG_CHECKING([for strerror()])
1125 cat > conftest.c <<EOF
1129 char *s = strerror(5);
1133 $CC $USER_CFLAGS -o conftest conftest.c >> config.log 2>&1
1134 if test -x conftest ; then
1136 AC_DEFINE(HAVE_STRERROR,,[Define if strerror available])
1139 AC_MSG_CHECKING([for sys_errlist])
1142 cat > conftest.c <<EOF
1146 extern char *sys_errlist[];
1147 printf("%s\n", sys_errlist[34]);
1152 $CC $USER_CFLAGS -o conftest conftest.c > config.log 2>&1
1153 if test -x conftest ; then
1155 AC_DEFINE(HAVE_SYSERRLIST,,[Define if syserrlist available])
1160 rm -f conftest conftest.c
1165 define(PAC_C_INLINE,[
1166 AC_MSG_CHECKING([for inline])
1167 if eval "test \"`echo '$''{'pac_cv_c_inline'+set}'`\" = set"; then
1168 AC_MSG_RESULT([(cached)])
1170 AC_COMPILE_CHECK(,[inline int a( int b ){return b+1;}],[int a;],
1171 pac_cv_c_inline="yes",pac_cv_c_inline="no")
1173 AC_MSG_RESULT($pac_cv_c_inline)
1174 if test "$pac_cv_c_inline" = "no" ; then
1175 AC_DEFINE(inline,,[Define if inline is not supported])
1178 define(AC_MSG_WARN,[AC_MSG_RESULT([Warning: $1])])
1180 dnl PAC_CHECK_HEADER(HEADER-FILE, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND],
1181 dnl PRE-REQ-HEADERS )
1183 dnl BUG: AIX 4.1 can't handle a \055 (octal for -) in a tr string (sometimes;
1184 dnl it works from the shell but not within a file)
1185 dnl I've removed that and hoped that no header will include a - in the
1188 dnl This can fail if the header needs OTHER headers for the compile
1189 dnl to succeed. Those headers should be specified in the "pre-req-headers"
1191 dnl PAC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H),,
1192 dnl [#include <sys/types.h>])
1194 define(PAC_CHECK_HEADER,dnl
1195 [dnl Do the transliteration at runtime so arg 1 can be a shell variable.
1197 ac_safe=`echo "$1" | tr '[a-z]./' '[A-Z]__'`
1199 AC_MSG_CHECKING([for $1])
1200 dnl AC_CACHE_VAL(ac_cv_header_$ac_safe,[dnl
1201 AC_COMPILE_CHECK(,[$4]
1202 [#include <$1>],main();,eval "ac_cv_header_$ac_safe=yes",
1203 eval "ac_cv_header_$ac_safe=no")dnl])dnl
1204 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1206 ifelse([$2], , :, [$2])
1209 ifelse([$3], , , [$3
1214 dnl PAC_CHECK_HEADERS(HEADER-FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1215 define(PAC_CHECK_HEADERS,[for ac_hdr in $1
1217 PAC_CHECK_HEADER($ac_hdr,
1219 ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
1220 changequote([, ])dnl
1221 AC_DEFINE($ac_tr_hdr) $2], $3)dnl
1225 define(PAC_TEST_MPIR_STATUS_SET_BYTES,[
1226 AC_MSG_CHECKING(if MPIR_Status_set_bytes is defined)
1228 cat > mpitest.c <<EOF
1230 main(int argc, char **argv)
1236 MPI_Init(&argc,&argv);
1237 MPIR_Status_set_bytes(status,type,err);
1242 $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1
1243 if test -x conftest ; then
1245 AC_DEFINE(HAVE_STATUS_SET_BYTES,,[Define if status set bytes available])
1249 rm -f conftest mpitest.c