@@ -11,6 +11,8 @@ dnl All rights reserved.
1111dnl Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
1212dnl Copyright (c) 2015 Research Organization for Information Science
1313dnl and Technology (RIST). All rights reserved.
14+ dnl Copyright (c) 2025 Triad National Security, LLC. All rights
15+ dnl reserved.
1416dnl $COPYRIGHT $
1517dnl
1618dnl Additional copyrights may follow
@@ -27,9 +29,14 @@ AC_DEFUN([OMPI_FORTRAN_GET_VALUE_TRUE],[
2729 if test " $ompi_cv_fortran_true_value " = " 0" ; then
2830 unset ompi_cv_fortran_true_value
2931 fi
32+ if test " $ompi_cv_fortran_false_value " = " 0" ; then
33+ unset ompi_cv_fortran_false_value
34+ fi
3035
3136 AS_VAR_PUSHDEF([fortran_true_var],
3237 [ompi_cv_fortran_true_value])
38+ AS_VAR_PUSHDEF([fortran_false_var],
39+ [ompi_cv_fortran_false_value])
3340
3441 AC_CACHE_CHECK([Fortran value for .TRUE. logical type],
3542 fortran_true_var,
98105 CALL ompi_print(value)
99106 end
100107EOF
108+ cat > conftestf2.f << EOF
109+ program main
110+ logical value
111+ value=.FALSE.
112+ CALL ompi_print(value)
113+ end
114+ EOF
115+
101116
102117 #
103118 # Try the compilation and run.
@@ -114,11 +129,40 @@ EOF
114129 AS_IF([test " $cross_compiling " = " yes" ],
115130 [AC_MSG_ERROR([Can not determine value of .TRUE. when cross-compiling])],
116131 [OPAL_LOG_COMMAND([./conftest],
117- [value = ` sed ' s/ *//' conftestval` ],
132+ [tvalue = ` sed ' s/ *//' conftestval` ],
118133 [AC_MSG_ERROR([Could not determine value of Fotran .TRUE.. Aborting.])])])
134+
135+ cat > conftestf.f << EOF
136+ program main
137+ logical value
138+ value=.FALSE.
139+ CALL ompi_print(value)
140+ end
141+ EOF
142+
143+ #
144+ # Try the compilation and run.
145+ #
146+ OPAL_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
147+ [OPAL_LOG_COMMAND([$FC $FCFLAGS -o conftest conftest.o conftestf.f $LDFLAGS $LIBS ],
148+ [happy= 1], [happy= 0])],
149+ [happy= 0])
150+
151+ AS_IF([test $happy -eq 0 && test $ompi_fortran_happy -eq 1],
152+ [AC_MSG_ERROR([Could not compile Fortran .FALSE. test. Aborting.])
153+ ])
154+
155+ AS_IF([test " $cross_compiling " = " yes" ],
156+ [AC_MSG_ERROR([Can not determine value of .FALSE. when cross-compiling])],
157+ [OPAL_LOG_COMMAND([./conftest],
158+ [fvalue= ` sed ' s/ *//' conftestval` ],
159+ [AC_MSG_ERROR([Could not determine value of Fotran .FALSE.. Aborting.])])])
119160 fi
120- AS_VAR_SET(fortran_true_var, [$value ])
121- unset value
161+ AS_VAR_SET(fortran_true_var, [$tvalue ])
162+ unset tvalue
163+ AS_VAR_SET(fortran_false_var, [$fvalue ])
164+ unset fvalue
165+
122166 ])
123167
124168 AS_VAR_COPY([ompi_fortran_true_value], [fortran_true_var])
127171 [Fortran value for LOGICAL .TRUE. value])
128172 AS_VAR_POPDEF([fortran_true_var])
129173
174+ AS_VAR_COPY([ompi_fortran_false_value], [fortran_false_var])
175+ AC_DEFINE_UNQUOTED([OMPI_FORTRAN_VALUE_FALSE],
176+ [$ompi_fortran_false_value ],
177+ [Fortran value for LOGICAL .FALSE. value])
178+ AS_VAR_POPDEF([fortran_false_var])
179+
180+
130181 unset happy ompi_print_logical_fn
131182 rm -rf conftest*
132183])dnl
0 commit comments