#!/bin/sh
# $Id: cfg-mingw,v 1.6 2012/06/16 21:13:15 tom Exp $
# configure to cross-compile using mingw32

BUILD_CC=${CC:-gcc}
unset CC
unset CXX

save_IFS="$IFS"
IFS=':'
TARGET=
for P in $PATH
do

	for T in \
		i586-mingw32msvc \
		i686-w64-mingw32 \
		i686-pc-mingw32 \
		mingw32
	do
		if test -f $P/$T-gcc
		then
			TARGET=$T
		fi
	done
	test -n "$TARGET" && break
done
IFS="$save_IFS"

if test -n "$TARGET"
then
	cfg-normal --with-build-cc=$BUILD_CC --host=$TARGET --target=$TARGET "$@"
else
	echo "? cannot find MinGW compiler in path"
	exit 1
fi
