# compilation settings

SOGo_INCLUDE_DIRS += -I.. -I../../UI 

HOSTNAME ?= $(shell hostname -f)
BUILD_DATE = $(shell echo $$USER@$(HOSTNAME); date +"%Y%m%d%H%M")

ADDITIONAL_CPPFLAGS += \
        -DSOGO_BUILD_DATE="@\"$(BUILD_DATE)\"" \
        -DSOGO_LIBDIR="\"$(SOGO_LIBDIR)\"" \
        -DSOGO_MAJOR_VERSION="@\"$(MAJOR_VERSION)\"" \
        -DSOGO_MINOR_VERSION="@\"$(MINOR_VERSION)\"" \
        -DSOGO_SUBMINOR_VERSION="@\"$(SUBMINOR_VERSION)\""


SOGo_LIBRARIES_DEPEND_UPON += \
        -Wl,--no-as-needed \
	-L../../SOPE/NGCards/$(GNUSTEP_OBJ_DIR)/ \
	-lmemcached		\
	-lcurl \
	-lGDLAccess		\
	-lNGObjWeb		\
	-lNGCards		\
	-lNGMime		\
	-lNGStreams -lNGExtensions -lEOControl \
	-lDOM -lSaxObjC \
	-lNGLdap -lSBJson \
        -lGDLContentStore \
        $(BASE_LIBS)

ifeq ($(HAS_LIBRARY_gnutls),yes)
ADDITIONAL_CPPFLAGS += -DHAVE_GNUTLS=1
SOGo_LIBRARIES_DEPEND_UPON += -lgnutls
SOGo_C_FILES += md4.c
else
ifeq ($(HAS_LIBRARY_ssl),yes)
ADDITIONAL_CPPFLAGS += -DHAVE_OPENSSL=1
SOGo_LIBRARIES_DEPEND_UPON += -lcrypto
endif
endif

ifeq ($(HAS_LIBRARY_lasso), yes)
ADDITIONAL_CPPFLAGS += $(LASSO_CFLAGS)
SOGo_LIBRARIES_DEPEND_UPON += $(LASSO_LIBS)
endif

ifeq ($(HAS_LIBRARY_oath), yes)
SOGo_LIBRARIES_DEPEND_UPON += $(MFA_LIBS)
endif

ifeq ($(HAS_LIBRARY_sodium), yes)
ADDITIONAL_CPPFLAGS += -DHAVE_SODIUM=1 `pkg-config --cflags libsodium`
SOGo_LIBRARIES_DEPEND_UPON += -lsodium
endif

ifeq ($(findstring openbsd, $(GNUSTEP_HOST_OS)), openbsd)
SOGo_LIBRARIES_DEPEND_UPON += -lcrypto
else
SOGo_LIBRARIES_DEPEND_UPON += -lcrypt
endif

ifeq ($(findstring gnu, $(GNUSTEP_HOST_OS)), gnu)
SOGo_LIBRARIES_DEPEND_UPON += -ldl
endif

ADDITIONAL_TOOL_LIBS += \
        -L$(GNUSTEP_OBJ_DIR)/ \
        -lSOGo \
	-lGDLContentStore -lGDLAccess	\
        -lNGCards                       \
	-lNGLdap			\
	-lNGExtensions -lEOControl	\
	-lDOM -lSaxObjC
