#!/bin/bash
# Copyright (c) 2000-2019 Synology Inc. All rights reserved.

case ${MakeClean} in
	[Yy][Ee][Ss])
		make clean
		;;
esac

SDK_INCS="`pkg-config libsynoproxy --cflags`"
SDK_LIBS="`pkg-config libsynoproxy --libs`"

CFLAGS="${CFLAGS} ${SDK_INCS} -DCURL_MAX_WRITE_SIZE=131072 -DSYNO_CURL_FORM_LARGE_CONTENTSLENGTH -DOPENSSL_NO_SSL3_METHOD"
LDFLAGS="${LDFLAGS} ${SDK_LIBS}"

ConfigOpt="$ConfigOpt --prefix=/usr"
env	CC=${CC} LD=${LD} AR=${AR} STRIP=${STRIP} RANLIB=${RANLIB} NM=${NM} \
	CFLAGS="${CFLAGS}" CPPFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
	ac_cv_func_clock_gettime="no" \
	./configure ${ConfigOpt} \
		--with-zlib \
		--with-ssl \
		--with-random=/dev/urandom \
		--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
		--with-nghttp2 \
		--with-ldap-lib="ldap" \
		--with-lber-lib="lber" \
		--enable-ipv6 \
		--enable-debug \
		--enable-symbol-hiding \
		--enable-versioned-symbols \
		--enable-ares \
		--enable-ldap \
		--enable-ldaps \
		--disable-verbose \
		--disable-manual \
		--disable-ftp \
		--disable-file \
		--disable-rtsp \
		--disable-dict \
		--disable-telnet \
		--disable-tftp \
		--disable-pop3 \
		--disable-imap \
		--disable-smb \
		--disable-smtp \
		--disable-gopher \
		--disable-sspi \
		--disable-mqtt \
		--disable-tls-srp

make ${MAKE_FLAGS}
