[MPlayer-dev-eng] [PATCH] 'configure' does not adequately test for which socket libs to build with
Ivan Kalvachev
ikalvachev at gmail.com
Tue Oct 11 22:26:41 CEST 2005
2005/10/11, Diego Biurrun <diego at biurrun.de>:
> 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
>
Or maybe it would be better if the test program contains few of the
other socket functions that we need?
More information about the MPlayer-dev-eng
mailing list