@@ -561,6 +561,39 @@ case "$enable_unwind_ptrace" in
561561 ;;
562562esac
563563
564+ AC_ARG_ENABLE ( [ libiberty] ,
565+ [ AS_HELP_STRING ( [ --enable-libiberty] ,
566+ [ enable libiberty support for demangling backtraces name @<:@ default=check@:>@ ] ) ] ,
567+ [ ] ,
568+ [ enable_libiberty=check] )
569+
570+
571+ case "$enable_libiberty" in
572+ check)
573+ enable_libiberty=yes
574+ AC_CHECK_HEADERS ( [ demangle.h] , [ ] , [
575+ old_CFLAGS="$CFLAGS"
576+ CFLAGS="$CFLAGS -I/usr/include/libiberty"
577+ AC_CHECK_HEADERS ( [ libiberty/demangle.h] , [ ] , [
578+ enable_libiberty=no
579+ CFLAGS="$old_CFLAGS"
580+ ] )
581+ ] )
582+ ;;
583+ no)
584+ ;;
585+ yes)
586+ AC_CHECK_LIB ( [ iberty] , [ cplus_demangle] , [ ] , [ AC_MSG_ERROR ( [ can not find required library libiberty] ) ] )
587+ AC_CHECK_HEADERS ( [ demangle.h] , [ ] , [
588+ CFLAGS="$CFLAGS -I/usr/include/libiberty"
589+ AC_CHECK_HEADERS ( [ libiberty/demangle.h] , [ ] , [ AC_MSG_ERROR ( [ can not find required header file libiberty/demange.h] ) ] )
590+ ] )
591+ ;;
592+ *)
593+ AC_MSG_ERROR ( [ bad value '$enable_libiberty' for --enable-libiberty] )
594+ ;;
595+ esac
596+
564597AC_ARG_ENABLE ( [ hwloc] ,
565598 [ AS_HELP_STRING ( [ --enable-hwloc] ,
566599 [ enable hwloc support for CPU affinity; disables affinity support; requires libhwloc @<:@ default=no@:>@ ] ) ] ,
@@ -895,6 +928,7 @@ AC_MSG_RESULT([
895928 affinity: $enable_affinity
896929 unwind: $enable_unwind
897930 unwind-ptrace: $enable_unwind_ptrace
931+ libiberty: $enable_libiberty
898932 hwloc: $enable_hwloc
899933 debug: $enable_debug
900934 static: $enable_static
0 commit comments