perf config: Add some new -DHAVE_XXX to CFLAGS
authorJin Yao <yao.jin@linux.intel.com>
Fri, 30 Mar 2018 09:27:12 +0000 (17:27 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 2 Apr 2018 16:50:17 +0000 (13:50 -0300)
For most of libraries, in perf.config, they are recorded with -DHAVE_XXX in
CFLAGS according to if the libraries are compiled-in.  Then C code then will
know if the library is compiled-in or not.

While for glibc, no -DHAVE_GLIBC_SUPPORT exists.

For python and perl libraries, only -DNO_PYTHON and -DNO_LIBPERL exist.

To make the code more consistent, the patch creates -DHAVE_LIBPYTHON_SUPPORT
and -DHAVE_LIBPERL_SUPPORT if the python and perl libraries are compiled-in.

Since the existing flags -DNO_PYTHON and -DNO_LIBPERL are being used in many
places in C code, this patch doesn't remove them. In a follow-up patch, we will
recontruct the C code and then use HAVE_XXX instead.

v3:

Move 'CFLAGS += -DHAVE_LIBPYTHON_SUPPORT' and 'CFLAGS +=
-DHAVE_LIBPERL_SUPPORT' to other places to avoid duplicated feature checking.

v2:

Create -DHAVE_GLIBC_SUPPORT, -DHAVE_LIBPYTHON_SUPPORT and
-DHAVE_LIBPERL_SUPPORT.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@intel.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1522402036-22915-3-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Makefile.config

index 98ff736..deb8fba 100644 (file)
@@ -352,6 +352,10 @@ else
   endif # libelf support
 endif # NO_LIBELF
 
+ifeq ($(feature-glibc), 1)
+  CFLAGS += -DHAVE_GLIBC_SUPPORT
+endif
+
 ifdef NO_DWARF
   NO_LIBDW_DWARF_UNWIND := 1
 endif
@@ -635,6 +639,7 @@ else
   else
     LDFLAGS += $(PERL_EMBED_LDFLAGS)
     EXTLIBS += $(PERL_EMBED_LIBADD)
+    CFLAGS += -DHAVE_LIBPERL_SUPPORT
     $(call detected,CONFIG_LIBPERL)
   endif
 endif
@@ -671,6 +676,7 @@ else
          LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
          EXTLIBS += $(PYTHON_EMBED_LIBADD)
          LANG_BINDINGS += $(obj-perf)python/perf.so
+         CFLAGS += -DHAVE_LIBPYTHON_SUPPORT
          $(call detected,CONFIG_LIBPYTHON)
       endif
     endif