[Pkg-voip-commits] [pjproject] 06/28: Reduce linkage of unused libraries

tzafrir at debian.org tzafrir at debian.org
Mon Dec 21 06:05:50 UTC 2015


This is an automated email from the git hooks/post-receive script.

tzafrir pushed a commit to branch master-broken-2
in repository pjproject.

commit 3cd38cc37577bd6b69f1eda1213bc81019c97c43
Author: Tzafrir Cohen <tzafrir at debian.org>
Date:   Thu Aug 13 17:49:57 2015 +0200

    Reduce linkage of unused libraries
    
    The following libraries: ffmpeg, v4l, opencore-amr and SDL are linked
    with all the libraries. But are only needed for a small part of them.
    
    Have them linked with the relevant ones explicitly.
    
    For pjlib-utils and pjnath the list of libraries is currently empty,
    and is left as a placeholder.
---
 aconfigure                | 16 ++++++++++++----
 aconfigure.ac             | 18 +++++++++++++-----
 build.mak.in              |  5 +++++
 pjlib-util/build/Makefile |  2 +-
 pjmedia/build/Makefile    |  1 +
 pjnath/build/Makefile     |  3 ++-
 6 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/aconfigure b/aconfigure
index eb50910..463564a 100755
--- a/aconfigure
+++ b/aconfigure
@@ -621,6 +621,11 @@ ac_includes_default="\
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 PJLIB_EXT
+PJLIB_UTIL_EXT
+PJMEDIA_EXT
+PJMEDIA_CODEC_EXT
+PJMEDIA_VIDEODEV_EXT
+PJNATH_EXT
 ac_main_obj
 ac_host
 ac_linux_poll
@@ -6647,7 +6652,7 @@ $as_echo "not found" >&6; }
 			ac_sdl_cflags=`$SDL_CONFIG --cflags`
 			ac_sdl_cflags="-DPJMEDIA_VIDEO_DEV_HAS_SDL=1 $ac_sdl_cflags"
 			ac_sdl_ldflags=`$SDL_CONFIG --libs`
-			LIBS="$LIBS $ac_sdl_ldflags"
+			PJMEDIA_VIDEODEV_EXT="$PJMEDIA_VIDEODEV_EXT $ac_sdl_ldflags"
 		  else
 			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Unsupported SDL version" >&5
 $as_echo "Unsupported SDL version" >&6; }
@@ -7050,7 +7055,9 @@ fi
 
 		fi
 
-		LIBS="$LIBS $ac_ffmpeg_ldflags"
+		PJMEDIA_EXT="$PJMEDIA_EXT $ac_ffmpeg_ldflags"
+		PJMEDIA_CODEC_EXT="$PJMEDIA_CODEC_EXT $ac_ffmpeg_ldflags"
+		# FIXME: only needs libavutil
 		export PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH
 
 
@@ -7108,7 +7115,7 @@ $as_echo "$ac_cv_lib_v4l2_v4l2_open" >&6; }
 if test "x$ac_cv_lib_v4l2_v4l2_open" = xyes; then :
   ac_v4l2_cflags="-DPJMEDIA_VIDEO_DEV_HAS_V4L2=1"
 			      ac_v4l2_ldflags="-lv4l2"
-			      LIBS="$LIBS -lv4l2"
+			      PJMEDIA_VIDEODEV_EXT="$PJMEDIA_VIDEODEV_EXT -lv4l2"
 
 
 fi
@@ -7878,6 +7885,7 @@ fi
 $as_echo "$ac_cv_lib_opencore_amrnb_Encoder_Interface_init" >&6; }
 if test "x$ac_cv_lib_opencore_amrnb_Encoder_Interface_init" = xyes; then :
   opencore_amrnb_present=1 && LIBS="$LIBS -lopencore-amrnb"
+  opencore_amrnb_present=1
 fi
 
 		if test "x$opencore_amrnb_h_present" = "x1" -a "x$opencore_amrnb_present" = "x1"; then
@@ -7943,7 +7951,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_opencore_amrwb_D_IF_init" >&5
 $as_echo "$ac_cv_lib_opencore_amrwb_D_IF_init" >&6; }
 if test "x$ac_cv_lib_opencore_amrwb_D_IF_init" = xyes; then :
-  opencore_amrwb_dec_present=1 && LIBS="$LIBS -lopencore-amrwb"
+  opencore_amrwb_dec_present=1
 fi
 
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for E_IF_init in -lvo-amrwbenc" >&5
diff --git a/aconfigure.ac b/aconfigure.ac
index 72446dd..8a4fee8 100644
--- a/aconfigure.ac
+++ b/aconfigure.ac
@@ -115,6 +115,11 @@ AC_CHECK_LIB(socket,puts)
 AC_CHECK_LIB(rt,puts)
 AC_CHECK_LIB(m,sin)
 AC_SUBST(PJLIB_EXT)
+AC_SUBST(PJLIB_UTIL_EXT)
+AC_SUBST(PJMEDIA_EXT)
+AC_SUBST(PJMEDIA_CODEC_EXT)
+AC_SUBST(PJMEDIA_VIDEODEV_EXT)
+AC_SUBST(PJNATH_EXT)
 AC_CHECK_LIB(uuid,uuid_generate,[PJLIB_EXT="-luuid $PJLIB_EXT"])
 AC_CHECK_LIB(uuid,uuid_generate,[ac_has_uuid_lib=1])
 AC_SEARCH_LIBS(gethostbyname,nsl)
@@ -951,7 +956,7 @@ AC_ARG_ENABLE(sdl,
 			ac_sdl_cflags=`$SDL_CONFIG --cflags`
 			ac_sdl_cflags="-DPJMEDIA_VIDEO_DEV_HAS_SDL=1 $ac_sdl_cflags"
 			ac_sdl_ldflags=`$SDL_CONFIG --libs`
-			LIBS="$LIBS $ac_sdl_ldflags"
+			PJMEDIA_VIDEODEV_EXT="$PJMEDIA_VIDEODEV_EXT $ac_sdl_ldflags"
 		  else
 			AC_MSG_RESULT([Unsupported SDL version])
 		  fi
@@ -1088,7 +1093,9 @@ AC_ARG_ENABLE(ffmpeg,
 			
 		fi
 		
-		LIBS="$LIBS $ac_ffmpeg_ldflags"
+		PJMEDIA_EXT="$PJMEDIA_EXT $ac_ffmpeg_ldflags"
+		PJMEDIA_CODEC_EXT="$PJMEDIA_CODEC_EXT $ac_ffmpeg_ldflags"
+		# FIXME: only needs libavutil
 		export PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH
 	      ]
 	      )
@@ -1109,7 +1116,8 @@ AC_ARG_ENABLE(v4l2,
 			     v4l2_open,
 			     [ac_v4l2_cflags="-DPJMEDIA_VIDEO_DEV_HAS_V4L2=1"
 			      ac_v4l2_ldflags="-lv4l2"
-			      LIBS="$LIBS -lv4l2"
+			      PJMEDIA_VIDEODEV_EXT="$PJMEDIA_VIDEODEV_EXT -lv4l2"
+
 			     ]
 			     )
 	      ])
@@ -1611,7 +1619,7 @@ AC_ARG_ENABLE(opencore_amr,
 		AC_SUBST(opencore_amrnb_h_present)
 		AC_SUBST(opencore_amrnb_present)
 		AC_CHECK_HEADER(opencore-amrnb/interf_enc.h,[opencore_amrnb_h_present=1])
-		AC_CHECK_LIB(opencore-amrnb,Encoder_Interface_init,[opencore_amrnb_present=1 && LIBS="$LIBS -lopencore-amrnb"])
+		AC_CHECK_LIB(opencore-amrnb,Encoder_Interface_init,[opencore_amrnb_present=1])
 		if test "x$opencore_amrnb_h_present" = "x1" -a "x$opencore_amrnb_present" = "x1"; then
 	        	AC_MSG_RESULT([OpenCORE AMR-NB library found, AMR-NB support enabled])
 	        	AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,1)
@@ -1625,7 +1633,7 @@ AC_ARG_ENABLE(opencore_amr,
 		AC_SUBST(opencore_amrwb_dec_present)
 		AC_CHECK_HEADER(vo-amrwbenc/enc_if.h,[opencore_amrwb_enc_h_present=1])
 		AC_CHECK_HEADER(opencore-amrwb/dec_if.h,[opencore_amrwb_dec_h_present=1])
-		AC_CHECK_LIB(opencore-amrwb,D_IF_init,[opencore_amrwb_dec_present=1 && LIBS="$LIBS -lopencore-amrwb"])
+		AC_CHECK_LIB(opencore-amrwb,D_IF_init,[opencore_amrwb_dec_present=1])
 		AC_CHECK_LIB(vo-amrwbenc,E_IF_init,[opencore_amrwb_enc_present=1 && LIBS="$LIBS -lvo-amrwbenc"])
 		if test "x$opencore_amrwb_enc_h_present" = "x1" -a "x$opencore_amrwb_dec_h_present" = "x1" -a "x$opencore_amrwb_enc_present" = "x1" -a "x$opencore_amrwb_dec_present" = "x1"; then
 	        	AC_MSG_RESULT([OpenCORE AMR-WB library found, AMR-WB support enabled])
diff --git a/build.mak.in b/build.mak.in
index 5c4fc40..4555ae9 100644
--- a/build.mak.in
+++ b/build.mak.in
@@ -29,6 +29,11 @@ export APP_THIRD_PARTY_LIBS :=
 export APP_THIRD_PARTY_LIB_FILES :=
 
 PJLIB_EXT = @PJLIB_EXT@
+PJLIB_UTIL_EXT = @PJLIB_UTIL_EXT@
+PJMEDIA_EXT = @PJMEDIA_EXT@
+PJMEDIA_CODEC_EXT = @PJMEDIA_CODEC_EXT@
+PJMEDIA_VIDEODEV_EXT = @PJMEDIA_VIDEODEV_EXT@
+PJNATH_EXT = @PJNATH_EXT@
 
 ifeq (@ac_external_srtp@,1)
 # External SRTP library
diff --git a/pjlib-util/build/Makefile b/pjlib-util/build/Makefile
index a03a558..56bc055 100644
--- a/pjlib-util/build/Makefile
+++ b/pjlib-util/build/Makefile
@@ -43,7 +43,7 @@ export PJLIB_UTIL_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
 		stun_simple_client.o xml.o
 export PJLIB_UTIL_CFLAGS += $(_CFLAGS)
 export PJLIB_UTIL_CXXFLAGS += $(_CXXFLAGS)
-export PJLIB_UTIL_LDFLAGS += $(PJLIB_LDLIB) $(_LDFLAGS)
+export PJLIB_UTIL_LDFLAGS += $(PJLIB_LDLIB) $(PJLIB_UTIL_EXT) $(_LDFLAGS)
 
 ###############################################################################
 # Defines for building test application
diff --git a/pjmedia/build/Makefile b/pjmedia/build/Makefile
index 340bfc4..83d852a 100644
--- a/pjmedia/build/Makefile
+++ b/pjmedia/build/Makefile
@@ -85,6 +85,7 @@ export PJMEDIA_LDFLAGS += $(PJMEDIA_VIDEODEV_LDLIB) \
 			  $(PJLIB_UTIL_LDLIB) \
 			  $(PJNATH_LDLIB) \
 			  $(PJMEDIA_EXT) \
+			  $(PJMEDIA_VIDEODEV_EXT) \
 			  $(_LDFLAGS)
 
 
diff --git a/pjnath/build/Makefile b/pjnath/build/Makefile
index 5f08a8a..8fb976d 100644
--- a/pjnath/build/Makefile
+++ b/pjnath/build/Makefile
@@ -43,7 +43,8 @@ export PJNATH_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
 		stun_transaction.o turn_session.o turn_sock.o
 export PJNATH_CFLAGS += $(_CFLAGS)
 export PJNATH_CXXFLAGS += $(_CXXFLAGS)
-export PJNATH_LDFLAGS += $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(_LDFLAGS)
+export PJNATH_LDFLAGS += $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(PJNATH_EXT) \
+			$(_LDFLAGS)
 
 ###############################################################################
 # Defines for building test application

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/pjproject.git



More information about the Pkg-voip-commits mailing list