Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Use libbsd if available.
Vsevolod Stakhov committed 11 years ago
commit 64a2425b2724e568b16a2049e011088e010406ef
parent fd859d6
4 files changed +26 -2
modified compat/Makefile.am
@@ -12,3 +12,7 @@ libbsd_compat_la_SOURCES= basename.c \
				strnstr.c

libbsd_compat_la_CFLAGS=	$(pkg_common_cflags) -shared
+

+
if HAVE_LIBBSD
+
libbsd_compat_la_LIBADD=	-lbsd
+
endif
modified compat/bsd_compat.h
@@ -27,9 +27,14 @@
#ifndef _BSD_COMPAT_H
#define _BSD_COMPAT_H

+
#include "pkg_config.h"
+

#include <sys/stat.h>

-
#include "pkg_config.h"
+
#ifdef HAVE_BSD_STDLIB_H
+
#include <bsd/stdlib.h>
+
#endif
+

#include "endian_util.h"

char *bsd_dirname(const char *);
@@ -110,6 +115,10 @@ char * strnstr(const char *s, const char *find, size_t slen);
#define ENEEDAUTH 81
#endif

+
#ifndef MAXLOGNAME
+
#define MAXLOGNAME 33
+
#endif
+

#ifndef __DECONST
#define __DECONST(type, var)    ((type)(uintptr_t)(const void *)(var))
#endif
modified configure.ac
@@ -111,6 +111,7 @@ AC_CHECK_HEADERS_ONCE([sys/socket.h])
AC_CHECK_HEADERS_ONCE([netinet/in.h])
AC_CHECK_HEADERS_ONCE([netinet/in6.h])
AC_CHECK_HEADERS_ONCE([dirent.h], [sys/ndir.h], [sys/dir.h], [ndir.h])
+
AC_CHECK_HEADERS_ONCE([bsd/stdlib.h])

AC_CHECK_HEADER([regex.h], [
	AC_DEFINE(HAVE_REGEX_H, 1, [Define to 1 if you have the <regex.h> header file.])
@@ -148,7 +149,8 @@ AC_CHECK_MEMBERS([struct in6_addr.s6_addr32,
	struct in6_addr.s6_addr16, 
	struct sockaddr_in.sin_len, 
	struct sockaddr_in6.sin6_len, 
-
	struct sockaddr_storage.ss_family, 
+
	struct sockaddr_storage.ss_len,
+
	struct sockaddr_storage.ss_family,
	struct sockaddr_storage.__ss_family], , ,
[#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
@@ -220,6 +222,11 @@ AC_SEARCH_LIBS([jail_getid], [jail], [
	AC_DEFINE(HAVE_LIBJAIL, 1, [Define to 1 if you have the 'jail' library (-ljail).])
	LIBJAIL_LIB="-ljail"
	], [])
+
	
+
AC_SEARCH_LIBS([getprogname], [bsd], [
+
	AC_DEFINE(HAVE_LIBBSD, 1, [Define to 1 if you have the 'bsd' library (-lbsd).])
+
	LIBBSD_LIB="-lbsd"
+
	], [])

AC_CHECK_HEADERS([gelf.h libelf.h], [
	AC_CHECK_TYPES([Elf_Note], [
modified libpkg/Makefile.am
@@ -99,6 +99,10 @@ if HAVE_MACHO_ABI
libpkg_la_LIBADD+=	$(top_builddir)/external/libmachista_static.la
endif

+
if HAVE_LIBBSD
+
libpkg_la_LIBADD+=	-lbsd
+
endif
+

libpkg_la_LDFLAGS=	-version-info @LIBPKG_SO_VERSION@
EXTRA_libpkg_la_DEPENDENCIES=	@REPOS_LDADD@