changeset 35943:4d83191b7218

build: Restructure mp_msg-related link library handling. This allows building tools and tests even in non-standard configurations.
author diego
date Thu, 21 Mar 2013 14:07:14 +0000
parents a24e13d192e7
children 132d5af113c8
files Makefile configure
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Thu Mar 21 14:07:00 2013 +0000
+++ b/Makefile	Thu Mar 21 14:07:14 2013 +0000
@@ -1019,7 +1019,6 @@
 
 ###### tests / tools #######
 
-MP_MSG_LIBS = -ltermcap -lm
 MP_MSG_OBJS = mp_msg.o mp_fifo.o osdep/$(GETCH) osdep/$(TIMER)
 
 libvo/aspecttest$(EXESUF): libvo/aspect.o libvo/geometry.o $(MP_MSG_OBJS)
@@ -1059,7 +1058,7 @@
 
 TOOLS/bmovl-test$(EXESUF): LIBS = -lSDL_image
 TOOLS/vfw2menc$(EXESUF):   LIBS = -lwinmm -lole32
-TOOLS/subrip$(EXESUF):     LIBS = $(MP_MSG_LIBS)
+TOOLS/subrip$(EXESUF):     LIBS = $(MP_MSG_LIBS) -lm
 TOOLS/subrip$(EXESUF): path.o sub/vobsub.o sub/spudec.o sub/unrar_exec.o \
     ffmpeg/libswscale/libswscale.a ffmpeg/libavutil/libavutil.a $(MP_MSG_OBJS)
 
--- a/configure	Thu Mar 21 14:07:00 2013 +0000
+++ b/configure	Thu Mar 21 14:07:14 2013 +0000
@@ -1741,7 +1741,7 @@
   _exesuf=".exe"
   extra_cflags="$extra_cflags -fno-common"
   # -lwinmm is always needed for osdep/timer-win2.c
-  extra_ldflags="$extra_ldflags -lwinmm"
+  timer_libs=-lwinmm
   _pe_executable=yes
   _timer=timer-win2.c
   _priority=yes
@@ -3926,7 +3926,7 @@
   _iconv=no
   for ld_tmp in "" "-liconv" "-liconv $ld_dl" ; do
     cc_check $ld_tmp && extra_ldflags="$extra_ldflags $ld_tmp" &&
-      _iconv=yes && break
+      ld_iconv="$ld_tmp" && _iconv=yes && break
   done
 fi
 if test "$_iconv" = yes ; then
@@ -4049,12 +4049,13 @@
   _termcap=no
   for ld_tmp in "-lncurses" "-ltinfo" "-ltermcap"; do
     statement_check term.h 'tgetent(0, 0)' $ld_tmp &&
-      extra_ldflags="$extra_ldflags $ld_tmp" && _termcap=yes && break
+      extra_ldflags="$extra_ldflags $ld_tmp" &&
+      ld_termcap="$ld_tmp" && _termcap=yes && break
   done
 fi
 if test "$_termcap" = yes ; then
   def_termcap='#define HAVE_TERMCAP 1'
-  test $ld_tmp && res_comment="using $ld_tmp"
+  test $ld_termcap && res_comment="using $ld_termcap"
 else
   def_termcap='#undef HAVE_TERMCAP'
 fi
@@ -8297,10 +8298,12 @@
 CFLAGS_STACKREALIGN      = $cflags_stackrealign
 CFLAGS_SVGALIB_HELPER    = $cflags_svgalib_helper
 
-EXTRALIBS          = $extra_ldflags $ld_static $extra_libs
+EXTRALIBS          = $extra_ldflags $ld_static $timer_libs $extra_libs
 EXTRALIBS_MPLAYER  = $libs_mplayer
 EXTRALIBS_MENCODER = $libs_mencoder
 
+MP_MSG_LIBS = $ld_iconv $ld_termcap $timer_libs
+
 GETCH = $_getch
 HELP_FILE = $_mp_help
 TIMER = $_timer