- Issue #14324: use a linker test to check for profiling support

This commit is contained in:
doko@ubuntu.com 2012-06-30 16:52:05 +02:00
parent 51f6594054
commit ba01583eef
2 changed files with 37 additions and 38 deletions

42
configure vendored
View File

@ -3211,7 +3211,7 @@ then
linux*) MACHDEP="linux";; linux*) MACHDEP="linux";;
cygwin*) MACHDEP="cygwin";; cygwin*) MACHDEP="cygwin";;
darwin*) MACHDEP="darwin";; darwin*) MACHDEP="darwin";;
irix646) MACHDEP="irix6";; irix646) MACHDEP="irix6";;
'') MACHDEP="unknown";; '') MACHDEP="unknown";;
esac esac
fi fi
@ -5424,37 +5424,35 @@ $as_echo "$enable_shared" >&6; }
$as_echo_n "checking for --enable-profiling... " >&6; } $as_echo_n "checking for --enable-profiling... " >&6; }
# Check whether --enable-profiling was given. # Check whether --enable-profiling was given.
if test "${enable_profiling+set}" = set; then : if test "${enable_profiling+set}" = set; then :
enableval=$enable_profiling; ac_save_cc="$CC" enableval=$enable_profiling;
CC="$CC -pg" fi
if test "$cross_compiling" = yes; then :
ac_enable_profiling="no" if test "x$enable_profiling" = xyes; then
else ac_save_cc="$CC"
CC="$(CC) -pg"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
int main() { return 0; } int main() { return 0; }
_ACEOF _ACEOF
if ac_fn_c_try_run "$LINENO"; then : if ac_fn_c_try_link "$LINENO"; then :
ac_enable_profiling="yes"
else else
ac_enable_profiling="no" enable_profiling=no
fi fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ rm -f core conftest.err conftest.$ac_objext \
conftest.$ac_objext conftest.beam conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
CC="$ac_save_cc"
else
enable_profiling=no
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_profiling" >&5
$as_echo "$enable_profiling" >&6; }
CC="$ac_save_cc" if test "x$enable_profiling" = xyes; then
BASECFLAGS="-pg $BASECFLAGS"
LDFLAGS="-pg $LDFLAGS"
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_enable_profiling" >&5
$as_echo "$ac_enable_profiling" >&6; }
case "$ac_enable_profiling" in
"yes")
BASECFLAGS="-pg $BASECFLAGS"
LDFLAGS="-pg $LDFLAGS"
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LDLIBRARY" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking LDLIBRARY" >&5
$as_echo_n "checking LDLIBRARY... " >&6; } $as_echo_n "checking LDLIBRARY... " >&6; }

View File

@ -348,7 +348,7 @@ then
linux*) MACHDEP="linux";; linux*) MACHDEP="linux";;
cygwin*) MACHDEP="cygwin";; cygwin*) MACHDEP="cygwin";;
darwin*) MACHDEP="darwin";; darwin*) MACHDEP="darwin";;
irix646) MACHDEP="irix6";; irix646) MACHDEP="irix6";;
'') MACHDEP="unknown";; '') MACHDEP="unknown";;
esac esac
fi fi
@ -813,22 +813,23 @@ AC_MSG_RESULT($enable_shared)
AC_MSG_CHECKING(for --enable-profiling) AC_MSG_CHECKING(for --enable-profiling)
AC_ARG_ENABLE(profiling, AC_ARG_ENABLE(profiling,
AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]), AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]))
[ac_save_cc="$CC" if test "x$enable_profiling" = xyes; then
CC="$CC -pg" ac_save_cc="$CC"
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], CC="$(CC) -pg"
[ac_enable_profiling="yes"], AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
[ac_enable_profiling="no"], [],
[ac_enable_profiling="no"]) [enable_profiling=no])
CC="$ac_save_cc"]) CC="$ac_save_cc"
AC_MSG_RESULT($ac_enable_profiling) else
enable_profiling=no
fi
AC_MSG_RESULT($enable_profiling)
case "$ac_enable_profiling" in if test "x$enable_profiling" = xyes; then
"yes") BASECFLAGS="-pg $BASECFLAGS"
BASECFLAGS="-pg $BASECFLAGS" LDFLAGS="-pg $LDFLAGS"
LDFLAGS="-pg $LDFLAGS" fi
;;
esac
AC_MSG_CHECKING(LDLIBRARY) AC_MSG_CHECKING(LDLIBRARY)