@@ -29,11 +29,33 @@ AC_DEFUN([OMPI_SETUP_CXX_BANNER],[
29
29
])
30
30
31
31
AC_DEFUN([OMPI_PROG_CXX],[
32
- OPAL_VAR_SCOPE_PUSH([ompi_cxxflags_save])
32
+ OPAL_VAR_SCOPE_PUSH([ompi_cxxflags_save ompi_cxx_argv0])
33
+
33
34
ompi_cxxflags_save= " $CXXFLAGS "
34
35
AC_PROG_CXX
35
36
AC_PROG_CXXCPP
36
37
CXXFLAGS= " $ompi_cxxflags_save "
38
+
39
+ # Note: according to the Autoconf docs, if no C++ compiler is
40
+ # found, $CXX is still set to "g++" (!!). So make sure that we
41
+ # actually found a C++ compiler; if not, set CXX to "no", per
42
+ # thread at
43
+ # https://www.open-mpi.org/community/lists/users/2013/02/21356.php,
44
+ # which advises us to set Libtool precious variables to "no" if we
45
+ # don't want Libtool to setup that language at all.
46
+ AS_IF([test " x$CXX " = " x" ], [CXX= no])
47
+ set dummy $CXX
48
+ ompi_cxx_argv0= [$]2
49
+ OPAL_WHICH([$ompi_cxx_argv0 ], [OMPI_CXX_ABSOLUTE])
50
+ AS_IF([test " x$OMPI_CXX_ABSOLUTE " = " x" ],
51
+ [CXX= no
52
+ OMPI_CXX_ABSOLUTE= no])
53
+
54
+ AC_DEFINE_UNQUOTED(OMPI_CXX, " $CXX " , [OMPI underlying C++ compiler])
55
+ AC_SUBST(OMPI_CXX_ABSOLUTE)
56
+
57
+ AM_CONDITIONAL([OMPI_HAVE_CXX_COMPILER], [test " $CXX " != " no" ])
58
+
37
59
OPAL_VAR_SCOPE_POP
38
60
])
39
61
@@ -44,8 +66,6 @@ dnl wrapper compiler (there is no C++ code in Open MPI, so we do not
44
66
dnl need to setup for internal C++ compilations). Safe to AC_REQUIRE
45
67
dnl this macro.
46
68
AC_DEFUN([OMPI_SETUP_CXX],[
47
- OPAL_VAR_SCOPE_PUSH([ompi_cxx_argv0])
48
-
49
69
# Do a little tomfoolery to get the subsection title printed first
50
70
AC_REQUIRE([OMPI_SETUP_CXX_BANNER])
51
71
@@ -54,20 +74,11 @@ AC_DEFUN([OMPI_SETUP_CXX],[
54
74
# see the docs for AC PROG_CC for details.
55
75
AC_REQUIRE([OMPI_PROG_CXX])
56
76
57
- BASECXX= " ` basename $CXX ` "
58
-
59
- AS_IF([test " x$CXX " = " x" ], [CXX= none])
60
- set dummy $CXX
61
- ompi_cxx_argv0= [$]2
62
- OPAL_WHICH([$ompi_cxx_argv0 ], [OMPI_CXX_ABSOLUTE])
63
- AS_IF([test " x$OMPI_CXX_ABSOLUTE " = " x" ], [OMPI_CXX_ABSOLUTE= none])
64
-
65
- AC_DEFINE_UNQUOTED(OMPI_CXX, " $CXX " , [OMPI underlying C++ compiler])
66
- AC_SUBST(OMPI_CXX_ABSOLUTE)
67
-
68
- # Make sure we can link with the C compiler
69
- OPAL_LANG_LINK_WITH_C([C++], [],
70
- [cat << EOF > & 2
77
+ # If we have a C++ compiler, do some additional tests
78
+ AS_IF([test " $CXX " != " no" ],
79
+ [ # Make sure we can link with the C compiler
80
+ OPAL_LANG_LINK_WITH_C([C++], [],
81
+ [cat << EOF > & 2
71
82
**********************************************************************
72
83
* It appears that your C++ compiler is unable to link against object
73
84
* files created by your C compiler. This generally indicates either
@@ -78,13 +89,6 @@ AC_DEFUN([OMPI_SETUP_CXX],[
78
89
* available in the config.log file in this directory.
79
90
**********************************************************************
80
91
EOF
81
- AC_MSG_ERROR([C and C++ compilers are not link compatible. Can not continue.])])
82
-
83
- # bool type size and alignment
84
- AC_LANG_PUSH(C++)
85
- AC_CHECK_SIZEOF(bool)
86
- OPAL_C_GET_ALIGNMENT(bool, OPAL_ALIGNMENT_CXX_BOOL)
87
- AC_LANG_POP(C++)
88
-
89
- OPAL_VAR_SCOPE_POP
92
+ AC_MSG_ERROR([C and C++ compilers are not link compatible. Can not continue.])])
93
+ ])
90
94
])
0 commit comments