1
1

These files help in determining MPI_Fint (in terms of relevant C types).

configure.ac #define's MPI_Fint to be of int32_t, int64_t or int depending
on the configuration details

This commit was SVN r454.
Этот коммит содержится в:
Prabhanjan Kambadur 2004-01-16 22:16:25 +00:00
родитель 006b56cbb6
Коммит 0c221c80fd
4 изменённых файлов: 176 добавлений и 9 удалений

Просмотреть файл

@ -22,6 +22,7 @@ sinclude(config/lam_config_subdir.m4)
sinclude(config/lam_config_subdir_args.m4)
sinclude(config/lam_configure_options.m4)
sinclude(config/lam_functions.m4)
sinclude(config/lam_get_sizeof_fortran_type.m4)
sinclude(config/lam_get_version.m4)
sinclude(config/lam_get_libtool_linker_flags.m4)
sinclude(config/lam_mca.m4)

Просмотреть файл

@ -20,12 +20,13 @@ EXTRA_DIST = \
lam_config_pthreads.m4 \
lam_config_solaris_threads.m4 \
lam_config_threads.m4 \
lam_configure_options.m4 \
lam_functions.m4 \
lam_get_version.m4 \
lam_get_version.sh \
lam_mca.m4 \
lam_setup_cc.m4 \
lam_setup_cxx.m4 \
lam_setup_f77.m4 \
lam_setup_f90.m4
lam_configure_options.m4 \
lam_functions.m4 \
lam_get_sizeof_fortran_type.m4 \
lam_get_version.m4 \
lam_get_version.sh \
lam_mca.m4 \
lam_setup_cc.m4 \
lam_setup_cxx.m4 \
lam_setup_f77.m4 \
lam_setup_f90.m4

118
config/lam_get_sizeof_fortran_type.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,118 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2001-2002 The Trustees of Indiana University.
dnl All rights reserved.
dnl Copyright (c) 1998-2001 University of Notre Dame.
dnl All rights reserved.
dnl Copyright (c) 1994-1998 The Ohio State University.
dnl All rights reserved.
dnl
dnl This file is part of the LAM/MPI software package. For license
dnl information, see the LICENSE file in the top level directory of the
dnl LAM/MPI source distribution.
dnl
dnl $Id: lam_get_sizeof_fortran_type.m4,v 1.1 2004/01/16 22:16:25 pkambadu Exp $
dnl
define(LAM_GET_SIZEOF_FORTRAN_TYPE,[
# Determine FORTRAN datatype size.
# First arg is type, 2nd (optional) arg is config var to define.
AC_MSG_CHECKING([size of FORTRAN $1])
lam_ac_size_fn=
if test "x$lam_ac_doubleunder" = xy || test "x$lam_ac_singleunder" = xy; then
lam_ac_size_fn=size_
else
if test "x$lam_ac_nounder" = xy; then
lam_ac_size_fn=size
else
if test "x$lam_ac_caps" = xy; then
lam_ac_size_fn=SIZE
else
AC_MSG_WARN([*** FORTRAN external naming convention undefined])
AC_MSG_ERROR([*** Cannot continue.])
fi
fi
fi
#
# Cannot use standard AC_TRY macros because we need two different .o
# files here, and link them together
#
#
# Fortran module
#
cat > conftestf.f <<EOF
program fsize
external SIZE
$1 x(2)
call SIZE(x(1),x(2))
end
EOF
#
# C module
#
if test -f conftest.h; then
lam_conftest_h="#include \"conftest.h\""
else
lam_conftest_h=""
fi
cat > conftest.c <<EOF
#include <stdio.h>
#include <stdlib.h>
$lam_conftest_h
#ifdef __cplusplus
extern "C" {
#endif
void $lam_ac_size_fn(char *a, char *b)
{
int diff = (int) (b - a);
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", diff);
}
#ifdef __cplusplus
}
#endif
EOF
#
# Try the compilation and run. Can't use AC_TRY_RUN because it's two
# module files.
#
LAM_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
LAM_LOG_COMMAND([$F77 $FFLAGS conftestf.f conftest.o -o conftest],
LAM_LOG_COMMAND([./conftest],[HAPPY=1],[HAPPY=0]),
[HAPPY=0]),
[HAPPY=0])
if test "$HAPPY" = "1" -a -f conftestval; then
lam_ac_fortsize=`cat conftestval`
AC_MSG_RESULT([$lam_ac_fortsize])
if test -n "$2"; then
eval "$2=$lam_ac_fortsize"
fi
else
AC_MSG_RESULT([unknown])
LAM_LOG_MSG([here is the C program:], 1)
LAM_LOG_FILE([conftest.c])
if test -f conftest.h; then
LAM_LOG_MSG([here is contest.h:], 1)
LAM_LOG_FILE([conftest.h])
fi
LAM_LOG_MSG([here is the fortran program:], 1)
LAM_LOG_FILE([conftestf.f])
AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])
fi
unset lam_ac_fortsize HAPPY lam_conftest_h
/bin/rm -f conftest*])dnl

Просмотреть файл

@ -224,6 +224,14 @@ if test -n "$F77"; then
LAM_F77_FIND_EXT_SYMBOL_CONVENTION($F77)
fi
# checking the sizeof fortran interger. This is needed to define
# MPI_Fint. This is needed for C bindings and hence there is no
# bearing of --enable-fortran flag on this test.
#
LAM_SIZEOF_FORTRAN_INT=0
LAM_GET_SIZEOF_FORTRAN_TYPE(INTEGER, LAM_SIZEOF_FORTRAN_INT)
#AC_DEFINE_UNQUOTED(LAM_SIZEOF_FORTRAN_INT, $LAM_SIZEOF_FORTRAN_INT,
# [Size of fortran INTEGER])
LAM_SETUP_F90
@ -279,6 +287,45 @@ AC_DEFINE_UNQUOTED(LAM_HAVE_UNDERSCORE_VA_COPY, $LAM_HAVE_UNDERSCORE_VA_COPY,
##################################
lam_show_title "System-specific tests"
#
# Determine what MPI_Fint shout be defined as. If the size of
# fortran integer is 4 then it is defined to either
# int32_t or int. Similarly if the size of fortran integer
# is 8 bytes then it is defined to either int64_t or int.
# ac_cv_type_int32_t=yes implies that unint_32 was present.
# similary ac_cv_type_int64_t=yes. Similarly the values
# of ac_cv_sizeof_int will contain the size of int and later
# this will be #defined to SIZEOF_INT.
#
MPI_FINT_TYPE=
if test "$LAM_SIZEOF_FORTRAN_INT" = 4 ; then
if test "$ac_cv_type_int32_t" == "yes"; then
AC_MSG_CHECKING([Yahoo .... I think we have a winner int32_t])
MPI_FINT_TYPE=int32_t
else
if test "$ac_cv_sizeof_int" = 4 ; then
AC_MSG_CHECKING([Yahoo .... I think we have a winner int])
MPI_FINT_TYPE=int
fi
fi
fi
if test "$LAM_SIZEOF_FORTRAN_INT" = 8 ; then
if test "$ac_cv_type_int64_t" == "yes"; then
AC_MSG_CHECKING([Yahoo .... I think we have a winner int64_t])
MPI_FINT_TYPE=int64_t
else
if test "$ac_cv_sizeof_int" = 8 ; then
AC_MSG_CHECKING([Yahoo .... I think we have a winner int])
MPI_FINT_TYPE=int
fi
fi
fi
if test -z "$MPI_FINT_TYPE"; then
AC_MSG_WARN([*** WARNING: Unable to find the right definition for MPI_Fint])
AC_MSG_ERROR([Cannot continue])
fi
AC_DEFINE_UNQUOTED(MPI_Fint, $MPI_FINT_TYPE,[MPI_Fint is int32_t])
# all: endian
# all: SYSV semaphores