2 # Cheesy hacky location of additional link libraries.
4 locate_library
() { [ ! "$1*" = "`echo $1*`" ]; }
5 find_func
() { egrep $1 $2 >/dev
/null
; }
7 if find_func hosts_access tcpwrap.o
; then
9 locate_library
/lib
/libnsl.so
&& echo "-lnsl";
10 locate_library
/lib64
/libnsl.so
&& echo "-lnsl";
13 # Look for PAM (done weirdly due to distribution bugs (e.g. Debian) or the
15 if find_func pam_start sysdeputil.o
; then
16 locate_library
/lib
/libpam.so
.0 && echo "/lib/libpam.so.0";
17 locate_library
/usr
/lib
/libpam.so
&& echo "-lpam";
18 locate_library
/usr
/lib64
/libpam.so
&& echo "-lpam";
19 # HP-UX ends shared libraries with .sl
20 locate_library
/usr
/lib
/libpam.sl
&& echo "-lpam";
21 # AIX ends shared libraries with .a
22 locate_library
/usr
/lib
/libpam.a
&& echo "-lpam";
24 locate_library
/lib
/libcrypt.so
&& echo "-lcrypt";
25 locate_library
/usr
/lib
/libcrypt.so
&& echo "-lcrypt";
26 locate_library
/usr
/lib64
/libcrypt.so
&& echo "-lcrypt";
29 # Look for the dynamic linker library. Needed by older RedHat when
31 locate_library
/lib
/libdl.so
&& echo "-ldl";
33 # Look for libsocket. Solaris needs this.
34 locate_library
/lib
/libsocket.so
&& echo "-lsocket";
36 # Look for libnsl. Solaris needs this.
37 locate_library
/lib
/libnsl.so
&& echo "-lnsl";
39 # Look for libresolv. Solaris needs this.
40 locate_library
/lib
/libresolv.so
&& echo "-lresolv";
42 # Look for libutil. Older FreeBSD need this for setproctitle().
43 locate_library
/usr
/lib
/libutil.so
&& echo "-lutil";
46 locate_library
/usr
/lib
/libsec.sl
&& echo "-lsec";
48 # Look for libcap (capabilities)
49 if locate_library
/lib
/libcap.so
.1; then
50 echo "/lib/libcap.so.1";
51 elif locate_library
/lib
/libcap.so
.2; then
52 echo "/lib/libcap.so.2";
54 locate_library
/usr
/lib
/libcap.so
&& echo "-lcap";
55 locate_library
/lib
/libcap.so
&& echo "-lcap";
56 locate_library
/lib64
/libcap.so
&& echo "-lcap";
59 # Solaris needs this for nanosleep()..
60 locate_library
/lib
/libposix4.so
&& echo "-lposix4";
61 locate_library
/usr
/lib
/libposix4.so
&& echo "-lposix4";
64 locate_library
/usr
/shlib
/librt.so
&& echo "-lrt";
67 locate_library
/usr
/lib
/libsendfile.so
&& echo "-lsendfile";
70 if find_func SSL_library_init ssl.o
; then
71 echo "-lssl -lcrypto";