[MPlayer-dev-eng] [PATCH] put libraries in right order for -static
Sidik Isani
lksi at cfht.hawaii.edu
Tue Oct 1 10:48:45 CEST 2002
Hello -
Static builds were configure'ing with many options (like DPMS and DGA)
disabled because the order of the -l's is critical. And even with
those things disabled, they were still failing to link. This patch
carefully re-orders the libraries in "configure" and "Makefile" so
that static builds work, and should not affect regular dynamic builds.
For example, a dynamic build doesn't care whether we put "-lX11 -lXext"
or "-lXext -lX11", but the latter is always the correct form, since Xext
needs some symbols out of X11, and not the other way around. Similarly,
SDL depends on X, and all of the mplayer libraries should go before the
system ones (e.g., libao2.a should come before any -l's.) There are
probably a few more subtle ordering things left, but the following
patch gets things building cleanly for me. (Yes, the --begin/end-group
linker hack I posted earlier is also not needed this way. This is
the "right" fix.)
Thanks,
- Sidik
-------------- next part --------------
diff -ru MPlayer-cvs/Makefile MPlayer-isani/Makefile
--- MPlayer-cvs/Makefile Mon Sep 30 21:49:58 2002
+++ MPlayer-isani/Makefile Mon Sep 30 22:26:23 2002
@@ -39,7 +39,7 @@
VO_LIBS = libvo/libvo.a
VO_INC = -Ilibvo
-V_LIBS = $(X_LIB) $(MP1E_LIB) $(GGI_LIB) $(MLIB_LIB) $(SDL_LIB) $(SVGA_LIB) $(AA_LIB) $(DIRECTFB_LIB)
+V_LIBS = $(SDL_LIB) $(X_LIB) $(MP1E_LIB) $(GGI_LIB) $(MLIB_LIB) $(SVGA_LIB) $(AA_LIB) $(DIRECTFB_LIB)
AO_LIBS = libao2/libao2.a
A_LIBS = $(ALSA_LIB) $(ARTS_LIB) $(NAS_LIB) $(MAD_LIB) $(VORBIS_LIB) $(FAAD_LIB) $(SGIAUDIO_LIB)
@@ -185,7 +185,7 @@
$(PRG): $(MPLAYER_DEP)
./darwinfixlib.sh $(MPLAYER_DEP)
- $(CC) $(CFLAGS) -o $(PRG) $(OBJS_MPLAYER) $(VO_LIBS) $(COMMON_LIBS) $(EXTRA_LIB) $(AO_LIBS) $(V_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(LIRC_LIB) $(STATIC_LIB)
+ $(CC) $(CFLAGS) -o $(PRG) $(OBJS_MPLAYER) $(VO_LIBS) $(AO_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(V_LIBS) $(COMMON_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(STATIC_LIB)
$(PRG_FIBMAP): fibmap_mplayer.o
$(CC) -o $(PRG_FIBMAP) fibmap_mplayer.o
diff -ru MPlayer-cvs/configure MPlayer-isani/configure
--- MPlayer-cvs/configure Mon Sep 30 21:49:59 2002
+++ MPlayer-isani/configure Mon Sep 30 22:08:39 2002
@@ -2217,7 +2217,7 @@
else
echores "yes (using $_ld_x11)"
fi
-_ld_x11="$_ld_x11 -lX11 -lXext $_ld_sock"
+_ld_x11="$_ld_x11 -lXext -lX11 $_ld_sock"
echocheck "X11"
@@ -2256,7 +2256,7 @@
(void) DPMSQueryExtension(0, 0, 0);
}
EOF
- cc_check $_inc_x11 $_ld_x11 -lXdpms && _xdpms3=yes
+ cc_check $_inc_x11 -lXdpms $_ld_x11 && _xdpms3=yes
fi
_xdpms4=no
if test "$_x11" = yes ; then
@@ -2274,7 +2274,7 @@
echores "yes (using Xdpms 4)"
elif test "$_xdpms3" = yes ; then
_def_xdpms='#define HAVE_XDPMS 1'
- _ld_x11="$_ld_x11 -lXdpms"
+ _ld_x11="-lXdpms $_ld_x11"
echores "yes (using Xdpms 3)"
else
_def_xdpms='#undef HAVE_XDPMS'
@@ -2290,7 +2290,7 @@
int main(void) { (void) XvGetPortAttribute(0, 0, 0, 0); return 0; }
EOF
_xv=no
- cc_check $_inc_x11 $_ld_x11 -lXv && _xv=yes
+ cc_check $_inc_x11 -lXv $_ld_x11 && _xv=yes
else
_xv=no
fi
@@ -2314,7 +2314,7 @@
int main(void) { (void) XineramaIsActive(0); return 0; }
EOF
_xinerama=no
- cc_check $_inc_x11 $_ld_x11 -lXinerama && _xinerama=yes
+ cc_check $_inc_x11 -lXinerama $_ld_x11 && _xinerama=yes
else
_xinerama=no
fi
@@ -2340,7 +2340,7 @@
int main(void) { (void) XF86VidModeQueryExtension(0, 0, 0); return 0; }
EOF
_vm=no
- cc_check $_inc_x11 $_ld_x11 -lXxf86vm && _vm=yes
+ cc_check $_inc_x11 -lXxf86vm $_ld_x11 && _vm=yes
else
_vm=no
fi
@@ -2362,14 +2362,14 @@
int main (void) { (void) XF86DGASetViewPort(0, 0, 0, 0); return 0; }
EOF
_dga=no
- cc_check $_inc_x11 $_ld_x11 -lXxf86dga -lXxf86vm && _dga=1
+ cc_check $_inc_x11 -lXxf86dga -lXxf86vm $_ld_x11 && _dga=1
cat > $TMPC << EOF
#include <X11/Xlib.h>
#include <X11/extensions/xf86dga.h>
int main (void) { (void) XDGASetViewport(0, 0, 0, 0, 0); return 0; }
EOF
- cc_check $_inc_x11 $_ld_x11 -lXxf86dga && _dga=2
+ cc_check $_inc_x11 -lXxf86dga $_ld_x11 && _dga=2
fi
_def_dga='#undef HAVE_DGA'
@@ -2831,11 +2831,11 @@
int main(void) { return 0; }
EOF
_nas=no
- cc_check -laudio $_inc_x11 $_ld_x11 -lXt -lm && _nas=yes
+ cc_check -laudio $_inc_x11 -lXt $_ld_x11 -lm && _nas=yes
fi
if test "$_nas" = yes ; then
_def_nas='#define HAVE_NAS 1'
- _ld_nas="-laudio $_ld_x11 -lXt"
+ _ld_nas="-laudio -lXt $_ld_x11"
_aosrc="$_aosrc ao_nas.c"
_aomodules="nas $_aomodules"
else
@@ -4397,7 +4397,7 @@
SRC_PATH=.
# video output
-X_LIB = $_ld_x11 $_ld_gl $_ld_dga $_ld_xv $_ld_vm $_ld_xinerama $_ld_mad $_ld_sock
+X_LIB = $_ld_gl $_ld_dga $_ld_xv $_ld_vm $_ld_xinerama $_ld_x11 $_ld_mad $_ld_sock
GGI_LIB = $_ld_ggi
MLIB_LIB = $_ld_mlib
MLIB_INC = $_inc_mlib
More information about the MPlayer-dev-eng
mailing list