1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University.
dnl All rights reserved.
dnl Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
dnl All rights reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_FORTRAN_GET_VALUE_TRUE()
# -------------------------------------------------------
# Determine the value of .TRUE. of this Fortran compiler.
AC_DEFUN([OMPI_FORTRAN_GET_VALUE_TRUE],[
# invalidate cache if result came from a run where FORTRAN was disabled
if test "$ompi_cv_fortran_true_value" = "0" ; then
unset ompi_cv_fortran_true_value
fi
AS_VAR_PUSHDEF([fortran_true_var],
[ompi_cv_fortran_true_value])
AC_CACHE_CHECK([Fortran value for .TRUE. logical type],
fortran_true_var,
[if test "$1" = "none" || \
test $OMPI_TRY_FORTRAN_BINDINGS -eq $OMPI_FORTRAN_NO_BINDINGS || \
test $ompi_fortran_happy -eq 0 ; then
value=77
else
#
# C module
# We really need the confdefs.h Header file for
# the ompi_fortran_logical_t definition
#
if test \! -f confdefs.h ; then
AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** Cannot find confdefs.h file for config test])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])
fi
cat > conftest.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#include "confdefs.h"
#ifdef __cplusplus
extern "C" {
#endif
void ompi_print_f(ompi_fortran_logical_t * logical)
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
if( SIZEOF_INT >= sizeof(ompi_fortran_logical_t) ) {
fprintf(f, "%d\n", (int)*logical);
} else if (SIZEOF_LONG >= sizeof(ompi_fortran_logical_t) ) {
fprintf(f, "%ld\n", (long) *logical);
} else if (SIZEOF_LONG_LONG >= sizeof(ompi_fortran_logical_t) ) {
fprintf(f, "%lld\n", (long long) *logical);
} else {
exit(1);
}
}
void ompi_print(ompi_fortran_logical_t *logical)
{ ompi_print_f(logical); }
void ompi_print_(ompi_fortran_logical_t *logical)
{ ompi_print_f(logical); }
void ompi_print__(ompi_fortran_logical_t *logical)
{ ompi_print_f(logical); }
void OMPI_PRINT(ompi_fortran_logical_t *logical)
{ ompi_print_f(logical); }
#ifdef __cplusplus
}
#endif
EOF
cat > conftestf.f <<EOF
program main
logical value
value=.TRUE.
CALL ompi_print(value)
end
EOF
#
# Try the compilation and run.
#
OPAL_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
[OPAL_LOG_COMMAND([$FC $FCFLAGS -o conftest conftest.o conftestf.f $LDFLAGS $LIBS],
[happy=1], [happy=0])],
[happy=0])
AS_IF([test $happy -eq 0 && test $ompi_fortran_happy -eq 1],
[AC_MSG_ERROR([Could not compile Fortran .TRUE. test. Aborting.])
])
AS_IF([test "$cross_compiling" = "yes"],
[AC_MSG_ERROR([Can not determine value of .TRUE. when cross-compiling])],
[OPAL_LOG_COMMAND([./conftest],
[value=`sed 's/ *//' conftestval`],
[AC_MSG_ERROR([Could not determine value of Fotran .TRUE.. Aborting.])])])
fi
AS_VAR_SET(fortran_true_var, [$value])
unset value
])
AS_VAR_COPY([ompi_fortran_true_value], [fortran_true_var])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_VALUE_TRUE],
[$ompi_fortran_true_value],
[Fortran value for LOGICAL .TRUE. value])
AS_VAR_POPDEF([fortran_true_var])
unset happy ompi_print_logical_fn
rm -rf conftest*
])dnl
|