Commit | Line | Data |
---|---|---|
959f3c4c JH |
1 | ?RCS: $Id: libs.U,v 3.0.1.6 1997/02/28 16:09:11 ram Exp $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1991-1993, Raphael Manfredi | |
4c42341b | 4 | ?RCS: |
959f3c4c JH |
5 | ?RCS: You may redistribute only under the terms of the Artistic Licence, |
6 | ?RCS: as specified in the README file that comes with the distribution. | |
7 | ?RCS: You may reuse parts of this distribution only within the terms of | |
8 | ?RCS: that same Artistic Licence; a copy of which may be found at the root | |
9 | ?RCS: of the source tree for dist 3.0. | |
10 | ?RCS: | |
11 | ?RCS: $Log: libs.U,v $ | |
12 | ?RCS: Revision 3.0.1.6 1997/02/28 16:09:11 ram | |
13 | ?RCS: patch61: replaced .a with $_a all over the place | |
14 | ?RCS: | |
15 | ?RCS: Revision 3.0.1.5 1995/07/25 14:12:05 ram | |
16 | ?RCS: patch56: now knows about OS/2 platforms | |
17 | ?RCS: | |
18 | ?RCS: Revision 3.0.1.4 1994/10/29 16:24:22 ram | |
19 | ?RCS: patch36: removed old broken thislib/thatlib processing (ADO) | |
20 | ?RCS: | |
21 | ?RCS: Revision 3.0.1.3 1994/06/20 07:05:44 ram | |
22 | ?RCS: patch30: code cleanup with if/elif by ADO and RAM | |
23 | ?RCS: patch30: undone patch23 for libswanted default setting | |
24 | ?RCS: | |
25 | ?RCS: Revision 3.0.1.2 1994/05/06 15:08:45 ram | |
26 | ?RCS: patch23: now includes ordered default libswanted variable (ADO) | |
27 | ?RCS: patch23: major cleanup for library lookups (ADO) | |
28 | ?RCS: | |
29 | ?RCS: Revision 3.0.1.1 1993/08/25 14:02:31 ram | |
30 | ?RCS: patch6: added default for libs | |
31 | ?RCS: | |
32 | ?RCS: Revision 3.0 1993/08/18 12:09:03 ram | |
33 | ?RCS: Baseline for dist 3.0 netwide release. | |
34 | ?RCS: | |
9544e06a | 35 | ?MAKE:libs ignore_versioned_solibs libsfound libsfiles libsdirs libspath: \ |
508a21cd | 36 | test cat Myread Oldconfig Loc libpth package xlibpth so _a \ |
cfa96255 | 37 | usesocks sed uselongdouble |
959f3c4c JH |
38 | ?MAKE: -pick add $@ %< |
39 | ?S:libs: | |
40 | ?S: This variable holds the additional libraries we want to use. | |
7fdfc47f | 41 | ?S: It is up to the Makefile to deal with it. The list can be empty. |
959f3c4c | 42 | ?S:. |
d088635c JH |
43 | ?S:libsfound: |
44 | ?S: This variable holds the full pathnames of the libraries | |
45 | ?S: we found and accepted. | |
46 | ?S:. | |
47 | ?S:libsfiles: | |
48 | ?S: This variable holds the filenames aka basenames of the libraries | |
49 | ?S: we found and accepted. | |
50 | ?S:. | |
51 | ?S:libsdirs: | |
52 | ?S: This variable holds the directory names aka dirnames of the libraries | |
53 | ?S: we found and accepted, duplicates are removed. | |
54 | ?S:. | |
9544e06a JH |
55 | ?S:libspath: |
56 | ?S: This variable holds the directory names probed for libraries. | |
57 | ?S:. | |
959f3c4c JH |
58 | ?S:ignore_versioned_solibs: |
59 | ?S: This variable should be non-empty if non-versioned shared | |
60 | ?S: libraries (libfoo.so.x.y) are to be ignored (because they | |
61 | ?S: cannot be linked against). | |
62 | ?S:. | |
d12857d9 | 63 | ?T:xxx yyy thislib thisdir libswanted libstyle |
959f3c4c JH |
64 | ?D:libs='' |
65 | ?X: | |
66 | ?X: This order is chosen so that libraries -lndir, -ldir, -lucb, -lbsd, | |
67 | ?X: -lBSD, -lPW, and -lx only get used if there are unresolved | |
68 | ?X: routines at link time. Usually, these are backwards compatability | |
69 | ?X: libraries, and may not be as reliable as the standard c library. | |
70 | ?X: | |
71 | ?X: The -lsocket -linet -lnsl order has been reported to be necessary | |
72 | ?X: for at least one SVR4 implementation. | |
73 | ?X: -lc must proceed -lucb or -lbsd for most Solaris applications. | |
74 | ?X: -lc_s proceeds -lc so we pick up the shared library version, if | |
75 | ?X: it is available. | |
76 | ?X: | |
77 | ?X: The ordering of c, posix, and cposix is a guess and almost | |
78 | ?X: certainly wrong on about half of all systems. | |
79 | ?X: | |
80 | ?X: Set proper libswanted in your private Myinit.U if needed. | |
81 | ?X: | |
82 | ?X:: default ordered library list | |
c1dcd061 | 83 | ?X:libswanted='net socket inet bind nsl nm sdbm gdbm ndbm dbm malloc dl' |
959f3c4c | 84 | ?X:libswanted="$libswanted dld sun m c_s c posix cposix ndir dir ucb" |
4a688124 | 85 | ?X:libswanted="$libswanted bsd BSD PW x" |
959f3c4c JH |
86 | ?X: |
87 | ?INIT:: default library list | |
88 | ?INIT:libswanted='' | |
89 | ?INIT:: some systems want to use only the non-versioned libso:s | |
90 | ?INIT:ignore_versioned_solibs='' | |
9544e06a | 91 | ?LINT:extern libscheck |
9f542ee7 | 92 | ?LINT:extern p |
cfa96255 | 93 | ?LINT:use uselongdouble |
959f3c4c JH |
94 | : Looking for optional libraries |
95 | echo " " | |
96 | echo "Checking for optional libraries..." >&4 | |
97 | case "$libs" in | |
98 | ' '|'') dflt='';; | |
99 | *) dflt="$libs";; | |
100 | esac | |
101 | case "$libswanted" in | |
102 | '') libswanted='c_s';; | |
103 | esac | |
fd1a35d0 | 104 | ?X: libsocks has nasty naming scheme. |
4c42341b | 105 | ?X: This does not work if somebody wants SOCKS 4. |
959f3c4c | 106 | case "$usesocks" in |
1cc20cf7 | 107 | "$define") libswanted="$libswanted socks5 socks5_sh" ;; |
959f3c4c | 108 | esac |
d75930da JH |
109 | libsfound='' |
110 | libsfiles='' | |
111 | libsdirs='' | |
9544e06a JH |
112 | libspath='' |
113 | for thisdir in $libpth $xlibpth; do | |
114 | test -d $thisdir && libspath="$libspath $thisdir" | |
115 | done | |
959f3c4c | 116 | for thislib in $libswanted; do |
9544e06a | 117 | for thisdir in $libspath; do |
4ee071c7 JH |
118 | xxx='' |
119 | if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then | |
e921e17c | 120 | xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'` |
4ee071c7 JH |
121 | $test -f "$xxx" && eval $libscheck |
122 | $test -f "$xxx" && libstyle=shared | |
123 | fi | |
124 | if test ! -f "$xxx"; then | |
125 | xxx=$thisdir/lib$thislib.$so | |
126 | $test -f "$xxx" && eval $libscheck | |
127 | $test -f "$xxx" && libstyle=shared | |
4c42341b | 128 | fi |
4ee071c7 JH |
129 | if test ! -f "$xxx"; then |
130 | xxx=$thisdir/lib$thislib$_a | |
131 | $test -f "$xxx" && eval $libscheck | |
132 | $test -f "$xxx" && libstyle=static | |
133 | fi | |
134 | if test ! -f "$xxx"; then | |
135 | xxx=$thisdir/$thislib$_a | |
136 | $test -f "$xxx" && eval $libscheck | |
137 | $test -f "$xxx" && libstyle=static | |
138 | fi | |
139 | if test ! -f "$xxx"; then | |
140 | xxx=$thisdir/lib${thislib}_s$_a | |
141 | $test -f "$xxx" && eval $libscheck | |
142 | $test -f "$xxx" && libstyle=static | |
e4e826e0 | 143 | $test -f "$xxx" && thislib=${thislib}_s |
4ee071c7 JH |
144 | fi |
145 | if test ! -f "$xxx"; then | |
146 | xxx=$thisdir/Slib$thislib$_a | |
147 | $test -f "$xxx" && eval $libscheck | |
148 | $test -f "$xxx" && libstyle=static | |
149 | fi | |
150 | if $test -f "$xxx"; then | |
508a21cd | 151 | case "$libstyle" in |
4ee071c7 JH |
152 | shared) echo "Found -l$thislib (shared)." ;; |
153 | static) echo "Found -l$thislib." ;; | |
154 | *) echo "Found -l$thislib ($libstyle)." ;; | |
508a21cd | 155 | esac |
959f3c4c JH |
156 | case " $dflt " in |
157 | *"-l$thislib "*);; | |
4ee071c7 | 158 | *) dflt="$dflt -l$thislib" |
d088635c JH |
159 | libsfound="$libsfound $xxx" |
160 | yyy=`basename $xxx` | |
161 | libsfiles="$libsfiles $yyy" | |
70ffff07 | 162 | yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"` |
d088635c JH |
163 | case " $libsdirs " in |
164 | *" $yyy "*) ;; | |
165 | *) libsdirs="$libsdirs $yyy" ;; | |
166 | esac | |
167 | ;; | |
959f3c4c | 168 | esac |
4ee071c7 | 169 | break |
4c42341b | 170 | fi |
4ee071c7 JH |
171 | done |
172 | if $test ! -f "$xxx"; then | |
173 | echo "No -l$thislib." | |
959f3c4c JH |
174 | fi |
175 | done | |
176 | set X $dflt | |
177 | shift | |
178 | dflt="$*" | |
179 | case "$libs" in | |
180 | '') dflt="$dflt";; | |
181 | *) dflt="$libs";; | |
182 | esac | |
183 | case "$dflt" in | |
184 | ' '|'') dflt='none';; | |
185 | esac | |
186 | ||
187 | $cat <<EOM | |
188 | ||
189 | In order to compile $package on your machine, a number of libraries | |
190 | are usually needed. Include any other special libraries here as well. | |
191 | Say "none" for none. The default list is almost always right. | |
192 | EOM | |
193 | ||
194 | echo " " | |
195 | rp="What libraries to use?" | |
196 | . ./myread | |
197 | case "$ans" in | |
198 | none) libs=' ';; | |
199 | *) libs="$ans";; | |
200 | esac | |
201 |