This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
/\=/ does not require \ even in older awk
[metaconfig.git] / U / modified / libs.U
CommitLineData
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:
65a32477 5?RCS: You may redistribute only under the terms of the Artistic License,
959f3c4c
JH
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
65a32477 8?RCS: that same Artistic License; a copy of which may be found at the root
959f3c4c
JH
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 \
a5cfd76b 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
ed5d019e 68?X: routines at link time. Usually, these are backwards compatibility
959f3c4c
JH
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=''
74e93a3a 91?LINT:extern usecbacktrace
9544e06a 92?LINT:extern libscheck
9f542ee7 93?LINT:extern p
cfa96255 94?LINT:use uselongdouble
959f3c4c
JH
95: Looking for optional libraries
96echo " "
97echo "Checking for optional libraries..." >&4
98case "$libs" in
99' '|'') dflt='';;
100*) dflt="$libs";;
101esac
102case "$libswanted" in
103'') libswanted='c_s';;
104esac
fd1a35d0 105?X: libsocks has nasty naming scheme.
4c42341b 106?X: This does not work if somebody wants SOCKS 4.
959f3c4c 107case "$usesocks" in
1cc20cf7 108"$define") libswanted="$libswanted socks5 socks5_sh" ;;
959f3c4c 109esac
74e93a3a
MBT
110case "$usecbacktrace" in
111"$define") libswanted="$libswanted bfd" ;;
112esac
d75930da
JH
113libsfound=''
114libsfiles=''
115libsdirs=''
9544e06a
JH
116libspath=''
117for thisdir in $libpth $xlibpth; do
118 test -d $thisdir && libspath="$libspath $thisdir"
119done
959f3c4c 120for thislib in $libswanted; do
9544e06a 121 for thisdir in $libspath; do
4ee071c7
JH
122 xxx=''
123 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
e921e17c 124 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
8b00cf4b
MBT
125 $test -f "$xxx" && eval $libscheck
126 $test -f "$xxx" && libstyle=shared
127 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
4ee071c7
JH
128 $test -f "$xxx" && eval $libscheck
129 $test -f "$xxx" && libstyle=shared
130 fi
131 if test ! -f "$xxx"; then
5d8a1008
MB
132 xxx=$thisdir/lib$thislib.$so$_a
133 $test -f "$xxx" && eval $libscheck
134 $test -f "$xxx" && libstyle="import"
135 fi
136 if test ! -f "$xxx"; then
137 xxx=$thisdir/$thislib.$so$_a
138 $test -f "$xxx" && eval $libscheck
139 $test -f "$xxx" && libstyle="import"
140 fi
141 if test ! -f "$xxx"; then
4ee071c7
JH
142 xxx=$thisdir/lib$thislib.$so
143 $test -f "$xxx" && eval $libscheck
144 $test -f "$xxx" && libstyle=shared
4c42341b 145 fi
4ee071c7
JH
146 if test ! -f "$xxx"; then
147 xxx=$thisdir/lib$thislib$_a
148 $test -f "$xxx" && eval $libscheck
149 $test -f "$xxx" && libstyle=static
150 fi
151 if test ! -f "$xxx"; then
152 xxx=$thisdir/$thislib$_a
153 $test -f "$xxx" && eval $libscheck
154 $test -f "$xxx" && libstyle=static
155 fi
156 if test ! -f "$xxx"; then
157 xxx=$thisdir/lib${thislib}_s$_a
158 $test -f "$xxx" && eval $libscheck
159 $test -f "$xxx" && libstyle=static
e4e826e0 160 $test -f "$xxx" && thislib=${thislib}_s
4ee071c7
JH
161 fi
162 if test ! -f "$xxx"; then
163 xxx=$thisdir/Slib$thislib$_a
164 $test -f "$xxx" && eval $libscheck
165 $test -f "$xxx" && libstyle=static
166 fi
167 if $test -f "$xxx"; then
508a21cd 168 case "$libstyle" in
4ee071c7
JH
169 shared) echo "Found -l$thislib (shared)." ;;
170 static) echo "Found -l$thislib." ;;
171 *) echo "Found -l$thislib ($libstyle)." ;;
508a21cd 172 esac
959f3c4c
JH
173 case " $dflt " in
174 *"-l$thislib "*);;
4ee071c7 175 *) dflt="$dflt -l$thislib"
5d8a1008
MB
176 libsfound="$libsfound $xxx"
177 yyy=`basename $xxx`
178 libsfiles="$libsfiles $yyy"
179 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
180 case " $libsdirs " in
181 *" $yyy "*) ;;
182 *) libsdirs="$libsdirs $yyy" ;;
183 esac
d088635c 184 ;;
959f3c4c 185 esac
4ee071c7 186 break
4c42341b 187 fi
4ee071c7
JH
188 done
189 if $test ! -f "$xxx"; then
190 echo "No -l$thislib."
959f3c4c
JH
191 fi
192done
193set X $dflt
194shift
195dflt="$*"
196case "$libs" in
197'') dflt="$dflt";;
198*) dflt="$libs";;
199esac
200case "$dflt" in
201' '|'') dflt='none';;
202esac
203
204$cat <<EOM
205
206In order to compile $package on your machine, a number of libraries
207are usually needed. Include any other special libraries here as well.
208Say "none" for none. The default list is almost always right.
209EOM
210
211echo " "
212rp="What libraries to use?"
213. ./myread
214case "$ans" in
215none) libs=' ';;
216*) libs="$ans";;
217esac
218