File: ompi_setup_cxx.m4

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (95 lines) | stat: -rw-r--r-- 4,035 bytes parent folder | download | duplicates (2)
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
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl                         University Research and Technology
dnl                         Corporation.  All rights reserved.
dnl Copyright (c) 2004-2006 The University of Tennessee and The University
dnl                         of Tennessee Research Foundation.  All rights
dnl                         reserved.
dnl Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
dnl                         University of Stuttgart.  All rights reserved.
dnl Copyright (c) 2004-2006 The Regents of the University of California.
dnl                         All rights reserved.
dnl Copyright (c) 2006      Los Alamos National Security, LLC.  All rights
dnl                         reserved.
dnl Copyright (c) 2007-2009 Sun Microsystems, Inc.  All rights reserved.
dnl Copyright (c) 2008-2020 Cisco Systems, Inc.  All rights reserved.
dnl Copyright (c) 2015-2016 Research Organization for Information Science
dnl                         and Technology (RIST). All rights reserved.
dnl Copyright (c) 2021      Nanook Consulting.  All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl

dnl This macro is necessary to get the title to be displayed first.  :-)
AC_DEFUN([OMPI_SETUP_CXX_BANNER],[
    opal_show_subtitle "C++ compiler and preprocessor"
])

AC_DEFUN([OMPI_PROG_CXX],[
    OPAL_VAR_SCOPE_PUSH([ompi_cxxflags_save ompi_cxx_argv0])

    ompi_cxxflags_save="$CXXFLAGS"
    AC_PROG_CXX
    CXXFLAGS="$ompi_cxxflags_save"

    # Note: according to the Autoconf docs, if no C++ compiler is
    # found, $CXX is still set to "g++" (!!).  So make sure that we
    # actually found a C++ compiler; if not, set CXX to "no", per
    # thread at
    # https://www.open-mpi.org/community/lists/users/2013/02/21356.php,
    # which advises us to set Libtool precious variables to "no" if we
    # don't want Libtool to setup that language at all.
    set dummy $CXX
    ompi_cxx_argv0=[$]2
    OPAL_WHICH([$ompi_cxx_argv0], [OMPI_CXX_ABSOLUTE])
    AS_IF([test "x$OMPI_CXX_ABSOLUTE" = "x"],
          [CXX=no
           OMPI_CXX_ABSOLUTE=no],
          [ # If we did actually find a C++ compiler, find the C++ CPP
           AC_PROG_CXXCPP])

    AC_DEFINE_UNQUOTED(OMPI_CXX, "$CXX", [OMPI underlying C++ compiler])
    AC_SUBST(OMPI_CXX_ABSOLUTE)

    AM_CONDITIONAL([OMPI_HAVE_CXX_COMPILER], [test "$CXX" != "no"])

    OPAL_VAR_SCOPE_POP
])

dnl OMPI_SETUP_CXX()
dnl ----------------
dnl Do everything required to setup the C++ compiler for the mpic++
dnl wrapper compiler (there is no C++ code in Open MPI, so we do not
dnl need to setup for internal C++ compilations).  Safe to AC_REQUIRE
dnl this macro.
AC_DEFUN([OMPI_SETUP_CXX],[
    # Do a little tomfoolery to get the subsection title printed first
    AC_REQUIRE([OMPI_SETUP_CXX_BANNER])

    # Must REQUIRE the PROG_CXX macro and not call it directly here
    # for reasons well-described in the AC2.64 (and beyond) docs --
    # see the docs for AC PROG_CC for details.
    AC_REQUIRE([OMPI_PROG_CXX])

    # If we have a C++ compiler, do some additional tests
    AS_IF([test "$CXX" != "no"],
        [ # Make sure we can link with the C compiler
         OPAL_LANG_LINK_WITH_C([C++], [],
            [cat <<EOF >&2
**********************************************************************
* It appears that your C++ compiler is unable to link against object
* files created by your C compiler.  This generally indicates either
* a conflict between the options specified in CFLAGS and CXXFLAGS
* or a problem with the local compiler installation.  More
* information (including exactly what command was given to the
* compilers and what error resulted when the commands were executed) is
* available in the config.log file in this directory.
**********************************************************************
EOF
             AC_MSG_ERROR([C and C++ compilers are not link compatible.  Can not continue.])])
        ])
])