#!/bin/sh
# $Id: choose-mingw64,v 1.1 2013/10/06 21:43:30 tom Exp $
# Choose a mingw64 "target".  This is especially for the Debian
# packages which provide old (gcc-mingw32) and new (gcc-mingw-w64)
# flavors, using symbolic links for more/less compatibility.
# Prefer the names which are not symlinked.

save_IFS="$IFS"
IFS=':'
TARGET=
for P in $PATH
do
	for T in \
		x86_64-w64-mingw32 \
		amd64-mingw32msvc
	do
		if test -f $P/$T-gcc
		then
			TARGET=$T
			test ! -h $P/$T-gcc && break
		fi
	done
	test -n "$TARGET" && break
done
IFS="$save_IFS"

echo $TARGET
