# compiler flags

ADDITIONAL_INCLUDE_DIRS += \
	-I..				\
	-I../../sope-core/NGExtensions	\
	-I../../sope-core		\
	-I/usr/local/include

ifneq ($(FOUNDATION_LIB),apple)
ADDITIONAL_INCLUDE_DIRS += -I/usr/local/openldap/include
SYSTEM_LIB_DIR += -L/usr/local/openldap/lib
endif


libNGLdap_LIBRARIES_DEPEND_UPON += \
	-lNGExtensions -lEOControl	\
	-lDOM -lSaxObjC

ifeq ($(reentrant),yes)
ADDITIONAL_CPPFLAGS += -D_REENTRANT=1
libNGLdap_LIBRARIES_DEPEND_UPON += -lldap_r -llber -lpthread
else
libNGLdap_LIBRARIES_DEPEND_UPON += -lldap -llber
endif

ifneq ($(FOUNDATION_LIB),nx)

ifeq ($(sasl),yes)
libNGLdap_LIBRARIES_DEPEND_UPON += -lsasl
endif
ifneq ($(nossl),yes)
libNGLdap_LIBRARIES_DEPEND_UPON += -lssl
endif

else

ADDITIONAL_LDFLAGS += -framework Foundation

endif

ADDITIONAL_CPPFLAGS += -Wall -Wno-protocol


ifneq ($(GNUSTEP_BUILD_DIR),)
RELBUILD_DIR_SxCore=$(GNUSTEP_BUILD_DIR)/../../sope-core
RELBUILD_DIR_SxXml=$(GNUSTEP_BUILD_DIR)/../../sope-xml

ADDITIONAL_LIB_DIRS += \
	-L$(GNUSTEP_OBJ_DIR)						\
	-L$(RELBUILD_DIR_SxCore)/NGStreams/$(GNUSTEP_OBJ_DIR_NAME)	\
	-L$(RELBUILD_DIR_SxCore)/NGExtensions/$(GNUSTEP_OBJ_DIR_NAME)	\
	-L$(RELBUILD_DIR_SxCore)/EOControl/$(GNUSTEP_OBJ_DIR_NAME)	\
	-L$(RELBUILD_DIR_SxXml)/DOM/$(GNUSTEP_OBJ_DIR_NAME)		\
	-L$(RELBUILD_DIR_SxXml)/SaxObjC/$(GNUSTEP_OBJ_DIR_NAME)
else
ADDITIONAL_LIB_DIRS += \
	-L./$(GNUSTEP_OBJ_DIR)					\
	-L../../sope-core/NGStreams/$(GNUSTEP_OBJ_DIR)		\
	-L../../sope-core/NGExtensions/$(GNUSTEP_OBJ_DIR)	\
	-L../../sope-xml/DOM/$(GNUSTEP_OBJ_DIR)			\
	-L../../sope-xml/SaxObjC/$(GNUSTEP_OBJ_DIR)		\
	-L../../sope-core/EOControl/$(GNUSTEP_OBJ_DIR)
endif

SYSTEM_LIB_DIR += -L/usr/local/lib

# Apple

ifeq ($(FOUNDATION_LIB),apple)
libNGLdap_PREBIND_ADDR="0xC1C00000"
libNGLdap_LDFLAGS += -seg1addr $(libNGLdap_PREBIND_ADDR)
endif