Skip to content

Commit bb856e7

Browse files
committed
TO BE SQUASHED: suggestion for 3-arg version
Suggestion for the 3-arg version of _ORTE_SETUP_DEBUGGER_FLAGS_TRY_CFLAGS(). Have to make it a bit cleaner than the originally-proposed version to enable the nesting. Also put in a final MSG_CHECKING/RESULT to indicate which flags were ultimately chosen (it also gives a good place to grep for in the configure output). Signed-off-by: Jeff Squyres <[email protected]>
1 parent 77690a6 commit bb856e7

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

config/orte_setup_debugger_flags.m4

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
1010
dnl University of Stuttgart. All rights reserved.
1111
dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212
dnl All rights reserved.
13-
dnl Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved.
13+
dnl Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved.
1414
dnl Copyright (c) 2006-2009 Sun Microsystems, Inc. All rights reserved.
1515
dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
1616
dnl reserved.
@@ -27,16 +27,23 @@ dnl
2727
dnl Check to see if specific CFLAGS work
2828
dnl $1: compiler flags to check
2929
dnl $2: Action if the flags work
30+
dnl $3: Action if the flags do not work
3031
AC_DEFUN([_ORTE_SETUP_DEBUGGER_FLAGS_TRY_CFLAGS],[
3132
OPAL_VAR_SCOPE_PUSH([ORTE_SETUP_DEBUGGER_FLAGS_CFLAGS_save])
33+
3234
ORTE_SETUP_DEBUGGER_FLAGS_CFLAGS_save=$CFLAGS
3335
AC_MSG_CHECKING([if $1 compiler flag works])
3436
CFLAGS="$CFLAGS $1"
3537
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[int i = 3;])],
36-
[$2; AC_MSG_RESULT([yes])],
37-
[AC_MSG_RESULT([no])])
38+
[ORTE_SETUP_DEBUGGER_FLAGS_HAPPY=yes],
39+
[ORTE_SETUP_DEBUGGER_FLAGS_HAPPY=no])
40+
AC_MSG_RESULT([$ORTE_SETUP_DEBUGGER_FLAGS_HAPPY])
3841
CFLAGS=$ORTE_SETUP_DEBUGGER_FLAGS_CFLAGS_save
42+
3943
OPAL_VAR_SCOPE_POP
44+
45+
AS_IF([test $ORTE_SETUP_DEBUGGER_FLAGS_HAPPY = yes],
46+
[$2], [$3])
4047
])
4148

4249
AC_DEFUN([ORTE_SETUP_DEBUGGER_FLAGS],[
@@ -75,25 +82,15 @@ AC_DEFUN([ORTE_SETUP_DEBUGGER_FLAGS],[
7582
# producing a stack when explicit unwind information is unavailable.
7683
# This is implied by -g, but we want to save space and don't need
7784
# full debug symbols.
78-
OPAL_VAR_SCOPE_PUSH([foundFlags])
79-
foundFlags=no
80-
MPIR_UNWIND_CFLAGS=
81-
82-
# Test for GNU and Intel compiler flags
8385
_ORTE_SETUP_DEBUGGER_FLAGS_TRY_CFLAGS([-fasynchronous-unwind-tables],
84-
[MPIR_UNWIND_CFLAGS=-fasynchronous-unwind-tables foundFlags=yes])
86+
[MPIR_UNWIND_CFLAGS="-fasynchronous-unwind-tables"],
87+
[_ORTE_SETUP_DEBUGGER_FLAGS_TRY_CFLAGS([-Meh_frame -Mframe],
88+
[MPIR_UNWIND_CFLAGS="-Meh_frame -Mframe"],
89+
[MPIR_UNWIND_CFLAGS=-g])
90+
])
8591

86-
# Test for PGI compiler flags
87-
if test $foundFlags = no; then
88-
_ORTE_SETUP_DEBUGGER_FLAGS_TRY_CFLAGS([-Meh_frame -Mframe],
89-
[MPIR_UNWIND_CFLAGS="-Meh_frame -Mframe" foundFlags=yes])
90-
fi
92+
AC_MSG_CHECKING([for final compiler unwind flags])
93+
AC_MSG_RESULT([$MPIR_UNWIND_CFLAGS])
9194

92-
# Finally fall back to -g if neither of the above were available
93-
if test $foundFlags = no; then
94-
_ORTE_SETUP_DEBUGGER_FLAGS_TRY_CFLAGS([-g],
95-
[MPIR_UNWIND_CFLAGS=-g])
96-
fi
9795
AC_SUBST(MPIR_UNWIND_CFLAGS)
98-
OPAL_VAR_SCOPE_POP
9996
])

0 commit comments

Comments
 (0)