# [PATCH] Fix compilation on newer NetBSD systems

3 messages from 2006-05-11 to 2006-05-15. Participants: Dennis Stosberg, Junio C Hamano.
Thread: https://gitlist.dev/t/4120

## Dennis Stosberg, 2006-05-11 17:35

Subject: [PATCH] Fix compilation on newer NetBSD systems
Message-ID: <20060511173531.G18d4553c@leonov.stosberg.net>
URL: https://gitlist.dev/e/20060511173531.G18d4553c%40leonov.stosberg.net

```
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
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, 2006-05-15 05:31

Subject: Re: [PATCH] Fix compilation on newer NetBSD systems
Message-ID: <7vu07rx3a9.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vu07rx3a9.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20060511173531.G18d4553c@leonov.stosberg.net>

```
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, 2006-05-15 12:41

Subject: Re: [PATCH] Fix compilation on newer NetBSD systems
Message-ID: <20060515124115.G78828137@leonov.stosberg.net>
URL: https://gitlist.dev/e/20060515124115.G78828137%40leonov.stosberg.net
In-Reply-To: <7vu07rx3a9.fsf@assigned-by-dhcp.cox.net>

```
Junio C Hamano wrote:

> 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

```
