# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# T2 SDE: package/.../gcc/config-550.in
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 ROCK Linux Project
# 
# More information can be found in the files COPYING and README.
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- T2-COPYRIGHT-NOTE-END ---

menu_begin MENU_COMPILER 'Selecting compiler'
	pkgout
	default='' ; list=''
	while read pkg ver ; do
		default=${default:-$pkg} ; [ $pkg = gcc3 ] && default=gcc3
		list="$list $pkg Use_${pkg}_($ver)_as_standard_C_compiler"
	done < <(grep "^X .* CC " config/$config/packages | cut -f5,6 -d' ')
	if [ -z "$default" ] ; then
		default="cc" ; list="cc Standard_C-Compiler_CC"
	fi
	choice SDECFG_DEFAULT_CC $default $list

	# do not build non-default gcc on stages 0 or 1
	if [ "$SDECFG_DEFAULT_CC" != "gcc2" ]; then
		pkgfilter sed -e '/ gcc2 / s/^\(..\)../\1--/' 
	fi
	if [ "$SDECFG_DEFAULT_CC" != "gcc3" ]; then
		pkgfilter sed -e '/ gcc3 / s/^\(..\)../\1--/' 
	fi
	if [ "$SDECFG_DEFAULT_CC" != "gcc33" ]; then
		pkgfilter sed -e '/ gcc33 / s/^\(..\)../\1--/' 
	fi
	if [ "$SDECFG_DEFAULT_CC" != "gccx" ]; then
		pkgfilter sed -e '/ gccx / s/^\(..\)../\1--/' 
	fi

	pkgout
	default='' ; list=''
	while read pkg ver ; do
		default=${default:-$pkg} ; [ $pkg = gcc3 ] && default=gcc3
		list="$list $pkg Use_${pkg}_($ver)_as_kernel_C_compiler"
	done < <(grep "^X .* KCC " config/$config/packages | cut -f5,6 -d' ')
	if [ -z "$default" ] ; then
		default="kcc" ; list="kcc Standard_Kernel_C-Compiler_KCC"
	fi
	choice SDECFG_DEFAULT_KCC $default $list

	pkgout
	default='' ; list=''
	while read pkg ver ; do
		default=${default:-$pkg} ; [ $pkg = gcc3 ] && default=gcc3
		list="$list $pkg Use_${pkg}_($ver)_as_standard_C++_compiler"
	done < <(grep "^X .* CXX " config/$config/packages | cut -f5,6 -d' ')
	if [ -z "$default" ] ; then
		default="c++" ; list="c++ Standard_C++-Compiler_C++"
	fi
	choice SDECFG_DEFAULT_CXX $default $list

	pkgout
	default='' ; list=''
	while read pkg ver ; do
		default=${default:-$pkg} ; [ $pkg = gcc3 ] && default=gcc3
		list="$list $pkg Use_${pkg}_($ver)_as_standard_F77_compiler"
	done < <(grep "^X .* F77 " config/$config/packages | cut -f5,6 -d' ')
	if [ -z "$default" ] ; then
		default="f77" ; list="f77 Standard_Fortran-Compiler_F77"
	fi
	choice SDECFG_DEFAULT_F77 $default $list
menu_end

if pkgcheck "gcc" X; then

	menu_begin MENU_PKG_GCC 'GCC (GNU Compiler Collection) options'
		bool 'Use Stack-Smashing Protector' \
					SDECFG_PKG_GCC_STACKPRO 0
		[ -s $cfgtmpdir/subconfig-gcc.in ] && . $cfgtmpdir/subconfig-gcc.in

		# TODO: recheck mips - x86-64 should only be temp. broken
		if [ "$SDECFG_ARCH" != "mips" ] &&
		   [ "$SDECFG_ARCH" != "x86-64" ]
		then
		  bool 'Build the JAVA compiler' SDECFG_PKG_GCC_JAVA 0
		fi

	menu_end
fi