Merge pull request #3406 from josuah/master

Better compatibility for OpenBSD
This commit is contained in:
Miodrag Milanović 2022-07-25 16:10:29 +02:00 committed by GitHub
commit d4875ceae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View File

@ -126,8 +126,10 @@ endif
else else
LDFLAGS += -rdynamic LDFLAGS += -rdynamic
ifneq ($(OS), OpenBSD)
LDLIBS += -lrt LDLIBS += -lrt
endif endif
endif
YOSYS_VER := 0.19+25 YOSYS_VER := 0.19+25
@ -395,7 +397,7 @@ endif # ENABLE_PYOSYS
ifeq ($(ENABLE_READLINE),1) ifeq ($(ENABLE_READLINE),1)
CXXFLAGS += -DYOSYS_ENABLE_READLINE CXXFLAGS += -DYOSYS_ENABLE_READLINE
ifeq ($(OS), FreeBSD) ifeq ($(OS), $(filter $(OS),FreeBSD OpenBSD NetBSD))
CXXFLAGS += -I/usr/local/include CXXFLAGS += -I/usr/local/include
endif endif
LDLIBS += -lreadline LDLIBS += -lreadline
@ -430,7 +432,7 @@ endif
ifeq ($(ENABLE_PLUGINS),1) ifeq ($(ENABLE_PLUGINS),1)
CXXFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags libffi) -DYOSYS_ENABLE_PLUGINS CXXFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags libffi) -DYOSYS_ENABLE_PLUGINS
LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs libffi || echo -lffi) LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs libffi || echo -lffi)
ifneq ($(OS), FreeBSD) ifneq ($(OS), $(filter $(OS),FreeBSD OpenBSD NetBSD))
LDLIBS += -ldl LDLIBS += -ldl
endif endif
endif endif
@ -447,10 +449,13 @@ endif
ifeq ($(ENABLE_TCL),1) ifeq ($(ENABLE_TCL),1)
TCL_VERSION ?= tcl$(shell bash -c "tclsh <(echo 'puts [info tclversion]')") TCL_VERSION ?= tcl$(shell bash -c "tclsh <(echo 'puts [info tclversion]')")
ifeq ($(OS), FreeBSD) ifeq ($(OS), $(filter $(OS),FreeBSD OpenBSD NetBSD))
# BSDs usually use tcl8.6, but the lib is named "libtcl86"
TCL_INCLUDE ?= /usr/local/include/$(TCL_VERSION) TCL_INCLUDE ?= /usr/local/include/$(TCL_VERSION)
TCL_LIBS ?= -l$(subst .,,$(TCL_VERSION))
else else
TCL_INCLUDE ?= /usr/include/$(TCL_VERSION) TCL_INCLUDE ?= /usr/include/$(TCL_VERSION)
TCL_LIBS ?= -l$(TCL_VERSION)
endif endif
ifeq ($(CONFIG),mxe) ifeq ($(CONFIG),mxe)
@ -458,12 +463,7 @@ CXXFLAGS += -DYOSYS_ENABLE_TCL
LDLIBS += -ltcl86 -lwsock32 -lws2_32 -lnetapi32 -lz -luserenv LDLIBS += -ltcl86 -lwsock32 -lws2_32 -lnetapi32 -lz -luserenv
else else
CXXFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags tcl || echo -I$(TCL_INCLUDE)) -DYOSYS_ENABLE_TCL CXXFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags tcl || echo -I$(TCL_INCLUDE)) -DYOSYS_ENABLE_TCL
ifeq ($(OS), FreeBSD) LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs tcl || echo $(TCL_LIBS))
# FreeBSD uses tcl8.6, but lib is named "libtcl86"
LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs tcl || echo -l$(TCL_VERSION) | tr -d '.')
else
LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs tcl || echo -l$(TCL_VERSION))
endif
endif endif
endif endif

View File

@ -21,7 +21,7 @@
#undef HAVE_LIBPTHREAD #undef HAVE_LIBPTHREAD
#undef HAVE_FSEEKO #undef HAVE_FSEEKO
#endif #endif
#ifdef __FreeBSD__ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#undef HAVE_ALLOCA_H #undef HAVE_ALLOCA_H
#endif #endif