configure.ac 170 KB
Newer Older
Sam Hocevar's avatar
 
Sam Hocevar committed
1
dnl Autoconf settings for vlc
2

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
3 4
AC_COPYRIGHT([Copyright 2002-2009 the VideoLAN team])

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
5
AC_INIT(vlc, 1.1.0-git)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
6
VERSION_MAJOR="1"
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
7
VERSION_MINOR="1"
8
VERSION_REVISION="0"
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
9
VERSION_EXTRA="-git"
10 11
PKGDIR="vlc"
AC_SUBST(PKGDIR)
12

13
CONFIGURE_LINE="`echo "$0 $ac_configure_args" | sed -e 's/\\\/\\\\\\\/g'`"
14
CODENAME="Yellow Bastard"
Christophe Mutricy's avatar
Christophe Mutricy committed
15
COPYRIGHT_YEARS="1996-2009"
16

17
AC_PREREQ(2.59c)
18
AC_CONFIG_SRCDIR(src/libvlc.c)
19
AC_CONFIG_AUX_DIR(autotools)
20
AC_CONFIG_MACRO_DIR(m4)
21
AC_CONFIG_LIBOBJ_DIR(compat)
22
AC_CANONICAL_BUILD
23
AC_CANONICAL_HOST
24

25
AM_INIT_AUTOMAKE(tar-ustar)
26 27
AM_CONFIG_HEADER(config.h)

28 29 30 31
# Disable with "./configure --disable-silent-rules" or "make V=1"
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])


32 33 34 35 36 37 38
dnl Too many people are not aware of maintainer mode:
dnl If you want to use it, you definitely know what you are doing, so
dnl you can specify "--disable-maintainer-mode". But if you want the default
dnl automake behavior, you've likely never heard of maintainer mode, so we
dnl can't expect you to enable it manually.

AS_IF([test "x${enable_maintainer_mode}" != "xno"],
39
    [enable_maintainer_mode="yes"])
40 41
AM_MAINTAINER_MODE

42 43 44 45 46 47 48 49 50 51
dnl
dnl Directories
dnl
dnl vlcincludedir="\${includedir}/\${PKGDIR}"
dnl AC_SUBST(vlcincludedir)
vlcdatadir="\${datadir}/\${PKGDIR}"
AC_SUBST(vlcdatadir)
vlclibdir="\${libdir}/\${PKGDIR}"
AC_SUBST(vlclibdir)

52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
dnl
dnl  Deprecated options
dnl  to notify packagers that stuff has changed
dnl
AC_ARG_ENABLE(python-bindings,
  [  --enable-python-bindings Always fails for historical reasons)],,
  [enable_python_bindings="no"])
AS_IF([test "${enable_python_bindings}" != "no"], [
  AC_MSG_ERROR([Python bindings are now built from a separate source package])
])

AC_ARG_ENABLE(java-bindings,
  [  --enable-java-bindings  Always fails for historical reasons],,
  [enable_java_bindings="no"])
AS_IF([test "${enable_java_bindings}" != "no"], [
  AC_MSG_ERROR([Java bindings are now built from a separate source package])
])

Sam Hocevar's avatar
Sam Hocevar committed
70 71 72
dnl
dnl  Save *FLAGS
dnl
Sam Hocevar's avatar
Sam Hocevar committed
73
VLC_SAVE_FLAGS
Sam Hocevar's avatar
 
Sam Hocevar committed
74

Sam Hocevar's avatar
Sam Hocevar committed
75
dnl
76
dnl Check for tools
Sam Hocevar's avatar
Sam Hocevar committed
77
dnl
78
AC_PROG_CC_C99
79
AC_USE_SYSTEM_EXTENSIONS
80
AC_DEFINE([_FORTIFY_SOURCE], 2, [Define to '2' to get glibc warnings.])
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
81

82 83
AM_PROG_CC_C_O
AC_PROG_CXX
84
AC_PROG_CPP
85 86 87
AC_PROG_OBJC
_AM_DEPENDENCIES([OBJC])
AC_PROG_EGREP
88 89
AC_PROG_MAKE_SET
AC_PROG_INSTALL
90
AM_PROG_AS
91

Gildas Bazin's avatar
 
Gildas Bazin committed
92 93
dnl Find the right ranlib, even when cross-compiling
AC_CHECK_TOOL(RANLIB, ranlib, :)
Sam Hocevar's avatar
 
Sam Hocevar committed
94
AC_CHECK_TOOL(STRIP, strip, :)
Jean-Paul Saman's avatar
Jean-Paul Saman committed
95 96
AC_CHECK_TOOL(AR, ar, :)
AC_CHECK_TOOL(LD, ld, :)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
97
AC_CHECK_TOOL(DLLTOOL, dlltool, :)
Gildas Bazin's avatar
 
Gildas Bazin committed
98

99 100 101
dnl Check for compiler properties
AC_C_CONST
AC_C_INLINE
102
AC_C_RESTRICT
103

104
dnl Allow binary package maintainer to pass a custom string to avoid
105
dnl cache problem
106
AC_ARG_WITH(binary-version,
107 108 109 110 111 112 113 114
	AS_HELP_STRING([--with-binary-version=STRING],
	     [To avoid plugins cache problem between binary version]),[],[])
AS_IF([test -n "${with_binary_version}"],[
      AC_DEFINE_UNQUOTED([DISTRO_VERSION],["${with_binary_version}"],
			 [Binary specific version])
      ])


115 116 117
dnl
dnl  Check for the contrib directory
dnl
118
AC_ARG_WITH(contrib,
119
    [  --without-contrib       do not use the libraries in CONTRIB_DIR],[],[])
120
  AS_IF([test "${with_contrib}" != "no"],[
121 122 123 124 125 126 127 128
    AC_ARG_VAR([CONTRIB_DIR], [directory containing pre-built contrib, overriding extras/contrib])
    if test -z "$CONTRIB_DIR"
    then
      topdir="`dirname $0`"
      if test "`echo \"$topdir\" | cut -c 1`" != "/"; then
         topdir="`pwd`/$topdir"
      fi
      CONTRIB_DIR=${topdir}/extras/contrib
129
    fi
130
    AC_MSG_CHECKING([for libs in ${CONTRIB_DIR}])
Christophe Mutricy's avatar
Typo  
Christophe Mutricy committed
131
  AS_IF([test -d ${CONTRIB_DIR}/lib],[
132
   AS_IF([test "`grep HOST ${CONTRIB_DIR}/config.mak 2>/dev/null|awk '{print $3}'`" != "`$CC -dumpmachine`"],[
133 134
      if test "${with_contrib}" = "yes"; then
        AC_MSG_RESULT([no])
135
        AC_MSG_ERROR([ not using the libs in extras/contrib as it is not the same host])
136 137
      else
        AC_MSG_RESULT([no])
138
        AC_MSG_WARN([ not using the libs in extras/contrib as it is not the same host])
139
      fi
140
     ],[
141
    AC_MSG_RESULT([yes])
Christophe Mutricy's avatar
Typo  
Christophe Mutricy committed
142
    export PATH=${CONTRIB_DIR}/bin:$PATH
143 144 145 146 147 148 149 150
    CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
    CPPFLAGS_save="${CPPFLAGS_save} -I${CONTRIB_DIR}/include"
    CFLAGS="${CFLAGS} -I${CONTRIB_DIR}/include"
    CFLAGS_save="${CFLAGS_save} -I${CONTRIB_DIR}/include"
    CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include"
    CXXFLAGS_save="${CXXFLAGS_save} -I${CONTRIB_DIR}/include"
    OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include"
    OBJCFLAGS_save="${OBJCFLAGS_save} -I${CONTRIB_DIR}/include"
151
    if test $build = $host -o "$PKG_CONFIG_LIBDIR"; then
152
        export PKG_CONFIG_PATH=${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH
153
    else
154
        export PKG_CONFIG_LIBDIR=${CONTRIB_DIR}/lib/pkgconfig
155
    fi
156 157
    LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
    LDFLAGS_save="${LDFLAGS_save} -L${CONTRIB_DIR}/lib"
158

159
    if test -z $with_mozilla_sdk_path; then
160
       with_mozilla_sdk_path=${CONTRIB_DIR}/gecko-sdk
161
    fi
162
    if test -z $with_cyberlink_tree; then
163
       with_cyberlink_tree=${CONTRIB_DIR}/src/clinkcc
164
    fi
165

166
    if test ".`uname -s`" = ".Darwin"; then
167 168
      export LD_LIBRARY_PATH=${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH
      export DYLD_LIBRARY_PATH=${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH
169
    elif test ".`uname -s`" = ".BeOS"; then
170 171
      export LIBRARY_PATH=${CONTRIB_DIR}/lib:$LIBRARY_PATH
      export BELIBRARIES=${CONTRIB_DIR}/lib:$BELIBRARIES
172
    fi
173 174 175 176 177
    ])
  ],[
    AC_MSG_RESULT([no])
  ])
])
Sam Hocevar's avatar
Sam Hocevar committed
178
dnl
179
dnl  Set default values
Sam Hocevar's avatar
Sam Hocevar committed
180
dnl
181
LDFLAGS_vlc="${LDFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
182

Gildas Bazin's avatar
 
Gildas Bazin committed
183 184 185
dnl
dnl  Check the operating system
dnl
186
case "${host_os}" in
Sam Hocevar's avatar
Sam Hocevar committed
187
  "")
188 189
    SYS=unknown
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
190
  linux*)
191 192
    SYS=linux
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
193
  bsdi*)
194 195
    SYS=bsdi
    CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
196
    VLC_ADD_LIBS([dvd dvdcss vcd cdda vcdx cddax],[-ldvd])
197
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
198
  *bsd*)
199
    SYS="${host_os}"
200
    CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
201
    case "${host_os}" in
202 203
      freebsd*)
        CPPFLAGS_save="${CPPFLAGS_save} -I/usr/local/include"
204
        CPPFLAGS="${CPPFLAGS_save}"
205
        LDFLAGS_save="${LDFLAGS_save} -L/usr/local/lib"
Derk-Jan Hartman's avatar
Derk-Jan Hartman committed
206
        LDFLAGS="${LDFLAGS_save}"
207 208
        ;;
    esac
209
    ;;
210 211 212 213
  darwin*)
    SYS=darwin
    CFLAGS_save="${CFLAGS_save} -D_INTL_REDIRECT_MACROS"; CFLAGS="${CFLAGS_save}"
    CXXFLAGS_save="${CXXFLAGS_save} -D_INTL_REDIRECT_MACROS"; CXXFLAGS="${CXXFLAGS_save}"
214
    OBJCFLAGS_save="${OBJCFLAGS_save} -D_INTL_REDIRECT_MACROS -std=gnu99"; OBJCFLAGS="${OBJCFLAGS_save}"
215
    LDFLAGS_save="${LDFLAGS_save} -Wl,-headerpad_max_install_names"; LDFLAGS="${LDFLAGS_save}"
216 217 218
    VLC_ADD_LDFLAGS([mp4], [-Wl,-framework,IOKit,-framework,CoreFoundation])
    VLC_ADD_LDFLAGS([mkv mp4], [-Wl,-framework,IOKit,-framework,CoreFoundation])
    VLC_ADD_LDFLAGS([vlc],[-Wl,-undefined,dynamic_lookup])
219
    VLC_ADD_LDFLAGS([libvlc],[-Wl,-undefined,dynamic_lookup])
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
220
    VLC_ADD_LDFLAGS([avcodec avformat swscale postproc i420_rgb_mmx x264],[-Wl,-read_only_relocs,suppress])
221
    VLC_ADD_CFLAGS([motion],[-fconstant-cfstrings])
222
    VLC_ADD_LDFLAGS([libvlccore],[-Wl,-framework,CoreFoundation])
223
    VLC_ADD_LDFLAGS([motion],[-Wl,-framework,IOKit,-framework,CoreFoundation])
224
    AC_ARG_ENABLE(macosx-defaults,
225
      AS_HELP_STRING([--enable-macosx-defaults],[Build the default configuration on Mac OS X (default enabled)]))
226 227 228 229
    if test "x${enable_macosx_defaults}" != "xno"
    then
        echo ""
        echo "Building with Mac OS X defaults:"
230 231 232 233
        with_macosx_version_min="10.5"
        echo "  Assuming --with-macosx-version-min=10.5"
        with_macosx_sdk="/Developer/SDKs/MacOSX${with_macosx_version_min}.sdk"
        echo "  Assuming --with-macosx-sdk=/Developer/SDKs/MacOSX${with_macosx_version_min}.sdk"
234 235 236
        build_dir=`pwd`
        echo "  Assuming --prefix=${build_dir}/vlc_install_dir"
        ac_default_prefix="${build_dir}/vlc_install_dir"
Pierre d'Herbemont's avatar
Pierre d'Herbemont committed
237 238
        enable_macosx="yes"
        echo "  Assuming --enable-macosx"
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
        enable_faad="yes"
        echo "  Assuming --enable-faad"
        enable_flac="yes"
        echo "  Assuming --enable-flac"
        enable_theora="yes"
        echo "  Assuming --enable-theora"
        enable_shout="yes"
        echo "  Assuming --enable-shout"
        enable_cddax="yes"
        echo "  Assuming --enable-cddax"
        enable_vcdx="yes"
        echo "  Assuming --enable-vcdx"
        enable_caca="yes"
        echo "  Assuming --enable-caca"
        enable_ncurses="yes"
        echo "  Assuming --enable-ncurses"
        enable_twolame="yes"
        echo "  Assuming --enable-twolame"
        enable_realrtsp="yes"
        echo "  Assuming --enable-realrtsp"
259 260 261 262
        enable_libass="yes"
        echo "  Assuming --enable-libass"
        enable_asademux="yes"
        echo "  Assuming --enable-asademux"
263 264 265 266 267

        enable_skins2="no"
        echo "  Assuming --disable-skins2"
        enable_x11="no"
        echo "  Assuming --disable-x11"
268 269
        enable_xcb="no"
        echo "  Assuming --disable-xcb"
270 271 272 273
        enable_glx="no"
        echo "  Assuming --disable-glx"
        enable_xvideo="no"
        echo "  Assuming --disable-xvideo"
274
    fi
275 276 277 278 279 280
    dnl
    dnl  Check for Mac OS X SDK settings
    dnl
    AC_ARG_WITH(macosx-sdk,
       [  --with-macosx-sdk=DIR   compile using the SDK in DIR])
    if test "${with_macosx_sdk}" != "" ; then
281 282
        CPP="${CPP} -isysroot ${with_macosx_sdk}"
        CC="${CC} -isysroot ${with_macosx_sdk}"
283 284 285 286 287 288 289
        CXX="${CXX} -isysroot ${with_macosx_sdk}"
        OBJC="${OBJC} -isysroot ${with_macosx_sdk}"
        LD="${LD} -syslibroot ${with_macosx_sdk}"
    fi
    AC_ARG_WITH(macosx-version-min,
       [  --with-macosx-version-min=VERSION  compile for MacOSX VERSION and above])
    if test "${with_macosx_version_min}" != "" ; then
290 291
        CPP="${CPP} -mmacosx-version-min=${with_macosx_version_min}"
        CC="${CC} -mmacosx-version-min=${with_macosx_version_min}"
292 293 294 295 296 297 298 299 300
        CXX="${CXX} -mmacosx-version-min=${with_macosx_version_min}"
        OBJC="${OBJC} -mmacosx-version-min=${with_macosx_version_min}"
        LD="${LD} -macosx_version_min=${with_macosx_version_min}"
        CFLAGS_save="${CFLAGS_save} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"; CFLAGS="${CFLAGS_save}"
        CXXFLAGS_save="${CXXFLAGS_save} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"; CXXFLAGS="${CXXFLAGS_save}"
        OBJCFLAGS_save="${OBJCFLAGS_save} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"; OBJCFLAGS="${OBJCFLAGS_save}"
        MACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}
        export MACOSX_DEPLOYMENT_TARGET
    fi
301
    ;;
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
  darwin9*)
    if (test ".`uname -p`" = ".i386"); then
        dnl Due to a ld(64) bug in 10.5 we cannot use our mmx code
        dnl without hacking it a lot, we disable mmx and sse.
        dnl (that bug is about ld being unable to handle
        dnl text relocation)
        save_cflags="$CFLAGS"
        CFLAGS="$CFLAGS -dynamiclib -single_module -read_only_relocs suppress"
        AC_TRY_LINK(
            [int a;], [asm("movq _a,%mm0\n");],
            ac_ld_does_not_support_text_reloc=no,
            ac_ld_does_not_support_text_reloc=yes)
        CFLAGS="$save_cflags"

        if test "x$ac_ld_does_not_support_text_reloc" = "xyes"; then
            enable_mmx="no"
            echo "  Assuming --disable-mmx (due to a bug in ld)"
            enable_sse="no"
            echo "  Assuming --disable-sse (due to a bug in ld)"
        fi
    fi
    ;;
324
  *mingw32* | *cygwin* | *wince* | *mingwce*)
325
    AC_CHECK_TOOL(WINDRES, windres, :)
326
    AC_CHECK_TOOL(OBJCOPY, objcopy, :)
Gildas Bazin's avatar
 
Gildas Bazin committed
327

328
    case "${host_os}" in
329
      *wince* | *mingwce* | *mingw32ce*)
Sam Hocevar's avatar
Sam Hocevar committed
330
        SYS=mingwce
331 332
        dnl Sadly CeGCC still needs non-wince macros
        AC_DEFINE([_WIN32_WINNT], 0x0501, [Define to '0x0500' for Windows 2000 APIs.])
Sam Hocevar's avatar
Sam Hocevar committed
333
        ;;
Sam Hocevar's avatar
Sam Hocevar committed
334
      *mingw32*)
Gildas Bazin's avatar
 
Gildas Bazin committed
335
        SYS=mingw32
336
        AC_DEFINE([_WIN32_WINNT], 0x0500, [Define to '0x0500' for Windows 2000 APIs.])
Gildas Bazin's avatar
 
Gildas Bazin committed
337
        ;;
Sam Hocevar's avatar
Sam Hocevar committed
338
      *cygwin*)
Gildas Bazin's avatar
 
Gildas Bazin committed
339 340
        dnl Check if we are using the mno-cygwin mode in which case we are
        dnl actually dealing with a mingw32 compiler.
341
        AC_DEFINE([_WIN32_WINNT], 0x0500, [Define to '0x0500' for Windows 2000 APIs.])
Gildas Bazin's avatar
 
Gildas Bazin committed
342 343 344 345
        AC_EGREP_CPP(yes,
            [#ifdef WIN32
             yes
             #endif],
346
            SYS=mingw32, AC_MSG_ERROR([VLC requires -mno-cygwin]))
Gildas Bazin's avatar
 
Gildas Bazin committed
347 348 349
        ;;
    esac

Sam Hocevar's avatar
Sam Hocevar committed
350
    if test "${SYS}" = "mingw32"; then
351
        # add ws2_32 for closesocket, select, recv
352
        VLC_ADD_LIBS([libvlccore],[-lws2_32 -lnetapi32 -lwinmm])
353
        VLC_ADD_LDFLAGS([vlc],[-mwindows])
354
        VLC_ADD_LIBS([activex mozilla],[-lgdi32])
355
        VLC_ADD_LIBS([cdda vcdx cddax sdl_image aout_sdl vout_sdl],[-lwinmm])
356
        VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_shout access_output_rtmp sap slp http stream_out_standard stream_out_rtp stream_out_raop vod_rtsp access_realrtsp rtp telnet rc netsync gnutls growl_udp flac ts audioscrobbler lua remoteosd zvbi],[-lws2_32])
357
        VLC_ADD_LIBS([access_file], [-lshlwapi])
358 359 360 361 362 363 364 365 366
        dnl
        dnl DEP and ASLR options
        dnl
        AC_ARG_ENABLE(peflags,
          [  --enable-peflags          peflags use (default enabled)])
        if test "${enable_peflags}" != "no"
        then
          AC_CHECK_TOOL(PEFLAGS, peflags, :)
        fi
Gildas Bazin's avatar
 
Gildas Bazin committed
367
    fi
368 369
    if test "${SYS}" = "mingwce"; then
        # add ws2 for closesocket, select, recv
370
        VLC_ADD_LIBS([libvlccore access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_rtmp sap http netsync audioscrobbler growl rtp stream_out_rtp remoteosd ts telnet],[-lws2])
371
        VLC_ADD_LIBS([libvlccore],[-lmmtimer])
372
   fi
373
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
374
  *nto*)
375 376
    SYS=nto
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
377
  solaris*)
378 379
    SYS=solaris
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
380
  hpux*)
381 382
    SYS=hpux
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
383
  beos)
384
    SYS=beos
385 386
    CFLAGS_save="${CFLAGS_save} -Wno-multichar"; CFLAGS="${CFLAGS_save}"
    CXXFLAGS_save="${CXXFLAGS_save} -Wno-multichar"; CXXFLAGS="${CXXFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
387
    VLC_ADD_CXXFLAGS([beos],[])
388
    VLC_ADD_LIBS([vlc libvlccore logger],[-lbe])
389 390 391
    VLC_ADD_LIBS([beos],[-lbe -lmedia -ltranslation -ltracker -lgame])
    VLC_ADD_LIBS([dvdnav dvdread],[-ldl])
    VLC_ADD_LIBS([access_file],[-lpoll])
392
    LDFLAGS_save="${LDFLAGS_save} -lintl"; LDFLAGS="${LDFLAGS_save}"
393 394
    dnl Check for BONE
    if test -f /boot/beos/system/lib/libbind.so; then
395
        VLC_ADD_LIBS([access_file access_ftp access_mms access_output_udp telnet netsync sap libvlccore growl_udp],[-lbind -lsocket])
396
    else
397
        VLC_ADD_LIBS([access_file access_ftp access_mms access_output_udp telnet netsync sap libvlccore growl_udp],[-lnet])
398
    fi
399

Eric Petit's avatar
Eric Petit committed
400
    dnl Ugly check for Zeta
401
    if test -f /boot/beos/system/lib/libzeta.so; then
402
        VLC_ADD_LIBS([beos],[-lzeta])
403
    fi
404
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
405
  *)
406
    SYS="${host_os}"
407
    ;;
Gildas Bazin's avatar
 
Gildas Bazin committed
408
esac
Sam Hocevar's avatar
Sam Hocevar committed
409 410
AM_CONDITIONAL(HAVE_BEOS, test "${SYS}" = "beos")
AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin")
411
AM_CONDITIONAL(HAVE_LINUX, [test "${SYS}" = "linux"])
Sam Hocevar's avatar
Sam Hocevar committed
412
AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
413
AM_CONDITIONAL(HAVE_WINCE, test "${SYS}" = "mingwce")
414
AM_CONDITIONAL(USE_PEFLAGS, [test "${enable_peflags}" = "yes"])
415

416
dnl
417
dnl Sadly autoconf doesn't think about testing foo.exe when ask to test
418 419 420 421 422
dnl for program foo on win32

case "${build_os}" in
    cygwin|msys)
        ac_executable_extensions=".exe"
423
    ;;
424
    *)
425
    ;;
426 427
esac

428
dnl
429 430 431 432
dnl  Libtool
dnl  It's very bad, but our former custom system was worst
dnl  -- Courmisch
dnl
433 434 435 436

dnl override platform specific check for dependent libraries
dnl otherwise libtool linking of shared libraries will
dnl fail on anything other than pass_all.
437 438
AC_CACHE_VAL(lt_cv_deplibs_check_method,
    [lt_cv_deplibs_check_method=pass_all])
439

440
AC_DISABLE_STATIC
441
dnl AC_DISABLE_FAST_INSTALL
442
AC_LIBTOOL_DLOPEN
443
AC_LIBTOOL_WIN32_DLL
444 445
m4_undefine([AC_PROG_F77])
m4_defun([AC_PROG_F77],[])
446 447
AC_PROG_LIBTOOL

448 449 450 451 452
m4_undefine([AC_DEPLIBS_CHECK_METHOD])
m4_defun([AC_DEPLIBS_CHECK_METHOD],[])

lt_cv_deplibs_check_method=pass_all

453 454 455
AS_IF([test "${enable_shared}" = "no"], [
  AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
])
456

457 458 459
dnl
dnl Gettext stuff
dnl
460
AM_GNU_GETTEXT_VERSION([0.17])
461
AM_GNU_GETTEXT([external])
462
VLC_ADD_LIBS([libvlccore vlc], [${LTLIBINTL}])
463

464 465 466
dnl
dnl Iconv stuff
dnl
467
AM_ICONV
468 469
VLC_ADD_CFLAGS([libvlccore],[${INCICONV}])
VLC_ADD_LIBS([libvlccore],[${LTLIBICONV}])
470

471
dnl Check for broken versions of mingw-runtime compatability library
472
AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"], [
473
    AC_MSG_CHECKING(for broken mingw-runtime)
474
    AC_PREPROC_IFELSE([
475
#include <_mingw.h>
476
#if (__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION < 15)
477 478
# error Attempting to use mingw-runtime with broken vsnprintf support
#endif
479 480 481 482
], [
        AC_MSG_RESULT([ok])
], [
        AC_MSG_RESULT([present])
483
        AC_MSG_ERROR([LibVLC requires mingw-runtime version 3.15 or higher!])
484 485 486 487
])
    dnl force use of mingw provided c99 *printf over msvcrt
    CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
    CPPFLAGS_save="${CPPFLAGS_save} -D__USE_MINGW_ANSI_STDIO=1"
488
])
489

Gildas Bazin's avatar
 
Gildas Bazin committed
490
dnl Check for the need to include the mingwex lib for mingw32
Sam Hocevar's avatar
Sam Hocevar committed
491
if test "${SYS}" = "mingw32"
Gildas Bazin's avatar
 
Gildas Bazin committed
492 493
then
    AC_CHECK_LIB(mingwex,opendir,
494
        AC_CHECK_LIB(mingw32,opendir,,
495
            [VLC_ADD_LIBS([libvlccore],[-lmingwex])])
Gildas Bazin's avatar
 
Gildas Bazin committed
496 497 498
    )
fi

Gildas Bazin's avatar
 
Gildas Bazin committed
499
dnl Check for fnative-struct or mms-bitfields support for mingw32
Sam Hocevar's avatar
Sam Hocevar committed
500
if test "${SYS}" = "mingw32"
Gildas Bazin's avatar
 
Gildas Bazin committed
501 502 503 504 505
then
    AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
        [ac_cv_c_mms_bitfields],
        [CFLAGS="${CFLAGS_save} -mms-bitfields"
         AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
Sam Hocevar's avatar
Sam Hocevar committed
506
    if test "${ac_cv_c_mms_bitfields}" != "no"; then
507 508
        CFLAGS_save="${CFLAGS_save} -mms-bitfields";
        CXXFLAGS_save="${CXXFLAGS_save} -mms-bitfields";
Gildas Bazin's avatar
 
Gildas Bazin committed
509
    else
510 511 512 513
        AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
            [ac_cv_c_fnative_struct],
            [CFLAGS="${CFLAGS_save} -fnative-struct"
             AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
Sam Hocevar's avatar
Sam Hocevar committed
514
        if test "${ac_cv_c_fnative_struct}" != "no"; then
515 516 517
            CFLAGS_save="${CFLAGS_save} -fnative-struct";
            CXXFLAGS_save="${CXXFLAGS_save} -fnative-struct";
        fi
Gildas Bazin's avatar
 
Gildas Bazin committed
518 519
    fi

Gildas Bazin's avatar
 
Gildas Bazin committed
520 521 522 523
    CFLAGS="${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
fi

dnl Check for fvtable-thunks support for mingw32
524
if test "${SYS}" = "mingw32" -a "${CXX}" != ""
Gildas Bazin's avatar
 
Gildas Bazin committed
525 526 527 528 529 530 531
then
AC_LANG_PUSH(C++)
    AC_CACHE_CHECK([if \$CXX accepts -fvtable-thunks],
        [ac_cv_cxx_fvtable_thunks],
        [CXXFLAGS="${CXXFLAGS_save} -Wall -Werror -fvtable-thunks"
         AC_TRY_COMPILE([],,ac_cv_cxx_fvtable_thunks=yes,
                        ac_cv_cxx_fvtable_thunks=no)])
Sam Hocevar's avatar
Sam Hocevar committed
532
    if test "${ac_cv_cxx_fvtable_thunks}" = "yes"; then
Gildas Bazin's avatar
 
Gildas Bazin committed
533 534 535
        CXXFLAGS_mingw32_special="-fvtable-thunks"
    fi

Sam Hocevar's avatar
Sam Hocevar committed
536
    CXXFLAGS_save="${CXXFLAGS_save} ${CXXFLAGS_mingw32_special}"; CXXFLAGS="${CXXFLAGS_save}"
Gildas Bazin's avatar
 
Gildas Bazin committed
537
AC_LANG_POP(C++)
Gildas Bazin's avatar
 
Gildas Bazin committed
538 539
fi

540 541
dnl
dnl Buggy glibc prevention. Purposedly not cached.
542
dnl See sourceware.org bugs 5058 and 5443.
543 544 545 546 547 548 549 550 551 552 553 554 555
dnl Ubuntu alone has 20 bug numbers for this...
dnl
AC_MSG_CHECKING(for buggy GNU/libc versions)
AC_PREPROC_IFELSE([
#include <limits.h>
#if defined (__GLIBC__) && (__GLIBC__ == 2) \
  && (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
# error GNU/libc with dcgettext killer bug!
#endif
], [
  AC_MSG_RESULT([not present])
], [
  AC_MSG_RESULT([found])
556 557 558 559 560
  AS_IF([test "x${enable_nls}" != "xno" || test "x${enable_mozilla}" != "xno"], [
    AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
work-around for this. Check with your distribution vendor on how to update the
glibc run-time. Alternatively, build with --disable-nls --disable-mozilla and
be sure to not use LibVLC from other applications/wrappers.])
561 562
  ], [
    AC_DEFINE(DISABLE_BUGGY_GLIBC_CHECK, 1, [Disables runtime check for buggy glibc.])
563
  ])
564 565
])

Sam Hocevar's avatar
Sam Hocevar committed
566 567 568 569
dnl Plugin compilation stuff

VLC_LIBRARY_SUFFIX

Sam Hocevar's avatar
 
Sam Hocevar committed
570
dnl The -DSYS_FOO flag
571
CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CPPFLAGS="${CPPFLAGS_save}"
Sam Hocevar's avatar
 
Sam Hocevar committed
572

573
dnl Check for system libs needed
574
need_libc=false
575

576
dnl Check for usual libc functions
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
577
AC_CHECK_FUNCS([gettimeofday isatty sigrelse getpwuid_r memalign posix_memalign if_nametoindex getenv putenv setenv ctime_r daemon fork lstat posix_fadvise posix_madvise uselocale])
Geoffroy Couprie's avatar
Geoffroy Couprie committed
578
AC_CHECK_FUNCS(fcntl)
579
AC_REPLACE_FUNCS([asprintf atof atoll getcwd getpid gmtime_r lldiv localtime_r rewind strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtoll vasprintf swab])
580
AC_CHECK_FUNCS([stricmp strnicmp])
581 582 583
AC_CHECK_FUNCS(fdatasync,,
  [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
])
Sam Hocevar's avatar
 
Sam Hocevar committed
584

585
dnl Check for non-standard system calls
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
586
AC_CHECK_FUNCS([vmsplice eventfd fstatfs])
587

588 589
AH_BOTTOM([#include <vlc_fixups.h>])

590
AC_CHECK_FUNCS(mmap, [VLC_ADD_PLUGIN([access_mmap])])
591

592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607
dnl Check for setlocal and langinfo
AC_CHECK_FUNCS(setlocale)
AC_CHECK_HEADERS(langinfo.h)
AC_CHECK_FUNCS(nl_langinfo)

AC_CACHE_CHECK([for nl_langinfo and CODESET], ac_cv_langinfo_codeset,
  [AC_TRY_LINK([#include <langinfo.h>],
    [char* cs = nl_langinfo(CODESET);],
    ac_cv_langinfo_codeset=yes,
    ac_cv_langinfo_codeset=no)
  ])
if test ${ac_cv_langinfo_codeset} = yes; then
  AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
    [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
fi

608
SOCKET_LIBS=""
609
AC_CHECK_FUNCS(connect,,[
Sam Hocevar's avatar
Sam Hocevar committed
610
  AC_CHECK_LIB(socket,connect,[
611
    VLC_ADD_LIBS([libvlccore cdda cddax],-lsocket)
612
    SOCKET_LIBS="-lsocket"
Sam Hocevar's avatar
Sam Hocevar committed
613 614
  ])
])
615
AC_SUBST(SOCKET_LIBS)
616

617
AC_CHECK_FUNCS(send,,[
Sam Hocevar's avatar
Sam Hocevar committed
618
  AC_CHECK_LIB(socket,send,[
619
    VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp sap access_output_udp access_output_rtmp stream_out_standard growl_udp remoteosd],[-lsocket])
Sam Hocevar's avatar
Sam Hocevar committed
620 621
  ])
])
622

623

624
dnl Check for socklen_t
625 626 627 628
AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
AC_CACHE_CHECK([for socklen_t in sys/socket.h],
ac_cv_type_socklen_t,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
629 630
[#include <sys/types.h>
#ifdef WIN32
631
# include <winsock2.h>
632
# include <ws2tcpip.h>
633 634
#else
# include <sys/socket.h>
635 636 637 638 639
#endif]], [[socklen_t len; len = 0;]])],
ac_cv_type_socklen_t=yes,
ac_cv_type_socklen_t=no)])
AS_IF([test "$ac_cv_type_socklen_t" = no],
 [AC_DEFINE(socklen_t, int)])
640

641 642 643 644 645 646 647
dnl Check for struct sockaddr_storage
AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.])
AH_TEMPLATE(ss_family, [Define to `sa_family' if <sys/socket.h> does not define.])
AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
  [AC_TRY_COMPILE(
    [#include <sys/types.h>
     #if defined( UNDER_CE )
648
     # include <winsock2.h>
649 650 651 652 653 654 655
     #elif defined( WIN32 )
     # include <winsock2.h>
     #else
     # include <sys/socket.h>
     #endif], [struct sockaddr_storage addr;],
     ac_cv_struct_sockaddr_storage=yes,
     ac_cv_struct_sockaddr_storage=no)])
656
AS_IF([test "${ac_cv_struct_sockaddr_storage}" = no], [
657 658
  AC_DEFINE(sockaddr_storage, sockaddr)
  AC_DEFINE(ss_family, sa_family)
659
])
660

661
dnl getaddrinfo, getnameinfo and gai_strerror check
662
dnl  -lnsl and -lsocket are needed on Solaris;
663
dnl  we purposedly make the test fail on Windows
664
LIBS_save="${LIBS}"
665
AH_TEMPLATE(HAVE_GETADDRINFO, [Define to 1 if you have the `getaddrinfo' function.])
666
AC_SEARCH_LIBS([getaddrinfo], [nsl], [AC_DEFINE(HAVE_GETADDRINFO)],, [${SOCKET_LIBS}])
667 668 669 670 671 672 673

dnl NOTE: we assume getaddrinfo will be present if getnameinfo or gai_strerro
dnl are
LIBS="${LIBS_gai}"
AC_CHECK_FUNCS([getnameinfo gai_strerror])
LIBS="${LIBS_save}"

674
AH_TEMPLATE(HAVE_ADDRINFO, [Define to 1 if <netdb.h> defines `struct addrinfo'.])
675 676
AC_CHECK_TYPES([struct addrinfo],[AC_DEFINE(HAVE_ADDRINFO)],,
[#include <sys/types.h>
677
#if defined( WIN32 ) || defined( UNDER_CE )
678 679 680
# if defined(UNDER_CE) && defined(sockaddr_storage)
#  undef sockaddr_storage
# endif
681 682 683 684 685
# include <winsock2.h>
# include <ws2tcpip.h>
#else
# include <netdb.h>
#endif])
686

687 688 689 690 691 692 693
dnl Check for va_copy
AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy,
  AC_TRY_LINK(
    [#include <stdarg.h>],
    [va_list ap1, ap2; va_copy(ap1,ap2);],
    [ac_cv_c_va_copy="yes"],
    [ac_cv_c_va_copy="no"]))
Sam Hocevar's avatar
Sam Hocevar committed
694
if test "${ac_cv_c_va_copy}" = "yes"; then
695 696 697 698 699 700 701 702
  AC_DEFINE(HAVE_VA_COPY, 1, [Define if <stdarg.h> defines va_copy.])
fi
AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy,
  AC_TRY_LINK(
    [#include <stdarg.h>],
    [va_list ap1, ap2; __va_copy(ap1,ap2);],
    [ac_cv_c___va_copy="yes"],
    [ac_cv_c___va_copy="no"]))
Sam Hocevar's avatar
Sam Hocevar committed
703
if test "${ac_cv_c___va_copy}" = "yes"; then
704
  AC_DEFINE(HAVE___VA_COPY, 1, [Define if <stdarg.h> defines __va_copy.])
705 706
fi

707
AC_CHECK_FUNCS(inet_aton,,[
Sam Hocevar's avatar
Sam Hocevar committed
708
  AC_CHECK_LIB(resolv,inet_aton,[
709
    VLC_ADD_LIBS([libvlccore],[-lresolv])
Sam Hocevar's avatar
Sam Hocevar committed
710
  ])
711
])
Sam Hocevar's avatar
 
Sam Hocevar committed
712

713
dnl Check for getopt (always use builtin one on win32)
714
if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"; then
715 716
need_getopt=:
else
717
need_getopt=false
718
AC_CHECK_FUNCS(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
Sam Hocevar's avatar
 
Sam Hocevar committed
719
[ # FreeBSD has a gnugetopt library for this:
720
  AC_CHECK_LIB([gnugetopt],[getopt_long],
Sam Hocevar's avatar
Sam Hocevar committed
721
    [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support)
722
     VLC_ADD_LIBS([libvlccore],[-lgnugetopt])],
723
    [need_getopt=:])])
724
fi
725
AM_CONDITIONAL(BUILD_GETOPT, ${need_getopt})
Sam Hocevar's avatar
 
Sam Hocevar committed
726

727
if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
728
AC_TYPE_SIGNAL
Sam Hocevar's avatar
Sam Hocevar committed
729
AC_CHECK_LIB(m,cos,[
730
  VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain scene kate flac lua chorus_flanger],[-lm])
Sam Hocevar's avatar
Sam Hocevar committed
731 732
])
AC_CHECK_LIB(m,pow,[
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
733
  VLC_ADD_LIBS([avcodec avformat swscale postproc ffmpegaltivec i420_rgb faad twolame equalizer spatializer param_eq libvlccore freetype mod mpc dmo quicktime realaudio realvideo opengl],[-lm])
Sam Hocevar's avatar
Sam Hocevar committed
734 735
])
AC_CHECK_LIB(m,sqrt,[
736
  VLC_ADD_LIBS([headphone_channel_mixer normvol speex mono colorthres extract],[-lm])
Sam Hocevar's avatar
Sam Hocevar committed
737
])
738
AC_CHECK_LIB(m,ceil,[
739
  VLC_ADD_LIBS([hotkeys mosaic swscale_omap],[-lm])
740
])
741
AC_CHECK_LIB(m,exp,[
742
  VLC_ADD_LIBS([gaussianblur],[-lm])
743
])
744 745 746
AC_CHECK_LIB(m,round,[
  VLC_ADD_LIBS([dbus],[-lm])
])
747 748
AC_CHECK_LIB(m,sqrtf,[
  VLC_ADD_LIBS([x264],[-lm])
749
])
750
fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
Sam Hocevar's avatar
 
Sam Hocevar committed
751

752 753 754 755 756
AC_CHECK_LIB(m,lrintf, [
  AC_DEFINE(HAVE_LRINTF, 1, [Define to 1 if you have the lrintf function])
  VLC_ADD_LIBS([skins2],[-lm])
])

Sam Hocevar's avatar
Sam Hocevar committed
757 758 759 760 761 762 763 764 765 766 767
dnl Check for dynamic plugins
ac_cv_have_plugins=no

# HP-UX style
if test "${ac_cv_have_plugins}" = "no"; then
  AC_CHECK_HEADERS(dl.h)
  ac_cv_my_have_shl_load=no
  AC_CHECK_FUNC(shl_load,
   [ac_cv_my_have_shl_load=yes,
    AC_CHECK_LIB(dld, shl_load,
     [ac_cv_my_have_shl_load=yes
768
      VLC_ADD_LIBS([libvlccore],[-ldld])])])
Sam Hocevar's avatar
Sam Hocevar committed
769 770 771 772 773 774 775 776
  if test "${ac_cv_my_have_shl_load}" = "yes"; then
    AC_DEFINE(HAVE_DL_SHL_LOAD, 1, [Define if you have the shl_load API])
    ac_cv_have_plugins=yes
  fi
fi

# Win32 style
if test "${ac_cv_have_plugins}" = "no"; then
777
  if test "${SYS}" = "mingw32" ; then
778
    AC_CHECK_LIB(kernel32, main,
779
     [VLC_ADD_LIBS([libvlccore],[-lkernel32])
780 781 782
      AC_DEFINE(HAVE_DL_WINDOWS, 1, [Define if you have Windows' LoadLibrary])
      ac_cv_have_plugins=yes])
  fi
Sam Hocevar's avatar
Sam Hocevar committed
783 784
fi

785 786 787 788 789 790 791 792
# WinCE style
if test "${ac_cv_have_plugins}" = "no"; then
  if test "${SYS}" = "mingwce"; then
    AC_DEFINE(HAVE_DL_WINDOWS, 1, [Define if you have Windows' LoadLibrary])
    ac_cv_have_plugins=yes
  fi
fi

Sam Hocevar's avatar
Sam Hocevar committed
793 794
# BeOS style
if test "${ac_cv_have_plugins}" = "no"; then
Sam Hocevar's avatar
Sam Hocevar committed
795 796 797 798
  AC_CHECK_HEADERS(image.h)
  AC_CHECK_FUNCS(load_add_on,
   [AC_DEFINE(HAVE_DL_BEOS, 1, [Define if you have the BeOS dl])
    ac_cv_have_plugins=yes])
Sam Hocevar's avatar
Sam Hocevar committed
799 800
fi

801
# Only test for dlopen() if the others didn't work
802
if test "${ac_cv_have_plugins}" = "no" -o "${SYS}" = "darwin"; then
Sam Hocevar's avatar
Sam Hocevar committed
803 804 805 806 807 808
  AC_CHECK_HEADERS(dlfcn.h sys/dl.h)
  ac_cv_my_have_dlopen=no
  AC_CHECK_FUNC(dlopen,
    ac_cv_my_have_dlopen=yes,
    AC_CHECK_LIB(dl, dlopen,
      ac_cv_my_have_dlopen=yes
809
      VLC_ADD_LIBS([libvlccore realaudio realvideo lua],[-ldl]),
Sam Hocevar's avatar
Sam Hocevar committed
810 811
      AC_CHECK_LIB(svld, dlopen,
        ac_cv_my_have_dlopen=yes
812
        VLC_ADD_LIBS([libvlccore],[-lsvld]))))
Sam Hocevar's avatar
Sam Hocevar committed
813 814 815 816 817 818
  if test "${ac_cv_my_have_dlopen}" = "yes"; then
    AC_DEFINE(HAVE_DL_DLOPEN, 1, [Define if you have the dlopen API])
    ac_cv_have_plugins=yes
  fi
fi

819
if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
Sam Hocevar's avatar
 
Sam Hocevar committed
820
dnl Check for pthreads - borrowed from XMMS
Sam Hocevar's avatar
 
Sam Hocevar committed
821
THREAD_LIB=error
Sam Hocevar's avatar
Sam Hocevar committed
822
if test "${THREAD_LIB}" = "error"; then
823
  AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
Sam Hocevar's avatar
 
Sam Hocevar committed
824
fi
Sam Hocevar's avatar
Sam Hocevar committed
825
if test "${THREAD_LIB}" = "error"; then
826
  AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
Sam Hocevar's avatar
 
Sam Hocevar committed
827
fi
Sam Hocevar's avatar
Sam Hocevar committed
828
if test "${THREAD_LIB}" = "error"; then
829
  AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
Sam Hocevar's avatar
 
Sam Hocevar committed
830
fi
Sam Hocevar's avatar
Sam Hocevar committed
831
if test "${THREAD_LIB}" = "error"; then
832
  AC_CHECK_FUNCS(pthread_mutex_lock)
833
  THREAD_LIB=""
Sam Hocevar's avatar
 
Sam Hocevar committed
834
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
835

836
VLC_ADD_LIBS([libvlccore libvlc plugin],[${THREAD_LIB}])
Gildas Bazin's avatar
 
Gildas Bazin committed
837

838
AC_CHECK_LIB(rt, clock_nanosleep, [
839
  VLC_ADD_LIBS([libvlccore],[-lrt])
840 841 842
  AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define to 1 if you have clock_nanosleep.])
], [
  dnl HP/UX port
843
  AC_CHECK_LIB(rt,sem_init, [VLC_ADD_LIBS([libvlccore],[-lrt])])
844
])
Gildas Bazin's avatar
 
Gildas Bazin committed
845

846 847 848
have_nanosleep=false
AC_CHECK_FUNCS(nanosleep,have_nanosleep=:,[
  AC_CHECK_LIB(rt,nanosleep,
849
    [VLC_ADD_LIBS([libvlccore],[-lrt]) have_nanosleep=:],
850
    [AC_CHECK_LIB(posix4,nanosleep,
851
        [VLC_ADD_LIBS([libvlccore],[-lposix4]) have_nanosleep=:])]
852 853 854 855
  )
])
if ${have_nanosleep}; then
  AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if nanosleep is available.])
Gildas Bazin's avatar
 
Gildas Bazin committed
856
fi
857
fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
Gildas Bazin's avatar
 
Gildas Bazin committed
858

Sam Hocevar's avatar
 
Sam Hocevar committed
859
dnl Check for misc headers
860
AC_MSG_CHECKING(for strncasecmp in strings.h)
Sam Hocevar's avatar
 
Sam Hocevar committed
861
AC_EGREP_HEADER(strncasecmp,strings.h,[
862
  AC_MSG_RESULT(yes)
863
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
864 865
            Define if <strings.h> defines strncasecmp.)],[
  AC_MSG_RESULT(no)])
Sam Hocevar's avatar
 
Sam Hocevar committed
866

Sam Hocevar's avatar
 
Sam Hocevar committed
867
dnl Check for headers
868 869
AC_CHECK_HEADERS(getopt.h strings.h locale.h xlocale.h)
AC_CHECK_HEADERS(fcntl.h sys/types.h sys/time.h sys/times.h sys/ioctl.h sys/stat.h sys/mount.h)
870
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h netinet/udplite.h sys/eventfd.h])
871 872
AC_CHECK_HEADERS([net/if.h], [], [],
  [
873
    #include <sys/types.h>
874
    #include <sys/socket.h>
875
  ])
876
if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
877
AC_CHECK_HEADERS(machine/param.h sys/shm.h)
878
AC_CHECK_HEADERS([linux/version.h linux/dccp.h scsi/scsi.h linux/magic.h])
879
AC_CHECK_HEADERS(syslog.h)
880
fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
Sam Hocevar's avatar
 
Sam Hocevar committed
881

Sam Hocevar's avatar
 
Sam Hocevar committed
882 883
AC_HEADER_TIME

884 885 886 887 888 889
dnl LP64 adn LLP64 architectures had better define ssize_t by themselves...
AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.])
AC_CHECK_TYPE(ssize_t,, [
  AC_DEFINE(ssize_t, int)
])

890
dnl Check for poll
891
AC_SEARCH_LIBS(poll, [poll], [AC_DEFINE(HAVE_POLL, 1, [Define to 1 if the OS is usabl... err, has poll().])], [
892
if test ${SYS} != "mingw32" -a ${SYS} != "mingwce"
893 894 895 896
then
    AC_MSG_WARN([Your platform does not support poll(). VLC has it's own poll() implementation, but it is only intended to be used on Windows. VLC might crash or be insecure when you see this message. Either switch to an OS with a proper poll() implementation, or implement one for your OS in VLC])
fi
])
897

898 899
dnl Check for dirent
need_dirent=false
900
AC_CHECK_HEADERS(dirent.h,,[need_dirent=:])
901 902
AM_CONDITIONAL(BUILD_DIRENT, ${need_dirent})

903
dnl Mac OS X and other OSes don't have declaration for nanosleep
904
if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
905
AC_MSG_CHECKING(for nanosleep in time.h)
906
AC_EGREP_HEADER(nanosleep,time.h,[
907
  AC_MSG_RESULT(yes)
908 909
  AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
            Define if <time.h> defines nanosleep.)
910 911
],[
  AC_MSG_RESULT(no)
912
])
913
fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
914 915

dnl Make sure we have timespecs
916
AC_MSG_CHECKING(for timespec in sys/time.h)
917
AC_EGREP_HEADER(timespec,sys/time.h,[
918
  AC_MSG_RESULT(yes)
919 920
  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
            Define if <sys/time.h> defines struct timespec.)
921 922
],[
  AC_MSG_RESULT(no)
923
])
924

Sam Hocevar's avatar
 
Sam Hocevar committed
925
dnl Check for threads library
926
if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
927
AC_CHECK_HEADERS(pthread.h)
928
fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
Sam Hocevar's avatar
 
Sam Hocevar committed
929

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
930 931 932
dnl It seems that autoconf detects pkg-config only during the first
dnl PKG_CHECK_MODULES from configure.ac - which makes sense. But in our case,
dnl it is nested within a conditional block, so it was not working right.
933
dnl Make PKG_CONFIG_PATH precious so that it appears in the help and get saved
934
AC_ARG_VAR(PKG_CONFIG_PATH,
935
	   [Paths where to find .pc not at the default location])
936 937
PKG_PROG_PKG_CONFIG()

938 939
dnl On some OS we need static linking 
AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce" -o "${SYS}" = "darwin" ],[
Christophe Mutricy's avatar
Typo  
Christophe Mutricy committed
940
       PKG_CONFIG="${PKG_CONFIG} --static"
941 942 943
    ])


944 945 946 947 948 949 950 951 952 953 954 955 956 957
dnl
dnl Check for zlib.h and -lz along with system -lminizip if available
dnl 
AC_CHECK_HEADERS(zlib.h, [ have_zlib=yes ], [ have_zlib=no ])
AM_CONDITIONAL(HAVE_ZLIB, [ test "${have_zlib}" = "yes" ])
if test "${have_zlib}" = "yes"
then
  VLC_ADD_LIBS([access_http gme mp4 skins2 sap mkv unzip zip],[-lz])
  PKG_CHECK_MODULES([MINIZIP], [minizip] , [ have_minizip=yes ], [
    AC_CHECK_HEADERS([unzip.h], [ 
      have_minizip=yes
      MINIZIP_LIBS="-lminizip -lz"
    ], [
      have_minizip=no
958 959
      MINIZIP_CFLAGS="-I\\\${top_srcdir}/libs/unzip"
      MINIZIP_LIBS="\\\${top_builddir}/libs/unzip/libunzip.la"
960 961 962 963 964 965 966 967
    ])
  ])
  VLC_ADD_CPPFLAGS([skins2],[$MINIZIP_CFLAGS])
  VLC_ADD_CFLAGS([zip],[$MINIZIP_CFLAGS])
  VLC_ADD_LIBS([skins2 zip],[$MINIZIP_LIBS])
  VLC_ADD_PLUGIN([unzip])
  VLC_ADD_PLUGIN([zip])
fi
968
AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
969 970


971 972
dnl Check for dbus
AC_ARG_ENABLE(dbus,
973
  [  --enable-dbus           Linux D-BUS message bus system (default enabled)])
974 975
case "${SYS}" in
    linux*|*bsd*)
976
if test "${enable_dbus}" != "no" -a "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
977
then
978 979
  dnl api stable dbus
  PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0.0,
980
    [ AC_DEFINE( HAVE_DBUS, 1, [Define if you have the D-BUS library] )
981 982
      VLC_ADD_LIBS([libvlccore],[$DBUS_LIBS])
      VLC_ADD_CFLAGS([libvlccore],[$DBUS_CFLAGS])
983
      dnl Check for dbus control interface
Rafaël Carré's avatar
Rafaël Carré committed
984
        AC_ARG_ENABLE(dbus-control, [  --disable-dbus-control  D-BUS control interface (default enabled)])
985
        if test "${enable_dbus_control}" != "no"
986
        then
987
          VLC_ADD_PLUGIN([dbus])
988
          VLC_ADD_LIBS([dbus],[$DBUS_LIBS])
989
          VLC_ADD_CFLAGS([dbus],[$DBUS_CFLAGS])
990 991
        fi
      dnl Check for Telepathy
Christophe Mutricy's avatar
Christophe Mutricy committed
992 993
        AC_ARG_ENABLE(telepathy,
          AS_HELP_STRING([--enable-telepathy],[Telepathy Presence plugin through DBus(default enabled)]))
994
        if test "${enable_telepathy}" != "no"; then
995
          VLC_ADD_PLUGIN([telepathy])
996
          VLC_ADD_LIBS([telepathy],[$DBUS_LIBS])
997
          VLC_ADD_CFLAGS([telepathy],[$DBUS_CFLAGS])
998 999
        fi
        dnl Power Management Inhibiter
1000
        VLC_ADD_PLUGIN([inhibit])
1001 1002
        VLC_ADD_LIBS([inhibit],[$DBUS_LIBS])
        VLC_ADD_CFLAGS([inhibit],[$DBUS_CFLAGS])
1003 1004
    ],
    [AC_MSG_ERROR([Couldn't find DBus >= 1.0.0, install libdbus-dev ?])]
1005 1006
  )
fi
1007 1008
;;
esac
1009

1010 1011 1012
dnl build the qte plugin ?
NEED_QTE_MAIN=no

Sam Hocevar's avatar
 
Sam Hocevar committed
1013
dnl Check for ntohl, etc.
1014
AC_CACHE_CHECK([for ntohl in sys/param.h],
1015 1016 1017
    [ac_cv_c_ntohl_sys_param_h],
    [CFLAGS="${CFLAGS_save} -Wall -Werror"
     AC_TRY_COMPILE([#include <sys/param.h>],
1018
        [int meuh; ntohl(meuh);],
1019
        ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
Sam Hocevar's avatar
Sam Hocevar committed
1020
if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
1021
    AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
1022
fi
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
1023
CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
 
Sam Hocevar committed
1024

1025
RDC_PROG_CC_WFLAGS([all extra sign-compare undef pointer-arith bad-function-cast write-strings missing-prototypes volatile-register-var error-implicit-function-declaration])
1026
RDC_PROG_CC_FLAGS([-pipe])
Sam Hocevar's avatar
 
Sam Hocevar committed
1027

1028
AC_ARG_ENABLE(warnings-as-error,
1029
      AS_HELP_STRING([--enable-warnings-as-error],[Treat acceptable warnings as error (default disabled)]),, [enable_warnings_as_error="no"])
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
1030
AS_IF([test "${enable_warnings_as_error}" = "yes"], [
1031
    RDC_PROG_CC_WERRORFLAGS([unused-function unused-label unused-value unused-parameter unused-variable unused \
1032
     missing-braces nonnull parentheses uninitialized address enum-compare undef comment switch \
1033
     bad-function-cast implicit sequence-point strict-aliasing array-bounds missing-parameter-type \
1034
     overflow int-to-pointer-cast pointer-to-int-cast div-by-zero overflow ignored])
1035
])
1036
AC_SUBST(CFLAGS_WERROR)
1037

Sam Hocevar's avatar
 
Sam Hocevar committed
1038
dnl Check for various optimization flags
1039 1040 1041 1042
AC_CACHE_CHECK([if \$CC accepts -Os],
    [ac_cv_c_os],
    [CFLAGS="${CFLAGS_save} -Os"
     AC_TRY_COMPILE([],,ac_cv_c_os=yes, ac_cv_c_os=no)])
1043 1044
if test "${ac_cv_c_os}" != "no"; then
    CFLAGS_OPTIM_SIZE="${CFLAGS_OPTIM_SIZE} -Os"
1045
else
1046 1047 1048 1049 1050 1051 1052 1053 1054
    AC_CACHE_CHECK([if \$CC accepts -O],
        [ac_cv_c_o],
        [CFLAGS="${CFLAGS_save} -O"
         AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
    if test "${ac_cv_c_o}" != "no"; then
        if test "${ac_cv_c_o3}" = "no"; then
            CFLAGS_OPTIM_SIZE="${CFLAGS_OPTIM_SIZE} -O"
        fi
    fi
1055 1056
fi

1057 1058 1059 1060 1061 1062
AC_CACHE_CHECK([if \$CC accepts -O4],
    [ac_cv_c_o4],
    [CFLAGS="${CFLAGS_save} -O4"
     AC_TRY_COMPILE([],,ac_cv_c_o4=yes, ac_cv_c_o4=no)])
if test "${ac_cv_c_o4}" != "no" -a "x${enable_debug}" = "xno"; then
    CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O4"
1063
else
1064 1065 1066 1067 1068 1069
    AC_CACHE_CHECK([if \$CC accepts -O3],
        [ac_cv_c_o3],
        [CFLAGS="${CFLAGS_save} -O3"
         AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
    if test "${ac_cv_c_o3}" != "no" -a "x${enable_debug}" = "xno"; then
        CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O3"
1070
    else
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084
        AC_CACHE_CHECK([if \$CC accepts -O2],
            [ac_cv_c_o2],
            [CFLAGS="${CFLAGS_save} -O2"
             AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)])
        if test "${ac_cv_c_o2}" != "no"; then
            CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O2"
        else
            AC_CACHE_CHECK([if \$CC accepts -O],
                [ac_cv_c_o],
                [CFLAGS="${CFLAGS_save} -O"
                 AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
            if test "${ac_cv_c_o}" != "no"; then
                CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O"
            fi
1085 1086
        fi
    fi
1087 1088
fi

1089 1090 1091 1092 1093 1094
AC_CACHE_CHECK([if \$CC accepts -O0],
    [ac_cv_c_o0],
    [CFLAGS="${CFLAGS_save} -O0"
     AC_TRY_COMPILE([],,ac_cv_c_o0=yes, ac_cv_c_o0=no)])
if test "${ac_cv_c_o0}" != "no"; then
    CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O0"
Sam Hocevar's avatar
 
Sam Hocevar committed
1095 1096 1097 1098
fi

dnl Check for -ffast-math
AC_CACHE_CHECK([if \$CC accepts -ffast-math],
1099 1100 1101
    [ac_cv_c_fast_math],
    [CFLAGS="${CFLAGS_save} -ffast-math"
     AC_TRY_COMPILE([],,ac_cv_c_fast_math=yes, ac_cv_c_fast_math=no)])
Sam Hocevar's avatar
Sam Hocevar committed
1102
if test "${ac_cv_c_fast_math}" != "no"; then
1103
    CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -ffast-math"
Sam Hocevar's avatar
 
Sam Hocevar committed
1104 1105 1106
fi

dnl Check for -funroll-loops
1107
dnl Disabled on BeOS because BeOS' gcc is buggy and may crash with it
Sam Hocevar's avatar
Sam Hocevar committed
1108
if test "${SYS}" != "beos"
1109 1110 1111 1112 1113
then
  AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
      [ac_cv_c_unroll_loops],
      [CFLAGS="${CFLAGS_save} -funroll-loops"
       AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)])
Sam Hocevar's avatar
Sam Hocevar committed
1114
  if test "${ac_cv_c_unroll_loops}" != "no"; then
1115
      CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -funroll-loops"
1116
  fi
Sam Hocevar's avatar
 
Sam Hocevar committed
1117 1118 1119 1120
fi

dnl Check for -fomit-frame-pointer
AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
1121 1122 1123
    [ac_cv_c_omit_frame_pointer],
    [CFLAGS="${CFLAGS_save} -fomit-frame-pointer"
     AC_TRY_COMPILE([],,ac_cv_c_omit_frame_pointer=yes, ac_cv_c_omit_frame_pointer=no)])
Sam Hocevar's avatar
Sam Hocevar committed
1124
if test "${ac_cv_c_omit_frame_pointer}" != "no"; then
1125
 if test "${SYS}" != "darwin"; then
1126
    CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
1127 1128 1129 1130
 else
    dnl On darwin we explicitely disable it.
    CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fno-omit-frame-pointer"
 fi
Sam Hocevar's avatar
 
Sam Hocevar committed
1131 1132
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
1133
dnl Check for Darwin plugin linking flags
1134
AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error],
1135
    [ac_cv_ld_darwin],
1136
    [CFLAGS="${CFLAGS_save} -bundle -undefined error"
1137
     AC_TRY_COMPILE([],,ac_cv_ld_darwin=yes, ac_cv_ld_darwin=no)])
Sam Hocevar's avatar
Sam Hocevar committed
1138
if test "${ac_cv_ld_darwin}" != "no"; then
1139
    VLC_ADD_LDFLAGS([plugin],[-bundle -undefined error])
1140
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
1141

1142 1143
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
1144 1145 1146 1147 1148 1149 1150 1151 1152
    [ac_cv_c_attribute_aligned],
    [ac_cv_c_attribute_aligned=0
        CFLAGS="${CFLAGS_save} -Werror"
    for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
        AC_TRY_COMPILE([],
        [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
        [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
    done
        CFLAGS="${CFLAGS_save}"])
Sam Hocevar's avatar
Sam Hocevar committed
1153
if test "${ac_cv_c_attribute_aligned}" != "0"; then
1154 1155
    AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
        [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
1156 1157
fi

1158
dnl Check for __attribute__((packed))
1159 1160 1161
AC_CACHE_CHECK([for __attribute__((packed))],
  [ac_cv_c_attribute_packed],
  [ac_cv_c_attribute_packed=no
1162
   AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b; (void)b;],
1163
                    [ac_cv_c_attribute_packed=yes])])
1164
if test "${ac_cv_c_attribute_packed}" != "no"; then
1165 1166 1167
  AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
1168 1169 1170
dnl
dnl  Check the CPU
dnl
1171
case "${host_cpu}" in
Sam Hocevar's avatar
Sam Hocevar committed
1172
  "")
1173 1174 1175
    ARCH=unknown
    ;;
  *)
1176
    ARCH="${host_cpu}"
1177 1178 1179
    ;;
esac

1180 1181 1182 1183
dnl Check for backtrace() support
AC_CHECK_HEADERS(execinfo.h)
AC_CHECK_FUNCS(backtrace)

1184 1185 1186 1187 1188 1189 1190
dnl
dnl  Enable profiling
dnl
AC_ARG_ENABLE(gprof,
[  --enable-gprof          gprof profiling (default disabled)])
AC_ARG_ENABLE(cprof,
[  --enable-cprof          cprof profiling (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
1191 1192
test "${enable_gprof}" != "yes" && enable_gprof="no"
test "${enable_cprof}" != "yes" && enable_cprof="no"
1193

Sam Hocevar's avatar
 
Sam Hocevar committed
1194 1195 1196
dnl
dnl  default modules
dnl
1197
dnl Video filters:
1198
VLC_ADD_PLUGIN([deinterlace])
1199
VLC_ADD_PLUGIN([yuvp])
1200
VLC_ADD_PLUGIN([invert])
1201
VLC_ADD_PLUGIN([mirror])
1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215
VLC_ADD_PLUGIN([adjust])
VLC_ADD_PLUGIN([transform])
VLC_ADD_PLUGIN([wave])
VLC_ADD_PLUGIN([ripple])
VLC_ADD_PLUGIN([psychedelic])
VLC_ADD_PLUGIN([gradient])
VLC_ADD_PLUGIN([motionblur])
VLC_ADD_PLUGIN([rv32])
VLC_ADD_PLUGIN([rotate])
VLC_ADD_PLUGIN([noise])
VLC_ADD_PLUGIN([grain])
VLC_ADD_PLUGIN([extract])
VLC_ADD_PLUGIN([sharpen])
VLC_ADD_PLUGIN([croppadd])
Antoine Cellerier's avatar
Antoine Cellerier committed
1216
VLC_ADD_PLUGIN([canvas])
1217 1218 1219 1220 1221 1222 1223 1224
VLC_ADD_PLUGIN([blendbench])
VLC_ADD_PLUGIN([blend])
VLC_ADD_PLUGIN([scale])
VLC_ADD_PLUGIN([vmem])
VLC_ADD_PLUGIN([logo])
VLC_ADD_PLUGIN([magnify])
VLC_ADD_PLUGIN([puzzle])
VLC_ADD_PLUGIN([colorthres])
1225
VLC_ADD_PLUGIN([scene])
1226
VLC_ADD_PLUGIN([yuv])
1227

1228 1229
ALIASES="${ALIASES} cvlc"

1230 1231 1232 1233
dnl
dnl default modules that need g++
dnl
AC_LANG_PUSH(C++)
1234
VLC_ADD_PLUGIN([spatializer])
1235
AC_LANG_POP(C++)
1236

1237
if test "${SYS}" != "mingwce"; then
1238 1239 1240 1241 1242 1243 1244 1245
  VLC_ADD_PLUGIN([gestures])
  VLC_ADD_PLUGIN([rc])
  VLC_ADD_PLUGIN([hotkeys])
  VLC_ADD_PLUGIN([showintf])
  VLC_ADD_PLUGIN([marq])
  VLC_ADD_PLUGIN([podcast])
  VLC_ADD_PLUGIN([shout])
  VLC_ADD_PLUGIN([sap])
1246
  VLC_ADD_PLUGIN([mediadirs])
1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264
  VLC_ADD_PLUGIN([fake])
  VLC_ADD_PLUGIN([folder])
  VLC_ADD_PLUGIN([rss])
  VLC_ADD_PLUGIN([mosaic])
  VLC_ADD_PLUGIN([wall])
  VLC_ADD_PLUGIN([motiondetect])
  VLC_ADD_PLUGIN([clone])
  VLC_ADD_PLUGIN([crop])
  VLC_ADD_PLUGIN([erase])
  VLC_ADD_PLUGIN([bluescreen])
  VLC_ADD_PLUGIN([alphamask])
  VLC_ADD_PLUGIN([gaussianblur])
  VLC_ADD_PLUGIN([i420_yuy2])
  VLC_ADD_PLUGIN([i422_yuy2])
  VLC_ADD_PLUGIN([i420_ymga])
  VLC_ADD_PLUGIN([i422_i420])
  VLC_ADD_PLUGIN([yuy2_i422])
  VLC_ADD_PLUGIN([yuy2_i420])
1265
  VLC_ADD_PLUGIN([chain])
1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276
  VLC_ADD_PLUGIN([aout_file])
  VLC_ADD_PLUGIN([linear_resampler])
  VLC_ADD_PLUGIN([bandlimited_resampler])
  VLC_ADD_PLUGIN([float32_mixer])
  VLC_ADD_PLUGIN([spdif_mixer])
  VLC_ADD_PLUGIN([simple_channel_mixer])
  VLC_ADD_PLUGIN([dolby_surround_decoder])
  VLC_ADD_PLUGIN([headphone_channel_mixer])
  VLC_ADD_PLUGIN([normvol])
  VLC_ADD_PLUGIN([equalizer])
  VLC_ADD_PLUGIN([param_eq])
Rov Juvano's avatar
Rov Juvano committed
1277
  VLC_ADD_PLUGIN([scaletempo])
1278 1279
  VLC_ADD_PLUGIN([a52tospdif])
  VLC_ADD_PLUGIN([dtstospdif])
1280
  ALIASES="${ALIASES} rvlc"
1281
fi
Gildas Bazin's avatar
 
Gildas Bazin committed
1282

1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302
if test "${SYS}" = "mingwce"; then
  VLC_ADD_PLUGIN([chain])
  VLC_ADD_PLUGIN([aout_file])
  VLC_ADD_PLUGIN([linear_resampler])
  VLC_ADD_PLUGIN([bandlimited_resampler])
  VLC_ADD_PLUGIN([float32_mixer])
  VLC_ADD_PLUGIN([spdif_mixer])
  VLC_ADD_PLUGIN([simple_channel_mixer])
  VLC_ADD_PLUGIN([headphone_channel_mixer])
  VLC_ADD_PLUGIN([normvol])
  VLC_ADD_PLUGIN([a52tospdif])
  VLC_ADD_PLUGIN([dtstospdif])
  VLC_ADD_PLUGIN([i420_yuy2])
  VLC_ADD_PLUGIN([i422_yuy2])
  VLC_ADD_PLUGIN([i420_ymga])
  VLC_ADD_PLUGIN([i422_i420])
  VLC_ADD_PLUGIN([yuy2_i422])
  VLC_ADD_PLUGIN([yuy2_i420])
fi

Gildas Bazin's avatar
 
Gildas Bazin committed
1303 1304 1305
dnl
dnl Some plugins aren't useful on some platforms
dnl
1306
if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
1307 1308 1309
    VLC_ADD_PLUGIN([screensaver])
    VLC_ADD_PLUGIN([motion])
    VLC_ADD_PLUGIN([dynamicoverlay])
1310
    VLC_ADD_PLUGIN([signals])
1311
elif test "${SYS}" != "mingwce"; then
1312 1313 1314 1315
    VLC_ADD_PLUGIN([ntservice])
    VLC_ADD_PLUGIN([access_smb])
    VLC_ADD_PLUGIN([dmo])
    VLC_ADD_PLUGIN([msn])
1316
    VLC_ADD_LIBS([dmo],[-lole32 -luuid])
Hannes Domani's avatar
Hannes Domani committed
1317
    VLC_ADD_PLUGIN([globalhotkeys])
1318
else
1319
    VLC_ADD_PLUGIN([win32text])
Gildas Bazin's avatar
 
Gildas Bazin committed
1320
fi
1321
if test "${SYS}" = "darwin"; then
1322
    VLC_ADD_PLUGIN([quartztext])
1323
    VLC_ADD_LDFLAGS([quartztext],[-Wl,-framework,ApplicationServices])
1324
fi
1325

Sam Hocevar's avatar
 
Sam Hocevar committed
1326 1327 1328
dnl
dnl  Accelerated modules
dnl
1329 1330 1331 1332
AC_ARG_WITH(,[])
AC_ARG_WITH(,[Optimization options:])

dnl  Check for fully working MMX intrinsics
1333 1334
dnl  We need support for -mmmx, we need <mmintrin.h>, and we also need a
dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1335
AC_ARG_ENABLE(mmx,
Christophe Mutricy's avatar
Christophe Mutricy committed
1336
[  --disable-mmx           disable MMX optimizations (default auto)],,[
1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349
  case "${host_cpu}" in
    i?86|x86_64)
      enable_mmx="yes"
      ;;
    *)
      enable_mmx="no"
      ;;
  esac
])
AS_IF([test "${enable_mmx}" != "no"], [
  ARCH="${ARCH} mmx"

  AC_CACHE_CHECK([if $CC groks MMX intrinsics],
1350
    [ac_cv_c_mmx_intrinsics],
1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365
    [CFLAGS="${CFLAGS_save} -O -mmmx"
     AC_TRY_COMPILE([#include <mmintrin.h>
                     #include <stdint.h>
                     uint64_t frobzor;],
                    [__m64 a, b, c;
                     a = b = c = (__m64)frobzor;
                     a = _mm_slli_pi16(a, 3);
                     a = _mm_adds_pi16(a, b);
                     c = _mm_srli_pi16(c, 8);
                     c = _mm_slli_pi16(c, 3);
                     b = _mm_adds_pi16(b, c);
                     a = _mm_unpacklo_pi8(a, b);
                     frobzor = (uint64_t)a;],
                    [ac_cv_c_mmx_intrinsics=yes],
                    [ac_cv_c_mmx_intrinsics=no])])
1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379
  AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
    AC_DEFINE(HAVE_MMX_INTRINSICS, 1,
              [Define to 1 if MMX intrinsics are available.])
    VLC_ADD_CFLAGS([memcpymmx i420_rgb_mmx i420_yuy2_mmx i422_yuy2_mmx i420_ymga_mmx],[-mmmx])
  ])

  AC_CACHE_CHECK([if $CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
    [CFLAGS="${CFLAGS_save}"
     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
  AS_IF([test "${ac_cv_mmx_inline}" != "no"], [
    AC_DEFINE(CAN_COMPILE_MMX, 1,
              [Define to 1 inline MMX assembly is available.])
1380 1381 1382 1383 1384
    VLC_ADD_PLUGIN([memcpymmx])
    VLC_ADD_PLUGIN([i420_rgb_mmx])
    VLC_ADD_PLUGIN([i420_yuy2_mmx])
    VLC_ADD_PLUGIN([i422_yuy2_mmx])
    VLC_ADD_PLUGIN([i420_ymga_mmx])
1385 1386 1387 1388 1389 1390 1391 1392 1393 1394
  ])

  AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
    [CFLAGS="${CFLAGS_save}"
     AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
  AS_IF([test "${ac_cv_mmxext_inline}" != "no"], [
    AC_DEFINE(CAN_COMPILE_MMXEXT, 1,
              [Define to 1 if MMX EXT inline assembly is available.])
1395
    VLC_ADD_PLUGIN([memcpymmxext])
1396 1397
  ])
])
1398

1399 1400 1401
dnl  Check for fully workin SSE2 intrinsics
dnl  We need support for -mmmx, we need <emmintrin.h>, and we also need a
dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1402
AC_ARG_ENABLE(sse,
1403
[  --disable-sse           disable SSE (1, 2, 3 and 4) optimizations (default auto)]
Christophe Mutricy's avatar
Christophe Mutricy committed
1404
,, [
1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417
  case "${host_cpu}" in
    i686|x86_64)
      enable_sse=yes
      ;;
    *)
      enable_sse=no
      ;;
  esac
])
AS_IF([test "${enable_sse}" != "no"], [
  ARCH="${ARCH} sse sse2"

  AC_CACHE_CHECK([if $CC groks SSE2 intrinsics],
1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433
    [ac_cv_c_sse2_intrinsics],
    [CFLAGS="${CFLAGS_save} -O -msse2"
     AC_TRY_COMPILE([#include <emmintrin.h>
                     #include <stdint.h>
                     uint64_t frobzor;],
                    [__m128i a, b, c;
                     a = b = c = _mm_set1_epi64((__m64)frobzor);
                     a = _mm_slli_epi16(a, 3);
                     a = _mm_adds_epi16(a, b);
                     c = _mm_srli_epi16(c, 8);
                     c = _mm_slli_epi16(c, 3);
                     b = _mm_adds_epi16(b, c);
                     a = _mm_unpacklo_epi8(a, b);
                     frobzor = (uint64_t)_mm_movepi64_pi64(a);],
                    [ac_cv_c_sse2_intrinsics=yes],
                    [ac_cv_c_sse2_intrinsics=no])])
1434 1435 1436 1437 1438
  AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
    AC_DEFINE(HAVE_SSE2_INTRINSICS, 1,
              [Define to 1 if SSE2 intrinsics are available.])
    VLC_ADD_CFLAGS([i420_rgb_sse2 i420_yuy2_sse2 i422_yuy2_sse2],[-msse2])
  ])
Sam Hocevar's avatar
 
Sam Hocevar committed
1439

1440
  AC_CACHE_CHECK([if $CC groks SSE inline assembly],
1441
    [ac_cv_sse_inline],
1442
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
1443
     AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
1444
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
1445 1446 1447 1448
  AS_IF([test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"], [
    AC_DEFINE(CAN_COMPILE_SSE, 1,
              [Define to 1 if SSE inline assembly is available.])
  ])
Sam Hocevar's avatar
 
Sam Hocevar committed
1449

1450
  AC_CACHE_CHECK([if $CC groks SSE2 inline assembly],
1451 1452 1453 1454
    [ac_cv_sse2_inline],
    [CFLAGS="${CFLAGS_save}"
     AC_TRY_COMPILE(,[void *p;asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p));],
                    ac_cv_sse2_inline=yes, ac_cv_sse2_inline=no)])
1455 1456 1457
  AS_IF([test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"], [
    AC_DEFINE(CAN_COMPILE_SSE2, 1,
              [Define to 1 if SSE2 inline assembly is available.])
1458 1459 1460
    VLC_ADD_PLUGIN([i420_rgb_sse2])
    VLC_ADD_PLUGIN([i420_yuy2_sse2])
    VLC_ADD_PLUGIN([i422_yuy2_sse2])
1461
  ])
1462

1463
  # SSE3
1464 1465 1466 1467 1468 1469 1470 1471 1472
  AC_CACHE_CHECK([if $CC groks SSE3 inline assembly],
    [ac_cv_sse3_inline],
    [CFLAGS="${CFLAGS_save} -O -msse3"
     AC_TRY_COMPILE(,[void *p;asm volatile("movsldup %%xmm1,%%xmm0"::"r"(p));],
                    ac_cv_sse3_inline=yes, ac_cv_sse3_inline=no)
     ARCH="${ARCH} sse3"
  ])
  AS_IF([test "${ac_cv_sse3_inline}" != "no"], [
    AC_DEFINE(CAN_COMPILE_SSE3, 1,
1473 1474
              [Define to 1 if SSE3 inline assembly is available.]) ])
  # SSSE3
1475 1476 1477 1478 1479 1480 1481 1482 1483 1484
  AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly],
    [ac_cv_ssse3_inline],
    [CFLAGS="${CFLAGS_save} -O -mssse3"
     AC_TRY_COMPILE(,[void *p;asm volatile("pabsw %%xmm0,%%xmm0"::"r"(p));],
                    ac_cv_ssse3_inline=yes, ac_cv_ssse3_inline=no)
     ARCH="${ARCH} ssse3"
  ])

  AS_IF([test "${ac_cv_ssse3_inline}" != "no"], [
    AC_DEFINE(CAN_COMPILE_SSSE3, 1,
1485 1486
              [Define to 1 if SSSE3 inline assembly is available.]) ])

1487
  # SSE4
1488 1489 1490 1491 1492 1493 1494 1495 1496 1497
  AC_CACHE_CHECK([if $CC groks SSE4 inline assembly],
    [ac_cv_sse4_inline],
    [CFLAGS="${CFLAGS_save} -O -msse4"
     AC_TRY_COMPILE(,[void *p;asm volatile("pmaxsb %%xmm1,%%xmm0"::"r"(p));],
                    ac_cv_sse4_inline=yes, ac_cv_sse4_inline=no)
     ARCH="${ARCH} sse4"
  ])
  AS_IF([test "${ac_cv_sse4_inline}" != "no"], [
    AC_DEFINE(CAN_COMPILE_SSE4, 1,
              [Define to 1 if SSE4 inline assembly is available.]) ])
1498 1499
])

1500 1501 1502
AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
    [CFLAGS="${CFLAGS_save}"
1503
     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
1504 1505 1506 1507
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
  AC_DEFINE(CAN_COMPILE_3DNOW, 1,
            [Define to 1 if 3D Now! inline assembly is available.])
1508
  VLC_ADD_PLUGIN([memcpy3dn])
1509 1510
])

1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528

AC_ARG_ENABLE(neon,
[ --disable-neon           disable NEON optimizations (default auto)],, [
  AS_IF([test "${host_cpu}" = "arm"], [enable_neon="yes"] ,[enable_neon="no"])
])
AS_IF([test "${enable_neon}" != "no"], [
  AC_CACHE_CHECK([if $CC groks NEON inline assembly], [ac_cv_neon_inline], [
    AC_COMPILE_IFELSE([
      AC_LANG_PROGRAM(,[[asm volatile("vqmovun.s64 d0, q1":::"d0");]])
    ], [
      ac_cv_neon_inline="yes"
    ], [
      ac_cv_neon_inline="no"
    ])
  ])
])
AM_CONDITIONAL(HAVE_NEON, [test "${ac_cv_neon_inline}" = "yes"])

1529 1530 1531 1532 1533 1534 1535 1536
AC_ARG_ENABLE(altivec,
[  --disable-altivec       disable AltiVec optimizations (default auto)],, [
  AS_IF([test "${host_cpu}" = "powerpc"],
        [enable_altivec=yes], [enable_altivec=no])
])
AS_IF([test "${enable_altivec}" = "yes"], [
  ARCH="${ARCH} altivec";
  AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
1537
    [ac_cv_altivec_inline],
1538
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
1539
     AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1540
         ac_cv_altivec_inline="yes",
1541
         [CFLAGS="${CFLAGS_save} -Wa,-m7400"
Sam Hocevar's avatar
 
Sam Hocevar committed
1542
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1543
            [ac_cv_altivec_inline="-Wa,-m7400"],
1544
            ac_cv_altivec_inline=no)
1545
         ])])
1546 1547 1548 1549 1550 1551 1552 1553
  AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
    AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
              [Define to 1 if AltiVec inline assembly is available.])
    AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
      VLC_ADD_CFLAGS([idctaltivec],[${ac_cv_altivec_inline}])
      VLC_ADD_CFLAGS([motionaltivec],[${ac_cv_altivec_inline}])
      VLC_ADD_CFLAGS([memcpyaltivec],[${ac_cv_altivec_inline}])
      VLC_ADD_CFLAGS([i420_yuy2_altivec],[${ac_cv_altivec_inline}])
1554
      VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
1555
    ])
1556 1557
    VLC_ADD_PLUGIN([memcpyaltivec])
    VLC_ADD_PLUGIN([i420_yuy2_altivec])
1558
  ])
1559

1560 1561 1562
dnl The AltiVec C extensions
dnl
dnl There are several possible cases:
1563 1564
dnl - OS X PPC, gcc 4.x: use -mpim-altivec -force_cpusubtype_ALL, don't
dnl                      need <altivec.h>
1565
dnl - OS X PPC, gcc 3.x: need -faltivec, don't need <altivec.h>
1566
dnl - Linux PPC, gcc 3.4, 4.x: need <altivec.h> which requires -maltivec
1567 1568 1569
dnl - Linux PPC, gcc 3.3: need <altivec.h> and -maltivec -mabi=altivec
dnl - Linux PPC, gcc 3.x: need <altivec.h> and -fvec
dnl - Others: test should fail
1570
  AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
1571
  [ac_cv_c_altivec],
1572
  [# OS X/PPC test (gcc 4.x)
1573
   CFLAGS="${CFLAGS_save} -mpim-altivec -force_cpusubtype_ALL"
1574
   AC_TRY_COMPILE([vector unsigned char foo;],
1575
     [vec_ld(0, (unsigned char *)0);],
1576
     [ac_cv_c_altivec="-mpim-altivec -force_cpusubtype_ALL"],
1577 1578
     [# OS X/PPC test (gcc 3.x)
      CFLAGS="${CFLAGS_save} -faltivec"
1579
      AC_TRY_COMPILE([vector unsigned char foo;],
1580
        [vec_ld(1 * sizeof(vector float), (unsigned char *)0);],
1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605
        [ac_cv_c_altivec="-faltivec"],
        dnl Below this are the Linux tests
        [# Linux/PPC test (gcc 4.x)
         CFLAGS="${CFLAGS_save} -maltivec"
         AC_TRY_COMPILE([#include <altivec.h>],
           [vec_ld(0, (unsigned char *)0);],
           [ac_cv_c_altivec="-maltivec"],
           [# Linux/PPC test (gcc 3.3)
            CFLAGS="${CFLAGS_save} -maltivec -mabi=altivec"
            AC_TRY_COMPILE([#include <altivec.h>],
              [vec_ld(0, (unsigned char *)0);],
              [ac_cv_c_altivec=""
               ac_cv_c_altivec_abi="-maltivec -mabi=altivec"],
              [# Linux/PPC test (gcc 3.3)
               CFLAGS="${CFLAGS_save} -fvec"
               AC_TRY_COMPILE([#include <altivec.h>],
                 [vec_ld(0, (unsigned char *)0);],
                 [ac_cv_c_altivec="-fvec"],
                 [ac_cv_c_altivec=no])
              ])
           ])
        ])
     ])
   CFLAGS="${CFLAGS_save}"
  ])
1606 1607 1608
  AS_IF([test "${ac_cv_c_altivec}" != "no"], [
    CPPFLAGS="${CPPFLAGS_save} ${ac_cv_c_altivec}"
  ])
1609

1610 1611
  AC_CHECK_HEADERS(altivec.h)
  CPPFLAGS="${CPPFLAGS_save}"
1612

1613 1614 1615
  AS_IF([test "${ac_cv_c_altivec}" != "no"], [
    AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1,
              [Define to 1 if C AltiVec extensions are available.])
1616
    VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
1617 1618
    VLC_ADD_CFLAGS([idctaltivec motionaltivec],[${ac_cv_c_altivec}])
    VLC_ADD_CFLAGS([i420_yuy2_altivec memcpyaltivec deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
1619 1620
    VLC_ADD_PLUGIN([memcpyaltivec])
    VLC_ADD_PLUGIN([i420_yuy2_altivec])
1621
  ])
1622

1623
  AC_CACHE_CHECK([if linker needs -framework vecLib],
1624
    [ac_cv_ld_altivec],
1625
    [LDFLAGS="${LDFLAGS_vlc} -Wl,-framework,vecLib"
1626
     AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
1627
     LDFLAGS="${LDFLAGS_save}"
1628
    ])
1629
  AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
1630
    VLC_ADD_LDFLAGS([libvlccore idctaltivec motionaltivec memcpyaltivec],[-Wl,-framework,vecLib])
1631 1632
  ])
])
Sam Hocevar's avatar
 
Sam Hocevar committed
1633

Sam Hocevar's avatar
 
Sam Hocevar committed
1634
dnl
1635
dnl  Special arch tuning
Sam Hocevar's avatar
 
Sam Hocevar committed
1636
dnl
1637
AC_ARG_WITH(tuning,
Sam Hocevar's avatar
 
Sam Hocevar committed
1638
[  --with-tuning=ARCH      enable special tuning for an architecture
1639
                          (default Pentium 2 on IA-32 and G4 on PPC)])
Sam Hocevar's avatar
Sam Hocevar committed
1640
if test -n "${with_tuning}"; then
1641 1642 1643
    if test "${with_tuning}" != "no"; then
        CFLAGS_TUNING="-mtune=${with_tuning}"
    fi
1644
else
1645
    if test "${SYS}" = "darwin" -a "${host_cpu}" != "powerpc"; then
1646
        CFLAGS_TUNING="-march=prescott -mtune=generic"
1647
    elif test "${host_cpu}" = "i686" -o "${host_cpu}" = "i586" -o "${host_cpu}" = "i486" -o "${host_cpu}" = "i386"; then
1648
        CFLAGS_TUNING="-mtune=pentium2"
1649
    elif test "${host_cpu}" = "x86_64"; then
1650
        CFLAGS_TUNING="-mtune=athlon64"
1651
    elif test "${host_cpu}" = "powerpc"; then
1652
        CFLAGS_TUNING="-mtune=G4";
1653
    fi
1654
fi
1655

1656 1657 1658 1659
dnl NOTE: this can't be cached cleanly
AS_IF([test "${CFLAGS_TUNING}"],
   [CFLAGS_save="${CFLAGS}"
    CFLAGS="${CFLAGS} ${CFLAGS_TUNING}"
1660

1661 1662 1663 1664 1665 1666
    AC_MSG_CHECKING([whether $CC accepts ${CFLAGS_TUNING}])
    AC_COMPILE_IFELSE([ ],
                      [tuning="yes"],
                      [CFLAGS_TUNING=""; tuning="no"
                       AS_IF([test "${with_tuning}"],
                             [AC_MSG_ERROR([requested tuning not supported])])])
1667

1668 1669 1670
    AC_MSG_RESULT([$tuning])
    CFLAGS="${CFLAGS_save}"
])
Sam Hocevar's avatar
 
Sam Hocevar committed
1671

1672 1673 1674 1675
dnl
dnl  Memory usage
dnl
AC_ARG_ENABLE(optimize-memory,
Rafaël Carré's avatar
Rafaël Carré committed
1676
[  --enable-optimize-memory optimize memory usage over performance])
1677 1678 1679 1680
if test "${enable_optimize_memory}" = "yes"; then
  AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
1681 1682 1683 1684
dnl
dnl  Enable/disable optimizations
dnl
AC_ARG_ENABLE(optimizations,
1685
[  --disable-optimizations disable compiler optimizations (default enabled)])
1686 1687 1688 1689 1690 1691 1692
if test "${enable_optimizations}" != "no"; then
   if test "${enable_optimize_memory}" = "yes"; then
      enable_optimizations="size"
   else
      enable_optimizations="speed"
   fi
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
1693

Sam Hocevar's avatar
 
Sam Hocevar committed
1694 1695 1696
dnl
dnl  Debugging mode
dnl
1697
AC_ARG_ENABLE(debug,
1698
[  --enable-debug          debug mode (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
1699
test "${enable_debug}" != "yes" && enable_debug="no"
1700 1701
AH_TEMPLATE(NDEBUG,
            [Define to 1 if debug code should NOT be compiled])
1702 1703 1704 1705 1706
AS_IF([test "x${enable_debug}" = "xno"], [
  AC_DEFINE(NDEBUG)
], [
  AC_CHECK_HEADERS([valgrind/valgrind.h])
])
Sam Hocevar's avatar
 
Sam Hocevar committed
1707

1708 1709 1710
dnl
dnl Allow runing as root (usefull for people runing on embedded platforms)
dnl
1711
AC_ARG_ENABLE(run-as-root,
1712
[  --enable-run-as-root    allow runing VLC as root (default disabled)])
1713
AS_IF([test "${enable_run_as_root}" = "yes"],[
1714 1715 1716 1717
    AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
              [Define to 1 to allow runing VLC as root (uid 0).])
])

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
1718 1719 1720 1721
dnl
dnl  Test coverage
dnl
AC_ARG_ENABLE(coverage,
Rémi Denis-Courmont's avatar
Typo  
Rémi Denis-Courmont committed
1722
	[  --enable-coverage       build for test coverage (default disabled)],,
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733
	[enable_coverage="no"])
AS_IF([test "${enable_coverage}" != "no"], [
	CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
	CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
	LDFLAGS="-lgcov ${LDFLAGS}"
	dnl ugly...
	CFLAGS_save="${CFLAGS}"
	CXXFLAGS_save="${CXXFLAGS}"
	LDFLAGS_save="${LDFLAGS}"
])

Sam Hocevar's avatar
 
Sam Hocevar committed
1734
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
1735
dnl  Enable release-specific flags
Sam Hocevar's avatar
 
Sam Hocevar committed
1736
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
1737
AC_ARG_ENABLE(release,
1738
[  --enable-release        activate extra optimizations (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
1739
test "${enable_release}" != "yes" && enable_release="no"
Sam Hocevar's avatar
 
Sam Hocevar committed
1740

1741 1742 1743 1744 1745
dnl
dnl Stream output
dnl
AC_ARG_ENABLE(sout,
  [  --enable-sout           Stream output modules (default enabled)])
1746 1747 1748
AS_IF([test "${enable_sout}" != "no"], [
  AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
])
1749
AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
1750

1751 1752
dnl Lua modules
AC_ARG_ENABLE(lua,
1753
  AS_HELP_STRING([--enable-lua],[lua playlist, metafetcher and interface
Christophe Mutricy's avatar
Christophe Mutricy committed
1754
		  plugins (default enabled)]))
1755 1756 1757
if test "${enable_lua}" != "no"
then
  PKG_CHECK_MODULES(LUA, lua5.1,
1758 1759 1760 1761 1762
    [ have_lua=yes ],
    [
    AC_MSG_WARN([lua5.1 not found, trying lua >= 5.1 instead])
    PKG_CHECK_MODULES(LUA, lua >= 5.1,
      [ have_lua=yes ],
1763
      [
1764
        have_lua=yes
1765 1766
        AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
          [],
1767
          [ have_lua=no ] )
1768
        AC_CHECK_LIB(  lua5.1 , luaL_newstate,
Christophe Mutricy's avatar
Christophe Mutricy committed
1769
          [LUA_LIBS="-llua5.1"],
1770
          AC_CHECK_LIB( lua51 , luaL_newstate,
1771
            [LUA_LIBS="-llua51"],
1772 1773 1774
            AC_CHECK_LIB( lua , luaL_newstate,
              [LUA_LIBS="-llua"],
              [ have_lua=no
1775 1776 1777 1778
                AS_IF([test "x${enable_lua}" = "xyes"],
                  [AC_MSG_ERROR([lua >= 5.1 not found!])],
                  [AC_MSG_WARN([lua >= 5.1 not found!])])
              ], [-lm])
1779 1780
          )
        )
1781 1782
      ])
    ])
1783
  if test "x${have_lua}" = "xyes" ;  then
1784
     VLC_ADD_LIBS([lua],[$LUA_LIBS])
1785
     VLC_ADD_CFLAGS([lua],[$LUA_CFLAGS])
1786
  fi
1787
fi
1788
AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
1789

1790 1791 1792 1793 1794 1795 1796
dnl
dnl HTTP daemon
dnl
AC_ARG_ENABLE(httpd,
  [  --enable-httpd          HTTP daemon (default enabled)])
if test "${enable_httpd}" != "no"
then
1797
  VLC_ADD_PLUGIN([http])
1798 1799
  AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP dameon support)
fi
1800
AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
1801

1802 1803 1804
dnl
dnl libproxy support
dnl
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817
AC_ARG_ENABLE(libproxy,
  [  --enable-libproxy       libproxy support (default auto)])
AS_IF([test "${enable_libproxy}" != "no"], [
  PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0, [
    AC_DEFINE(HAVE_LIBPROXY, 1, [Define if libproxy is available])
    VLC_ADD_CFLAGS([access_http],[$LIBPROXY_CFLAGS])
    VLC_ADD_LIBS([access_http],[$LIBPROXY_LIBS])
  ], [
    AS_IF([test "x${enable_libproxy}" != "x"], [
      AC_MSG_ERROR([libproxy could not be found on your system])
    ])
  ])
])
1818

1819

1820 1821 1822 1823
dnl
dnl VideoLAN manager
dnl
AC_ARG_ENABLE(vlm,
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
1824 1825 1826 1827 1828 1829 1830
  [  --enable-vlm            VideoLAN manager (default enabled)],,
  [enable_vlm="${enable_sout}"])
AS_IF([test "${enable_vlm}" != "no"], [
  AS_IF([test "${enable_sout}" = "no"], [
    AC_MSG_ERROR([VLM requires the stream output. Do not use --disable-sout.])
  ])
  AC_DEFINE(ENABLE_VLM, 1, [Define if you want the VideoLAN manager support])
1831
  VLC_ADD_PLUGIN([telnet])
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
1832
])
1833
AM_CONDITIONAL([ENABLE_VLM], [test "${enable_vlm}" != "no"])
1834

1835 1836 1837 1838
dnl
dnl Growl notification plugin
dnl
AC_ARG_ENABLE(growl,
1839 1840
  [  --enable-growl          growl notification plugin (default disabled)],,
  [enable_growl=no])
1841
AS_IF([test "${enable_growl}" != "no"], [
1842
    VLC_ADD_PLUGIN([growl_udp])
1843
    AC_CHECK_HEADERS(Growl/GrowlDefines.h, [
1844
      VLC_ADD_PLUGIN([growl])
1845 1846
      VLC_ADD_LDFLAGS([growl], [-Wl,-framework,Growl,-framework,AppKit])
    ])
1847 1848 1849
  ]
)

Christophe Mutricy's avatar
Christophe Mutricy committed
1850 1851 1852
dnl
dnl Libnotify notification plugin
dnl
1853
PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify], [libnotify notification], [auto])
Christophe Mutricy's avatar
Christophe Mutricy committed
1854

1855 1856 1857
dnl
dnl Audioscrobbler plugin
dnl
Christophe Mutricy's avatar
Christophe Mutricy committed
1858

1859
AC_ARG_ENABLE(audioscrobbler,
1860 1861
  [  --disable-audioscrobbler Last.fm submission plugin (default enabled)])
AS_IF([test "${enable_audioscrobbler}" != "no"], [
1862
        VLC_ADD_PLUGIN([audioscrobbler])
1863
  ])
1864

1865 1866 1867 1868
dnl
dnl Taglibplugin
dnl
AC_ARG_ENABLE(taglib,
1869
  [  --disable-taglib        Taglib support (default enabled) ])
1870
  AS_IF([test "${enable_taglib}" != "no"],[
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
1871
    PKG_CHECK_MODULES(TAGLIB, taglib >= 1.5,
1872
      [ VLC_ADD_PLUGIN([taglib])
1873
        VLC_ADD_LIBS([taglib],[$TAGLIB_LIBS -lz])
1874 1875 1876 1877
       VLC_ADD_CXXFLAGS([taglib],[$TAGLIB_CFLAGS]) ],
      [AC_MSG_WARN(TagLib library not found)])
  ])

Sam Hocevar's avatar
 
Sam Hocevar committed
1878
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
1879
dnl  Input plugins
Sam Hocevar's avatar
 
Sam Hocevar committed
1880 1881
dnl

Sam Hocevar's avatar
 
Sam Hocevar committed
1882
AC_ARG_WITH(,[Input plugins:])
Sam Hocevar's avatar
 
Sam Hocevar committed
1883

1884
dnl  live555 input
1885
dnl
1886
if test "${enable_livedotcom}"
1887 1888 1889
then
  AC_MSG_WARN(--{en|dis}able-livedotcom is deprecated. Use --{en|dis}able-live555 instead.)
fi
1890
if test "${enable_livedotcom}" = "no"
1891
then
1892
  enable_live555="no"
1893
fi
1894

1895
AC_ARG_ENABLE(live555,
1896 1897
[  --enable-live555        live555 RTSP input plugin (default enabled)])
if test "${enable_live555}" != "no"; then
1898 1899
  AC_ARG_WITH(live555-tree,
    [    --with-live555-tree=PATH live.com tree for static linking])
1900 1901

  dnl
1902
  dnl test for --with-live555-tree
1903
  dnl
1904
  if test "${with_livedotcom_tree}"
1905 1906 1907 1908
  then
    AC_MSG_WARN(--with-livedotcom-tree is deprecated. Use --with-live555-tree instead.)
  with_live555_tree="${with_livedotcom_tree}"
  fi
1909

1910
  if test -z "${with_live555_tree}" -a "${CXX}" != ""; then
Sam Hocevar's avatar
Sam Hocevar committed
1911 1912
    AC_LANG_PUSH(C++)
    CPPFLAGS_save="${CPPFLAGS}"
1913
    CPPFLAGS_live555="-I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment"
1914
    if test "${SYS}" = "solaris"; then
1915
      CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
1916
    fi
1917
    CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
1918 1919

    AC_CHECK_HEADERS(liveMedia_version.hh, [
1920
      AC_MSG_CHECKING(for liveMedia version >= 1214895600 )
1921 1922 1923 1924 1925 1926 1927
      AC_EGREP_CPP(yes,
        [#include <liveMedia_version.hh>
         #ifdef LIVEMEDIA_LIBRARY_VERSION_INT
         #if LIVEMEDIA_LIBRARY_VERSION_INT < 1214895600
         yes
         #endif
         #endif],
1928
        [AC_MSG_RESULT([no])
1929
         AC_MSG_ERROR([Your version of liveMedia is too old: you may get a more recent one from http://www.live555.com/liveMedia.
1930
lternatively you can use --disable-live555 to disable the liveMedia plugin.])
1931 1932 1933
      ],[
	 AC_MSG_RESULT([yes])
	 ])
1934
    ])
1935
     other_libs="-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment"
1936
     other_libs_pic="-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic"
1937 1938 1939 1940
      if test "${SYS}" = "mingw32"; then
        # add ws2_32 for closesocket, select, recv
        other_libs="$other_libs -lws2_32"
      fi
1941 1942
    dnl We need to check for pic because live555 don't provide shared libs
    dnl and we want to build a plugins so we need -fPIC on some arch.
Sam Hocevar's avatar
Sam Hocevar committed
1943
    AC_CHECK_HEADERS(liveMedia.hh, [
1944
      VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
1945 1946 1947 1948
        AC_CHECK_LIB(liveMedia_pic, main, [
          VLC_ADD_PLUGIN([live555])
         VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
	 ],[
Sam Hocevar's avatar
Sam Hocevar committed
1949
        AC_CHECK_LIB(liveMedia, main, [
1950
          VLC_ADD_PLUGIN([live555])
1951
          VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
1952
        ],[],[${other_libs}]) ],[${other_libs_pic}])
1953 1954
    ],[
       AC_MSG_WARN([The development files for liveMedia (live555) can't be found])
Sam Hocevar's avatar
Sam Hocevar committed
1955 1956 1957 1958
    ])
    CPPFLAGS="${CPPFLAGS_save}"
    AC_LANG_POP(C++)
  else
1959 1960 1961
    AC_MSG_CHECKING(for liveMedia/libliveMedia.a in ${with_live555_tree})
    real_live555_tree="`cd ${with_live555_tree} 2>/dev/null && pwd`"
    if test -z "${real_live555_tree}"; then
1962 1963
      dnl  The given directory can't be found
      AC_MSG_RESULT(no)
1964
      AC_MSG_ERROR([cannot cd to ${with_live555_tree}])
1965
    fi
1966 1967
    if test -f "${real_live555_tree}/liveMedia/libliveMedia.a"; then
      AC_MSG_RESULT(${real_live555_tree}/liveMedia/libliveMedia.a)
1968

1969
      AC_CHECK_HEADERS(${real_live555_tree}/liveMedia/include/liveMedia_version.hh,[
1970
        AC_MSG_CHECKING(for liveMedia version >= 1214895600 )
1971 1972 1973 1974 1975 1976 1977
        AC_EGREP_CPP(yes,
          [#include "${real_live555_tree}/liveMedia/include/liveMedia_version.hh"
           #ifdef LIVEMEDIA_LIBRARY_VERSION_INT
           #if LIVEMEDIA_LIBRARY_VERSION_INT < 1214895600
           yes
           #endif
           #endif],
1978
          [AC_MSG_RESULT([no])
1979
           AC_MSG_ERROR([Your version of liveMedia is too old: you may get a more recent one from http://www.live555.com/liveMedia.
1980
lternatively you can use --disable-live555 to disable the liveMedia plugin.])
1981 1982 1983
        ],[
	   AC_MSG_RESULT([yes])
	   ])
1984 1985
      ])

1986
      VLC_ADD_PLUGIN([live555])
1987

Gildas Bazin's avatar
 
Gildas Bazin committed
1988 1989
      if test "${SYS}" = "mingw32"; then
        # add ws2_32 for closesocket, select, recv
1990
        VLC_ADD_LIBS([live555],[-lws2_32])
Gildas Bazin's avatar
 
Gildas Bazin committed
1991 1992
      fi

1993 1994 1995 1996
      VLC_ADD_LIBS([live555],[-L${real_live555_tree}/liveMedia -lliveMedia])
      VLC_ADD_LIBS([live555],[-L${real_live555_tree}/BasicUsageEnvironment -lBasicUsageEnvironment])
      VLC_ADD_LIBS([live555],[-L${real_live555_tree}/groupsock -lgroupsock])
      VLC_ADD_LIBS([live555],[-L${real_live555_tree}/UsageEnvironment -lUsageEnvironment])
Gildas Bazin's avatar
 
Gildas Bazin committed
1997

1998 1999 2000 2001
      VLC_ADD_CXXFLAGS([live555],[-I${real_live555_tree}/BasicUsageEnvironment/include])
      VLC_ADD_CXXFLAGS([live555],[-I${real_live555_tree}/groupsock/include])
      VLC_ADD_CXXFLAGS([live555],[-I${real_live555_tree}/liveMedia/include])
      VLC_ADD_CXXFLAGS([live555],[-I${real_live555_tree}/UsageEnvironment/include ])
2002
      if test "${SYS}" = "solaris"; then
2003
        VLC_ADD_CXXFLAGS([live555],[-DSOLARIS])
2004
      fi
2005
    else
2006
      dnl  The given live555 wasn't built
2007 2008 2009 2010
        AC_MSG_RESULT(no)
      if test "${enable_live555}" = "yes"; then
        AC_MSG_ERROR([cannot find ${real_live555_tree}/liveMedia/libliveMedia.a, make sure you compiled live555 in ${with_live555_tree}])
      fi	
2011 2012 2013 2014
    fi
  fi
fi

2015
dnl
2016 2017
dnl - special access module for dc1394 input
dnl - dv module: digital video module check for libraw1394
2018
dnl
Christophe Mutricy's avatar
Christophe Mutricy committed
2019 2020
PKG_ENABLE_MODULES_VLC([DC1394], [], [libraw1394 >= 2.0.1 libdc1394 >= 1.0.0], [dc1394 access module], [auto])
PKG_ENABLE_MODULES_VLC([DV], [access_dv], [libraw1394 >= 2.0.1 libavc1394 >= 0.5.3], [DV input module], [auto])
2021 2022 2023 2024 2025 2026 2027 2028 2029

dnl
dnl dvdread module: check for libdvdread
dnl
AC_ARG_ENABLE(dvdread,
[  --enable-dvdread        dvdread input module (default disabled)])
if test "${enable_dvdread}" != "no"
then
  AC_ARG_WITH(dvdread,
2030
  [    --with-dvdread=PATH   libdvdread headers and libraries])
2031 2032
  AC_ARG_WITH(dvdread-tree,
  [    --with-dvdread-tree=PATH libdvdread tree for static linking])
2033 2034

  dnl Temporary hack (yeah, sure ;)
2035
  if test "${SYS}" = "mingw32" || test "${SYS}" = "darwin" || test "${SYS}" = "beos" ; then
2036
      VLC_ADD_LIBS([dvdread],[-ldvdcss])
2037 2038
  fi

2039 2040 2041 2042 2043
  if test -z "${with_dvdread}"
  then
    if test -z "${with_dvdread_tree}"
    then
      AC_CHECK_HEADERS(dvdread/dvd_reader.h,
2044
        [ VLC_ADD_PLUGIN([dvdread])
2045
          VLC_ADD_LIBS([dvdread],[-ldvdread ${LIBS_dvdcss}])
2046
        ],[
2047 2048 2049 2050 2051 2052 2053 2054 2055 2056
	  AC_CHECK_HEADERS(libdvdread/dvd_reader.h,
            [ VLC_ADD_PLUGIN([dvdread])
	      VLC_ADD_LIBS([dvdread],[-ldvdread ${LIBS_dvdcss}])
	    ],[
	      if test -n "${enable_dvdread}"
	      then
	      AC_MSG_ERROR([cannot find libdvdread headers])
	     fi
	   ])
	])
2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069
    else
      AC_MSG_CHECKING(for libdvdread.a in ${with_dvdread_tree})
      real_dvdread_tree="`cd ${with_dvdread_tree} 2>/dev/null && pwd`"
      if test -z "${real_dvdread_tree}"
      then
        dnl  The given directory can't be found
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot cd to ${with_dvdread_tree}])
      fi
      if test -f "${real_dvdread_tree}/dvdread/.libs/libdvdread.a"
      then
        dnl  Use a custom libdvdread
        AC_MSG_RESULT(${real_dvdread_tree}/dvdread/.libs/libdvdread.a)
2070
        VLC_ADD_PLUGIN([dvdread])
2071
        VLC_ADD_LIBS([dvdread],[-L${real_dvdread_tree}/dvdread/.libs -ldvdread ${LIBS_dvdcss}])
Sam Hocevar's avatar
Sam Hocevar committed
2072
        VLC_ADD_CPPFLAGS([dvdread],[-I${real_dvdread_tree}])
2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084
      else
        dnl  The given libdvdread wasn't built
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot find ${real_dvdread_tree}/dvdread/.libs/libdvdread.a, make sure you compiled libdvdread in ${with_dvdread_tree}])
      fi
    fi
  else
    AC_MSG_CHECKING(for dvdread headers in ${with_dvdread})
    if test -f ${with_dvdread}/include/dvdread/dvd_reader.h
    then
      dnl  Use ${with_dvdread}/include/dvdread/dvd_reader.h
      AC_MSG_RESULT(yes)
2085
      VLC_ADD_PLUGIN([dvdread])
2086
      VLC_ADD_LIBS([dvdread],[-L${with_dvdread}/lib -ldvdread ${LIBS_dvdcss}])
Sam Hocevar's avatar
Sam Hocevar committed
2087
      VLC_ADD_CPPFLAGS([dvdread],[-I${with_dvdread}/include])
2088 2089 2090 2091 2092 2093 2094
    else
      dnl  No libdvdread could be found, sorry
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([cannot find ${with_dvdread}/include/dvdread/dvd_reader.h])
    fi
  fi
fi
Stéphane Borel's avatar
Stéphane Borel committed
2095

Gildas Bazin's avatar
 
Gildas Bazin committed
2096 2097 2098 2099 2100
dnl
dnl  libdvdnav plugin
dnl
AC_ARG_ENABLE(dvdnav,
  [  --enable-dvdnav         dvdnav input module (default enabled)])
2101
if test "${enable_dvdnav}" != "no"
Gildas Bazin's avatar
 
Gildas Bazin committed
2102
then
2103 2104
  dnl Same hack than dvdread
  if test "${SYS}" = "mingw32" || test "${SYS}" = "darwin" || test "${SYS}" = "beos" ; then
2105
      VLC_ADD_LIBS([dvdnav],[-ldvdcss])
2106 2107
  fi

Gildas Bazin's avatar
 
Gildas Bazin committed
2108 2109 2110 2111 2112 2113 2114 2115 2116 2117
  DVDNAV_PATH="${PATH}"
  AC_ARG_WITH(dvdnav-config-path,
    [    --with-dvdnav-config-path=PATH dvdnav-config path (default search in \$PATH)],
    [ if test "${with_dvdnav_config_path}" != "no"
      then
        DVDNAV_PATH="${with_dvdnav_config_path}:${PATH}"
      fi ])
  AC_PATH_PROG(DVDNAV_CONFIG, dvdnav-config, no, ${DVDNAV_PATH})
  if test "${DVDNAV_CONFIG}" != "no"
  then
2118
    VLC_ADD_PLUGIN([dvdnav])
Sam Hocevar's avatar
Sam Hocevar committed
2119
    VLC_ADD_CFLAGS([dvdnav],[`${DVDNAV_CONFIG} --cflags`])
2120
    VLC_ADD_LIBS([dvdnav],[`${DVDNAV_CONFIG} --libs`])
Gildas Bazin's avatar
 
Gildas Bazin committed
2121 2122 2123
  fi
fi

Gildas Bazin's avatar
 
Gildas Bazin committed
2124 2125 2126 2127
dnl
dnl  Windows DirectShow access module
dnl
AC_ARG_ENABLE(dshow,
2128
  [  --enable-dshow          Win32 DirectShow support (default enabled on Win32)])
Gildas Bazin's avatar
 
Gildas Bazin committed
2129 2130
if test "${enable_dshow}" != "no"
then
2131
  if test "${SYS}" = "mingw32"
Gildas Bazin's avatar
 
Gildas Bazin committed
2132
  then
2133
    AC_LANG_PUSH(C++)
Gildas Bazin's avatar
 
Gildas Bazin committed
2134
      AC_CHECK_HEADERS(dshow.h,
2135
      [ VLC_ADD_PLUGIN([dshow])
Sam Hocevar's avatar
Sam Hocevar committed
2136
        VLC_ADD_CXXFLAGS([dshow],[])
2137
        VLC_ADD_LIBS([dshow],[-lole32 -loleaut32 -luuid]) ])
2138
    AC_LANG_POP(C++)
Gildas Bazin's avatar
 
Gildas Bazin committed
2139 2140 2141
  fi
fi

2142 2143 2144 2145
dnl
dnl  Windows DirectShow BDA access module
dnl
AC_ARG_ENABLE(bda,
2146
  AS_HELP_STRING([--enable-bda],[Win32 DirectShow BDA support (default
Christophe Mutricy's avatar
Christophe Mutricy committed
2147
		  enabled on Win32)]))
2148 2149
if test "${enable_bda}" != "no"
then
2150
  if test "${SYS}" = "mingw32"
2151 2152
  then
      AC_CHECK_HEADERS(dshow.h,
2153
      [ VLC_ADD_PLUGIN([bda])
2154
        VLC_ADD_CXXFLAGS([bda],[])
2155
        VLC_ADD_LIBS([bda],[-lstrmiids -lole32 -loleaut32 -luuid]) ])
2156 2157 2158
  fi
fi

2159 2160 2161 2162 2163

dnl
dnl  OpenCV wrapper and example filters
dnl
AC_ARG_ENABLE(opencv,
Rafaël Carré's avatar
Rafaël Carré committed
2164
  [  --enable-opencv         OpenCV (computer vision) filter (default disabled)])
2165 2166 2167 2168
if test "${enable_opencv}" = "yes" -a "${CXX}" != "";
then
  AC_ARG_WITH(opencv-tree,
  [    --with-opencv-tree=PATH opencv tree for linking])
2169
    if test "${SYS}" = "mingw32"
2170
    then
2171
      test -z "${with_opencv_tree}" && AC_MSG_ERROR([You have to specify --with-opencv-tree])
2172 2173 2174
      AC_MSG_CHECKING(for opencv in ${with_opencv_tree})
      if test -f ${with_opencv_tree}/cv/include/cv.h -a -f ${with_opencv_tree}/cxcore/include/cxcore.h \
        -a -f ${with_opencv_tree}/cvaux/include/cvaux.h -a -f ${with_opencv_tree}/otherlibs/highgui/highgui.h
2175 2176
      then
        AC_MSG_RESULT(yes)
2177
        VLC_ADD_PLUGIN([opencv_wrapper])
2178
        VLC_ADD_LIBS([opencv_wrapper],[-L${with_opencv_tree}/lib -lcv -lcxcore -lcvaux -lhighgui])
2179 2180
        VLC_ADD_CFLAGS([opencv_wrapper],[-I${with_opencv_tree}/cv/include -I${with_opencv_tree}/cxcore/include -I${with_opencv_tree}/cvaux/include -I${with_opencv_tree}/otherlibs/highgui])
        AC_LANG_PUSH(C++)
2181
        VLC_ADD_PLUGIN([opencv_example])
2182
        VLC_ADD_LIBS([opencv_example],[-L${with_opencv_tree}/lib -lcv -lcxcore -lcvaux -lhighgui])
2183
        VLC_ADD_CXXFLAGS([opencv_example],[-I${with_opencv_tree}/cv/include -I${with_opencv_tree}/cxcore/include -I${with_opencv_tree}/cvaux/include -I${with_opencv_tree}/otherlibs/highgui])
2184
        AC_LANG_POP(C++)
2185
      else
2186 2187 2188
        dnl  No opencv could be found, sorry
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot find opencv in ${with_opencv_tree}])
2189
      fi
2190
    else
2191 2192 2193 2194 2195 2196 2197 2198 2199 2200
      PKG_CHECK_MODULES(OPENCV, opencv,
        [
          VLC_ADD_PLUGIN([opencv_example])
          VLC_ADD_PLUGIN([opencv_wrapper])
          VLC_ADD_LIBS([opencv_example opencv_wrapper],[${OPENCV_LIBS}])
          VLC_ADD_CFLAGS([opencv_wrapper],[${OPENCV_CFLAGS}])
          VLC_ADD_CXXFLAGS([opencv_example],[${OPENCV_CFLAGS}])
        ],
        [AC_MSG_ERROR([libopencv not found!])]
      )
2201 2202 2203 2204
    fi
fi


2205 2206 2207 2208
dnl
dnl  libsmbclient plugin
dnl
AC_ARG_ENABLE(smb,
2209
  [  --enable-smb            smb input module (default enabled)])
2210
if test "${enable_smb}" != "no"; then
2211 2212 2213 2214 2215 2216
  AC_CHECK_HEADERS(libsmbclient.h,
    [ VLC_ADD_PLUGIN([access_smb])
      VLC_ADD_LIBS([access_smb],[-lsmbclient]) ],
    [ if test -n "${enable_smb}"; then
        AC_MSG_ERROR([cannot find libsmbclient headers])
     fi ])
2217 2218
fi

Rémi Duraffort's avatar
Rémi Duraffort committed
2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231

dnl
dnl sftp access support
dnl
AC_ARG_ENABLE(sftp,
  [  --enable-sftp           sftp input access module (default disable)])
if test "${enable_sftp}" = "yes"; then
  AC_CHECK_HEADERS(libssh2.h, [
    VLC_ADD_PLUGIN([access_sftp])
    VLC_ADD_LIBS([access_sftp], [-lssh2])
  ])
fi

2232
dnl
2233
dnl  libdvbpsi ts demux/mux
2234 2235
dnl
AC_ARG_ENABLE(dvbpsi,
2236
  [  --enable-dvbpsi         dvbpsi ts mux and demux module (default enabled)])
Christophe Mutricy's avatar
Christophe Mutricy committed
2237
have_dvbpsi=no
Sam Hocevar's avatar
Sam Hocevar committed
2238
if test "${enable_dvbpsi}" != "no"
2239
then
2240
  AC_ARG_WITH(dvbpsi,
2241
  [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
2242
  AC_ARG_WITH(dvbpsi,
2243
  [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
Sam Hocevar's avatar
Sam Hocevar committed
2244 2245
  case "${with_dvbpsi}" in
  ""|yes)
Sam Hocevar's avatar
Sam Hocevar committed
2246
    if test -z "${with_dvbpsi_tree}"
2247
    then
Sam Hocevar's avatar
Sam Hocevar committed
2248
      AC_CHECK_HEADERS(dvbpsi/dr.h,
2249
        [ VLC_ADD_PLUGIN([ts])
2250
          if test "${enable_sout}" != "no"; then
2251
            VLC_ADD_PLUGIN([mux_ts])
2252
          fi
Christophe Mutricy's avatar
Christophe Mutricy committed
2253 2254
          VLC_ADD_LIBS([mux_ts ts dvb],[-ldvbpsi])
	  have_dvbpsi=yes],
2255
        [  AC_MSG_WARN([cannot find libdvbpsi headers]) ],
2256 2257 2258 2259 2260
        [#if defined( HAVE_STDINT_H )
#   include <stdint.h>
#elif defined( HAVE_INTTYPES_H )
#   include <inttypes.h>
#endif
Gildas Bazin's avatar
 
Gildas Bazin committed
2261 2262 2263 2264
#include <dvbpsi/dvbpsi.h>
#include <dvbpsi/descriptor.h>
#include <dvbpsi/pat.h>
#include <dvbpsi/pmt.h>])
2265 2266 2267
    else
      AC_MSG_CHECKING(for libdvbpsi.a in ${with_dvbpsi_tree})
      real_dvbpsi_tree="`cd ${with_dvbpsi_tree} 2>/dev/null && pwd`"
Sam Hocevar's avatar
Sam Hocevar committed
2268
      if test -z "${real_dvbpsi_tree}"
2269 2270 2271 2272 2273 2274 2275 2276 2277
      then
        dnl  The given directory can't be found
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot cd to ${with_dvbpsi_tree}])
      fi
      if test -f "${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
      then
        dnl  Use a custom libdvbpsi
        AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
2278
        VLC_ADD_PLUGIN([ts])
2279
        if test "${enable_sout}" != "no"; then
2280
          VLC_ADD_PLUGIN([mux_ts])
2281
        fi
2282
        VLC_ADD_CPPFLAGS([mux_ts ts dvb],[-I${real_dvbpsi_tree}/src])
2283
        VLC_ADD_LIBS([mux_ts ts dvb],[${real_dvbpsi_tree}/src/.libs/libdvbpsi.a])
Christophe Mutricy's avatar
Christophe Mutricy committed
2284
	have_dvbpsi=yes
2285 2286 2287 2288 2289
      else
        dnl  The given libdvbpsi wasn't built
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot find ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a, make sure you compiled libdvbpsi in ${with_dvbpsi_tree}])
      fi
2290
    fi
2291
  ;;
Sam Hocevar's avatar
Sam Hocevar committed
2292
  no)
2293
    dnl  Compile without dvbpsi
2294 2295 2296
  ;;
  *)
    AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
Sam Hocevar's avatar
Sam Hocevar committed
2297
    if test -z "${with_dvbpsi}"
2298
    then
2299 2300
      LDFLAGS_test=""
      CPPFLAGS_test=""
2301
    else
2302 2303
      LDFLAGS_test="-L${with_dvbpsi}/lib"
      CPPFLAGS_test="-I${with_dvbpsi}/include"
2304
    fi
2305
    CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
Sam Hocevar's avatar
Sam Hocevar committed
2306
    AC_CHECK_HEADERS([dvbpsi/dr.h],[
2307
      VLC_ADD_PLUGIN([ts])
2308
      if test "${enable_sout}" != "no"; then
2309
        VLC_ADD_PLUGIN([mux_ts])
2310
      fi
Christophe Massiot's avatar
Christophe Massiot committed
2311
      VLC_ADD_CPPFLAGS([mux_ts ts dvb],[${CPPFLAGS_test}])
2312
      VLC_ADD_LIBS([mux_ts ts dvb],[${LDFLAGS_test} -ldvbpsi])
Christophe Mutricy's avatar
Christophe Mutricy committed
2313
      have_dvbpsi=yes
Sam Hocevar's avatar
Sam Hocevar committed
2314
    ],[
Sam Hocevar's avatar
Sam Hocevar committed
2315
      if test -n "${enable_dvbpsi}"
2316 2317 2318
      then
        AC_MSG_ERROR([Could not find libdvbpsi on your system: you may get it from www.videolan.org, you'll need at least version 0.1.1])
      fi
2319 2320 2321 2322 2323 2324 2325 2326 2327 2328
    ],
    [#if defined( HAVE_STDINT_H )
#   include <stdint.h>
#elif defined( HAVE_INTTYPES_H )
#   include <inttypes.h>
#endif
#include <dvbpsi/dvbpsi.h>
#include <dvbpsi/descriptor.h>
#include <dvbpsi/pat.h>
#include <dvbpsi/pmt.h>])
2329
    CPPFLAGS="${CPPFLAGS_save}"
2330 2331
  ;;
  esac
2332 2333
  AC_CHECK_LIB(dvbpsi, dvbpsi_GenSDTSections, [
    AC_DEFINE(HAVE_DVBPSI_SDT, 1, [Define if you have dvbpsi_GenSDTSections.])
2334
  ], [], [${LIBS_ts}])
2335

2336
fi
2337

2338 2339 2340 2341 2342
dnl
dnl  Video4Linux plugin
dnl
AC_ARG_ENABLE(v4l,
  [  --enable-v4l            Video4Linux input support (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
2343
if test "${enable_v4l}" = "yes"
2344
then
2345 2346
  AC_ARG_WITH(v4l,
    [    --with-v4l=PATH       path to a v4l-enabled kernel tree],[],[])
Sam Hocevar's avatar
Sam Hocevar committed
2347
  if test "${with_v4l}" != "no" -a -n "${with_v4l}"
2348
  then
Sam Hocevar's avatar
Sam Hocevar committed
2349
    VLC_ADD_CPPFLAGS([v4l],[-I${with_v4l}/include])
2350 2351 2352
  fi

  CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_v4l}"
2353
  AC_CHECK_HEADERS(linux/videodev.h, [
2354
    VLC_ADD_PLUGIN([v4l])
2355 2356
  ],[])
  CPPFLAGS="${CPPFLAGS_save}"
2357 2358
fi

2359
dnl
2360
dnl  Video4Linux2 plugin
2361 2362
dnl
AC_ARG_ENABLE(v4l2,
2363 2364
  [  --enable-v4l2           Video4Linux2 input support (default enabled)])
if test "${enable_v4l2}" != "no"
2365 2366 2367 2368 2369 2370 2371 2372 2373 2374
then
  AC_ARG_WITH(v4l2,
    [    --with-v4l2=PATH       path to a v4l2-enabled kernel tree],[],[])
  if test "${with_v4l2}" != "no" -a -n "${with_v4l2}"
  then
    VLC_ADD_CPPFLAGS([v4l2],[-I${with_v4l2}/include])
  fi

  CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_v4l2}"
  AC_CHECK_HEADERS(linux/videodev2.h, [
2375
    VLC_ADD_PLUGIN([v4l2])
2376 2377 2378 2379
  ],[])
  CPPFLAGS="${CPPFLAGS_save}"
fi

2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393
dnl
dnl libv4l2 support for video4linux.
dnl
AC_ARG_ENABLE( libv4l2,
  [  --enable-libv4l2        Libv4l2 Video4Linux2 support (default enabled)])
if test "${enable_libv4l2}" != "no" -a "${enable_v4l2}" != "no"
then
    PKG_CHECK_MODULES( LIBV4L2, libv4l2, [
      VLC_ADD_LDFLAGS([v4l2],[${LIBV4L2_LIBS}])
      VLC_ADD_CFLAGS([v4l2],[${LIBV4L2_CFLAGS}])
      AC_DEFINE(HAVE_LIBV4L2, 1, Define if libv4l is available)],
      AC_MSG_WARN([LibV4L2 support disabled because libv4l2 development headers were not found])
    )
fi
2394

2395 2396 2397 2398 2399
dnl
dnl  special access module for Hauppauge PVR cards
dnl
AC_ARG_ENABLE(pvr,
  [  --enable-pvr            PVR cards access module (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
2400
if test "${enable_pvr}" = "yes"
2401
then
2402
  VLC_ADD_PLUGIN([pvr])
2403 2404 2405 2406 2407 2408 2409 2410
  AC_ARG_WITH(videodev2,
    [  --with-videodev2=FILE   Location of videodev2.h file (default /usr/include/linux/videodev2.h)],[],[])
  if test "${with_videodev2}" != "no" -a -n "${with_videodev2}"
  then
    AC_DEFINE_UNQUOTED(VIDEODEV2_H_FILE, "${with_videodev2}", [Location of videodev2.h])
  fi

  AC_CACHE_CHECK([for new linux/videodev2.h],
2411
      [ac_cv_new_linux_videodev2_h],
2412 2413 2414 2415 2416 2417 2418 2419
      [AC_TRY_COMPILE([
          #include <sys/types.h>
          #   ifdef VIDEODEV2_H_FILE
	  #   include VIDEODEV2_H_FILE
	  #   else
	  #   include <linux/videodev2.h>
	  #   endif
	  ],
2420
          [struct v4l2_ext_controls ctrls; ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG; ],
2421 2422 2423
          ac_cv_new_linux_videodev2_h=yes,
          ac_cv_new_linux_videodev2_h=no)])
  if test "${ac_cv_new_linux_videodev2_h}" != "no"; then
2424 2425
    AC_DEFINE(HAVE_NEW_LINUX_VIDEODEV2_H, 1, [Define if new linux/videodev2.h present])
  fi
2426 2427
fi

2428 2429 2430
dnl
dnl  gnomeVFS access module
dnl
2431
PKG_ENABLE_MODULES_VLC([GNOMEVFS], [access_gnomevfs], [gnome-vfs-2.0], [GnomeVFS access module], [auto])
2432

2433

2434 2435 2436
dnl Need to test libcdio and libvcdinfo for a number of things. Do it now.
AC_ARG_ENABLE(libcdio,
  [  --enable-libcdio        CD input and control library support (default enabled)])
2437

2438
AC_ARG_ENABLE(vcdinfo,
Christophe Mutricy's avatar
Christophe Mutricy committed
2439
  [  --enable-vcdinfo        VCD information library support (default enabled)])
2440

2441 2442 2443 2444
have_libcdio=no
have_libvcdinfo=no
if test "${enable_libcdio}" != "no"
then
2445
  PKG_CHECK_MODULES(LIBCDIO, libcdio >= 0.78.2,
2446
     have_libcdio=yes
2447
     AC_DEFINE(HAVE_LIBCDIO, 1,
2448
     [Define if you have libcdio 0.78.2 or greater installed]),
2449
     [AC_MSG_WARN(CD Reading and information library not found)])
2450

2451 2452 2453
  if test "${enable_vcdinfo}" != "no"
  then
    PKG_CHECK_MODULES(VCDINFO, libvcdinfo >= 0.7.22,
2454
       [have_libvcdinfo=yes],
2455 2456
       [AC_MSG_WARN(VCD information library not found)])
  fi
2457 2458
fi

2459 2460 2461
dnl
dnl  VCDX and CDDAX modules
dnl
2462
AC_ARG_ENABLE(cddax,
Christophe Mutricy's avatar
Christophe Mutricy committed
2463 2464
  AS_HELP_STRING([--enable-cddax],[audio CD plugin with CD Text and CD paranoia
		  via libcdio (default disabled)]))
2465

2466
AC_ARG_ENABLE(libcddb,
2467
  [  --enable-libcddb        CDDB support for libcdio audio CD (default enabled)])
2468

2469
if test "${enable_cddax}" = "yes"
2470
then
2471 2472
  if test "$have_libcdio" = "yes"
  then
2473
    AC_DEFINE(HAVE_CDDAX, 1, [Define for the audio CD plugin using libcdio])
2474
    VLC_ADD_LIBS([cddax],[$LIBCDIO_LIBS])
2475
    VLC_ADD_CFLAGS([cddax],[$LIBCDIO_CFLAGS])
2476
    VLC_ADD_PLUGIN([cddax])
2477
    PKG_CHECK_MODULES(LIBCDIO_PARANOIA, libcdio_paranoia >= 0.72, [
2478
    VLC_ADD_LIBS([cddax],[$LIBCDIO_CDDA_LIBS $LIBCDIO_CDDA_LIBS $LIBCDIO_PARANOIA_LIBS])],
2479
    AC_MSG_WARN([CD Paranoia support disabled because no libcdio >= 0.72 found]))
2480
  else
2481 2482 2483
    AC_MSG_WARN([cddax plugin disabled because ok libcdio library not found or disabled])
    HAVE_CDDAX=no
  fi
2484

2485
  if test "$enable_libcddb" != "no"; then
2486
    PKG_CHECK_MODULES(LIBCDDB, libcddb >= 0.9.5, [
2487
      HAVE_LIBCDDB=yes
2488
      AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
2489
      VLC_ADD_LIBS([cddax],[$LIBCDDB_LIBS])
2490 2491
      VLC_ADD_CFLAGS([cddax],[$LIBCDDB_CFLAGS])
      ],
2492
      [AC_MSG_WARN(new enough libcddb not found. CDDB access disabled)
2493 2494
      HAVE_LIBCDDB=no])
  fi
2495

2496 2497
fi

2498
AC_ARG_ENABLE(vcdx,
2499
  [  --enable-vcdx           VCD with navigation via libvcdinfo (default disabled)])
2500

2501 2502
if test "${enable_vcdx}" = "yes"
then
2503 2504
  if test "${have_libvcdinfo}" = "yes"
  then
2505
    VLC_ADD_LIBS([vcdx],[$VCDINFO_LIBS])
2506
    VLC_ADD_CFLAGS([vcdx],[$VCDINFO_CFLAGS])
2507
  else
2508 2509 2510
    AC_MSG_WARN([vcdx plugin disabled because ok libvcdinfo library not found or disabled])
    HAVE_VCDX=no
  fi
2511

Rocky Bernstein's avatar
Rocky Bernstein committed
2512
  PKG_CHECK_MODULES(LIBCDIO, libiso9660 >= 0.72,
2513
   [VLC_ADD_LIBS([vcdx],[$LIBISO9660_LIBS])
2514
    VLC_ADD_CFLAGS([vcdx],[$LIBISO9660_CFLAGS])],
2515
    [AC_MSG_WARN([vcdx plugin disabled because ok libiso9660 library not found])
2516 2517
    HAVE_VCDX=no])

2518 2519
  if test "$have_libvcdinfo" = "yes"
  then
2520
    AC_DEFINE(HAVE_VCDX, 1,
2521
    [Define for the VCD plugin using libcdio/libvcdinfo])
2522
    VLC_ADD_LIBS([vcdx],[$VCDINFO_LIBS])
2523
    VLC_ADD_CFLAGS([vcdx],[$VCDINFO_CFLAGS])
2524
    VLC_ADD_PLUGIN([vcdx])
2525
  else
2526 2527 2528
    AC_MSG_WARN([vcdx plugin disabled because ok libvcdinfo library not found])
    HAVE_VCDX=no
  fi
2529
fi
2530

2531
dnl
2532
dnl  Built-in CD-DA and VCD module
2533
dnl
2534
AC_ARG_ENABLE(cdda,
2535
  [  --enable-cdda           audio CD via built-in VCD (default enabled)])
2536

2537
AC_ARG_ENABLE(vcd,
2538
  [  --enable-vcd            built-in VCD (default enabled)])
2539

Sam Hocevar's avatar
Sam Hocevar committed
2540
if test "${enable_vcd}" != "no"
Sam Hocevar's avatar
 
Sam Hocevar committed
2541
then
2542
  AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
Sam Hocevar's avatar
 
Sam Hocevar committed
2543
  AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
2544
    AC_MSG_RESULT(yes)
2545 2546
    VLC_ADD_PLUGIN([vcd])
    VLC_ADD_PLUGIN([cdda])
2547 2548
  ],[
    AC_MSG_RESULT(no)
Sam Hocevar's avatar
 
Sam Hocevar committed
2549
  ])
2550

2551
  AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
2552
  AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
2553
    AC_MSG_RESULT(yes)
2554 2555
    VLC_ADD_PLUGIN([vcd])
    VLC_ADD_PLUGIN([cdda])
2556
    AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
2557 2558
  ],[
    AC_MSG_RESULT(no)
2559 2560
  ])

2561
  AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
2562
  AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
2563
    AC_MSG_RESULT(yes)
2564 2565
    VLC_ADD_PLUGIN([vcd])
    VLC_ADD_PLUGIN([cdda])
2566
    AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
2567 2568
  ],[
    AC_MSG_RESULT(no)
2569
  ])
2570

Sam Hocevar's avatar
Sam Hocevar committed
2571
  if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32"
Sam Hocevar's avatar
 
Sam Hocevar committed
2572
  then
2573 2574
    VLC_ADD_PLUGIN([vcd])
    VLC_ADD_PLUGIN([cdda])
Sam Hocevar's avatar
 
Sam Hocevar committed
2575
  fi
2576

Sam Hocevar's avatar
Sam Hocevar committed
2577
  if test "${SYS}" = "darwin"
Sam Hocevar's avatar
 
Sam Hocevar committed
2578
  then
2579 2580
    VLC_ADD_PLUGIN([vcd])
    VLC_ADD_PLUGIN([cdda])
2581
    VLC_ADD_LDFLAGS([vcd vcdx cdda cddax],[-Wl,-framework,IOKit,-framework,CoreFoundation])
2582
    VLC_ADD_LIBS([vcdx cddax cdda],[-liconv])
Sam Hocevar's avatar
 
Sam Hocevar committed
2583
  fi
2584 2585 2586

  if test "$enable_libcddb" != "no"; then
    PKG_CHECK_MODULES(LIBCDDB, libcddb >= 0.9.5, [
2587
      HAVE_LIBCDDB=yes
2588
      AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
2589
      VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
2590 2591
      VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
      ],:
2592
      [AC_MSG_WARN(new enough libcddb not found. CDDB access disabled)
2593 2594
      HAVE_LIBCDDB=no])
  fi
2595 2596
fi

2597 2598 2599 2600
dnl
dnl  DVB-S/DVB-T/DVB-C satellite/teresterial/cable input using v4l2
dnl
AC_ARG_ENABLE(dvb,
2601
  [  --enable-dvb            DVB-S/T/C card support (default enabled)])
2602

2603
if test "${enable_dvb}" != "no"
2604
then
2605
    AS_IF([test "${have_dvbpsi}" = "yes" ],[
Christophe Mutricy's avatar
Christophe Mutricy committed
2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618
    AC_ARG_WITH(dvb,
     [    --with-dvb=PATH       path to a dvb- and v4l2-enabled kernel tree],[],[])
     if test "${with_dvb}" != "no" -a -n "${with_dvb}"
     then
       VLC_ADD_CFLAGS([dvb],[-I${with_dvb}/include])
     fi
     CPPFLAGS="${CPPFLAGS_save} -I${with_dvb}/include"
     AC_CHECK_HEADERS(linux/dvb/version.h linux/dvb/frontend.h, [
     VLC_ADD_PLUGIN([dvb])
     ],[AC_MSG_WARN(linux-dvb headers not found, dvb disabled)])
     CPPFLAGS="${CPPFLAGS_save}"
   ],[
     AC_MSG_WARN([the dvb access module requires libdvbpsi])
2619
    ])
2620 2621
fi

2622 2623 2624 2625
dnl
dnl  Screen capture module
dnl
AC_ARG_ENABLE(screen,
2626
  [  --enable-screen         Screen capture support (default enabled)])
2627
if test "${enable_screen}" != "no"; then
Eric Petit's avatar
Eric Petit committed
2628
  if test "${SYS}" = "darwin"; then
2629 2630
    AC_CHECK_HEADERS(OpenGL/gl.h, [
      AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
2631
        VLC_ADD_PLUGIN([screen])
2632 2633
        VLC_ADD_LDFLAGS([screen],[-Wl,-framework,OpenGL,-framework,ApplicationServices])
      ])
2634
    ])
Eric Petit's avatar
Eric Petit committed
2635
  elif test "${SYS}" = "mingw32"; then
2636
    VLC_ADD_PLUGIN([screen])
2637
    VLC_ADD_LIBS([screen],[-lgdi32])
2638 2639
  elif test "${SYS}" = "mingwce"; then
    CPPFLAGS="${CPPFLAGS_save}"
2640
  elif test "${SYS}" = "beos"; then
2641
    VLC_ADD_PLUGIN([screen])
2642
    VLC_ADD_CXXFLAGS([screen],[])
2643
    VLC_ADD_LIBS([screen],[-lbe])
2644 2645 2646
  fi
fi

2647
dnl
2648
dnl  ipv6 plugin - not for QNX yet
2649
dnl
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
2650 2651
have_ipv6=no
AC_CHECK_FUNCS(inet_pton,[have_ipv6=yes],[
2652
  AC_CHECK_LIB(nsl,inet_pton, [have_ipv6=yes])
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
2653 2654
])

2655
AS_IF([test "${have_ipv6}" = "yes"], [
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
2656 2657
  AC_DEFINE(HAVE_INET_PTON, 1, [Define to 1 if you have inet_pton().])])

2658 2659 2660 2661 2662

AC_CHECK_FUNCS(inet_ntop,[
  AC_DEFINE(HAVE_INET_NTOP, 1, [Define to 1 if you have inet_ntop().])])


Gildas Bazin's avatar
 
Gildas Bazin committed
2663
dnl
Gildas Bazin's avatar
 
Gildas Bazin committed
2664
dnl  ogg demux plugin
Gildas Bazin's avatar
 
Gildas Bazin committed
2665
dnl
2666
PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto])
2667
if test "${enable_sout}" != "no"; then
2668
    PKG_ENABLE_MODULES_VLC([MUX_OGG], [], [ogg >= 1.0], [Ogg demux support], [auto])
Gildas Bazin's avatar
 
Gildas Bazin committed
2669 2670
fi

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
2671 2672
if test "${enable_sout}" != "no"; then
dnl Check for libshout
Christophe Mutricy's avatar
Christophe Mutricy committed
2673
PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
2674 2675
fi

Gildas Bazin's avatar
 
Gildas Bazin committed
2676 2677 2678 2679
dnl
dnl  matroska demux plugin
dnl
AC_ARG_ENABLE(mkv,
Gildas Bazin's avatar
 
Gildas Bazin committed
2680
  [  --enable-mkv            Matroska demux support (default enabled)])
2681
if test "${enable_mkv}" != "no" -a "${CXX}" != ""; then
Sam Hocevar's avatar
Sam Hocevar committed
2682 2683
  AC_LANG_PUSH(C++)
  AC_CHECK_HEADERS(ebml/EbmlVersion.h, [
2684
    AC_MSG_CHECKING(for libebml version >= 0.7.7)
2685 2686 2687
    AC_EGREP_CPP(yes,
      [#include <ebml/EbmlVersion.h>
       #ifdef LIBEBML_VERSION
2688
       #if LIBEBML_VERSION >= 0x000706
2689 2690 2691 2692 2693
       yes
       #endif
       #endif],
      [AC_MSG_RESULT([yes])
        AC_CHECK_HEADERS(matroska/KaxVersion.h, [
2694
          AC_MSG_CHECKING(for libmatroska version >= 0.8.0)
2695 2696 2697 2698 2699 2700 2701 2702 2703 2704
          AC_EGREP_CPP(yes,
            [#include <matroska/KaxVersion.h>
             #ifdef LIBMATROSKA_VERSION
             #if LIBMATROSKA_VERSION >= 0x000705
             yes
             #endif
             #endif],
            [AC_MSG_RESULT([yes])
              AC_CHECK_HEADERS(matroska/KaxAttachments.h)
              VLC_ADD_CXXFLAGS([mkv],[])
2705 2706 2707
              if test "${SYS}" = "darwin"; then
                VLC_ADD_CXXFLAGS([mkv],[-O1])
              fi
2708
              AC_CHECK_LIB(ebml_pic, main, [
2709
                VLC_ADD_PLUGIN([mkv])
2710
                VLC_ADD_LIBS([mkv],[-lmatroska -lebml_pic])
2711 2712
              ],
                AC_CHECK_LIB(ebml, main, [
2713
                  VLC_ADD_PLUGIN([mkv])
2714
                  VLC_ADD_LIBS([mkv],[-lmatroska -lebml])
2715
                ])
2716
	      )
2717 2718 2719 2720
            ],
            [AC_MSG_RESULT([no])
              AC_MSG_ERROR([Your libmatroska is too old: you may get a more recent one from http://dl.matroska.org/downloads/libmatroska/. Alternatively you can use --disable-mkv to disable the matroska plugin.])
          ])
Sam Hocevar's avatar
Sam Hocevar committed
2721
        ])
2722 2723 2724
      ],
      [AC_MSG_RESULT([no])
        AC_MSG_ERROR([Your libebml is too old: you may get a more recent one from http://dl.matroska.org/downloads/libebml/. Alternatively you can use --disable-mkv to disable the matroska plugin.])
2725
    ])
Sam Hocevar's avatar
Sam Hocevar committed
2726
  ])
Sam Hocevar's avatar
Sam Hocevar committed
2727
  AC_LANG_POP(C++)
Gildas Bazin's avatar
 
Gildas Bazin committed
2728 2729
fi

Gildas Bazin's avatar
 
Gildas Bazin committed
2730 2731 2732 2733 2734 2735 2736
dnl
dnl  modplug demux plugin
dnl
AC_ARG_ENABLE(mod,
  [  --enable-mod            Mod demux support (default enabled)])
if test "${enable_mod}" != "no"
then
2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752
  AC_ARG_WITH(mod-tree,
  [    --with-mod-tree=PATH mod tree for static linking])
  if test -n "${with_mod_tree}"
  then
    AC_MSG_CHECKING(for libmodplug.a in ${with_mod_tree})
    real_mod_tree="`cd ${with_mod_tree} 2>/dev/null && pwd`"
    if test -z "${real_mod_tree}"
    then
      dnl  The given directory can't be found
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([cannot cd to ${with_mod_tree}])
    fi
    if test -f "${real_mod_tree}/src/.libs/libmodplug.a"
    then
      dnl  Use a custom mod
      AC_MSG_RESULT(${real_mod_tree}/src/.libs/libmodplug.a)
2753
      VLC_ADD_PLUGIN([mod])
2754
      VLC_ADD_LIBS([mod],[${real_mod_tree}/src/.libs/libmodplug.a -lstdc++])
2755
      VLC_ADD_CXXFLAGS([mod],[-I${real_mod_tree}/include])
2756 2757 2758 2759 2760 2761 2762
    else
      dnl  The given mod wasn't built
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([cannot find ${real_mod_tree}/src/.libs/libmodplug.a, make sure you compiled mod in ${with_mod_tree}])
    fi
  else
    AC_CHECK_HEADERS(libmodplug/modplug.h, [
2763
      VLC_ADD_PLUGIN([mod])
2764
      VLC_ADD_CXXFLAGS([mod],[])
2765
      VLC_ADD_LIBS([mod],[-lmodplug -lstdc++])])
2766
  fi
Gildas Bazin's avatar
 
Gildas Bazin committed
2767 2768
fi

2769 2770 2771 2772 2773 2774 2775
dnl
dnl  mpc demux plugin
dnl
AC_ARG_ENABLE(mpc,
  [  --enable-mpc            Mpc demux support (default enabled)])
if test "${enable_mpc}" != "no"
then
Yavor Doganov's avatar
Yavor Doganov committed
2776
  AC_CHECK_HEADERS([mpc/mpcdec.h], [
2777
    VLC_ADD_PLUGIN([mpc])
Yavor Doganov's avatar
Yavor Doganov committed
2778 2779 2780 2781
    VLC_ADD_LIBS([mpc],[-lmpcdec])],
    [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
    VLC_ADD_PLUGIN([mpc])
    VLC_ADD_LIBS([mpc],[-lmpcdec])])])
2782 2783
fi

2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807
dnl
dnl  game music emu demux plugin
dnl
AC_ARG_ENABLE(gme,
  [  --enable-gme            Game Music Emu demux support (default enabled)])
if test "${enable_gme}" != "no" -a "${CXX}" != "";
then
  AC_LANG_PUSH(C++)
  AC_ARG_WITH(gme-tree,
  [    --with-gme-tree=PATH gme tree for static linking])
  if test -n "${with_gme_tree}"
  then
    AC_MSG_CHECKING(for libgme.a in ${with_mod_tree})
    real_gme_tree="`cd ${with_gme_tree} 2>/dev/null && pwd`"
    if test -z "${real_gme_tree}"
    then
      dnl  The given directory can't be found
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([cannot cd to ${with_gme_tree}])
    fi
    if test -f "${real_gme_tree}/gme/libgme.a"
    then
      dnl  Use a custom gme
      AC_MSG_RESULT(${real_gme_tree}/gme/libgme.a)
2808
      VLC_ADD_PLUGIN([gme])
2809
      VLC_ADD_LIBS([gme],[${real_gme_tree}/gme/libgme.a])
2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820
      VLC_ADD_CXXFLAGS([gme],[-I${real_gme_tree}/gme])
    else
      dnl  The given gme wasn't built
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([cannot find ${real_mod_tree}/gme/libgme.a, make sure you compiled gme in ${with_gme_tree}])
    fi
  else
      AC_MSG_WARN([only static linking is available, you must provide a gme-tree])
  fi
  AC_LANG_POP(C++)
fi
2821

Sam Hocevar's avatar
 
Sam Hocevar committed
2822
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
2823
dnl  Codec plugins
Sam Hocevar's avatar
 
Sam Hocevar committed
2824
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
2825

Sam Hocevar's avatar
 
Sam Hocevar committed
2826
AC_ARG_WITH(,[Codec plugins:])
Sam Hocevar's avatar
 
Sam Hocevar committed
2827

2828 2829 2830 2831 2832 2833 2834 2835 2836 2837
dnl
dnl wmafixed plugin
dnl
AC_ARG_ENABLE(wma-fixed,
  [  --enable-wma-fixed      libwma-fixed module (default disabled)])
if test "${enable_wma_fixed}" = "yes"
then
  VLC_ADD_PLUGIN([wma_fixed])
fi

2838 2839 2840 2841 2842 2843 2844 2845 2846 2847
dnl
dnl shine fixed point mp3 encoder
dnl
AC_ARG_ENABLE(shine,
  [  --enable-shine          shine mp3 encoding module (default disabled)])
if test "${enable_shine}" = "yes"
then
  VLC_ADD_PLUGIN([shine])
fi

2848
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
2849
dnl  mad plugin
2850
dnl
2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904
AC_ARG_ENABLE(mad,
  [  --enable-mad            libmad module (default enabled)])
if test "${enable_mad}" != "no"
then
  AC_ARG_WITH(mad,
    [    --with-mad=PATH       path to libmad],[],[])
  if test "${with_mad}" != "no" -a -n "${with_mad}"
  then
    VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${with_mad}/include])
    VLC_ADD_LIBS([mpgatofixed32],[-L${with_mad}/lib])
  fi

  AC_ARG_WITH(mad-tree,
    [    --with-mad-tree=PATH   mad tree for static linking],[],[])
  if test "${with_mad_tree}" != "no" -a -n "${with_mad_tree}"
  then
    real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
    if test -z "${real_mad_tree}"
    then
      dnl  The given directory can't be found
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([${with_mad_tree} directory doesn't exist])
    fi
    dnl  Use a custom libmad
    AC_MSG_CHECKING(for mad.h in ${real_mad_tree})
    if test -f ${real_mad_tree}/mad.h
    then
      AC_MSG_RESULT(yes)
      VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${real_mad_tree}])
      VLC_ADD_LIBS([mpgatofixed32],[-L${real_mad_tree}/.libs])
      LDFLAGS="${LDFLAGS_save} ${LIBS_mpgatofixed32}"
      AC_CHECK_LIB(mad, mad_bit_init, [
        VLC_ADD_PLUGIN([mpgatofixed32])
        VLC_ADD_LIBS([mpgatofixed32],[-lmad])
        ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
      ],[])
      LDFLAGS="${LDFLAGS_save}"
    else
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([the specified tree doesn't have mad.h])
    fi
  else
    CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mpgatofixed32}"
    LDFLAGS="${LDFLAGS_save} ${LIBS_mpgatofixed32}"
    AC_CHECK_HEADERS(mad.h, ,
      [ AC_MSG_ERROR([Could not find libmad on your system: you may get it from http://www.underbit.com/products/mad/. Alternatively you can use --disable-mad to disable the mad plugin.]) ])
    AC_CHECK_LIB(mad, mad_bit_init, [
      VLC_ADD_PLUGIN([mpgatofixed32])
      VLC_ADD_LIBS([mpgatofixed32],[-lmad])],
      [ AC_MSG_ERROR([Cannot find libmad library...]) ])
    CPPFLAGS="${CPPFLAGS_save}"
    LDFLAGS="${LDFLAGS_save}"
  fi
fi
2905

2906
dnl
2907
dnl   libid3tag support (FIXME!!! doesn't work with new input)
2908
dnl
2909
AC_ARG_ENABLE( id3tag,
2910 2911
[  --disable-id3tag        id3tag metadata reader plugin (default disabled)])
AS_IF([test "${enable_id3tag}" = "yes"], [
2912
  AC_CHECK_HEADERS(id3tag.h, [
2913 2914 2915 2916 2917
      AS_IF([test "${have_zlib}" = "yes"],[
          VLC_ADD_LIBS([id3tag],[-lid3tag -lz])
          VLC_ADD_PLUGIN([id3tag])
       ])
    ])
2918
])
2919

2920
AC_ARG_ENABLE(merge-ffmpeg,
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
2921
[  --enable-merged-ffmpeg  merge FFmpeg-based plugins (default disabled)],, [
2922 2923 2924 2925
  enable_merge_ffmpeg="no"
])
AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])

2926
dnl
2927
dnl  avcodec decoder/encoder plugin
2928
dnl
2929

2930 2931 2932 2933 2934
if test "${with_ffmpeg_tree}"
then
  AC_MSG_WARN([--with-ffmpeg-tree is deprecated. Use PKG_CONFIG_PATH instead.])
fi

2935
AC_ARG_ENABLE(avcodec,
Christophe Mutricy's avatar
Christophe Mutricy committed
2936
[  --enable-avcodec        libavcodec codec (default enabled)])
2937
if test "${enable_avcodec}" != "no"
2938
then
2939
  PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 51.48.0 libavutil],
2940 2941 2942 2943 2944
    [
      VLC_SAVE_FLAGS
      CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
      CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
      AC_CHECK_HEADERS(libavcodec/avcodec.h ffmpeg/avcodec.h)
2945
      AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h)
2946 2947 2948 2949
      VLC_ADD_PLUGIN([avcodec])
      VLC_ADD_LIBS([avcodec],[$AVCODEC_LIBS])
      VLC_ADD_CFLAGS([avcodec],[$AVCODEC_CFLAGS])
      VLC_RESTORE_FLAGS
2950
      have_avcodec="yes"
2951
    ],[
2952
      AC_MSG_ERROR([Could not find libavcodec or libavutil. Use --disable-avcodec to ignore this error.])
2953 2954 2955
  ])
fi

2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975
dnl
dnl libva needs avcodec
dnl
AC_ARG_ENABLE(libva,
  [  --enable-libva         libva VAAPI support (default disabled)])
AS_IF([test "${enable_libva}" = "yes"], [
  AS_IF([test "x${have_avcodec}" = "xyes"], [
    PKG_CHECK_MODULES(LIBVA, [libva libva-x11],
      [
        VLC_ADD_LIBS([avcodec],[$LIBVA_LIBS])
        VLC_ADD_CFLAGS([avcodec],[$LIBVA_CFLAGS])
        AC_DEFINE(HAVE_AVCODEC_VAAPI, 1, [Define if avcodec has to be built with VAAPI support.])
      ],[
        AC_MSG_ERROR([Could not find libva.])
    ])
  ],[
    AC_MSG_ERROR([libva VAAPI support depends on libavcodec.])
  ])
])

2976 2977 2978 2979 2980 2981 2982 2983
dnl
dnl stream_out switcher needs libavcodec
dnl
AC_ARG_ENABLE(switcher,
  [  --enable-switcher       Stream-out switcher plugin (default disabled)])
AS_IF([test "${enable_switcher}" = "yes"], [
  AS_IF([test "x${have_avcodec}" = "xyes"], [
    VLC_ADD_PLUGIN([stream_out_switcher])
2984 2985
    VLC_ADD_LIBS([stream_out_switcher],[$AVCODEC_LIBS $AVUTIL_LIBS])
    VLC_ADD_CFLAGS([stream_out_switcher],[$AVCODEC_CFLAGS $AVUTIL_CFLAGS])
2986 2987 2988 2989 2990
  ],[AC_MSG_ERROR([Stream_out switcher depends on avcodec])
  ])
])


2991 2992 2993
dnl
dnl  avformat demuxer/muxer plugin
dnl
2994

2995
AC_ARG_ENABLE(avformat,
Christophe Mutricy's avatar
Christophe Mutricy committed
2996
[  --enable-avformat       libavformat containers (default enabled)])
2997 2998
if test "${enable_avformat}" != "no"
then
2999
  PKG_CHECK_MODULES(AVFORMAT,[libavformat libavutil],
3000
    [
3001 3002 3003 3004
      VLC_SAVE_FLAGS
      CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
      CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
      AC_CHECK_HEADERS(libavformat/avformat.h ffmpeg/avformat.h)
3005
      AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h)
3006 3007 3008 3009 3010 3011 3012 3013
      AS_IF([test "$enable_merge_ffmpeg" = "no"], [
        VLC_ADD_PLUGIN([avformat])
        VLC_ADD_LIBS([avformat],[$AVFORMAT_LIBS $AVUTIL_LIBS])
        VLC_ADD_CFLAGS([avformat],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
      ], [
        VLC_ADD_LIBS([avcodec],[$AVFORMAT_LIBS $AVUTIL_LIBS])
        VLC_ADD_CFLAGS([avcodec],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
      ])
3014 3015
      VLC_RESTORE_FLAGS
    ],[
3016
      AC_MSG_ERROR([Could not find libavformat or libavutil. Use --disable-avformat to ignore this error.])
3017 3018
  ])
fi
3019

3020 3021 3022
dnl
dnl  swscale image scaling and conversion plugin
dnl
3023

3024
AC_ARG_ENABLE(swscale,
3025
  AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
Christophe Mutricy's avatar
Christophe Mutricy committed
3026
		  (default enabled)]))
3027 3028
if test "${enable_swscale}" != "no"
then
3029
  PKG_CHECK_MODULES(SWSCALE,[libswscale],
3030
    [
3031
      VLC_SAVE_FLAGS
3032 3033 3034 3035 3036 3037
      CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
      CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
      AC_CHECK_HEADERS(libswscale/swscale.h ffmpeg/swscale.h)
      VLC_ADD_PLUGIN([swscale])
      VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
      VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
3038
      VLC_RESTORE_FLAGS
3039
    ],[
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
3040
      AC_MSG_ERROR([Could not find libswscale. Use --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
3041 3042
  ])
fi
Derk-Jan Hartman's avatar
Derk-Jan Hartman committed
3043

3044 3045 3046
dnl
dnl  postproc plugin
dnl
3047

3048
AC_ARG_ENABLE(postproc,
Christophe Mutricy's avatar
Christophe Mutricy committed
3049
[  --enable-postproc       libpostproc image post-processing (default enabled)])
3050 3051
if test "${enable_postproc}" != "no"
then
3052
  PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
3053 3054 3055 3056
    [
      VLC_SAVE_FLAGS
      CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
      CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
3057
      AC_CHECK_HEADERS(postproc/postprocess.h)
3058
      VLC_ADD_PLUGIN([postproc])
3059 3060
      VLC_ADD_LIBS([postproc],[$POSTPROC_LIBS $AVUTIL_LIBS])
      VLC_ADD_CFLAGS([postproc],[$POSTPROC_CFLAGS $AVUTIL_CFLAGS])
3061
      VLC_RESTORE_FLAGS
3062
    ],[
3063
      AC_MSG_ERROR([Could not find libpostproc. Use --disable-postproc to ignore this error.])
3064
  ])
3065 3066
fi

3067 3068 3069 3070 3071
dnl
dnl  faad decoder plugin
dnl
AC_ARG_ENABLE(faad,
[  --enable-faad           faad codec (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
3072
if test "${enable_faad}" = "yes"
3073
then
3074
  AC_ARG_WITH(faad-tree,
3075
  [    --with-faad-tree=PATH faad tree for static linking])
Sam Hocevar's avatar
Sam Hocevar committed
3076
  if test -n "${with_faad_tree}"
3077 3078 3079
  then
    AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
    real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
Sam Hocevar's avatar
Sam Hocevar committed
3080
    if test -z "${real_faad_tree}"
3081 3082 3083 3084 3085 3086 3087 3088 3089
    then
      dnl  The given directory can't be found
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
    fi
    if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"
    then
      dnl  Use a custom faad
      AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
3090
      VLC_ADD_PLUGIN([faad])
3091
      VLC_ADD_LIBS([faad],[${real_faad_tree}/libfaad/.libs/libfaad.a])
Sam Hocevar's avatar
Sam Hocevar committed
3092
      VLC_ADD_CPPFLAGS([faad],[-I${real_faad_tree}/include])
3093 3094 3095
    else
      dnl  The given libfaad wasn't built
      AC_MSG_RESULT(no)
3096
      AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
3097 3098
    fi
  else
3099
    CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_faad}"
3100
    LDFLAGS="${LDFLAGS_save} ${LIBS_faad}"
3101 3102 3103
    AC_CHECK_HEADERS(faad.h, ,
      [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ])
    AC_CHECK_LIB(faad, faacDecOpen, [
3104
      VLC_ADD_PLUGIN([faad])
3105
      VLC_ADD_LIBS([faad],[-lfaad]) ],
3106
      AC_CHECK_LIB(faad, NeAACDecOpen, [
3107
        VLC_ADD_PLUGIN([faad])
3108
        VLC_ADD_LIBS([faad],[-lfaad]) ],
3109
        [ AC_MSG_ERROR([Cannot find libfaad library...]) ]))
3110 3111
    LDFLAGS="${LDFLAGS_save}"
    CPPFLAGS="${CPPFLAGS_save}"
3112 3113 3114
  fi
fi

3115
dnl
3116
dnl twolame encoder plugin
3117
dnl
Christophe Mutricy's avatar
Christophe Mutricy committed
3118
PKG_ENABLE_MODULES_VLC([TWOLAME], [], [twolame], [MPEG Audio Layer 2 encoder], [auto], [], [], [ -DLIBTWOLAME_STATIC])
3119

3120 3121 3122 3123
dnl
dnl  QuickTime plugin
dnl
AC_ARG_ENABLE(quicktime,
3124 3125
  [  --enable-quicktime      QuickTime module (deprecated)])
if test "${enable_quicktime}" = "yes"; then
Gildas Bazin's avatar
 
Gildas Bazin committed
3126
  if test "${SYS}" = "mingw32"; then
3127
    VLC_ADD_PLUGIN([quicktime])
Gildas Bazin's avatar
 
Gildas Bazin committed
3128
  else
3129
  AC_CHECK_HEADERS(QuickTime/QuickTime.h,
3130
    [ VLC_ADD_PLUGIN([quicktime])
3131
      VLC_ADD_LDFLAGS([quicktime],[-Wl,-framework,QuickTime,-framework,Carbon])
Derk-Jan Hartman's avatar
Derk-Jan Hartman committed
3132
    ], [ AC_MSG_ERROR([cannot find QuickTime headers]) ])
Gildas Bazin's avatar
 
Gildas Bazin committed
3133
  fi
3134
fi
3135

3136 3137 3138 3139
dnl
dnl  Real plugin
dnl
AC_ARG_ENABLE(real,
Wang Bo's avatar
Wang Bo committed
3140
  [  --enable-real           Real media module (default disabled)])
3141
if test "${enable_real}" = "yes"; then
3142
  VLC_ADD_PLUGIN([realaudio])
Wang Bo's avatar
Wang Bo committed
3143
  VLC_ADD_PLUGIN([realvideo])
3144 3145
fi

3146 3147 3148 3149 3150 3151
dnl
dnl  Real RTSP plugin
dnl
AC_ARG_ENABLE(realrtsp,
  [  --enable-realrtsp       Real RTSP module (default disabled)])
if test "${enable_realrtsp}" = "yes"; then
3152
  VLC_ADD_PLUGIN([access_realrtsp])
3153 3154
fi

3155 3156 3157 3158 3159 3160 3161 3162
AC_ARG_ENABLE(libsysfs,
  [  --enable-libsysfs       Get user key from firewire connected iPod via libsysfs (default enabled)])

AS_IF([test "${enable_libsysfs}" != "no"],[
  AC_CHECK_HEADERS(sysfs/libsysfs.h, [
    VLC_ADD_LIBS([mp4 mkv],[-lsysfs])
  ] )
])
3163 3164

dnl
3165
dnl skins2 module
3166
dnl
3167
AC_ARG_ENABLE(libtar,
Christophe Mutricy's avatar
Christophe Mutricy committed
3168
  [  --enable-libtar         libtar support for skins2 (default enabled)])
3169

3170 3171
AS_IF([test "${enable_libtar}" != "no"],[
  AC_CHECK_HEADERS(libtar.h, [
3172
    VLC_ADD_LIBS([skins2],[-ltar])
3173 3174
  ] )
])
3175

Gildas Bazin's avatar
 
Gildas Bazin committed
3176
dnl
Gildas Bazin's avatar
 
Gildas Bazin committed
3177
dnl A52/AC3 decoder plugin
Gildas Bazin's avatar
 
Gildas Bazin committed
3178
dnl
Gildas Bazin's avatar
 
Gildas Bazin committed
3179
AC_ARG_ENABLE(a52,
3180
  [  --enable-a52            A/52 support with liba52 (default enabled)])
Sam Hocevar's avatar
Sam Hocevar committed
3181
if test "${enable_a52}" != "no"
Gildas Bazin's avatar
 
Gildas Bazin committed
3182
then
3183
  AC_ARG_WITH(a52,
3184
    [    --with-a52=PATH       a52 headers and libraries])
Gildas Bazin's avatar
 
Gildas Bazin committed
3185 3186
  AC_ARG_WITH(a52-tree,
    [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
Sam Hocevar's avatar
Sam Hocevar committed
3187
  if test "${with_a52_tree}" != "no" -a -n "${with_a52_tree}"
Gildas Bazin's avatar
 
Gildas Bazin committed
3188
  then
Gildas Bazin's avatar
 
Gildas Bazin committed
3189
    real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
Sam Hocevar's avatar
Sam Hocevar committed
3190
    if test -z "${real_a52_tree}"
Gildas Bazin's avatar
 
Gildas Bazin committed
3191 3192 3193 3194 3195 3196 3197 3198 3199 3200
    then
      dnl  The given directory can't be found
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([${with_a52_tree} directory doesn't exist])
    fi
    dnl  Use a custom a52dec
    AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
    if test -f ${real_a52_tree}/include/a52.h
    then
      AC_MSG_RESULT(yes)
Sam Hocevar's avatar
Sam Hocevar committed
3201
      VLC_ADD_CPPFLAGS([a52tofloat32],[-I${real_a52_tree}])
3202
      VLC_ADD_LIBS([a52tofloat32],[-L${real_a52_tree}/liba52/.libs])
3203
      LDFLAGS="${LDFLAGS_save} ${LIBS_a52tofloat32}"
Gildas Bazin's avatar
 
Gildas Bazin committed
3204
      AC_CHECK_LIB(a52, a52_free, [
3205
        VLC_ADD_PLUGIN([a52tofloat32])
Sam Hocevar's avatar
Sam Hocevar committed
3206
        VLC_ADD_CPPFLAGS([a52tofloat32],[-DUSE_A52DEC_TREE])
3207
        VLC_ADD_LIBS([a52tofloat32],[-la52])
Gildas Bazin's avatar
 
Gildas Bazin committed
3208 3209 3210
        ],[
        if test -f ${real_a52_tree}/liba52/.libs/liba52.a
        then
3211
          AC_MSG_ERROR([make sure you have at least a52dec-0.7.3 ($real_a52_tree)])
Gildas Bazin's avatar
 
Gildas Bazin committed
3212 3213 3214
        else
          AC_MSG_ERROR([the specified tree hasn't been compiled])
        fi
3215
      ])
3216
      LDFLAGS="${LDFLAGS_save}"
Gildas Bazin's avatar
 
Gildas Bazin committed
3217 3218 3219 3220
    else
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([the specified tree doesn't have a52.h])
    fi
3221
  else
Sam Hocevar's avatar
Sam Hocevar committed
3222
    if test -z "${with_a52}"
3223
    then
3224 3225
      LDFLAGS_test=""
      CPPFLAGS_test=""
3226
    else
3227 3228
      LDFLAGS_test="-L${with_a52}/lib"
      CPPFLAGS_test="-I${with_a52}/include"
3229
    fi
3230
    CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
3231
    LDFLAGS="${LDFLAGS_save} ${LDFLAGS_test} ${LIBS_a52tofloat32}"
3232
    AC_CHECK_HEADERS(a52dec/a52.h, [
Gildas Bazin's avatar
 
Gildas Bazin committed
3233
      AC_CHECK_LIB(a52, a52_free, [
3234
        VLC_ADD_PLUGIN([a52tofloat32])
3235
        VLC_ADD_LIBS([a52tofloat32],[${LDFLAGS_test} -la52])
Sam Hocevar's avatar
Sam Hocevar committed
3236
        VLC_ADD_CPPFLAGS([a52tofloat32],[${CPPFLAGS_test}])
3237
      ],[
Gildas Bazin's avatar
 
Gildas Bazin committed
3238
        AC_MSG_ERROR([Could not find liba52 on your system: you may get it from http://liba52.sf.net/. Alternatively you can use --disable-a52 to disable the a52 plugin.])
3239
        ])
3240 3241
    ],[
      AC_MSG_ERROR([Could not find liba52 on your system: you may get it from http://liba52.sf.net/. Alternatively you can use --disable-a52 to disable the a52 plugin.])
Gildas Bazin's avatar
 
Gildas Bazin committed
3242
    ])
3243 3244
    CPPFLAGS="${CPPFLAGS_save}"
    LDFLAGS="${LDFLAGS_save}"
Gildas Bazin's avatar
 
Gildas Bazin committed
3245
  fi
Gildas Bazin's avatar
 
Gildas Bazin committed
3246 3247
fi

3248 3249 3250 3251 3252
AC_ARG_WITH(a52-fixed,
      [    --with-a52-fixed      specify if liba52 has been compiled with fixed point support],
      [
        VLC_ADD_CPPFLAGS([a52tofloat32],[-DLIBA52_FIXED]) ])

Gildas Bazin's avatar
 
Gildas Bazin committed
3253 3254 3255
dnl
dnl DTS Coherent Acoustics decoder plugin
dnl
3256
AS_IF([test "x${enable_dts}" != "x"], [
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
3257
  AC_MSG_ERROR([--enable-dts is obsolete. Please use libdca and --enable-dca.])
3258
])
3259
PKG_ENABLE_MODULES_VLC([DCA], [dtstofloat32], [libdca >= 0.0.5], [DTS Coherent Acoustics support with libdca], [auto])
Gildas Bazin's avatar
 
Gildas Bazin committed
3260

3261
dnl
Gildas Bazin's avatar
 
Gildas Bazin committed
3262
dnl  Flac plugin
3263
dnl
3264
PKG_ENABLE_MODULES_VLC([FLAC], [], [flac], [libflac decoder/encoder support], [auto])
3265

Gildas Bazin's avatar
 
Gildas Bazin committed
3266 3267 3268
dnl
dnl  Libmpeg2 plugin
dnl
3269
PKG_ENABLE_MODULES_VLC([LIBMPEG2], [], [libmpeg2 > 0.3.2], [libmpeg2 decoder support], [auto])
Gildas Bazin's avatar
 
Gildas Bazin committed
3270

Gildas Bazin's avatar
 
Gildas Bazin committed
3271 3272 3273
dnl
dnl  Vorbis plugin
dnl
3274
PKG_ENABLE_MODULES_VLC([VORBIS], [], [ogg vorbis >= 1.1 vorbisenc >= 1.1], [Vorbis decoder and encoder], [auto])
Gildas Bazin's avatar
 
Gildas Bazin committed
3275

Gildas Bazin's avatar
 
Gildas Bazin committed
3276 3277 3278 3279 3280
dnl
dnl  Tremor plugin
dnl
AC_ARG_ENABLE(tremor,
  [  --enable-tremor         Tremor decoder support (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
3281
if test "${enable_tremor}" = "yes"
Gildas Bazin's avatar
 
Gildas Bazin committed
3282 3283
then
  AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
3284
    VLC_ADD_PLUGIN([tremor])
3285
    VLC_ADD_LIBS([tremor],[-lvorbisidec -logg])
Gildas Bazin's avatar
 
Gildas Bazin committed
3286 3287 3288
   ],[])
fi

Gildas Bazin's avatar
 
Gildas Bazin committed
3289 3290 3291
dnl
dnl  Speex plugin
dnl
3292
PKG_ENABLE_MODULES_VLC([SPEEX], [], [ogg speex >= 1.0.5], [Speex decoder support], [auto])
Gildas Bazin's avatar
 
Gildas Bazin committed
3293

Gildas Bazin's avatar
 
Gildas Bazin committed
3294 3295 3296 3297 3298
dnl
dnl  tarkin decoder plugin
dnl
AC_ARG_ENABLE(tarkin,
[  --enable-tarkin         experimental tarkin codec (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
3299
if test "${enable_tarkin}" = "yes"
Gildas Bazin's avatar
 
Gildas Bazin committed
3300 3301 3302
then
  AC_ARG_WITH(tarkin-tree,
  [    --with-tarkin-tree=PATH tarkin tree for static linking])
Sam Hocevar's avatar
Sam Hocevar committed
3303
  if test -n "${with_tarkin_tree}"
Gildas Bazin's avatar
 
Gildas Bazin committed
3304 3305 3306 3307 3308
  then
    AC_MSG_CHECKING(for tarkin.o in ${with_tarkin_tree})
    real_tarkin_tree="`cd ${with_tarkin_tree} 2>/dev/null && pwd`"
    if test -f "${real_tarkin_tree}/tarkin.o"
    then
3309
      VLC_ADD_PLUGIN([tarkin])
Sam Hocevar's avatar
Sam Hocevar committed
3310
      VLC_ADD_CPPFLAGS([tarkin],[-I${real_tarkin_tree}])
3311
      VLC_ADD_LIBS([tarkin],[${real_tarkin_tree}/mem.o ${real_tarkin_tree}/pnm.o ${real_tarkin_tree}/wavelet.o ${real_tarkin_tree}/wavelet_xform.o ${real_tarkin_tree}/wavelet_coeff.o ${real_tarkin_tree}/yuv.o ${real_tarkin_tree}/tarkin.o ${real_tarkin_tree}/info.o -logg])
Gildas Bazin's avatar
 
Gildas Bazin committed
3312
      AC_MSG_RESULT(yes)
Gildas Bazin's avatar
 
Gildas Bazin committed
3313 3314 3315 3316 3317 3318 3319 3320 3321
    else
      dnl  The given tarkin tree wasn't built
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([cannot find ${real_tarkin_tree}/tarkin.o,
                    make sure you compiled tarkin in ${with_tarkin_tree}])
    fi
  fi
fi

Gildas Bazin's avatar
 
Gildas Bazin committed
3322 3323 3324
dnl
dnl  theora decoder plugin
dnl
3325
PKG_ENABLE_MODULES_VLC([THEORA], [], [ogg theora >= 1.0], [experimental theora codec], [auto])
Gildas Bazin's avatar
 
Gildas Bazin committed
3326

3327
dnl
3328
dnl  dirac encoder plugin
3329
dnl
3330
PKG_ENABLE_MODULES_VLC([DIRAC], [], [dirac >= 0.10.0], [dirac encoder], [auto])
3331

3332 3333 3334
dnl
dnl  schroedinger decoder plugin (for dirac format video)
dnl
3335
PKG_ENABLE_MODULES_VLC([SCHROEDINGER], [], [schroedinger-1.0 >= 1.0.6], [dirac decoder using schroedinger], [auto])
3336

3337 3338 3339 3340 3341 3342 3343 3344 3345
dnl
dnl  PNG decoder module
dnl
AC_ARG_ENABLE(png,
  [  --enable-png            PNG support (default enabled)])
if test "${enable_png}" != "no"; then
AC_CHECK_HEADERS(png.h, [
  LDFLAGS="${LDFLAGS_save} -lz"
  AC_CHECK_LIB(png, png_set_rows, [
3346
    VLC_ADD_LIBS([png],[-lpng -lz])
3347 3348
    VLC_ADD_PLUGIN([png])
    VLC_ADD_PLUGIN([osdmenu])
3349
    VLC_ADD_PLUGIN([osd_parser])],
3350
    [],[-lz])
3351
    LDFLAGS="${LDFLAGS_save}"
3352 3353
  ])
fi
3354
AM_CONDITIONAL(BUILD_OSDMENU, [test "${enable_png}" != "no"])
3355

3356 3357 3358 3359 3360 3361 3362
dnl
dnl H264 encoder plugin (using libx264)
dnl
AC_ARG_ENABLE(x264,
  [  --enable-x264           H264 encoding support with libx264 (default enabled)])
if test "${enable_x264}" != "no"; then
  AC_ARG_WITH(x264-tree,
3363
    [    --with-x264-tree=PATH x264 tree for static linking ],[],[])
3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378
  if test "${with_x264_tree}" != "no" -a -n "${with_x264_tree}"
  then
    real_x264_tree="`cd ${with_x264_tree} 2>/dev/null && pwd`"
    if test -z "${real_x264_tree}"
    then
      dnl  The given directory can't be found
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([${with_x264_tree} directory doesn't exist])
    fi
    dnl  Use a custom libx264
    AC_MSG_CHECKING(for x264.h in ${real_x264_tree})
    if test -f ${real_x264_tree}/x264.h
    then
      AC_MSG_RESULT(yes)
      VLC_ADD_CPPFLAGS([x264],[-I${real_x264_tree}])
3379
      VLC_ADD_LIBS([x264],[-L${real_x264_tree}])
Benjamin Pracht's avatar
 
Benjamin Pracht committed
3380
      PKG_CHECK_MODULES(X264,x264, [
3381
        VLC_ADD_PLUGIN([x264])
3382
        VLC_ADD_LDFLAGS([x264],[${X264_LIBS}])
Benjamin Pracht's avatar
 
Benjamin Pracht committed
3383
        VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
Hannes Domani's avatar
Hannes Domani committed
3384 3385 3386
        if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
          VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
        fi
3387 3388 3389 3390 3391 3392 3393 3394 3395
      ],[
        AC_MSG_ERROR([the specified tree hasn't been compiled])
      ])
      LDFLAGS="${LDFLAGS_save}"
    else
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([the specified tree doesn't have x264.h])
    fi
  else
3396
      PKG_CHECK_MODULES(X264,x264 >= 0.76, [
3397
        VLC_ADD_PLUGIN([x264])
3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409
        VLC_ADD_LDFLAGS([x264],[${X264_LIBS}])

        AC_CACHE_CHECK([if linker supports -Bsymbolic],
          [ac_cv_ld_bsymbolic],
          [LDFLAGS="${LDFLAGS_vlc} -Wl,-Bsymbolic"
            AC_TRY_LINK([],,ac_cv_ld_bsymbolic=yes,ac_cv_ld_bsymbolic=no)
            LDFLAGS="${LDFLAGS_save}"
          ])
        AS_IF([test "${ac_cv_ld_bsymbolic}" != "no"], [
          VLC_ADD_LDFLAGS([x264],[-Wl,-Bsymbolic])
        ])

Benjamin Pracht's avatar
 
Benjamin Pracht committed
3410
        VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
Hannes Domani's avatar
Hannes Domani committed
3411 3412 3413
        if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
          VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
        fi
3414 3415
      ],[
        if test "${enable_x264}" = "yes"; then
3416
            AC_MSG_ERROR([Could not find libx264 >= 0.76 on your system: you may get it from http://www.videolan.org/x264.html])
3417 3418 3419 3420 3421 3422
          fi
      ])
    LDFLAGS="${LDFLAGS_save}"
  fi
fi

3423 3424 3425
dnl
dnl libfluidsynth (MIDI synthetizer) plugin
dnl
3426
PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth], [MIDI synthetiser with libfluidsynth], [auto])
3427

3428
dnl
3429
dnl Teletext Modules
3430
dnl vbi decoder plugin (using libzbvi)
3431 3432
dnl telx module
dnl uncompatible
3433 3434
dnl
AC_ARG_ENABLE(zvbi,
3435
  AS_HELP_STRING([--enable-zvbi],[VBI (inc. Teletext) decoding support with
3436
                  libzvbi (default enabled)]))
3437
AC_ARG_ENABLE(telx,
3438
  AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
3439
                  zvbi) (default enabled if zvbi is absent)]))
3440 3441 3442

AS_IF( [test "${enable_zvbi}" != "no"],[
    PKG_CHECK_MODULES(ZVBI,
3443 3444 3445
        zvbi-0.2 >= 0.2.25,
        [
          VLC_ADD_LIBS([zvbi],[$ZVBI_LIBS])
3446
          if test "${SYS}" = "mingw32"; then
3447
              VLC_ADD_LIBS([zvbi],[ -lpthreadGC2])
3448
          fi
3449
          VLC_ADD_CFLAGS([zvbi],[$ZVBI_CFLAGS])
3450
          VLC_ADD_PLUGIN([zvbi])
3451 3452 3453 3454 3455 3456 3457 3458
          AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built])
          AS_IF( [test "${enable_telx}" = "yes"],[
                  AC_MSG_WARN([The zvbi and telx modules are uncompatibles.
                               Using zvbi.])
                  ])
        ],[
          AC_MSG_WARN(ZVBI library not found. Enabling the telx module instead)
        ])
3459
    ])
3460
AS_IF( [test "${enable_telx}" != "no" ],[
3461
  VLC_ADD_PLUGIN([telx])
3462
  ])
3463

Laurent Aimar's avatar
Laurent Aimar committed
3464 3465 3466 3467
dnl
dnl libass subtitle rendering module
dnl
AC_ARG_ENABLE(libass,
3468 3469
  [  --enable-libass         Subtitle support using libass (default enabled)])
AS_IF( [test "${enable_libass}" != "no"], [
3470
  PKG_CHECK_MODULES(LIBASS, libass >= 0.9.6,
Laurent Aimar's avatar
Laurent Aimar committed
3471
      [
3472
        VLC_ADD_LIBS([libass],[$LIBASS_LIBS])
Laurent Aimar's avatar
Laurent Aimar committed
3473 3474 3475
        VLC_ADD_CFLAGS([libass],[$LIBASS_CFLAGS])
        VLC_ADD_PLUGIN([libass])

3476 3477
        AC_CHECK_HEADERS(fontconfig/fontconfig.h,
          [VLC_ADD_CPPFLAGS([libass],[-DHAVE_FONTCONFIG])
3478 3479
           VLC_ADD_LIBS([libass],[-lfontconfig])
       ])
Laurent Aimar's avatar
Laurent Aimar committed
3480 3481 3482 3483 3484
      ],[
        AC_MSG_WARN([LIBASS library not found])
      ])
  ])

3485 3486 3487 3488
dnl
dnl asa demuxer
dnl
AC_ARG_ENABLE(asademux,
Christophe Mutricy's avatar
Christophe Mutricy committed
3489
  [  --enable-asademux       asa subtitle demuxing (default disabled)])
Christophe Mutricy's avatar
Christophe Mutricy committed
3490
AS_IF( [test "${enable_asademux}" = "yes"], [
3491 3492 3493 3494 3495
  PKG_CHECK_MODULES(PCRE,
      libpcre >= 6.5,
      [
        VLC_ADD_LDFLAGS([asademux],[$PCRE_LIBS])
        VLC_ADD_CFLAGS([asademux],[$PCRE_CFLAGS])
3496 3497
        if test "${SYS}" = "mingw32"; then
            VLC_ADD_CPPFLAGS([asademux],[-DPCRE_STATIC])
3498
        fi
3499
        VLC_ADD_PLUGIN([asademux])
3500 3501 3502 3503 3504
      ],[
        AC_MSG_WARN([PCRE library not found (required for asademux)])
      ])
  ])

3505 3506 3507 3508 3509 3510 3511
dnl
dnl  CMML plugin
dnl
AC_ARG_ENABLE(cmml,
  [  --enable-cmml           CMML support (default enabled)])
if test "${enable_cmml}" != "no"
then
3512
  VLC_ADD_PLUGIN([cmml])
3513 3514
fi

3515 3516 3517 3518 3519
dnl
dnl  kate decoder plugin
dnl
AC_ARG_ENABLE(kate,
[  --enable-kate           kate codec (default enabled)])
3520
AS_IF([test "${enable_kate}" != "no"], [
3521
  PKG_CHECK_MODULES(KATE,[kate >= 0.1.5], [
3522
      VLC_ADD_PLUGIN([kate])
3523 3524 3525 3526
      VLC_ADD_CFLAGS([kate],[$KATE_CFLAGS])
      VLC_ADD_LIBS([kate],[$KATE_LIBS]) ],[
        AC_CHECK_HEADERS(kate/kate.h, [
          AC_CHECK_LIB(kate, kate_decode_init, [
3527
            VLC_ADD_PLUGIN([kate])
3528 3529
            kate_libs="-lkate -logg"
            VLC_ADD_LDFLAGS([kate],[${kate_libs}]) ],[
3530
            AS_IF([test "x${enable_kate}" != "x"], [
3531 3532
              AC_MSG_ERROR([libkate doesn't appear to be installed on your system.
              You also need to check that you have a libogg posterior to the 1.0 release.])
3533 3534
            ])
	  ], [-lkate -logg])
3535
        ],[
3536
          AS_IF([test "x${enable_kate}" != "x"], [
3537 3538
            AC_MSG_ERROR([libkate headers do not appear to be installed on your system.
            You also need to check that you have a libogg posterior to the 1.0 release.])
3539
          ])
3540 3541
        ])
  ])
3542
])
3543

3544

3545 3546 3547
dnl
dnl  tiger decoder plugin
dnl
3548
PKG_ENABLE_MODULES_VLC([TIGER], [], [tiger >= 0.3.1], [Tiger rendering library for Kate streams],[auto])
3549 3550


Sam Hocevar's avatar
 
Sam Hocevar committed
3551
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
3552
dnl  Video plugins
Sam Hocevar's avatar
 
Sam Hocevar committed
3553 3554
dnl

Sam Hocevar's avatar
 
Sam Hocevar committed
3555
AC_ARG_WITH(,[Video plugins:])
Sam Hocevar's avatar
 
Sam Hocevar committed
3556

3557 3558 3559 3560 3561 3562
dnl
dnl  Xlib
dnl

AC_PATH_XTRA()
AC_ARG_ENABLE(x11,
3563
  [  --enable-x11            X11 support with Xlib (default enabled)],, [
3564 3565 3566 3567 3568 3569 3570 3571 3572
  AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"], [
    enable_x11="yes"
  ], [
    enable_x11="no"
  ])
])

CPPFLAGS="${CPPFLAGS_save} ${X_CFLAGS}"

3573
AS_IF([test "${enable_x11}" != "no"], [
3574
  AC_CHECK_HEADERS(X11/Xlib.h)
3575

Gildas Bazin's avatar
 
Gildas Bazin committed
3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588
dnl Check for DPMS
  AC_CHECK_HEADERS(X11/extensions/dpms.h, [
    AC_MSG_CHECKING(for DPMSInfo in X11/extensions/dpms.h)
    AC_EGREP_HEADER(DPMSInfo,X11/extensions/dpms.h,[
      AC_MSG_RESULT(yes)
      AC_DEFINE(DPMSINFO_IN_DPMS_H, 1,
                Define if <X11/extensions/dpms.h> defines DPMSInfo.)
    ],[
      AC_MSG_RESULT(no)
    ])
  ],,[
    #include <X11/Xlib.h>
  ])
3589
])
Sam Hocevar's avatar
 
Sam Hocevar committed
3590

3591 3592 3593 3594 3595
dnl
dnl  GLX module
dnl  (enabled by default except on win32)
dnl
AC_ARG_ENABLE(glx,
3596 3597 3598 3599
  [  --enable-glx            X11 OpenGL (GLX) support (default enabled)],, [
  enable_glx="$enable_x11"
])
AS_IF([test "${enable_glx}" != "no"], [
Rafaël Carré's avatar
Rafaël Carré committed
3600 3601 3602 3603 3604 3605
  AC_CHECK_HEADERS(X11/Xlib.h GL/glu.h GL/glx.h)
  AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
    [[#if !defined(HAVE_X11_XLIB_H) || !defined(HAVE_GL_GLU_H) || !defined(HAVE_GL_GLX_H)
    choke me
    #endif]]),
    [
3606
      VLC_ADD_PLUGIN([glx])
3607
      VLC_ADD_LIBS([glx],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext -lGL -lGLU])
3608
      VLC_ADD_CPPFLAGS([glx],[${X_CFLAGS}])
Rafaël Carré's avatar
Rafaël Carré committed
3609
    ],[AC_MSG_ERROR([Please install GL development package. Alternatively you can also configure with --disable-glx.])])
3610
])
3611

Jean-Paul Saman's avatar
Jean-Paul Saman committed
3612 3613
dnl
dnl  XVMC module
3614
dnl  (disabled by default except on win32)
Jean-Paul Saman's avatar
Jean-Paul Saman committed
3615 3616
dnl
AC_ARG_ENABLE(xvmc,
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
3617
  [  --enable-xvmc           XvMC support (default disabled)],, [
3618 3619 3620
  enable_xvmc="no"
])
AS_IF([test "${enable_xvmc}" != "no"], [
Jean-Paul Saman's avatar
Jean-Paul Saman committed
3621
  AC_CHECK_HEADERS(X11/extensions/vldXvMC.h, [
3622 3623 3624 3625 3626 3627 3628
    AS_IF([test "${enable_libmpeg2}" = "yes"], [
      VLC_ADD_PLUGIN([xvmc])
      VLC_ADD_LIBS([xvmc],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext -lXvMCW -lXv ${LIBMPEG2_LIBS}])
      VLC_ADD_CPPFLAGS([xvmc],[${X_CFLAGS} ${LIBMPEG2_CFLAGS}])
    ], [
      AC_MSG_ERROR([XVideo-MotionCompensation needs libmpeg2 which isn't available])
    ])
3629 3630
  ], [
    AC_MSG_ERROR([XVideo-MotionCompensation extension not found!])
Jean-Paul Saman's avatar
Jean-Paul Saman committed
3631
  ])
3632
])
Jean-Paul Saman's avatar
Jean-Paul Saman committed
3633

3634 3635
dnl End of Xlib tests
CPPFLAGS="${CPPFLAGS_save}"
3636

Sam Hocevar's avatar
Sam Hocevar committed
3637

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
3638 3639 3640 3641
dnl
dnl  X C Bindings modules
dnl
AC_ARG_ENABLE(xcb,
3642 3643 3644 3645 3646 3647 3648
  [  --enable-xcb            X11 support with XCB (default enabled)],, [
  AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"], [
    enable_xcb="yes"
  ], [
    enable_xcb="no"
  ])
])
3649 3650 3651 3652
AC_ARG_ENABLE(xvideo,
  [  --enable-xvideo         XVideo support (default enabled)],, [
    enable_xvideo="$enable_xcb"
])
3653

3654
need_xid_provider="no"
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
3655 3656
AS_IF([test "${enable_xcb}" != "no"], [
  dnl libxcb
3657
  PKG_CHECK_MODULES(XCB, [xcb])
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
3658
  PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
3659
  VLC_ADD_PLUGIN([xcb_x11])
3660
  VLC_ADD_PLUGIN([xcb_screen])
3661
  VLC_ADD_PLUGIN([xcb_apps])
3662
  VLC_SET_CFLAGS_WERROR([xcb_screen], [-Wno-error=uninitialized]) # some gcc report a warning which doesn't reveal an error
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
3663

3664
  AS_IF([test "${enable_xvideo}" != "no"], [
3665
    PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [
3666
      VLC_ADD_PLUGIN([xcb_xv])
3667 3668 3669 3670 3671
    ], [
      PKG_CHECK_MODULES(XCB_XV, [xcb-xv], [
        VLC_ADD_PLUGIN([xcb_xv])
        VLC_ADD_CFLAGS([xcb_xv], [-DXCB_XV_OLD])
      ])
3672 3673 3674
    ])
  ])

3675
  PKG_CHECK_MODULES(XCB_RANDR, [xcb-randr >= 1.3], [
3676 3677 3678 3679 3680
    VLC_ADD_PLUGIN([panoramix])
    VLC_ADD_LIBS([panoramix],[${XCB_RANDR_LIBS} ${XCB_LIBS}])
    VLC_ADD_CFLAGS([panoramix],[${XCB_RANDR_CFLAGS} ${XCB_CFLAGS}])
  ], [true])

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
3681
  dnl xcb-utils
3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692
  PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [
    have_xcb_keysyms="yes"
  ], [
    PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms], [
      have_xcb_keysyms="yes"
      VLC_ADD_CFLAGS([globalhotkeys], [-DXCB_KEYSYM_OLD_API])
    ], [
      have_xcb_keysyms="no"
      need_xid_provider="yes"
    ])
  ])
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
3693

3694
  AS_IF([test "${have_xcb_keysyms}" = "yes"], [
3695
    PKG_CHECK_MODULES(XPROTO, [xproto])
3696 3697 3698 3699 3700
    VLC_ADD_PLUGIN([xcb_window])
    VLC_ADD_PLUGIN([globalhotkeys])
    VLC_ADD_CFLAGS([globalhotkeys], [${XCB_KEYSYMS_CFLAGS} ${XCB_CFLAGS}])
    VLC_ADD_LIBS([globalhotkeys], [${XCB_KEYSYMS_LIBS} ${XCB_LIBS}])
  ])
3701
  VLC_ADD_PLUGIN([xdg_screensaver])
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
3702 3703
])

3704

3705
dnl
3706 3707
dnl  OpenGL module
dnl  (enabled by default except on beos)
3708 3709
dnl
AC_ARG_ENABLE(opengl,
3710
  [  --enable-opengl         OpenGL support (default enabled)])
3711 3712
if test "${enable_opengl}" != "no" &&
   test "${SYS}" != "beos" -a "${SYS}" != "mingwce"; then
3713
  if test "${SYS}" != "darwin"; then
3714
    AC_CHECK_HEADERS(GL/gl.h GL/glu.h, [
3715
      VLC_ADD_PLUGIN([opengl])
3716
      if test "${SYS}" != "mingw32"; then
3717
        VLC_ADD_LIBS([opengl],[${X_LIBS} -lGL -lGLU])
3718
      else
3719
        VLC_ADD_LIBS([opengl],[-lopengl32 -lglu32])
3720 3721 3722 3723
      fi
    ])
  else
    dnl OS X special case (no GL/gl.h but OpenGL/gl.h)
3724
    VLC_ADD_PLUGIN([opengl])
3725
    VLC_ADD_LIBS([opengl],[-Wl,-framework,OpenGL])
3726
  fi
3727 3728
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
3729 3730 3731
dnl
dnl  SDL module
dnl
3732
AC_ARG_ENABLE(sdl,
Sam Hocevar's avatar
 
Sam Hocevar committed
3733
  [  --enable-sdl            SDL support (default enabled)])
3734
AC_ARG_ENABLE(sdl-image,
Rafaël Carré's avatar
Rafaël Carré committed
3735
  [  --enable-sdl-image      SDL image support (default enabled)])
Sam Hocevar's avatar
Sam Hocevar committed
3736
if test "${enable_sdl}" != "no"
3737
then
3738
  SDL_PATH="${PATH}"
3739
  AC_ARG_WITH(sdl-config-path,
Sam Hocevar's avatar
 
Sam Hocevar committed
3740
    [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
Sam Hocevar's avatar
Sam Hocevar committed
3741
    [ if test "${with_sdl_config_path}" != "no"
3742
      then
3743
        SDL_PATH="${with_sdl_config_path}:${PATH}"
3744
      fi ])
3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776
  AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
  SDL_HEADER="SDL/SDL.h"
  SDL_IMAGE="SDL/SDL_image.h"

  if test "${SDL_CONFIG}" != "no";  then
     PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [
        # SDL on Darwin is heavily patched and can only run SDL_image
        if test "${SYS}" != "darwin"; then
          VLC_ADD_PLUGIN([vout_sdl])
          VLC_ADD_PLUGIN([aout_sdl])
        fi
        VLC_ADD_CFLAGS([vout_sdl aout_sdl sdl_image],[`${SDL_CONFIG} --cflags | sed 's,SDL,,'`])
        VLC_ADD_LIBS([vout_sdl aout_sdl sdl_image],[`${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`])

        # SDL_image
        AS_IF([ test "${enable_sdl_image}" != "no"],[
          AC_CHECK_HEADERS("SDL/SDL_image.h", [
            VLC_ADD_PLUGIN([sdl_image])
            AC_CHECK_LIB(png, png_set_rows, [VLC_ADD_LIBS([sdl_image],[-lpng -lz])],[],[-lz])
            AC_CHECK_LIB(jpeg, jpeg_start_decompress, [VLC_ADD_LIBS([sdl_image],[-ljpeg])])
            AC_CHECK_LIB(tiff, TIFFClientOpen, [VLC_ADD_LIBS([sdl_image],[-ltiff])])
            VLC_ADD_LIBS([sdl_image], [-lSDL_image])],
            [ AC_MSG_WARN([The development package for SDL_image is not installed.
      You should install it alongside your SDL package.])
            ])
        ])
     ],[
       AC_MSG_ERROR([The development package for SDL is too old. You need 1.2.10.
                    Alternatively you can also configure with --disable-sdl.])
     ])
  else if test "${enable_sdl}" =  "yes"; then
    AC_MSG_ERROR([I could not find the SDL package. You can download libSDL
3777 3778
from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
    ])
3779
      fi
3780 3781
  fi
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
3782

3783 3784 3785 3786
dnl
dnl  freetype module
dnl
AC_ARG_ENABLE(freetype,
3787
  [  --enable-freetype       freetype support (default enabled)])
Gildas Bazin's avatar
 
Gildas Bazin committed
3788 3789
AC_ARG_ENABLE(fribidi,
  [  --enable-fribidi        fribidi support (default enabled)])
3790 3791
AC_ARG_ENABLE(fontconfig,
  [  --enable-fontconfig,    fontconfig support (default enabled)])
Sam Hocevar's avatar
Sam Hocevar committed
3792
if test "${enable_freetype}" != "no"
3793
then
3794
   PKG_CHECK_MODULES(FREETYPE, freetype2,[
3795
      VLC_ADD_PLUGIN([freetype])
3796
      have_freetype=yes
3797
      VLC_ADD_CPPFLAGS([freetype skins2],[${FREETYPE_CFLAGS}])
3798
      if test "${SYS}" = "mingw32"; then
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
3799
        VLC_ADD_LIBS([freetype],[-liconv -lz])
3800
      fi
3801
      VLC_ADD_LIBS([freetype skins2],[${FREETYPE_LIBS}])
3802 3803 3804 3805 3806 3807 3808 3809
      if test "${enable_fontconfig}" != "no"
      then
        AC_CHECK_HEADERS(fontconfig/fontconfig.h,
          [VLC_ADD_CPPFLAGS([freetype],[-DHAVE_FONTCONFIG])
           VLC_ADD_LIBS([freetype],[-lfontconfig])])
        AC_CHECK_HEADERS(Carbon/Carbon.h,
          [VLC_ADD_LDFLAGS([freetype],[-Wl,-framework,Carbon])])
      fi
3810 3811 3812 3813 3814 3815 3816 3817 3818 3819

     dnl fribidi support
      if test "${enable_fribidi}" != "no"
      then
        PKG_CHECK_MODULES(FRIBIDI, fribidi, [
          VLC_ADD_CPPFLAGS([freetype skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
          VLC_ADD_LIBS([freetype skins2], [${FRIBIDI_LIBS}])
        ])
      fi

3820 3821 3822
  ],[
  have_freetype=no
  AS_IF([ test "${enable_freetype}" =  "yes"],[
3823 3824
    AC_MSG_ERROR([I couldn't find the freetype package. You can download libfreetype2
from http://www.freetype.org/, or configure with --disable-freetype. Have a nice day.
3825
      ])
3826
    ])
3827
  ])
Gildas Bazin's avatar
 
Gildas Bazin committed
3828

3829 3830
fi

Gildas Bazin's avatar
Gildas Bazin committed
3831 3832 3833
dnl
dnl  libxml2 module
dnl
Christophe Mutricy's avatar
Christophe Mutricy committed
3834
PKG_ENABLE_MODULES_VLC([LIBXML2], [xml], [libxml-2.0 >= 2.5], [libxml2 support],[auto])
Gildas Bazin's avatar
Gildas Bazin committed
3835

3836 3837 3838
dnl
dnl  SVG module
dnl
3839
PKG_ENABLE_MODULES_VLC([SVG], [], [librsvg-2.0 >= 2.9.0], [SVG rendering library],[auto])
3840

3841 3842 3843 3844 3845
dnl
dnl Snapshot vout module (with cache)
dnl
AC_ARG_ENABLE(snapshot,
  [  --enable-snapshot       snapshot module (default disabled)])
3846
if test "${enable_snapshot}" = "yes"
3847
then
3848
  VLC_ADD_PLUGIN([snapshot])
3849 3850
fi

3851
dnl
3852
dnl  Qt Embedded module
3853 3854 3855 3856
dnl  (disabled by default)
dnl
AC_ARG_ENABLE(qte,
  [  --enable-qte            QT Embedded support (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
3857
if test "${enable_qte}" = "yes"
3858 3859
then
  AC_ARG_WITH(qte,
Jean-Paul Saman's avatar
Jean-Paul Saman committed
3860
  [    --with-qte=PATH       Qt Embedded headers and libraries])
Sam Hocevar's avatar
Sam Hocevar committed
3861
  if test "${with_qte}" != "no" -a -n "${with_qte}"
3862
  then
3863
    VLC_ADD_LIBS([qte],[-L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte])
Sam Hocevar's avatar
Sam Hocevar committed
3864
    VLC_ADD_CXXFLAGS([qte],[-I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti])
3865
  else
3866
    VLC_ADD_LIBS([qte],[-L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte])
Sam Hocevar's avatar
Sam Hocevar committed
3867
    VLC_ADD_CXXFLAGS([qte],[-I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti])
Jean-Paul Saman's avatar
Jean-Paul Saman committed
3868
  fi
3869
  VLC_ADD_PLUGIN([qte])
3870
  NEED_QTE_MAIN=yes
3871
  CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_qte}"
Jean-Paul Saman's avatar
Jean-Paul Saman committed
3872 3873 3874
  AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
    AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
  ] )
3875
  CPPFLAGS="${CPPFLAGS_save}"
3876 3877
fi

Jean-Paul Saman's avatar
Jean-Paul Saman committed
3878 3879 3880 3881
dnl
dnl Roku HD1000 Video output module
dnl
AC_ARG_ENABLE(hd1000v,
3882
  [  --enable-hd1000v        HD1000 Video Output module (default enabled on HD1000)])
3883
if test "${enable_hd1000v}" != "no" -a "${CXX}" != "" &&
3884 3885
  (test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ||
   test "${enable_hd1000v}" = "yes"); then
Jean-Paul Saman's avatar
Jean-Paul Saman committed
3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896
  AC_LANG_PUSH([C++])
  AC_CHECK_HEADERS([cascade/graphics/CascadeScreen.h cascade/graphics/CascadeBitmap.h],
  [
    can_build_roku="yes"
  ],
  [
    can_build_roku="no"
    AC_MSG_WARN([Not building Roku HD1000 compatible video output])
  ])
  if test "$can_build_roku" = "yes"
  then
3897
    VLC_ADD_PLUGIN([hd1000v])
3898
    VLC_ADD_LIBS([hd1000v],[-lCascade -ldvbpsi -lmad])
Jean-Paul Saman's avatar
Jean-Paul Saman committed
3899 3900 3901 3902
  fi
  AC_LANG_POP([C++])
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
3903 3904 3905
dnl
dnl  Windows DirectX module
dnl
3906

3907
if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"
3908
then
3909
  VLC_ADD_PLUGIN([panoramix])
3910 3911
fi

3912
AC_ARG_ENABLE(directx,
Sam Hocevar's avatar
 
Sam Hocevar committed
3913
  [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
Sam Hocevar's avatar
Sam Hocevar committed
3914
if test "${enable_directx}" != "no"
3915
then
3916
  if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"
3917
  then
Gildas Bazin's avatar
 
Gildas Bazin committed
3918
      AC_CHECK_HEADERS(ddraw.h,
3919
      [ VLC_ADD_PLUGIN([directx])
3920
        VLC_ADD_PLUGIN([aout_directx])
3921
        VLC_ADD_LIBS([directx],[-lgdi32])
3922 3923
      ],[AC_MSG_ERROR([Cannot find DirectX headers!])]
      )
3924
      AC_CHECK_HEADERS(GL/gl.h,
3925
      [ VLC_ADD_PLUGIN([glwin32])
3926
        VLC_ADD_LIBS([glwin32],[-lopengl32 -lgdi32])
3927 3928
      ])
      AC_CHECK_HEADERS(d3d9.h,
3929
      [ VLC_ADD_PLUGIN([direct3d])
3930
        VLC_ADD_LIBS([direct3d],[-lgdi32])
3931
      ])
3932
      VLC_ADD_LIBS([direct3d directx glwin32],[-lole32])
3933 3934
  fi
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
3935

3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954
dnl
dnl  win32 GDI plugin
dnl
AC_ARG_ENABLE(wingdi,
  [  --enable-wingdi         Win32 GDI module (default enabled on Win32)])
if test "${enable_wingdi}" != "no"; then
  if test "${SYS}" = "mingw32"; then
    VLC_ADD_PLUGIN([wingdi])
    VLC_ADD_LIBS([wingdi],[-lgdi32 -lole32])
  fi
  if test "${SYS}" = "mingwce"; then
    VLC_ADD_PLUGIN([wingdi])
    VLC_ADD_PLUGIN([wingapi])
    VLC_ADD_LIBS([wingdi],[-laygshell])
    VLC_ADD_LIBS([wingapi],[-laygshell])
  fi
fi


Gildas Bazin's avatar
 
Gildas Bazin committed
3955
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
3956
dnl  Linux framebuffer module
Gildas Bazin's avatar
 
Gildas Bazin committed
3957
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
3958 3959
AC_ARG_ENABLE(fb,
  [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
Sam Hocevar's avatar
Sam Hocevar committed
3960
    if test "${enable_fb}" != "no"
Sam Hocevar's avatar
 
Sam Hocevar committed
3961 3962
    then
      AC_CHECK_HEADERS(linux/fb.h, [
3963
        VLC_ADD_PLUGIN([fb])
Sam Hocevar's avatar
 
Sam Hocevar committed
3964 3965
      ])
    fi
Gildas Bazin's avatar
 
Gildas Bazin committed
3966

Sam Hocevar's avatar
 
Sam Hocevar committed
3967
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
3968
dnl  Linux MGA module
Sam Hocevar's avatar
 
Sam Hocevar committed
3969
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
3970 3971
AC_ARG_ENABLE(mga,
  [  --enable-mga            Linux kernel Matrox support (default disabled)],
Sam Hocevar's avatar
Sam Hocevar committed
3972
  [ if test "${enable_mga}" = "yes"
Sam Hocevar's avatar
 
Sam Hocevar committed
3973
    then
3974
      VLC_ADD_PLUGIN([mga])
Sam Hocevar's avatar
 
Sam Hocevar committed
3975
    fi ])
Sam Hocevar's avatar
 
Sam Hocevar committed
3976

3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988
dnl
dnl  OMAP Framebuffer module
dnl
AC_ARG_ENABLE(omapfb,
  [  --enable-omapfb         OMAP framebuffer support (default disabled)])
    if test "${enable_omapfb}" = "yes"
    then
      AC_CHECK_HEADERS(asm/arch-omap/omapfb.h, [
        VLC_ADD_PLUGIN([omapfb])
        AC_CHECK_HEADERS(X11/Xlib.h, [
          VLC_ADD_LIBS([omapfb],[${X_LIBS} ${X_PRE_LIBS} -lX11]) ])
      ])
3989
      VLC_ADD_PLUGIN([swscale_omap])
3990 3991
    fi

3992 3993 3994 3995 3996
dnl
dnl  SVGAlib module
dnl
AC_ARG_ENABLE(svgalib,
  [  --enable-svgalib        SVGAlib support (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
3997
if test "${enable_svgalib}" = "yes"
3998
then
3999
  VLC_ADD_PLUGIN([svgalib])
4000
  VLC_ADD_LIBS([svgalib],[-lvgagl -lvga])
4001 4002
fi

4003 4004
dnl
dnl  DirectFB module
4005 4006
dnl  try to find using: 1 - given location; 2 - directfb-config; 3 - pkg-config
dnl  TODO: support for static linking
4007 4008
dnl
AC_ARG_ENABLE(directfb,
4009
  [  --enable-directfb       DirectFB support (default disabled)])
4010
AC_ARG_WITH(directfb,
4011 4012 4013 4014 4015
  [    --with-directfb=PATH  path to DirectFB headers and libraries])

if test "${enable_directfb}" = "yes"; then
    have_directfb="false"
    CPPFLAGS_mydirectfb=
4016
    LIBS_mydirectfb=
4017 4018
    if test "${with_directfb}" != "no" -a -n "${with_directfb}"; then
        dnl Trying the given location
4019 4020
        CPPFLAGS_save="${CPPFLAGS}"
        LIBS_save="${LIBS}"
4021 4022

        CPPFLAGS_new="-I${with_directfb}/include -D_REENTRANT -D_GNU_SOURCE"
4023 4024
        LIBS_new="-L${with_directfb}/lib/fusion/.libs/ -L${with_directfb}/lib/direct/.libs/"
        LIBS_new="${LIBS_new} -L${with_directfb}/src/.libs/"
4025 4026

        CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_new}"
4027
        LIBS="${LIBS} ${LIBS_new}"
4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039

        dnl FIXME: too obscure
        AC_CHECK_HEADER([directfb.h], [
            AC_CHECK_LIB([direct],[direct_initialize], [
                AC_CHECK_LIB([fusion], [fusion_enter], [
                    AC_CHECK_LIB([directfb], [DirectFBInit], have_directfb="true", have_directfb="false")
                ], have_directfb="false")
            ], have_directfb="false")
        ], have_directfb="false")

        dnl Restore flags
        CPPFLAGS="${CPPFLAGS_save}"
4040
        LIBS="${LIBS_save}"
4041 4042

        if test "${have_directfb}" = "true"; then
4043
            LIBS_mydirectfb="${LIBS_new} -lz -ldl -ldirectfb -lfusion -ldirect -lpthread"
4044 4045
            CPPFLAGS_mydirectfb="${CPPFLAGS_new}"
        fi
4046
    else
4047 4048 4049 4050
        dnl Look for directfb-config
        AC_PATH_PROG(DIRECTFB_CONFIG, directfb-config, no, ${PATH})
        if test "${DIRECTFB_CONFIG}" != "no"; then
            CPPFLAGS_mydirectfb="`${DIRECTFB_CONFIG} --cflags`"
4051
            LIBS_mydirectfb="`${DIRECTFB_CONFIG} --libs`"
4052
            have_directfb="true"
4053
        else
4054 4055 4056
            dnl Trying with pkg-config
            PKG_CHECK_MODULES(DIRECTFB, directfb, [
                CPPFLAGS_mydirectfb="${DIRECTFB_CFLAGS}"
4057
                LIBS_mydirectfb="${DIRECTFB_LIBS}"
4058 4059 4060 4061 4062
                have_directfb="true"
                ], [have_directfb="false"])
        fi
    fi
    if test "${have_directfb}" = "true"; then
4063
        VLC_ADD_PLUGIN([directfb])
4064
        VLC_ADD_CPPFLAGS([directfb],[${CPPFLAGS_mydirectfb}])
4065
        VLC_ADD_LIBS([directfb],[${LIBS_mydirectfb}])
4066
    else
4067
        AC_MSG_ERROR([cannot find directfb headers and/or libraries ])
4068
    fi
4069
fi
4070

4071

4072

Sam Hocevar's avatar
 
Sam Hocevar committed
4073 4074 4075 4076 4077
dnl
dnl  GGI module
dnl
AC_ARG_ENABLE(ggi,
  [  --enable-ggi            GGI support (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
4078
if test "${enable_ggi}" = "yes"
Sam Hocevar's avatar
 
Sam Hocevar committed
4079
then
Christophe Mutricy's avatar
Christophe Mutricy committed
4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092
  AC_CHECK_HEADER([ggi/ggi.h],[
    VLC_ADD_PLUGIN([ggi])
    VLC_ADD_LIBS([ggi],[-lggi])
    AC_ARG_WITH(ggi,
      [    --with-ggi=PATH       path to libggi],
      [ if test "${with_ggi}" != "no" -a -n "${with_ggi}"
        then
          VLC_ADD_CPPFLAGS([ggi],[-I${with_ggi}/include])
          VLC_ADD_LIBS([ggi],[-L${with_ggi}/lib])
        fi ])
    ],[
       AC_MSG_ERROR([LibGGI development files can't be found])
    ])
Sam Hocevar's avatar
 
Sam Hocevar committed
4093 4094
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
4095 4096 4097 4098 4099
dnl
dnl  AA plugin
dnl
AC_ARG_ENABLE(aa,
  [  --enable-aa             aalib output (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
4100
if test "${enable_aa}" = "yes"
Sam Hocevar's avatar
 
Sam Hocevar committed
4101 4102
then
  AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
Sam Hocevar's avatar
Sam Hocevar committed
4103
  if test "${have_aa}" = "true"
Sam Hocevar's avatar
 
Sam Hocevar committed
4104
  then
4105
    VLC_ADD_PLUGIN([aa])
4106
    VLC_ADD_LIBS([aa],[-laa])
Sam Hocevar's avatar
 
Sam Hocevar committed
4107 4108 4109
  fi
fi

Sam Hocevar's avatar
Sam Hocevar committed
4110 4111 4112
dnl
dnl  libcaca plugin
dnl
Christophe Mutricy's avatar
Christophe Mutricy committed
4113
PKG_ENABLE_MODULES_VLC([CACA], [], [caca >= 0.99.beta1], [libcaca output],[auto])
Sam Hocevar's avatar
Sam Hocevar committed
4114

Sam Hocevar's avatar
 
Sam Hocevar committed
4115
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
4116
dnl  Audio plugins
Sam Hocevar's avatar
 
Sam Hocevar committed
4117
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
4118 4119 4120 4121 4122 4123

AC_ARG_WITH(,[Audio plugins:])

dnl
dnl  OSS /dev/dsp module (enabled by default except on win32)
dnl
4124 4125
AC_ARG_ENABLE(oss,
  [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
Sam Hocevar's avatar
 
Sam Hocevar committed
4126

Sam Hocevar's avatar
Sam Hocevar committed
4127
if test "${enable_oss}" != "no" &&
4128 4129
  (test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ||
   test "${enable_oss}" = "yes")
Sam Hocevar's avatar
 
Sam Hocevar committed
4130
then
4131
  AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
4132
    VLC_ADD_PLUGIN([oss])
4133
    VLC_ADD_PLUGIN([access_oss])
4134
    AC_CHECK_LIB(ossaudio,main,[VLC_ADD_LIBS([oss],[-lossaudio])])
Sam Hocevar's avatar
 
Sam Hocevar committed
4135 4136 4137
  ])
fi

4138 4139 4140
dnl
dnl  Pulseaudio module
dnl
4141
PKG_ENABLE_MODULES_VLC([PULSE], [], [libpulse >= 0.9.11], [Pulseaudio support], [auto])
4142

4143 4144 4145
dnl
dnl  Portaudio module
dnl
4146
PKG_ENABLE_MODULES_VLC([PORTAUDIO], [], [portaudio-2.0], [Portaudio library support], [auto])
4147

Sam Hocevar's avatar
 
Sam Hocevar committed
4148
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
4149 4150
dnl  ALSA module
dnl
4151
PKG_ENABLE_MODULES_VLC([ALSA], [], [alsa >= 1.0.0], [Alsa sound support for linux], [auto])
4152
PKG_ENABLE_MODULES_VLC([ACCESS_ALSA], [access_alsa], [alsa >= 1.0.0], [Alsa access for linux], [auto])
Sam Hocevar's avatar
 
Sam Hocevar committed
4153 4154

dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
4155
dnl  win32 waveOut plugin
Sam Hocevar's avatar
 
Sam Hocevar committed
4156
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
4157 4158
AC_ARG_ENABLE(waveout,
  [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
Sam Hocevar's avatar
Sam Hocevar committed
4159
if test "${enable_waveout}" != "no"; then
4160
  if test "${SYS}" = "mingw32"; then
4161
    VLC_ADD_PLUGIN([waveout])
4162
    VLC_ADD_LIBS([waveout],[-lwinmm])
Gildas Bazin's avatar
 
Gildas Bazin committed
4163
  fi
Gildas Bazin's avatar
Gildas Bazin committed
4164
  if test "${SYS}" = "mingwce"; then
4165
    VLC_ADD_PLUGIN([waveout])
4166
  fi
Sam Hocevar's avatar
 
Sam Hocevar committed
4167 4168
fi

4169 4170 4171
dnl
dnl  CoreAudio plugin
dnl
Derk-Jan Hartman's avatar
Derk-Jan Hartman committed
4172 4173 4174 4175
AC_ARG_ENABLE(macosx-audio,
  [  --enable-macosx-audio   Mac OS X audio module (default enabled on MacOS X)])
if test "${enable_macosx-audio}" != "no" &&
  (test "${SYS}" = "darwin" || test "${enable_macosx-audio}" = "yes")
4176
then
4177
  AC_CHECK_HEADERS(CoreAudio/CoreAudio.h,
4178
    [ VLC_ADD_PLUGIN([auhal])
4179
      VLC_ADD_LDFLAGS([auhal],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,Carbon])
4180
    ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
4181 4182
fi

4183 4184 4185 4186 4187
dnl
dnl  Roku HD1000 audio
dnl
AC_ARG_ENABLE(hd1000a,
  [  --enable-hd1000a        HD1000 audio module (default enabled on HD1000)])
4188
if test "${enable_hd1000a}" != "no" -a "${CXX}" != "" &&
4189 4190
  (test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ||
   test "${enable_hd1000a}" = "yes")
4191 4192 4193
then
  AC_LANG_PUSH([C++])
  AC_CHECK_HEADERS(deschutes/libraries/hdmachinex225/PCMAudioPlayer.h, [
4194
    VLC_ADD_PLUGIN([hd1000a])
4195
    AC_CHECK_LIB(HDMachineX225,main,VLC_ADD_LIBS([hd1000a],[-lHDMachineX225]))  ])
4196 4197 4198
  AC_LANG_POP([C++])
fi

4199
dnl
4200
dnl  JACK modules
4201
dnl
4202 4203
PKG_ENABLE_MODULES_VLC([JACK], [jack], [jack], [JACK audio I/O modules],[auto])
PKG_ENABLE_MODULES_VLC([JACK], [access_jack], [jack], [JACK audio I/O modules],[auto])
4204

4205

4206 4207 4208 4209 4210
dnl
dnl  CyberLink for C++ UPnP stack
dnl
AC_ARG_ENABLE(cyberlink,
  [  --enable-cyberlink      CyberLink for C++ UPnP stack (default disabled)])
4211
  AS_IF([test "${enable_cyberlink}" = "yes" ], [
4212 4213 4214 4215 4216 4217
  AC_ARG_WITH(cyberlink-tree,
    [    --with-cyberlink-tree=PATH CyberLink for C++ tree for static linking])

  dnl
  dnl test for --with-cyberlink-tree
  dnl
4218
  AS_IF([test ! -z "${with_cyberlink_tree}" -a "${CXX}" != ""], [
4219 4220
    AC_LANG_PUSH(C++)
    real_cyberlink_tree="`cd ${with_cyberlink_tree} 2>/dev/null && pwd`"
4221
    AS_IF([test -z "${real_cyberlink_tree}"], [
4222 4223 4224
      dnl  The given directory can't be found
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([cannot cd to ${with_cyberlink_tree}])
4225 4226 4227 4228
    ])
    CPPFLAGS_save="${CPPFLAGS}"
    CPPFLAGS_cyberlink="-I${real_cyberlink_tree}/include"
    CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_cyberlink}"
4229
    AC_CHECK_HEADERS([cybergarage/upnp/MediaServer.h],
4230
      [ VLC_ADD_CXXFLAGS([upnp_cc], [${CPPFLAGS_cyberlink}])
4231
        VLC_ADD_PLUGIN([upnp_cc])
4232 4233 4234 4235
      ],[
        AC_MSG_ERROR([cannot find CyberLink for C++ headers])
      ])
    AC_MSG_CHECKING(for libclink.a in ${with_cyberlink_tree})
4236
    AS_IF([test -f "${real_cyberlink_tree}/lib/unix/libclink.a"], [
4237
      AC_MSG_RESULT(${real_cyberlink_tree}/lib/unix/libclink.a)
4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264
      dnl The mere fact that we have to make such an ugly check sucks
      AC_MSG_CHECKING(for XML parser to link CyberLink with)
      LIBS_save="$LIBS"
      LIBS_cclink="no"
      for l in "`xml2-config --libs`" -lexpat -lxerces-c; do
        LIBS="$LIBS_save ${real_cyberlink_tree}/lib/unix/libclink.a -lpthread $l"
        AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <cybergarage/upnp/media/player/MediaPlayer.h>
using namespace CyberLink;

class testclass : public SearchResponseListener, public MediaPlayer
{
    virtual void deviceSearchResponseReceived( SSDPPacket *)
    {
    }

    public:
      testclass (void)
      {
        addSearchResponseListener (this);
	start ();
      }
};
],[testclass l;])],[LIBS_cclink="$l"])
      done
      LIBS="${LIBS_save}"
      dnl should not happen - otherwise this needs fixing - hence FAILURE
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
4265
      AS_IF([test "${LIBS_cclink}" = "no"],
4266 4267
        [AC_MSG_FAILURE([cannot find XML parser for CyberLink])])
      AC_MSG_RESULT([${LIBS_cclink}])
4268
      VLC_ADD_LIBS([upnp_cc], [${real_cyberlink_tree}/lib/unix/libclink.a -lpthread ${LIBS_cclink}])
4269
    ], [
4270
      AC_MSG_RESULT(no)
4271 4272 4273
      AC_MSG_ERROR([cannot find ${real_cyberlink_tree}/lib/unix/libclink.a, make sure you compiled CyberLink for C++ in ${with_cyberlink_tree}])
    ])
    CPPFLAGS="${CPPFLAGS_save}"
4274
    AC_LANG_POP([C++])
4275 4276
  ])
])
4277

4278 4279 4280
dnl
dnl UPnP Plugin (Intel SDK)
dnl
4281
PKG_ENABLE_MODULES_VLC([UPNP], [upnp_intel], [libupnp], [Intel UPnp SDK],[auto])
4282 4283


Sam Hocevar's avatar
 
Sam Hocevar committed
4284 4285 4286 4287 4288
dnl
dnl  Interface plugins
dnl

AC_ARG_WITH(,[Interface plugins:])
Sam Hocevar's avatar
 
Sam Hocevar committed
4289

4290
dnl special case for BeOS
Sam Hocevar's avatar
Sam Hocevar committed
4291
if test "${SYS}" = "beos"
4292
then
4293
    VLC_ADD_PLUGIN([beos])
4294 4295
fi

4296 4297 4298 4299
dnl
dnl Skins2 module
dnl
AC_ARG_ENABLE(skins2,
Christophe Mutricy's avatar
Christophe Mutricy committed
4300 4301
  [AS_HELP_STRING([--enable-skins2],[Skins2 interface module (default
   enabled except on MacOSX, BeOS and WinCE)])])
4302 4303 4304
if test "${enable_skins2}" = "yes" ||
  (test "${SYS}" != "darwin" && test "${SYS}" != "beos" &&
   test "${SYS}" != "mingwce" && test "${enable_skins2}" != "no"); then
4305

Gildas Bazin's avatar
 
Gildas Bazin committed
4306 4307
  dnl test for the required libraries
  skins2_missing_lib="no"
4308

Gildas Bazin's avatar
 
Gildas Bazin committed
4309
  dnl freetype
4310
  if test "${have_freetype}" != "yes"; then
Gildas Bazin's avatar
 
Gildas Bazin committed
4311 4312 4313 4314 4315 4316
    skins2_missing_lib="yes"
    if test "${enable_skins2}" = "yes"; then
      AC_MSG_ERROR([Could not find freetype (required for skins2)])
    fi
  fi

4317
  if test "${skins2_missing_lib}" = "no" && (test "${SYS}" = "mingw32"); then
4318
    VLC_ADD_PLUGIN([skins2])
Gildas Bazin's avatar
 
Gildas Bazin committed
4319
    ALIASES="${ALIASES} svlc"
Sam Hocevar's avatar
Sam Hocevar committed
4320 4321
    VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -Imodules/gui/skins2 -DWIN32_SKINS])
    VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
4322
    VLC_ADD_LIBS([skins2],[-loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32])
Gildas Bazin's avatar
 
Gildas Bazin committed
4323

4324
  else if test "${skins2_missing_lib}" = "no" && (test "${SYS}" = "darwin"); then
4325
    VLC_ADD_PLUGIN([skins2])
4326 4327 4328
    ALIASES="${ALIASES} svlc"
    VLC_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 -DMACOSX_SKINS])
    VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
4329
    VLC_ADD_LDFLAGS([skins2],[-Wl,-framework,Carbon])
4330

Gildas Bazin's avatar
 
Gildas Bazin committed
4331
  else if test "${skins2_missing_lib}" = "no"; then
4332
    VLC_ADD_PLUGIN([skins2])
Gildas Bazin's avatar
 
Gildas Bazin committed
4333
    ALIASES="${ALIASES} svlc"
4334
    VLC_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 ${X_CFLAGS} -DX11_SKINS])
Sam Hocevar's avatar
Sam Hocevar committed
4335
    VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
4336
    VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} -lXext -lX11])
4337
    need_xid_provider="no"
4338
  fi fi fi
4339
fi
Christophe Mutricy's avatar
Christophe Mutricy committed
4340 4341 4342
AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes" ||
	 (test "${SYS}" != "darwin" && test "${SYS}" != "beos" &&
	  test "${SYS}" != "mingwce" && test "${enable_skins2}" != "no")])
4343

4344
dnl
4345
dnl Hildon UI
4346
dnl
4347 4348 4349
AC_ARG_ENABLE(hildon,
  [  --enable-hildon         Hildon touchscreen UI (default disabled)])
AS_IF([test "${enable_hildon}" = "yes"], [
4350
  PKG_CHECK_MODULES(HILDON, [hildon-1 hildon-fm-2], [
4351 4352 4353
    VLC_ADD_CFLAGS([hildon],[${HILDON_CFLAGS}])
    VLC_ADD_LIBS([hildon],[${HILDON_LIBS}])
    VLC_ADD_PLUGIN([hildon])
4354
    ALIASES="${ALIASES} mvlc"
4355
    need_xid_provider="no"
4356
  ], [
4357
    AS_IF([test "${enable_hildon}" = "yes"],[
4358 4359
      AC_MSG_ERROR([Hildon libraries not found])
    ])
4360
    enable_hildon="no"
4361
  ])
4362 4363
])
AM_CONDITIONAL(BUILD_HILDON, [test "${enable_hildon}" = "yes"])
4364

Clément Stenac's avatar
Clément Stenac committed
4365 4366 4367 4368
dnl
dnl QT 4
dnl
AC_ARG_ENABLE(qt4,
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
4369 4370 4371 4372
  [  --enable-qt4            QT 4 support (default enabled) ],, [
  AS_IF([test "${SYS}" = "darwin"], [enable_qt4=no])
])
AS_IF([test "${enable_qt4}" != "no"], [
4373
  PKG_CHECK_MODULES(QT4, [QtCore QtGui >= 4.4.0], [
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
4374 4375
    VLC_ADD_PLUGIN([qt4])
    ALIASES="${ALIASES} qvlc"
4376
    AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" -a "${SYS}" != "darwin"], [
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
4377
        VLC_ADD_LIBS([qt4],[$QT4_LIBS -lX11])
4378
        need_xid_provider="no"
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
4379
    ], [
4380
        VLC_ADD_LIBS([qt4],[$QT4_LIBS -lole32])
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
4381
    ])
4382
    QT4LOCALEDIR="$(eval $PKG_CONFIG --variable=prefix QtCore)/share/qt4/translations/"
4383
    AC_SUBST(QT4LOCALEDIR)
Christophe Mutricy's avatar
Christophe Mutricy committed
4384
    VLC_ADD_CXXFLAGS([qt4],[$QT4_CFLAGS -DQT4LOCALEDIR=\\\\\\\"${QT4LOCALEDIR}\\\\\\\"])
4385 4386 4387
    AC_PATH_PROGS(MOC, [moc-qt4 moc], moc,`eval $PKG_CONFIG --variable=exec_prefix QtCore`/bin)
    AC_PATH_PROG(RCC, rcc, rcc,`eval $PKG_CONFIG --variable=exec_prefix QtCore`/bin)
    AC_PATH_PROGS(UIC, [uic-qt4 uic], uic,`eval $PKG_CONFIG --variable=exec_prefix QtCore`/bin)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
4388 4389 4390 4391 4392 4393 4394 4395
  ], [
    AS_IF([test "${enable_qt4}" = "yes"],[
      AC_MSG_ERROR([Qt 4 library not found])
    ],[
      AC_MSG_WARN([Qt 4 library not found])
    ])
    enable_qt4="no"
  ])
4396
])
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
4397
AM_CONDITIONAL(ENABLE_QT4, [test "x$enable_qt4" != "xno"])
Clément Stenac's avatar
Clément Stenac committed
4398

4399 4400 4401
dnl
dnl  WinCE GUI module
dnl
Sam Hocevar's avatar
Sam Hocevar committed
4402 4403 4404 4405
AC_ARG_ENABLE(wince,
  [  --enable-wince          Windows CE interface (default enabled with MinGW)])
if test "${enable_wince}" != "no"; then
  if test "${SYS}" = "mingwce"; then
4406
    VLC_ADD_PLUGIN([wince])
Sam Hocevar's avatar
Sam Hocevar committed
4407 4408 4409 4410 4411 4412 4413 4414 4415 4416
    VLC_ADD_CXXFLAGS([wince],[])
    VLC_ADD_LIBS([wince],[-lcommctrl -lcommdlg -laygshell])
    dnl Gross hack
    VLC_ADD_LIBS([wince],[\\\${top_builddir}modules/gui/wince/wince_rc.o])
  elif test "${SYS}" = "mingw32"; then
    VLC_ADD_CXXFLAGS([wince],[])
    VLC_ADD_LIBS([wince],[-lcomctl32 -lcomdlg32 -lgdi32 -lole32])
    dnl Gross hack
    VLC_ADD_LIBS([wince],[\\\${top_builddir}modules/gui/wince/wince_rc.o])
  fi
4417 4418
fi

4419 4420 4421
dnl
dnl Simple test for skins2 dependency
dnl
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
4422
AS_IF([test "${enable_skins2}" != "no" && test "x$enable_qt4" = "xno"], [
4423 4424
  AC_MSG_ERROR([The skins2 module depends on a the Qt4 development package. Without it you won't be able to open any dialog box from the interface, which makes the skins2 interface rather useless. Install the Qt4 development package or alternatively you can also configure with: --disable-qt4 --disable-skins2.])
])
4425

4426
dnl
4427
dnl  Opie QT embedded module
4428
dnl
4429 4430
AC_ARG_ENABLE(opie,
  [  --enable-opie           Qt embedded interface support (default disabled)],
Sam Hocevar's avatar
Sam Hocevar committed
4431
  [if test "${enable_opie}" = "yes"; then
4432
     AC_ARG_WITH(qte,
Jean-Paul Saman's avatar
Jean-Paul Saman committed
4433
     [    --with-qte=PATH       Qt Embedded headers and libraries])
Sam Hocevar's avatar
Sam Hocevar committed
4434
     if test "${with_qte}" != "no" -a -n "${with_qte}"
4435
     then
4436
       VLC_ADD_LIBS([qte],[-L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte])
Sam Hocevar's avatar
Sam Hocevar committed
4437
       VLC_ADD_CXXFLAGS([qte],[-I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti])
4438
     else
4439
       VLC_ADD_LIBS([qte],[-L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'`])
Sam Hocevar's avatar
Sam Hocevar committed
4440
       VLC_ADD_CXXFLAGS([qte],[-I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'`])
Jean-Paul Saman's avatar
Jean-Paul Saman committed
4441
     fi
4442
     CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_qte}"
Jean-Paul Saman's avatar
Jean-Paul Saman committed
4443 4444 4445 4446
     AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
       AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
     ] )
     CPPFLAGS="${CPPFLAGS_save}"
4447

4448
     VLC_ADD_PLUGIN([opie])
4449
     NEED_QTE_MAIN=yes
4450
     VLC_ADD_LIBS([opie],[-lqpe ${LDFLAGS_qte}])
Sam Hocevar's avatar
Sam Hocevar committed
4451
     VLC_ADD_CXXFLAGS([opie],[${CXXFLAGS_qte}])
Sam Hocevar's avatar
Sam Hocevar committed
4452
     if test "${with_qte}" != "no" -a -n "${with_qte}"
4453
     then
4454
       MOC=${with_qte}/bin/moc
4455
     else
4456
       MOC=${QTDIR}/bin/moc
4457 4458 4459
     fi
   fi])

Sam Hocevar's avatar
 
Sam Hocevar committed
4460
dnl
Pierre d'Herbemont's avatar
Pierre d'Herbemont committed
4461
dnl  MacOS X video output/gui modules
Sam Hocevar's avatar
 
Sam Hocevar committed
4462
dnl
4463 4464
AC_ARG_ENABLE(macosx,
  [  --enable-macosx         MacOS X support (default enabled on MacOS X)])
Pierre d'Herbemont's avatar
Pierre d'Herbemont committed
4465 4466
if test "x${enable_macosx}" = "xyes"
then
4467
  VLC_ADD_LDFLAGS([access_eyetv],                     [-Wl,-framework,Foundation])
4468
  VLC_ADD_LDFLAGS([macosx minimal_macosx opengllayer qtcapture],[-Wl,-framework,Cocoa])
Pierre d'Herbemont's avatar
Pierre d'Herbemont committed
4469 4470
  VLC_ADD_LDFLAGS([macosx minimal_macosx opengllayer],[-Wl,-framework,OpenGL])
  VLC_ADD_LDFLAGS([macosx minimal_macosx],            [-Wl,-framework,Carbon])
4471
  VLC_ADD_LDFLAGS([macosx minimal_macosx],            [-Wl,-framework,CoreServices])
Pierre d'Herbemont's avatar
Pierre d'Herbemont committed
4472 4473
  VLC_ADD_LDFLAGS([macosx minimal_macosx],            [-Wl,-framework,AGL])
  VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,IOKit])
4474
  VLC_ADD_LDFLAGS([macosx],                           [-F\\\${top_srcdir}/extras/contrib/Sparkle -Wl,-framework,Sparkle])
Felix Paul Kühne's avatar
Felix Paul Kühne committed
4475
  VLC_ADD_OBJCFLAGS([macosx],                         [-F\\\${top_srcdir}/extras/contrib/Sparkle])
4476 4477
  dnl For bug report
  VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,AddressBook])
4478
  VLC_ADD_LDFLAGS([qtcapture],                        [-Wl,-framework,QTKit])
4479
  VLC_ADD_LDFLAGS([qtcapture],                        [-Wl,-framework,CoreAudio])
Pierre d'Herbemont's avatar
Pierre d'Herbemont committed
4480
  VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,WebKit])
4481 4482
  VLC_ADD_LDFLAGS([opengllayer qtcapture],            [-Wl,-framework,QuartzCore])
  VLC_ADD_LDFLAGS([qtcapture],                        [-Wl,-framework,CoreVideo])
Felix Paul Kühne's avatar
Felix Paul Kühne committed
4483
  VLC_ADD_OBJCFLAGS([macosx minimal_macosx opengllayer growl opengllayer], [-fobjc-exceptions] )
Pierre d'Herbemont's avatar
Pierre d'Herbemont committed
4484

4485
  VLC_ADD_PLUGIN([access_eyetv])
4486
  VLC_ADD_PLUGIN([qtcapture])
4487 4488
  VLC_ADD_PLUGIN([macosx])
  VLC_ADD_PLUGIN([minimal_macosx])
Felix Paul Kühne's avatar
Felix Paul Kühne committed
4489
  VLC_ADD_PLUGIN([opengllayer])
Pierre d'Herbemont's avatar
Pierre d'Herbemont committed
4490
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
4491 4492 4493 4494 4495 4496

dnl
dnl  QNX RTOS module
dnl
AC_ARG_ENABLE(qnx,
  [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
Sam Hocevar's avatar
Sam Hocevar committed
4497
    if test "${enable_qnx}" != "no"
Sam Hocevar's avatar
 
Sam Hocevar committed
4498 4499
    then
      AC_CHECK_HEADERS(Ph.h, [
4500
        VLC_ADD_PLUGIN([qnx])
4501
        VLC_ADD_LIBS([qnx],[-lasound -lph])
Sam Hocevar's avatar
 
Sam Hocevar committed
4502 4503 4504 4505 4506 4507 4508
      ])
    fi

dnl
dnl  ncurses module
dnl
AC_ARG_ENABLE(ncurses,
4509
  [  --disable-ncurses       ncurses interface support (default enabled)],
4510
  [if test "${enable_ncurses}" != "no"; then
4511 4512
    AC_CHECK_HEADER(ncurses.h,
      [AC_CHECK_LIB(ncursesw, mvprintw,
4513
        [VLC_ADD_PLUGIN([ncurses])
4514
        VLC_ADD_LIBS([ncurses],[-lncursesw])
4515
        ALIASES="${ALIASES} nvlc"
4516
        AC_DEFINE([HAVE_NCURSESW], 1, [Define to 1 if you have libncursesw.])
4517 4518 4519 4520 4521 4522 4523 4524 4525
        AC_CHECK_LIB(ncursesw, tgetent, [],
          AC_CHECK_LIB(tinfow, tgetent, [VLC_ADD_LIBS([ncurses],[-ltinfow])],
            [AC_CHECK_LIB(tinfo, tgetent, [VLC_ADD_LIBS([ncurses],[-ltinfo])],
              [AS_IF([test "x${enable_ncurses}" != "x"],
                [AC_MSG_ERROR([tgetent not found in ncursesw tinfow tinfo]
               )])])
            ]
          )
        )
4526 4527
        ],
        [AC_CHECK_LIB( ncurses, mvprintw,
4528
          [VLC_ADD_PLUGIN([ncurses])
4529
          ALIASES="${ALIASES} nvlc"
4530
          VLC_ADD_LIBS([ncurses],[-lncurses])
4531 4532 4533 4534 4535 4536
          AC_CHECK_LIB(ncurses, tgetent, [],
            [AC_CHECK_LIB(tinfo, tgetent, [VLC_ADD_LIBS([ncurses],[-ltinfo])],
              [AS_IF([test "x${enable_ncurses}" != "x"],
                [AC_MSG_ERROR([tgetent not found in ncurses tinfo])])]
            )]
          )],
4537 4538 4539 4540 4541 4542 4543
          [AS_IF([test "x${enable_ncurses}" != "x"], [
            AC_MSG_ERROR([libncurses not found])])]
        )]
      )]
    )
  fi]
)
Sam Hocevar's avatar
 
Sam Hocevar committed
4544

4545 4546 4547 4548
dnl
dnl  XOSD plugin
dnl
AC_ARG_ENABLE(xosd,
4549
  [  --enable-xosd           xosd interface support (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
4550
if test "${enable_xosd}" = "yes"
4551
then
4552 4553 4554 4555 4556 4557
  AC_CHECK_HEADERS(xosd.h,
    AC_CHECK_LIB(xosd, xosd_set_horizontal_offset, [
      VLC_ADD_PLUGIN([xosd])
      VLC_ADD_LIBS([xosd],[-lxosd])
    ])
  )
4558 4559
fi

4560 4561 4562 4563
dnl
dnl Framebuffer (overlay) plugin
dnl
AC_ARG_ENABLE(fbosd,
Jean-Paul Saman's avatar
Typo  
Jean-Paul Saman committed
4564
  [  --enable-fbosd          fbosd interface support (default disabled)])
4565 4566 4567
if test "${enable_fbosd}" = "yes"
then
  AC_CHECK_HEADERS(linux/fb.h, [
4568
    VLC_ADD_PLUGIN([fbosd])
4569 4570 4571
 ])
fi

4572 4573 4574 4575 4576 4577 4578
dnl
dnl Post-interface configuration checks
dnl
AS_IF([test "$need_xid_provider" = "yes"], [
  AC_MSG_ERROR([X11 video outputs need a window provider (Qt4, Skins2, Hildon or xcb-utils), but none were found. Please install xcb-keysyms.])
])

4579 4580 4581 4582
dnl
dnl Visualisation plugin
dnl
AC_ARG_ENABLE(visual,
4583
  [  --enable-visual         visualisation plugin (default enabled)])
4584 4585
if test "${enable_visual}" != "no"
then
4586
    VLC_ADD_PLUGIN([visual])
4587 4588
fi

4589 4590 4591
dnl
dnl  goom visualization plugin
dnl
Christophe Mutricy's avatar
Christophe Mutricy committed
4592
PKG_ENABLE_MODULES_VLC([GOOM], [], [libgoom2], [goom visualization plugin], [auto])
4593

4594 4595 4596
dnl
dnl libprojectM visualization plugin
dnl
Christophe Mutricy's avatar
Christophe Mutricy committed
4597
PKG_ENABLE_MODULES_VLC([PROJECTM], [], [libprojectM], [projectM visualization plugin], [auto])
4598

4599 4600 4601
dnl
dnl  AtmoLight (homebrew AmbiLight)
dnl
4602 4603
AC_ARG_ENABLE(atmo,
AS_HELP_STRING([--disable-atmo],[AtmoLight (homebrew Philips ambilight)
4604
                (broken, default disabled)]),, [enable_atmo="no"])
4605 4606 4607 4608 4609 4610 4611
AS_IF([test "${enable_atmo}" != no], [
  AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "linux"], [
    AC_LANG_PUSH(C++)
    VLC_ADD_PLUGIN([atmo])
    AC_LANG_POP(C++)
  ])
])
4612

4613 4614
dnl
dnl  Bonjour services discovery
4615
PKG_ENABLE_MODULES_VLC([BONJOUR], [], [avahi-client >= 0.6], [Bonjour services discovery], [auto])
4616

4617 4618
dnl
dnl  libudev services discovery
4619
PKG_ENABLE_MODULES_VLC([UDEV], [], [libudev >= 142], [Linux udev services discovery], [auto])
4620

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
4621 4622 4623 4624
dnl
dnl MTP devices services discovery
PKG_ENABLE_MODULES_VLC([MTP], [], [libmtp >= 0.3.0],[MTP devices support],[auto])

4625 4626 4627
dnl
dnl  Lirc plugin
dnl
4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638
AC_ARG_ENABLE(lirc,
  [  --enable-lirc           lirc support (default disabled)])
if test "${enable_lirc}" = "yes"
then
  AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
  if test "${have_lirc}" = "true"
  then
    VLC_ADD_PLUGIN([lirc])
    VLC_ADD_LIBS([lirc],[-llirc_client])
  fi
fi
4639

4640

Sam Hocevar's avatar
 
Sam Hocevar committed
4641 4642
AC_ARG_WITH(,[Misc options:])

4643 4644 4645 4646
dnl
dnl libgcrypt
dnl
AC_ARG_ENABLE(libgcrypt,
4647
  [  --disable-libgcrypt      gcrypt support (default enabled)])
4648
AS_IF([test "${enable_libgcrypt}" != "no"], [
4649
  AC_CHECK_DECL([GCRYCTL_SET_THREAD_CBS], [
4650 4651 4652 4653 4654 4655 4656 4657
    libgcrypt-config --version >/dev/null || \
        AC_MSG_ERROR([gcrypt.h present but libgcrypt-config could not be found])
    AC_CHECK_LIB(gcrypt, gcry_control, [
      have_libgcrypt="yes"
      GCRYPT_CFLAGS="`libgcrypt-config --cflags`"
      GCRYPT_LIBS="`libgcrypt-config --libs`"
    ], [
      AC_MSG_ERROR([libgcrypt not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.])
4658
    ], [`libgcrypt-config --libs`])
4659 4660 4661 4662
  ], [
    AC_MSG_ERROR([libgcrypt version 1.1.94 or higher not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.])
  ], [#include <gcrypt.h>]
  )
4663
])
4664

4665 4666
if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"; then
  AS_IF([test "${have_libgcrypt}" = "yes"],[
4667
    VLC_ADD_LIBS([rtp stream_out_rtp], [${GCRYPT_LIBS}])
4668 4669
  ])
fi
4670 4671 4672
AC_SUBST(GCRYPT_CFLAGS)
AC_SUBST(GCRYPT_LIBS)
AM_CONDITIONAL([HAVE_GCRYPT], [test "${have_libgcrypt}" = "yes"])
4673

4674 4675 4676 4677 4678 4679 4680
dnl
dnl TLS/SSL
dnl
AC_ARG_ENABLE(gnutls,
  [  --enable-gnutls         gnutls TLS/SSL support (default enabled)])

AS_IF([test "${enable_gnutls}" != "no"], [
4681
  PKG_CHECK_MODULES(GNUTLS, [gnutls >= 1.7.4], [
4682
    VLC_ADD_PLUGIN([gnutls])
4683
    VLC_ADD_CFLAGS([gnutls], [$GNUTLS_CFLAGS])
4684
    AS_IF([test "${SYS}" = "mingw32"], [
4685
      dnl pkg-config --libs gnutls omits these
4686 4687
      VLC_ADD_LIBS([gnutls], [-lz])
      VLC_ADD_LIBS([gnutls], [${LTLIBINTL}])
4688
    ])
4689
    dnl The GnuTLS plugin invokes gcry_control directly.
4690
    AS_IF([test "${have_libgcrypt}" = "yes"],[
4691 4692
      VLC_ADD_LIBS([gnutls], [${GCRYPT_LIBS}])
      VLC_ADD_CFLAGS([gnutls], [${GCRYPT_CFLAGS}])
4693
    ])
4694
    VLC_ADD_LIBS([gnutls], [$GNUTLS_LIBS])
4695 4696
  ], [
    AS_IF([test "${enable_gnutls}" = "yes"], [
4697
      AC_MSG_ERROR([gnutls not present or too old (version 1.7.4 required)])
4698 4699 4700 4701
    ])
  ])
])

4702 4703 4704 4705 4706

dnl
dnl RemoteOSD plugin (VNC client as video filter)
dnl
AC_ARG_ENABLE(remoteosd,
Christophe Mutricy's avatar
Christophe Mutricy committed
4707
  [  --disable-remoteosd     RemoteOSD plugin (default enabled)])
4708 4709 4710 4711

AS_IF([test "${enable_remoteosd}" != "no"], [
  AS_IF([test "${have_libgcrypt}" = "yes"],[
    VLC_ADD_PLUGIN([remoteosd])
4712 4713
    VLC_ADD_LIBS([remoteosd], ${GCRYPT_LIBS})
    VLC_ADD_CFLAGS([remoteosd], ${GCRYPT_CFLAGS})
4714 4715 4716 4717 4718 4719
  ], [
    AC_MSG_ERROR([libgcrypt support required for RemoteOSD plugin])
  ])
])


4720 4721 4722 4723 4724 4725 4726
dnl
dnl RAOP plugin
dnl
AC_MSG_CHECKING([whether to enable RAOP plugin])
AS_IF([test "${have_libgcrypt}" = "yes"], [
  AC_MSG_RESULT(yes)
  VLC_ADD_PLUGIN([stream_out_raop])
4727 4728
  VLC_ADD_LIBS([stream_out_raop], [${GCRYPT_LIBS} -lgpg-error])
  VLC_ADD_CFLAGS([stream_out_raop], [${GCRYPT_CFLAGS}])
4729 4730 4731 4732 4733 4734
], [
  AC_MSG_RESULT(no)
  AC_MSG_WARN([libgcrypt support required for RAOP plugin])
])


4735 4736 4737 4738 4739
dnl
dnl OSSO (Maemo screen blanking) plugin
dnl
PKG_ENABLE_MODULES_VLC([OSSO], [], [libosso], [Maemo support], [auto])

4740 4741 4742 4743 4744
AS_IF([test -f "/etc/maemo_version"], [
  AC_DEFINE([HAVE_MAEMO], 1, [Define to 1 if building for the Maemo platform.])
])


4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755
dnl
dnl update checking system
dnl
AC_ARG_ENABLE(update-check,
  [  --enable-update-check   update checking system (default disabled)])
if test "${enable_update_check}" = "yes"
then
  if test "${have_libgcrypt}" != "yes"
  then
    AC_MSG_ERROR([libgcrypt is required for update checking system])
  fi
4756
  VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
4757
  VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
4758
  AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
4759
fi
4760

4761

4762
dnl
4763
dnl  Endianness check
4764
dnl
4765
AC_C_BIGENDIAN
4766 4767 4768 4769 4770 4771
AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
  DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
], [
  DEFS_BIGENDIAN=""
])
AC_SUBST(DEFS_BIGENDIAN)
4772

4773 4774 4775 4776 4777
dnl
dnl  DLL loader copied from MPlayer copied from somewhere else (WINE ?)
dnl
loader=false
AC_ARG_ENABLE(loader,
4778
  AS_HELP_STRING([--enable-loader],[build DLL loader for ELF i386 platforms
Christophe Mutricy's avatar
Christophe Mutricy committed
4779
		  (default disabled)]))
4780 4781
AM_CONDITIONAL(LOADER, [test "${enable_loader}" = "yes"])
AS_IF([test "${enable_loader}" = "yes"],
4782
  [ VLC_ADD_PLUGIN([dmo])
4783 4784 4785 4786 4787 4788 4789 4790
    VLC_ADD_CPPFLAGS([dmo],[-I\\\${top_srcdir}/libs/loader])
    VLC_ADD_LIBS([dmo],[\\\${top_builddir}/libs/loader/libloader.la -lpthread])
    VLC_ADD_CPPFLAGS([quicktime],[-I\\\${top_srcdir}/libs/loader])
    VLC_ADD_LIBS([quicktime],[\\\${top_builddir}/libs/loader/libloader.la -lpthread])
    VLC_ADD_CPPFLAGS([realaudio],[-I\\\${top_srcdir}/libs/loader -DLOADER])
    VLC_ADD_LIBS([realaudio],[\\\${top_builddir}/libs/loader/libloader.la])
    VLC_ADD_CPPFLAGS([realvideo],[-I\\\${top_srcdir}/libs/loader -DLOADER])
    VLC_ADD_LIBS([realvideo],[\\\${top_builddir}/libs/loader/libloader.la])
4791 4792
  ])

4793 4794 4795 4796 4797 4798 4799 4800 4801
AC_ARG_WITH(,[Components:])

dnl
dnl  the VLC binary
dnl
AC_ARG_ENABLE(vlc,
  [  --enable-vlc            build the VLC media player (default enabled)])
AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])

4802 4803 4804
dnl
dnl  Microsoft ActiveX support
dnl
4805
activex=false
4806
AC_ARG_ENABLE(activex,
4807
  AS_HELP_STRING([--enable-activex],[build a vlc-based ActiveX control
Christophe Mutricy's avatar
Christophe Mutricy committed
4808
		  (default enabled on Win32)]))
4809 4810
AC_ARG_WITH(wine-sdk-path,
  [    --with-wine-sdk-path=PATH path to wine sdk])
4811 4812
if test "${enable_activex}" != "no"
then
4813
  if test "${SYS}" = "mingw32"
4814
  then
4815 4816 4817 4818 4819
    AC_CHECK_PROGS(MIDL, [midl], no)
    if test "${with_wine_sdk_path}" != ""
    then
       WINE_SDK_PATH=${with_wine_sdk_path}
       AC_PATH_PROG(WIDL, widl, no, [$WINE_SDK_PATH/bin:$WINE_SDK_PATH/tools/widl])
4820 4821
    else
       WIDL=no
4822
    fi
4823
    AC_LANG_PUSH(C++)
4824
    AC_CHECK_HEADERS(ole2.h,
4825
      [AC_CHECK_HEADERS(olectl.h,
4826
        [ VLC_ADD_CPPFLAGS([activex],[-DUNICODE -D_UNICODE -D_MIDL_USE_GUIDDEF_])
4827
          VLC_ADD_CXXFLAGS([activex],[-fno-exceptions])
4828
          VLC_ADD_LIBS([activex],[-lole32 -loleaut32 -luuid -lshlwapi])
4829 4830 4831
          AC_CHECK_HEADERS(objsafe.h,
            VLC_ADD_CXXFLAGS([activex],[-DHAVE_OBJSAFE_HEADER]),,
            [
Jean-Paul Saman's avatar
Jean-Paul Saman committed
4832
             #if HAVE_OLE2_H
4833 4834
             #   include <ole2.h>
             #endif
Jean-Paul Saman's avatar
Jean-Paul Saman committed
4835
            ]
4836 4837
          )
          activex=:
Jean-Paul Saman's avatar
Jean-Paul Saman committed
4838
          PLUGINS_BINDINGS="${PLUGINS_BINDINGS} activex"
4839 4840 4841
        ],
        [ AC_MSG_ERROR([required OLE headers are missing from your system]) ]
      )],
4842 4843
      [ AC_MSG_ERROR([required OLE headers are missing from your system]) ]
    )
4844
    AC_LANG_POP(C++)
4845 4846
  fi
fi
4847
AC_ARG_VAR(MIDL, [Microsoft IDL compiler (Win32 platform only)])
4848
AM_CONDITIONAL(HAS_MIDL_COMPILER, test "${MIDL}" != "no")
4849 4850
AC_ARG_VAR(WIDL, [Wine IDL compiler (requires Wine SDK)])
AM_CONDITIONAL(HAS_WIDL_COMPILER, test "${WIDL}" != "no")
4851
AM_CONDITIONAL(BUILD_ACTIVEX,${activex})
4852

4853 4854 4855
dnl
dnl  Mozilla plugin
dnl
4856
mozilla=false
4857
AC_ARG_ENABLE(mozilla,
Christophe Mutricy's avatar
Christophe Mutricy committed
4858 4859
  AS_HELP_STRING([--enable-mozilla],[build a vlc-based Firefox/Mozilla plugin
		  (default disabled)]))
4860 4861
AC_ARG_WITH(mozilla-sdk-path,
  [    --with-mozilla-sdk-path=PATH path to mozilla sdk])
4862 4863
AC_ARG_WITH(mozilla-pkg,
  [    --with-mozilla-pkg=PKG  look for PKG.pc to build the mozilla plugin.])
4864
AC_LANG_PUSH(C++)
4865
if test "${enable_mozilla}" = "yes"
4866
then
4867 4868 4869
  AS_IF([test "${with_mozilla_sdk_path}" = "" -o "${with_mozilla_sdk_path}" = "no"],
    [
    dnl pkg-config
4870
    dnl As we want to do a loop due to the number of name possible for the .pc
4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881
    dnl we can't use the pkg-config macros.

    AC_ARG_VAR([MOZILLA_CFLAGS], [C compiler flags for Mozilla, overriding pkg-config])
    AC_ARG_VAR([MOZILLA_LIBS], [linker flags for Mozilla, overriding pkg-config])
    AC_MSG_NOTICE([Checking for Mozilla])
    found=0
    if test -n "$MOZILLA_CFLAGS" -a -n "$MOZILLA_LIBS"
    then
      found=1
    else
      if test -n "$PKG_CONFIG"; then
4882 4883
	for i in "${with_mozilla_pkg}" libxul {seamonkey,iceape,xulrunner,firefox,iceweasel,mozilla}-plugin; do
	  echo "Trying to find $i.pc files" >&5
4884 4885
	  if $PKG_CONFIG --exists --print-errors "$i" 2>&5
	  then
4886 4887
            echo "Using $i.pc files." >&5
            echo "Using $i.pc files." >&6
4888
	    found=1
4889 4890
	    MOZILLA_CFLAGS=$(eval $PKG_CONFIG --cflags "$i" )
	    MOZILLA_LIBS=$(eval $PKG_CONFIG --libs "$i" )
4891 4892 4893 4894
	    break
	  fi
	done
      fi
4895
    fi
4896 4897
    AS_IF( [test $found = 1],[
        CPPFLAGS="${CPPFLAGS_save} ${MOZILLA_CFLAGS}"
4898
        MOZILLA_REQUIRED_HEADERS=1
4899
        AC_CHECK_HEADERS([npfunctions.h])
4900 4901 4902 4903 4904 4905
        AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0)
        AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0,
          [#if HAVE_NPAPI_H
           # include <npapi.h>
           #endif
          ])
4906
        if test "${MOZILLA_REQUIRED_HEADERS}" = "0"; then
4907
            AC_MSG_ERROR([Please install the Firefox development tools; mozilla-config.h, plugin/npapi.h and plugin/npruntime.h were not found.])
4908
        fi
4909 4910
        MOZILLA_REQUIRED_HEADERS=
        mozilla=:
4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922
        AS_IF([ test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"],[
	   VLC_ADD_CPPFLAGS([mozilla],[-DXP_UNIX -DOJI])
	   AS_IF([ test "${SYS}" != "darwin"],[
	     PKG_CHECK_MODULES(XPM, [xpm xt],[
		VLC_ADD_CPPFLAGS([mozilla],[-DMOZ_X11])
	     ],[
		AC_MSG_ERROR([Please install the libXpm and libXt development files.])
	     ])
          ])
        ])
	VLC_ADD_CPPFLAGS([mozilla],[${CPPFLAGS} ${XPM_CFLAGS}])
        VLC_ADD_LIBS([mozilla],[${MOZILLA_LIBS} ${XPM_LIBS}])
4923
        VLC_ADD_PLUGIN([mozilla])
4924
        PLUGINS_BINDINGS="${PLUGINS_BINDINGS} mozilla"
4925
        MOZILLA_CONFIG=
4926
        CPPFLAGS="${CPPFLAGS_save}"
4927 4928
          ],
          [
4929 4930
            AC_PATH_PROGS(MOZILLA_CONFIG,
	    [mozilla-config seamonkey-config xulrunner-config],
4931 4932
        [no])
            test "${MOZILLA_CONFIG}" = "no" && AC_MSG_ERROR([Please install the Mozilla development tools. mozilla-config was not found.])
4933 4934
          ]
        )
4935 4936
    dnl pkg-config failed but we might have found a mozilla-config
    AS_IF( [test ! -z "${MOZILLA_CONFIG}"],[
4937 4938 4939 4940 4941
      if ${MOZILLA_CONFIG} --defines | grep -q 'MOZ_X11=1'; then
        LDFLAGS="${LDFLAGS_save} ${X_LIBS} ${X_PRE_LIBS}"
        AC_CHECK_LIB(Xt,XtStrings,
         [
           VLC_ADD_CPPFLAGS([mozilla],[${X_CFLAGS}])
4942
           VLC_ADD_LIBS([mozilla],[${X_LIBS} ${X_PRE_LIBS} -lXt -lX11 -lSM -lICE -lXpm])
4943 4944
         ],
         [],
4945
         [[${X_LIBS} ${X_PRE_LIBS} -lX11 -lSM -lICE -lXpm]
4946
        ])
4947
        AC_CHECK_HEADERS(X11/xpm.h,,AC_MSG_ERROR([Please install libXpm-devel library for required X11/xpm.h]))
4948 4949
        LDFLAGS="${LDFLAGS_save}"
      fi
4950

4951
      mozilla=:
4952
      PLUGINS_BINDINGS="${PLUGINS_BINDINGS} mozilla"
4953 4954
      VLC_ADD_CPPFLAGS([mozilla],[[`${MOZILLA_CONFIG} --cflags plugin java`]])
      VLC_ADD_LIBS([mozilla],[`${MOZILLA_CONFIG} --libs plugin`])
4955
      CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mozilla}"
4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968
      MOZILLA_REQUIRED_HEADERS=1
      AC_CHECK_HEADERS(mozilla-config.h,,MOZILLA_REQUIRED_HEADERS=0)
      AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0)
      AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0,
        [#if HAVE_NPAPI_H
         # include <npapi.h>
         #endif
        ])
      if test "${MOZILLA_REQUIRED_HEADERS}" = "0"
      then
        AC_MSG_ERROR([Please install the Mozilla development tools, required headers were not found.])
      fi
      MOZILLA_REQUIRED_HEADERS=
4969
      CPPFLAGS="${CPPFLAGS_save}"
4970
      MOZILLA_SDK_PATH="`${MOZILLA_CONFIG} --prefix`"
4971
    ])
4972
    dnl End of moz_sdk = ""
4973
  ],[
4974 4975 4976 4977 4978
    dnl special case for mingw32
    if test "${SYS}" = "mingw32"
    then
      AC_CHECK_TOOL(CYGPATH, cygpath, "")
      dnl latest gecko sdk does not have an xpcom directory
Christophe Mutricy's avatar
Typo  
Christophe Mutricy committed
4979
      if test -d "${with_mozilla_sdk_path}/xpcom"; then
4980 4981
          mozilla_sdk_xpcom="/xpcom"
      fi
4982
    fi
4983

4984 4985
    real_mozilla_sdk="`cd ${with_mozilla_sdk_path} 2>/dev/null && pwd`"
    CPPFLAGS="${CPPFLAGS_save} -I${real_mozilla_sdk} -I${real_mozilla_sdk}/include"
4986 4987 4988 4989 4990
    MOZILLA_REQUIRED_HEADERS=1
    AC_CHECK_HEADERS(mozilla-config.h,,MOZILLA_REQUIRED_HEADERS=0)
    AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0)
    AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0,
        [#if HAVE_NPAPI_H
4991
          #include <npapi.h>
4992 4993 4994 4995 4996 4997 4998 4999
          #endif
        ])
    if test "${MOZILLA_REQUIRED_HEADERS}" = "0"
    then
        AC_MSG_ERROR([Please install the Mozilla development tools, required headers were not found.])
    fi
    MOZILLA_REQUIRED_HEADERS=
    mozilla=:
5000
    PLUGINS_BINDINGS="${PLUGINS_BINDINGS} mozilla"
5001 5002
    VLC_ADD_CPPFLAGS([mozilla],[-DXPCOM_GLUE -DHAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX -I${real_mozilla_sdk} -I${real_mozilla_sdk}/include -I${real_mozilla_sdk}/embedstring/include -I${real_mozilla_sdk}/xpcom/include -I${real_mozilla_sdk}/nspr/include -I${real_mozilla_sdk}/string/include -I${real_mozilla_sdk}/plugin/include -I${real_mozilla_sdk}/java/include])
    if ${need_xpcom_libs}; then
5003
       VLC_ADD_LIBS([mozilla],[-L${real_mozilla_sdk}/embedstring/bin -L${real_mozilla_sdk}/xpcom/bin -L${real_mozilla_sdk}/nspr/bin -L${real_mozilla_sdk}/string/bin -L${real_mozilla_sdk}/lib -lnspr4 -lplds4 -lplc4 -lxpcomglue])
5004
      if test "${SYS}" = "mingw32"; then
5005 5006 5007
        dnl latest gecko sdk does not have embedstring
        if test -d "${real_mozilla_sdk}/embedstring/bin"
        then
5008
          VLC_ADD_LIBS([mozilla],[-lembedstring])
5009 5010
        fi
      fi
5011 5012
    fi
    MOZILLA_SDK_PATH="${real_mozilla_sdk}"
5013

5014 5015 5016
    if test -n "${CYGPATH}"; then
      real_mozilla_sdk="`${CYGPATH} -w ${real_mozilla_sdk}`"
    fi
Sam Hocevar's avatar
Sam Hocevar committed
5017
    CPPFLAGS="${CPPFLAGS_save}"
5018
 ])
5019
fi
5020
AC_LANG_POP(C++)
5021
AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
5022

5023
dnl Tests for Xsp
5024
AC_CHECK_LIB(Xsp, XSPSetPixelDoubling,[
5025 5026
  VLC_ADD_CPPFLAGS([xvmc glx],[-DHAVE_XSP])
  VLC_ADD_LIBS([xvmc glx],[-lXsp])
5027
])
5028

5029 5030 5031 5032 5033
dnl
dnl  test plugins
dnl
AC_ARG_ENABLE(testsuite,
  [  --enable-testsuite      build test modules (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
5034
if test "${enable_testsuite}" = "yes"
5035
then
5036 5037
  TESTS="test1 test2 test3 test4"

5038
  dnl  we define those so that bootstrap sets the right linker
Sam Hocevar's avatar
Sam Hocevar committed
5039 5040
  VLC_ADD_CXXFLAGS([test2],[])
  VLC_ADD_OBJCFLAGS([test3],[])
5041
  dnl  this one is needed until automake knows what to do
5042
  VLC_ADD_LIBS([test3],[-lobjc])
5043

5044 5045 5046 5047
  VLC_ADD_PLUGIN([test1])
  VLC_ADD_PLUGIN([test2])
  VLC_ADD_PLUGIN([test3])
  VLC_ADD_PLUGIN([test4])
5048 5049
fi

5050 5051 5052
dnl
dnl  qte_main plugin
dnl
Sam Hocevar's avatar
Sam Hocevar committed
5053
if test "${NEED_QTE_MAIN}" != "no"
5054
then
5055
    VLC_ADD_PLUGIN([qte_main])
Sam Hocevar's avatar
Sam Hocevar committed
5056 5057 5058
    VLC_ADD_CXXFLAGS([opie qte qt_video],[-DNEED_QTE_MAIN])
    VLC_ADD_CXXFLAGS([qte_main],[${CXXFLAGS_qte} ${CXXFLAGS_qt_video}])
    VLC_ADD_LDFLAGS([qte_main],[${LDFLAGS_qte} ${LDFLAGS_qt_video}])
5059 5060
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
5061
dnl
5062
dnl  Plugin and builtin checks
Sam Hocevar's avatar
 
Sam Hocevar committed
5063
dnl
5064
plugin_support=yes
Sam Hocevar's avatar
 
Sam Hocevar committed
5065

5066 5067 5068
dnl Automagically disable plugins if there is no system support for
dnl dynamically loadable files (.so, .dll, .dylib).
dnl don't forget vlc-win32 still can load .dll as plugins
5069 5070 5071 5072 5073 5074
AS_IF([test "${ac_cv_have_plugins}" = "no"], [
  AC_MSG_WARN([*** No plugin support! Building statically! ***])
  plugin_support=no
])

AS_IF([test "${plugin_support}" != "no"], [
5075
  AC_DEFINE(HAVE_DYNAMIC_PLUGINS, 1, [Define if dynamic plugins are supported])
Rémi Denis-Courmont's avatar
Woops  
Rémi Denis-Courmont committed
5076
])
5077

5078 5079 5080
dnl
dnl Pic and shared libvlc stuff
dnl
5081
AS_IF([test "${SYS}" = "mingw32"], [
5082
  FILE_LIBVLCCORE_DLL="!define LIBVLCCORE_DLL libvlccore.dll"
5083
  FILE_LIBVLC_DLL="!define LIBVLC_DLL libvlc.dll"
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
5084
])
5085

Sam Hocevar's avatar
 
Sam Hocevar committed
5086 5087 5088
dnl
dnl  Stuff used by the program
dnl
5089 5090 5091 5092
VERSION_MESSAGE="${VERSION} ${CODENAME}"
COPYRIGHT_MESSAGE="VLC media player - version ${VERSION_MESSAGE} - (c) ${COPYRIGHT_YEARS} the VideoLAN team"
AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION_MESSAGE}", [Simple version string])
AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "${COPYRIGHT_MESSAGE}", [Copyright string])
Christophe Mutricy's avatar
Christophe Mutricy committed
5093
AC_DEFINE_UNQUOTED(COPYRIGHT_YEARS, "${COPYRIGHT_YEARS}", [The copyright years])
5094
AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
5095 5096 5097 5098
AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,"${VERSION_MAJOR}", [version major number])
AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,"${VERSION_MINOR}", [version minor number])
AC_DEFINE_UNQUOTED(PACKAGE_VERSION_REVISION,"${VERSION_REVISION}", [version minor number])
AC_DEFINE_UNQUOTED(PACKAGE_VERSION_EXTRA,"${VERSION_EXTRA}", [version minor number])
5099 5100
AC_SUBST(COPYRIGHT_MESSAGE)
AC_SUBST(VERSION_MESSAGE)
5101 5102 5103
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_REVISION)
5104
AC_SUBST(VERSION_EXTRA)
5105
AC_SUBST(COPYRIGHT_YEARS)
5106
AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami`", [user who ran configure])
5107
if test "${build_os}" = "cygwin"
5108 5109 5110 5111 5112
then
    AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname`", [host which ran configure])
else
    AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -s`", [host which ran configure])
fi
5113 5114
AC_DEFINE_UNQUOTED(VLC_COMPILE_DOMAIN, "`dnsdomainname 2>/dev/null || domainname 2>/dev/null || echo unknown`", [domain of the host which ran configure])
AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1`", [compiler])
5115
dnl Win32 need s a numerical version_extra.
5116
case $( echo ${VERSION_EXTRA}|wc -m ) in
5117 5118 5119 5120 5121
       "1") VERSION_EXTRA_RC="0";;
       "2") VERSION_EXTRA_RC=$( echo ${VERSION_EXTRA}|tr "abcdefghi" "123456789") ;;
       *) VERSION_EXTRA_RC="99"
esac
AC_SUBST(VERSION_EXTRA_RC)
Sam Hocevar's avatar
Sam Hocevar committed
5122
dnl
Sam Hocevar's avatar
Sam Hocevar committed
5123
dnl  Handle substvars that use $(top_srcdir)
Sam Hocevar's avatar
Sam Hocevar committed
5124
dnl
5125
VLC_CONFIG="top_srcdir=\"\$(top_srcdir)\" top_builddir=\"\$(top_builddir)\" \$(top_builddir)/vlc-config"
Sam Hocevar's avatar
Sam Hocevar committed
5126
AC_SUBST(VLC_CONFIG)
5127
CPPFLAGS_save="-I\$(top_srcdir)/include -I\$(top_builddir)/include ${CPPFLAGS_save}"
5128 5129

dnl
Sam Hocevar's avatar
Sam Hocevar committed
5130
dnl  Restore *FLAGS
5131
dnl
Sam Hocevar's avatar
Sam Hocevar committed
5132
VLC_RESTORE_FLAGS
Sam Hocevar's avatar
Sam Hocevar committed
5133

Christophe Mutricy's avatar
Christophe Mutricy committed
5134 5135
dnl
dnl Sort the modules list
5136
dnl
Christophe Mutricy's avatar
Christophe Mutricy committed
5137 5138
PLUGINS=$( (for i in `echo $PLUGINS`; do echo $i; done)|sort|xargs )

5139 5140 5141
dnl
dnl  Create the vlc-config script
dnl
5142
LDFLAGS_libvlc="${LDFLAGS_libvlc} ${LDFLAGS_builtin}"
5143

5144
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
5145 5146
dnl  Configuration is finished
dnl
5147 5148
AC_SUBST(SYS)
AC_SUBST(ARCH)
5149
AC_SUBST(ALIASES)
Sam Hocevar's avatar
 
Sam Hocevar committed
5150
AC_SUBST(ASM)
Sam Hocevar's avatar
 
Sam Hocevar committed
5151
AC_SUBST(MOC)
Clément Stenac's avatar
Clément Stenac committed
5152
AC_SUBST(RCC)
5153
AC_SUBST(UIC)
Sam Hocevar's avatar
 
Sam Hocevar committed
5154
AC_SUBST(WINDRES)
5155
AC_SUBST(MOZILLA_SDK_PATH)
5156
AC_SUBST(WINE_SDK_PATH)
5157
AC_SUBST(LIBEXT)
5158
AC_SUBST(AM_CPPFLAGS)
5159
AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
5160
AC_SUBST(FILE_LIBVLCCORE_DLL)
5161
AC_SUBST(FILE_LIBVLC_DLL)
Sam Hocevar's avatar
 
Sam Hocevar committed
5162

Sam Hocevar's avatar
Sam Hocevar committed
5163
dnl Create vlc-config.in
Sam Hocevar's avatar
Sam Hocevar committed
5164
VLC_OUTPUT_VLC_CONFIG_IN
5165

5166
AC_CONFIG_FILES([
5167
  extras/package/win32/vlc.win32.nsi
5168 5169 5170 5171
  extras/package/macosx/Info.plist
  extras/package/macosx/Resources/English.lproj/InfoPlist.strings
  extras/package/macosx/plugin/Info.plist
  extras/package/macosx/plugin/InstallerInfo.plist
5172
  Makefile
5173 5174
  projects/activex/Makefile
  projects/activex/axvlc.inf
5175
  doc/Makefile
5176
  extras/package/ipkg/Makefile
5177
  libs/loader/Makefile
5178
  libs/srtp/Makefile
5179
  libs/unzip/Makefile
5180
  modules/Makefile
5181
  projects/mozilla/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5182
  m4/Makefile
5183
  po/Makefile.in
5184 5185
  projects/activex/axvlc_rc.rc
  projects/mozilla/npvlc_rc.rc
5186
  projects/mozilla/vlc.r
5187
  projects/mozilla/install.js
5188
  share/Makefile
5189
  share/vlc_win32_rc.rc
5190
  share/libvlc_win32_rc.rc
5191
  compat/Makefile
5192
  src/Makefile
5193
  src/test/Makefile
5194
  bin/Makefile
5195
  test/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5196
  modules/access/Makefile
5197
  modules/access/bd/Makefile
5198
  modules/access/bda/Makefile
Gildas Bazin's avatar
 
Gildas Bazin committed
5199
  modules/access/dshow/Makefile
5200
  modules/access/dvb/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5201
  modules/access/mms/Makefile
5202
  modules/access/cdda/Makefile
5203
  modules/access/rtp/Makefile
5204
  modules/access/rtsp/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5205
  modules/access/vcd/Makefile
Gildas Bazin's avatar
 
Gildas Bazin committed
5206
  modules/access/vcdx/Makefile
5207
  modules/access/screen/Makefile
5208
  modules/access/zip/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5209 5210 5211 5212 5213
  modules/access_output/Makefile
  modules/audio_filter/Makefile
  modules/audio_filter/channel_mixer/Makefile
  modules/audio_filter/converter/Makefile
  modules/audio_filter/resampler/Makefile
5214
  modules/audio_filter/spatializer/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5215 5216 5217
  modules/audio_mixer/Makefile
  modules/audio_output/Makefile
  modules/codec/Makefile
5218
  modules/codec/avcodec/Makefile
5219
  modules/codec/cmml/Makefile
5220
  modules/codec/dmo/Makefile
5221
  modules/codec/shine/Makefile
5222
  modules/codec/subtitles/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5223
  modules/codec/spudec/Makefile
5224
  modules/codec/wmafixed/Makefile
5225
  modules/codec/xvmc/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5226
  modules/control/Makefile
5227
  modules/control/http/Makefile
5228
  modules/control/globalhotkeys/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5229 5230
  modules/demux/Makefile
  modules/demux/asf/Makefile
5231
  modules/demux/avformat/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5232
  modules/demux/avi/Makefile
5233
  modules/demux/mkv/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5234 5235
  modules/demux/mp4/Makefile
  modules/demux/mpeg/Makefile
5236
  modules/demux/playlist/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5237 5238 5239
  modules/gui/Makefile
  modules/gui/beos/Makefile
  modules/gui/macosx/Makefile
5240
  modules/gui/hildon/Makefile
5241
  modules/gui/minimal_macosx/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5242
  modules/gui/qnx/Makefile
5243
  modules/gui/qt4/Makefile
5244
  modules/gui/skins2/Makefile
5245
  modules/gui/wince/Makefile
Clément Stenac's avatar
Clément Stenac committed
5246
  modules/meta_engine/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5247 5248
  modules/misc/Makefile
  modules/misc/dummy/Makefile
5249
  modules/misc/lua/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5250
  modules/misc/memcpy/Makefile
5251
  modules/misc/notify/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5252
  modules/misc/testsuite/Makefile
5253
  modules/misc/playlist/Makefile
5254
  modules/misc/osd/Makefile
5255
  modules/misc/stats/Makefile
Gildas Bazin's avatar
Gildas Bazin committed
5256
  modules/misc/xml/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5257 5258 5259
  modules/mux/Makefile
  modules/mux/mpeg/Makefile
  modules/packetizer/Makefile
5260
  modules/services_discovery/Makefile
5261
  modules/stream_filter/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5262 5263 5264
  modules/stream_out/Makefile
  modules/video_chroma/Makefile
  modules/video_filter/Makefile
5265
  modules/video_filter/dynamicoverlay/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5266
  modules/video_output/Makefile
5267
  modules/video_output/msw/Makefile
Sam Hocevar's avatar
Sam Hocevar committed
5268 5269 5270
  modules/video_output/qte/Makefile
  modules/video_output/x11/Makefile
  modules/visualization/Makefile
5271
  modules/visualization/visual/Makefile
5272
])
5273

5274 5275 5276
dnl Generate makefiles
AC_OUTPUT

5277 5278 5279 5280 5281
# Cannot use AC_CONFIG_FILES([vlc-config]) as is automatically built,
# not provided with the source
${SHELL} ./config.status --file=vlc-config
chmod 0755 vlc-config

Christophe Mutricy's avatar
Christophe Mutricy committed
5282
/bin/echo -n "Enabled modules: "
5283
./vlc-config --list plugin
5284

5285 5286 5287
dnl Shortcut to nice compile message
rm -f compile
echo '#! /bin/sh' >compile
5288 5289 5290
echo rm -f .error\$\$ >>compile
echo ERROR=0 >>compile
echo export PATH=$PATH LANG=C >>compile
5291
echo "(make V=1 \$@ 2>&1 || touch .error\$\$)| \\" >>compile
5292 5293 5294 5295
echo '`sed -ne "s/^top_srcdir *= *//p" < Makefile`/extras/buildsystem/make.pl' >>compile
echo test -f .error\$\$ \&\& ERROR=1 >>compile
echo rm -f .error\$\$ >>compile
echo exit \$ERROR >>compile
5296 5297
chmod a+x compile

5298
printf "
5299
libvlc configuration
Sam Hocevar's avatar
 
Sam Hocevar committed
5300
--------------------
5301
version               : ${VERSION}
Sam Hocevar's avatar
 
Sam Hocevar committed
5302 5303
system                : ${SYS}
architecture          : ${ARCH}
5304
build flavour         : "
Sam Hocevar's avatar
Sam Hocevar committed
5305 5306 5307 5308 5309
test "${enable_debug}" = "yes" && printf "debug "
test "${enable_cprof}" = "yes" && printf "cprof "
test "${enable_gprof}" = "yes" && printf "gprof "
test "${enable_optimizations}" = "yes" && printf "optim "
test "${enable_release}" = "yes" && printf "release " || printf "devel "
5310 5311 5312 5313 5314 5315 5316
echo ""
if test "${enable_vlc}" != "no"; then
echo "vlc aliases           :${ALIASES}"
else
echo "build vlc executable  : no"
fi
echo "plugins/bindings      :${PLUGINS_BINDINGS}
Sam Hocevar's avatar
 
Sam Hocevar committed
5317

Sam Hocevar's avatar
Sam Hocevar committed
5318
You can tune the compiler flags in vlc-config.
5319
To build vlc and its plugins, type \`./compile' or \`make'.
Sam Hocevar's avatar
 
Sam Hocevar committed
5320
"
5321 5322 5323 5324
if test "x$ac_ld_does_not_support_text_reloc" = "xyes"; then
   echo ""
   echo "Warning: Due to a bug in ld, mmx/sse support has been"
   echo "         turned off."
5325 5326
   echo "         FFmpeg will be REALLY slow."
   echo "         VLC WILL NOT PERFORM AS EXPECTED."
5327 5328
   echo ""
fi