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";
12 # Look for PAM (done weirdly due to distribution bugs (e.g. Debian) or the
14 if find_func pam_start sysdeputil.o
; then
15 locate_library
/lib
/libpam.so
.0 && echo "/lib/libpam.so.0";
16 locate_library
/usr
/lib
/libpam.so
&& echo "-lpam";
17 # HP-UX ends shared libraries with .sl
18 locate_library
/usr
/lib
/libpam.sl
&& echo "-lpam";
19 # AIX ends shared libraries with .a
20 locate_library
/usr
/lib
/libpam.a
&& echo "-lpam";
22 locate_library
/lib
/libcrypt.so
&& echo "-lcrypt";
23 locate_library
/usr
/lib
/libcrypt.so
&& echo "-lcrypt";
26 # Look for the dynamic linker library. Needed by older RedHat when
28 locate_library
/lib
/libdl.so
&& echo "-ldl";
30 # Look for libsocket. Solaris needs this.
31 locate_library
/lib
/libsocket.so
&& echo "-lsocket";
33 # Look for libnsl. Solaris needs this.
34 locate_library
/lib
/libnsl.so
&& echo "-lnsl";
36 # Look for libresolv. Solaris needs this.
37 locate_library
/lib
/libresolv.so
&& echo "-lresolv";
39 # Look for libutil. Older FreeBSD need this for setproctitle().
40 locate_library
/usr
/lib
/libutil.so
&& echo "-lutil";
43 locate_library
/usr
/lib
/libsec.sl
&& echo "-lsec";
45 # Look for libcap (capabilities)
46 if locate_library
/lib
/libcap.so
.1; then
47 echo "/lib/libcap.so.1";
48 elif locate_library
/lib
/libcap.so
.2; then
49 echo "/lib/libcap.so.2";
51 locate_library
/usr
/lib
/libcap.so
&& echo "-lcap";
52 locate_library
/lib
/libcap.so
&& echo "-lcap";
55 # Solaris needs this for nanosleep()..
56 locate_library
/lib
/libposix4.so
&& echo "-lposix4";
57 locate_library
/usr
/lib
/libposix4.so
&& echo "-lposix4";
60 locate_library
/usr
/shlib
/librt.so
&& echo "-lrt";
63 locate_library
/usr
/lib
/libsendfile.so
&& echo "-lsendfile";
66 if find_func SSL_library_init ssl.o
; then
67 echo "-lssl -lcrypto";