The following instructions are used by Sun system managers at the
University of Illinois.  They are provided here as an aid to Sun
users having trouble with Xgopher and name resolution.

Please refer to the Sun-names document for the background on why this
information may be useful to you.

***** Please understand that these instructions are provided without
      warranty of any kind.  Nor can we offer any support for these
      modifications.
--------------------------------------------------------------------------

This short note describes how to rebuild the system library known as
libc.so (the "c" library) to include the name resolver routines.

This assumes you have installed the Shlib_Custom software category on your 
system. If there are no files in /usr/lib/shlib.etc, this has not been done.
You will also potentially have to modify the Makefile in this directory. Since 
I have forgotten what the original file looked like, I have included mine here.

---Begin Makefile---
#
# @(#)Makefile 1.2 89/10/04 SMI
#
# Added lines to work under 4.1.2    SMM


OBJSORT=objsort
AWKFILE=awkfile


libc.so:
        ld -assert pure-text -ldl `${OBJSORT} lorder-sparc tmp`
        /bin/ls /usr/lib/libc.so.* > TMP_FILE
        mv a.out libc.so.`cat TMP_FILE | awk -f ${AWKFILE}`
        echo libc.so.`cat TMP_FILE | awk -f ${AWKFILE}` built.

libcs5.so:
        ld -assert pure-text -ldl `${OBJSORT} lorder-sparc tmp`
        /bin/ls /usr/5lib/libc.so.* > TMP_FILE
        mv a.out libc.so.`cat TMP_FILE | awk -f ${AWKFILE}`
        echo libc.so.`cat TMP_FILE | awk -f ${AWKFILE}` built.

---End Makefile---

It is strongly advised that you read through this before trying it so you 
understand what it is you are about to do. 


 1. Become super user
        % su
 
 2. Go to the directory /usr/lib/shlib.etc
	% cd /usr/lib/shlib.etc

 2. Make a temporary directory
        % mkdir tmp

 3. Change to the "tmp" directory just made, extract the pic .o from 
    libc_pic.a and rm the file __.SYMDEF. The reason you need to do 
    the 3 "mv" commands is because "ar" truncated filenames over 
    16 characters.
        % cd tmp
        % ar x ../libc_pic.a
        % rm __.SYMDEF
        % mv rpc_dtablesize. rpc_dtablesize.o
        % mv rpc_commondata. rpc_commondata.o
	% mv xccs.multibyte. xccs.multibyte.o

 4. Extract the contents of libc_pic.a and /usr/lib/libresolv.a into the
    tmp directory:
	% cd tmp
	% ar x ../libc_pic.a
	% ar x /usr/lib/libresolv.a

    The libresolv.a (apparently) contains object modules that are position
    independant, so they can be added to the libc_pic modules without fear.

 5. Remove the old routine to do the hostname/addr resolution:
	% rm gethostent.o

 6. Remove the libresolv module that contains `strncasecmp' (which is now
    in the main C library, so it is redundant):
	% rm strcasecmp.o

 7. Edit the file ../lorder-sparc to make these changes.
    Remove the reference to `gethostent.o' and add the
    references to the resolver library routines by applying this patch:

	% diff -rc2 lorder-sparc.orig lorder-sparc
	*** lorder-sparc.orig   Thu Feb  8 05:27:46 1990
	--- lorder-sparc	Mon Apr  9 12:58:59 1990
	***************
	*** 150,154 ****
	  getwd.o
	  getnetgrent.o
	! gethostent.o
	  ypxdr.o
	  ttyname.o
	--- 150,161 ----
	  getwd.o
	  getnetgrent.o
	! gethostnamadr.o
	! sethostent.o
	! res_query.o
	! res_mkquery.o
	! res_send.o
	! res_debug.o
	! res_comp.o
	! res_init.o
	  ypxdr.o
	  ttyname.o

8.      % cd ..

9.      % make libc.so

10. Now you should have some libc.so.x.y.z built in the current directory,
    where .x.y.z are some digits.

    It is recommended that you tested out this library at this point 
    before installing it. You can do so by setting the environment
    LD_LIBRARY_PATH  to the current directory and doing a trace command
    of, for example, "date".  The output should inform you that the new
    library is being used.  The commands are:
        % setenv LD_LIBRARY_PATH `pwd`
        % trace date
    (You should see an "open( new_library_name)" here.  When I do this,
    there are somewhere around 40 lines of output from this command, and
    the open() to look for is about 1/3 of the way down.)

    Once you are satisfied that the new library worked, you can proceed
    to install it with the following commands:
        % cp libc.so.x.y.z /usr/lib         (replace x.y.z with your numbers)
        % ldconfig
        % unsetenv LD_LIBRARY_PATH

