[DVDnav-discuss] [PATCH] Link directly with libdvdcss

Rafaël Carré funman at videolan.org
Fri Nov 25 18:48:46 CET 2011


Hi,

I'm sending a patch we've been using in VLC for some years on our
mingw32 and darwin binaries.

It adds --enable-libdvdcss (off by default) to link directly to dvdcss 
instead of using dlopen()

--- dvdread/misc/dvdread.pc.in.orig	2011-11-25 11:13:16.573585109 -0500
+++ dvdread/misc/dvdread.pc.in	2011-11-25 11:01:31.390088283 -0500
@@ -8,4 +8,4 @@
 Version: @VERSION@
 
 Cflags: -I${includedir}
-Libs: -L${libdir} -ldvdread
+Libs: -L${libdir} -ldvdread @CSS_LIBS@
--- dvdread/src/Makefile.am.orig	2011-11-25 11:20:16.287666356 -0500
+++ dvdread/src/Makefile.am	2011-11-25 11:20:24.147705328 -0500
@@ -10,7 +10,7 @@
 	dvd_input.c dvd_udf.c md5.c nav_print.c ifo_print.c bitreader.c \
 	bswap.h dvd_input.h dvdread_internal.h dvd_udf.h md5.h bitreader.h
 
-libdvdread_la_LIBADD = $(DYNAMIC_LD_LIBS)
+libdvdread_la_LIBADD = $(DYNAMIC_LD_LIBS) @CSS_LIBS@
 
 libdvdread_la_LDFLAGS = -version-info $(DVDREAD_LT_CURRENT):$(DVDREAD_LT_REVISION):$(DVDREAD_LT_AGE) \
 	-export-symbols-regex "(^dvd.*|^nav.*|^ifo.*|^DVD.*|^UDF.*)"
--- dvdread/configure.ac.orig	2011-11-25 10:59:00.953342325 -0500
+++ dvdread/configure.ac	2011-11-25 11:21:26.732015667 -0500
@@ -137,6 +137,11 @@
 dnl ---------------------------------------------
 dnl dynamic linker
 dnl ---------------------------------------------
+AC_ARG_ENABLE([libdvdcss], [  --enable-libdvdcss    force linking against libdvdcss])
+
+CSS_LIBS=""
+if test x"$enable_libdvdcss" != xyes; then
+dnl dlopen libdvdcss
 case $host in
   *mingw32*)
     CFLAGS="-idirafter \$(top_srcdir)/msvc/include $CFLAGS"
@@ -157,6 +162,18 @@
     AC_SUBST(DYNAMIC_LD_LIBS)
     ;;
 esac
+else
+dnl link with libdvdcss
+  CSS_LIBS=-ldvdcss
+  case "${host}" in
+    *darwin*) CSS_LIBS="${CSS_LIBS} -Wl,-framework,CoreFoundation -Wl,-framework,IOKit"
+    ;;
+  esac
+  AC_CHECK_LIB(dvdcss, dvdcss_interface_2,, AC_MSG_ERROR(You need libdvdcss.so.2 or later))
+  AC_CHECK_HEADERS(dvdcss/dvdcss.h,, AC_MSG_ERROR(You need libdvdcss (dvdcss.h)))
+fi
+
+AC_SUBST(CSS_LIBS)
 
 dnl ---------------------------------------------
 dnl cflags


-- 
Rafaël Carré


More information about the DVDnav-discuss mailing list