# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../gcc/config-550.in
# Copyright (C) 2006 - 2008 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf
#
# 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.
# --- SDE-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 " $cfgtmpdir/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 " $cfgtmpdir/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 " $cfgtmpdir/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 " $cfgtmpdir/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" ]; then
		  bool 'Build the JAVA compiler' SDECFG_PKG_GCC_JAVA 1
		fi
		bool 'Build the F77 compiler' SDECFG_PKG_GCC_F77 1
		bool 'Build the OBJC compiler' SDECFG_PKG_GCC_OBJC 1
		comment ' '
		bool 'Build version specific runtime libraries' \
					SDECFG_PKG_GCC_VERSION_LIBS 0
		bool 'Build the pre-compiled header (PCH) for libstdc++' \
					SDECFG_PKG_GCC_CXX_PCH 0
	menu_end
fi