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

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

Sam Hocevar's avatar
Sam Hocevar committed
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}"
Sam Hocevar's avatar
Sam Hocevar committed
17
save_LDFLAGS="${LDFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
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
Sam Hocevar's avatar
Sam Hocevar committed
23 24
AC_PROG_CC
AC_PROG_CPP
25

Gildas Bazin's avatar
Gildas Bazin committed
26 27
dnl Find the right ranlib, even when cross-compiling
AC_CHECK_TOOL(RANLIB, ranlib, :)
Sam Hocevar's avatar
Sam Hocevar committed
28
AC_CHECK_TOOL(STRIP, strip, :)
Gildas Bazin's avatar
Gildas Bazin committed
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

Sam Hocevar's avatar
Sam Hocevar committed
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])
Sam Hocevar's avatar
Sam Hocevar committed
54 55
AM_GNU_GETTEXT

56 57 58
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL

59 60 61 62
dnl Check for compiler properties
AC_C_CONST
AC_C_INLINE

Sam Hocevar's avatar
Sam Hocevar committed
63 64 65 66 67
dnl
dnl  Set default LDFLAGS
dnl
vlc_LDFLAGS="${LDFLAGS}"

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

Sam Hocevar's avatar
Sam Hocevar committed
125
dnl Flags for plugin compilation
126
if test "x${SYS}" = "xmingw32"
Sam Hocevar's avatar
Sam Hocevar committed
127 128 129 130
then
  plugins_CFLAGS="${plugins_CFLAGS} -fnative-struct"
else
  plugins_CFLAGS="${plugins_CFLAGS} -fPIC"
131
  plugins_LDFLAGS="${plugins_LDFLAGS} -fPIC"
Sam Hocevar's avatar
Sam Hocevar committed
132 133 134
fi

dnl The -DSYS_FOO flag
135
save_CFLAGS="${save_CFLAGS} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CFLAGS="${save_CFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
136

137
dnl Check for system libs needed
138
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll strndup)
Sam Hocevar's avatar
Sam Hocevar committed
139

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

Sam Hocevar's avatar
Sam Hocevar committed
168
AC_CHECK_FUNC(inet_aton,,[
Sam Hocevar's avatar
Sam Hocevar committed
169
  AC_CHECK_LIB(resolv,inet_aton,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lresolv")
170 171
])
AC_CHECK_FUNC(textdomain,,[
172 173 174 175
  AC_CHECK_LIB(intl,textdomain,
    vlc_LDFLAGS="${vlc_LDFLAGS} -lintl"
    plugins_LDFLAGS="${plugins_LDFLAGS} -lintl"
  )
Sam Hocevar's avatar
Sam Hocevar committed
176
])
Sam Hocevar's avatar
Sam Hocevar committed
177

Sam Hocevar's avatar
Sam Hocevar committed
178
dnl Check for getopt
Sam Hocevar's avatar
Sam Hocevar committed
179
NEED_GETOPT=0
Sam Hocevar's avatar
Sam Hocevar committed
180 181 182
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],
Sam Hocevar's avatar
Sam Hocevar committed
183
    [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) vlc_LDFLAGS="${vlc_LDFLAGS} -lgnugetopt"],
Sam Hocevar's avatar
Sam Hocevar committed
184
    [NEED_GETOPT=1])])
Sam Hocevar's avatar
Sam Hocevar committed
185

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

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

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

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

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

Sam Hocevar's avatar
Sam Hocevar committed
238 239
AC_HEADER_TIME

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

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

Sam Hocevar's avatar
Sam Hocevar committed
252 253 254
dnl Check for threads library
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)

255 256 257 258 259 260 261 262
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

263 264 265
dnl Build the gtk_main plugin?
NEED_GTK_MAIN=no

Sam Hocevar's avatar
Sam Hocevar committed
266
dnl Check for DPMS
267
if test "x${SYS}" != "xmingw32"
Sam Hocevar's avatar
Sam Hocevar committed
268
then
269
  CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
Sam Hocevar's avatar
Sam Hocevar committed
270 271 272 273 274 275
  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.)
    ])
  ])
276
  CPPFLAGS="${save_CPPFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
277 278
fi

Sam Hocevar's avatar
Sam Hocevar committed
279
dnl Check for ntohl, etc.
280 281 282 283 284 285
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)])
286
if test "x${ac_cv_c_ntohl_sys_param_h}" != "xno"; then
287 288
    AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
fi
Sam Hocevar's avatar
Sam Hocevar committed
289

Sam Hocevar's avatar
Sam Hocevar committed
290
dnl Check for inline function size limit
291 292 293 294
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)])
295 296
if test "x${ac_cv_c_inline_limit}" != "xno"; then
    save_CFLAGS="${save_CFLAGS} -finline-limit-30000"; CFLAGS="${save_CFLAGS}"
297
fi
Sam Hocevar's avatar
Sam Hocevar committed
298

Sam Hocevar's avatar
Sam Hocevar committed
299 300 301
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
302
    [CFLAGS="-Wall -Winline ${save_CFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
303
     AC_TRY_COMPILE([],,ac_cv_c_Wall_Winline=yes, ac_cv_c_Wall_Winline=no)])
304 305
if test "x${ac_cv_c_Wall_Winline}" != "xno"; then
    save_CFLAGS="-Wall -Winline ${save_CFLAGS}"; CFLAGS="${save_CFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
306 307 308
else
    AC_CACHE_CHECK([if \$CC accepts -wall -winline],
        [ac_cv_c_wall_winline],
Sam Hocevar's avatar
Sam Hocevar committed
309
        [CFLAGS="-wall -winline ${save_CFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
310
         AC_TRY_COMPILE([],,ac_cv_c_wall_winline=yes, ac_cv_c_wall_winline=no)])
311 312
    if test "x${ac_cv_c_wall_winline}" != "xno"; then
        save_CFLAGS="-wall -winline ${save_CFLAGS}"; CFLAGS="${save_CFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
313 314 315 316 317 318 319 320
    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)])
321 322
if test "x${ac_cv_c_pipe}" != "xno"; then
    save_CFLAGS="${save_CFLAGS} -pipe"; CFLAGS="${save_CFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
323 324 325 326 327 328 329
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)])
330
if test "x${ac_cv_c_o3}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
331 332 333 334 335 336
    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)])
337
    if test "x${ac_cv_c_o2}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
338 339 340 341 342 343
        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)])
344
        if test "x${ac_cv_c_o}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
345 346 347 348 349 350 351 352 353 354
            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)])
355
if test "x${ac_cv_c_fast_math}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
356 357 358 359 360 361 362 363
    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)])
364
if test "x${ac_cv_c_unroll_loops}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
365 366 367 368 369 370 371 372
    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)])
373
if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
374
    CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
Sam Hocevar's avatar
Sam Hocevar committed
375
    # this plugin does not compile without -fomit-frame-pointer, damn gcc!
376
    i420_yuy2_mmx_CFLAGS="${i420_yuy2_mmx_CFLAGS} -fomit-frame-pointer"
Sam Hocevar's avatar
Sam Hocevar committed
377 378
fi

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

dnl Check for standard plugin linking flags
389 390 391 392
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)])
393
if test "x${ac_cv_ld_plugins}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
394
    plugins_LDFLAGS="${plugins_LDFLAGS} -shared"
Sam Hocevar's avatar
Sam Hocevar committed
395
fi
396
        
397 398 399 400 401 402 403 404 405 406
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)])
407
if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
408 409 410
    AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
fi

411 412 413 414
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
    [ac_cv_c_attribute_aligned],
    [ac_cv_c_attribute_aligned=0
Sam Hocevar's avatar
Sam Hocevar committed
415
        CFLAGS="${save_CFLAGS} -Werror"
416 417
    for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
        AC_TRY_COMPILE([],
418 419 420 421 422
        [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
423
    AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
424
        [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
425 426
fi

Sam Hocevar's avatar
Sam Hocevar committed
427 428 429
dnl
dnl  Check the CPU
dnl
430
case "x${target_cpu}" in
Sam Hocevar's avatar
Sam Hocevar committed
431 432 433 434
  x)
    ARCH=unknown
    ;;
  *)
Sam Hocevar's avatar
Sam Hocevar committed
435
    ARCH="${target_cpu}"
Sam Hocevar's avatar
Sam Hocevar committed
436 437
    ;;
esac
Sam Hocevar's avatar
Sam Hocevar committed
438 439 440 441

dnl
dnl  default modules
dnl
442
BUILTINS="${BUILTINS}"
443
PLUGINS="${PLUGINS} misc/dummy/dummy misc/null"
444
PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file misc/memcpy/memcpy"
445
PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts"
446
PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec codec/spdif codec/mpeg_audio/mpeg_audio"
447 448
PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/a52old/a52old"
#PLUGINS="${PLUGINS} codec/lpcm/lpcm"
449
PLUGINS="${PLUGINS} video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop"
450
PLUGINS="${PLUGINS} audio_filter/converter/float32tos16 audio_filter/converter/float32tos8 audio_filter/converter/float32tou16 audio_filter/converter/float32tou8 audio_filter/converter/a52tospdif audio_filter/converter/fixed32tofloat32 audio_filter/converter/fixed32tos16 audio_filter/converter/s16tofloat32"
451
PLUGINS="${PLUGINS} audio_filter/resampler/trivial audio_filter/resampler/ugly"
452
PLUGINS="${PLUGINS} audio_filter/channel_mixer/trivial"
453
PLUGINS="${PLUGINS} audio_mixer/trivial audio_mixer/spdif"
454 455
PLUGINS="${PLUGINS} audio_output/file"
#PLUGINS="${PLUGINS} visualization/scope/scope"
456
PLUGINS="${PLUGINS} video_chroma/i420_rgb video_chroma/i420_yuy2 video_chroma/i422_yuy2 video_chroma/i420_ymga"
457
PLUGINS="${PLUGINS} demux/util/id3"
458 459 460 461 462
dnl
dnl  Network modules
dnl
NETWORK_MODULES="access/udp access/http access/rtp misc/network/ipv4"

Sam Hocevar's avatar
Sam Hocevar committed
463 464 465
dnl
dnl  Accelerated modules
dnl
466 467 468 469 470
MMX_MODULES="misc/memcpy/memcpymmx codec/mpeg_video/idct/idctmmx codec/mpeg_video/motion/motionmmx video_chroma/i420_rgb_mmx video_chroma/i420_yuy2_mmx video_chroma/i422_yuy2_mmx video_chroma/i420_ymga_mmx"
MMXEXT_MODULES="misc/memcpy/memcpymmxext codec/mpeg_video/idct/idctmmxext codec/mpeg_video/motion/motionmmxext"
THREEDNOW_MODULES="misc/memcpy/memcpy3dn codec/a52old/imdct/imdct3dn codec/a52old/downmix/downmix3dn"
SSE_MODULES="codec/a52old/imdct/imdctsse codec/a52old/downmix/downmixsse"
ALTIVEC_MODULES="codec/mpeg_video/idct/idctaltivec codec/mpeg_video/motion/motionaltivec misc/memcpy/memcpyaltivec"
471

472 473
if test x$SYS != xbeos
then
474
  PLUGINS="${PLUGINS} ${NETWORK_MODULES}"
475 476
fi

477 478
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
Sam Hocevar's avatar
Sam Hocevar committed
479 480
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
481
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
482
if test "x${ac_cv_mmx_inline}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
483
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
484
fi
Sam Hocevar's avatar
Sam Hocevar committed
485

486 487
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
Sam Hocevar's avatar
Sam Hocevar committed
488 489
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
490
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
491
if test "x${ac_cv_mmxext_inline}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
492
  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
493
fi
Sam Hocevar's avatar
Sam Hocevar committed
494

495 496
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
Sam Hocevar's avatar
Sam Hocevar committed
497 498
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
499
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
500
if test "x${ac_cv_3dnow_inline}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
501
  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
Sam Hocevar's avatar
Sam Hocevar committed
502
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
503
fi
Sam Hocevar's avatar
Sam Hocevar committed
504

505 506
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
Sam Hocevar's avatar
Sam Hocevar committed
507 508
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
509
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
510
if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
Sam Hocevar committed
511
  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
Sam Hocevar's avatar
Sam Hocevar committed
512
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
513
fi
Sam Hocevar's avatar
Sam Hocevar committed
514

Sam Hocevar's avatar
Sam Hocevar committed
515
# don't try to grok AltiVec with native mingw32 it doesn't work right now
Gildas Bazin's avatar
Gildas Bazin committed
516
# we should be able to remove this test with future versions of mingw32
517
if test "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
Sam Hocevar committed
518
AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
519
    [ac_cv_altivec_inline],
Sam Hocevar's avatar
Sam Hocevar committed
520 521
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
522
         ac_cv_altivec_inline=yes,
523
         [CFLAGS="${save_CFLAGS} -Wa,-m7400"
Sam Hocevar's avatar
Sam Hocevar committed
524
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
525
            [ac_cv_altivec_inline="-Wa,-m7400"],
526
            ac_cv_altivec_inline=no)
527
         ])])
528
if test "x${ac_cv_altivec_inline}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
529
  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
530 531 532 533 534
  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}"
535
  fi
536
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
537
fi
538

Sam Hocevar's avatar
Sam Hocevar committed
539
AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
540
    [ac_cv_c_altivec],
541
    [CFLAGS="${save_CFLAGS} -faltivec"
542
     # Darwin test
Sam Hocevar's avatar
Sam Hocevar committed
543
     AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
544 545
        ac_cv_c_altivec=-faltivec, [
        # Linux/PPC test
546
        CFLAGS="${save_CFLAGS} ${idctaltivec_CFLAGS} -fvec"
Sam Hocevar's avatar
Sam Hocevar committed
547
        AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
548 549
            [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
        ])
550 551
     CFLAGS="${save_CFLAGS}"])
if test "x${ac_cv_c_altivec}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
552
  AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
553 554 555 556
  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}"
557
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
558 559 560 561
fi

AC_CACHE_CHECK([if linker needs -framework vecLib],
    [ac_cv_ld_altivec],
562
    [LDFLAGS="${vlc_LDFLAGS} -framework vecLib"
563
     AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
564
     LDFLAGS="${save_LDFLAGS}"
565
    ])
566
if test "x${ac_cv_ld_altivec}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
567 568 569 570
  idctaltivec_LDFLAGS="${idctaltivec_LDFLAGS} -framework vecLib"
  motionaltivec_LDFLAGS="${motionaltivec_LDFLAGS} -framework vecLib"
  memcpyaltivec_LDFLAGS="${memcpyaltivec_LDFLAGS} -framework vecLib"
  vlc_LDFLAGS="${vlc_LDFLAGS} -framework vecLib"
571
fi
Gildas Bazin's avatar
Gildas Bazin committed
572
fi # end if mingw32
573 574


Sam Hocevar's avatar
Sam Hocevar committed
575 576 577
AC_ARG_WITH(,[])
AC_ARG_WITH(,[Optimization options:])

Sam Hocevar's avatar
Sam Hocevar committed
578
dnl
579
dnl  Special arch tuning
Sam Hocevar's avatar
Sam Hocevar committed
580
dnl
581
AC_ARG_WITH(tuning,
Sam Hocevar's avatar
Sam Hocevar committed
582
[  --with-tuning=ARCH      enable special tuning for an architecture
583
                          (default i686 on IA-32 and 750 on PPC)])
584 585
if test "x${with_tuning}" != "x"; then
    TUNING="${with_tuning}"
586
else
587
    if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xi486" -o "x${target_cpu}" = "xi386"; then TUNING="pentiumpro"
588
    else
589
        if test "x${target_cpu}" = "xpowerpc"; then TUNING="750"; fi
590 591
    fi
fi
Sam Hocevar's avatar
Sam Hocevar committed
592 593

dnl
Sam Hocevar's avatar
Sam Hocevar committed
594
dnl  x86 accelerations
Sam Hocevar's avatar
Sam Hocevar committed
595
dnl
596
if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xx86" -o "x${target_cpu}" = "xi386"
Sam Hocevar's avatar
Sam Hocevar committed
597 598
then
    ARCH="${ARCH} mmx"
Sam Hocevar's avatar
Sam Hocevar committed
599
    PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
Sam Hocevar's avatar
Sam Hocevar committed
600
fi
Sam Hocevar's avatar
Sam Hocevar committed
601

Sam Hocevar's avatar
Sam Hocevar committed
602 603 604 605 606
dnl
dnl  Enable/disable optimizations
dnl
AC_ARG_ENABLE(optimizations,
[  --disable-optimizations disable compiler optimizations (default enabled)],
607
[ if test "x${enable_optimizations}" = "xno"; then OPTIMS=0; fi ],
Sam Hocevar's avatar
Sam Hocevar committed
608 609
[ OPTIMS=1 ])

Sam Hocevar's avatar
Sam Hocevar committed
610 611 612
dnl
dnl  AltiVec acceleration
dnl
613
AC_ARG_ENABLE(altivec,
Sam Hocevar's avatar
Sam Hocevar committed
614
[  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
615
[ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
616
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
617
[ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
618
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
Sam Hocevar committed
619 620 621 622

dnl
dnl  Debugging mode
dnl
Sam Hocevar's avatar
Sam Hocevar committed
623
DEBUG=0
624
AC_ARG_ENABLE(debug,
Sam Hocevar's avatar
Sam Hocevar committed
625
[  --enable-debug          debug mode (default disabled)],
626
[ if test "x${enable_debug}" = "xyes"; then DEBUG=1; fi ])
Sam Hocevar's avatar
Sam Hocevar committed
627

Sam Hocevar's avatar
Sam Hocevar committed
628
dnl
Sam Hocevar's avatar
Sam Hocevar committed
629
dnl  Enable release-specific flags
Sam Hocevar's avatar
Sam Hocevar committed
630
dnl
Sam Hocevar's avatar
Sam Hocevar committed
631
RELEASE=0
Sam Hocevar's avatar
Sam Hocevar committed
632 633
AC_ARG_ENABLE(release,
[  --enable-release        activate extra optimizations (default disabled)],
634
[ if test "x${enable_release}" = "xyes"; then RELEASE=1; fi ],
Sam Hocevar's avatar
Sam Hocevar committed
635
[ VERSION="${VERSION}_`date +%Y-%m-%d`" ])
Sam Hocevar's avatar
Sam Hocevar committed
636

Sam Hocevar's avatar
Sam Hocevar committed
637
dnl
Sam Hocevar's avatar
Sam Hocevar committed
638
dnl  Input plugins
Sam Hocevar's avatar
Sam Hocevar committed
639 640
dnl

Sam Hocevar's avatar
Sam Hocevar committed
641
AC_ARG_WITH(,[Input plugins:])
Sam Hocevar's avatar
Sam Hocevar committed
642 643

dnl
Sam Hocevar's avatar
Sam Hocevar committed
644 645 646 647
dnl  DVD module: optionally check for installed libdvdcss
dnl
AC_ARG_ENABLE(dvd,
[  --enable-dvd            DVD input module (default enabled)])
648
if test "x${enable_dvd}" != "xno"
Sam Hocevar's avatar
Sam Hocevar committed
649 650 651
then
  AC_ARG_WITH(dvdcss, 
  [    --with-dvdcss=PATH    libdvdcss headers and libraries])
Sam Hocevar's avatar
Sam Hocevar committed
652 653
  AC_ARG_WITH(dvdcss-tree, 
  [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
654
  case "x${with_dvdcss}" in
Sam Hocevar's avatar
Sam Hocevar committed
655
  x|xyes)
656
    if test "x${with_dvdcss_tree}" = x
Sam Hocevar's avatar
Sam Hocevar committed
657 658
    then
      AC_CHECK_HEADERS(dvdcss/dvdcss.h,
659
        [ PLUGINS="${PLUGINS} access/dvd/dvd"
Sam Hocevar's avatar
Sam Hocevar committed
660
          dvd_LDFLAGS="${dvd_LDFLAGS} -ldvdcss" ],
Sam Hocevar's avatar
Sam Hocevar committed
661 662 663 664 665
        [ 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`"
666
      if test "x${real_dvdcss_tree}" = "x"
Sam Hocevar's avatar
Sam Hocevar committed
667 668 669 670 671 672 673 674 675
      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)
676
        BUILTINS="${BUILTINS} access/dvd/dvd"
Sam Hocevar's avatar
Sam Hocevar committed
677 678
        dvd_LDFLAGS="${dvd_LDFLAGS} ${real_dvdcss_tree}/src/.libs/libdvdcss.a"
        dvd_CFLAGS="${dvd_CFLAGS} -I${real_dvdcss_tree}/src"
Sam Hocevar's avatar
Sam Hocevar committed
679 680 681 682 683 684
      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
Sam Hocevar's avatar
Sam Hocevar committed
685 686
  ;;
  xno)
Sam Hocevar's avatar
Sam Hocevar committed
687
    dnl  Compile without dvdcss (dlopen version, works only under Linux)
688
    PLUGINS="${PLUGINS} access/dvd/dvd"
Sam Hocevar's avatar
Sam Hocevar committed
689 690
    dvd_CFLAGS="${dvd_CFLAGS} -DGOD_DAMN_DMCA"
    dvd_LDFLAGS="${dvd_LDFLAGS} -ldl"
Sam Hocevar's avatar
Sam Hocevar committed
691 692
  ;;
  *)
Sam Hocevar's avatar
Sam Hocevar committed
693 694
    AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
    if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
Sam Hocevar's avatar
Sam Hocevar committed
695
    then
Sam Hocevar's avatar
Sam Hocevar committed
696
      dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
Sam Hocevar's avatar
Sam Hocevar committed
697
      AC_MSG_RESULT(yes)
698
      PLUGINS="${PLUGINS} access/dvd/dvd"
Sam Hocevar's avatar
Sam Hocevar committed
699 700
      dvd_LDFLAGS="${dvd_LDFLAGS} -L${with_dvdcss}/lib -ldvdcss"
      dvd_CFLAGS="${dvd_CFLAGS} -I${with_dvdcss}/include"
Sam Hocevar's avatar
Sam Hocevar committed
701
    else
Sam Hocevar's avatar
Sam Hocevar committed
702
      dnl  No libdvdcss could be found, sorry
Sam Hocevar's avatar
Sam Hocevar committed
703
      AC_MSG_RESULT(no)
Sam Hocevar's avatar
Sam Hocevar committed
704
      AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
Sam Hocevar's avatar
Sam Hocevar committed
705 706 707 708
    fi
  ;;
  esac
fi
Sam Hocevar's avatar
Sam Hocevar committed
709

710
dnl
Sam Hocevar's avatar
Sam Hocevar committed
711
dnl dvdread module: check for libdvdread plugin
712
dnl
Sam Hocevar's avatar
Sam Hocevar committed
713 714
AC_ARG_ENABLE(dvdread,
[  --enable-dvdread        dvdread input module (default disabled)])
715
if test "x${enable_dvdread}" != "xno"
Sam Hocevar's avatar
Sam Hocevar committed
716 717 718
then
  AC_ARG_WITH(dvdread, 
  [    --with-dvdread=PATH   libdvdread headers and libraries])
719
  if test "x${with_dvdread}" = "x"
Sam Hocevar's avatar
Sam Hocevar committed
720 721 722 723
  then
    test_LDFLAGS=""
    test_CFLAGS=""
  else
724 725
    test_LDFLAGS="-L${with_dvdread}/lib"
    test_CFLAGS="-I${with_dvdread}/include"
Sam Hocevar's avatar
Sam Hocevar committed
726
  fi
727
  CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
728 729
  AC_CHECK_HEADERS(dvdread/dvd_reader.h, [
     AC_TRY_COMPILE([#include <dvdread/dvd_reader.h>],
730
        [int foo() { return DVD_VIDEO_LB_LEN; }],[
731
          PLUGINS="${PLUGINS} access/dvdread/dvdread"
Sam Hocevar's avatar
Sam Hocevar committed
732 733 734
          dvdread_LDFLAGS="${dvdread_LDFLAGS} ${test_LDFLAGS} -ldvdread"
          dvdread_CFLAGS="${dvdread_CFLAGS} ${test_CFLAGS}"
        ],[
735
          if test "x${enable_dvdread}" != "x"
Sam Hocevar's avatar
Sam Hocevar committed
736 737 738 739 740
          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
        ])
  ],[
741
    if test "x${enable_dvdread}" != "x"
742
    then
743
      if test "x${with_dvdread}" != "x"
Sam Hocevar's avatar
Sam Hocevar committed
744
      then
745
        AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h in ${with_dvdread}/include])
Sam Hocevar's avatar
Sam Hocevar committed
746 747 748
      else
        AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h])
      fi
Sam Hocevar's avatar
Sam Hocevar committed
749
    fi
Sam Hocevar's avatar
Sam Hocevar committed
750
  ])
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772
  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, [
773
      PLUGINS="${PLUGINS} access/dvdplay/dvdplay"
774 775 776 777 778 779 780 781 782 783 784 785 786
      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
  ])
787
  CPPFLAGS="${save_CPPFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
788
fi
789

790

791 792 793 794 795
dnl
dnl  libdvbpsi ts demux
dnl
AC_ARG_ENABLE(dvbpsi,
[  --enable-dvbpsi        dvbpsi ts demux module (default disabled)])
796
if test "x${enable_dvbpsi}" != "xno"
797
then
798 799
  AC_ARG_WITH(dvbpsi, 
  [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
800 801
  AC_ARG_WITH(dvbpsi,
  [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
802
  case "x${with_dvbpsi}" in
803
  x|xyes)
804
    if test "x${with_dvbpsi_tree}" = "x"
805
    then
Sam Hocevar's avatar
Sam Hocevar committed
806
      AC_CHECK_HEADERS(dvbpsi/dr.h,
807 808
        [ PLUGINS="${PLUGINS} demux/mpeg/ts_dvbpsi"
          ts_dvbpsi_LDFLAGS="${ts_dvbpsi_LDFLAGS} -ldvbpsi" ], [],
809 810 811 812
        [  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`"
813
      if test "x${real_dvbpsi_tree}" = "x"
814 815 816 817 818 819 820 821 822
      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)
823 824 825
        BUILTINS="${BUILTINS} demux/mpeg/ts_dvbpsi"
        ts_dvbpsi_LDFLAGS="${ts_dvbpsi_LDFLAGS} ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
        ts_dvbpsi_CFLAGS="${ts_dvbpsi_CFLAGS} -I${real_dvbpsi_tree}/src"
826 827 828 829 830
      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
831
    fi
832 833
  ;;
  xno)
834
    dnl  Compile without dvbpsi
835 836 837
  ;;
  *)
    AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
838
    if test "x${with_dvbpsi}" = "x"
839 840 841 842 843 844 845
    then
      test_LDFLAGS=""
      test_CFLAGS=""
    else
      test_LDFLAGS="-L${with_dvbpsi}/lib"
      test_CFLAGS="-I${with_dvbpsi}/include"
    fi
846
    CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
847
    AC_CHECK_HEADER([dvbpsi/dr.h],[
848 849 850
      PLUGINS="${PLUGINS} demux/mpeg/ts_dvbpsi"
      ts_dvbpsi_LDFLAGS="${ts_dvbpsi_LDFLAGS} ${test_LDFLAGS} -ldvbpsi"
      ts_dvbpsi_CFLAGS="${ts_dvbpsi_CFLAGS} ${test_CFLAGS}"
851
      ],[
852
      if test "x${enable_dvbpsi}" != "x"
853 854 855 856
      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
    ])
857
    CPPFLAGS="${save_CPPFLAGS}"
858 859
  ;;
  esac
860
fi
861

862 863 864 865 866 867 868 869 870 871 872 873
dnl
dnl  Video4Linux plugin
dnl
AC_ARG_ENABLE(v4l,
  [  --enable-v4l            Video4Linux input support (default disabled)])
if test "x${enable_v4l}" = "xyes"
then
  AC_CHECK_HEADERS(libv4l/v4l.h, [
    PLUGINS="${PLUGINS} access/v4l/v4l"
   ],[])
fi

874
dnl
Sam Hocevar's avatar
Sam Hocevar committed
875
dnl  VCD module
876 877
dnl
AC_ARG_ENABLE(vcd,
878
  [  --enable-vcd            VCD support for Linux, FreeBSD and MacOS X (default enabled)])
879

880
if test "x${enable_vcd}" != "xno"
Sam Hocevar's avatar
Sam Hocevar committed
881 882
then
  AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
883
    PLUGINS="${PLUGINS} access/vcd/vcd"
Sam Hocevar's avatar
Sam Hocevar committed
884
  ])
885 886
  
  AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
887
    PLUGINS="${PLUGINS} access/vcd/vcd"
888 889
    AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
  ])
890
  
Sam Hocevar's avatar
Sam Hocevar committed
891 892
  if test "x${SYS}" = "xbsdi"
  then
893
    PLUGINS="${PLUGINS} access/vcd/vcd"
Sam Hocevar's avatar
Sam Hocevar committed
894
  fi
895

Sam Hocevar's avatar
Sam Hocevar committed
896 897
  if test "x${SYS}" = "xdarwin"
  then
898
    # No need to add vcd to PLUGINS, Darwin is already based on FreeBSD
Sam Hocevar's avatar
Sam Hocevar committed
899
    vcd_LDFLAGS="${vcd_LDFLAGS} -framework IOKit -framework CoreFoundation" 
Sam Hocevar's avatar
Sam Hocevar committed
900
  fi
901 902
fi

Johan Bilien's avatar
Johan Bilien committed
903 904 905 906
dnl
dnl  Satellite input module
dnl
AC_ARG_ENABLE(satellite,
Sam Hocevar's avatar
Sam Hocevar committed
907
  [  --enable-satellite      satellite card support (default disabled)],
908
  [ if test "x${enable_satellite}" = "xyes"
Johan Bilien's avatar
Johan Bilien committed
909
    then
910
      PLUGINS="${PLUGINS} access/satellite/satellite"
Johan Bilien's avatar
Johan Bilien committed
911 912
    fi])

913
dnl
914
dnl  ipv6 plugin - not for QNX yet
915
dnl
916
if test "x${SYS}" != "xnto" && test "x${SYS}" != "xmingw32"
917
then
918 919
  have_ipv6=0
  AC_CHECK_FUNC(inet_pton,[have_ipv6=1],[
920
    AC_CHECK_LIB(resolv,inet_pton,
921
      [have_ipv6=1
922 923
       ipv6_LDFLAGS="${ipv6_LDFLAGS} -lresolv"])
  ])
924 925 926 927
  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
928
    PLUGINS="${PLUGINS} misc/network/ipv6"
929
  fi
930
fi
931
if test "x${SYS}" = "xmingw32"
Gildas Bazin's avatar
Gildas Bazin committed
932 933 934
then
  AC_MSG_CHECKING(for getaddrinfo in ws2tcpip.h)
  AC_EGREP_HEADER(addrinfo,ws2tcpip.h,[AC_MSG_RESULT(yes)
935
    PLUGINS="${PLUGINS} misc/network/ipv6"],[AC_MSG_RESULT(no)])
Gildas Bazin's avatar
Gildas Bazin committed
936
fi
937

938 939 940 941 942
dnl
dnl  AVI demux plugin
dnl
AC_ARG_ENABLE(avi,
  [  --enable-avi            AVI demux module (default enabled)])
943
if test "x${enable_avi}" != "xno"
944
then
945
  PLUGINS="${PLUGINS} demux/avi/avi"
946 947
fi

948 949 950 951 952 953 954 955 956 957
dnl
dnl  AAC demux plugin
dnl
AC_ARG_ENABLE(aac,
  [  --enable-aac            AAC demux module (default enabled)])
if test "x${enable_aac}" != "xno"
then
  PLUGINS="${PLUGINS} demux/aac/aac"
fi

Sam Hocevar's avatar
Sam Hocevar committed
958
dnl
Sam Hocevar's avatar
Sam Hocevar committed
959
dnl  Codec plugins
Sam Hocevar's avatar
Sam Hocevar committed
960
dnl
Sam Hocevar's avatar
Sam Hocevar committed
961

Sam Hocevar's avatar
Sam Hocevar committed
962
AC_ARG_WITH(,[Codec plugins:])
Sam Hocevar's avatar
Sam Hocevar committed
963

964
dnl
Sam Hocevar's avatar
Sam Hocevar committed
965
dnl  mad plugin
966
dnl
Sam Hocevar's avatar
Sam Hocevar committed
967 968
AC_ARG_ENABLE(mad,
  [  --enable-mad            libmad module (default disabled)])
969
if test "x${enable_mad}" = "xyes"
Sam Hocevar's avatar
Sam Hocevar committed
970 971
then
  AC_ARG_WITH(mad,
Gildas Bazin's avatar
Gildas Bazin committed
972
    [    --with-mad=PATH       path to libmad],[],[])
973
  if test "x${with_mad}" != "xno" -a "x${with_mad}" != "x"
Gildas Bazin's avatar
Gildas Bazin committed
974
  then
975 976
    mad_CFLAGS="${mad_CFLAGS} -I${with_mad}/include"
    mad_LDFLAGS="${mad_LDFLAGS} -L${with_mad}/lib"
Gildas Bazin's avatar
Gildas Bazin committed
977 978 979 980
  fi

  AC_ARG_WITH(mad-tree,
    [    --with-mad-tree=PATH  mad tree for static linking],[],[])
981
  if test "x${with_mad_tree}" != "xno" -a "x${with_mad_tree}" != "x"
Gildas Bazin's avatar
Gildas Bazin committed
982 983
  then
    real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
984
    if test "x${real_mad_tree}" = "x"
Gildas Bazin's avatar
Gildas Bazin committed
985 986 987 988 989 990 991 992 993 994 995 996
    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"
997
      LDFLAGS="${save_LDFLAGS} ${mad_LDFLAGS}"
Gildas Bazin's avatar
Gildas Bazin committed
998
      AC_CHECK_LIB(mad, mad_bit_init, [
999
        BUILTINS="${BUILTINS} codec/mad/mad"
Gildas Bazin's avatar
Gildas Bazin committed
1000 1001 1002
        mad_LDFLAGS="${mad_LDFLAGS} -lmad"
        ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
      ],[])
1003
      LDFLAGS="${save_LDFLAGS}"
Gildas Bazin's avatar
Gildas Bazin committed
1004 1005 1006 1007 1008
    else
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([the specified tree doesn't have mad.h])
    fi
  else
1009 1010
    CFLAGS="${save_CFLAGS} ${mad_CFLAGS}"
    LDFLAGS="${save_LDFLAGS} ${mad_LDFLAGS}"
Gildas Bazin's avatar
Gildas Bazin committed
1011 1012
    AC_CHECK_HEADERS(mad.h, ,
      [ AC_MSG_ERROR([Cannot find development headers for libmad...]) ])
1013
    AC_CHECK_LIB(mad, mad_bit_init, [
1014
      PLUGINS="${PLUGINS} codec/mad/mad"
1015
      mad_LDFLAGS="${mad_LDFLAGS} -lmad" ],
Gildas Bazin's avatar
Gildas Bazin committed
1016
      [ AC_MSG_ERROR([Cannot find libmad library...]) ])
1017 1018
    CFLAGS="${save_CFLAGS}"
    LDFLAGS="${save_LDFLAGS}"
Gildas Bazin's avatar
Gildas Bazin committed
1019
  fi
Sam Hocevar's avatar
Sam Hocevar committed
1020
fi
1021

1022 1023 1024
dnl
dnl   libid3tag support
dnl
1025 1026 1027
AC_CHECK_HEADERS(id3tag.h, [
  id3tag_LDFLAGS="${id3tag_LDFLAGS} -lz -lid3tag"
  PLUGINS="${PLUGINS} demux/util/id3tag"])
1028
   
1029 1030 1031 1032 1033
dnl
dnl  ffmpeg decoder plugin
dnl
AC_ARG_ENABLE(ffmpeg,
[  --enable-ffmpeg         ffmpeg codec (default disabled)])
1034
if test "x${enable_ffmpeg}" = "xyes"
1035
then
1036 1037
  AC_ARG_WITH(ffmpeg,
    [    --with-ffmpeg=PATH    path to ffmpeg installation],[],[])
1038
  if test "x${with_ffmpeg}" != "xno" -a "x${with_ffmpeg}" != "x"
1039
  then
1040 1041
    ffmpeg_CFLAGS="${ffmpeg_CFLAGS} -I${with_ffmpeg}/include/libffmpeg"
    ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -L${with_ffmpeg}/lib"
1042 1043
  fi

1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054
  dnl Add postprocessing modules
  PLUGINS="${PLUGINS} codec/ffmpeg/postprocessing/postprocessing_c"
  if test "x${ac_cv_mmx_inline}" != "xno"; then
    PLUGINS="${PLUGINS} codec/ffmpeg/postprocessing/postprocessing_mmx"
  fi

  if test "x${ac_cv_mmxext_inline}" != "xno"; then
    PLUGINS="${PLUGINS} codec/ffmpeg/postprocessing/postprocessing_mmxext"
  fi


1055 1056
  AC_ARG_WITH(ffmpeg-tree, 
  [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
1057
  if test "x${with_ffmpeg_tree}" != "x"
1058 1059 1060
  then
    AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
    real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
1061
    if test "x${real_ffmpeg_tree}" = x
1062 1063 1064 1065 1066 1067 1068 1069 1070
    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)
1071
      BUILTINS="${BUILTINS} codec/ffmpeg/ffmpeg"
1072
      ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} ${real_ffmpeg_tree}/libavcodec/libavcodec.a"
1073 1074 1075 1076 1077 1078
      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
1079
  else
1080
    CFLAGS="${save_CFLAGS} ${ffmpeg_CFLAGS}"
1081
    LDFLAGS="${save_LDFLAGS} ${ffmpeg_LDFLAGS}"
1082
    AC_CHECK_LIB(avcodec, avcodec_init, [
1083
      BUILTINS="${BUILTINS} codec/ffmpeg/ffmpeg"
1084
      ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -lavcodec" ],
1085
      [ AC_MSG_ERROR([Cannot find libavcodec library...]) ])
1086 1087
    LDFLAGS="${save_LDFLAGS}"
    CFLAGS="${save_CFLAGS}"
1088 1089 1090
  fi
fi

1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104
dnl
dnl  faad decoder plugin
dnl
AC_ARG_ENABLE(faad,
[  --enable-faad           faad codec (default disabled)])
if test "x${enable_faad}" = "xyes"
then
  AC_ARG_WITH(faad,
    [    --with-faad=PATH      path to faad installation],[],[])
  if test "x${with_faad}" != "xno" -a "x${with_faad}" != "x"
  then
    faad_CFLAGS="${faad_CFLAGS} -I${with_faad}/include"
    faad_LDFLAGS="${faad_LDFLAGS} -L${with_faad}/lib"
  fi
1105
  faad_LDFLAGS="${faad_LDFLAGS}"
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128

  AC_ARG_WITH(faad-tree, 
  [    --with-faad-tree=PATH faad tree for static linking])
  if test "x${with_faad_tree}" != "x"
  then
    AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
    real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
    if test "x${real_faad_tree}" = x
    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)
      BUILTINS="${BUILTINS} codec/faad/faad"
      faad_LDFLAGS="${faad_LDFLAGS} ${real_faad_tree}/libfaad/.libs/libfaad.a"
      faad_CFLAGS="${faad_CFLAGS} -I${real_faad_tree}/include"
    else
      dnl  The given libfaad wasn't built
      AC_MSG_RESULT(no)
1129
      AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146
    fi
  else
    CFLAGS="${save_CFLAGS} ${faad_CFLAGS}"
    LDFLAGS="${save_LDFLAGS} ${faad_LDFLAGS}"
    AC_CHECK_HEADERS(faad.h, ,
      [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ])
    AC_CHECK_LIB(faad, faacDecOpen, [
      PLUGINS="${PLUGINS} codec/faad/faad"
      faad_LDFLAGS="${faad_LDFLAGS} -lfaad" ],
      [ AC_MSG_ERROR([Cannot find libfaad library...]) ])
    LDFLAGS="${save_LDFLAGS}"
    CFLAGS="${save_CFLAGS}"
  fi
fi



1147
dnl 
1148
dnl MP4 module 
1149 1150
dnl 
AC_ARG_ENABLE(mp4,
1151 1152
  [  --enable-mp4            MP4 demux module (default enabled)])
if test "x${enable_mp4}" != "xno"
1153
then
1154 1155 1156 1157

    PLUGINS="${PLUGINS} demux/mp4/mp4"
    AC_CHECK_HEADERS(zlib.h,
              [ mp4_LDFLAGS="${mp4_LDFLAGS} -lz" ] )
1158
fi
1159

Gildas Bazin's avatar
Gildas Bazin committed
1160
dnl
Gildas Bazin's avatar
Gildas Bazin committed
1161
dnl  a52 AC3 decoder plugin
Gildas Bazin's avatar
Gildas Bazin committed
1162
dnl
Gildas Bazin's avatar
Gildas Bazin committed
1163
AC_ARG_ENABLE(a52,
1164
  [  --enable-a52            A/52 support with liba52 (default enabled)])
1165
if test "x${enable_a52}" != "xno"
Gildas Bazin's avatar
Gildas Bazin committed
1166
then
1167 1168
  AC_ARG_WITH(a52, 
    [    --with-a52=PATH       a52 headers and libraries])
Gildas Bazin's avatar
Gildas Bazin committed
1169 1170
  AC_ARG_WITH(a52-tree,
    [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
1171
  if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x"
Gildas Bazin's avatar
Gildas Bazin committed
1172
  then
Gildas Bazin's avatar
Gildas Bazin committed
1173
    real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
1174
    if test "x${real_a52_tree}" = "x"
Gildas Bazin's avatar
Gildas Bazin committed
1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186
    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"
1187
      LDFLAGS="${save_LDFLAGS} ${a52_LDFLAGS}"
Gildas Bazin's avatar
Gildas Bazin committed
1188
      AC_CHECK_LIB(a52, a52_free, [
Christophe Massiot's avatar
Christophe Massiot committed
1189
        BUILTINS="${BUILTINS} codec/a52"
Gildas Bazin's avatar
Gildas Bazin committed
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199
        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])
1200
      LDFLAGS="${save_LDFLAGS}"
Gildas Bazin's avatar
Gildas Bazin committed
1201 1202 1203 1204
    else
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([the specified tree doesn't have a52.h])
    fi
1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217
  else
    if test "x${with_a52}" = "x"
    then
      test_LDFLAGS=""
      test_CFLAGS=""
    else
      test_LDFLAGS="-L${with_a52}/lib"
      test_CFLAGS="-I${with_a52}/include"
    fi
    save_CPPFLAGS="${CPPFLAGS}"
    save_LDFLAGS="${LDFLAGS}"
    CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
    LDFLAGS="${save_LDFLAGS} ${test_LDFLAGS}"
1218
    AC_CHECK_HEADERS(a52dec/a52.h, [
Gildas Bazin's avatar
Gildas Bazin committed
1219
      AC_CHECK_LIB(a52, a52_free, [
Christophe Massiot's avatar
Christophe Massiot committed
1220
        BUILTINS="${BUILTINS} codec/a52"
1221 1222 1223 1224 1225 1226 1227 1228
        a52_LDFLAGS="${a52_LDFLAGS} ${test_LDFLAGS} -la52 -lm"
        a52_CFLAGS="${a52_CFLAGS} ${test_CFLAGS}"
      ],[
        if test "x${enable_dvbpsi}" != "x"
        then
          AC_MSG_ERROR([Could not find a52 on your system: you may get it from http://liba52.sf.net])
        fi
      ],[-lm])
Gildas Bazin's avatar
Gildas Bazin committed
1229
    ])
1230 1231
    CPPFLAGS="${save_CPPFLAGS}"
    LDFLAGS="${save_LDFLAGS}"
Gildas Bazin's avatar
Gildas Bazin committed
1232
  fi
Gildas Bazin's avatar
Gildas Bazin committed
1233 1234
fi

1235 1236 1237 1238 1239 1240 1241
dnl
dnl  cinepak plugin
dnl
AC_ARG_ENABLE(cinepak,
  [  --enable-cinepak        Cinepak decoder (default enabled)])
if test "x${enable_cinepak}" != "xno"
then
1242
  PLUGINS="${PLUGINS} codec/cinepak/cinepak"
1243 1244
fi

Sam Hocevar's avatar
Sam Hocevar committed
1245 1246 1247 1248
dnl
dnl  ogg vorbis plugin
dnl
AC_ARG_ENABLE(vorbis,
Sam Hocevar's avatar
Sam Hocevar committed
1249
  [  --enable-vorbis         Ogg/Vorbis decoder support (default enabled)])
1250
if test "x${enable_vorbis}" != "xno"
Sam Hocevar's avatar
Sam Hocevar committed
1251 1252
then
  AC_CHECK_HEADERS(ogg/ogg.h, [
1253
    dnl disabled for the moment
1254
    #PLUGINS="${PLUGINS} demux/ogg/ogg codec/vorbis/vorbis"
Sam Hocevar's avatar
Sam Hocevar committed
1255
    vorbis_LDFLAGS="${vorbis_LDFLAGS} -lvorbis"
Sam Hocevar's avatar
Sam Hocevar committed
1256 1257 1258
   ],[])
fi

1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271
dnl
dnl  DV plugin
dnl 
AC_ARG_ENABLE(dv,
  [  --enable-dv             DV decoder support (default disabled)])
if test "x${enable_dv}" = "xyes"
then
  AC_CHECK_HEADERS(libdv/dv.h, [
    BUILTINS="${BUILTINS} codec/dv/dv"
    dv_LDFLAGS="${dv_LDFLAGS} -ldv"
   ],[])
fi  

Sam Hocevar's avatar
Sam Hocevar committed
1272
dnl
Sam Hocevar's avatar
Sam Hocevar committed
1273
dnl  Video plugins
Sam Hocevar's avatar
Sam Hocevar committed
1274 1275
dnl

Sam Hocevar's avatar
Sam Hocevar committed
1276
AC_ARG_WITH(,[Video plugins:])
Sam Hocevar's avatar
Sam Hocevar committed
1277

Sam Hocevar's avatar
Sam Hocevar committed
1278
dnl
Sam Hocevar's avatar
Sam Hocevar committed
1279 1280
dnl  X11 module
dnl  (enabled by default except on win32)
Sam Hocevar's avatar
Sam Hocevar committed
1281
dnl
Sam Hocevar's avatar
Sam Hocevar committed
1282
AC_ARG_ENABLE(x11,
Sam Hocevar's avatar
Sam Hocevar committed
1283
  [  --enable-x11            X11 support (default enabled)])
1284 1285 1286
if test "x${enable_x11}" != "xno" &&
  (test "x${SYS}" != "xmingw32" || test "x${enable_x11}" = "xyes"); then
  CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
Sam Hocevar's avatar
Sam Hocevar committed
1287
  AC_CHECK_HEADERS(X11/Xlib.h, [
1288
    PLUGINS="${PLUGINS} video_output/x11/x11"
1289 1290
    x11_LDFLAGS="${x11_LDFLAGS} -L${x_libraries} -lX11 -lXext"
    x11_CFLAGS="${x11_CFLAGS} -I${x_includes}"
Sam Hocevar's avatar
Sam Hocevar committed
1291
  ])
1292
  CPPFLAGS="${save_CPPFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
1293 1294 1295 1296 1297 1298 1299
fi

dnl
dnl  XVideo module
dnl  (enabled by default except on win32)
dnl
AC_ARG_ENABLE(xvideo,
Sam Hocevar's avatar
Sam Hocevar committed
1300
  [  --enable-xvideo         XVideo support (default enabled)])
1301 1302 1303
if test "x${enable_xvideo}" != "xno" &&
  (test "x${SYS}" != "xmingw32" || test "x${enable_xvideo}" = "xyes"); then
  CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
Sam Hocevar's avatar
Sam Hocevar committed
1304
  AC_CHECK_HEADERS(X11/extensions/Xv.h, [
1305
    CFLAGS="${save_CFLAGS} -L${x_libraries} -lX11 -lXext"
1306
    AC_CHECK_LIB(Xv_pic,XvPutImage,
Sam Hocevar's avatar
Sam Hocevar committed
1307
      # We have Xv_pic, that's good, we can build an xvideo.so plugin !
1308
      PLUGINS="${PLUGINS} video_output/x11/xvideo"