Skip to content

Commit 78d6ccc

Browse files
committed
perf build: Handle slang being in /usr/include and in /usr/include/slang/
In some distros slang.h may be in a /usr/include 'slang' subdir, so use the if slang is not explicitely disabled (by using NO_SLANG=1) and its feature test for the common case (having /usr/include/slang.h) failed, use the results for the test that checks if it is in slang/slang.h. Change the only file in perf that includes slang.h to use HAVE_SLANG_INCLUDE_SUBDIR and forget about this for good. On a rhel6 system now we have: $ /tmp/build/perf/perf -vv | grep slang libslang: [ on ] # HAVE_SLANG_SUPPORT $ ldd /tmp/build/perf/perf | grep libslang libslang.so.2 => /usr/lib64/libslang.so.2 (0x00007fa2d5a8d000) $ grep slang /tmp/build/perf/FEATURE-DUMP feature-libslang=0 feature-libslang-include-subdir=1 $ cat /etc/redhat-release CentOS release 6.10 (Final) $ While on fedora:29: $ /tmp/build/perf/perf -vv | grep slang libslang: [ on ] # HAVE_SLANG_SUPPORT $ ldd /tmp/build/perf/perf | grep slang libslang.so.2 => /lib64/libslang.so.2 (0x00007f8eb11a7000) $ grep slang /tmp/build/perf/FEATURE-DUMP feature-libslang=1 feature-libslang-include-subdir=1 $ $ cat /etc/fedora-release Fedora release 29 (Twenty Nine) $ The feature-libslang-include-subdir=1 line is because the 'gettid()' test was added to test-all.c as the new glibc has an implementation for that, so we soon should have it not failing, i.e. should be the common case soon. Perhaps I should move it out till it becomes the norm... Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Fixes: 1955c8c ("perf tools: Don't hardcode host include path for libslang") Link: https://lkml.kernel.org/n/tip-bkgtpsu3uit821fuwsdhj9gd@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent cbefd24 commit 78d6ccc

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎tools/perf/Makefile.config‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,14 @@ endif
644644

645645
ifndef NO_SLANG
646646
ifneq ($(feature-libslang), 1)
647-
msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev);
648-
NO_SLANG := 1
649-
else
647+
ifneq ($(feature-libslang-include-subdir), 1)
648+
msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev);
649+
NO_SLANG := 1
650+
else
651+
CFLAGS += -DHAVE_SLANG_INCLUDE_SUBDIR
652+
endif
653+
endif
654+
ifndef NO_SLANG
650655
# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
651656
CFLAGS += -DHAVE_SLANG_SUPPORT
652657
EXTLIBS += -lslang

‎tools/perf/ui/libslang.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
#ifndef HAVE_LONG_LONG
1111
#define HAVE_LONG_LONG __GLIBC_HAVE_LONG_LONG
1212
#endif
13+
14+
#ifdef HAVE_SLANG_INCLUDE_SUBDIR
15+
#include <slang/slang.h>
16+
#else
1317
#include <slang.h>
18+
#endif
1419

1520
#if SLANG_VERSION < 20104
1621
#define slsmg_printf(msg, args...) \

0 commit comments

Comments
 (0)