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 | |
4 | ?RCS: | |
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: | |
d088635c | 35 | ?MAKE:libs ignore_versioned_solibs libsfound libsfiles libsdirs: \ |
508a21cd | 36 | test cat Myread Oldconfig Loc libpth package xlibpth so _a \ |
2bdc7c0c | 37 | use64bits usesocks ccflags |
959f3c4c JH |
38 | ?MAKE: -pick add $@ %< |
39 | ?S:libs: | |
40 | ?S: This variable holds the additional libraries we want to use. | |
41 | ?S: It is up to the Makefile to deal with it. | |
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:. | |
959f3c4c JH |
55 | ?S:ignore_versioned_solibs: |
56 | ?S: This variable should be non-empty if non-versioned shared | |
57 | ?S: libraries (libfoo.so.x.y) are to be ignored (because they | |
58 | ?S: cannot be linked against). | |
59 | ?S:. | |
d088635c | 60 | ?T:xxx yyy thislib libswanted libstyle libname |
959f3c4c JH |
61 | ?D:libs='' |
62 | ?X: | |
63 | ?X: This order is chosen so that libraries -lndir, -ldir, -lucb, -lbsd, | |
64 | ?X: -lBSD, -lPW, and -lx only get used if there are unresolved | |
65 | ?X: routines at link time. Usually, these are backwards compatability | |
66 | ?X: libraries, and may not be as reliable as the standard c library. | |
67 | ?X: | |
68 | ?X: The -lsocket -linet -lnsl order has been reported to be necessary | |
69 | ?X: for at least one SVR4 implementation. | |
70 | ?X: -lc must proceed -lucb or -lbsd for most Solaris applications. | |
71 | ?X: -lc_s proceeds -lc so we pick up the shared library version, if | |
72 | ?X: it is available. | |
73 | ?X: | |
74 | ?X: The ordering of c, posix, and cposix is a guess and almost | |
75 | ?X: certainly wrong on about half of all systems. | |
76 | ?X: | |
77 | ?X: Set proper libswanted in your private Myinit.U if needed. | |
78 | ?X: | |
79 | ?X:: default ordered library list | |
80 | ?X:libswanted='net socket inet nsl nm sdbm gdbm ndbm dbm malloc dl' | |
81 | ?X:libswanted="$libswanted dld sun m c_s c posix cposix ndir dir ucb" | |
d088635c | 82 | ?X:libswanted="$libswanted bsd BSD PW x iconv" |
959f3c4c JH |
83 | ?X: |
84 | ?INIT:: default library list | |
85 | ?INIT:libswanted='' | |
86 | ?INIT:: some systems want to use only the non-versioned libso:s | |
87 | ?INIT:ignore_versioned_solibs='' | |
88 | : Looking for optional libraries | |
89 | echo " " | |
90 | echo "Checking for optional libraries..." >&4 | |
91 | case "$libs" in | |
92 | ' '|'') dflt='';; | |
93 | *) dflt="$libs";; | |
94 | esac | |
95 | case "$libswanted" in | |
96 | '') libswanted='c_s';; | |
97 | esac | |
98 | ?X: libsocks has nasty naming. | |
99 | case "$usesocks" in | |
100 | $define) | |
101 | libswanted="$libswanted socks5 socks5_sh" | |
102 | ;; | |
103 | esac | |
104 | for thislib in $libswanted; do | |
105 | ||
106 | ?X: | |
107 | ?X: Comparisons via case statement use the string " $dflt " to ensure that | |
108 | ?X: each library is separated by a space. That way, by looking to something | |
109 | ?X: like *"-l$thislib "*, we ensure we find -lm and not -lmalloc (which was | |
110 | ?X: the case with the old looking pattern *-l$thislib*. | |
111 | ?X: | |
508a21cd | 112 | libname="$thislib" |
4caea067 JH |
113 | if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth` |
114 | $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X" ; then | |
115 | libstyle=shared | |
959f3c4c | 116 | elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then |
508a21cd | 117 | libstyle=shared |
959f3c4c | 118 | elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then |
508a21cd | 119 | libstyle=static |
959f3c4c JH |
120 | ?X: Don't forget about OS/2 where -lmalloc is spelled out malloc.a |
121 | elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then | |
508a21cd | 122 | libstyle=static |
959f3c4c | 123 | elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then |
508a21cd JH |
124 | libstyle=static |
125 | libname=${thislib}_s | |
959f3c4c | 126 | elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then |
508a21cd JH |
127 | libstyle="static" |
128 | fi | |
129 | if $test -f "$xxx"; then | |
508a21cd JH |
130 | case "$libstyle" in |
131 | shared) echo "Found -l$libname (shared)." ;; | |
132 | static) echo "Found -l$libname." ;; | |
133 | *) echo "Found -l$libname ($libstyle)." ;; | |
134 | esac | |
959f3c4c JH |
135 | case " $dflt " in |
136 | *"-l$thislib "*);; | |
d088635c JH |
137 | *) dflt="$dflt -l$libname" |
138 | libsfound="$libsfound $xxx" | |
139 | yyy=`basename $xxx` | |
140 | libsfiles="$libsfiles $yyy" | |
141 | yyy=`echo $xxx|sed "s@/$yyy\\$@@"` | |
142 | case " $libsdirs " in | |
143 | *" $yyy "*) ;; | |
144 | *) libsdirs="$libsdirs $yyy" ;; | |
145 | esac | |
146 | ;; | |
959f3c4c JH |
147 | esac |
148 | else | |
149 | echo "No -l$thislib." | |
150 | fi | |
151 | done | |
152 | set X $dflt | |
153 | shift | |
154 | dflt="$*" | |
155 | case "$libs" in | |
156 | '') dflt="$dflt";; | |
157 | *) dflt="$libs";; | |
158 | esac | |
159 | case "$dflt" in | |
160 | ' '|'') dflt='none';; | |
161 | esac | |
162 | ||
163 | $cat <<EOM | |
164 | ||
165 | In order to compile $package on your machine, a number of libraries | |
166 | are usually needed. Include any other special libraries here as well. | |
167 | Say "none" for none. The default list is almost always right. | |
168 | EOM | |
169 | ||
170 | echo " " | |
171 | rp="What libraries to use?" | |
172 | . ./myread | |
173 | case "$ans" in | |
174 | none) libs=' ';; | |
175 | *) libs="$ans";; | |
176 | esac | |
177 |