Revision 8 (by moose, 2006/05/16 01:39:45)
do ifnot "${PREFIX}"=""
	put checking for AllegroGL ${AGL_MIN_MAJOR}.${AGL_MIN_SUB}.${AGL_MIN_WIP}...
	writefile tmp.c '/* safe to delete */'
	do ifret 0

#define AGL_VERSION     0            ///< Major version number
#define AGL_SUB_VERSION 2            ///< Minor version number
#define AGL_WIP_VERSION 5            ///< Work-In-Progress version number

		appendfile tmp.c \#include 
		appendfile tmp.c \#include 
		appendfile tmp.c \#include 
		appendfile tmp.c int main(int argc, char **argv) {
		appendfile tmp.c "	int vmajor = AGL_VERSION, vminor = AGL_SUB_VERSION, vwip = AGL_WIP_VERSION, major = ${AGL_MIN_MAJOR}, minor = ${AGL_MIN_SUB}, wip = ${AGL_MIN_WIP};"
		appendfile tmp.c '	FILE *fh = fopen("agl_version", "wt");'
		appendfile tmp.c '	fprintf(fh, "AGL_VERSION_STR=\'%s\'\\nAGL_VERSION=%i\\nAGL_SUB_VERSION=%i\\nAGL_WIP_VERSION=%i", AGL_VERSION_STR, vmajor, vminor, vwip); fclose(fh);'
		appendfile tmp.c '	if(major != vmajor) return -1;'
		appendfile tmp.c '	if(minor > vminor) return -1;'
		appendfile tmp.c '	//if(wip > vwip) return -1;'
		appendfile tmp.c '	return 0;'
		appendfile tmp.c }

		@compile tmp.c
		@linkexec tmp
		do ifret 0
			# empty 
			@!call ./tmp${EXE_EXT}
			do ifret 0
				invoke agl_version
				echo " ${AGL_VERSION_STR}"
				# echo ""
				# nothing?
			else
				echo Failed to find a suitable AllegroGL lib :(
				exit -1
			done

			@call rm tmp tmp.c
		else
			echo " Failed to compile test program."
			exit -1
		done
		
	done
else
	echo PREFIX not specified.
done

${APPEND_CONFIG} \# AllegroGL Config
${APPEND_CONFIG} AGL_VERSION=${AGL_VERSION}
${APPEND_CONFIG} AGL_SUB_VERSION=${AGL_SUB_VERSION}
${APPEND_CONFIG} AGL_WIP_VERSION=${AGL_WIP_VERSION}
${APPEND_CONFIG} AGL_VERSION_STR=${AGL_VERSION_STR}
${APPEND_CONFIG}