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

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

GCC_MAJOR_VERSION=$(${CC} -dumpversion | cut -d'.' -f1)
if [ "${GCC_MAJOR_VERSION}" -gt 5 ]; then
	LDFLAGS="$LDFLAGS -no-pie -fno-PIE"
fi

env CC=${CC} LD=${LD} AR=${AR} STRIP=${STRIP} RANLIB=${RANLIB} NM=${NM} \
	CPPFLAGS="${CFLAGS} -DSYNO_CURL_JUNIOR" LDFLAGS="${LDFLAGS}" \
	./configure ${ConfigOpt} \
		--prefix=/usr/syno-junior \
		--with-mbedtls=${SysRootPrefix} \
		--without-zlib \
		--without-libssh2 \
		--with-random=/dev/urandom \
		--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
		--without-nghttp2 \
		--enable-ipv6 \
		--enable-symbol-hiding \
		--enable-versioned-symbols \
		--disable-threaded-resolver \
		--disable-verbose \
		--disable-manual \
		--disable-file \
		--disable-ldap \
		--disable-rtsp \
		--disable-dict \
		--disable-telnet \
		--disable-pop3 \
		--disable-imap \
		--disable-smb \
		--disable-smtp \
		--disable-gopher \
		--disable-sspi \
		--disable-mqtt \
		--disable-tls-srp

make ${MAKE_FLAGS}
