#!/bin/sh
# $Id: cfg-mingw32,v 1.11 2018/01/05 00:47:13 tom Exp $
# configure to cross-compile using mingw32 using 32-bits

unset CC
unset CXX

TARGET=`choose-mingw32 gcc pkg-config`

if test -n "$TARGET"
then
	PREFIX=
	test -d /usr/$TARGET && PREFIX="--prefix=/usr/$TARGET"

	# some older configuration does this
	if test -z "$PREFIX"
	then
	SYS=/usr/$TARGET/sys-root/mingw
	if test -d $SYS/include
	then
		echo "...adding $SYS/include to CFLAGS"
		CFLAGS="$CFLAGS -I$SYS/include"
		export CFLAGS
	fi
	if test -d $SYS/lib
	then
		echo "...adding $SYS/lib to LDFLAGS"
		LDFLAGS="$LDFLAGS -L$SYS/lib"
		export LDFLAGS
	fi
	fi

	cfg-normal \
		--host=$TARGET \
		--target=$TARGET \
		$PREFIX "$@" || exit 1
else
	echo "? cannot find MinGW-32 compiler in path"
	exit 1
fi
