@@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
1010dnl University of Stuttgart. All rights reserved.
1111dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212dnl 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.
1414dnl Copyright (c) 2006-2009 Sun Microsystems, Inc. All rights reserved.
1515dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
1616dnl reserved.
2727dnl Check to see if specific CFLAGS work
2828dnl $1 : compiler flags to check
2929dnl $2 : Action if the flags work
30+ dnl $3 : Action if the flags do not work
3031AC_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
4249AC_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