[MPlayer-dev-eng] [PATCH] 'configure' does not adequately test for which socket libs to build with
Derek E. Lewis
dlewis at solnetworks.net
Mon Oct 10 20:12:35 CEST 2005
In the latest CVS source (10 October 2005 17:53 GMT) the 'configure'
script does not append a -lsocket to MPLAYER_NETWORK_LIB in config.mak
. -lsocket is needed to build mplayer with network support in Solaris;
otherwise, a user will encounter unknown symbol errors when linking
occurs later on in the build process like these:
Undefined first referenced
symbol in file
bind libmpdemux/libmpdemux.a(rtp.o)
(symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
recv
libmpdemux/libmpdemux.a(stream_ftp.o) (symbol belongs to implicit
dependency /usr/lib/libsocket.so.1)
send
libmpdemux/libmpdemux.a(stream_ftp.o) (symbol belongs to implicit
dependency /usr/lib/libsocket.so.1)
socket libmpdemux/libmpdemux.a(network.o)
(symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
setsockopt libmpdemux/libmpdemux.a(rtp.o)
(symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
getsockopt libmpdemux/libmpdemux.a(network.o)
(symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
connect libmpdemux/libmpdemux.a(network.o)
(symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
The function that is currently used to test for the existence of socket
libs, gethostbyname(), is only a part of the nsl library, so any tests
using -lnsl and -lsocket complete successfully -- likewise, if the test
only uses -lnsl.
In previous versions of mplayer, specfically, 1.0pre7try2 this was not a
problem, though. The 'configure' script used does not use a loop like
the one in the latest cvs source.
#include <netdb.h>
int main(void) { (void) gethostbyname(0); return 0; }
EOF
cc_check -lsocket && _ld_sock="-lsocket"
cc_check -lnsl && _ld_sock="-lnsl"
cc_check -lsocket -lnsl && _ld_sock="-lsocket -lnsl"
cc_check -lsocket -ldnet && _ld_sock="-lsocket -ldnet"
cc_check -lsocket -lbind && _ld_sock="-lsocket -lbind"
Because "cc_check -lsocket -lnsl && _ld_sock="-lsocket -lnsl" is the
last to complete sucessfully, MPLAYER_NETWORK_LIB is set as it should
be; however, in the latest CVS source:
for _ld_tmp in "-lsocket" "-lnsl" "-lsocket -lnsl" "-lsocket -ldnet"
"-lsocket -
lbind" ; do
cc_check $_ld_tmp && _ld_sock="$_ld_tmp" && break
the loop breaks at the first successful compilation -- "-lnsl", instead
of "-lsocket -lnsl".
So, I have provided the following patch, that tests for, both, the
existence of the socket library and the nsl library.
--- configure.orig 2005-10-10 17:03:47.653082000 +0000
+++ configure 2005-10-10 18:11:05.830982000 +0000
@@ -2482,7 +2482,8 @@
# for BeOS (socket stuff is in -lsocket, gethostbyname and friends in
-lbind):
cat > $TMPC << EOF
#include <netdb.h>
-int main(void) { (void) gethostbyname(0); return 0; }
+#include <sys/socket.h>
+int main(void) { (void) gethostbyname(0); (void)
socket(AF_INET,SOCK_STREAM,0); return 0; }
EOF
for _ld_tmp in "-lsocket" "-lnsl" "-lsocket -lnsl" "-lsocket -ldnet"
"-lsocket -lbind" ; do
cc_check $_ld_tmp && _ld_sock="$_ld_tmp" && break
--
Derek E. Lewis
dlewis at solnetworks.net
http://riemann.solnetworks.net/~dlewis
More information about the MPlayer-dev-eng
mailing list