diff --git a/configure/CONFIG_PVACCESS_MODULE b/configure/CONFIG_PVACCESS_MODULE index 4ee8e3f..c8acb21 100644 --- a/configure/CONFIG_PVACCESS_MODULE +++ b/configure/CONFIG_PVACCESS_MODULE @@ -3,5 +3,16 @@ # in file LICENSE that is included with this distribution. #************************************************************************* -# LIbraries needed to link a pvAccess tool +# Libraries needed to link a pvAccess tool EPICS_BASE_PVA_CORE_LIBS = pvAccessIOC pvAccessCA pvAccess pvData + +ifneq ($(SKIP_PVA_AUTO_LIBS),YES) + +# automatically inject -lnetapi32 and -lws2_32 along with -lpvAccess +define _PVA_ADD_NETAPI +$(1)_SYS_LIBS_WIN32 += $$(if $$(findstring pvAccess,$$($(1)_LIBS)),netapi32 ws2_32) +endef + +$(foreach loc,PROD TESTPROD $(PROD) $(TESTPROD) LIB $(LIBRARY),$(eval $(call _PVA_ADD_NETAPI,$(loc)))) + +endif diff --git a/examples/Makefile b/examples/Makefile index 3aef798..213d459 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -3,7 +3,6 @@ TOP=.. include $(TOP)/configure/CONFIG PROD_LIBS += pvAccessCA ca pvAccess pvData Com -PROD_SYS_LIBS_WIN32 += netapi32 ws2_32 TESTPROD_HOST += getme getme_SRCS = getme.cpp diff --git a/pvtoolsSrc/Makefile b/pvtoolsSrc/Makefile index 1b3a3c1..6b332fa 100644 --- a/pvtoolsSrc/Makefile +++ b/pvtoolsSrc/Makefile @@ -30,8 +30,6 @@ pvlist_SRCS += pvlist.cpp PROD_LIBS += pvAccessCA pvAccess pvData ca Com -PROD_SYS_LIBS_WIN32 += netapi32 ws2_32 - include $(TOP)/configure/RULES #---------------------------------------- # ADD RULES AFTER THIS LINE diff --git a/src/ca/Makefile b/src/ca/Makefile index bf0e4ef..5e91fc4 100644 --- a/src/ca/Makefile +++ b/src/ca/Makefile @@ -6,9 +6,6 @@ pvAccessCA_LIBS += pvAccess pvData ca Com SHRLIB_VERSION ?= $(EPICS_PVA_MAJOR_VERSION).$(EPICS_PVA_MINOR_VERSION).$(EPICS_PVA_MAINTENANCE_VERSION) -# needed for Windows -LIB_SYS_LIBS_WIN32 += netapi32 ws2_32 - INC += pv/caProvider.h pvAccessCA_SRCS += channelConnectThread.cpp diff --git a/testApp/Makefile b/testApp/Makefile index 36f3675..4d59b61 100644 --- a/testApp/Makefile +++ b/testApp/Makefile @@ -11,7 +11,6 @@ USR_CPPFLAGS += -I$(TOP)/src/remoteClient PVACCESS_TEST = $(TOP)/testApp PROD_LIBS += pvAccess pvData Com -PROD_SYS_LIBS_WIN32 += netapi32 ws2_32 include $(PVACCESS_TEST)/utils/Makefile include $(PVACCESS_TEST)/remote/Makefile diff --git a/testCa/Makefile b/testCa/Makefile index 1b1ded0..47092ac 100644 --- a/testCa/Makefile +++ b/testCa/Makefile @@ -7,7 +7,6 @@ include $(TOP)/configure/CONFIG USR_CPPFLAGS += -I$(TOP)/src/ca PROD_LIBS += pvAccess pvAccessCA pvData $(EPICS_BASE_IOC_LIBS) -PROD_SYS_LIBS_WIN32 += netapi32 ws2_32 TESTPROD_HOST += testCaProvider testCaProvider_SRCS += testCaProvider.cpp