#!/bin/sh
# $Id: cfg-mingw64,v 1.10 2023/01/24 23:19:08 tom Exp $
# configure to cross-compile using mingw32 using 64-bits

unset CC
unset CXX

TARGET=`choose-mingw64 gcc pkg-config`

# Fedora 33 or 34 turned on hardening flags in the packaged libraries, making
# them unusable if we do not do the same.
case `partition` in
*fedora3[3-9]|*fedora[4-9][0-9]|*fedoracur)
	export CFLAGS='-O2 -Wall -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS'
	export LIBS="-lssp"
	;;
esac

if test -n "$TARGET"
then
	PREFIX=
	test -d /usr/$TARGET && PREFIX="--prefix=/usr/$TARGET"
	cfg-normal \
		--host=$TARGET \
		--target=$TARGET \
		$PREFIX "$@" || exit 1
else
	echo "? cannot find MinGW-64 compiler in path"
	exit 1
fi
