From: Ingo Schwarze Date: Fri, 20 Jun 2014 02:55:49 +0000 (+0000) Subject: let the build system cope with the recent ohash changes X-Git-Tag: VERSION_1_13_1~144 X-Git-Url: https://git.cameronkatri.com/mandoc.git/commitdiff_plain/b7a2831fbcd6d60e1569cdd4aa4e19945ffd5c60?ds=inline let the build system cope with the recent ohash changes --- diff --git a/Makefile b/Makefile index 2bf63401..b6a1dc9b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.419 2014/04/24 00:29:45 schwarze Exp $ +# $Id: Makefile,v 1.420 2014/06/20 02:55:49 schwarze Exp $ # # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons # Copyright (c) 2011, 2013, 2014 Ingo Schwarze @@ -66,6 +66,10 @@ INSTALL_MAN = $(INSTALL_DATA) DBLIB = -L/usr/local/lib -lsqlite3 DBBIN = makewhatis manpage apropos +# OpenBSD has the ohash functions in libutil. +# Comment the following line if your system doesn't. +DBLIB += -lutil + # === END OF USER SETTINGS ============================================= ALLBIN = mandoc preconv demandoc $(DBBIN) diff --git a/configure b/configure index 1e4788c9..5ddaec1a 100755 --- a/configure +++ b/configure @@ -20,8 +20,8 @@ exec > config.h 2> config.log CFLAGS="${CFLAGS} -Wno-unused -Werror" runtest() { - echo ${CC} ${CFLAGS} -o test-${1} test-${1}.c 1>&2 - ${CC} ${CFLAGS} -o "test-${1}" "test-${1}.c" 1>&2 || return 0 + echo ${CC} ${CFLAGS} ${3} -o test-${1} test-${1}.c 1>&2 + ${CC} ${CFLAGS} ${3} -o "test-${1}" "test-${1}.c" 1>&2 || return 0 "./test-${1}" && echo "#define HAVE_${2}" \ || echo FAILURE: test-${1} returned $? 1>&2 rm "test-${1}" @@ -33,7 +33,7 @@ echo "#define VERSION \"${VERSION}\"" runtest fgetln FGETLN runtest getsubopt GETSUBOPT runtest mmap MMAP -runtest ohash OHASH +runtest ohash OHASH -lutil runtest reallocarray REALLOCARRAY runtest strcasestr STRCASESTR runtest strlcat STRLCAT diff --git a/test-ohash.c b/test-ohash.c index 84d1b677..522ad708 100644 --- a/test-ohash.c +++ b/test-ohash.c @@ -3,16 +3,18 @@ #include #include -void *xalloc(size_t sz, void *arg) { return(calloc(sz,1)); } -void xfree(void *p, size_t sz, void *arg) { free(p); } +void *xmalloc(size_t sz, void *arg) { return(calloc(1,sz)); } +void *xcalloc(size_t nmemb, size_t sz, void *arg) { return(calloc(nmemb,sz)); } +void xfree(void *p, void *arg) { free(p); } int main(void) { struct ohash h; struct ohash_info i; - i.halloc = i.alloc = xalloc; - i.hfree = xfree; + i.alloc = xmalloc; + i.calloc = xcalloc; + i.free = xfree; ohash_init(&h, 2, &i); ohash_delete(&h); return 0;