configure.in 68.2 KB
Newer Older
Sam Hocevar's avatar
   
Sam Hocevar committed
1
dnl Autoconf settings for vlc
2
AC_INIT(configure.in)
3
4

AC_PREREQ(2.50)
5
AC_CANONICAL_SYSTEM
6

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

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

13
14
15
AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION})
AM_CONFIG_HEADER(config.h)

Sam Hocevar's avatar
Sam Hocevar committed
16
17
18
dnl
dnl  Save *FLAGS
dnl
19
save_CPPFLAGS="${CPPFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
20
save_CFLAGS="${CFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
21
save_LDFLAGS="${LDFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
22

Sam Hocevar's avatar
Sam Hocevar committed
23
dnl
24
dnl Check for tools
Sam Hocevar's avatar
Sam Hocevar committed
25
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
26
27
AC_PROG_CC
AC_PROG_CPP
28
29
AC_PROG_MAKE_SET
AC_PROG_INSTALL
30

gbazin's avatar
   
gbazin committed
31
32
dnl Find the right ranlib, even when cross-compiling
AC_CHECK_TOOL(RANLIB, ranlib, :)
Sam Hocevar's avatar
   
Sam Hocevar committed
33
AC_CHECK_TOOL(STRIP, strip, :)
gbazin's avatar
   
gbazin committed
34

Sam Hocevar's avatar
Sam Hocevar committed
35
dnl
Christophe Massiot's avatar
Christophe Massiot committed
36
dnl Check for GNU make
Sam Hocevar's avatar
Sam Hocevar committed
37
dnl
Christophe Massiot's avatar
Christophe Massiot committed
38
AC_PATH_PROG(GMAKE, gmake, no)
39
if test "x${GMAKE}" = "xno"; then
40
41
42
43
44
45
46
47
48
49
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"
Christophe Massiot's avatar
Christophe Massiot committed
50
else
51
VLC_MAKE="gmake"
Christophe Massiot's avatar
Christophe Massiot committed
52
53
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
54
dnl Gettext stuff
55
ALL_LINGUAS="de en_GB fr ja no ru nl pl se"
56
AM_GNU_GETTEXT_VERSION(0.10.40)
Sam Hocevar's avatar
   
Sam Hocevar committed
57
58
AM_GNU_GETTEXT

59
60
61
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL

62
63
64
65
dnl Check for compiler properties
AC_C_CONST
AC_C_INLINE

Sam Hocevar's avatar
Sam Hocevar committed
66
67
68
69
70
dnl
dnl  Set default LDFLAGS
dnl
vlc_LDFLAGS="${LDFLAGS}"

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

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

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

140
dnl Check for system libs needed
141
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
142

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

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

Sam Hocevar's avatar
   
Sam Hocevar committed
181
dnl Check for getopt
Sam Hocevar's avatar
   
Sam Hocevar committed
182
NEED_GETOPT=0
Sam Hocevar's avatar
   
Sam Hocevar committed
183
184
AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
[ # FreeBSD has a gnugetopt library for this:
185
186
187
AC_CHECK_LIB([gnugetopt],[getopt_long],
[AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) vlc_LDFLAGS="${vlc_LDFLAGS} -lgnugetopt"],
[NEED_GETOPT=1])])
Sam Hocevar's avatar
   
Sam Hocevar committed
188

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

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

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

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

Sam Hocevar's avatar
   
Sam Hocevar committed
233
dnl Check for headers
Sam Hocevar's avatar
Sam Hocevar committed
234
AC_CHECK_HEADERS(stdint.h getopt.h strings.h inttypes.h sys/int_types.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
235
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
236
237
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
238
AC_CHECK_HEADERS(machine/param.h sys/shm.h)
239
AC_CHECK_HEADERS(linux/version.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
240

Sam Hocevar's avatar
   
Sam Hocevar committed
241
242
AC_HEADER_TIME

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

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

Sam Hocevar's avatar
   
Sam Hocevar committed
255
256
257
dnl Check for threads library
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)

258
259
dnl Default X headers and libraries
if test "x${x_includes}" = "xNONE"; then
260
x_includes="/usr/X11R6/include"
261
262
fi
if test "x${x_libraries}" = "xNONE"; then
263
x_libraries="/usr/X11R6/lib"
264
265
fi

266
267
268
dnl Build the gtk_main plugin?
NEED_GTK_MAIN=no

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

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

Sam Hocevar's avatar
   
Sam Hocevar committed
293
dnl Check for inline function size limit
294
AC_CACHE_CHECK([if \$CC accepts -finline-limit],
295
296
297
[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)])
298
if test "x${ac_cv_c_inline_limit}" != "xno"; then
299
save_CFLAGS="${save_CFLAGS} -finline-limit-30000"; CFLAGS="${save_CFLAGS}"
300
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
301

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

dnl Check for -pipe
AC_CACHE_CHECK([if \$CC accepts -pipe],
321
322
323
[ac_cv_c_pipe],
[CFLAGS="${save_CFLAGS} -pipe"
 AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
324
if test "x${ac_cv_c_pipe}" != "xno"; then
325
save_CFLAGS="${save_CFLAGS} -pipe"; CFLAGS="${save_CFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
326
327
328
329
fi

dnl Check for various optimization flags
AC_CACHE_CHECK([if \$CC accepts -O3],
330
331
332
[ac_cv_c_o3],
[CFLAGS="${save_CFLAGS} -O3"
 AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
333
if test "x${ac_cv_c_o3}" != "xno"; then
334
CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
Sam Hocevar's avatar
   
Sam Hocevar committed
335
else
336
337
338
339
340
341
342
343
344
345
346
347
348
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}" != "xno"; 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}" != "xno"; then
        CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
Sam Hocevar's avatar
   
Sam Hocevar committed
349
350
    fi
fi
351
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
352
353
354

dnl Check for -ffast-math
AC_CACHE_CHECK([if \$CC accepts -ffast-math],
355
356
357
[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)])
358
if test "x${ac_cv_c_fast_math}" != "xno"; then
359
CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
Sam Hocevar's avatar
   
Sam Hocevar committed
360
361
362
363
fi

dnl Check for -funroll-loops
AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
364
365
366
[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)])
367
if test "x${ac_cv_c_unroll_loops}" != "xno"; then
368
CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
Sam Hocevar's avatar
   
Sam Hocevar committed
369
370
371
372
fi

dnl Check for -fomit-frame-pointer
AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
373
374
375
[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)])
376
if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
377
378
379
CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
# this plugin does not compile without -fomit-frame-pointer, damn gcc!
i420_yuy2_mmx_CFLAGS="${i420_yuy2_mmx_CFLAGS} -fomit-frame-pointer"
Sam Hocevar's avatar
   
Sam Hocevar committed
380
381
fi

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

dnl Check for standard plugin linking flags
392
AC_CACHE_CHECK([if \$CC accepts -shared],
393
394
395
[ac_cv_ld_plugins],
[CFLAGS="${save_CFLAGS} -shared"
 AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
396
if test "x${ac_cv_ld_plugins}" != "xno"; then
397
plugins_LDFLAGS="${plugins_LDFLAGS} -shared"
Sam Hocevar's avatar
   
Sam Hocevar committed
398
fi
399
    
400
401
dnl Check for variadic macros
AC_CACHE_CHECK([for variadic cpp macros],
402
403
404
405
406
407
408
409
[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)])
410
if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
411
AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
412
413
fi

414
415
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
416
417
418
419
420
421
422
423
424
[ac_cv_c_attribute_aligned],
[ac_cv_c_attribute_aligned=0
    CFLAGS="${save_CFLAGS} -Werror"
for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
    AC_TRY_COMPILE([],
    [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
    [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
done
    CFLAGS="${save_CFLAGS}"])
425
if test "x${ac_cv_c_attribute_aligned}" != "x0"; then
426
427
AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
    [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
428
429
fi

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

dnl
dnl  default modules
dnl
445
BUILTINS="${BUILTINS}"
446
PLUGINS="${PLUGINS} misc/dummy/dummy misc/null"
447
PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file misc/memcpy/memcpy"
448
PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts demux/a52sys"
449
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/mpeg_audio/mpeg_audio"
450
PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/a52old/a52old codec/a52 codec/lpcm"
sigmunau's avatar
sigmunau committed
451
PLUGINS="${PLUGINS} video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop video_filter/motionblur"
452
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 audio_filter/converter/s16tofloat32swab"
453
PLUGINS="${PLUGINS} audio_filter/resampler/trivial audio_filter/resampler/ugly"
454
PLUGINS="${PLUGINS} audio_filter/channel_mixer/trivial"
455
PLUGINS="${PLUGINS} audio_mixer/float32 audio_mixer/trivial audio_mixer/spdif"
456
457
PLUGINS="${PLUGINS} audio_output/file"
#PLUGINS="${PLUGINS} visualization/scope/scope"
458
PLUGINS="${PLUGINS} video_chroma/i420_rgb video_chroma/i420_yuy2 video_chroma/i422_yuy2 video_chroma/i420_ymga"
459
PLUGINS="${PLUGINS} demux/util/id3"
460
461
462
463
464
dnl
dnl  Network modules
dnl
NETWORK_MODULES="access/udp access/http access/rtp misc/network/ipv4"

Sam Hocevar's avatar
   
Sam Hocevar committed
465
466
467
dnl
dnl  Accelerated modules
dnl
468
469
470
471
472
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"
473

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

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

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

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

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

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

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

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


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

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

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
596
dnl  x86 accelerations
Sam Hocevar's avatar
   
Sam Hocevar committed
597
dnl
598
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
599
600
then
    ARCH="${ARCH} mmx"
Sam Hocevar's avatar
Sam Hocevar committed
601
    PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
Sam Hocevar's avatar
   
Sam Hocevar committed
602
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
603

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

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

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

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

Sam Hocevar's avatar
   
Sam Hocevar committed
639
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
640
dnl  Input plugins
Sam Hocevar's avatar
   
Sam Hocevar committed
641
642
dnl

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

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

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

792

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

864
865
866
867
868
869
870
871
872
873
874
875
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

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

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

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

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

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

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

950
951
952
953
954
955
956
957
958
959
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