Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba01583

Browse files
committed
- Issue #14324: use a linker test to check for profiling support
1 parent 51f6594 commit ba01583

2 files changed

Lines changed: 38 additions & 39 deletions

File tree

configure

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3211,7 +3211,7 @@ then
32113211
linux*) MACHDEP="linux";;
32123212
cygwin*) MACHDEP="cygwin";;
32133213
darwin*) MACHDEP="darwin";;
3214-
irix646) MACHDEP="irix6";;
3214+
irix646) MACHDEP="irix6";;
32153215
'') MACHDEP="unknown";;
32163216
esac
32173217
fi
@@ -5424,37 +5424,35 @@ $as_echo "$enable_shared" >&6; }
54245424
$as_echo_n "checking for --enable-profiling... " >&6; }
54255425
# Check whether --enable-profiling was given.
54265426
if test "${enable_profiling+set}" = set; then :
5427-
enableval=$enable_profiling; ac_save_cc="$CC"
5428-
CC="$CC -pg"
5429-
if test "$cross_compiling" = yes; then :
5430-
ac_enable_profiling="no"
5431-
else
5427+
enableval=$enable_profiling;
5428+
fi
5429+
5430+
if test "x$enable_profiling" = xyes; then
5431+
ac_save_cc="$CC"
5432+
CC="$(CC) -pg"
54325433
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
54335434
/* end confdefs.h. */
54345435
int main() { return 0; }
54355436
_ACEOF
5436-
if ac_fn_c_try_run "$LINENO"; then :
5437-
ac_enable_profiling="yes"
5437+
if ac_fn_c_try_link "$LINENO"; then :
5438+
54385439
else
5439-
ac_enable_profiling="no"
5440+
enable_profiling=no
54405441
fi
5441-
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
5442-
conftest.$ac_objext conftest.beam conftest.$ac_ext
5442+
rm -f core conftest.err conftest.$ac_objext \
5443+
conftest$ac_exeext conftest.$ac_ext
5444+
CC="$ac_save_cc"
5445+
else
5446+
enable_profiling=no
54435447
fi
5448+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_profiling" >&5
5449+
$as_echo "$enable_profiling" >&6; }
54445450

5445-
CC="$ac_save_cc"
5451+
if test "x$enable_profiling" = xyes; then
5452+
BASECFLAGS="-pg $BASECFLAGS"
5453+
LDFLAGS="-pg $LDFLAGS"
54465454
fi
54475455

5448-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_enable_profiling" >&5
5449-
$as_echo "$ac_enable_profiling" >&6; }
5450-
5451-
case "$ac_enable_profiling" in
5452-
"yes")
5453-
BASECFLAGS="-pg $BASECFLAGS"
5454-
LDFLAGS="-pg $LDFLAGS"
5455-
;;
5456-
esac
5457-
54585456
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LDLIBRARY" >&5
54595457
$as_echo_n "checking LDLIBRARY... " >&6; }
54605458

configure.ac

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ then
348348
linux*) MACHDEP="linux";;
349349
cygwin*) MACHDEP="cygwin";;
350350
darwin*) MACHDEP="darwin";;
351-
irix646) MACHDEP="irix6";;
351+
irix646) MACHDEP="irix6";;
352352
'') MACHDEP="unknown";;
353353
esac
354354
fi
@@ -813,22 +813,23 @@ AC_MSG_RESULT($enable_shared)
813813

814814
AC_MSG_CHECKING(for --enable-profiling)
815815
AC_ARG_ENABLE(profiling,
816-
AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]),
817-
[ac_save_cc="$CC"
818-
CC="$CC -pg"
819-
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
820-
[ac_enable_profiling="yes"],
821-
[ac_enable_profiling="no"],
822-
[ac_enable_profiling="no"])
823-
CC="$ac_save_cc"])
824-
AC_MSG_RESULT($ac_enable_profiling)
825-
826-
case "$ac_enable_profiling" in
827-
"yes")
828-
BASECFLAGS="-pg $BASECFLAGS"
829-
LDFLAGS="-pg $LDFLAGS"
830-
;;
831-
esac
816+
AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]))
817+
if test "x$enable_profiling" = xyes; then
818+
ac_save_cc="$CC"
819+
CC="$(CC) -pg"
820+
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
821+
[],
822+
[enable_profiling=no])
823+
CC="$ac_save_cc"
824+
else
825+
enable_profiling=no
826+
fi
827+
AC_MSG_RESULT($enable_profiling)
828+
829+
if test "x$enable_profiling" = xyes; then
830+
BASECFLAGS="-pg $BASECFLAGS"
831+
LDFLAGS="-pg $LDFLAGS"
832+
fi
832833

833834
AC_MSG_CHECKING(LDLIBRARY)
834835

0 commit comments

Comments
 (0)