Libdvdread compile fix.
[vlc.git] / extras / contrib / src / Patches / libdvdread.patch
1 Index: configure.ac
2 ===================================================================
3 --- configure.ac        (revision 1107)
4 +++ configure.ac        (working copy)
5 @@ -137,24 +137,59 @@
6  dnl ---------------------------------------------
7  dnl dynamic linker
8  dnl ---------------------------------------------
9 -case $host in
10 -  *mingw32*)
11 -    CFLAGS="-idirafter \$(top_srcdir)/msvc/include $CFLAGS"
12 -    LDFLAGS="-no-undefined $LDFLAGS"
13 -    ;;
14 -  *cygwin*)
15 -    LDFLAGS="-no-undefined $LDFLAGS"
16 -    ;;
17 -  *)
18 -    AC_CHECK_LIB(c, dlopen,
19 -                DYNAMIC_LD_LIBS="",
20 -                AC_CHECK_LIB(dl, dlopen,
21 -                             DYNAMIC_LD_LIBS="-ldl",
22 -                             AC_MSG_ERROR(dynamic linker needed)))
23 -    AC_SUBST(DYNAMIC_LD_LIBS)
24 -    ;;
25 -esac
26 +AC_ARG_WITH( [libdvdcss],
27 +    [  --with-libdvdcss[=PATH]    force linking against libdvdcss],
28 +    [if test x"$withval" != xno; then
29 +       link_dvdcss=yes
30 +     fi
31 +     if test x"$withval" != xyes; then
32 +       dvdcss_path=$withval
33 +     fi])
34  
35 +if test x"$link_dvdcss" != xyes; then
36 +dnl dlopen libdvdcss
37 +  AC_CHECK_FUNC( dlopen,
38 +    [DL_LIBS="" ],
39 +    AC_CHECK_LIB( dl, dlopen,
40 +      [DL_LIBS=-ld ],
41 +      AC_MSG_ERROR(You need libdl (dlopen))
42 +    )
43 +  )
44 +else
45 +dnl link with libdvdcss
46 +  if test -z "$dvdcss_path"; then
47 +    AC_CHECK_LIB(dvdcss, dvdcss_interface_2,
48 +      [ CSS_LIBS=-ldvdcss ],
49 +      AC_MSG_ERROR(You need libdvdcss.so.2 or later)
50 +    )
51 +    AC_CHECK_HEADERS(dvdcss/dvdcss.h,
52 +      [ ],
53 +      AC_MSG_ERROR(You need libdvdcss (dvdcss.h))
54 +    )
55 +  else
56 +    saved_CFLAGS=$CFLAGS
57 +    CFLAGS="$CFLAGS -L$dvdcss_path/lib"
58 +    AC_CHECK_LIB(dvdcss, dvdcss_interface_2,
59 +      [ CSS_LIBS="-L$dvdcss_path/lib -R$dvdcss_path/lib -ldvdcss"
60 +        CSS_CFLAGS=-I$dvdcss_path/include ],
61 +      AC_MSG_ERROR(You need libdvdcss.so.2 or later)
62 +    )
63 +    CFLAGS=$saved_CFLAGS
64 +    dnl -w added to shutup GCC3.1's cpp warning about -I/usr/local
65 +    saved_CPPFLAGS=$CPPFLAGS
66 +    CPPFLAGS="-w $CPPFLAGS -I$dvdcss_path/include"
67 +    AC_CHECK_HEADERS(dvdcss/dvdcss.h,
68 +      [ ],
69 +      AC_MSG_ERROR(You need libdvdcss (dvdcss.h))
70 +    )
71 +    CPPFLAGS=$saved_CPPFLAGS
72 +  fi
73 +fi
74 +
75 +AC_SUBST(DL_LIBS)
76 +AC_SUBST(CSS_LIBS)
77 +AC_SUBST(CSS_CFLAGS)
78 +
79  dnl ---------------------------------------------
80  dnl cflags
81  dnl ---------------------------------------------
82 Index: autogen.sh
83 ===================================================================
84 --- autogen.sh  (revision 1107)
85 +++ autogen.sh  (working copy)
86 @@ -86,7 +86,7 @@
87  try_libtool_executable() {
88    libtool=$1
89      LT="`$libtool --version | awk '{ print $4 }' | sed -e 's/[a-zA-Z\ \.\(\)\-\;]//g'`"
90 -    if test "$LT" -ne "" ; then
91 +    if test "$LT" -ne "0" ; then
92      LIBTOOL_MIN="`echo $LIBTOOL_MIN | sed -e 's/[a-zA-Z\ \.\(\)\-]//g'`"
93      if test $LT -lt 100 ; then
94        LT=`expr $LT \* 10`