threads / patch / 4120

patchFix compilation on newer NetBSD systems

Subject: [PATCH] Fix compilation on newer NetBSD systems

## tl;dr

3 messages between May 11, 2006 and May 15, 2006. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Dennis Stosberg· May 11, 2006, 17:35 UTC · lore

NetBSD >=2.0 has iconv() in libc. A libiconv is not required and does not exist.

See: http://netbsd.gw.com/cgi-bin/man-cgi?iconv+3+NetBSD-2.0
Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---
 Makefile |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
2a73fcf43bfd1f73ec5e1e50396d54b83abae5e1
Show changes to Makefile +3 −1
diff --git a/Makefile b/Makefile
index 37fbe78..26fa4e6 100644
--- a/Makefile
+++ b/Makefile
@@ -285,7 +285,9 @@ ifeq ($(uname_S),OpenBSD)
 	ALL_LDFLAGS += -L/usr/local/lib
 endif
 ifeq ($(uname_S),NetBSD)
-	NEEDS_LIBICONV = YesPlease
+	ifeq ($(shell test `uname -r | sed -e 's/^\([0-9]\).*/\1/'` -lt 2 && echo y),y)
+		NEEDS_LIBICONV = YesPlease
+	endif
 	ALL_CFLAGS += -I/usr/pkg/include
 	ALL_LDFLAGS += -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib
 endif
-- 
1.3.2.gbe65
Junio C Hamano· May 15, 2006, 05:31 UTC · re: Dennis Stosberg · lore

Re: [PATCH] Fix compilation on newer NetBSD systems

Dennis Stosberg <dennis@stosberg.net> writes:
> NetBSD >=2.0 has iconv() in libc.  A libiconv is not required and
> does not exist.
I do not doubt that, but...
> +	ifeq ($(shell test `uname -r | sed -e 's/^\([0-9]\).*/\1/'` -lt 2 && echo y),y)
> +		NEEDS_LIBICONV = YesPlease
> +	endif

This looks rather ugly. I do not know if NetBSD has 0.xx versions, but perhaps something like this?

	ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
Dennis Stosberg· May 15, 2006, 12:41 UTC · re: Junio C Hamano · lore

Re: [PATCH] Fix compilation on newer NetBSD systems

Junio C Hamano wrote:
Show 10 quoted lines
> Dennis Stosberg <dennis@stosberg.net> writes:
> 
> > +	ifeq ($(shell test `uname -r | sed -e 's/^\([0-9]\).*/\1/'` -lt 2 && echo y),y)
> > +		NEEDS_LIBICONV = YesPlease
> > +	endif
> 
> This looks rather ugly.  I do not know if NetBSD has 0.xx
> versions, but perhaps something like this?
> 
> 	ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)

Admittedly, that looks a lot nicer. And it works correctly with NetBSD's "expr", too.

Regards, Dennis

← back to recent threads