libxml2: restrict _POSIX_C_SOURCE to Linux

Fix build breakage with FreeBSD, where some definitions were then hidden
by __BSD_VISIBLE not being defined, e.g.:

  CC       libxml2_la-nanohttp.lo
nanohttp.c:837:20: error: use of undeclared identifier 'PF_INET6'
        s = socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP);
                   ^
nanohttp.c:842:20: error: use of undeclared identifier 'PF_INET'
        s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
                   ^
2 errors generated.

(Tested on FreeBSD 14 and Fedora Linux 39.)
This commit is contained in:
gutteridge 2024-01-30 00:12:48 +00:00
parent c0b29f609b
commit 29d53481bc
1 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.178 2024/01/27 21:07:16 sjmulder Exp $
# $NetBSD: Makefile,v 1.179 2024/01/30 00:12:48 gutteridge Exp $
.include "../../textproc/libxml2/Makefile.common"
@ -23,7 +23,7 @@ USE_LANGUAGES+= c
FORCE_C_STD= c99
# for struct addrinfo on glibc
CPPFLAGS+= -D_POSIX_C_SOURCE=200112L
CPPFLAGS.Linux+= -D_POSIX_C_SOURCE=200112L
TEST_TARGET= check