v01i024: Revised ccc (and ggg) - hassle free compilation with shared libs, Part01/01

rew wilber at alice.att.com
Thu May 30 12:27:51 AEST 1991


Submitted-by: wilber at alice.att.com (rew)
Posting-number: Volume 1, Issue 24
Archive-name: ccc_1.3x/part01

[ moderators note - this is based on ccc version 1.3, I'm not sure how it ]
[ compares with ccc version 1.5 but it does have the interesting addition ]
[ of a script called ggg for use with the gcc compiler.                   ]

Compile and link with cc (or GNU cc) using the shared libraries.
This can deal with programs that use curses.

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 1)."
# Contents:  README Files Install Makefile Manifest Name Remove Size
#   ccc ggg
# Wrapped by wilber at UNIXPC on Sat May 18 14:13:35 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(8769 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XDate:	05-09-91
XFrom:	Bob Wilber   (wilber at homxb.att.com)
X
XJeffery Small posted this a few years back; this version fixes a couple bugs in
Xccc and also contains a shell script called "ggg" for invoking GNU CC with the
Xshared libraries.
X
XWhat this does: ccc acts like cc but uses the shared library to the maximum
Xextent permissible by law.  You invoke it in exactly the same way that you
Xwould invoke cc without using the shared library.  Examples:
X
Xccc foo.c bar.c -lmalloc -lmath -o foo
X
X	Compiles foo.c and bar.c and links them with shlib.ifile and
X	libcSHLIB.a so that foo uses the shared library.  Library libmath.a
X	is passed to the linker, but libmalloc.a is not since its modules are
X	already in the shared library.  (libcSHLIB.a contains those modules
X	that are in libc.a but not the shared library.)
X
Xccc foo.c bar.c -lmalloc -lmath -o foo -g
X
X	Compiles foo.c and bar.c and links them along with libg.a (no shared
X	libraries are used).  libmath.a and libmalloc.a are both passed to
X	the linker.  (Use of -g or -p precludes using the shared libraries.)
X
Xccc foo.c bar.c -lmalloc -lmath -lcurses -o foo
X
X	Compiles foo.c and bar.c and links them with shlib.iCURSES and
X	libcSHLIB.a so that foo uses the shared libraries.  libmath.a and
X	libcurses.a are passed to the linker; the use of shlib.iCURSES instead
X	of shlib.ifile prevents name conflicts with the curses routines.
X
Xggg is used in the same way.
X
XThe "Install" shell script creates the necessary shlib.iCURSES and libcSHLIB.a
Xfiles, and installs the ccc and ggg scripts.  Run it as root.
X
XThere shouldn't be anything you can do with "cc" or gcc" that you can't do with
X"ccc" or "ggg".  If some option doesn't work, let me know.
X
X
XThe old README:
X
XDate:	04-20-88
XFrom:	Jeffery Small  (uunet!hsi!cjsa!jeff)
X
XAttached is a new version (1.3) of the  "ccc"  script which I previously
Xposted to the net.  A few people who were using version 1.2 of the script
Xhad problems compiling programs because there are a number of routines
Xcontained in /lib/libc.a which are not built into the shared libraries.
XWhile I attempted to address this problem in version 1.2 for curses-based
Xprograms, I did not provide a generalized solution to the problem.
X
XWhat I have now done is take a look at all of the routines contained in the
Xstd. library (ar -t /lib/libc.a) and compared them to the reference addresses
Xin /lib/shlib.ifile.  The following, is a complete list of all non-matching
Xnames.
X
X  __cerror.o   __msgsys.o  __semsys.o  __setpgrp.o  __shmsys.o   __stime.o
X  __utssys.o   acct.o  	   assert.o    aulrem.o     biglitpow.o  bufctl.o
X  clrerr.o     ctdata.o    ctype.o     cuexit.o     data.o       doprnt.o
X  doscan.o     dtop.o      errlst.o    fakcu.o      filbuf.o     findiop.o
X  fladd.o      flcvt.o     fldvmd.o    flmul.o      flsbuf.o     fpa_decs.o
X  fpachk.o     getut.o     highbuf.o   l3.o         lfind.o      lockf.o
X  lsearch.o    ltostr.o    mcount.o    mon.o        msgsys.o     nlist.o
X  ptod.o       rew.o       semsys.o    setvbuf.o    shmsys.o     sigrte.o
X  strtod.o     tell.o      tfind.o     vfprintf.o   vprintf.o    vsprintf.o
X
XHowever, many of these modules are in fact, supported by the shared library,
Xso I then tested each module individually to determine which ones did and
Xdid not conflict with the shared library symbols.  The following list are
Xthe non-conflicting modules.
X
X  __cerror.o   __msgsys.o  __semsys.o  __setpgrp.o  __shmsys.o   __stime.o
X  __utssys.o   acct.o       aulrem.o   biglitpow.o  bufctl.o     clrerr.o
X  doprnt.o     doscan.o    dtop.o      fakcu.o      findiop.o    lfind.o
X  lockf.o      lsearch.o   ltostr.o    mcount.o     ptod.o       setvbuf.o
X  sigrte.o     strtod.o    tell.o       tfind.o      vfprintf.o  vprintf.o
X  vsprintf.o
X
XIt is obvious that missing routines such as  doprnt, lockf, vprintf, etc.
Xcan be a real problem.  What some of the other more obscure routines do is
Xa mystery to me.  An examination of the contents using  "strings"  reveals
Xthat some of thease modules depend upon one another.  I have extracted all
Xof these missing modules and constructed an adjunct support library for
Xshlib.ifile which I call "/lib/libcSHLIB.a" and I have modified "ccc" to
Xaccess this library.
X
XMy guess is that certain of these routines (eg: __msgsys.o) don't really
Xbelong in the adjunct library, but I can't predict what some future program
Xmay actually need - and (so far!) their inclusion doesn't appear to be
Xcausing any problems.  Perhaps someone more knowledgeable can shed some
Xlight on this list and possible pare it down.
X
XThere has also been some recent discussion about  "daylight"  being missing
Xfrom the shlib.ifile.  The idea of adding the line "daylight = 0x303658;"
Xwas recently suggested in an article originally posted by Ken Brassler.
XI have provided an option (during installation) of having this variable
Xadded to your ifile and thus, hopefully plug one more gap.
X
XI have tested this version of "ccc" by compiling a number of programs using
Xa variety of #include files and libraries (-lcurses, -lm -lld) and have had
Xno problems to date.  I would appreciate receiving feedback from anyone who
Xdiscovers problems created by the approach I have taken or finds a program
Xwhich compiles with the standard library but fails to compile using the
Xshared library and ccc.
X
XBy the way, this work applies to version 3.51 of the Development Set.  I
Xam not sure how well all of this works under earlier versions of the OS.
XPossible someone running 3.0 or 3.5 could let me know.
X
XIf you previously installed version 1.2 of "ccc" with my Install script, 
Xthen be sure to use the  User Agent  to remove that version before you
Xinstall this one.  To install this program, follow the instructions below.
X
XWith regards,
X
XJeff
X
X-------- Original README for ccc Version 1.2 ---------------------------------
X
XThe enclosed files provide a updated c-compiler interface for the UNIX-PC
Xwhich automates the use of the shared libraries when compiling programs on
Xthis machine.
X
XCredit for the initial idea of a compiler interface goes to Arnold Robbins
Xof Emory University Computing Center who distributed the original interface
Xprogram.  To this original work I have done the following:
X
X	- Added and/or modify support for -[CUefouLW] & -VS flags
X	- Expanded comments throughout the script for readability.
X	- Performed some minor reorganization for clarity.
X	- Modified the script so as not to rename /bin/cc.  Instead, this
X		script is called /bin/ccc and it references the original cc.
X	- Added a test which prevents the loader-step from starting up if
X	  an error occurs in the compiling stage.  Prior to this, linking
X	  would be attempted even if one of the .o files was missing.
X
X
XRecently, Emmet Gray of the US Army HQ III Corp sent out a script for
Xmodifying the /lib/shlib.ifile to allow curses programs to be compiled
Xusing the shared libraries.  This was a great idea but I found three
Xadditions which I wanted to make:
X
X	(1) I wanted a permanent copy of the edited .ifile so that I didn't
X	    have to re-edit the original file each time I compiled a curses
X	    program.
X
X	(2) I found that there were a few routines contained in /lib/libc.a
X	    which were not duplicated in the shared libraries but which
X	    were required by the curses library /usr/lib/libcurses.a.
X
X	(3) I wanted curses programs to compile transparently like any
X	    other program - which meant modifying /bin/ccc to handle the
X	    work.
X	    
X
XFinally, I like the way that the UNIX-PC keeps track of installed software
Xby hiding a Remove script which cleans up if you decide to remove the
Xthe software at a later date.  So what you have here is a set of files
Xto make a UNIX-PC Installable File.  To Install this program:
X
X	1:  Unshar this package
X
X	2:  Type:  make 
X
X	3:  Use the "Install Software sent by Electronic Mail" item in
X		the "Software Setup" menu from the "Administration" menu
X		to install the file "CCC".  This step will allow you to
X		create a Backup Installable Floppy if you decide you
X		would like it.
X
X	4:  Use "ccc"  just as you would "cc".  In your Makefiles, define
X	    CC=/bin/ccc  to force make to use the interface program.
X
X	(For those of you not running the User Agent, you can install
X	 this program by: 1:  become root [su root]
X			  2:  Type: sh Install
X			  3:  Keep a copy of the Remove file if you like.)
X
X
XI have compiled a number of curses program using this modified script and
Xhave encountered no problems to date.  Should you find any problems with
Xthis script and support files, I would appreciate hearing about them.
X
X--
XJeffery Small          (203) 776-2000     UUCP:   uunet!---\
XC. Jeffery Small and Associates	                  ihnp4!--- hsi!cjsa!jeff
X123 York Street, New Haven, CT  06511          hao!noao!---/
END_OF_FILE
if test 8769 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'Files' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Files'\"
else
echo shar: Extracting \"'Files'\" \(39 characters\)
sed "s/^X//" >'Files' <<'END_OF_FILE'
XSize
XName
XFiles
XInstall
XRemove
Xccc
Xggg
END_OF_FILE
if test 39 -ne `wc -c <'Files'`; then
    echo shar: \"'Files'\" unpacked with wrong size!
fi
# end of 'Files'
fi
if test -f 'Install' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Install'\"
else
echo shar: Extracting \"'Install'\" \(5934 characters\)
sed "s/^X//" >'Install' <<'END_OF_FILE'
X# A model install script for User Agent applications.
X#
X# C. Jeffery Small and Associates			Date: 04-20-88
X
X
X#########################################################################
X# Insert the name of the Application in NAME="", exactly as it should	#
X# appear in the User Agent Menu.  "NAME"  MUST be identical to that in	#
X# both the "Remove" Script and in the "UA_UPDATE" File.			#
X#########################################################################
X
XNAME="ccc"
X
X
X#########################################################################
X# List the application files below & assign the appropriate directory,	#
X# owner, group, and mode to each group.  OT1 and OT2 are "Other" groups	#
X# and can be used for file-groups which do not go into $BIN, $LIB or 	#
X# $DOC. The "Other" directory assignments can also be used to force the	#
X# creation of intermediate directories which may not otherwise exist.	#
X#   (ie: To install files in "/usr/games/lib/rogue" it is necessary 	#
X#    to insure that "/usr/games" & "/usr/games/lib" exist before 	#
X#    attempting to mkdir  "/usr/games/lib/rogue".)			#
X#########################################################################
X
XBINFILES="ccc ggg"
X
XBIN=/bin
X
XBINMOD=755
X
XBINOWN=bin
X
XBINGRP=bin
X
Xecho "Now beginning the installation of $NAME ...\n"
X
X
X
X#########################################################################
X# Step 1:  See if the C compiler exists on this system.			#
X#########################################################################
X
Xif [ ! -x  $BIN/cc ]
Xthen
X    echo "    \007The C-compiler is not installed on this machine.\n"
X    echo "    To install this application you must first load the"
X    echo "    Development Set Utilities onto this system.\n\n"
X    echo "    $NAME cannot be installed at this time.\n"
X    echo "    Hit  <ENTER>  to continue ... \c"
X    read ANS
X    exit 64				# This aborts the Install process
Xfi
X
X#########################################################################
X# Step 2:  Link files into the proper directories.			#
X#########################################################################
X
Xecho "\n    Installing the files ..."
X
Xfor i in $BINFILES
Xdo
X    chown $BINOWN $i
X    chgrp $BINGRP $i
X    chmod $BINMOD $i
X    ln $i $BIN
Xdone
X
X#########################################################################
X# Step 3:  Put any special work here.					#
X#########################################################################
X
Xecho "\n    Creating a curses compatible shared-library ifile."
Xecho   "    .... working ..."
X
Xif [ ! -f /lib/shlib.ifile ]
Xthen
X    echo "    \007Error:  /lib/shlib.ifile is missing!"
X    echo "    Make sure that you have loaded the Development Set."
X    echo "    Hit <ENTER> to continue ... \c"
X    read ANS
Xelse
X    # The following is credited to Emmet P. Gray (fthood!gray)  Thanks Emmet!
X
X    cp /lib/shlib.ifile  /lib/shlib.iCURSES
X    chmod 644 /lib/shlib.iCURSES
X    chown bin /lib/shlib.iCURSES
X    chgrp bin /lib/shlib.iCURSES
X
X    ed  -  /lib/shlib.iCURSES  <<-'ENDofEDIT'
X	1,$s/^PC/xPC/
X	1,$s/^BC/xBC/
X	1,$s/^UP/xUP/
X	1,$s/^ospeed/xospeed/
X	1,$s/^LINES/xLINES/
X	1,$s/^COLS/xCOLS/
X	1,$s/^tgetflag/xtgetflag/
X	1,$s/^tgetent/xtgetent/
X	1,$s/^tgetstr/xtgetstr/
X	1,$s/^tgetnum/xtgetnum/
X	1,$s/^tgoto/xtgoto/
X	1,$s/^tputs/xtputs/
X	1,$s/^wrefresh/xwrefresh/
X	1,$s/^initscr/xinitscr/
X	1,$s/^cbreak/xcbreak/
X	1,$s/^nl/xnl/
X	1,$s/^flushinp/xflushinp/
X	1,$s/^noecho/xnoecho/
X	1,$s/^savetty/xsavetty/
X	1,$s/^resetty/xresetty/
X	1,$s/^echo/xecho/
X	1,$s/^nocbreak/xnocbreak/
X	1,$s/^nonl/xnonl/
X	1,$s/^keypad/xkeypad/
X	1,$s/^endwin/xendwin/
X	1,$s/^printw/xprintw/
X	1,$s/^fixterm/xfixterm/
X	1,$s/^resetterm/xresetterm/
X	1,$s/^setterm/xsetterm/
X	1,$s/^baudrate/xbaudrate/
X	w
X	q
XENDofEDIT
Xfi
X
Xgrep "daylight" /lib/shlib.ifile > /dev/null 2>&1
X
Xif [ $? -ne 0 ]
Xthen
X  echo "\n    The 'daylight' variable is missing from the shlib.ifile."
X  echo   "    Our best guess is that the entry should be:  daylight = 0x303658;"
X  echo   "    Would you like to add it to the file? (y or n): \c"
X  read ANS
X
X  if [ "$ANS" = "y"  -o  "$ANS" = "Y" ]
X  then
X    echo "daylight = 0x303658;" >> /lib/shlib.ifile
X    echo "daylight = 0x303658;" >> /lib/shlib.iCURSES
X    echo "\n    OK.  The daylight variable has been added.\n"
X  else
X    echo "\n    OK.  We will skip this step.\n"
X  fi
Xfi
X
Xecho "\n    Creating a supplemental library of routines missing from"
Xecho   "    the shared-library ... working ..."
X
Xif [ ! -f /lib/libc.a ]
Xthen
X    echo "    \007Error:  /lib/libc.a  is missing!"
X    echo "    Make sure that you have loaded the Development Set."
X    echo "    Hit <ENTER> to continue ... \c"
X    read ANS
Xelse
X    OFILES="__cerror.o __msgsys.o __semsys.o __setpgrp.o __shmsys.o \
X	__stime.o __utssys.o acct.o aulrem.o biglitpow.o bufctl.o \
X	clrerr.o doprnt.o doscan.o dtop.o fakcu.o findiop.o lfind.o \
X	lockf.o lsearch.o ltostr.o mcount.o ptod.o setvbuf.o sigrte.o \
X	strtod.o tell.o tfind.o vfprintf.o vprintf.o vsprintf.o"
X
X
X    ar     x   /lib/libc.a  $OFILES
X    chown root $OFILES
X    chgrp root $OFILES
X
X    ar     qc  libcSHLIB.a  $OFILES
X    chmod  644 libcSHLIB.a  
X    chown  bin libcSHLIB.a  
X    chgrp  bin libcSHLIB.a  
X
X    ln  libcSHLIB.a  /lib
Xfi
X
X
X#########################################################################
X# Step 4:  Update the UA menu with the new application.			#
X#########################################################################
X
X
X#########################################################################
X# Step 5:  Close out with any explanatory comments.			#
X#########################################################################
X
X
Xecho "\nInstallation of $NAME is now complete."
Xecho "\nUse ccc and ggg just as you would cc and gcc.  In Makefiles, define"
Xecho   "CC=/bin/ccc (or /bin/ggg) at the head of your file to force make"
Xecho   "to use the ccc (ggg) compiler interface."
Xecho "\nHit  <ENTER>  to continue ... \c"
Xread ANS
Xexit 0
END_OF_FILE
if test 5934 -ne `wc -c <'Install'`; then
    echo shar: \"'Install'\" unpacked with wrong size!
fi
# end of 'Install'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(90 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
XSHELL=/bin/sh
X
X
Xinstall:	ccc ggg
X	cat ./Files | cpio -ocBv > /usr/spool/uucppublic/CCC+IN
END_OF_FILE
if test 90 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'Manifest' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Manifest'\"
else
echo shar: Extracting \"'Manifest'\" \(64 characters\)
sed "s/^X//" >'Manifest' <<'END_OF_FILE'
XREADME
XFiles
XInstall
XMakefile
XManifest
XName
XRemove
XSize
Xccc
Xggg
END_OF_FILE
if test 64 -ne `wc -c <'Manifest'`; then
    echo shar: \"'Manifest'\" unpacked with wrong size!
fi
# end of 'Manifest'
fi
if test -f 'Name' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Name'\"
else
echo shar: Extracting \"'Name'\" \(66 characters\)
sed "s/^X//" >'Name' <<'END_OF_FILE'
Xccc - A C-compiler interface for the UNIX-pc. (Ver 1.3  04-20-88)
END_OF_FILE
if test 66 -ne `wc -c <'Name'`; then
    echo shar: \"'Name'\" unpacked with wrong size!
fi
# end of 'Name'
fi
if test -f 'Remove' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Remove'\"
else
echo shar: Extracting \"'Remove'\" \(1712 characters\)
sed "s/^X//" >'Remove' <<'END_OF_FILE'
X# A model Remove script for User Agent applications.
X#
X# C. Jeffery Small and Associates			Date: 04-20-88
X
X
X#########################################################################
X# Insert the name of the Application in NAME="", exactly as it should	#
X# appear in the User Agent Menu.  "NAME"  MUST be identical to that in	#
X# both the "Install" Script and in the "UA_UPDATE" File.		#
X#########################################################################
X
XNAME="ccc"
X
XBINFILES="ccc ggg"
XLIBFILES="shlib.iCURSES libcSHLIB.a"
X
XBIN=/bin
XLIB=/lib
X
X
Xecho "Now beginning the removal of $NAME ...\n"
X
Xfor i in $BINFILES
Xdo
X    rm -f  $BIN/$i
Xdone
X
Xfor i in $LIBFILES
Xdo
X    rm -f $LIB/$i
Xdone
X
X#########################################################################
X# Step 2:  Put any special work here.					#
X#########################################################################
X
X# The daylight variable may have been added to /lib/shlib.ifile.
X# Check to see if it is there and then ask if it should be removed.
X
Xgrep  'daylight = 0x303658;'  /lib/shlib.ifile  > /dev/null  2>&1
X
Xif [ $?  -eq  0 ]
Xthen
X    echo "\n    Previously, the 'daylight' variable was added to your"
X    echo   "    /lib/shlib.ifile file.  Do you want me to remove this"
X    echo   "    entry now?  (y or n): \c"
X    read ANS
X
X    if [ "$ANS" = "y"  -o  "$ANS" = "Y" ]
X    then
X	ed  -  /lib/shlib.ifile  <<-'ENDofEDIT'
X	/daylight = 0x303658/d
X	w
X	q
XENDofEDIT
X    fi
Xfi
X
X
X#########################################################################
X# Step 3:  Close out with any explanatory comments.			#
X#########################################################################
X
X
Xecho "\nThe Removal of $NAME is now complete."
Xexit 0
END_OF_FILE
if test 1712 -ne `wc -c <'Remove'`; then
    echo shar: \"'Remove'\" unpacked with wrong size!
fi
# end of 'Remove'
fi
if test -f 'Size' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Size'\"
else
echo shar: Extracting \"'Size'\" \(3 characters\)
sed "s/^X//" >'Size' <<'END_OF_FILE'
X67
END_OF_FILE
if test 3 -ne `wc -c <'Size'`; then
    echo shar: \"'Size'\" unpacked with wrong size!
fi
# end of 'Size'
fi
if test -f 'ccc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ccc'\"
else
echo shar: Extracting \"'ccc'\" \(5850 characters\)
sed "s/^X//" >'ccc' <<'END_OF_FILE'
X#########################################################################
X#									#
X# Program:		/bin/ccc		(Bourne Shell Script)	#
X# Version:		1.3x			(modified)		#
X#									#
X# Original Coding:	Arnold Robbins - Emory Univ. Computing Center	#
X#			Heavily hacked since then by Jeffrey Small and	#
X#			Bob Wilber.					#
X#									#
X# SYNOPSIS								#
X#	ccc  [ options ]  file  [ file ... ]				#
X#									#
X# DESCRIPTION								#
X#	"ccc" is an interface for the standard C-compiler (/bin/cc) on	#
X#	the AT&T UNIX-pc (aka 3B1) which allows a more natural usage of	#
X#	the shared library facilities on this machine.			#
X#									#
X#	To use this script, you must:					#
X#		1.  Create the file /lib/shlib.iCURSES using the	#
X#		    shell script provided.				#
X#		2:  Install this script as /usr/local/bin/ccc		#
X#									#
X#	You may use this replacement "ccc" as you would the original	#
X#	with the added benefit that programs will now be compiled using	#
X#	the shared library.						#
X#									#
X# REVISION HISTORY							#
X#	09-10-87  V1.0: Jeffery Small  (uunet!hsi!cjsa!jeff)		#
X#			- Add/modify support for -[CUefouLW] & -VS flag	#
X#			- Expanded comments				#
X#			- Performed some minor reorganization.		#
X#	09-22-87  V1.1: Jeffery Small  (uunet!hsi!cjsa!jeff)		#
X#			- Modified script to leave /bin/cc alone 	#
X#			- Rename this script to /bin/ccc		#
X#			- Prevent loader-step from starting if an error #
X#			    occurs in the compiling stage.		#
X#	01-20-88  V1.2: Jeffery Small  (uunet!hsi!cjsa!jeff)		#
X#			- Added support to allow curses programs to be	#
X#			  compiled with the shared library.  This 	#
X#			  requires the following two support files.	#
X#			    (1) /lib/shlib.iCURSES - edited version of	#
X#				/lib/shlib.ifile modified to eliminate	#
X#				conflicts with the curses library. Idea	#
X#				credits	to Emmet P. Gray (fthood!egray)	#
X#			    (2) /lib/libCURSES.a - missing routines	#
X#				from /lib/libc.a not defined by the	#
X#				shared libraries.			#
X#	04-20-88  V1.3:	Jeffery Small  (uunet!hsi!cjsa!jeff)		#
X#			- Modified script to add support for ALL libc.a	#
X#			  routines which are missing from shlib.ifile.	#
X#			  This replaces /lib/libCURSES.a with the new	#
X#			  library /lib/libcSHLIB.a which is created by	#
X#			  an accompanying Install script.		#
X#									#
X#	06-12-88  Unnumbered version					#
X#			- Modidified script to work properly on 	#
X#			  cc -g (the library name order needed to	#
X#			  be changed on the 'ld' command)		#
X#									#
X#	02-08-91 Modified it so that when -g or -p is used (meaning you #
X#		 can't use the shared libraries) options like -ltam,    #
X#		 -ltermcap, etc., get passed to the loader.		#
X#									#
X#       02-16-91 Rearranged ld arguments so that $libextract and $libc  #
X#		 follow $ldargs.  This is necessary because libcurses.a #
X#		 references routines in libcSHLIB.a.			#
X#									#
X#	04-22-91 Added -lmalloc to the set of libraries that get	#
X#		 ignored when you use shared libraries, since those	#
X#		 routines are already in the shared libraries.		#
X#									#
X#########################################################################
X
XPATH=/bin:/usr/bin
Xexport PATH
X
XOCC=${OCC-/bin/cc}		# allows compiler to be renamed
X
Xstartoff=/lib/crt0s.o		# use the shared library by default
Xlibc=/lib/shlib.ifile
Xmylibs=				# insert any libraries you always want to have
X				# included here.
Xlibextract=-lcSHLIB
Xuse_shlib=1			# turn off if can't use shared library
X
Xnoshlibarg=
X
Xfiles=
Xofiles=
Xccargs=-c				# have to run $OCC with this
X
Xload=1					# run ld  (1=yes  0=no)
Xjustprint=0				# just print what would do, -#
Xverbose=0				# be verbose, -v
X
Xwhile [ $# -gt 0 ]
Xdo
X	case "$1" in
X	-C)		ccargs="$ccargs $1"		# cpp flag
X			;;
X	-[UDI]*)	ccargs="$ccargs $1"		# cpp flags
X			;;
X	'-#')		ccargs="$ccargs $1"		# cc flag
X			justprint=1
X			;;
X	-c)		load=0				# cc flag
X			;;
X	-[EPS])		ccargs="$ccargs $1"		# cc flags
X			load=0
X			;;
X	-g)		ccargs="$ccargs $1"		# cc & ld flags
X			ldargs="$ldargs -lg"
X			if [ ! "$startoff" = /lib/mcrt0.o ]
X			then
X				startoff=/lib/crt0.o
X			fi
X			use_shlib=0
X			;;
X	-O)		ccargs="$ccargs $1"		# cc flag
X			;;
X	-p)		ccargs="$ccargs $1"		# cc & ld flags
X			ldargs="$ldargs -L/lib/libp"
X			startoff=/lib/mcrt0.o
X			use_shlib=0
X			;;
X	-W*)		ccargs="$ccargs $1"		# cc flag
X			;;
X	-680[012]0)	ccargs="$ccargs $1"		# cc flags
X			;;
X	-v)		ccargs="$ccargs $1"		# cc flag
X			verbose=1
X			;;
X	-T)		ccargs="$ccargs $1"		# cc & ld flags
X			ldargs="$ldargs -G"
X			;;
X	-[efouL])	ldargs="$ldargs $1 $2"		# ld flags
X			shift
X			;;
X	-VS)		ldargs="$ldargs $1 $2"		#ld flags
X			shift
X			;;
X	-[nNzF])	noshlibarg="$noshlibarg $1"	# ifile sets load type
X			;;
X	-ltam)		noshlibarg="$noshlibarg $1"	# get from shared lib
X			;;
X	-lc)		noshlibarg="$noshlibarg $1"	# get from shared lib
X			;;
X	-ltermlib)	noshlibarg="$noshlibarg $1"	# get from shared lib
X			;;
X	-ltermcap)	noshlibarg="$noshlibarg $1"	# get from shared lib
X			;;
X	-lmalloc)	noshlibarg="$noshlibarg $1"	# get from shared lib
X			;;
X	-lcurses)	libc="/lib/shlib.iCURSES"
X			ldargs="$ldargs $1"
X			;;
X	-*)		ldargs="$ldargs $1"		# other flags go to ld
X			;;
X	*.[ao])		ofiles="$ofiles $1"		# files for ld
X			;;
X	*.[cs])		files="$files $1"		# files for cc and ld
X			ofiles="$ofiles `basename $1 .[cs]`.o"
X			;;
X	*)		files="$files $1"		# files(?) for cc & ld
X			ofiles="$ofiles $1"
X			;;
X	esac
X	shift
Xdone
X
Xif [ $use_shlib -eq 0 ]
Xthen
X	libc=-lc
X	libextract=
Xelse
X	noshlibarg=
Xfi
X
Xif [ -n "$files" ]
Xthen
X	$OCC $ccargs $files			# compile source files
X	ECODE=$?
X	if [ $ECODE != 0 ]			# exit upon error
X	then					# do not attempt ld
X		exit $ECODE
X	fi
Xfi
Xif [ "$load" -eq 1 ]					# run ld phase
Xthen
X	run="/bin/ld $ofiles $startoff $ldargs $mylibs $libextract $noshlibarg $libc"
X
X	if [ "$verbose" -eq 1 ]
X	then
X		echo Loading ...
X	fi
X
X	if [ "$justprint" -eq 1 ]
X	then
X		echo callsys $run
X	else
X		eval $run
X	fi
Xfi
Xexit $?
END_OF_FILE
if test 5850 -ne `wc -c <'ccc'`; then
    echo shar: \"'ccc'\" unpacked with wrong size!
fi
chmod +x 'ccc'
# end of 'ccc'
fi
if test -f 'ggg' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ggg'\"
else
echo shar: Extracting \"'ggg'\" \(7561 characters\)
sed "s/^X//" >'ggg' <<'END_OF_FILE'
X#########################################################################
X#									#
X# Program:		ggg			(Bourne Shell Script)	#
X# Version:		1.3x			(modified)		#
X#									#
X# Original Coding:	Arnold Robbins - Emory Univ. Computing Center	#
X#			Heavily hacked since then by Jeffrey Small and	#
X#			Bob Wilber.					#
X#									#
X# SYNOPSIS								#
X#	ggg  [ options ]  file  [ file ... ]				#
X#									#
X# DESCRIPTION								#
X#	"ggg" is an interface for the Gnu C-compiler			#
X#	(/usr/local/bin/gcc) on	the AT&T UNIX-pc (aka 3B1) which allows #
X#	a more natural usage of the shared library facilities on this	#
X#	machine.							#
X#									#
X#	To use this script, you must:					#
X#		1.  Create the file /lib/shlib.iCURSES using the	#
X#		    shell script provided.				#
X#		2:  Install this script as /usr/local/bin/ggg		#
X#									#
X#	You may use this replacement "ggg" as you would the original	#
X#	with the added benefit that programs will now be compiled using	#
X#	the shared library.						#
X#									#
X# REVISION HISTORY							#
X#	09-10-87  V1.0: Jeffery Small  (uunet!hsi!cjsa!jeff)		#
X#			- Add/modify support for -[CUefouLW] & -VS flag	#
X#			- Expanded comments				#
X#			- Performed some minor reorganization.		#
X#	09-22-87  V1.1: Jeffery Small  (uunet!hsi!cjsa!jeff)		#
X#			- Modified script to leave /bin/cc alone 	#
X#			- Rename this script to /bin/ccc		#
X#			- Prevent loader-step from starting if an error #
X#			    occurs in the compiling stage.		#
X#	01-20-88  V1.2: Jeffery Small  (uunet!hsi!cjsa!jeff)		#
X#			- Added support to allow curses programs to be	#
X#			  compiled with the shared library.  This 	#
X#			  requires the following two support files.	#
X#			    (1) /lib/shlib.iCURSES - edited version of	#
X#				/lib/shlib.ifile modified to eliminate	#
X#				conflicts with the curses library. Idea	#
X#				credits	to Emmet P. Gray (fthood!egray)	#
X#			    (2) /lib/libCURSES.a - missing routines	#
X#				from /lib/libc.a not defined by the	#
X#				shared libraries.			#
X#	04-20-88  V1.3:	Jeffery Small  (uunet!hsi!cjsa!jeff)		#
X#			- Modified script to add support for ALL libc.a	#
X#			  routines which are missing from shlib.ifile.	#
X#			  This replaces /lib/libCURSES.a with the new	#
X#			  library /lib/libcSHLIB.a which is created by	#
X#			  an accompanying Install script.		#
X#									#
X#	06-12-88  Unnumbered version					#
X#			- Modidified script to work properly on 	#
X#			  cc -g (the library name order needed to	#
X#			  be changed on the 'ld' command)		#
X#									#
X#	02-08-91 Modified it so that when -g or -p is used (meaning you #
X#		 can't use the shared libraries) options like -ltam,    #
X#		 -ltermcap, etc., get passed to the loader.		#
X#									#
X#       02-16-91 Rearranged ld arguments so that $libextract and $libc  #
X#		 follow $ldargs.  This is necessary because libcurses.a #
X#		 references routines in libcSHLIB.a.			#
X#									#
X#	04-22-91 Added -lmalloc to the set of libraries that get	#
X#		 ignored when you use shared libraries, since those	#
X#		 routines are already in the shared libraries.		#
X#									#
X#	04-22-91 Modified "ccc" to produce "ggg".  Works the same way	#
X#		 but for gcc.						#
X#									#
X#########################################################################
X
XPATH=/bin:/usr/bin
Xexport PATH
X
XOGCC=${OGCC-/usr/local/bin/gcc}	# allows compiler to be renamed
X
Xstartoff=/lib/crt0s.o		# use the shared library by default
Xlibc=/lib/shlib.ifile
Xmylibs=				# insert any libraries you always want to have
X				# included here.
Xgcclib=/usr/local/lib/gcc-gnulib
Xlibextract=-lcSHLIB
Xuse_shlib=1			# turn off if can't use shared library
X
Xnoshlibarg=
X
Xfiles=
Xofiles=
Xccargs=-c				# have to run $OGCC with this
X
Xload=1					# run ld  (1=yes  0=no)
Xjustprint=0				# just print what would do, -#
Xverbose=0				# be verbose, -v
X
Xwhile [ $# -gt 0 ]
Xdo
X	case "$1" in
X	-C)		ccargs="$ccargs $1"		# cpp flag
X			;;
X	-[UDI]*)	ccargs="$ccargs $1"		# cpp flags
X			;;
X	'-#')		ccargs="$ccargs $1"		# cc flag
X			justprint=1
X			;;
X	-c)		load=0				# cc flag
X			;;
X	-[EPS])		ccargs="$ccargs $1"		# cc flags
X			load=0
X			;;
X	-g)		ccargs="$ccargs $1"		# cc & ld flags
X			ldargs="$ldargs -lg"
X			if [ ! "$startoff" = /lib/mcrt0.o ]
X			then
X				startoff=/lib/crt0.o
X			fi
X			use_shlib=0
X			;;
X
X	# You must have the GNU assembler and linker for gg to actually work.
X	# Here it is treated like -g.
X	-gg)		ccargs="$ccargs $1"		# cc & ld flags
X			ldargs="$ldargs -lg"
X			if [ ! "$startoff" = /lib/mcrt0.o ]
X			then
X				startoff=/lib/crt0.o
X			fi
X			use_shlib=0
X			;;
X	-O)		ccargs="$ccargs $1"		# cc flag
X			;;
X	-p)		ccargs="$ccargs $1"		# cc & ld flags
X			ldargs="$ldargs -L/lib/libp"
X			startoff=/lib/mcrt0.o
X			use_shlib=0
X			;;
X
X	# The 3b1 doesn't really have the libraries to support -pg and -a,
X	# so we link them as though they were -p.
X	-pg)		ccargs="$ccargs $1"		# cc & ld flags
X			ldargs="$ldargs -L/lib/libp"
X			startoff=/lib/mcrt0.o
X			use_shlib=0
X			;;
X	-a)		ccargs="$ccargs $1"		# cc & ld flags
X			ldargs="$ldargs -L/lib/libp"
X			startoff=/lib/mcrt0.o
X			use_shlib=0
X			;;
X	-W*)		ccargs="$ccargs $1"		# GNU cc warning options
X			;;
X	-680[012]0)	ccargs="$ccargs $1"		# cc flags
X			;;
X	-v)		ccargs="$ccargs $1"		# cc flag
X			verbose=1
X			;;
X	-T)		ccargs="$ccargs $1"		# cc & ld flags
X			ldargs="$ldargs -G"
X			;;
X	-[efouL])	ldargs="$ldargs $1 $2"		# ld flags
X			shift
X			;;
X	-VS)		ldargs="$ldargs $1 $2"		#ld flags
X			shift
X			;;
X	-[nNzF])	noshlibarg="$noshlibarg $1"	# ifile sets load type
X			;;
X	-ltam)		noshlibarg="$noshlibarg $1"	# get from shared lib
X			;;
X	-lc)		noshlibarg="$noshlibarg $1"	# get from shared lib
X			;;
X	-ltermlib)	noshlibarg="$noshlibarg $1"	# get from shared lib
X			;;
X	-ltermcap)	noshlibarg="$noshlibarg $1"	# get from shared lib
X			;;
X	-lmalloc)	noshlibarg="$noshlibarg $1"	# get from shared lib
X			;;
X	-lcurses)	libc="/lib/shlib.iCURSES"
X			ldargs="$ldargs $1"
X			;;
X	-[bBdfm]?*)	ccargs="$ccargs $1"		# various GNU cc
X			;;				# flags
X	-nostdlib)	ccargs="$ccargs $1"		# GNU cc option
X			;;
X	-ansi)		ccargs="$ccargs $1"		# GNU cc option
X			;;
X	-traditional)	ccargs="$ccargs $1"		# GNU cc option
X			;;
X	-pedantic)	ccargs="$ccargs $1"		# GNU cc option
X			;;
X	-shlib)		;;				# Ignore!
X	-pipe)		ccargs="$ccargs $1"		# GNU cc option
X			;;
X	-trigraphs)	ccargs="$ccargs $1"		# GNU cc option
X			;;
X	-nostdinc)	ccargs="$ccargs $1"		# GNU cc option
X			;;
X
X	# This one's a tough call, since gcc and ld both have -M options that
X	# mean completely different things.  I think the gcc -M is more likely
X	# to be used than the ld -M, so the -M option goes to gcc.
X	-M)		ccargs="$ccargs $1"
X			;;
X	-MM)		ccargs="$ccargs $1"
X			;;
X
X	# -w is both an option to ld and an option to gcc.  The ld -w option is
X	# obscure; we assume it's meant for gcc instead.
X	-w)		ccargs="$ccargs $1"
X			;;
X	-*)		ldargs="$ldargs $1"		# other flags go to ld
X			;;
X	*.[ao])		ofiles="$ofiles $1"		# files for ld
X			;;
X	*.[cs])		files="$files $1"		# files for cc and ld
X			ofiles="$ofiles `basename $1 .[cs]`.o"
X			;;
X	*)		files="$files $1"		# files(?) for cc & ld
X			ofiles="$ofiles $1"
X			;;
X	esac
X	shift
Xdone
X
Xif [ $use_shlib -eq 0 ]
Xthen
X	libc=-lc
X	libextract=
Xelse
X	noshlibarg=
Xfi
X
Xif [ -n "$files" ]
Xthen
X	$OGCC $ccargs $files			# compile source files
X	ECODE=$?
X	if [ $ECODE != 0 ]			# exit upon error
X	then					# do not attempt ld
X		exit $ECODE
X	fi
Xfi
Xif [ "$load" -eq 1 ]					# run ld phase
Xthen
X	run="/bin/ld $ofiles $startoff $ldargs $mylibs $gcclib $libextract $noshlibarg $libc"
X
X	if [ "$verbose" -eq 1 ]
X	then
X		echo Loading ...
X	fi
X
X	if [ "$justprint" -eq 1 ]
X	then
X		echo callsys $run
X	else
X		eval $run
X	fi
Xfi
Xexit $?
END_OF_FILE
if test 7561 -ne `wc -c <'ggg'`; then
    echo shar: \"'ggg'\" unpacked with wrong size!
fi
chmod +x 'ggg'
# end of 'ggg'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have the archive.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0

-- 
David H. Brierley
Home: dave at galaxia.newport.ri.us; Work: dhb at quahog.ssd.ray.com
Send comp.sources.3b1 submissions to comp-sources-3b1 at galaxia.newport.ri.us
%% Can I be excused, my brain is full. **



More information about the Comp.sources.3b1 mailing list