Commit | Line | Data |
a0d0e21e |
1 | case $CONFIG in |
2 | '') |
3 | if test -f config.sh; then TOP=.; |
4 | elif test -f ../config.sh; then TOP=..; |
5 | elif test -f ../../config.sh; then TOP=../..; |
6 | elif test -f ../../../config.sh; then TOP=../../..; |
7 | elif test -f ../../../../config.sh; then TOP=../../../..; |
8 | else |
9 | echo "Can't find config.sh."; exit 1 |
10 | fi |
11 | . $TOP/config.sh |
12 | ;; |
13 | esac |
14 | : extliblist |
15 | : |
16 | : Author: Andy Dougherty doughera@lafcol.lafayette.edu |
17 | : |
94b6baf5 |
18 | : This utility was only used by the old Makefile.SH extension |
19 | : mechanism. It is now obsolete and may be removed in a future |
20 | : release. |
21 | : |
a0d0e21e |
22 | : This utility takes a list of libraries in the form |
23 | : -llib1 -llib2 -llib3 |
24 | : and prints out lines suitable for inclusion in an extension |
25 | : Makefile. |
26 | : Extra library paths may be included with the form -L/another/path |
27 | : this will affect the searches for all subsequent libraries. |
28 | : |
29 | : It is intended to be "dotted" from within an extension Makefile.SH. |
30 | : see ext/POSIX/Makefile.SH for an example. |
31 | : Prior to calling this, the variable potential_libs should be set |
32 | : to the potential list of libraries |
33 | : |
34 | : It sets the following |
35 | : extralibs = full list of libraries needed for static linking. |
36 | : Only those libraries that actually exist are included. |
37 | : dynaloadlibs = full path names of those libraries that are needed |
38 | : but can be linked in dynamically on this platform. On |
39 | : SunOS, for example, this would be .so* libraries, |
40 | : but not archive libraries. |
41 | : Eventually, this list can be used to write a bootstrap file. |
42 | : statloadlibs = list of those libraries which must be statically |
43 | : linked into the shared library. On SunOS 4.1.3, |
44 | : for example, I have only an archive version of |
45 | : -lm, and it must be linked in statically. |
46 | : |
47 | : This script uses config.sh variables libs, libpth, and so. It is mostly |
48 | : taken from the metaconfig libs.U unit. |
49 | extralibs='' |
50 | dynaloadlibs='' |
51 | statloadlibs='' |
52 | Llibpth='' |
53 | for thislib in `echo "XXX $potential_libs " | $sed 's/ -l/ /g'` ; do |
54 | case "$thislib" in |
55 | XXX) |
56 | : Handle case where potential_libs is empty. |
57 | ;; |
58 | -L*) |
59 | : Handle possible linker path arguments. |
60 | newpath=`echo $thislib | $sed 's/^-L//'` |
61 | if $test -d $newpath; then |
62 | Llibpth="$Llibpth $newpath" |
63 | extralibs="$extralibs $thislib" |
64 | statloadlibs="$statloadlibs $thislib" |
65 | fi |
66 | ;; |
67 | *) |
68 | : Handle possible library arguments. |
69 | for thispth in $Llibpth $libpth; do |
70 | : Loop over possible wildcards and take the last one. |
71 | for fullname in $thispth/lib$thislib.$so.[0-9]* ; do |
72 | : |
73 | done |
74 | if $test -f $fullname; then |
75 | break |
76 | elif fullname=$thispth/lib$thislib.$so && $test -f $fullname; then |
77 | break |
78 | elif fullname=$thispth/lib${thislib}_s.a && $test -f $fullname; then |
79 | thislib=${thislib}_s |
80 | break |
81 | elif fullname=$thispth/lib${thislib}.a && $test -f $fullname; then |
82 | break |
83 | elif fullname=$thispth/Slib${thislib}.a && $test -f $fullname; then |
84 | break |
85 | else |
86 | fullname='' |
87 | fi |
88 | done |
89 | : Now update library lists |
90 | case "$fullname" in |
91 | '') |
92 | : Skip nonexistent files |
93 | ;; |
94 | *) |
95 | : Do not add it into the extralibs if it is already linked in |
96 | : with the main perl executable. |
97 | case " $libs " in |
98 | *" -l$thislib "*|*" -l${thislib}_s "*) ;; |
99 | *) extralibs="$extralibs -l$thislib" ;; |
100 | esac |
101 | : |
102 | : For NeXT and DLD, put files into DYNALOADLIBS to be |
103 | : converted into a boostrap file. For other systems, |
104 | : we will use ld with what I have misnamed STATLOADLIBS |
105 | : to assemble the shared object. |
106 | case "$dlsrc" in |
107 | dl_dld*|dl_next*) |
108 | dynaloadlibs="$dynaloadlibs $fullname" ;; |
109 | *) |
110 | case "$fullname" in |
111 | *.a) |
112 | statloadlibs="$statloadlibs -l$thislib" |
113 | ;; |
114 | *) |
115 | : For SunOS4, do not add in this shared library |
116 | : if it is already linked in the main |
117 | : perl executable |
118 | case "$osname" in |
119 | sunos) |
120 | case " $libs " in |
121 | *" -l$thislib "*) ;; |
122 | *) statloadlibs="$statloadlibs -l$thislib" ;; |
123 | esac |
124 | ;; |
125 | *) |
126 | statloadlibs="$statloadlibs -l$thislib" |
127 | ;; |
128 | esac |
129 | ;; |
130 | esac |
131 | ;; |
132 | esac |
133 | ;; |
134 | esac |
135 | ;; |
136 | esac |
137 | done |
138 | |
139 | case "$dlsrc" in |
140 | dl_next*) |
141 | extralibs=`echo " $extralibs "| $sed -e 's/ -lm / /'` ;; |
142 | esac |
143 | |
144 | set X $extralibs |
145 | shift |
146 | extralibs="$*" |
147 | |
148 | set X $dynaloadlibs |
149 | shift |
150 | dynaloadlibs="$*" |
151 | |
152 | set X $statloadlibs |
153 | shift |
154 | statloadlibs="$*" |
155 | |