diff --git a/configure/CONFIG_PVXS_MODULE b/configure/CONFIG_PVXS_MODULE index 81074fd..5e479d9 100644 --- a/configure/CONFIG_PVXS_MODULE +++ b/configure/CONFIG_PVXS_MODULE @@ -11,6 +11,7 @@ ifdef T_A # use custom libevent2 install prefix by: # setting LIBEVENT only for single arch build # setting LIBEVENT_$(T_A) for each arch +# leave unset to use implicit system search path # NOTE: only needed if not present in default search paths LIBEVENT ?= $(LIBEVENT_$(T_A)) @@ -20,28 +21,18 @@ LIBEVENT_$(T_A) ?= $(wildcard $(abspath $(_PVXS)/../bundle/usr/$(T_A))) # apply to include search paths INCLUDES += $(if $(LIBEVENT),-I$(LIBEVENT)/include) -ifeq (msvc,$(CMPLR_CLASS)) -# Select lib file directly -LIBEVENT_SYS_LIBS = $(LIBEVENT)/lib/event_core +LIBEVENT_BUNDLE_LIBS += event_core +LIBEVENT_BUNDLE_LIBS_POSIX_YES = event_pthreads +LIBEVENT_BUNDLE_LIBS += $(LIBEVENT_BUNDLE_LIBS_POSIX_$(POSIX)) -else -# apply to library search paths, and -rpath -_PVXS_DEPLIB_DIRS += $(if $(LIBEVENT),$(LIBEVENT)/lib) - -PROD_DEPLIB_DIRS += $(_PVXS_DEPLIB_DIRS) -SHRLIB_DEPLIB_DIRS += $(_PVXS_DEPLIB_DIRS) - -LIBEVENT_SYS_LIBS = event_core - -endif - -# automatically add necessary libraries -LIBEVENT_SYS_LIBS_POSIX_YES = event_pthreads LIBEVENT_SYS_LIBS_WIN32 = iphlpapi netapi32 ws2_32 - -LIBEVENT_SYS_LIBS += $(LIBEVENT_SYS_LIBS_POSIX_$(POSIX)) LIBEVENT_SYS_LIBS += $(LIBEVENT_SYS_LIBS_$(OS_CLASS)) +event_core_DIR = $(LIBEVENT)/lib +event_pthreads_DIR = $(LIBEVENT)/lib + endif # T_A endif # _PVXS_CONF_INCLUDED + +# logic continues in RULES_PVXS_MODULE diff --git a/configure/RULES_PVXS_MODULE b/configure/RULES_PVXS_MODULE index 05074e7..87154f9 100644 --- a/configure/RULES_PVXS_MODULE +++ b/configure/RULES_PVXS_MODULE @@ -1,4 +1,6 @@ +# logic continues from CONFIG_PVXS_MODULE + # we're appending so must be idempotent ifeq (,$(_PVXS_RULE_INCLUDED)) _PVXS_RULE_INCLUDED := YES @@ -9,11 +11,24 @@ endif _PVXS_CHECK_VARS := PROD TESTPROD $(PROD) $(TESTPROD) $(LIBRARY) +ifeq (,$(LIBEVENT)) + # $(1) is PROD or LIBRARY name define _PVXS_ADD_LIBEVENT -$(1)_SYS_LIBS += $$(if $$(findstring pvxs,$$($(1)_LIBS)),$$(LIBEVENT_SYS_LIBS)) +$(1)_SYS_LIBS := $$($(1)_SYS_LIBS) $$(if $$(filter pvxs,$$($(1)_LIBS)),$$(LIBEVENT_BUNDLE_LIBS)) +$(1)_SYS_LIBS := $$($(1)_SYS_LIBS) $$(if $$(filter pvxs,$$($(1)_LIBS)),$$(LIBEVENT_SYS_LIBS)) endef +else + +# $(1) is PROD or LIBRARY name +define _PVXS_ADD_LIBEVENT +$(1)_LIBS := $$($(1)_LIBS) $$(if $$(filter pvxs,$$($(1)_LIBS)),$$(LIBEVENT_BUNDLE_LIBS)) +$(1)_SYS_LIBS := $$($(1)_SYS_LIBS) $$(if $$(filter pvxs,$$($(1)_LIBS)),$$(LIBEVENT_SYS_LIBS)) +endef + +endif + $(foreach loc,$(_PVXS_CHECK_VARS),$(eval $(call _PVXS_ADD_LIBEVENT,$(loc)))) endif # _PVXS_RULE_INCLUDED diff --git a/src/Makefile b/src/Makefile index 0f2152c..a48baf8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -95,6 +95,14 @@ LIB_SRCS += clientget.cpp LIB_SRCS += clientmon.cpp LIB_LIBS += Com + +# special case matching configure/RULES_PVXS_MODULE +ifeq (,$(LIBEVENT)) +LIB_SYS_LIBS += $(LIBEVENT_BUNDLE_LIBS) +else +LIB_LIBS += $(LIBEVENT_BUNDLE_LIBS) +endif + LIB_SYS_LIBS += $(LIBEVENT_SYS_LIBS) #===========================