Fix the OProfile part of PR5018. This fixes --without-oprofile, makes

it the default, and works around a broken libopagent on some Debian
systems.

llvm-svn: 83503
This commit is contained in:
Jeffrey Yasskin 2009-10-07 23:22:42 +00:00
parent 763be1a248
commit 2da7231034
2 changed files with 131 additions and 297 deletions

View File

@ -999,31 +999,30 @@ AC_ARG_WITH(oprofile,
AC_SUBST(USE_OPROFILE, [1])
case "$withval" in
/usr|yes) llvm_cv_oppath=/usr/lib/oprofile ;;
no) llvm_cv_oppath=
AC_SUBST(USE_OPROFILE, [0]) ;;
*) llvm_cv_oppath="${withval}/lib/oprofile"
CPPFLAGS="-I${withval}/include";;
esac
LIBS="$LIBS -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}"
AC_SEARCH_LIBS(op_open_agent, opagent, [], [
echo "Error! You need to have libopagent around."
exit -1
])
AC_CHECK_HEADER([opagent.h], [], [
echo "Error! You need to have opagent.h around."
exit -1
])
if test -n "$llvm_cv_oppath" ; then
LIBS="$LIBS -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}"
dnl Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537744:
dnl libbfd is not included properly in libopagent in some Debian
dnl versions. If libbfd isn't found at all, we assume opagent works
dnl anyway.
AC_SEARCH_LIBS(bfd_init, bfd, [], [])
AC_SEARCH_LIBS(op_open_agent, opagent, [], [
echo "Error! You need to have libopagent around."
exit -1
])
AC_CHECK_HEADER([opagent.h], [], [
echo "Error! You need to have opagent.h around."
exit -1
])
fi
],
[
llvm_cv_old_LIBS="$LIBS"
LIBS="$LIBS -L/usr/lib/oprofile -Wl,-rpath,/usr/lib/oprofile"
dnl If either the library or header aren't present, omit oprofile support.
AC_SEARCH_LIBS(op_open_agent, opagent,
[AC_SUBST(USE_OPROFILE, [1])],
[LIBS="$llvm_cv_old_LIBS"
AC_SUBST(USE_OPROFILE, [0])])
AC_CHECK_HEADER([opagent.h], [], [
LIBS="$llvm_cv_old_LIBS"
AC_SUBST(USE_OPROFILE, [0])
])
AC_SUBST(USE_OPROFILE, [0])
])
AC_DEFINE_UNQUOTED([USE_OPROFILE],$USE_OPROFILE,
[Define if we have the oprofile JIT-support library])

389
llvm/configure vendored
View File

@ -28539,11 +28539,114 @@ if test "${with_oprofile+set}" = set; then
case "$withval" in
/usr|yes) llvm_cv_oppath=/usr/lib/oprofile ;;
no) llvm_cv_oppath=
USE_OPROFILE=0
;;
*) llvm_cv_oppath="${withval}/lib/oprofile"
CPPFLAGS="-I${withval}/include";;
esac
LIBS="$LIBS -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}"
{ echo "$as_me:$LINENO: checking for library containing op_open_agent" >&5
if test -n "$llvm_cv_oppath" ; then
LIBS="$LIBS -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}"
{ echo "$as_me:$LINENO: checking for library containing bfd_init" >&5
echo $ECHO_N "checking for library containing bfd_init... $ECHO_C" >&6; }
if test "${ac_cv_search_bfd_init+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_func_search_save_LIBS=$LIBS
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char bfd_init ();
int
main ()
{
return bfd_init ();
;
return 0;
}
_ACEOF
for ac_lib in '' bfd; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_search_bfd_init=$ac_res
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if test "${ac_cv_search_bfd_init+set}" = set; then
break
fi
done
if test "${ac_cv_search_bfd_init+set}" = set; then
:
else
ac_cv_search_bfd_init=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_search_bfd_init" >&5
echo "${ECHO_T}$ac_cv_search_bfd_init" >&6; }
ac_res=$ac_cv_search_bfd_init
if test "$ac_res" != no; then
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
{ echo "$as_me:$LINENO: checking for library containing op_open_agent" >&5
echo $ECHO_N "checking for library containing op_open_agent... $ECHO_C" >&6; }
if test "${ac_cv_search_op_open_agent+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@ -28642,12 +28745,12 @@ if test "$ac_res" != no; then
else
echo "Error! You need to have libopagent around."
exit -1
echo "Error! You need to have libopagent around."
exit -1
fi
if test "${ac_cv_header_opagent_h+set}" = set; then
if test "${ac_cv_header_opagent_h+set}" = set; then
{ echo "$as_me:$LINENO: checking for opagent.h" >&5
echo $ECHO_N "checking for opagent.h... $ECHO_C" >&6; }
if test "${ac_cv_header_opagent_h+set}" = set; then
@ -28805,285 +28908,17 @@ if test $ac_cv_header_opagent_h = yes; then
:
else
echo "Error! You need to have opagent.h around."
exit -1
echo "Error! You need to have opagent.h around."
exit -1
fi
fi
else
llvm_cv_old_LIBS="$LIBS"
LIBS="$LIBS -L/usr/lib/oprofile -Wl,-rpath,/usr/lib/oprofile"
{ echo "$as_me:$LINENO: checking for library containing op_open_agent" >&5
echo $ECHO_N "checking for library containing op_open_agent... $ECHO_C" >&6; }
if test "${ac_cv_search_op_open_agent+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_func_search_save_LIBS=$LIBS
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char op_open_agent ();
int
main ()
{
return op_open_agent ();
;
return 0;
}
_ACEOF
for ac_lib in '' opagent; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_search_op_open_agent=$ac_res
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if test "${ac_cv_search_op_open_agent+set}" = set; then
break
fi
done
if test "${ac_cv_search_op_open_agent+set}" = set; then
:
else
ac_cv_search_op_open_agent=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_search_op_open_agent" >&5
echo "${ECHO_T}$ac_cv_search_op_open_agent" >&6; }
ac_res=$ac_cv_search_op_open_agent
if test "$ac_res" != no; then
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
USE_OPROFILE=1
else
LIBS="$llvm_cv_old_LIBS"
USE_OPROFILE=0
fi
if test "${ac_cv_header_opagent_h+set}" = set; then
{ echo "$as_me:$LINENO: checking for opagent.h" >&5
echo $ECHO_N "checking for opagent.h... $ECHO_C" >&6; }
if test "${ac_cv_header_opagent_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
{ echo "$as_me:$LINENO: result: $ac_cv_header_opagent_h" >&5
echo "${ECHO_T}$ac_cv_header_opagent_h" >&6; }
else
# Is the header compilable?
{ echo "$as_me:$LINENO: checking opagent.h usability" >&5
echo $ECHO_N "checking opagent.h usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <opagent.h>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
{ echo "$as_me:$LINENO: checking opagent.h presence" >&5
echo $ECHO_N "checking opagent.h presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <opagent.h>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: opagent.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: opagent.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: opagent.h: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: opagent.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: opagent.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: opagent.h: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: opagent.h: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: opagent.h: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: opagent.h: see the Autoconf documentation" >&5
echo "$as_me: WARNING: opagent.h: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: opagent.h: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: opagent.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: opagent.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: opagent.h: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: opagent.h: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: opagent.h: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
## ----------------------------------- ##
## Report this to llvmbugs@cs.uiuc.edu ##
## ----------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ echo "$as_me:$LINENO: checking for opagent.h" >&5
echo $ECHO_N "checking for opagent.h... $ECHO_C" >&6; }
if test "${ac_cv_header_opagent_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_header_opagent_h=$ac_header_preproc
fi
{ echo "$as_me:$LINENO: result: $ac_cv_header_opagent_h" >&5
echo "${ECHO_T}$ac_cv_header_opagent_h" >&6; }
fi
if test $ac_cv_header_opagent_h = yes; then
:
else
LIBS="$llvm_cv_old_LIBS"
USE_OPROFILE=0
fi
USE_OPROFILE=0
fi