Skip to content

Commit bd0cc1d

Browse files
committed
Just ignore any lto settings
Rather than exiting configure with an error, print a warning if lto-based directives are detected and ignore those flags. This may help resolve rpm problems. Signed-off-by: Ralph Castain <[email protected]>
1 parent 509ce39 commit bd0cc1d

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

config/prte_check_cflags.m4

+15-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ dnl -*- shell-script -*-
22
dnl
33
dnl Copyright (c) 2021 IBM Corporation. All rights reserved.
44
dnl
5-
dnl Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
5+
dnl Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
66
dnl $COPYRIGHT$
77
dnl
88
dnl Additional copyrights may follow
@@ -43,12 +43,20 @@ AC_MSG_CHECKING(if $CC supports ([$1]))
4343

4444

4545
AC_DEFUN([_PRTE_CHECK_LTO_FLAG], [
46-
chkflg=`echo $1 | grep -- -flto`
46+
chkflg=`echo $1 | grep -- lto`
4747
if test -n "$chkflg"; then
48-
AC_MSG_WARN([Configure has detected the presence of the -flto])
49-
AC_MSG_WARN([compiler directive in $2. PRRTE does not currently])
50-
AC_MSG_WARN([support this flag as it conflicts with the])
51-
AC_MSG_WARN([plugin architecture of the PRRTE code base.])
52-
AC_MSG_ERROR([Please remove this directive and re-run configure.])
48+
AC_MSG_WARN([Configure has detected the presence of one or more])
49+
AC_MSG_WARN([compiler directives involving the lto optimizer])
50+
AC_MSG_WARN([$2. PRRTE does not currently support such directives])
51+
AC_MSG_WARN([as they conflict with the plugin architecture of the])
52+
AC_MSG_WARN([PRRTE library. The directive is being ignored.])
53+
newflg=
54+
for item in $1; do
55+
chkflg=`echo $item | grep -- lto`
56+
if test ! -n "$chkflg"; then
57+
newflg+="$item "
58+
fi
59+
done
60+
$2="$newflg"
5361
fi
5462
])

configure.ac

+12-13
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
2626
# Copyright (c) 2018-2022 Amazon.com, Inc. or its affiliates.
2727
# All Rights reserved.
28-
# Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
28+
# Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
2929
# Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
3030
# Copyright (c) 2023-2024 Jeffrey M. Squyres. All rights reserved.
3131
# $COPYRIGHT$
@@ -323,6 +323,17 @@ prte_show_title "Compiler and preprocessor tests"
323323
##################################
324324

325325
PRTE_SETUP_CC
326+
# We do not currently support the "lto" optimizer as it
327+
# aggregates all the headers from our plugins, resulting
328+
# in a configuration that generates warnings/errors when
329+
# passed through their optimizer phase. We therefore check
330+
# for the flag, and if found, output a message explaining
331+
# the situation and aborting configure
332+
_PRTE_CHECK_LTO_FLAG($CPPFLAGS, CPPFLAGS)
333+
_PRTE_CHECK_LTO_FLAG($CFLAGS, CFLAGS)
334+
_PRTE_CHECK_LTO_FLAG($LDFLAGS, LDFLAGS)
335+
_PRTE_CHECK_LTO_FLAG($LIBS, LIBS)
336+
326337

327338
# Does the compiler support "ident"-like constructs?
328339

@@ -932,18 +943,6 @@ LDFLAGS="$LDFLAGS $PRTE_FINAL_LDFLAGS"
932943
LIBS="$LIBS $PRTE_FINAL_LIBS"
933944

934945

935-
# We do not currently support the "lto" optimizer as it
936-
# aggregates all the headers from our plugins, resulting
937-
# in a configuration that generates warnings/errors when
938-
# passed through their optimizer phase. We therefore check
939-
# for the flag, and if found, output a message explaining
940-
# the situation and aborting configure
941-
_PRTE_CHECK_LTO_FLAG($CPPFLAGS, CPPFLAGS)
942-
_PRTE_CHECK_LTO_FLAG($CFLAGS, CFLAGS)
943-
_PRTE_CHECK_LTO_FLAG($LDFLAGS, LDFLAGS)
944-
_PRTE_CHECK_LTO_FLAG($LIBS, LIBS)
945-
946-
947946
# restore any user-provided Werror flags
948947
AS_IF([test ! -z "$PRTE_CFLAGS_cache"], [CFLAGS="$CFLAGS $PRTE_CFLAGS_cache"])
949948

0 commit comments

Comments
 (0)