#! /bin/sh
#+++
#  title:	cc3
#  abstract:	Run NEXTSTEP 3.x compiler from OPENSTEP 4.x.
#  author:	Tom Hageman <tom@basil.icce.rug.nl>
#  created:	September 1996
#  modified:
#  copyleft:
#
#		Copyright (C) 1996  Tom R. Hageman.
#
#	This 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; either version 2 of the License, or
#	(at your option) any later version.
#
#	This software is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.
#
#	You should have received a copy of the GNU General Public License
#	along with this software; see the file COPYING.  If not, write to
#	the Free Software Foundation, 59 Temple Place - Suite 330,
#	Boston, MA 02111-1307, USA.
#
#  description:
#
#	This script should allow you to compile pre-OPENSTEP source code on
#	an OPENSTEP system, assuming a NS3.3 developer system is mounted
#	somewhere.
#
#	Note that you get a lot of warnings when you use this script with the
#	original 3.3 precompiled headers.  To remedy this you can either add
#	the -traditional-cpp option (but this can be slow), or re-precompile
#	the 3.3 headers using this script. (you must probably be root to
#	be allowed to do that).
#
#  usage:
#
#	Put this script anywhere in your execution path.
#
#	From ProjectBuilder (presumably the 3.x version) set:
#
#		CC=cc3
#
#	in Arguments:, either in Builder [Options...] panel,
#	or (just once) in PBs Preferences panel.
#
#	From the commandline:
#
#		make CC=cc3 ...
#
#  bugs:
#
#	Indubitably.
#---

### start of configuration section ###

## Where to find NS3.x developer.
ns3dev="/3.3Dev"

## Where to find NS3.x /LocalDeveloper directory.
ns3dev_LocalDeveloper="$ns3dev/LocalDeveloper"
#ns3dev_LocalDeveloper="/LocalDeveloper"

## Where to find NS3.x /usr/local directory.
ns3dev_usr_local="$ns3dev/usr/local"
#ns3dev_usr_local="/usr/local"

## Which compiler version to use.
# (You lose the ability to compile for hppa if you choose the 4.x compiler.
#  OTOH you use a more recent version of the compiler tools if you do so.)
CC="$ns3dev/bin/cc -B$ns3dev/lib/"	# Use NS 3.x compiler
#CC="/bin/cc -static"			# Use OS 4.x compiler

### end of configuration section ###


CPLUSINCLUDES=
case " $* " in
  *\ -ObjC++\ * | *\ -x\ c++\ * | *\ -x\ objective-c++\ * | \
  *.C\ * | *.M\ * | *.cc\ * | *.cxx\ * )
	CPLUSINCLUDES="-I $ns3dev/NextDeveloper/Headers/g++"
esac

exec $CC -nostdinc ${1+"$@"}			\
	-L$ns3dev/usr/lib			\
	-L$ns3dev/usr/local/lib			\
	-L$ns3dev/lib				\
	$CPLUSINCLUDES				\
	-I $ns3dev_usr_local/include		\
	-I $ns3dev/NextDeveloper/Headers	\
	-I $ns3dev/NextDeveloper/Headers/ansi	\
	-I $ns3dev/NextDeveloper/Headers/bsd	\
	-I $ns3dev_LocalDeveloper/Headers	\
	-I $ns3dev_LocalDeveloper/Headers/ansi	\
	-I $ns3dev_LocalDeveloper/Headers/bsd	\
	-I $ns3dev/NextDeveloper/2.0CompatibleHeaders
