Skip to content

Commit 160ff18

Browse files
authored
Merge pull request #7169 from hjelmn/fix_what_wg21_calls_our_problem_not_theirs_seriously__in_some_ways_they_are_correct_but_wtf
configure: use -iquote for non-system include paths
2 parents 96759e8 + a6212fe commit 160ff18

File tree

59 files changed

+570
-213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+570
-213
lines changed

autogen.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ (\$\@)
399399
#ifndef $ifdef_string
400400
#define $ifdef_string
401401
402-
#include <opal/mca/base/mca_base_framework.h>
402+
#include \"opal/mca/base/mca_base_framework.h\"
403403
404404
$framework_decl_output
405405
static mca_base_framework_t *${project}_frameworks[] = {

config/opal_setup_cc.m4

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,26 @@ AC_DEFUN([OPAL_PROG_CC_C11],[
117117
OPAL_VAR_SCOPE_POP
118118
])
119119

120+
# OPAL_CHECK_CC_IQUOTE()
121+
# ----------------------
122+
# Check if the compiler supports the -iquote option. This options
123+
# removes the specified directory from the search path when using
124+
# #include <>. This check works around an issue caused by C++20
125+
# which added a <version> header. This conflicts with the
126+
# VERSION file at the base of our source directory on case-
127+
# insensitive filesystems.
128+
AC_DEFUN([OPAL_CHECK_CC_IQUOTE],[
129+
OPAL_VAR_SCOPE_PUSH([opal_check_cc_iquote_CFLAGS_save])
130+
opal_check_cc_iquote_CFLAGS_save=${CFLAGS}
131+
CFLAGS="${CFLAGS} -iquote ."
132+
AC_MSG_CHECKING([for $CC option to add a directory only to the search path for the quote form of include])
133+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[])],
134+
[opal_cc_iquote="-iquote"],
135+
[opal_cc_iquote="-I"])
136+
CFLAGS=${opal_check_cc_iquote_CFLAGS_save}
137+
OPAL_VAR_SCOPE_POP
138+
AC_MSG_RESULT([$opal_cc_iquote])
139+
])
120140

121141
# OPAL_SETUP_CC()
122142
# ---------------
@@ -140,6 +160,8 @@ AC_DEFUN([OPAL_SETUP_CC],[
140160

141161
OPAL_PROG_CC_C11
142162

163+
OPAL_CHECK_CC_IQUOTE
164+
143165
if test $opal_cv_c11_supported = no ; then
144166
# It is not currently an error if C11 support is not available. Uncomment the
145167
# following lines and update the warning when we require a C11 compiler.

config/opal_setup_cxx.m4

Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
dnl -*- shell-script -*-
2+
dnl
3+
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4+
dnl University Research and Technology
5+
dnl Corporation. All rights reserved.
6+
dnl Copyright (c) 2004-2006 The University of Tennessee and The University
7+
dnl of Tennessee Research Foundation. All rights
8+
dnl reserved.
9+
dnl Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
10+
dnl University of Stuttgart. All rights reserved.
11+
dnl Copyright (c) 2004-2006 The Regents of the University of California.
12+
dnl All rights reserved.
13+
dnl Copyright (c) 2006 Los Alamos National Security, LLC. All rights
14+
dnl reserved.
15+
dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
16+
dnl Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved.
17+
dnl Copyright (c) 2015-2016 Research Organization for Information Science
18+
dnl and Technology (RIST). All rights reserved.
19+
dnl $COPYRIGHT$
20+
dnl
21+
dnl Additional copyrights may follow
22+
dnl
23+
dnl $HEADER$
24+
dnl
25+
26+
# This macro is necessary to get the title to be displayed first. :-)
27+
AC_DEFUN([OPAL_SETUP_CXX_BANNER],[
28+
opal_show_subtitle "C++ compiler and preprocessor"
29+
])
30+
31+
# This macro is necessary because PROG_CXX* is REQUIREd by multiple
32+
# places in SETUP_CXX.
33+
AC_DEFUN([OPAL_PROG_CXX],[
34+
OPAL_VAR_SCOPE_PUSH([opal_cxxflags_save])
35+
opal_cxxflags_save="$CXXFLAGS"
36+
AC_PROG_CXX
37+
AC_PROG_CXXCPP
38+
CXXFLAGS="$opal_cxxflags_save"
39+
OPAL_VAR_SCOPE_POP
40+
])
41+
42+
# OPAL_SETUP_CXX()
43+
# ----------------
44+
# Do everything required to setup the C++ compiler. Safe to AC_REQUIRE
45+
# this macro.
46+
AC_DEFUN([OPAL_SETUP_CXX],[
47+
AC_REQUIRE([OPAL_SETUP_CXX_BANNER])
48+
49+
_OPAL_SETUP_CXX_COMPILER
50+
51+
OPAL_CXX_COMPILER_VENDOR([opal_cxx_vendor])
52+
53+
_OPAL_SETUP_CXX_COMPILER_BACKEND
54+
])
55+
56+
# _OPAL_SETUP_CXX_COMPILER()
57+
# --------------------------
58+
# Setup the CXX compiler
59+
AC_DEFUN([_OPAL_SETUP_CXX_COMPILER],[
60+
OPAL_VAR_SCOPE_PUSH(opal_cxx_compiler_works)
61+
62+
# Must REQUIRE the PROG_CXX macro and not call it directly here for
63+
# reasons well-described in the AC2.64 (and beyond) docs.
64+
AC_REQUIRE([OPAL_PROG_CXX])
65+
BASECXX="`basename $CXX`"
66+
67+
AS_IF([test "x$CXX" = "x"], [CXX=none])
68+
set dummy $CXX
69+
opal_cxx_argv0=[$]2
70+
OPAL_WHICH([$opal_cxx_argv0], [OPAL_CXX_ABSOLUTE])
71+
AS_IF([test "x$OPAL_CXX_ABSOLUTE" = "x"], [OPAL_CXX_ABSOLUTE=none])
72+
73+
AC_DEFINE_UNQUOTED(OPAL_CXX, "$CXX", [OPAL underlying C++ compiler])
74+
AC_SUBST(OPAL_CXX_ABSOLUTE)
75+
76+
OPAL_VAR_SCOPE_POP
77+
])
78+
79+
# OPAL_CHECK_CXX_IQUOTE()
80+
# ----------------------
81+
# Check if the compiler supports the -iquote option. This options
82+
# removes the specified directory from the search path when using
83+
# #include <>. This check works around an issue caused by C++20
84+
# which added a <version> header. This conflicts with the
85+
# VERSION file at the base of our source directory on case-
86+
# insensitive filesystems.
87+
AC_DEFUN([OPAL_CHECK_CXX_IQUOTE],[
88+
OPAL_VAR_SCOPE_PUSH([opal_check_cxx_iquote_CFLAGS_save])
89+
opal_check_cxx_iquote_CFLAGS_save=${CFLAGS}
90+
CXXFLAGS="${CFLAGS} -iquote ."
91+
AC_MSG_CHECKING([for $CXX option to add a directory only to the search path for the quote form of include])
92+
AC_LANG_PUSH(C++)
93+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[])],
94+
[opal_cxx_iquote="-iquote"],
95+
[opal_cxx_iquote="-I"])
96+
CXXFLAGS=${opal_check_cxx_iquote_CFLAGS_save}
97+
AC_LANG_POP(C++)
98+
OPAL_VAR_SCOPE_POP
99+
AC_MSG_RESULT([$opal_cxx_iquote])
100+
])
101+
102+
# _OPAL_SETUP_CXX_COMPILER_BACKEND()
103+
# ----------------------------------
104+
# Back end of _OPAL_SETUP_CXX_COMPILER_BACKEND()
105+
AC_DEFUN([_OPAL_SETUP_CXX_COMPILER_BACKEND],[
106+
# Do we want code coverage
107+
if test "$WANT_COVERAGE" = "1"; then
108+
if test "$opal_cxx_vendor" = "gnu" ; then
109+
AC_MSG_WARN([$OPAL_COVERAGE_FLAGS has been added to CFLAGS (--enable-coverage)])
110+
WANT_DEBUG=1
111+
CXXFLAGS="${CXXFLAGS} $OPAL_COVERAGE_FLAGS"
112+
OPAL_WRAPPER_FLAGS_ADD([CXXFLAGS], [$OPAL_COVERAGE_FLAGS])
113+
else
114+
AC_MSG_WARN([Code coverage functionality is currently available only with GCC suite])
115+
AC_MSG_ERROR([Configure: cannot continue])
116+
fi
117+
fi
118+
119+
# Do we want debugging?
120+
if test "$WANT_DEBUG" = "1" && test "$enable_debug_symbols" != "no" ; then
121+
CXXFLAGS="$CXXFLAGS -g"
122+
OPAL_FLAGS_UNIQ(CXXFLAGS)
123+
AC_MSG_WARN([-g has been added to CXXFLAGS (--enable-debug)])
124+
fi
125+
126+
# These flags are generally g++-specific; even the g++-impersonating
127+
# compilers won't accept them.
128+
OPAL_CXXFLAGS_BEFORE_PICKY="$CXXFLAGS"
129+
if test "$WANT_PICKY_COMPILER" = 1 && test "$opal_cxx_vendor" = "gnu"; then
130+
add="-Wall -Wundef -Wno-long-long"
131+
132+
# see if -Wno-long-double works...
133+
AC_LANG_PUSH(C++)
134+
CXXFLAGS_orig="$CXXFLAGS"
135+
CXXFLAGS="$CXXFLAGS $add -Wno-long-double -fstrict-prototype"
136+
AC_CACHE_CHECK([if $CXX supports -Wno-long-double],
137+
[opal_cv_cxx_wno_long_double],
138+
[AC_TRY_COMPILE([], [],
139+
[
140+
dnl So -Wno-long-double did not produce any errors...
141+
dnl We will try to extract a warning regarding
142+
dnl unrecognized or ignored options
143+
AC_TRY_COMPILE([], [long double test;],
144+
[
145+
opal_cv_cxx_wno_long_double="yes"
146+
if test -s conftest.err ; then
147+
dnl Yes, it should be "ignor", in order to catch ignoring and ignore
148+
for i in unknown invalid ignor unrecognized ; do
149+
$GREP -iq $i conftest.err
150+
if test "$?" = "0" ; then
151+
opal_cv_cxx_wno_long_double="no"
152+
break;
153+
fi
154+
done
155+
fi
156+
],
157+
[opal_cv_cxx_wno_long_double="no"])],
158+
[opal_cv_cxx_wno_long_double="no"])
159+
])
160+
161+
CXXFLAGS="$CXXFLAGS_orig"
162+
AC_LANG_POP(C++)
163+
if test "$opal_cv_cxx_wno_long_double" = "yes" ; then
164+
add="$add -Wno-long-double"
165+
fi
166+
167+
CXXFLAGS="$CXXFLAGS $add"
168+
OPAL_FLAGS_UNIQ(CXXFLAGS)
169+
if test "$add" != "" ; then
170+
AC_MSG_WARN([$add has been added to CXXFLAGS (--enable-picky)])
171+
fi
172+
unset add
173+
fi
174+
175+
# See if this version of g++ allows -finline-functions
176+
if test "$GXX" = "yes"; then
177+
CXXFLAGS_orig="$CXXFLAGS"
178+
CXXFLAGS="$CXXFLAGS -finline-functions"
179+
add=
180+
AC_LANG_PUSH(C++)
181+
AC_CACHE_CHECK([if $CXX supports -finline-functions],
182+
[opal_cv_cxx_finline_functions],
183+
[AC_TRY_COMPILE([], [],
184+
[opal_cv_cxx_finline_functions="yes"],
185+
[opal_cv_cxx_finline_functions="no"])])
186+
AC_LANG_POP(C++)
187+
if test "$opal_cv_cxx_finline_functions" = "yes" ; then
188+
add=" -finline-functions"
189+
fi
190+
CXXFLAGS="$CXXFLAGS_orig$add"
191+
OPAL_FLAGS_UNIQ(CXXFLAGS)
192+
if test "$add" != "" ; then
193+
AC_MSG_WARN([$add has been added to CXXFLAGS])
194+
fi
195+
unset add
196+
fi
197+
198+
# Make sure we can link with the C compiler
199+
if test "$opal_cv_cxx_compiler_vendor" != "microsoft"; then
200+
OPAL_LANG_LINK_WITH_C([C++], [],
201+
[cat <<EOF >&2
202+
**********************************************************************
203+
* It appears that your C++ compiler is unable to link against object
204+
* files created by your C compiler. This generally indicates either
205+
* a conflict between the options specified in CFLAGS and CXXFLAGS
206+
* or a problem with the local compiler installation. More
207+
* information (including exactly what command was given to the
208+
* compilers and what error resulted when the commands were executed) is
209+
* available in the config.log file in this directory.
210+
**********************************************************************
211+
EOF
212+
AC_MSG_ERROR([C and C++ compilers are not link compatible. Can not continue.])])
213+
fi
214+
215+
# If we are on HP-UX, ensure that we're using aCC
216+
case "$host" in
217+
*hpux*)
218+
if test "$BASECXX" = "CC"; then
219+
AC_MSG_WARN([*** You will probably have problems compiling the MPI 2])
220+
AC_MSG_WARN([*** C++ bindings with the HP-UX CC compiler. You should])
221+
AC_MSG_WARN([*** probably be using the aCC compiler. Re-run configure])
222+
AC_MSG_WARN([*** with the environment variable "CXX=aCC".])
223+
fi
224+
;;
225+
esac
226+
227+
# Note: gcc-imperonating compilers accept -O3
228+
if test "$WANT_DEBUG" = "1"; then
229+
OPTFLAGS=
230+
else
231+
if test "$GXX" = yes; then
232+
OPTFLAGS="-O3"
233+
else
234+
OPTFLAGS="-O"
235+
fi
236+
fi
237+
238+
# config/opal_ensure_contains_optflags.m4
239+
OPAL_ENSURE_CONTAINS_OPTFLAGS(["$CXXFLAGS"])
240+
AC_MSG_CHECKING([for C++ optimization flags])
241+
AC_MSG_RESULT([$co_result])
242+
CXXFLAGS="$co_result"
243+
244+
# bool type size and alignment
245+
AC_LANG_PUSH(C++)
246+
AC_CHECK_SIZEOF(bool)
247+
OPAL_C_GET_ALIGNMENT(bool, OPAL_ALIGNMENT_CXX_BOOL)
248+
AC_LANG_POP(C++)
249+
250+
OPAL_CHECK_CXX_IQUOTE
251+
])

configure.ac

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,11 +1260,17 @@ if test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"; then
12601260
# rather than have successive assignments to these shell
12611261
# variables, lest the $(foo) names try to get evaluated here.
12621262
# Yuck!
1263-
CPPFLAGS='-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/opal/include m4_ifdef([project_ompi], [-I$(top_srcdir)/ompi/include]) m4_ifdef([project_oshmem], [-I$(top_srcdir)/oshmem/include])'" $CPPFLAGS"
1263+
cpp_includes='$(top_srcdir) $(top_builddir) $(top_srcdir)/opal/include m4_ifdef([project_ompi], [$(top_srcdir)/ompi/include]) m4_ifdef([project_oshmem], [$(top_srcdir)/oshmem/include])'
12641264
else
1265-
CPPFLAGS='-I$(top_srcdir)'" $CPPFLAGS"
1265+
cpp_includes='$(top_srcdir)'
12661266
fi
12671267

1268+
CPP_INCLUDES="$(echo $cpp_includes | $SED 's/[[^ \]]* */'"$opal_cc_iquote"'&/g')"
1269+
CXX_INCLUDES="$(echo $cpp_includes | $SED 's/[[^ \]]* */'"$opal_cxx_iquote"'&/g')"
1270+
CPPFLAGS="$CPP_INCLUDES $CPPFLAGS"
1271+
# C++ is only relevant if we're building OMPI
1272+
m4_ifdef([project_ompi],[CXXCPPFLAGS="$CXX_INCLUDES $CXXCPPFLAGS"])
1273+
12681274
# OMPI needs some additional processing of the flags (e.g., get
12691275
# versions without optimization for debugger modules).
12701276

ompi/mca/coll/monitoring/coll_monitoring.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 2016 Inria. All rights reserved.
3-
* Copyright (c) 2017 Research Organization for Information Science
4-
* and Technology (RIST). All rights reserved.
3+
* Copyright (c) 2017-2019 Research Organization for Information Science
4+
* and Technology (RIST). All rights reserved.
55
* Copyright (c) 2017 Amazon.com, Inc. or its affiliates. All Rights
66
* reserved.
77
* $COPYRIGHT$
@@ -16,13 +16,13 @@
1616

1717
BEGIN_C_DECLS
1818

19-
#include <ompi_config.h>
20-
#include <ompi/mca/coll/coll.h>
21-
#include <ompi/op/op.h>
22-
#include <ompi/request/request.h>
23-
#include <ompi/datatype/ompi_datatype.h>
24-
#include <ompi/communicator/communicator.h>
25-
#include <ompi/mca/common/monitoring/common_monitoring.h>
19+
#include "ompi_config.h"
20+
#include "ompi/mca/coll/coll.h"
21+
#include "ompi/op/op.h"
22+
#include "ompi/request/request.h"
23+
#include "ompi/datatype/ompi_datatype.h"
24+
#include "ompi/communicator/communicator.h"
25+
#include "ompi/mca/common/monitoring/common_monitoring.h"
2626

2727
struct mca_coll_monitoring_component_t {
2828
mca_coll_base_component_t super;

ompi/mca/coll/monitoring/coll_monitoring_allgather.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
/*
22
* Copyright (c) 2016-2018 Inria. All rights reserved.
3+
* Copyright (c) 2019 Research Organization for Information Science
4+
* and Technology (RIST). All rights reserved.
35
* $COPYRIGHT$
46
*
57
* Additional copyrights may follow
68
*
79
* $HEADER$
810
*/
911

10-
#include <ompi_config.h>
11-
#include <ompi/request/request.h>
12-
#include <ompi/datatype/ompi_datatype.h>
13-
#include <ompi/communicator/communicator.h>
12+
#include "ompi_config.h"
13+
#include "ompi/request/request.h"
14+
#include "ompi/datatype/ompi_datatype.h"
15+
#include "ompi/communicator/communicator.h"
1416
#include "coll_monitoring.h"
1517

1618
int mca_coll_monitoring_allgather(const void *sbuf, int scount,

ompi/mca/coll/monitoring/coll_monitoring_allgatherv.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
/*
22
* Copyright (c) 2016-2018 Inria. All rights reserved.
3+
* Copyright (c) 2019 Research Organization for Information Science
4+
* and Technology (RIST). All rights reserved.
35
* $COPYRIGHT$
46
*
57
* Additional copyrights may follow
68
*
79
* $HEADER$
810
*/
911

10-
#include <ompi_config.h>
11-
#include <ompi/request/request.h>
12-
#include <ompi/datatype/ompi_datatype.h>
13-
#include <ompi/communicator/communicator.h>
12+
#include "ompi_config.h"
13+
#include "ompi/request/request.h"
14+
#include "ompi/datatype/ompi_datatype.h"
15+
#include "ompi/communicator/communicator.h"
1416
#include "coll_monitoring.h"
1517

1618
int mca_coll_monitoring_allgatherv(const void *sbuf, int scount,

0 commit comments

Comments
 (0)