configure.in 54.5 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
AC_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

gbazin's avatar
   
gbazin 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, :)
gbazin's avatar
   
gbazin committed
29

Sam Hocevar's avatar
Sam Hocevar committed
30
dnl
Christophe Massiot's avatar
Christophe Massiot committed
31
dnl Check for GNU make
Sam Hocevar's avatar
Sam Hocevar committed
32
dnl
Christophe Massiot's avatar
Christophe Massiot committed
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
AC_PATH_PROG(GMAKE, gmake, no)
if test "x$GMAKE" = "xno"; then
  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"
Sam Hocevar's avatar
Sam Hocevar committed
51

Sam Hocevar's avatar
   
Sam Hocevar committed
52
AC_DEFINE_UNQUOTED(VLC_PACKAGE, "$PACKAGE", [Package name])
Sam Hocevar's avatar
   
Sam Hocevar committed
53
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

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

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

Sam Hocevar's avatar
   
Sam Hocevar committed
117
118
119
120
121
122
123
124
125
dnl Flags for plugin compilation
if test x"${SYS}" = xmingw32
then
  plugins_CFLAGS="${plugins_CFLAGS} -fnative-struct"
else
  plugins_CFLAGS="${plugins_CFLAGS} -fPIC"
fi

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

128
dnl Check for system libs needed
129
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
130

Sam Hocevar's avatar
   
Sam Hocevar committed
131
AC_CHECK_FUNC(connect,,[
Sam Hocevar's avatar
   
Sam Hocevar committed
132
  AC_CHECK_LIB(socket,connect,
Sam Hocevar's avatar
   
Sam Hocevar committed
133
134
    ipv4_LDFLAGS="${ipv4_LDFLAGS} -lsocket"
    vlc_LDFLAGS="${vlc_LDFLAGS} -lsocket"
Sam Hocevar's avatar
   
Sam Hocevar committed
135
)])
Sam Hocevar's avatar
Sam Hocevar committed
136
137
138
139
AC_CHECK_FUNC(send,,[
  AC_CHECK_LIB(socket,send,
    http_LDFLAGS="${http_LDFLAGS} -lsocket"
)])
Sam Hocevar's avatar
   
Sam Hocevar committed
140
AC_CHECK_FUNC(gethostbyname,,[
Sam Hocevar's avatar
   
Sam Hocevar committed
141
  AC_CHECK_LIB(nsl,gethostbyname,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lnsl")
Sam Hocevar's avatar
   
Sam Hocevar committed
142
143
])
AC_CHECK_FUNC(gethostbyname,,[
Sam Hocevar's avatar
   
Sam Hocevar committed
144
  AC_CHECK_LIB(bind,gethostbyname,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lbind")
Sam Hocevar's avatar
   
Sam Hocevar committed
145
])
146
147
148
149
150
151
AC_CHECK_FUNCS(nanosleep,,[
  AC_CHECK_LIB(rt,nanosleep,
    [vlc_LDFLAGS="${vlc_LDFLAGS} -lrt"],
    [AC_CHECK_LIB(posix4,nanosleep,
        [vlc_LDFLAGS="${vlc_LDFLAGS} -lposix4"])]
  )
Sam Hocevar's avatar
   
Sam Hocevar committed
152
153
])
AC_CHECK_FUNC(inet_aton,,[
Sam Hocevar's avatar
   
Sam Hocevar committed
154
  AC_CHECK_LIB(resolv,inet_aton,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lresolv")
155
156
])
AC_CHECK_FUNC(textdomain,,[
157
158
159
160
  AC_CHECK_LIB(intl,textdomain,
    vlc_LDFLAGS="${vlc_LDFLAGS} -lintl"
    plugins_LDFLAGS="${plugins_LDFLAGS} -lintl"
  )
Sam Hocevar's avatar
   
Sam Hocevar committed
161
])
Sam Hocevar's avatar
   
Sam Hocevar committed
162

Sam Hocevar's avatar
   
Sam Hocevar committed
163
dnl Check for getopt
Sam Hocevar's avatar
   
Sam Hocevar committed
164
NEED_GETOPT=0
Sam Hocevar's avatar
   
Sam Hocevar committed
165
166
167
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
168
    [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) vlc_LDFLAGS="${vlc_LDFLAGS} -lgnugetopt"],
Sam Hocevar's avatar
   
Sam Hocevar committed
169
    [NEED_GETOPT=1])])
Sam Hocevar's avatar
   
Sam Hocevar committed
170

171
AC_TYPE_SIGNAL
Sam Hocevar's avatar
   
Sam Hocevar committed
172
AC_CHECK_LIB(dl,dlopen,vlc_LDFLAGS="${vlc_LDFLAGS} -ldl")
Sam Hocevar's avatar
   
Sam Hocevar committed
173
AC_CHECK_LIB(m,cos,
Sam Hocevar's avatar
   
Sam Hocevar committed
174
175
  imdct_LDFLAGS="${imdct_LDFLAGS} -lm"
  filter_distort_LDFLAGS="${filter_distort_LDFLAGS} -lm")
Sam Hocevar's avatar
   
Sam Hocevar committed
176
AC_CHECK_LIB(m,pow,
Sam Hocevar's avatar
Sam Hocevar committed
177
  ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -lm"
Sam Hocevar's avatar
   
Sam Hocevar committed
178
179
180
181
  imdct_LDFLAGS="${imdct_LDFLAGS} -lm"
  imdct3dn_LDFLAGS="${imdct3dn_LDFLAGS} -lm"
  imdctsse_LDFLAGS="${imdctsse_LDFLAGS} -lm"
  chroma_i420_rgb_LDFLAGS="${chroma_i420_rgb_LDFLAGS} -lm"
Sam Hocevar's avatar
   
Sam Hocevar committed
182
)
Sam Hocevar's avatar
   
Sam Hocevar committed
183

Sam Hocevar's avatar
   
Sam Hocevar committed
184
dnl Check for pthreads - borrowed from XMMS
Sam Hocevar's avatar
   
Sam Hocevar committed
185
186
187
188
189
190
191
192
193
194
195
196
197
198
THREAD_LIB=error
if test "x${THREAD_LIB}" = xerror; then
  AC_CHECK_LIB(pthread,pthread_attr_init,THREAD_LIB="-lpthread")
fi
if test "x${THREAD_LIB}" = xerror; then
  AC_CHECK_LIB(pthreads,pthread_attr_init,THREAD_LIB="-lpthreads")
fi
if test "x${THREAD_LIB}" = xerror; then
  AC_CHECK_LIB(c_r,pthread_attr_init,THREAD_LIB="-lc_r")
fi
if test "x${THREAD_LIB}" = xerror; then
  AC_CHECK_FUNC(pthread_attr_init)
  THREAD_LIB=""
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
199
200
201

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

Sam Hocevar's avatar
   
Sam Hocevar committed
203
204
205
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
206
            Define if <pthread.h> defines pthread_cond_t.)])
Sam Hocevar's avatar
Sam Hocevar committed
207
208
209
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
210
211
AC_EGREP_HEADER(strncasecmp,strings.h,[
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
Sam Hocevar's avatar
   
Sam Hocevar committed
212
            Define if <strings.h> defines strncasecmp.)])
Sam Hocevar's avatar
   
Sam Hocevar committed
213

Sam Hocevar's avatar
   
Sam Hocevar committed
214
dnl Check for headers
Sam Hocevar's avatar
Sam Hocevar committed
215
AC_CHECK_HEADERS(stdint.h getopt.h strings.h inttypes.h sys/int_types.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
216
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
217
218
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
219
AC_CHECK_HEADERS(machine/param.h sys/shm.h)
220
AC_CHECK_HEADERS(linux/version.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
221

Sam Hocevar's avatar
   
Sam Hocevar committed
222
223
AC_HEADER_TIME

224
dnl Mac OS X and other OSes don't have declaration for nanosleep
225
226
227
228
AC_EGREP_HEADER(nanosleep,time.h,[
  AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
            Define if <time.h> defines nanosleep.)
])
229
230

dnl Make sure we have timespecs
231
232
233
234
AC_EGREP_HEADER(timespec,sys/time.h,[
  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
            Define if <sys/time.h> defines struct timespec.)
])
235

Sam Hocevar's avatar
   
Sam Hocevar committed
236
237
238
dnl Check for threads library
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)

Sam Hocevar's avatar
   
Sam Hocevar committed
239
240
241
242
243
244
245
246
247
dnl Check for DPMS
if test x$SYS != xmingw32
then
  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
Sam Hocevar's avatar
   
Sam Hocevar committed
248
  CPPFLAGS="$save_CPPFLAGS -I$x_includes"
Sam Hocevar's avatar
   
Sam Hocevar committed
249
250
251
252
253
254
  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.)
    ])
  ])
Sam Hocevar's avatar
   
Sam Hocevar committed
255
  CPPFLAGS="$save_CPPFLAGS"
Sam Hocevar's avatar
   
Sam Hocevar committed
256
257
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
258
dnl Check for ntohl, etc.
259
260
261
262
263
264
265
266
267
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)])
if test x"$ac_cv_c_ntohl_sys_param_h" != x"no"; then
    AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
268

Sam Hocevar's avatar
   
Sam Hocevar committed
269
dnl Check for inline function size limit
270
271
272
273
274
275
276
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)])
if test x"$ac_cv_c_inline_limit" != x"no"; then
    save_CFLAGS="${save_CFLAGS} -finline-limit-30000"
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
277

Sam Hocevar's avatar
   
Sam Hocevar committed
278
279
280
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
281
    [CFLAGS="-Wall -Winline ${save_CFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
282
283
     AC_TRY_COMPILE([],,ac_cv_c_Wall_Winline=yes, ac_cv_c_Wall_Winline=no)])
if test x"$ac_cv_c_Wall_Winline" != x"no"; then
Sam Hocevar's avatar
Sam Hocevar committed
284
    save_CFLAGS="-Wall -Winline ${save_CFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
285
286
287
else
    AC_CACHE_CHECK([if \$CC accepts -wall -winline],
        [ac_cv_c_wall_winline],
Sam Hocevar's avatar
Sam Hocevar committed
288
        [CFLAGS="-wall -winline ${save_CFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
289
290
         AC_TRY_COMPILE([],,ac_cv_c_wall_winline=yes, ac_cv_c_wall_winline=no)])
    if test x"$ac_cv_c_wall_winline" != x"no"; then
Sam Hocevar's avatar
Sam Hocevar committed
291
        save_CFLAGS="-wall -winline ${save_CFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
    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)])
if test x"$ac_cv_c_pipe" != x"no"; then
    save_CFLAGS="${save_CFLAGS} -pipe"
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)])
if test x"$ac_cv_c_o3" != x"no"; then
    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)])
    if test x"$ac_cv_c_o2" != x"no"; then
        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)])
        if test x"$ac_cv_c_o" != x"no"; then
            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)])
if test x"$ac_cv_c_fast_math" != x"no"; then
    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)])
if test x"$ac_cv_c_unroll_loops" != x"no"; then
    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)])
if test x"$ac_cv_c_omit_frame_pointer" != x"no"; then
    CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
Sam Hocevar's avatar
Sam Hocevar committed
354
355
    # this plugin does not compile without -fomit-frame-pointer, damn gcc!
    chroma_i420_yuy2_mmx_CFLAGS="${chroma_i420_yuy2_mmx_CFLAGS} -fomit-frame-pointer"
Sam Hocevar's avatar
   
Sam Hocevar committed
356
357
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
358
dnl Check for Darwin plugin linking flags
Christophe Massiot's avatar
Christophe Massiot committed
359
AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
360
    [ac_cv_ld_darwin],
Christophe Massiot's avatar
Christophe Massiot committed
361
    [CFLAGS="${save_CFLAGS} -bundle -undefined error -lcc_dynamic"
362
363
     AC_TRY_COMPILE([],,ac_cv_ld_darwin=yes, ac_cv_ld_darwin=no)])
if test x"$ac_cv_ld_darwin" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
364
    plugins_LDFLAGS="${plugins_LDFLAGS} -bundle -undefined error -lcc_dynamic"
365
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
366
367

dnl Check for standard plugin linking flags
368
369
370
371
372
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)])
if test x"$ac_cv_ld_plugins" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
373
    plugins_LDFLAGS="${plugins_LDFLAGS} -shared"
Sam Hocevar's avatar
   
Sam Hocevar committed
374
fi
375
        
376
377
378
379
380
381
382
383
384
385
386
387
388
389
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)])
if test x"$ac_cv_cpp_variadic_macros" != x"no"; then
    AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
fi

390
391
392
393
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
394
        CFLAGS="${save_CFLAGS} -Werror"
395
396
397
398
399
400
401
402
403
404
    for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
        AC_TRY_COMPILE([],
        [static char c __attribute__ ((aligned($ac_cv_c_attr_align_try))) = 0; return c;],
        [ac_cv_c_attribute_aligned=$ac_cv_c_attr_align_try])
    done])
if test x"$ac_cv_c_attribute_aligned" != x"0"; then
    AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
        [$ac_cv_c_attribute_aligned],[Maximum supported data alignment])
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
405
406
407
408
409
410
411
412
dnl
dnl  Check the CPU
dnl
case x"${target_cpu}" in
  x)
    ARCH=unknown
    ;;
  *)
Sam Hocevar's avatar
   
Sam Hocevar committed
413
    ARCH="${target_cpu}"
Sam Hocevar's avatar
   
Sam Hocevar committed
414
415
    ;;
esac
Sam Hocevar's avatar
   
Sam Hocevar committed
416
417
418
419

dnl
dnl  default modules
dnl
Sam Hocevar's avatar
Sam Hocevar committed
420
421
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"
Sam Hocevar's avatar
   
Sam Hocevar committed
422
423
424
425

dnl
dnl  Accelerated modules
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
426
MMX_MODULES="memcpymmx idctmmx motionmmx chroma_i420_rgb_mmx chroma_i420_yuy2_mmx chroma_i422_yuy2_mmx chroma_i420_ymga_mmx"
Sam Hocevar's avatar
   
Sam Hocevar committed
427
428
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
gbazin's avatar
   
gbazin committed
429
SSE_MODULES="imdctsse downmixsse"
430
ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec"
431

432
433
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
Sam Hocevar's avatar
Sam Hocevar committed
434
435
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
436
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
437
if test x"$ac_cv_mmx_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
438
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
439
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
440

441
442
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
Sam Hocevar's avatar
Sam Hocevar committed
443
444
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
445
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
446
if test x"$ac_cv_mmxext_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
447
  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
448
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
449

450
451
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
Sam Hocevar's avatar
Sam Hocevar committed
452
453
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
454
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
455
if test x"$ac_cv_3dnow_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
456
  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
457
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
458
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
459

460
461
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
Sam Hocevar's avatar
Sam Hocevar committed
462
463
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
464
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
Sam Hocevar's avatar
   
Sam Hocevar committed
465
if test x"$ac_cv_sse_inline" != x"no" -a x$SYS != xmingw32; then
Sam Hocevar's avatar
   
Sam Hocevar committed
466
  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
467
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
468
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
469

Sam Hocevar's avatar
Sam Hocevar committed
470
# don't try to grok AltiVec with native mingw32 it doesn't work right now
gbazin's avatar
   
gbazin committed
471
472
# we should be able to remove this test with future versions of mingw32
if test x$SYS != xmingw32; then
Sam Hocevar's avatar
Sam Hocevar committed
473
AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
474
    [ac_cv_altivec_inline],
Sam Hocevar's avatar
Sam Hocevar committed
475
476
    [CFLAGS="${save_CFLAGS}"
     AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
477
         ac_cv_altivec_inline=yes,
Sam Hocevar's avatar
Sam Hocevar committed
478
         [CFLAGS="$save_CFLAGS -Wa,-m7400"
Sam Hocevar's avatar
   
Sam Hocevar committed
479
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
480
            [ac_cv_altivec_inline="-Wa,-m7400"],
481
            ac_cv_altivec_inline=no)
482
         ])])
483
if test x"$ac_cv_altivec_inline" != x"no"; then
Sam Hocevar's avatar
Sam Hocevar committed
484
  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
485
  if test x"$ac_cv_altivec_inline" != x"yes"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
486
487
488
489
    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"
490
  fi
491
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
492
fi
493

Sam Hocevar's avatar
Sam Hocevar committed
494
AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
495
    [ac_cv_c_altivec],
Sam Hocevar's avatar
Sam Hocevar committed
496
    [CFLAGS="$save_CFLAGS -faltivec"
497
     # Darwin test
Sam Hocevar's avatar
   
Sam Hocevar committed
498
     AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
499
500
        ac_cv_c_altivec=-faltivec, [
        # Linux/PPC test
Sam Hocevar's avatar
   
Sam Hocevar committed
501
        CFLAGS="$save_CFLAGS $idctaltivec_CFLAGS -fvec"
Sam Hocevar's avatar
   
Sam Hocevar committed
502
        AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
503
504
505
            [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
        ])
    ])
506
if test x"$ac_cv_c_altivec" != x"no"; then
Sam Hocevar's avatar
Sam Hocevar committed
507
  AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
Sam Hocevar's avatar
   
Sam Hocevar committed
508
509
510
511
  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"
512
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
513
514
515
516
fi

AC_CACHE_CHECK([if linker needs -framework vecLib],
    [ac_cv_ld_altivec],
Sam Hocevar's avatar
Sam Hocevar committed
517
    [LDFLAGS="$vlc_LDFLAGS -framework vecLib"
518
519
520
     AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
    ])
if test x"$ac_cv_ld_altivec" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
521
522
523
524
  idctaltivec_LDFLAGS="${idctaltivec_LDFLAGS} -framework vecLib"
  motionaltivec_LDFLAGS="${motionaltivec_LDFLAGS} -framework vecLib"
  memcpyaltivec_LDFLAGS="${memcpyaltivec_LDFLAGS} -framework vecLib"
  vlc_LDFLAGS="${vlc_LDFLAGS} -framework vecLib"
525
fi
gbazin's avatar
   
gbazin committed
526
fi # end if mingw32
527
528


Sam Hocevar's avatar
   
Sam Hocevar committed
529
530
531
AC_ARG_WITH(,[])
AC_ARG_WITH(,[Optimization options:])

Sam Hocevar's avatar
   
Sam Hocevar committed
532
dnl
533
dnl  Special arch tuning
Sam Hocevar's avatar
   
Sam Hocevar committed
534
dnl
535
AC_ARG_WITH(tuning,
Sam Hocevar's avatar
   
Sam Hocevar committed
536
[  --with-tuning=ARCH      enable special tuning for an architecture
537
                          (default i686 on IA-32 and 750 on PPC)])
538
539
if test "x$with_tuning" != "x"; then
    TUNING="$with_tuning"
540
else
541
    if test x${target_cpu} = xi686 -o x${target_cpu} = xi586 -o x${target_cpu} = xi486 -o x${target_cpu} = xi386; then TUNING="pentiumpro"
542
    else
543
        if test x${target_cpu} = xpowerpc; then TUNING="750"; fi
544
545
    fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
546
547

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
548
dnl  x86 accelerations
Sam Hocevar's avatar
   
Sam Hocevar committed
549
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
550
551
552
if test x${target_cpu} = xi686 -o x${target_cpu} = xi586 -o x${target_cpu} = xx86 -o x${target_cpu} = xi386
then
    ARCH="${ARCH} mmx"
Sam Hocevar's avatar
Sam Hocevar committed
553
    PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
Sam Hocevar's avatar
   
Sam Hocevar committed
554
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
555

Sam Hocevar's avatar
   
Sam Hocevar committed
556
557
558
559
560
dnl
dnl  Enable/disable optimizations
dnl
AC_ARG_ENABLE(optimizations,
[  --disable-optimizations disable compiler optimizations (default enabled)],
561
[ if test x$enable_optimizations = xno; then OPTIMS=0; fi ],
Sam Hocevar's avatar
   
Sam Hocevar committed
562
563
[ OPTIMS=1 ])

Sam Hocevar's avatar
   
Sam Hocevar committed
564
565
566
dnl
dnl  AltiVec acceleration
dnl
567
AC_ARG_ENABLE(altivec,
Sam Hocevar's avatar
Sam Hocevar committed
568
[  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
569
[ if test x$enable_altivec = xyes; then ARCH="${ARCH} altivec";
570
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
571
[ if test x${target_cpu} = xpowerpc; then ARCH="${ARCH} altivec";
572
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
573
574
575
576

dnl
dnl  Debugging mode
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
577
DEBUG=0
578
AC_ARG_ENABLE(debug,
Sam Hocevar's avatar
   
Sam Hocevar committed
579
[  --enable-debug          debug mode (default disabled)],
580
[ if test x$enable_debug = xyes; then DEBUG=1; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
581

Sam Hocevar's avatar
   
Sam Hocevar committed
582
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
583
dnl  Enable release-specific flags
Sam Hocevar's avatar
   
Sam Hocevar committed
584
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
585
RELEASE=0
Sam Hocevar's avatar
   
Sam Hocevar committed
586
587
AC_ARG_ENABLE(release,
[  --enable-release        activate extra optimizations (default disabled)],
588
[ if test x$enable_release = xyes; then RELEASE=1; fi ],
Sam Hocevar's avatar
   
Sam Hocevar committed
589
[ VERSION="${VERSION}_`date +%Y-%m-%d`" ])
Sam Hocevar's avatar
   
Sam Hocevar committed
590

Sam Hocevar's avatar
   
Sam Hocevar committed
591
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
592
dnl  Input plugins
Sam Hocevar's avatar
   
Sam Hocevar committed
593
594
dnl

Sam Hocevar's avatar
   
Sam Hocevar committed
595
AC_ARG_WITH(,[Input plugins:])
Sam Hocevar's avatar
   
Sam Hocevar committed
596
597

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
598
599
600
601
dnl  DVD module: optionally check for installed libdvdcss
dnl
AC_ARG_ENABLE(dvd,
[  --enable-dvd            DVD input module (default enabled)])
602
if test "x$enable_dvd" != "xno"
Sam Hocevar's avatar
   
Sam Hocevar committed
603
604
605
then
  AC_ARG_WITH(dvdcss, 
  [    --with-dvdcss=PATH    libdvdcss headers and libraries])
Sam Hocevar's avatar
   
Sam Hocevar committed
606
607
  AC_ARG_WITH(dvdcss-tree, 
  [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
Sam Hocevar's avatar
   
Sam Hocevar committed
608
  case "x$with_dvdcss" in
Sam Hocevar's avatar
   
Sam Hocevar committed
609
  x|xyes)
Sam Hocevar's avatar
   
Sam Hocevar committed
610
611
612
613
    if test "x$with_dvdcss_tree" = x
    then
      AC_CHECK_HEADERS(dvdcss/dvdcss.h,
        [ PLUGINS="${PLUGINS} dvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
614
          dvd_LDFLAGS="${dvd_LDFLAGS} -ldvdcss" ],
Sam Hocevar's avatar
   
Sam Hocevar committed
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
        [ 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`"
      if test "x$real_dvdcss_tree" = x
      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"
Sam Hocevar's avatar
   
Sam Hocevar committed
631
632
        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
633
634
635
636
637
638
      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
639
640
  ;;
  xno)
Sam Hocevar's avatar
   
Sam Hocevar committed
641
    dnl  Compile without dvdcss (dlopen version, works only under Linux)
Sam Hocevar's avatar
   
Sam Hocevar committed
642
    PLUGINS="${PLUGINS} dvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
643
644
    dvd_CFLAGS="${dvd_CFLAGS} -DGOD_DAMN_DMCA"
    dvd_LDFLAGS="${dvd_LDFLAGS} -ldl"
Sam Hocevar's avatar
   
Sam Hocevar committed
645
646
  ;;
  *)
Sam Hocevar's avatar
   
Sam Hocevar committed
647
648
    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
649
    then
Sam Hocevar's avatar
   
Sam Hocevar committed
650
      dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
Sam Hocevar's avatar
   
Sam Hocevar committed
651
      AC_MSG_RESULT(yes)
Sam Hocevar's avatar
   
Sam Hocevar committed
652
      PLUGINS="${PLUGINS} dvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
653
654
      dvd_LDFLAGS="${dvd_LDFLAGS} -L${with_dvdcss}/lib -ldvdcss"
      dvd_CFLAGS="${dvd_CFLAGS} -I${with_dvdcss}/include"
Sam Hocevar's avatar
   
Sam Hocevar committed
655
    else
Sam Hocevar's avatar
   
Sam Hocevar committed
656
      dnl  No libdvdcss could be found, sorry
Sam Hocevar's avatar
   
Sam Hocevar committed
657
      AC_MSG_RESULT(no)
Sam Hocevar's avatar
   
Sam Hocevar committed
658
      AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
Sam Hocevar's avatar
   
Sam Hocevar committed
659
660
661
662
    fi
  ;;
  esac
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
663

Stéphane Borel's avatar
Stéphane Borel committed
664
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
665
dnl dvdread module: check for libdvdread plugin
Stéphane Borel's avatar
Stéphane Borel committed
666
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
667
668
AC_ARG_ENABLE(dvdread,
[  --enable-dvdread        dvdread input module (default disabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
669
if test "x$enable_dvdread" != "xno"
Sam Hocevar's avatar
   
Sam Hocevar committed
670
671
672
then
  AC_ARG_WITH(dvdread, 
  [    --with-dvdread=PATH   libdvdread headers and libraries])
673
  if test "x$with_dvdread" = x
Sam Hocevar's avatar
   
Sam Hocevar committed
674
675
676
677
  then
    test_LDFLAGS=""
    test_CFLAGS=""
  else
678
679
    test_LDFLAGS="-L${with_dvdread}/lib"
    test_CFLAGS="-I${with_dvdread}/include"
Sam Hocevar's avatar
   
Sam Hocevar committed
680
681
682
  fi
  CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
  AC_CHECK_HEADERS(dvdread/dvd_reader.h, [
Sam Hocevar's avatar
Sam Hocevar committed
683
     CFLAGS="${save_CFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
684
685
686
687
688
689
     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}"
        ],[
Sam Hocevar's avatar
   
Sam Hocevar committed
690
          if test "x$enable_dvdread" != x
Sam Hocevar's avatar
   
Sam Hocevar committed
691
692
693
694
695
          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
        ])
  ],[
Sam Hocevar's avatar
   
Sam Hocevar committed
696
    if test "x$enable_dvdread" != x
697
    then
698
      if test "x$with_dvdread" != x
Sam Hocevar's avatar
   
Sam Hocevar committed
699
      then
700
        AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h in ${with_dvdread}/include])
Sam Hocevar's avatar
   
Sam Hocevar committed
701
702
703
      else
        AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h])
      fi
Sam Hocevar's avatar
   
Sam Hocevar committed
704
    fi
Sam Hocevar's avatar
   
Sam Hocevar committed
705
706
  ])
  CPPFLAGS="$save_CPPFLAGS"
Sam Hocevar's avatar
   
Sam Hocevar committed
707
fi
Stéphane Borel's avatar
Stéphane Borel committed
708

709
710
711
712
713
dnl
dnl  libdvbpsi ts demux
dnl
AC_ARG_ENABLE(dvbpsi,
[  --enable-dvbpsi        dvbpsi ts demux module (default disabled)])
714
if test "x$enable_dvbpsi" != "xno"
715
then
716
717
  AC_ARG_WITH(dvbpsi, 
  [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
718
719
720
721
722
  AC_ARG_WITH(dvbpsi,
  [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
  case "x$with_dvbpsi" in
  x|xyes)
    if test "x$with_dvbpsi_tree" = x
723
    then
Sam Hocevar's avatar
Sam Hocevar committed
724
725
      AC_CHECK_HEADERS(dvbpsi/dr.h,
        [ PLUGINS="${PLUGINS} mpeg_ts_dvbpsi"
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
          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`"
      if test "x$real_dvbpsi_tree" = x
      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
749
    fi
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
  ;;
  xno)
    dnl  Compile without dvbpsi (dlopen version, works only under Linux)
  ;;
  *)
    AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
    if test "x$with_dvbpsi" = x
    then
      test_LDFLAGS=""
      test_CFLAGS=""
    else
      test_LDFLAGS="-L${with_dvbpsi}/lib"
      test_CFLAGS="-I${with_dvbpsi}/include"
    fi
    CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
    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}"
      ],[
      if test "x$enable_dvbpsi" != x
      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
    ])
    CPPFLAGS="$save_CPPFLAGS"
  ;;
  esac
778
fi
779

780
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
781
dnl  VCD module
782
783
dnl
AC_ARG_ENABLE(vcd,
784
  [  --enable-vcd            VCD support for Linux, FreeBSD and MacOS X (default enabled)])
785

Sam Hocevar's avatar
   
Sam Hocevar committed
786
787
788
if test x$enable_vcd != xno
then
  AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
789
    PLUGINS="${PLUGINS} vcd"
Sam Hocevar's avatar
   
Sam Hocevar committed
790
  ])
791
792
  
  AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
793
    PLUGINS="${PLUGINS} vcd"
794
795
    AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
  ])
796
  
Sam Hocevar's avatar
   
Sam Hocevar committed
797
798
799
800
  if test "x${SYS}" = "xbsdi"
  then
    PLUGINS="${PLUGINS} vcd"
  fi
801

Sam Hocevar's avatar
   
Sam Hocevar committed
802
803
  if test "x${SYS}" = "xdarwin"
  then
804
    # No need to add vcd to PLUGINS, Darwin is already based on FreeBSD
Sam Hocevar's avatar
   
Sam Hocevar committed
805
    vcd_LDFLAGS="${vcd_LDFLAGS} -framework IOKit -framework CoreFoundation" 
Sam Hocevar's avatar
   
Sam Hocevar committed
806
  fi
Jon Lech Johansen's avatar
Jon Lech Johansen committed
807
808
fi

Johan Bilien's avatar
Johan Bilien committed
809
810
811
812
dnl
dnl  Satellite input module
dnl
AC_ARG_ENABLE(satellite,
Sam Hocevar's avatar
   
Sam Hocevar committed
813
  [  --enable-satellite      satellite card support (default disabled)],
Johan Bilien's avatar
Johan Bilien committed
814
815
  [ if test x$enable_satellite = xyes
    then
816
      PLUGINS="${PLUGINS} satellite"
Johan Bilien's avatar
Johan Bilien committed
817
818
    fi])

819
dnl
820
dnl  ipv6 plugin - not for QNX yet
821
dnl
gbazin's avatar
   
gbazin committed
822
if test x$SYS != xnto && test "x$SYS" != "xmingw32"
823
then
Sam Hocevar's avatar
Sam Hocevar committed
824
  CFLAGS="$save_CFLAGS"
825
826
827
828
829
  AC_CHECK_FUNC(inet_pton,[PLUGINS="${PLUGINS} ipv6"],[
    AC_CHECK_LIB(resolv,inet_pton,
      [PLUGINS="${PLUGINS} ipv6"
       ipv6_LDFLAGS="${ipv6_LDFLAGS} -lresolv"])
  ])
830
fi
gbazin's avatar
   
gbazin committed
831
832
833
834
835
836
if test "x$SYS" = "xmingw32"
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
837

838
839
840
841
842
843
844
845
846
847
dnl
dnl  AVI demux plugin
dnl
AC_ARG_ENABLE(avi,
  [  --enable-avi            AVI demux module (default enabled)])
if test x$enable_avi != xno
then
  PLUGINS="${PLUGINS} avi"
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
848
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
849
dnl  Codec plugins
Sam Hocevar's avatar
   
Sam Hocevar committed
850
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
851

Sam Hocevar's avatar
   
Sam Hocevar committed
852
AC_ARG_WITH(,[Codec plugins:])
Sam Hocevar's avatar
   
Sam Hocevar committed
853

854
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
855
dnl  mad plugin
856
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
857
858
AC_ARG_ENABLE(mad,
  [  --enable-mad            libmad module (default disabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
859
if test x$enable_mad = xyes
Sam Hocevar's avatar
   
Sam Hocevar committed
860
861
then
  AC_ARG_WITH(mad,
gbazin's avatar
   
gbazin committed
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
    [    --with-mad=PATH       path to libmad],[],[])
  if test "x$with_mad" != "xno" -a "x$with_mad" != "x"
  then
    mad_CFLAGS="${mad_CFLAGS} -I$with_mad/include"
    mad_LDFLAGS="${mad_LDFLAGS} -L$with_mad/lib"
  fi

  AC_ARG_WITH(mad-tree,
    [    --with-mad-tree=PATH  mad tree for static linking],[],[])
  if test "x$with_mad_tree" != "xno" -a "x$with_mad_tree" != "x"
  then
    real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
    if test "x$real_mad_tree" = x
    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"
      save_LDFLAGS=$LDFLAGS
      LDFLAGS=$mad_LDFLAGS
      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 ])
      ],[])
      LDFLAGS=$save_LDFLAGS
    else
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([the specified tree doesn't have mad.h])
    fi
  else
Sam Hocevar's avatar
Sam Hocevar committed
900
901
    CFLAGS="$vlc_CFLAGS $mad_CFLAGS"
    LDFLAGS="$vlc_LDFLAGS $mad_LDFLAGS"
gbazin's avatar
   
gbazin committed
902
903
    AC_CHECK_HEADERS(mad.h, ,
      [ AC_MSG_ERROR([Cannot find development headers for libmad...]) ])
904
    AC_CHECK_LIB(mad, mad_bit_init, [
gbazin's avatar
   
gbazin committed
905
      PLUGINS="${PLUGINS} mad"
906
      mad_LDFLAGS="${mad_LDFLAGS} -lmad" ],
gbazin's avatar
   
gbazin committed
907
908
      [ AC_MSG_ERROR([Cannot find libmad library...]) ])
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
909
fi
910

911
912
913
914
915
dnl
dnl  ffmpeg decoder plugin
dnl
AC_ARG_ENABLE(ffmpeg,
[  --enable-ffmpeg         ffmpeg codec (default disabled)])
916
if test "x$enable_ffmpeg" = "xyes"
917
then
918
919
920
921
922
923
924
925
  AC_ARG_WITH(ffmpeg,
    [    --with-ffmpeg=PATH    path to ffmpeg installation],[],[])
  if test "x$with_ffmpeg" != "xno" -a "x$with_ffmpeg" != "x"
  then
    ffmpeg_CFLAGS="${ffmpeg_CFLAGS} -I$with_ffmpeg/include/libffmpeg"
    ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -L$with_ffmpeg/lib"
  fi

926
927
  AC_ARG_WITH(ffmpeg-tree, 
  [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
928
  if test "x$with_ffmpeg_tree" != "x"
929
930
931
932
933
934
935
936
937
938
939
940
941
942
  then
    AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
    real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
    if test "x$real_ffmpeg_tree" = x
    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"
943
      ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} ${real_ffmpeg_tree}/libavcodec/libavcodec.a -lm"
944
945
946
947
948
949
      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
950
951
952
953
  else
    save_CFLAGS=$CFLAGS
    save_LDFLAGS=$LDFLAGS
    CFLAGS="$CFLAGS $ffmpeg_CFLAGS"
954
    LDFLAGS="$LDFLAGS $ffmpeg_LDFLAGS -lm"
955
956
    AC_CHECK_LIB(avcodec, avcodec_init, [
      BUILTINS="${BUILTINS} ffmpeg"
957
      ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -lavcodec -lm" ],
958
959
960
      [ AC_MSG_ERROR([Cannot find libavcodec library...]) ])
    CFLAGS=$save_CFLAGS
    LDFLAGS=$save_LDFLAGS
961
962
963
964
  fi
fi


Sam Hocevar's avatar
   
Sam Hocevar committed
965
dnl special case for BeOS
Sam Hocevar's avatar
   
Sam Hocevar committed
966
967
if test x$SYS = xbeos
then
Sam Hocevar's avatar
   
Sam Hocevar committed
968
    PLUGINS="${PLUGINS} beos"
Sam Hocevar's avatar
   
Sam Hocevar committed
969
fi
970

gbazin's avatar
   
gbazin committed
971
dnl
gbazin's avatar
   
gbazin committed
972
dnl  a52 AC3 decoder plugin
gbazin's avatar
   
gbazin committed
973
dnl
gbazin's avatar
   
gbazin committed
974
AC_ARG_ENABLE(a52,
Sam Hocevar's avatar
   
Sam Hocevar committed
975
  [  --enable-a52            AC3 support with liba52 (default enabled)])
gbazin's avatar
   
gbazin committed
976
977
978
979
980
if test "x$enable_a52" != "xno"
then
  AC_ARG_WITH(a52-tree,
    [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
  if test "x$with_a52_tree" != "xno" -a "x$with_a52_tree" != "x"
gbazin's avatar
   
gbazin committed
981
  then
gbazin's avatar
   
gbazin committed
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
    real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
    if test "x$real_a52_tree" = x
    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"
      save_LDFLAGS=$LDFLAGS
      LDFLAGS="$a52_LDFLAGS $LDFLAGS"
      AC_CHECK_LIB(a52, a52_free, [
        BUILTINS="${BUILTINS} a52"
        a52_LDFLAGS="${a52_LDFLAGS} -la52 -lm"