Skip to content

Commit 6d8c16d

Browse files
authored
Merge pull request #8693 from jsquyres/pr/cxx-isnt-mandatory
No longer require a C++ compiler to build Open MPI
2 parents f455578 + 38e53f3 commit 6d8c16d

File tree

7 files changed

+97
-286
lines changed

7 files changed

+97
-286
lines changed

config/ompi_setup_cxx.m4

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,33 @@ AC_DEFUN([OMPI_SETUP_CXX_BANNER],[
2929
])
3030

3131
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+
3334
ompi_cxxflags_save="$CXXFLAGS"
3435
AC_PROG_CXX
3536
AC_PROG_CXXCPP
3637
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+
3759
OPAL_VAR_SCOPE_POP
3860
])
3961

@@ -44,8 +66,6 @@ dnl wrapper compiler (there is no C++ code in Open MPI, so we do not
4466
dnl need to setup for internal C++ compilations). Safe to AC_REQUIRE
4567
dnl this macro.
4668
AC_DEFUN([OMPI_SETUP_CXX],[
47-
OPAL_VAR_SCOPE_PUSH([ompi_cxx_argv0])
48-
4969
# Do a little tomfoolery to get the subsection title printed first
5070
AC_REQUIRE([OMPI_SETUP_CXX_BANNER])
5171

@@ -54,20 +74,11 @@ AC_DEFUN([OMPI_SETUP_CXX],[
5474
# see the docs for AC PROG_CC for details.
5575
AC_REQUIRE([OMPI_PROG_CXX])
5676

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
7182
**********************************************************************
7283
* It appears that your C++ compiler is unable to link against object
7384
* files created by your C compiler. This generally indicates either
@@ -78,13 +89,6 @@ AC_DEFUN([OMPI_SETUP_CXX],[
7889
* available in the config.log file in this directory.
7990
**********************************************************************
8091
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+
])
9094
])

config/opal_case_sensitive_fs_setup.m4

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ AC_ARG_WITH([cs_fs],
6363
[AS_HELP_STRING([--with-cs-fs],
6464
[Destination FS is case sensitive (default: set to value of the build FS's case sensitivity)])])
6565
66+
dnl Stupid emacs syntax hilighting: '
67+
6668
if test "$with_cs_fs" = "yes"; then
6769
OPAL_WANT_CS_FS=1
6870
elif test -z "$with_cs_fs"; then
@@ -78,6 +80,12 @@ else
7880
fi
7981

8082
AM_CONDITIONAL(CASE_SENSITIVE_FS, test "$OPAL_WANT_CS_FS" = "1")
83+
# There is a case in the ompi/tools/wrappers/Makefile.am where we need
84+
# to know if there is a case sensitive filesystem *and* if we have a
85+
# C++ compiler. Since we can't use operators like "&&" or "and" to
86+
# join together AM CONDITIONALs in a Makefile.am, effectively make a
87+
# combo CONDITIONAL here.
88+
AM_CONDITIONAL([CASE_SENSITIVE_FS_AND_HAVE_CXX_COMPILER], [test "$OPAL_WANT_CS_FS" = "1" && test "$CXX" != "no"])
8189

8290
if test "$OPAL_WANT_CS_FS" = "0"; then
8391
cat <<EOF

config/opal_config_asm.m4

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,6 @@ dnl
10871087
dnl #################################################################
10881088
AC_DEFUN([OPAL_CONFIG_ASM],[
10891089
AC_REQUIRE([OPAL_SETUP_CC])
1090-
AC_REQUIRE([OPAL_SETUP_CXX])
10911090
AC_REQUIRE([AM_PROG_AS])
10921091
10931092
AC_ARG_ENABLE([c11-atomics],[AS_HELP_STRING([--enable-c11-atomics],

config/opal_setup_cxx.m4

Lines changed: 0 additions & 218 deletions
This file was deleted.

configure.ac

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,12 +1242,6 @@ opal_show_title "Final top-level OMPI configuration"
12421242

12431243
opal_show_subtitle "Libtool configuration"
12441244

1245-
# Use the undocumented solaris_use_stlport4 libtool variable to turn off any
1246-
# Cstd/stlport4 linkage. This allows Open MPI to be C++ STL agnostic.
1247-
if test "x$opal_cv_c_compiler_vendor" = "xsun"; then
1248-
solaris_use_stlport4="yes"
1249-
fi
1250-
12511245
# Due to this thread:
12521246
# https://www.open-mpi.org/community/lists/users/2013/02/21356.php and
12531247
# a helpful tip from Dave Goodell, set the precious variables for

0 commit comments

Comments
 (0)