#!/bin/sh
# --- Copyright University of Sussex 1993. All rights reserved. ----------
# File:             C.mips/src/poplink_motif_xlibs
# Purpose:          Link Poplog against MOTIF without G0 libraries
# Author:           Robert John Duncan, Mar 15 1991 (see revisions)
# Documentation:
# Related Files:

# Usage:
#	poplink_motif_xlibs [version]

if [ $# -eq 0 ]; then
	# just do clean up after link
	rm -r LibXm LibXt LibX11
	exit
fi

# Locate Xm, Xt and X11 archives

LibX11=/usr/lib/libX11.a
LibXt=/usr/lib/libXt.a
LibXm=/usr/lib/libXm.a
PW=

if [ -f /usr/lib/DXM/lib/Xm/libXm.a ]; then
	# DECstation Ultrix
	LibXt=/usr/lib/DXM/lib/Xt/libXt.a
	LibXm=/usr/lib/DXM/lib/Xm/libXm.a
elif [ -d /bsd43/usr/lib ]; then
	# MIPS RISC/os
	LibX11=/bsd43/usr/lib/libX11.a
	LibXt=/bsd43/usr/lib/libXt.a
	LibXm=/bsd43/usr/lib/libXm.a
elif [ -f /usr/lib/libPW.a ]; then
	# Regex library, possibly used by libXm
	PW=-lPW
fi

# Unpack the archives

mkdir LibX11
cd LibX11
ln -s $LibX11 .
ar x libX11.a
rm -f __* XvmsAlloc.o XvmsCalloc.o
cd ..

mkdir LibXt
cd LibXt
ln -s $LibXt .
ar x libXt.a
rm -f __* Vendor.o VMSUtil.o XtCompRL.o XtCompTM.o
cd ..

mkdir LibXm
cd LibXm
ln -s $LibXm .
ar x libXm.a
rm -f __* XmCompTM.o
cd ..

# Output all MOTIF object files

echo LibXm/*.o LibXt/*.o LibX11/*.o $PW


# --- Revision History ---------------------------------------------------
# --- Simon Nichols, Aug  9 1993
#		Now outputs libPW for systems other than Ultrix and RISC/os (i.e.
#		SGI IRIX)
# --- John Gibson, May 14 1993
#		Renamed as poplink_motif_xlibs; now just outputs filenames on
#		standard output when given an arg, or deletes dirs created otherwise
# --- John Gibson, May 10 1993 Changed to set POP_XM_EXLIBS
# --- Robert John Duncan, Apr 15 1993 -- added version number as first arg.
# --- John Gibson, Mar 27 1993 -- Uses new -xcomplete option to pglink
# --- Adrian Howard, Sep  4 1992 -- Set XLINK_TYPE correctly
# --- Robert John Duncan, Dec  2 1991 -- generalised for all MIPS systems
# --- Robert John Duncan, Jun  4 1991 -- changed STATIC to COMPLETE
# --- Robert John Duncan, May 28 1991 -- added XLINK_*STATIC
# --- Robert John Duncan, May 24 1991 -- passed on "$@" to pglink
# --- Robert John Duncan, Apr 25 1991 -- specified XvmsCalloc.o for removal
