Revision 1 (by moose, 2006/03/06 10:00:33) Initial Import
do ifnot "${QT4DIR}"=""
	put checking for Qt ${QT_MAJOR}.${QT_MIN_MINOR}...
	writefile tmp.cpp '/* safe to delete */'
	do ifret 0
		appendfile tmp.cpp \#include 
		appendfile tmp.cpp \#include 
		appendfile tmp.cpp \#include 
		appendfile tmp.cpp int main(int argc, char **argv) {
		appendfile tmp.cpp "	int qmajor = QT_VERSION >> 16, qminor = (char)(QT_VERSION >> 8), major = ${QT_MAJOR}, minor = ${QT_MIN_MINOR};"
		appendfile tmp.cpp '	FILE *fh = fopen("qt_version", "wt");'
		appendfile tmp.cpp '	fprintf(fh, "QT_VERSION='%s'\\nQT_MINOR=%i", QT_VERSION_STR, qminor); fclose(fh);'
		appendfile tmp.cpp '	if(major != qmajor) return -1;'
		appendfile tmp.cpp '	if(minor > qminor) return -1;'
		appendfile tmp.cpp '	return 0;'
		appendfile tmp.cpp }
		@!call ${CXX} -s -O2 -I${QT4INCDIR}/Qt -I${QT4INCDIR} -L${QT4LIBDIR} tmp.cpp ${OUT_OPT}tmp${EXE_EXT} #${QUIET}
		do ifret 0
			# empty 
			@!call ./tmp${EXE_EXT}
			do ifret 0
				invoke qt_version
				echo " ${QT_VERSION}"
				# echo ""
				# nothing?
			else
				echo Failed to find a suitable Qt lib :(
				echo set QTDIR, or pass --with-qt-dir=.
				exit -1
			done

			@call rm tmp tmp.cpp
		else
			echo " Failed to compile test program."
			echo " set QTDIR, or pass --with-qt-dir=."
			exit -1
		done
		
	done
else
	echo Qt4 path not specified, set QTDIR, or pass --with-qt-dir=.
done