[Re-devel] [re] on OpenBSD

Dmitrij D. Czarkoff czarkoff at gmail.com
Tue Sep 16 12:58:33 CEST 2014


Dmitrij D. Czarkoff said:
> Hi!
> 
> My patch which allows building libre on OpenBSD is inlined below.  The
> problem I am trying to solve is that OpenBSD has no "res_close()"
> function.  As I gather, the style of re requires defining
> positively-named macros, so I define "HAVE_RES_CLOSE" in "mk/re.mk" for
> all systems except OpenBSD.
> 
> Alternative options would be:
> 
>  1. Run grep on "${SYSROOT}/include/resolv.h" for "res_close"
>     definition. This is tricky because of different styles, but doable,
>     I believe.
>  2. Use something like
> 
>   #ifdef OPENBSD
>   #define res_close() ;
>   #endif
> 
>     but it is too ugly and inconsistent with the rest of library.
> 
> The other problem I am solving here is that OpenBSD, just like FreeBSD,
> lacks libresolv.
> 
> -- 
> Dmitrij D. Czarkoff
> 
> diff -r 0d4037fefaad mk/re.mk
> --- a/mk/re.mk	Fri Apr 11 17:00:49 2014 +0000
> +++ b/mk/re.mk	Wed Sep 10 15:07:32 2014 +0200
> @@ -499,9 +499,15 @@
>  ifneq ($(HAVE_LIBRESOLV),)
>  CFLAGS  += -DHAVE_LIBRESOLV
>  ifneq ($(OS),freebsd)
> +ifneq ($(OS),openbsd)
>  LIBS    += -lresolv
>  endif
>  endif
> +ifneq ($(OS),openbsd)
> +CFLAGs	+= -DHAVE_RES_CLOSE
> +endif
> +endif
> +
>  ifneq ($(HAVE_SYSLOG),)
>  CFLAGS  += -DHAVE_SYSLOG
>  endif
> diff -r 0d4037fefaad src/dns/res.c
> --- a/src/dns/res.c	Fri Apr 11 17:00:49 2014 +0000
> +++ b/src/dns/res.c	Wed Sep 10 15:07:32 2014 +0200
> @@ -60,7 +60,9 @@
>  	*n = i;
>  
>   out:
> +#ifdef HAVE_RES_CLOSE
>  	res_close();
> +#endif
>  
>  	return err;
>  }

Ping.

-- 
Dmitrij D. Czarkoff

_______________________________________________
Re-devel mailing list
Re-devel at lists.creytiv.com
http://lists.creytiv.com/mailman/listinfo/re-devel



More information about the Re-devel mailing list