[PATCH 06/27] perf tools: Move libelf check config into config/Makefile

2013-04-01 Thread Jiri Olsa
Moving libelf check config into config/Makefile.

Signed-off-by: Jiri Olsa 
Cc: Arnaldo Carvalho de Melo 
Cc: Peter Zijlstra 
Cc: Ingo Molnar 
Cc: Paul Mackerras 
Cc: Corey Ashford 
Cc: Frederic Weisbecker 
Cc: Namhyung Kim 
Cc: Borislav Petkov 
Cc: Stephane Eranian 
---
 tools/perf/Makefile| 46 -
 tools/perf/config/Makefile | 47 ++
 2 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index dcae71b..0ea3359 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -461,45 +461,6 @@ ifneq ($(MAKECMDGOALS),tags)
 # because maintaining the nesting to match is a pain.  If
 # we had "elif" things would have been much nicer...
 
-ifdef NO_LIBELF
-   NO_DWARF := 1
-   NO_DEMANGLE := 1
-   NO_LIBUNWIND := 1
-else
-FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
-   FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
-   ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
-   LIBC_SUPPORT := 1
-   endif
-   ifeq ($(BIONIC),1)
-   LIBC_SUPPORT := 1
-   endif
-   ifeq ($(LIBC_SUPPORT),1)
-   msg := $(warning No libelf found, disables 'probe' tool, please 
install elfutils-libelf-devel/libelf-dev);
-
-   NO_LIBELF := 1
-   NO_DWARF := 1
-   NO_DEMANGLE := 1
-   else
-   msg := $(error No gnu/libc-version.h found, please install 
glibc-dev[el]/glibc-static);
-   endif
-else
-   # for linking with debug library, run like:
-   # make DEBUG=1 LIBDW_DIR=/opt/libdw/
-   ifdef LIBDW_DIR
-   LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
-   LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
-   endif
-
-   FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) 
$(ALL_LDFLAGS) $(EXTLIBS)
-   ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
-   msg := $(warning No libdw.h found or old libdw.h found or 
elfutils is older than 0.138, disables dwarf support. Please install new 
elfutils-devel/libdw-dev);
-   NO_DWARF := 1
-   endif # Dwarf support
-endif # SOURCE_LIBELF
-endif # NO_LIBELF
-
 # There's only x86 (both 32 and 64) support for CFI unwind so far
 ifneq ($(ARCH),x86)
NO_LIBUNWIND := 1
@@ -541,13 +502,6 @@ BUILTIN_OBJS := $(filter-out 
$(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
 LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
 
 else # NO_LIBELF
-BASIC_CFLAGS += -DLIBELF_SUPPORT
-
-FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
-   BASIC_CFLAGS += -DLIBELF_MMAP
-endif
-
 ifndef NO_DWARF
 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
msg := $(warning DWARF register mappings have not been defined for 
architecture $(ARCH), DWARF support disabled);
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 9ce522a..ef09d6c 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -108,3 +108,50 @@ ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
BASIC_CFLAGS += -I.
 endif
+
+ifdef NO_LIBELF
+   NO_DWARF := 1
+   NO_DEMANGLE := 1
+   NO_LIBUNWIND := 1
+else
+FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
+   FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
+   ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
+   LIBC_SUPPORT := 1
+   endif
+   ifeq ($(BIONIC),1)
+   LIBC_SUPPORT := 1
+   endif
+   ifeq ($(LIBC_SUPPORT),1)
+   msg := $(warning No libelf found, disables 'probe' tool, please 
install elfutils-libelf-devel/libelf-dev);
+
+   NO_LIBELF := 1
+   NO_DWARF := 1
+   NO_DEMANGLE := 1
+   else
+   msg := $(error No gnu/libc-version.h found, please install 
glibc-dev[el]/glibc-static);
+   endif
+else
+   # for linking with debug library, run like:
+   # make DEBUG=1 LIBDW_DIR=/opt/libdw/
+   ifdef LIBDW_DIR
+   LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
+   LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
+   endif
+
+   FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) 
$(ALL_LDFLAGS) $(EXTLIBS)
+   ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
+   msg := $(warning No libdw.h found or old libdw.h found or 
elfutils is older than 0.138, disables dwarf support. Please install new 
elfutils-devel/libdw-dev);
+   NO_DWARF := 1
+   endif # Dwarf support
+endif # SOURCE_LIBELF
+endif # NO_LIBELF
+
+ifndef NO_LIBELF
+BASIC_CFLAGS += -DLIBELF_SUPPORT
+FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)

[PATCH 06/27] perf tools: Move libelf check config into config/Makefile

2013-04-01 Thread Jiri Olsa
Moving libelf check config into config/Makefile.

Signed-off-by: Jiri Olsa jo...@redhat.com
Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net
Cc: Peter Zijlstra a.p.zijls...@chello.nl
Cc: Ingo Molnar mi...@elte.hu
Cc: Paul Mackerras pau...@samba.org
Cc: Corey Ashford cjash...@linux.vnet.ibm.com
Cc: Frederic Weisbecker fweis...@gmail.com
Cc: Namhyung Kim namhy...@kernel.org
Cc: Borislav Petkov b...@alien8.de
Cc: Stephane Eranian eran...@google.com
---
 tools/perf/Makefile| 46 -
 tools/perf/config/Makefile | 47 ++
 2 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index dcae71b..0ea3359 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -461,45 +461,6 @@ ifneq ($(MAKECMDGOALS),tags)
 # because maintaining the nesting to match is a pain.  If
 # we had elif things would have been much nicer...
 
-ifdef NO_LIBELF
-   NO_DWARF := 1
-   NO_DEMANGLE := 1
-   NO_LIBUNWIND := 1
-else
-FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
-   FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
-   ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
-   LIBC_SUPPORT := 1
-   endif
-   ifeq ($(BIONIC),1)
-   LIBC_SUPPORT := 1
-   endif
-   ifeq ($(LIBC_SUPPORT),1)
-   msg := $(warning No libelf found, disables 'probe' tool, please 
install elfutils-libelf-devel/libelf-dev);
-
-   NO_LIBELF := 1
-   NO_DWARF := 1
-   NO_DEMANGLE := 1
-   else
-   msg := $(error No gnu/libc-version.h found, please install 
glibc-dev[el]/glibc-static);
-   endif
-else
-   # for linking with debug library, run like:
-   # make DEBUG=1 LIBDW_DIR=/opt/libdw/
-   ifdef LIBDW_DIR
-   LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
-   LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
-   endif
-
-   FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) 
$(ALL_LDFLAGS) $(EXTLIBS)
-   ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
-   msg := $(warning No libdw.h found or old libdw.h found or 
elfutils is older than 0.138, disables dwarf support. Please install new 
elfutils-devel/libdw-dev);
-   NO_DWARF := 1
-   endif # Dwarf support
-endif # SOURCE_LIBELF
-endif # NO_LIBELF
-
 # There's only x86 (both 32 and 64) support for CFI unwind so far
 ifneq ($(ARCH),x86)
NO_LIBUNWIND := 1
@@ -541,13 +502,6 @@ BUILTIN_OBJS := $(filter-out 
$(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
 LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
 
 else # NO_LIBELF
-BASIC_CFLAGS += -DLIBELF_SUPPORT
-
-FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
-   BASIC_CFLAGS += -DLIBELF_MMAP
-endif
-
 ifndef NO_DWARF
 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
msg := $(warning DWARF register mappings have not been defined for 
architecture $(ARCH), DWARF support disabled);
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 9ce522a..ef09d6c 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -108,3 +108,50 @@ ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
BASIC_CFLAGS += -I.
 endif
+
+ifdef NO_LIBELF
+   NO_DWARF := 1
+   NO_DEMANGLE := 1
+   NO_LIBUNWIND := 1
+else
+FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
+   FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
+   ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
+   LIBC_SUPPORT := 1
+   endif
+   ifeq ($(BIONIC),1)
+   LIBC_SUPPORT := 1
+   endif
+   ifeq ($(LIBC_SUPPORT),1)
+   msg := $(warning No libelf found, disables 'probe' tool, please 
install elfutils-libelf-devel/libelf-dev);
+
+   NO_LIBELF := 1
+   NO_DWARF := 1
+   NO_DEMANGLE := 1
+   else
+   msg := $(error No gnu/libc-version.h found, please install 
glibc-dev[el]/glibc-static);
+   endif
+else
+   # for linking with debug library, run like:
+   # make DEBUG=1 LIBDW_DIR=/opt/libdw/
+   ifdef LIBDW_DIR
+   LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
+   LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
+   endif
+
+   FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) 
$(ALL_LDFLAGS) $(EXTLIBS)
+   ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
+   msg := $(warning No libdw.h found or old libdw.h found or 
elfutils is older than 0.138, disables dwarf support. Please install new 
elfutils-devel/libdw-dev);
+   NO_DWARF := 1