[MPlayer-dev-eng] [PATCH] 'configure' does not adequately test for which socket libs to build with

Diego Biurrun diego at biurrun.de
Tue Oct 11 19:27:28 CEST 2005


On Mon, Oct 10, 2005 at 06:12:35PM +0000, Derek E. Lewis wrote:
> 
> 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.

What about just inverting the order of the linker flags instead?  That
should restore the old semantics.  IOW:

  for _ld_tmp in "-lsocket -lbind" "-lsocket -ldnet" \
    "-lsocket -lnsl" "-lnsl" "-lsocket" ; do
      cc_check $_ld_tmp && _ld_sock="$_ld_tmp" && break

Please try the suggested change and report whether it solves your problem.

Diego
-------------- next part --------------
--- configure	2005-10-11 19:01:47.000000000 +0200
+++ configure	2005-10-11 19:03:20.000000000 +0200
@@ -2484,7 +2484,7 @@
 #include <netdb.h>
 int main(void) { (void) gethostbyname(0); return 0; }
 EOF
-for _ld_tmp in "-lsocket" "-lnsl" "-lsocket -lnsl" "-lsocket -ldnet" "-lsocket -lbind" ; do
+for _ld_tmp in "-lsocket -lbind" "-lsocket -ldnet" "-lsocket -lnsl" "-lnsl" "-lsocket" ; do
   cc_check $_ld_tmp && _ld_sock="$_ld_tmp" && break
 done
 if test $_winsock2 = auto && not cygwin ; then


More information about the MPlayer-dev-eng mailing list