#
# PGI Compiler Configurations for C++
#

#-----------------------------------------------------------------------------#
# Set switches for C++	                                                      #
#-----------------------------------------------------------------------------#
switch -b=-Wc,--cfront_2.1
switch -b3=-Wc,--cfront_3.0
switch -xh=-Wc,-x
switch +p=-Wc,--no_anachronisms
switch -t=-Wc,-tused
switch -tall=-Wc,-tall
switch -tlocal=-Wc,-tlocal
switch -tnone=-Wc,-tnone
switch -tused=-Wc,-tused
switch -Muchar=-Wc,--unsigned_chars -Muchar
switch -Mschar=-Wc,--signed_chars -Mschar
switch -mangled_names=-Mx,117,0x2
switch -dwarf_formal_this=-Mx,117,0x4
# disable math builtins. -Mbuiltin will not disable -Mnobuiltin, so this 
# may not be correct
switch Mbuiltin=-Wc,--builtin -My,122,0x80
switch Mnobuiltin=-Wc,--nobuiltin -Mx,122,0x80
# Create new switch -Mstandard, mapped to -Mbuiltin
# This covers us for Ansi C conformance on setting errno correctly for
# math functions
switch Mstandard=-Wc,--nobuiltin -Mx,122,0x80
switch --suppress_template_dwarf=-Wc,--suppress_template_dwarf -W0,-notem_dbg



#-----------------------------------------------------------------------------#
# Set options for C++	                                                      #
#-----------------------------------------------------------------------------#

ifndef SYSTEM_DEFINE set SYSTEM_DEFINE=$SYSTEM
if DOS \
  set CC_="cpp" \
  set C_="cpp" \
else \
  set CC_="CC" \
  set C_="C" \
endif

set DRIVER_ARGS_CPLUS="-Minline\=levels:0 $HOST_ARGS_CPLUS $EXTRA_DRIVER_ARGS_CPLUS"

# C++: -g -and -dwarf now do the same thing
# EDG release 2.30 requires this switch until we make this the default
# Dec 96 we no longer want the --using_std default for Rogue Wave libraries.
#set CPLUSARGS="$CPLUSARGS --using_std"

set CPLUSARGS="$TARGET_ARGS_CPLUS $EXTRA_ARGS_CPLUS"

ifndef CPLUS1			set CPLUS1=pgcpp1
ifndef CPLUS2			set CPLUS2=pgcpp2
ifndef EXTRACTOR_C		set EXTRACTOR_C=pgcpp2ex
ifndef CPLUSDIR1		set CPLUSDIR1=$PGI/$SYSTEM/bin
ifndef CPLUSDIR2		set CPLUSDIR2=$PGI/$SYSTEM/bin

ifndef MUNCH			set MUNCH=pgmunch
ifndef MUNCHDIR			set MUNCHDIR=$PGI/$SYSTEM/bin

ifndef NM \
	if I860			set NM=nm860 \
	else			set NM=nm \
endif
ifndef NMDIR \
	if I860			set NMDIR=$PGI/$SYSTEM/bin \
	else if SOLARIS		set NMDIR=/usr/ccs/bin \
	else if I386		set NMDIR=/usr/ccs/bin \
	else			set NMDIR=/bin \
endif
ifndef NMARGS \
	if I860			set NMARGS=-xpr \
	else if SOLARIS		set NMARGS="-R -p" \
	else if I386		set NMARGS="-r -p" \
	else			set NMARGS=-r \
endif

ifndef PRELNK			set PRELNK=pgprelnk
ifndef PRELNKDIR		set PRELNKDIR=$PGI/$SYSTEM/bin
ifndef PRELNKARGS \
	if I860 		set PRELNKARGS="-f $PGI_TARGET -YP,$PGIDIR" \
	else 			set PRELNKARGS="-f $PGI_TARGET -YP,$PGIDIR:$LIBDIR" 
ifdef GCCDIR 			set  PRELNKARGS="$PRELNKARGS:$GCCDIR"

ifndef CPLUSINC \
	if DOS			set CPLUSINC="$PGI/$SYSTEM/include/$(CC_);" \
	else			set CPLUSINC="$PGI/$SYSTEM/include/$(CC_):"

ifndef CPLUS_PREDEFS \
	ifn -Mnostddef		set CPLUS_PREDEFS="-D__PGI -D__$SYSTEM_DEFINE"

#ifndef CPLUS_LIBS \
#	ifn -Mnostdlib		set CPLUS_LIBS="-lstrm -l$(C_)"
# Rogue Wave STL now in use
#ifndef CPLUS_LIBS \
#	ifn -Mnostdlib		set CPLUS_LIBS=" -l$(C_)"
# use -lstd_mt for -mp when it becomes available
ifndef CPLUS_LIBS \
	if -mp          	set CPLUS_LIBS=" -lstd -l$(C_)" \
	else \
	ifn -Mnostdlib		set CPLUS_LIBS=" -lstd -l$(C_)"
ifndef CPLUS_PRELNK_LIBS \
	if -mp			set CPLUS_PRELNK_LIBS=" -lstd" \
	else \
        ifn -Mnostdlib          set CPLUS_PRELNK_LIBS=" -lstd"
if -mp                          set  CPLUSARGS= "$CPLUSARGS --mp "
# when -lstd_mt enabled, also use if -mp		set  CPLUSARGS=
#                         "$CPLUSARGS --mp -D_RWSTD_MULTI_THREAD -D_REENTRANT"
if -mp \
    ifn -Mnoopenmp \
        set  CPLUS_PREDEFS="$(CPLUS_PREDEFS) -D_OPENMP\=199810"

