Fix build under NetBSD with native X.org (/usr/X11R7) and modular X.org (/usr/pkg)

* Use pkg-config for X.org
* Exclude -liconv for NetBSD too
* sysctl(3) of NetBSD requres _NETBSD_SOURCE
This commit is contained in:
Ryo ONODERA 2018-07-24 23:58:20 +09:00
parent 715bda292b
commit 244e856e9f

View File

@ -508,17 +508,23 @@ endif
COPT += -D_XOPEN_SOURCE=700
endif
ifeq ($(PLATFORM), NetBSD)
COPT += -D_NETBSD_SOURCE
endif
LOPT = -lm
ifeq ($(API),sdl)
LOPT += $(shell sdl-config --libs) -lSDL_image
ifneq ($(NO_X11),1)
LOPT += -lX11
LOPT += $(shell pkg-config --libs x11)
COPT += $(shell pkg-config --cflags x11)
endif
endif
ifeq ($(API),sdl2)
LOPT += $(shell sdl2-config --libs) -lSDL2_image
ifneq ($(NO_X11),1)
LOPT += -lX11
LOPT += $(shell pkg-config --libs x11)
COPT += $(shell pkg-config --cflags x11)
endif
endif
ifeq ($(NO_X11),1)
@ -534,7 +540,7 @@ endif
# enable UTF8 filename translation
# For Linux (GLibc), iconv is built into the C library so no LOPT needed.
COPT += -DENABLE_FILENAMES_ICONV
ifneq ($(PLATFORM),Linux)
ifeq ($(filter-out NetBSD Linux, $(PLATFORM))),)
LOPT += -liconv
endif