1 dnl -*- shell-script -*-
3 dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
4 dnl University Research and Technology
5 dnl Corporation. All rights reserved.
6 dnl Copyright (c) 2004-2005 The University of Tennessee and The University
7 dnl of Tennessee Research Foundation. All rights
9 dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10 dnl University of Stuttgart. All rights reserved.
11 dnl Copyright (c) 2004-2005 The Regents of the University of California.
12 dnl All rights reserved.
15 dnl Additional copyrights may follow
20 # OMPI_F77_GET_SIZEOF(type, variable to set)
21 # ------------------------------------------
22 AC_DEFUN([OMPI_F77_GET_SIZEOF],[
23 AS_VAR_PUSHDEF([type_var], [ompi_cv_f77_sizeof_$1])
25 AC_CACHE_CHECK([size of Fortran 77 $1], type_var,
26 [OMPI_F77_MAKE_C_FUNCTION([ompi_ac_size_fn], [size])
28 cat > conftestf.f <<EOF
37 if test -f conftest.h; then
38 ompi_conftest_h="#include \"conftest.h\""
42 cat > conftest.c <<EOF
50 void $ompi_ac_size_fn(char *a, char *b)
52 int diff = (int) (b - a);
53 FILE *f=fopen("conftestval", "w");
55 fprintf(f, "%d\n", diff);
63 OMPI_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
64 [OMPI_LOG_COMMAND([$F77 $FFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
65 [happy="yes"], [happy="no"])], [happy="no"])
67 if test "$happy" = "no" ; then
68 AC_MSG_ERROR([Could not determine size of $1])
71 AS_IF([test "$cross_compiling" = "yes"],
72 [AC_MSG_ERROR([Can not determine size of $1 when cross-compiling])],
73 [OMPI_LOG_COMMAND([./conftest],
74 [AS_IF([test -f conftestval],
75 [AS_VAR_SET(type_var, [`cat conftestval`])],
76 [OMPI_LOG_MSG([conftestval not found.], 1)
77 AC_MSG_ERROR([Could not determine size of $1])])],
78 [AC_MSG_ERROR([Could not determine size of $1])])])
80 unset happy ompi_conftest_h
83 $2=AS_VAR_GET(type_var)
84 AS_VAR_POPDEF([type_var])dnl