# For local development builds

if test $(uname -s) = Darwin; then
    # Any macOS specific settings
	# For release builds we should use -march=core2 -mtune=haswell
	X=$(getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN)
	export CC=/usr/bin/clang
    export CXX=/usr/bin/clang++
elif test "$(uname -s) = MINGW*"; then
    # Any Windows specific settings
	X=$(wmic cpu get NumberOfLogicalProcessors /Format:List | cut -d'=' -f2 | xargs)
	ac_add_options --disable-bits-download
	ac_add_options --disable-maintenance-service
	ac_add_options --disable-parental-controls
	export WIN32_REDIST_DIR="/c/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Redist/MSVC/14.16.27012/x64/Microsoft.VC141.CRT"
	export WIN_UCRT_REDIST_DIR="/c/Program Files (x86)/Windows Kits/10/Redist/ucrt/DLLs/x64"
elif test $(uname -s) = Linux; then
    # Any Linux specific settings
	X=$(getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN)
	if test $(uname -m) = x86_64; then
		if test -d "$HOME/.mozbuild/clang/bin"; then
			export CC=$HOME/.mozbuild/clang/bin/clang
			export CXX=$HOME/.mozbuild/clang/bin/clang++
		else
			export CC=clang
			export CXX=clang++
		fi
		if test -f "$HOME/.mozbuild/nasm/nasm"; then
			export NASM=$HOME/.mozbuild/nasm/nasm
		fi
		ac_add_options --target=x86_64-pc-linux-gnu
	elif test $(uname -m) = ppc64le; then
		export CC=gcc
		export CXX=g++
		ac_add_options --enable-optimize="-w"
		ac_add_options --target=powerpc64le-unknown-linux-gnu
	fi
fi

ac_add_options --disable-bootstrap
ac_add_options --disable-crashreporter
ac_add_options --disable-debug
ac_add_options --disable-dmd
ac_add_options --disable-geckodriver
ac_add_options --disable-jprof
ac_add_options --disable-profiling
ac_add_options --disable-tests
ac_add_options --disable-trace-logging
ac_add_options --disable-verify-mar
ac_add_options --disable-updater

ac_add_options --enable-application=browser
ac_add_options --enable-optimize="-Os -w"
ac_add_options --enable-rust-simd

ac_add_options --with-app-basename=Waterfox
ac_add_options --with-branding=browser/branding/dokimi
ac_add_options --with-l10n-base=$PWD/browser/locales/l10n

if test -x "$(command -v sccache)"; then
	ac_add_options --with-ccache=sccache
elif test -f "$HOME/.mozbuild/sccache/sccache"; then
	ac_add_options --with-ccache=$HOME/.mozbuild/sccache/sccache
fi

mk_add_options AUTOCLOBBER=1
mk_add_options MOZ_MAKE_FLAGS=-j${X%.*}
MOZ_REQUIRE_SIGNING=
