Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
* trace-cmd: Only add udis86 CFLAGS and LDFLAGS if it is found
@ 2019-07-24 19:13 Steven Rostedt
  2019-07-24 21:07 ` Patrick McLean
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2019-07-24 19:13 UTC (permalink / raw)
  To: Linux Trace Devel; +Cc: howaboutsynergy, Patrick McLean

[ Patrick, I don't have udis86 on my machines, can you test to see if
  this will include it if you do not set NO_UDIS86? ]

As we need to update both LDFLAGS and CFLAGS, move the test to see if
udisc86 is installed to a variable, and then set NO_UDIS86 if it is not
found. This way we do not need to test if it exists twice, nor have
LDFLAGS set unconditionally.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204277

Reported-by: howaboutsynergy@pm.me
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
diff --git a/Makefile b/Makefile
index 0aa98517..e98535ea 100644
--- a/Makefile
+++ b/Makefile
@@ -136,9 +136,14 @@ export NO_PYTHON
 test-build = $(if $(shell sh -c 'echo "$(1)" | \
 	$(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y'), $2)
 
+UDIS86_AVAILABLE := $(call test-build,\#include <udis86.h>, y)
+ifneq ($(UDIS86_AVAILABLE), y)
+NO_UDIS86 := 1
+endif
+
 ifndef NO_UDIS86
 # have udis86 disassembler library?
-udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86)
+udis86-flags := -DHAVE_UDIS86 -ludis86
 udis86-ldflags := -ludis86
 endif # NO_UDIS86
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: trace-cmd: Only add udis86 CFLAGS and LDFLAGS if it is found
  2019-07-24 19:13 trace-cmd: Only add udis86 CFLAGS and LDFLAGS if it is found Steven Rostedt
@ 2019-07-24 21:07 ` Patrick McLean
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McLean @ 2019-07-24 21:07 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Linux Trace Devel, howaboutsynergy

On Wed, 24 Jul 2019 15:13:49 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> [ Patrick, I don't have udis86 on my machines, can you test to see if
>   this will include it if you do not set NO_UDIS86? ]
> 
> As we need to update both LDFLAGS and CFLAGS, move the test to see if
> udisc86 is installed to a variable, and then set NO_UDIS86 if it is
> not found. This way we do not need to test if it exists twice, nor
> have LDFLAGS set unconditionally.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204277
> 
> Reported-by: howaboutsynergy@pm.me
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
> diff --git a/Makefile b/Makefile
> index 0aa98517..e98535ea 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -136,9 +136,14 @@ export NO_PYTHON
>  test-build = $(if $(shell sh -c 'echo "$(1)" | \
>  	$(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y'),
> $2) 
> +UDIS86_AVAILABLE := $(call test-build,\#include <udis86.h>, y)
> +ifneq ($(UDIS86_AVAILABLE), y)

The value of UDIS86_AVAILABLE ends up having whitespace, so this line
always fails. If you change it to the line below, it works.
ifneq ($(strip $(UDIS86_AVAILABLE)), y)

> +NO_UDIS86 := 1
> +endif
> +
>  ifndef NO_UDIS86
>  # have udis86 disassembler library?
> -udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86
> -ludis86) +udis86-flags := -DHAVE_UDIS86 -ludis86
>  udis86-ldflags := -ludis86
>  endif # NO_UDIS86
>  


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24 19:13 trace-cmd: Only add udis86 CFLAGS and LDFLAGS if it is found Steven Rostedt
2019-07-24 21:07 ` Patrick McLean

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org linux-trace-devel@archiver.kernel.org
	public-inbox-index linux-trace-devel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox