From f50e25d0d23c97ee0895de0d38fb347ef73ed217 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 11 Aug 2009 23:13:18 +0000 Subject: [PATCH] Addition to r21759 and r21764. Properly group flag-saving inside the AC_REQUIREd macro so that we don't get unexpected execution ordering. See comments on Trac ticket #1993 and Ralf W.'s post on the devel list: http://www.open-mpi.org/community/lists/devel/2009/08/6621.php This commit was SVN r21803. The following SVN revision numbers were found above: r21759 --> open-mpi/ompi@3eb2a3141af1ff3c5aaa2fbe638707da710afa74 r21764 --> open-mpi/ompi@a82d957c46510d22ab90c3b17b90a7742b734b1c --- config/ompi_setup_cxx.m4 | 20 +++++++++++++++----- config/ompi_setup_f77.m4 | 12 ++++++++---- config/ompi_setup_f90.m4 | 12 ++++++++---- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/config/ompi_setup_cxx.m4 b/config/ompi_setup_cxx.m4 index afb3c0f3fd..09b4889c7a 100644 --- a/config/ompi_setup_cxx.m4 +++ b/config/ompi_setup_cxx.m4 @@ -13,7 +13,7 @@ dnl All rights reserved. dnl Copyright (c) 2006 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. -dnl Copyright (c) 2008-20009 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -26,6 +26,17 @@ AC_DEFUN([OMPI_SETUP_CXX_BANNER],[ ompi_show_subtitle "C++ compiler and preprocessor" ]) +# This macro is necessary because PROG_CXX* is REQUIREd by multiple +# places in SETUP_CXX. +AC_DEFUN([OMPI_PROG_CXX],[ + OMPI_VAR_SCOPE_PUSH([ompi_cxxflags_save]) + ompi_cxxflags_save="$CXXFLAGS" + AC_PROG_CXX + AC_PROG_CXXCPP + CXXFLAGS="$ompi_cxxflags_save" + OMPI_VAR_SCOPE_POP +]) + # OMPI_SETUP_CXX() # ---------------- # Do everything required to setup the C++ compiler. Safe to AC_REQUIRE @@ -66,11 +77,10 @@ AC_DEFUN([_OMPI_SETUP_CXX_COMPILER],[ # both found a c++ compiler and want the C++ bindings (i.e., either # case #1 or #3) - ompi_cxxflags_save="$CXXFLAGS" - AC_REQUIRE([AC_PROG_CXX]) - AC_REQUIRE([AC_PROG_CXXCPP]) + # Must REQUIRE the PROG_CXX macro and not call it directly here for + # reasons well-described in the AC2.64 (and beyond) docs. + AC_REQUIRE([OMPI_PROG_CXX]) BASECXX="`basename $CXX`" - CXXFLAGS="$ompi_cxxflags_save" AS_IF([test "x$CXX" = "x"], [CXX=none]) set dummy $CXX diff --git a/config/ompi_setup_f77.m4 b/config/ompi_setup_f77.m4 index cc4aa0481c..9b1a890394 100644 --- a/config/ompi_setup_f77.m4 +++ b/config/ompi_setup_f77.m4 @@ -41,7 +41,11 @@ AC_DEFUN([OMPI_SETUP_F77_BANNER],[ # This macro is necessary because PROG_FC is REQUIREd by multiple # places in SETUP_F90. AC_DEFUN([OMPI_PROG_F77],[ + OMPI_VAR_SCOPE_PUSH([ompi_fflags_save]) + ompi_fflags_save="$FFLAGS" AC_PROG_F77([gfortran g77 f77 xlf frt ifort pgf77 fort77 fl32 af77]) + FFLAGS="$ompi_fflags_save" + OMPI_VAR_SCOPE_POP ]) AC_DEFUN([OMPI_SETUP_F77],[ @@ -58,11 +62,11 @@ AC_DEFUN([OMPI_SETUP_F77],[ # Always run this test, even if fortran isn't wanted so that F77 has # value for the Fint tests # -ompi_fflags_save="$FFLAGS" -# Strangeness in AC2.64 forces us to require a macro that calls -# PROG_FC instead of calling it directly. Weird. + +# Must REQUIRE the PROG_F77 macro and not call it directly here for +# reasons well-described in the AC2.64 (and beyond) docs. AC_REQUIRE([OMPI_PROG_F77]) -FFLAGS="$ompi_fflags_save" + if test -z "$F77"; then AC_MSG_WARN([*** Fortran 77 bindings disabled (could not find compiler)]) OMPI_WANT_F77_BINDINGS=0 diff --git a/config/ompi_setup_f90.m4 b/config/ompi_setup_f90.m4 index d3ea7f6fe8..3894af4e0a 100644 --- a/config/ompi_setup_f90.m4 +++ b/config/ompi_setup_f90.m4 @@ -13,6 +13,7 @@ dnl All rights reserved. dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. +dnl Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -42,7 +43,11 @@ AC_DEFUN([OMPI_SETUP_F90_BANNER],[ # This macro is necessary because PROG_FC is REQUIREd by multiple # places in SETUP_F90. AC_DEFUN([OMPI_PROG_FC],[ + OMPI_VAR_SCOPE_PUSH([ompi_fcflags_save]) + ompi_fcflags_save="$FCFLAGS" AC_PROG_FC([gfortran f95 fort xlf95 ifort ifc efc pgf95 lf95 f90 xlf90 pgf90 epcf90]) + FCFLAGS="$ompi_fcflags_save" + OMPI_VAR_SCOPE_POP ])dnl AC_DEFUN([OMPI_SETUP_F90],[ @@ -86,11 +91,10 @@ else # list of 95 and 90 compilers and use it here. # - ompi_fcflags_save="$FCFLAGS" - # Strangeness in AC2.64 forces us to require a macro that calls - # PROG_FC instead of calling it directly. Weird. + # Must REQUIRE the PROG_FC macro and not call it directly here for + # reasons well-described in the AC2.64 (and beyond) docs. AC_REQUIRE([OMPI_PROG_FC]) - FCFLAGS="$ompi_fcflags_save" + if test -z "$FC"; then AC_MSG_WARN([*** Fortran 90/95 bindings disabled (could not find compiler)]) OMPI_WANT_F90_BINDINGS=0