# gcc-test - test for a version of GCC
#
################################################################
# Copyright (C) 2002 Tom Lord
# 
# See the file "COPYING" for further information about
# the copyright and warranty status of this work.
# 



# gcc-test variable
#
# See if ${CC} thinks it is gcc -- if so, what version?
# 


if test $# -ne 1 ; then
  printf "usage: library-test variable-name\n" 1>&2
  exit 1
fi

variable_name="$1"

rm -f ,test-prog.c
rm -f ,test-prog

cat > ,test-prog.c <<- EOF

	#include <stdio.h>

	#undef stringify2
	#undef stringify
	#define stringify2(x) #x
	#define stringify(y) stringify2(y)

	int 
	main (int argc, char * argv[])
	{
	#ifdef __GNUC__
	  printf ("%s\n", stringify(__GNUC__));
	#endif
	  return 0; 
	}

EOF

if ${CC} -o ,test-prog ,test-prog.c 2> /dev/null > /dev/null ; then
  gcc_version="`./,test-prog`"
  if test ! -z "$gcc_version" ; then
    printf "string %s=%s\n" "$variable_name" "$gcc_version"
  fi
fi

# tag: Tom Lord Fri May 10 02:25:39 2002 (auto-conf-lib/gcc-test)
#
