Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / lib / tt / tt_ld.sh
1 # Shell script for linking C++ ToolTalk routines.  We have
2 # %%  (c) Copyright 1993, 1994 Hewlett-Packard Company                  
3 # %%  (c) Copyright 1993, 1994 International Business Machines Corp.    
4 # %%  (c) Copyright 1993, 1994 Sun Microsystems, Inc.                   
5 # %%  (c) Copyright 1993, 1994 Novell, Inc.                             
6 # %%  $XConsortium: tt_ld.sh /main/4 1995/10/20 16:23:10 rswiston $                                                     
7 # to do this "by hand" to get all the compiler libraries included
8 # just once, with libC static and libc and libm dynamic.
9
10 # Calling sequence
11 # tt_ld $(CCLIBDIR) $@ $(LDFLAGS) -- $(OBJECT_FILES) $(TT_LIBS) $(TT_AUX_LIBS)
12 #
13
14 CCLIBDIR=$1; shift
15 BINARY=$1; shift
16 LDFLAGS=""
17 while   test "$1" != "--"
18 do      LDFLAGS="$LDFLAGS $1"
19         shift
20 done
21 shift
22
23 if      test "$TARGET_SYS" = "SVR4";
24 then
25         echo $0 is not used for SVR4 based systems.  Check your Makefiles and
26         echo environment variables.
27         exit 1
28 else
29         if test "$PROF" = "gprof";
30         then
31                 if ld -dc -dp -e start -X $LDFLAGS -Bstatic -o $BINARY \
32                                 $CCLIBDIR/gcrt0.o $CCLIBDIR/cg87/_crt1.o \
33                                 -L$CCLIBDIR/cg87 -L$CCLIBDIR \
34                                 $* \
35                                 -Bstatic -lX11 -lC  -lc_p -lm >/tmp/ld.$$.4.err 2>&1
36                 then    $CCLIBDIR/c++filt </tmp/ld.$$.4.err
37                         rm -f /tmp/ld.$$.4.err
38                         $CCLIBDIR/patch $BINARY
39                         exit 0
40                 else    $CCLIBDIR/c++filt </tmp/ld.$$.4.err
41                         rm -f /tmp/ld.$$.4.err
42                         exit 1
43                 fi
44         else
45                 if ld -dc -dp -e start -X $LDFLAGS -o $BINARY \
46                                 $CCLIBDIR/crt0.o $CCLIBDIR/cg87/_crt1.o \
47                                 -L$CCLIBDIR/cg87 -L$CCLIBDIR \
48                                 $* \
49                                 -Bstatic -lC -Bdynamic -lc -lm >/tmp/ld.$$.4.err 2>&1
50                 then    $CCLIBDIR/c++filt </tmp/ld.$$.4.err
51                         rm -f /tmp/ld.$$.4.err
52                         $CCLIBDIR/patch $BINARY
53                         exit 0
54                 else    $CCLIBDIR/c++filt </tmp/ld.$$.4.err
55                         rm -f /tmp/ld.$$.4.err
56                         exit 1
57                 fi
58         fi
59 fi
60