configure.in 59.5 KB
Newer Older
1
dnl Autoconf settings for vlc
Sam Hocevar's avatar
Sam Hocevar committed
2
AC_INIT(include/main.h)
3
AC_CONFIG_HEADER(include/defs.h)
4
AC_CANONICAL_SYSTEM
5

Sam Hocevar's avatar
Sam Hocevar committed
6 7
CONFIGURE_LINE="$0 $*"

8
PACKAGE="vlc"
Sam Hocevar's avatar
Sam Hocevar committed
9 10
VERSION="0.5.0-cvs"
CODENAME="Natalya"
11

Sam Hocevar's avatar
Sam Hocevar committed
12 13 14
dnl
dnl  Save *FLAGS
dnl
15
save_CPPFLAGS="${CPPFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
16
save_CFLAGS="${CFLAGS}"
17
save_LDFLAGS="${LDFLAGS}"
18

Sam Hocevar's avatar
Sam Hocevar committed
19
dnl
20
dnl Check for tools
Sam Hocevar's avatar
Sam Hocevar committed
21
dnl
22
AC_PROG_MAKE_SET
23 24
AC_PROG_CC
AC_PROG_CPP
25

26 27
dnl Find the right ranlib, even when cross-compiling
AC_CHECK_TOOL(RANLIB, ranlib, :)
28
AC_CHECK_TOOL(STRIP, strip, :)
29

Sam Hocevar's avatar
Sam Hocevar committed
30
dnl
31
dnl Check for GNU make
Sam Hocevar's avatar
Sam Hocevar committed
32
dnl
33
AC_PATH_PROG(GMAKE, gmake, no)
34
if test "x${GMAKE}" = "xno"; then
35 36 37 38 39 40 41 42 43 44 45 46 47 48
  AC_CACHE_CHECK([whether GNU make is installed],
      [ac_cv_gmake],
      [if make --version | grep -q -i gnu; then
         ac_cv_gmake="yes"
       else
         echo "This software needs you to install GNU make to compile properly."
         echo "You can get it from http://www.gnu.org/."
         exit
       fi])
  VLC_MAKE="make"
else
  VLC_MAKE="gmake"
fi

49
dnl Gettext stuff
50
ALL_LINGUAS="de en_GB fr ja no ru nl pl se"
51

52 53
AC_DEFINE_UNQUOTED(VLC_PACKAGE, "${PACKAGE}", [Package name])
AC_DEFINE_UNQUOTED(VLC_VERSION, "${VERSION}", [Package version])
54 55
AM_GNU_GETTEXT

56 57 58
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL

Sam Hocevar's avatar
Sam Hocevar committed
59 60 61 62 63
dnl
dnl  Set default LDFLAGS
dnl
vlc_LDFLAGS="${LDFLAGS}"

64 65 66
dnl
dnl  Check the operating system
dnl
67
case "x${target_os}" in
68 69 70 71 72 73 74 75
  x)
    SYS=unknown
    ;;
  xlinux*)
    SYS=linux
    ;;
  xbsdi*)
    SYS=bsdi
76
    save_CFLAGS="${save_CFLAGS} -pthread"; CFLAGS="${save_CFLAGS}"
77 78 79 80 81
    dvd_LDFLAGS="${dvd_LDFLAGS} -ldvd"
    vcd_LDFLAGS="${vcd_LDFLAGS} -ldvd"
    ;;
  x*bsd*)
    SYS="${target_os}"
82
    save_CFLAGS="${save_CFLAGS} -pthread"; CFLAGS="${save_CFLAGS}"
83 84 85
    ;;
  xdarwin*)
    SYS=darwin
86
    save_CFLAGS="${save_CFLAGS} -no-cpp-precomp"; CFLAGS="${save_CFLAGS}"
87
    vlc_LDFLAGS="${vlc_LDFLAGS} -all_load"
88 89 90 91
    ;;
  x*mingw32*)
    SYS=mingw32
    AC_CHECK_TOOL(WINDRES, windres, :)
92
    save_CFLAGS="${save_CFLAGS} -fnative-struct -D_OFF_T_ -D_off_t=long"; CFLAGS="${save_CFLAGS}"
93
    vlc_LDFLAGS="${vlc_LDFLAGS} -mwindows -Xlinker --force-exe-suffix"
94 95
    vlc_LDFLAGS="${vlc_LDFLAGS} -lws2_32 -lnetapi32"
    ipv4_LDFLAGS="${ipv4_LDFLAGS} -lws2_32"
96
    ipv6_LDFLAGS="${ipv6_LDFLAGS} -lws2_32"
97
    http_LDFLAGS="${http_LDFLAGS} -lws2_32"
98
    rc_LDFLAGS="${rc_LDFLAGS} -lws2_32"
99 100 101
    ;;
  x*nto*)
    SYS=nto
102 103
    x11_LDFLAGS="${x11_LDFLAGS} -lsocket"
    xvideo_LDFLAGS="${xvideo_LDFLAGS} -lsocket"
104
    ;;
105 106 107
  xsolaris*)
    SYS=solaris
    ;;
108 109
  xbeos)
    SYS=beos
110
    save_CFLAGS="${save_CFLAGS} -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual"; CFLAGS="${save_CFLAGS}"
111 112 113 114
    vlc_LDFLAGS="${vlc_LDFLAGS} -lbe"
    plugins_LDFLAGS="${plugins_LDFLAGS} -nostart"
    beos_LDFLAGS="${beos_LDFLAGS} -lbe -lgame -lroot -ltracker"
    ipv4_LDFLAGS="${ipv4_LDFLAGS} -lbind"
115 116
    ;;
  x*)
117
    SYS="${target_os}"
118 119 120
    ;;
esac

121
dnl Flags for plugin compilation
122
if test "x${SYS}" = "xmingw32"
123 124 125 126
then
  plugins_CFLAGS="${plugins_CFLAGS} -fnative-struct"
else
  plugins_CFLAGS="${plugins_CFLAGS} -fPIC"
127
  plugins_LDFLAGS="${plugins_LDFLAGS} -fPIC"
128 129 130
fi

dnl The -DSYS_FOO flag
131
save_CFLAGS="${save_CFLAGS} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CFLAGS="${save_CFLAGS}"
132

133
dnl Check for system libs needed
134
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll strndup)
135

136
AC_CHECK_FUNC(connect,,[
137
  AC_CHECK_LIB(socket,connect,
138 139
    ipv4_LDFLAGS="${ipv4_LDFLAGS} -lsocket"
    vlc_LDFLAGS="${vlc_LDFLAGS} -lsocket"
140
)])
Sam Hocevar's avatar
Sam Hocevar committed
141 142 143 144
AC_CHECK_FUNC(send,,[
  AC_CHECK_LIB(socket,send,
    http_LDFLAGS="${http_LDFLAGS} -lsocket"
)])
145
AC_CHECK_FUNC(gethostbyname,,[
146
  AC_CHECK_LIB(nsl,gethostbyname,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lnsl")
147 148
])
AC_CHECK_FUNC(gethostbyname,,[
149
  AC_CHECK_LIB(bind,gethostbyname,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lbind")
150
])
151 152
have_nanosleep=0
AC_CHECK_FUNC(nanosleep,have_nanosleep=1,[
153
  AC_CHECK_LIB(rt,nanosleep,
154
    [vlc_LDFLAGS="${vlc_LDFLAGS} -lrt"; have_nanosleep=1],
155
    [AC_CHECK_LIB(posix4,nanosleep,
156
        [vlc_LDFLAGS="${vlc_LDFLAGS} -lposix4"; have_nanosleep=1])]
157
  )
158
])
159 160 161 162
if test x$have_nanosleep = x1; then
  AC_DEFINE(HAVE_NANOSLEEP, 1,
            Define if nanosleep is available.)
fi
163 164 165
# HP/UX port
AC_CHECK_LIB(rt,sem_init, [vlc_LDFLAGS="${vlc_LDFLAGS} -lrt"])

166
AC_CHECK_FUNC(inet_aton,,[
167
  AC_CHECK_LIB(resolv,inet_aton,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lresolv")
168 169
])
AC_CHECK_FUNC(textdomain,,[
170 171 172 173
  AC_CHECK_LIB(intl,textdomain,
    vlc_LDFLAGS="${vlc_LDFLAGS} -lintl"
    plugins_LDFLAGS="${plugins_LDFLAGS} -lintl"
  )
174
])
175

176
dnl Check for getopt
177
NEED_GETOPT=0
178 179 180
AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
[ # FreeBSD has a gnugetopt library for this:
  AC_CHECK_LIB([gnugetopt],[getopt_long],
181
    [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) vlc_LDFLAGS="${vlc_LDFLAGS} -lgnugetopt"],
182
    [NEED_GETOPT=1])])
183

184
AC_TYPE_SIGNAL
185
AC_CHECK_LIB(dl,dlopen,vlc_LDFLAGS="${vlc_LDFLAGS} -ldl")
186
AC_CHECK_LIB(m,cos,
187 188
  imdct_LDFLAGS="${imdct_LDFLAGS} -lm"
  filter_distort_LDFLAGS="${filter_distort_LDFLAGS} -lm")
189
AC_CHECK_LIB(m,pow,
Sam Hocevar's avatar
Sam Hocevar committed
190
  ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -lm"
191 192 193 194
  imdct_LDFLAGS="${imdct_LDFLAGS} -lm"
  imdct3dn_LDFLAGS="${imdct3dn_LDFLAGS} -lm"
  imdctsse_LDFLAGS="${imdctsse_LDFLAGS} -lm"
  chroma_i420_rgb_LDFLAGS="${chroma_i420_rgb_LDFLAGS} -lm"
195
)
196

197
dnl Check for pthreads - borrowed from XMMS
198
THREAD_LIB=error
199
if test "x${THREAD_LIB}" = "xerror"; then
200
  AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
201
fi
202
if test "x${THREAD_LIB}" = "xerror"; then
203
  AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
204
fi
205
if test "x${THREAD_LIB}" = "xerror"; then
206
  AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
207
fi
208
if test "x${THREAD_LIB}" = "xerror"; then
209
  AC_CHECK_FUNC(pthread_mutex_lock)
210 211
  THREAD_LIB=""
fi
212 213 214

dnl Check for cthreads under GNU/Hurd for instance
AC_CHECK_LIB(threads,cthread_fork,THREAD_LIB="-lthreads")
215

216 217 218
dnl Check for misc headers
AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
  AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
219
            Define if <pthread.h> defines pthread_cond_t.)])
Sam Hocevar's avatar
Sam Hocevar committed
220 221 222
AC_EGREP_HEADER(pthread_once,pthread.h,[
  AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
            Define if <pthread.h> defines pthread_once.)])
223 224
AC_EGREP_HEADER(strncasecmp,strings.h,[
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
225
            Define if <strings.h> defines strncasecmp.)])
226

227
dnl Check for headers
Sam Hocevar's avatar
Sam Hocevar committed
228
AC_CHECK_HEADERS(stdint.h getopt.h strings.h inttypes.h sys/int_types.h)
229
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h)
230 231
AC_CHECK_HEADERS(dlfcn.h image.h)
AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
232
AC_CHECK_HEADERS(machine/param.h sys/shm.h)
233
AC_CHECK_HEADERS(linux/version.h)
234

Sam Hocevar's avatar
Sam Hocevar committed
235 236
AC_HEADER_TIME

237
dnl Mac OS X and other OSes don't have declaration for nanosleep
238 239 240 241
AC_EGREP_HEADER(nanosleep,time.h,[
  AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
            Define if <time.h> defines nanosleep.)
])
242 243

dnl Make sure we have timespecs
244 245 246 247
AC_EGREP_HEADER(timespec,sys/time.h,[
  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
            Define if <sys/time.h> defines struct timespec.)
])
248

249 250 251
dnl Check for threads library
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)

252 253 254 255 256 257 258 259
dnl Default X headers and libraries
if test "x${x_includes}" = "xNONE"; then
  x_includes="/usr/X11R6/include"
fi
if test "x${x_libraries}" = "xNONE"; then
  x_libraries="/usr/X11R6/lib"
fi

260
dnl Check for DPMS
261
if test "x${SYS}" != "xmingw32"
262
then
263
  CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
264 265 266 267 268 269
  AC_CHECK_HEADERS(X11/extensions/dpms.h, [
    AC_EGREP_HEADER(DPMSInfo,X11/extensions/dpms.h,[
      AC_DEFINE(DPMSINFO_IN_DPMS_H, 1,
                Define if <X11/extensions/dpms.h> defines DPMSInfo.)
    ])
  ])
270
  CPPFLAGS="${save_CPPFLAGS}"
271 272
fi

273
dnl Check for ntohl, etc.
274 275 276 277 278 279
AC_CACHE_CHECK([for ntohl in sys/param.h],
    [ac_cv_c_ntohl_sys_param_h],
    [CFLAGS="${save_CFLAGS} -Wall -Werror"
     AC_TRY_COMPILE([#include <sys/param.h>],
        [void foo() { int meuh; ntohl(meuh); }],
        ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
280
if test "x${ac_cv_c_ntohl_sys_param_h}" != "xno"; then
281 282
    AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
fi
283

284
dnl Check for inline function size limit
285 286 287 288
AC_CACHE_CHECK([if \$CC accepts -finline-limit],
    [ac_cv_c_inline_limit],
    [CFLAGS="${save_CFLAGS} -finline-limit-30000"
     AC_TRY_COMPILE([],,ac_cv_c_inline_limit=yes, ac_cv_c_inline_limit=no)])
289 290
if test "x${ac_cv_c_inline_limit}" != "xno"; then
    save_CFLAGS="${save_CFLAGS} -finline-limit-30000"; CFLAGS="${save_CFLAGS}"
291
fi
292

293 294 295
dnl Check for -W or -w flags
AC_CACHE_CHECK([if \$CC accepts -Wall -Winline],
    [ac_cv_c_Wall_Winline],
Sam Hocevar's avatar
Sam Hocevar committed
296
    [CFLAGS="-Wall -Winline ${save_CFLAGS}"
297
     AC_TRY_COMPILE([],,ac_cv_c_Wall_Winline=yes, ac_cv_c_Wall_Winline=no)])
298 299
if test "x${ac_cv_c_Wall_Winline}" != "xno"; then
    save_CFLAGS="-Wall -Winline ${save_CFLAGS}"; CFLAGS="${save_CFLAGS}"
300 301 302
else
    AC_CACHE_CHECK([if \$CC accepts -wall -winline],
        [ac_cv_c_wall_winline],
Sam Hocevar's avatar
Sam Hocevar committed
303
        [CFLAGS="-wall -winline ${save_CFLAGS}"
304
         AC_TRY_COMPILE([],,ac_cv_c_wall_winline=yes, ac_cv_c_wall_winline=no)])
305 306
    if test "x${ac_cv_c_wall_winline}" != "xno"; then
        save_CFLAGS="-wall -winline ${save_CFLAGS}"; CFLAGS="${save_CFLAGS}"
307 308 309 310 311 312 313 314
    fi
fi

dnl Check for -pipe
AC_CACHE_CHECK([if \$CC accepts -pipe],
    [ac_cv_c_pipe],
    [CFLAGS="${save_CFLAGS} -pipe"
     AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
315 316
if test "x${ac_cv_c_pipe}" != "xno"; then
    save_CFLAGS="${save_CFLAGS} -pipe"; CFLAGS="${save_CFLAGS}"
317 318 319 320 321 322 323
fi

dnl Check for various optimization flags
AC_CACHE_CHECK([if \$CC accepts -O3],
    [ac_cv_c_o3],
    [CFLAGS="${save_CFLAGS} -O3"
     AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
324
if test "x${ac_cv_c_o3}" != "xno"; then
325 326 327 328 329 330
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
else
    AC_CACHE_CHECK([if \$CC accepts -O2],
        [ac_cv_c_o2],
        [CFLAGS="${save_CFLAGS} -O2"
         AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)])
331
    if test "x${ac_cv_c_o2}" != "xno"; then
332 333 334 335 336 337
        CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
    else
        AC_CACHE_CHECK([if \$CC accepts -O],
            [ac_cv_c_o],
            [CFLAGS="${save_CFLAGS} -O"
             AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
338
        if test "x${ac_cv_c_o}" != "xno"; then
339 340 341 342 343 344 345 346 347 348
            CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
        fi
    fi
fi

dnl Check for -ffast-math
AC_CACHE_CHECK([if \$CC accepts -ffast-math],
    [ac_cv_c_fast_math],
    [CFLAGS="${save_CFLAGS} -ffast-math"
     AC_TRY_COMPILE([],,ac_cv_c_fast_math=yes, ac_cv_c_fast_math=no)])
349
if test "x${ac_cv_c_fast_math}" != "xno"; then
350 351 352 353 354 355 356 357
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
fi

dnl Check for -funroll-loops
AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
    [ac_cv_c_unroll_loops],
    [CFLAGS="${save_CFLAGS} -funroll-loops"
     AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)])
358
if test "x${ac_cv_c_unroll_loops}" != "xno"; then
359 360 361 362 363 364 365 366
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
fi

dnl Check for -fomit-frame-pointer
AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
    [ac_cv_c_omit_frame_pointer],
    [CFLAGS="${save_CFLAGS} -fomit-frame-pointer"
     AC_TRY_COMPILE([],,ac_cv_c_omit_frame_pointer=yes, ac_cv_c_omit_frame_pointer=no)])
367
if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
368
    CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
Sam Hocevar's avatar
Sam Hocevar committed
369 370
    # this plugin does not compile without -fomit-frame-pointer, damn gcc!
    chroma_i420_yuy2_mmx_CFLAGS="${chroma_i420_yuy2_mmx_CFLAGS} -fomit-frame-pointer"
371 372
fi

Sam Hocevar's avatar
Sam Hocevar committed
373
dnl Check for Darwin plugin linking flags
374
AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
375
    [ac_cv_ld_darwin],
376
    [CFLAGS="${save_CFLAGS} -bundle -undefined error -lcc_dynamic"
377
     AC_TRY_COMPILE([],,ac_cv_ld_darwin=yes, ac_cv_ld_darwin=no)])
378
if test "x${ac_cv_ld_darwin}" != "xno"; then
379
    plugins_LDFLAGS="${plugins_LDFLAGS} -bundle -undefined error -lcc_dynamic"
380
fi
Sam Hocevar's avatar
Sam Hocevar committed
381 382

dnl Check for standard plugin linking flags
383 384 385 386
AC_CACHE_CHECK([if \$CC accepts -shared],
    [ac_cv_ld_plugins],
    [CFLAGS="${save_CFLAGS} -shared"
     AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
387
if test "x${ac_cv_ld_plugins}" != "xno"; then
388
    plugins_LDFLAGS="${plugins_LDFLAGS} -shared"
389
fi
390
        
391 392 393 394 395 396 397 398 399 400
dnl Check for variadic macros
AC_CACHE_CHECK([for variadic cpp macros],
    [ac_cv_cpp_variadic_macros],
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(
         [#include <stdio.h>
          #define a(b,c...) printf(b,##c)],
         [a("foo");a("%s","bar");a("%s%s","baz","quux");],
         ac_cv_cpp_variadic_macros=yes,
         ac_cv_cpp_variadic_macros=no)])
401
if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
402 403 404
    AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
fi

405 406 407 408
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
    [ac_cv_c_attribute_aligned],
    [ac_cv_c_attribute_aligned=0
409
        CFLAGS="${save_CFLAGS} -Werror"
410 411
    for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
        AC_TRY_COMPILE([],
412 413 414 415 416
        [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="${save_CFLAGS}"])
if test "x${ac_cv_c_attribute_aligned}" != "x0"; then
417
    AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
418
        [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
419 420
fi

421 422 423
dnl
dnl  Check the CPU
dnl
424
case "x${target_cpu}" in
425 426 427 428
  x)
    ARCH=unknown
    ;;
  *)
429
    ARCH="${target_cpu}"
430 431
    ;;
esac
432 433 434 435

dnl
dnl  default modules
dnl
Sam Hocevar's avatar
Sam Hocevar committed
436 437
BUILTINS="${BUILTINS} idct idctclassic motion imdct downmix mpeg_adec ac3_adec mpeg_vdec"
PLUGINS="${PLUGINS} dummy null rc logger mpeg_es mpeg_audio mpeg_ps mpeg_ts file udp http ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort filter_clone filter_crop fx_scope chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga"
438 439 440 441

dnl
dnl  Accelerated modules
dnl
442
MMX_MODULES="memcpymmx idctmmx motionmmx chroma_i420_rgb_mmx chroma_i420_yuy2_mmx chroma_i422_yuy2_mmx chroma_i420_ymga_mmx"
443 444
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
445
SSE_MODULES="imdctsse downmixsse"
446
ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec"
447

448 449
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
Sam Hocevar's avatar
Sam Hocevar committed
450 451
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
452
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
453
if test "x${ac_cv_mmx_inline}" != "xno"; then
454
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
455
fi
456

457 458
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
Sam Hocevar's avatar
Sam Hocevar committed
459 460
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
461
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
462
if test "x${ac_cv_mmxext_inline}" != "xno"; then
463
  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
464
fi
465

466 467
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
Sam Hocevar's avatar
Sam Hocevar committed
468 469
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
470
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
471
if test "x${ac_cv_3dnow_inline}" != "xno"; then
472
  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
473
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
474
fi
475

476 477
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
Sam Hocevar's avatar
Sam Hocevar committed
478 479
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
480
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
481
if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
482
  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
483
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
484
fi
485

Sam Hocevar's avatar
Sam Hocevar committed
486
# don't try to grok AltiVec with native mingw32 it doesn't work right now
487
# we should be able to remove this test with future versions of mingw32
488
if test "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
Sam Hocevar committed
489
AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
490
    [ac_cv_altivec_inline],
Sam Hocevar's avatar
Sam Hocevar committed
491 492
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
493
         ac_cv_altivec_inline=yes,
494
         [CFLAGS="${save_CFLAGS} -Wa,-m7400"
495
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
496
            [ac_cv_altivec_inline="-Wa,-m7400"],
497
            ac_cv_altivec_inline=no)
498
         ])])
499
if test "x${ac_cv_altivec_inline}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
500
  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
501 502 503 504 505
  if test "x${ac_cv_altivec_inline}" != "xyes"; then
    idctaltivec_CFLAGS="${idctaltivec_CFLAGS} ${ac_cv_altivec_inline}"
    motionaltivec_CFLAGS="${motionaltivec_CFLAGS} ${ac_cv_altivec_inline}"
    memcpyaltivec_CFLAGS="${memcpyaltivec_CFLAGS} ${ac_cv_altivec_inline}"
    vlc_CFLAGS="${vlc_CFLAGS} ${ac_cv_altivec_inline}"
506
  fi
507
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
508
fi
509

Sam Hocevar's avatar
Sam Hocevar committed
510
AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
511
    [ac_cv_c_altivec],
512
    [CFLAGS="${save_CFLAGS} -faltivec"
513
     # Darwin test
514
     AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
515 516
        ac_cv_c_altivec=-faltivec, [
        # Linux/PPC test
517
        CFLAGS="${save_CFLAGS} ${idctaltivec_CFLAGS} -fvec"
518
        AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
519 520
            [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
        ])
521 522
     CFLAGS="${save_CFLAGS}"])
if test "x${ac_cv_c_altivec}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
523
  AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
524 525 526 527
  idctaltivec_CFLAGS="${idctaltivec_CFLAGS} ${ac_cv_c_altivec}"
  motionaltivec_CFLAGS="${motionaltivec_CFLAGS} ${ac_cv_c_altivec}"
  memcpyaltivec_CFLAGS="${memcpyaltivec_CFLAGS} ${ac_cv_c_altivec}"
  vlc_CFLAGS="${vlc_CFLAGS} ${ac_cv_c_altivec}"
528
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
529 530 531 532
fi

AC_CACHE_CHECK([if linker needs -framework vecLib],
    [ac_cv_ld_altivec],
533
    [LDFLAGS="${vlc_LDFLAGS} -framework vecLib"
534
     AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
535
     LDFLAGS="${save_LDFLAGS}"
536
    ])
537
if test "x${ac_cv_ld_altivec}" != "xno"; then
538 539 540 541
  idctaltivec_LDFLAGS="${idctaltivec_LDFLAGS} -framework vecLib"
  motionaltivec_LDFLAGS="${motionaltivec_LDFLAGS} -framework vecLib"
  memcpyaltivec_LDFLAGS="${memcpyaltivec_LDFLAGS} -framework vecLib"
  vlc_LDFLAGS="${vlc_LDFLAGS} -framework vecLib"
542
fi
543
fi # end if mingw32
544 545


546 547 548
AC_ARG_WITH(,[])
AC_ARG_WITH(,[Optimization options:])

549
dnl
550
dnl  Special arch tuning
551
dnl
552
AC_ARG_WITH(tuning,
553
[  --with-tuning=ARCH      enable special tuning for an architecture
554
                          (default i686 on IA-32 and 750 on PPC)])
555 556
if test "x${with_tuning}" != "x"; then
    TUNING="${with_tuning}"
557
else
558
    if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xi486" -o "x${target_cpu}" = "xi386"; then TUNING="pentiumpro"
559
    else
560
        if test "x${target_cpu}" = "xpowerpc"; then TUNING="750"; fi
561 562
    fi
fi
563 564

dnl
565
dnl  x86 accelerations
566
dnl
567
if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xx86" -o "x${target_cpu}" = "xi386"
568 569
then
    ARCH="${ARCH} mmx"
Sam Hocevar's avatar
Sam Hocevar committed
570
    PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
571
fi
572

573 574 575 576 577
dnl
dnl  Enable/disable optimizations
dnl
AC_ARG_ENABLE(optimizations,
[  --disable-optimizations disable compiler optimizations (default enabled)],
578
[ if test "x${enable_optimizations}" = "xno"; then OPTIMS=0; fi ],
579 580
[ OPTIMS=1 ])

581 582 583
dnl
dnl  AltiVec acceleration
dnl
584
AC_ARG_ENABLE(altivec,
Sam Hocevar's avatar
Sam Hocevar committed
585
[  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
586
[ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
587
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
588
[ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
589
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
590 591 592 593

dnl
dnl  Debugging mode
dnl
594
DEBUG=0
595
AC_ARG_ENABLE(debug,
596
[  --enable-debug          debug mode (default disabled)],
597
[ if test "x${enable_debug}" = "xyes"; then DEBUG=1; fi ])
598

599
dnl
600
dnl  Enable release-specific flags
601
dnl
602
RELEASE=0
603 604
AC_ARG_ENABLE(release,
[  --enable-release        activate extra optimizations (default disabled)],
605
[ if test "x${enable_release}" = "xyes"; then RELEASE=1; fi ],
606
[ VERSION="${VERSION}_`date +%Y-%m-%d`" ])
607

608
dnl
609
dnl  Input plugins
610 611
dnl

612
AC_ARG_WITH(,[Input plugins:])
613 614

dnl
615 616 617 618
dnl  DVD module: optionally check for installed libdvdcss
dnl
AC_ARG_ENABLE(dvd,
[  --enable-dvd            DVD input module (default enabled)])
619
if test "x${enable_dvd}" != "xno"
620 621 622
then
  AC_ARG_WITH(dvdcss, 
  [    --with-dvdcss=PATH    libdvdcss headers and libraries])
623 624
  AC_ARG_WITH(dvdcss-tree, 
  [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
625
  case "x${with_dvdcss}" in
626
  x|xyes)
627
    if test "x${with_dvdcss_tree}" = x
628 629 630
    then
      AC_CHECK_HEADERS(dvdcss/dvdcss.h,
        [ PLUGINS="${PLUGINS} dvd"
631
          dvd_LDFLAGS="${dvd_LDFLAGS} -ldvdcss" ],
632 633 634 635 636
        [ AC_MSG_WARN([libdvdcss is no longer provided with vlc; please get libdvdcss from http://www.videolan.org/libdvdcss/ and build it. Then either use --with-dvdcss=<path/where/libdvdcss/was/installed> for dynamic linking (recommended under Unix) or --with-dvdcss-tree=<path/where/libdvdcss/was/built> for static linking (recommended under BeOS, Windows, MacOS X). Alternatively you can use --disable-dvd to disable the DVD plugin.])
          AC_MSG_ERROR([cannot find libdvdcss headers]) ])
    else
      AC_MSG_CHECKING(for libdvdcss.a in ${with_dvdcss_tree})
      real_dvdcss_tree="`cd ${with_dvdcss_tree} 2>/dev/null && pwd`"
637
      if test "x${real_dvdcss_tree}" = "x"
638 639 640 641 642 643 644 645 646 647
      then
        dnl  The given directory can't be found
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot cd to ${with_dvdcss_tree}])
      fi
      if test -f "${real_dvdcss_tree}/src/.libs/libdvdcss.a"
      then
        dnl  Use a custom libdvdcss
        AC_MSG_RESULT(${real_dvdcss_tree}/src/.libs/libdvdcss.a)
        BUILTINS="${BUILTINS} dvd"
648 649
        dvd_LDFLAGS="${dvd_LDFLAGS} ${real_dvdcss_tree}/src/.libs/libdvdcss.a"
        dvd_CFLAGS="${dvd_CFLAGS} -I${real_dvdcss_tree}/src"
650 651 652 653 654 655
      else
        dnl  The given libdvdcss wasn't built
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot find ${real_dvdcss_tree}/src/.libs/libdvdcss.a, make sure you compiled libdvdcss in ${with_dvdcss_tree}])
      fi
    fi
656 657
  ;;
  xno)
658
    dnl  Compile without dvdcss (dlopen version, works only under Linux)
659
    PLUGINS="${PLUGINS} dvd"
660 661
    dvd_CFLAGS="${dvd_CFLAGS} -DGOD_DAMN_DMCA"
    dvd_LDFLAGS="${dvd_LDFLAGS} -ldl"
662 663
  ;;
  *)
664 665
    AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
    if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
666
    then
667
      dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
668
      AC_MSG_RESULT(yes)
669
      PLUGINS="${PLUGINS} dvd"
670 671
      dvd_LDFLAGS="${dvd_LDFLAGS} -L${with_dvdcss}/lib -ldvdcss"
      dvd_CFLAGS="${dvd_CFLAGS} -I${with_dvdcss}/include"
672
    else
673
      dnl  No libdvdcss could be found, sorry
674
      AC_MSG_RESULT(no)
675
      AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
676 677 678 679
    fi
  ;;
  esac
fi
680

681
dnl
682
dnl dvdread module: check for libdvdread plugin
683
dnl
684 685
AC_ARG_ENABLE(dvdread,
[  --enable-dvdread        dvdread input module (default disabled)])
686
if test "x${enable_dvdread}" != "xno"
687 688 689
then
  AC_ARG_WITH(dvdread, 
  [    --with-dvdread=PATH   libdvdread headers and libraries])
690
  if test "x${with_dvdread}" = "x"
691 692 693 694
  then
    test_LDFLAGS=""
    test_CFLAGS=""
  else
695 696
    test_LDFLAGS="-L${with_dvdread}/lib"
    test_CFLAGS="-I${with_dvdread}/include"
697
  fi
698
  CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
699 700 701 702 703 704 705
  AC_CHECK_HEADERS(dvdread/dvd_reader.h, [
     AC_TRY_COMPILE([#include <dvdread/dvd_reader.h>],
        [void foo() { int i=DVD_VIDEO_LB_LEN; }],[
          PLUGINS="${PLUGINS} dvdread"
          dvdread_LDFLAGS="${dvdread_LDFLAGS} ${test_LDFLAGS} -ldvdread"
          dvdread_CFLAGS="${dvdread_CFLAGS} ${test_CFLAGS}"
        ],[
706
          if test "x${enable_dvdread}" != "x"
707 708 709 710 711
          then
            AC_MSG_ERROR([Cannot find DVD_VIDEO_LB_LEN in dvdread/dvd_reader.h, please install libdvdread version 0.9.2 or later])
          fi
        ])
  ],[
712
    if test "x${enable_dvdread}" != "x"
713
    then
714
      if test "x${with_dvdread}" != "x"
715
      then
716
        AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h in ${with_dvdread}/include])
717 718 719
      else
        AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h])
      fi
720
    fi
721
  ])
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757
  CPPFLAGS="$save_CPPFLAGS"
fi

dnl
dnl dvdplay module: check for libdvdplay
dnl
AC_ARG_ENABLE(dvdplay,
[  --enable-dvdplay        dvdplay input module (default disabled)])
if test "x$enable_dvdplay" != "xno"
then
  AC_ARG_WITH(dvdplay, 
  [    --with-dvdplay=PATH   libdvdplay headers and libraries])
  if test "x$with_dvdplay" = x
  then
    test_LDFLAGS=""
    test_CFLAGS=""
  else
    test_LDFLAGS="-L${with_dvdplay}/lib"
    test_CFLAGS="-I${with_dvdplay}/include"
  fi
  CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
  AC_CHECK_HEADERS(dvdplay/dvdplay.h, [
      PLUGINS="${PLUGINS} dvdplay"
      dvdplay_LDFLAGS="${dvdplay_LDFLAGS} ${test_LDFLAGS} -ldvdplay -ldvdread"
      dvdplay_CFLAGS="${dvdplay_CFLAGS} ${test_CFLAGS}"
    ],[
    if test "x$enable_dvdplay" != x
    then
      if test "x$with_dvdplay" != x
      then
        AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h in ${with_dvdplay}/include])
      else
        AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h])
      fi
    fi
  ])
758
  CPPFLAGS="${save_CPPFLAGS}"
759
fi
760

761

762 763 764 765 766
dnl
dnl  libdvbpsi ts demux
dnl
AC_ARG_ENABLE(dvbpsi,
[  --enable-dvbpsi        dvbpsi ts demux module (default disabled)])
767
if test "x${enable_dvbpsi}" != "xno"
768
then
769 770
  AC_ARG_WITH(dvbpsi, 
  [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
771 772
  AC_ARG_WITH(dvbpsi,
  [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
773
  case "x${with_dvbpsi}" in
774
  x|xyes)
775
    if test "x${with_dvbpsi_tree}" = "x"
776
    then
Sam Hocevar's avatar
Sam Hocevar committed
777 778
      AC_CHECK_HEADERS(dvbpsi/dr.h,
        [ PLUGINS="${PLUGINS} mpeg_ts_dvbpsi"
779 780 781 782 783
          mpeg_ts_dvbpsi_LDFLAGS="${mpeg_ts_dvbpsi_LDFLAGS} -ldvbpsi" ], [],
        [  AC_MSG_ERROR([cannot find libdvbpsi headers]) ])
    else
      AC_MSG_CHECKING(for libdvbpsi.a in ${with_dvbpsi_tree})
      real_dvbpsi_tree="`cd ${with_dvbpsi_tree} 2>/dev/null && pwd`"
784
      if test "x${real_dvbpsi_tree}" = "x"
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801
      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)
        BUILTINS="${BUILTINS} mpeg_ts_dvbpsi"
        mpeg_ts_dvbpsi_LDFLAGS="${mpeg_ts_dvbpsi_LDFLAGS} ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
        mpeg_ts_dvbpsi_CFLAGS="${mpeg_ts_dvbpsi_CFLAGS} -I${real_dvbpsi_tree}/src"
      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
802
    fi
803 804 805 806 807 808
  ;;
  xno)
    dnl  Compile without dvbpsi (dlopen version, works only under Linux)
  ;;
  *)
    AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
809
    if test "x${with_dvbpsi}" = "x"
810 811 812 813 814 815 816
    then
      test_LDFLAGS=""
      test_CFLAGS=""
    else
      test_LDFLAGS="-L${with_dvbpsi}/lib"
      test_CFLAGS="-I${with_dvbpsi}/include"
    fi
817
    CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
818 819 820 821 822
    AC_CHECK_HEADER([dvbpsi/dr.h],[
      PLUGINS="${PLUGINS} mpeg_ts_dvbpsi"
      mpeg_ts_dvbpsi_LDFLAGS="${mpeg_ts_dvbpsi_LDFLAGS} ${test_LDFLAGS} -ldvbpsi"
      mpeg_ts_dvbpsi_CFLAGS="${mpeg_ts_dvbpsi_CFLAGS} ${test_CFLAGS}"
      ],[
823
      if test "x${enable_dvbpsi}" != "x"
824 825 826 827
      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
    ])
828
    CPPFLAGS="${save_CPPFLAGS}"
829 830
  ;;
  esac
831
fi
832

833
dnl
834
dnl  VCD module
835 836
dnl
AC_ARG_ENABLE(vcd,
837
  [  --enable-vcd            VCD support for Linux, FreeBSD and MacOS X (default enabled)])
838

839
if test "x${enable_vcd}" != "xno"
840 841
then
  AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
842
    PLUGINS="${PLUGINS} vcd"
843
  ])
844 845
  
  AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
846
    PLUGINS="${PLUGINS} vcd"
847 848
    AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
  ])
849
  
850 851 852 853
  if test "x${SYS}" = "xbsdi"
  then
    PLUGINS="${PLUGINS} vcd"
  fi
854

855 856
  if test "x${SYS}" = "xdarwin"
  then
857
    # No need to add vcd to PLUGINS, Darwin is already based on FreeBSD
858
    vcd_LDFLAGS="${vcd_LDFLAGS} -framework IOKit -framework CoreFoundation" 
859
  fi
860 861
fi

Johan Bilien's avatar
Johan Bilien committed
862 863 864 865
dnl
dnl  Satellite input module
dnl
AC_ARG_ENABLE(satellite,
866
  [  --enable-satellite      satellite card support (default disabled)],
867
  [ if test "x${enable_satellite}" = "xyes"
Johan Bilien's avatar
Johan Bilien committed
868
    then
869
      PLUGINS="${PLUGINS} satellite"
Johan Bilien's avatar
Johan Bilien committed
870 871
    fi])

872
dnl
873
dnl  ipv6 plugin - not for QNX yet
874
dnl
875
if test "x${SYS}" != "xnto" && test "x${SYS}" != "xmingw32"
876
then
877 878
  have_ipv6=0
  AC_CHECK_FUNC(inet_pton,[have_ipv6=1],[
879
    AC_CHECK_LIB(resolv,inet_pton,
880
      [have_ipv6=1
881 882
       ipv6_LDFLAGS="${ipv6_LDFLAGS} -lresolv"])
  ])
883 884 885 886 887 888
  AC_MSG_CHECKING(for sockaddr_in6 in netinet/in.h)
  AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,
    [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); have_ipv6=0])
  if test x$have_ipv6 = x1; then
    PLUGINS="${PLUGINS} ipv6"
  fi
889
fi
890
if test "x${SYS}" = "xmingw32"
891 892 893 894 895
then
  AC_MSG_CHECKING(for getaddrinfo in ws2tcpip.h)
  AC_EGREP_HEADER(addrinfo,ws2tcpip.h,[AC_MSG_RESULT(yes)
    PLUGINS="${PLUGINS} ipv6"],[AC_MSG_RESULT(no)])
fi
896

897 898 899 900 901
dnl
dnl  AVI demux plugin
dnl
AC_ARG_ENABLE(avi,
  [  --enable-avi            AVI demux module (default enabled)])
902
if test "x${enable_avi}" != "xno"
903 904 905 906
then
  PLUGINS="${PLUGINS} avi"
fi

907
dnl
908
dnl  Codec plugins
909
dnl
910

911
AC_ARG_WITH(,[Codec plugins:])
912

913
dnl
914
dnl  mad plugin
915
dnl
916 917
AC_ARG_ENABLE(mad,
  [  --enable-mad            libmad module (default disabled)])
918
if test "x${enable_mad}" = "xyes"
919 920
then
  AC_ARG_WITH(mad,
921
    [    --with-mad=PATH       path to libmad],[],[])
922
  if test "x${with_mad}" != "xno" -a "x${with_mad}" != "x"
923
  then
924 925
    mad_CFLAGS="${mad_CFLAGS} -I${with_mad}/include"
    mad_LDFLAGS="${mad_LDFLAGS} -L${with_mad}/lib"
926 927 928 929
  fi

  AC_ARG_WITH(mad-tree,
    [    --with-mad-tree=PATH  mad tree for static linking],[],[])
930
  if test "x${with_mad_tree}" != "xno" -a "x${with_mad_tree}" != "x"
931 932
  then
    real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
933
    if test "x${real_mad_tree}" = "x"
934 935 936 937 938 939 940 941 942 943 944 945
    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}/libmad)
    if test -f ${real_mad_tree}/libmad/mad.h
    then
      AC_MSG_RESULT(yes)
      mad_CFLAGS="${mad_CFLAGS} -I${real_mad_tree}/libmad"
      mad_LDFLAGS="${mad_LDFLAGS} -L${real_mad_tree}/libmad/.libs"
946
      LDFLAGS="${save_LDFLAGS} ${mad_LDFLAGS}"
947 948 949 950 951
      AC_CHECK_LIB(mad, mad_bit_init, [
        BUILTINS="${BUILTINS} mad"
        mad_LDFLAGS="${mad_LDFLAGS} -lmad"
        ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
      ],[])
952
      LDFLAGS="${save_LDFLAGS}"
953 954 955 956 957
    else
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([the specified tree doesn't have mad.h])
    fi
  else
958 959
    CFLAGS="${save_CFLAGS} ${mad_CFLAGS}"
    LDFLAGS="${save_LDFLAGS} ${mad_LDFLAGS}"
960 961
    AC_CHECK_HEADERS(mad.h, ,
      [ AC_MSG_ERROR([Cannot find development headers for libmad...]) ])
962
    AC_CHECK_LIB(mad, mad_bit_init, [
963
      PLUGINS="${PLUGINS} mad"
964
      mad_LDFLAGS="${mad_LDFLAGS} -lmad" ],
965
      [ AC_MSG_ERROR([Cannot find libmad library...]) ])
966 967
    CFLAGS="${save_CFLAGS}"
    LDFLAGS="${save_LDFLAGS}"
968
  fi
969
fi
970

971 972 973 974 975
dnl
dnl  ffmpeg decoder plugin
dnl
AC_ARG_ENABLE(ffmpeg,
[  --enable-ffmpeg         ffmpeg codec (default disabled)])
976
if test "x${enable_ffmpeg}" = "xyes"
977
then
978 979
  AC_ARG_WITH(ffmpeg,
    [    --with-ffmpeg=PATH    path to ffmpeg installation],[],[])
980
  if test "x${with_ffmpeg}" != "xno" -a "x${with_ffmpeg}" != "x"
981
  then
982 983
    ffmpeg_CFLAGS="${ffmpeg_CFLAGS} -I${with_ffmpeg}/include/libffmpeg"
    ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -L${with_ffmpeg}/lib"
984 985
  fi

986 987
  AC_ARG_WITH(ffmpeg-tree, 
  [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
988
  if test "x${with_ffmpeg_tree}" != "x"
989 990 991
  then
    AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
    real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
992
    if test "x${real_ffmpeg_tree}" = x
993 994 995 996 997 998 999 1000 1001 1002
    then
      dnl  The given directory can't be found
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
    fi
    if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"
    then
      dnl  Use a custom libffmpeg
      AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
      BUILTINS="${BUILTINS} ffmpeg"
1003
      ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} ${real_ffmpeg_tree}/libavcodec/libavcodec.a -lm"
1004 1005 1006 1007 1008 1009
      ffmpeg_CFLAGS="${ffmpeg_CFLAGS} -I${real_ffmpeg_tree}/libavcodec"
    else
      dnl  The given libavcodec wasn't built
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
    fi
1010
  else
1011 1012
    CFLAGS="${save_CFLAGS} ${ffmpeg_CFLAGS}"
    LDFLAGS="${save_LDFLAGS} ${ffmpeg_LDFLAGS} -lm"
1013 1014
    AC_CHECK_LIB(avcodec, avcodec_init, [
      BUILTINS="${BUILTINS} ffmpeg"
1015
      ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -lavcodec -lm" ],
1016
      [ AC_MSG_ERROR([Cannot find libavcodec library...]) ])
1017 1018
    LDFLAGS="${save_LDFLAGS}"
    CFLAGS="${save_CFLAGS}"
1019 1020 1021
  fi
fi

1022
dnl 
1023
dnl MP4 module 
1024 1025
dnl 
AC_ARG_ENABLE(mp4,
1026
  [  --enable-mp4            MP4 demux module (default disabled)])
1027 1028 1029 1030 1031 1032 1033 1034 1035
if test "x${enable_mp4}" = "xyes"
then
    AC_CHECK_HEADER(zlib.h,
        AC_CHECK_LIB(z, inflateEnd,
            [ PLUGINS="${PLUGINS} mp4"
              mp4_LDFLAGS="${mp4_LDFLAGS} -lz" ], 
            [ AC_MSG_ERROR([cannot find zlib library...]) ]),
        [  AC_MSG_ERROR([cannot find zlib header...]) ])
fi
1036

1037
dnl special case for BeOS
1038
if test "x${SYS}" = "xbeos"
1039
then
1040
    PLUGINS="${PLUGINS} beos"
1041
fi
1042

1043
dnl
1044
dnl  a52 AC3 decoder plugin
1045
dnl
1046
AC_ARG_ENABLE(a52,
1047
  [  --enable-a52            AC3 support with liba52 (default enabled)])
1048
if test "x${enable_a52}" != "xno"
1049 1050 1051
then
  AC_ARG_WITH(a52-tree,
    [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
1052
  if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x"
1053
  then
1054
    real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
1055
    if test "x${real_a52_tree}" = "x"
1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067
    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)
      a52_CFLAGS="${a52_CFLAGS} -I${real_a52_tree}"
      a52_LDFLAGS="${a52_LDFLAGS} -L${real_a52_tree}/liba52/.libs"
1068
      LDFLAGS="${save_LDFLAGS} ${a52_LDFLAGS}"
1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080
      AC_CHECK_LIB(a52, a52_free, [
        BUILTINS="${BUILTINS} a52"
        a52_LDFLAGS="${a52_LDFLAGS} -la52 -lm"
        a52_CFLAGS="${a52_CFLAGS} -DUSE_A52DEC_TREE"
        ],[
        if test -f ${real_a52_tree}/liba52/.libs/liba52.a
        then
          AC_MSG_ERROR([make sure you have at least a52dec-0.7.3])
        else
          AC_MSG_ERROR([the specified tree hasn't been compiled])
        fi
      ],[-lm])
1081
      LDFLAGS="${save_LDFLAGS}"
1082 1083 1084 1085 1086
    else
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([the specified tree doesn't have a52.h])
    fi
  else dnl  no with args
1087
    AC_CHECK_HEADERS(a52dec/a52.h, [
1088 1089 1090 1091 1092 1093 1094
      AC_CHECK_LIB(a52, a52_free, [
        BUILTINS="${BUILTINS} a52"
        a52_LDFLAGS="${a52_LDFLAGS} -la52 -lm"
        a52_CFLAGS="${a52_CFLAGS}"
      ],[],[-lm])
    ])
  fi
1095 1096
fi

1097 1098 1099 1100 1101 1102 1103 1104 1105 1106
dnl
dnl  cinepak plugin
dnl
AC_ARG_ENABLE(cinepak,
  [  --enable-cinepak        Cinepak decoder (default enabled)])
if test "x${enable_cinepak}" != "xno"
then
  PLUGINS="${PLUGINS} cinepak"
fi

1107 1108 1109 1110
dnl
dnl  ogg vorbis plugin
dnl
AC_ARG_ENABLE(vorbis,
1111
  [  --enable-vorbis         Ogg/Vorbis decoder support (default enabled)])
1112
if test "x${enable_vorbis}" != "xno"
1113 1114
then
  AC_CHECK_HEADERS(ogg/ogg.h, [
1115 1116
    dnl disabled for the moment
    #PLUGINS="${PLUGINS} vorbis"
1117
    vorbis_LDFLAGS="${vorbis_LDFLAGS} -lvorbis"
1118 1119 1120
   ],[])
fi

1121
dnl
1122
dnl  Video plugins
1123 1124
dnl

1125
AC_ARG_WITH(,[Video plugins:])
1126

1127
dnl
1128 1129
dnl  X11 module
dnl  (enabled by default except on win32)
1130
dnl
1131
AC_ARG_ENABLE(x11,
1132
  [  --enable-x11            X11 support (default enabled)])
1133 1134 1135
if test "x${enable_x11}" != "xno" &&
  (test "x${SYS}" != "xmingw32" || test "x${enable_x11}" = "xyes"); then
  CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
1136 1137
  AC_CHECK_HEADERS(X11/Xlib.h, [
    PLUGINS="${PLUGINS} x11"
1138 1139
    x11_LDFLAGS="${x11_LDFLAGS} -L${x_libraries} -lX11 -lXext"
    x11_CFLAGS="${x11_CFLAGS} -I${x_includes}"
1140
  ])
1141
  CPPFLAGS="${save_CPPFLAGS}"
1142 1143 1144 1145 1146 1147 1148
fi

dnl
dnl  XVideo module
dnl  (enabled by default except on win32)
dnl
AC_ARG_ENABLE(xvideo,
1149
  [  --enable-xvideo         XVideo support (default enabled)])
1150 1151 1152
if test "x${enable_xvideo}" != "xno" &&
  (test "x${SYS}" != "xmingw32" || test "x${enable_xvideo}" = "xyes"); then
  CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
1153
  AC_CHECK_HEADERS(X11/extensions/Xv.h, [
1154
    CFLAGS="${save_CFLAGS} -L${x_libraries} -lX11 -lXext"
1155
    AC_CHECK_LIB(Xv_pic,XvPutImage,
1156 1157
      # We have Xv_pic, that's good, we can build an xvideo.so plugin !
      PLUGINS="${PLUGINS} xvideo"
1158 1159
      xvideo_LDFLAGS="${xvideo_LDFLAGS} -L${x_libraries} -lX11 -lXext -lXv_pic"
      xvideo_CFLAGS="${xvideo_CFLAGS} -I${x_includes}",
1160 1161 1162
      AC_CHECK_LIB(Xv,XvPutImage,
        # We don't have Xv_pic, but we have Xv, let's make xvideo.a as builtin
        PLUGINS="${PLUGINS} xvideo"
1163 1164
        xvideo_LDFLAGS="${xvideo_LDFLAGS} -L${x_libraries} -lX11 -lXext -lXv"
        xvideo_CFLAGS="${xvideo_CFLAGS} -I${x_includes}",
1165 1166 1167
        # Otherwise... well, do nothing.
      )
    )
1168
    CFLAGS="${save_CFLAGS}"
1169
  ]
1170
  CPPFLAGS="${save_CPPFLAGS}")
1171
fi
1172 1173 1174 1175

dnl
dnl  SDL module
dnl
1176
AC_ARG_ENABLE(sdl,
1177
  [  --enable-sdl            SDL support (default enabled)])
1178
if test "x${enable_sdl}" != "xno"
1179
then
1180
  SDL_PATH="${PATH}"
1181
  AC_ARG_WITH(sdl-config-path,
1182
    [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
1183
    [ if test "x${with_sdl_config_path}" != "xno"
1184
      then
1185
        SDL_PATH="${with_sdl_config_path}:${PATH}"
1186
      fi ])
1187 1188
  AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, ${SDL_PATH})
  SDL_CONFIG="${SDL12_CONFIG}"
1189
  SDL_HEADER="SDL12/SDL.h"
1190
  if test "x${SDL_CONFIG}" = "xno"
1191
  then
1192
    AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, ${SDL_PATH})
1193
    SDL_CONFIG=${SDL11_CONFIG}
1194 1195
    SDL_HEADER="SDL11/SDL.h"
  fi
1196
  if test "x${SDL_CONFIG}" = "xno"
1197
  then
1198
    AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
1199
    SDL_HEADER="SDL/SDL.h"