#!/bin/sh
# $Id: choose-mingw32,v 1.3 2014/02/01 15:48:56 tom Exp $
# Choose a mingw32 "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 \
		i686-w64-mingw32 \
		i686-pc-mingw32 \
		i686-mingw32msvc \
		i586-mingw32msvc \
		mingw32
	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
