# compilation settings

libNGStreams_INCLUDE_DIRS += \
	-INGStreams		\
	-I../NGExtensions	\
	-I..

NGStreams_INCLUDE_DIRS += $(libNGStreams_INCLUDE_DIRS)

# dependencies

libNGStreams_LIBRARIES_DEPEND_UPON += \
	-lz $(BASE_LIBS)
NGStreams_LIBRARIES_DEPEND_UPON += \
	-framework NGExtensions -framework EOControl	\
	-framework DOM -framework SaxObjC		\
	-lz


# library/framework search pathes

DEP_DIRS = \
	../NGExtensions	\
	../EOControl	\
	../../sope-xml/DOM ../../sope-xml/SaxObjC

ifneq ($(frameworks),yes)
ADDITIONAL_LIB_DIRS += \
	$(foreach dir,$(DEP_DIRS),\
	  -L$(GNUSTEP_BUILD_DIR)/$(dir)/$(GNUSTEP_OBJ_DIR_NAME))
else
ADDITIONAL_LIB_DIRS += \
	$(foreach dir,$(DEP_DIRS),-F$(GNUSTEP_BUILD_DIR)/$(dir))
endif

ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64)
ifeq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd)
SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib
else
SYSTEM_LIB_DIR += -L/usr/local/lib64 -L/usr/lib64
endif
else
SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib
endif

# activating SSL support
ifeq ($(HAS_LIBRARY_gnutls),yes)
libNGStreams_OBJC_FILES += NGActiveSSLSocket.m
NGStreams_OBJC_FILES += NGActiveSSLSocket.m
ADDITIONAL_CPPFLAGS += -DHAVE_GNUTLS=1
libNGStreams_LIBRARIES_DEPEND_UPON += -lgnutls
NGStreams_LIBRARIES_DEPEND_UPON += -lgnutls
else
ifeq ($(HAS_LIBRARY_ssl),yes)
libNGStreams_OBJC_FILES += NGActiveSSLSocket.m
NGStreams_OBJC_FILES += NGActiveSSLSocket.m
ADDITIONAL_CPPFLAGS += -DHAVE_OPENSSL=1 -DOPENSSL_NO_KRB5
libNGStreams_LIBRARIES_DEPEND_UPON += -lssl -lcrypto
NGStreams_LIBRARIES_DEPEND_UPON += -lssl -lcrypto
endif
endif

# pass CA bundle
ifdef CA_BUNDLE
ADDITIONAL_CPPFLAGS += -DCA_BUNDLE="\"$(CA_BUNDLE)\""
endif

ADDITIONAL_CPPFLAGS += -Wall -Wno-protocol

# reentrant

ifeq ($(reentrant),yes)
ADDITIONAL_CPPFLAGS += -D_REENTRANT=1
endif

# Apple

ifeq ($(FOUNDATION_LIB),apple)
libNGStreams_PREBIND_ADDR="0xC1400000"
libNGStreams_LDFLAGS += -seg1addr $(libNGStreams_PREBIND_ADDR)
NGStreams_LDFLAGS += -seg1addr $(libNGStreams_PREBIND_ADDR)
endif
