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

5
AC_CANONICAL_SYSTEM
6

Sam Hocevar's avatar
   
Sam Hocevar committed
7
8
9
HAVE_VLC=0
if test -r src/interface/main.c; then
  HAVE_VLC=1
10
  VLC_VERSION="0.2.92-dev"
Sam Hocevar's avatar
   
Sam Hocevar committed
11
12
13
14
15
16
  VLC_CODENAME=Ourumov
fi

HAVE_LIBDVDCSS=0
if test -r extras/libdvdcss/libdvdcss.c; then
  HAVE_LIBDVDCSS=1
17
  LIBDVDCSS_VERSION="1.0.1-dev"
Sam Hocevar's avatar
   
Sam Hocevar committed
18
  AC_SUBST(LIBDVDCSS_VERSION)
19
20
21
  if test -r extras/libdvdcss/csskeys.h; then
    AC_DEFINE(HAVE_CSSKEYS,1,css decryption with player keys)
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
22
fi
23

Sam Hocevar's avatar
   
Sam Hocevar committed
24
dnl Save CFLAGS and LDFLAGS
Sam Hocevar's avatar
   
Sam Hocevar committed
25
save_CFLAGS="${CFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
26
save_LDFLAGS="${LDFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
27

28
29
dnl Check for tools
AC_PROG_MAKE_SET
Sam Hocevar's avatar
   
Sam Hocevar committed
30
31
AC_PROG_CC
AC_PROG_CPP
32

gbazin's avatar
   
gbazin committed
33
34
35
dnl Find the right ranlib, even when cross-compiling
AC_CHECK_TOOL(RANLIB, ranlib, :)

Sam Hocevar's avatar
   
Sam Hocevar committed
36
dnl Gettext stuff
Sam Hocevar's avatar
   
Sam Hocevar committed
37
ALL_LINGUAS="de fr no ru"
Sam Hocevar's avatar
Sam Hocevar committed
38

Sam Hocevar's avatar
   
Sam Hocevar committed
39
40
AC_DEFINE_UNQUOTED(PACKAGE, "vlc")
AC_DEFINE_UNQUOTED(VERSION, "$VLC_VERSION")
Sam Hocevar's avatar
   
Sam Hocevar committed
41
42
AM_GNU_GETTEXT

43
44
45
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL

gbazin's avatar
   
gbazin committed
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
dnl
dnl  Check the operating system
dnl
case x"${target_os}" in
  x)
    SYS=unknown
    ;;
  xlinux*)
    SYS=linux
    ;;
  xbsdi*)
    SYS=bsdi
    ;;
  xdarwin*)
    SYS=darwin
    ;;
  x*mingw32*)
    SYS=mingw32
    AC_CHECK_TOOL(WINDRES, windres, :)
Sam Hocevar's avatar
   
Sam Hocevar committed
65
    LIB_IPV4="${LIB_IPV4} -lws2_32"
gbazin's avatar
   
gbazin committed
66
67
68
69
70
71
72
73
74
    LIB_RC="${LIB_RC} -lws2_32"
    ;;
  x*nto*)
    SYS=nto
    LIB_X11="${LIB_X11} -lsocket"
    LIB_XVIDEO="${LIB_XVIDEO} -lsocket"
    ;;
  xbeos)
    SYS=beos
Sam Hocevar's avatar
   
Sam Hocevar committed
75
    LIB="${LIB} -lbe -lbind"
gbazin's avatar
   
gbazin committed
76
77
78
79
80
81
82
83
    LIB_BEOS="${LIB_BEOS} -lbe -lgame -lroot -ltracker"
    PLDFLAGS="${PLDFLAGS} -nostart"
    ;;
  x*)
    SYS=${target_os}
    ;;
esac

84
dnl Check for system libs needed
Sam Hocevar's avatar
   
Sam Hocevar committed
85
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty)
Sam Hocevar's avatar
   
Sam Hocevar committed
86
87
88
89
90
91
92
93
94
95
96
AC_CHECK_FUNC(connect,,[
  AC_CHECK_LIB(socket,connect,LIB="${LIB} -lsocket")
])
AC_CHECK_FUNC(gethostbyname,,[
  AC_CHECK_LIB(nsl,gethostbyname,LIB="${LIB} -lnsl")
])
AC_CHECK_FUNC(nanosleep,,[
  AC_CHECK_LIB(rt,nanosleep,LIB="${LIB} -lrt",[
    AC_CHECK_LIB(posix4,nanosleep,LIB="${LIB} -lposix4")
  ])
])
97
AC_CHECK_FUNCS(usleep)
Sam Hocevar's avatar
   
Sam Hocevar committed
98
99
100
AC_CHECK_FUNC(inet_aton,,[
  AC_CHECK_LIB(resolv,inet_aton,LIB="${LIB} -lresolv")
])
Sam Hocevar's avatar
   
Sam Hocevar committed
101
AC_CHECK_FUNCS(vasprintf)
Sam Hocevar's avatar
   
Sam Hocevar committed
102
AC_CHECK_FUNCS(swab)
103
AC_CHECK_FUNCS([memalign valloc])
Sam Hocevar's avatar
   
Sam Hocevar committed
104

Sam Hocevar's avatar
   
Sam Hocevar committed
105
AC_CHECK_FUNCS(sigrelse)
gbazin's avatar
   
gbazin committed
106
AC_CHECK_FUNCS(getpwuid_r getpwuid)
Sam Hocevar's avatar
   
Sam Hocevar committed
107

Sam Hocevar's avatar
   
Sam Hocevar committed
108
dnl Check for getopt
Sam Hocevar's avatar
   
Sam Hocevar committed
109
NEED_GETOPT=0
Sam Hocevar's avatar
   
Sam Hocevar committed
110
111
112
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
113
    [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) LIB="${LIB} -lgnugetopt"],
Sam Hocevar's avatar
   
Sam Hocevar committed
114
    [NEED_GETOPT=1])])
Sam Hocevar's avatar
   
Sam Hocevar committed
115

116
AC_TYPE_SIGNAL
Sam Hocevar's avatar
   
Sam Hocevar committed
117
AC_CHECK_LIB(dl,dlopen,LIB="${LIB} -ldl")
Sam Hocevar's avatar
   
Sam Hocevar committed
118
119
120
AC_CHECK_LIB(m,cos,
  LIB_IMDCT="${LIB_IMDCT} -lm"
  LIB_FILTER_DISTORT="${LIB_FILTER_DISTORT} -lm")
Sam Hocevar's avatar
   
Sam Hocevar committed
121
122
123
124
125
AC_CHECK_LIB(m,pow,
  LIB_IMDCT="${LIB_IMDCT} -lm"
  LIB_IMDCT3DN="${LIB_IMDCT3DN} -lm"
  LIB_IMDCTSSE="${LIB_IMDCTSSE} -lm"
)
Sam Hocevar's avatar
   
Sam Hocevar committed
126

Sam Hocevar's avatar
   
Sam Hocevar committed
127
dnl Check for pthreads - borrowed from XMMS
Sam Hocevar's avatar
   
Sam Hocevar committed
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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
142
143
144

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

Sam Hocevar's avatar
   
Sam Hocevar committed
146
147
148
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
149
            Define if <pthread.h> defines pthread_cond_t.)])
Sam Hocevar's avatar
   
Sam Hocevar committed
150
151
AC_EGREP_HEADER(strncasecmp,strings.h,[
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
Sam Hocevar's avatar
   
Sam Hocevar committed
152
            Define if <strings.h> defines strncasecmp.)])
Sam Hocevar's avatar
   
Sam Hocevar committed
153

Sam Hocevar's avatar
   
Sam Hocevar committed
154
dnl Check for headers
Sam Hocevar's avatar
   
Sam Hocevar committed
155
AC_CHECK_HEADERS(getopt.h strings.h)
156
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/time.h sys/times.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
157
158
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
159
AC_CHECK_HEADERS(machine/param.h sys/shm.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
160

Sam Hocevar's avatar
   
Sam Hocevar committed
161
162
AC_HEADER_TIME

Sam Hocevar's avatar
   
Sam Hocevar committed
163
164
165
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
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
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$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=$saved_CPPFLAGS
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
186
dnl Check for ntohl, etc.
187
188
189
190
191
192
193
194
195
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
196

Sam Hocevar's avatar
   
Sam Hocevar committed
197
dnl Check for inline function size limit
198
199
200
201
202
203
204
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
205

Sam Hocevar's avatar
   
Sam Hocevar committed
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
dnl Check for -W or -w flags
AC_CACHE_CHECK([if \$CC accepts -Wall -Winline],
    [ac_cv_c_Wall_Winline],
    [CFLAGS="${save_CFLAGS} -Wall -Winline"
     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
    save_CFLAGS="${save_CFLAGS} -Wall -Winline"
else
    AC_CACHE_CHECK([if \$CC accepts -wall -winline],
        [ac_cv_c_wall_winline],
        [CFLAGS="${save_CFLAGS} -wall -winline"
         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
        save_CFLAGS="${save_CFLAGS} -wall -winline"
    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"
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
284
dnl Check for Darwin plugin linking flags
285
286
287
288
289
AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error],
    [ac_cv_ld_darwin],
    [CFLAGS="${save_CFLAGS} -bundle -undefined error"
     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
290
    PLDFLAGS="${PLDFLAGS} -bundle -undefined error"
291
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
292
293

dnl Check for standard plugin linking flags
294
295
296
297
298
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
299
    PLDFLAGS="${PLDFLAGS} -shared"
Sam Hocevar's avatar
   
Sam Hocevar committed
300
fi
301
302
        
dnl Check for soname setting
Sam Hocevar's avatar
   
Sam Hocevar committed
303
if test x"${SOFLAGS}" = x; then
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
    AC_CACHE_CHECK([for soname setting],
        [ac_cv_ld_soname],
        [
        # Standard
        try_SOFLAGS="-Wl,-soname -Wl,"
        LDFLAGS="${save_LDFLAGS} ${try_SOFLAGS}foo.so.0"
        AC_TRY_LINK([],,ac_cv_ld_soname="${try_SOFLAGS}", [
            # SunOS
            try_SOFLAGS="-Wl,-h -Wl,"
            LDFLAGS="${save_LDFLAGS} ${try_SOFLAGS}foo.so.0"
            AC_TRY_LINK([],,ac_cv_ld_soname="${try_SOFLAGS}",
                ac_cv_ld_soname=none)
        ])])
    if test x"$ac_cv_ld_soname" != x"none"; then
        SOFLAGS=$ac_cv_ld_soname
    else
        echo "
------------
Your system doesn't seem to have support for dynamic linking. You may
have problems using libdvdcss.
------------
"
326
    fi
Sam Hocevar's avatar
   
Sam Hocevar committed
327
328
fi

329
330
331
332
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
333
        CFLAGS="${save_CFLAGS} -Werror"
334
335
336
337
338
339
340
341
342
343
    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
344
dnl End of the bizarre compilation tests
Sam Hocevar's avatar
   
Sam Hocevar committed
345
CFLAGS="${save_CFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
346
LDFLAGS="${save_LDFLAGS}"
Christophe Massiot's avatar
Christophe Massiot committed
347

348
dnl Check for boolean_t
349
350
AC_CACHE_CHECK([for boolean_t in sys/types.h],
    [ac_cv_c_boolean_t_sys_types_h],
Sam Hocevar's avatar
   
Sam Hocevar committed
351
    [AC_TRY_COMPILE([#include <sys/types.h>], [boolean_t foo;],
352
353
354
355
356
357
358
     ac_cv_c_boolean_t_sys_types_h=yes, ac_cv_c_boolean_t_sys_types_h=no)])
if test x"$ac_cv_c_boolean_t_sys_types_h" != x"no"; then
    AC_DEFINE(BOOLEAN_T_IN_SYS_TYPES_H, 1, Define if <sys/types.h> defines boolean_t.)
fi

AC_CACHE_CHECK([for boolean_t in pthread.h],
    [ac_cv_c_boolean_t_pthread_h],
Sam Hocevar's avatar
   
Sam Hocevar committed
359
    [AC_TRY_COMPILE([#include <pthread.h>], [boolean_t foo;],
360
361
362
363
364
365
366
     ac_cv_c_boolean_t_pthread_h=yes, ac_cv_c_boolean_t_pthread_h=no)])
if test x"$ac_cv_c_boolean_t_pthread_h" != x"no"; then
    AC_DEFINE(BOOLEAN_T_IN_PTHREAD_H, 1, Define if <pthread.h> defines boolean_t.)
fi

AC_CACHE_CHECK([for boolean_t in cthreads.h],
    [ac_cv_c_boolean_t_cthreads_h],
Sam Hocevar's avatar
   
Sam Hocevar committed
367
    [AC_TRY_COMPILE([#include <cthreads.h>], [boolean_t foo;],
368
369
370
371
     ac_cv_c_boolean_t_cthreads_h=yes, ac_cv_c_boolean_t_cthreads_h=no)])
if test x"$ac_cv_c_boolean_t_cthreads_h" != x"no"; then
    AC_DEFINE(BOOLEAN_T_IN_CTHREADS_H, 1, Define if <cthreads.h> defines boolean_t.)
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
372

Sam Hocevar's avatar
   
Sam Hocevar committed
373
374
375
376
377
378
379
380
381
382
383
dnl
dnl  Check the CPU
dnl
case x"${target_cpu}" in
  x)
    ARCH=unknown
    ;;
  *)
    ARCH=${target_cpu}
    ;;
esac
Sam Hocevar's avatar
   
Sam Hocevar committed
384
385
386
387

dnl
dnl  default modules
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
388
BUILTINS="${BUILTINS} idct idctclassic motion imdct downmix chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga mpeg_adec ac3_adec mpeg_vdec"
Sam Hocevar's avatar
   
Sam Hocevar committed
389
PLUGINS="${PLUGINS} dummy null rc logger mpeg_es mpeg_ps mpeg_ts file udp http ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort fx_scope"
Sam Hocevar's avatar
   
Sam Hocevar committed
390
391
392
393

dnl
dnl  Accelerated modules
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
394
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
395
396
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
Sam Hocevar's avatar
   
Sam Hocevar committed
397
SSE_MODULES="imdctsse downmixsse"
398
ALTIVEC_MODULES="idctaltivec motionaltivec"
399

400
401
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
402
    [AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
403
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
404
if test x"$ac_cv_mmx_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
405
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
406
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
407

408
409
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
410
    [AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
411
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
412
if test x"$ac_cv_mmxext_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
413
  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
414
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
415

416
417
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
418
    [AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
419
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
420
if test x"$ac_cv_3dnow_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
421
  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
422
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
423
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
424

425
426
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
427
    [AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
428
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
429
if test x"$ac_cv_sse_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
430
  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
431
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
432
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
433

gbazin's avatar
   
gbazin committed
434
435
436
# don't try to grok altivec with native mingw32 it doesn't work right now
# we should be able to remove this test with future versions of mingw32
if test x$SYS != xmingw32; then
437
438
AC_CACHE_CHECK([if \$CC groks Altivec inline assembly],
    [ac_cv_altivec_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
439
    [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
440
441
442
         ac_cv_altivec_inline=yes,
         [save_CFLAGS=$CFLAGS
          CFLAGS="$CFLAGS -Wa,-m7400"
Sam Hocevar's avatar
   
Sam Hocevar committed
443
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
444
            [ac_cv_altivec_inline="-Wa,-m7400"],
445
            ac_cv_altivec_inline=no)
446
447
          CFLAGS=$save_CFLAGS
         ])])
448
if test x"$ac_cv_altivec_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
449
  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks ALTIVEC inline assembly.)
450
  if test x"$ac_cv_altivec_inline" != x"yes"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
451
452
    CFLAGS_IDCTALTIVEC="$CFLAGS_IDCTALTIVEC $ac_cv_altivec_inline"
    CFLAGS_MOTIONALTIVEC="$CFLAGS_MOTIONALTIVEC $ac_cv_altivec_inline"
Sam Hocevar's avatar
   
Sam Hocevar committed
453
    CFLAGS_VLC="$CFLAGS_VLC $ac_cv_altivec_inline"
454
  fi
455
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
456
fi
457

458
459
AC_CACHE_CHECK([if \$CC groks Altivec C extensions],
    [ac_cv_c_altivec],
460
461
462
    [save_CFLAGS=$CFLAGS
     CFLAGS="$CFLAGS -faltivec"
     # Darwin test
Sam Hocevar's avatar
   
Sam Hocevar committed
463
     AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
464
465
        ac_cv_c_altivec=-faltivec, [
        # Linux/PPC test
Sam Hocevar's avatar
   
Sam Hocevar committed
466
        CFLAGS="$save_CFLAGS $CFLAGS_IDCTALTIVEC -fvec"
Sam Hocevar's avatar
   
Sam Hocevar committed
467
        AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
468
469
470
471
            [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
        ])
     CFLAGS=$save_CFLAGS
    ])
472
if test x"$ac_cv_c_altivec" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
473
  AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C altivec extensions.)
Sam Hocevar's avatar
   
Sam Hocevar committed
474
475
  CFLAGS_IDCTALTIVEC="$CFLAGS_IDCTALTIVEC $ac_cv_c_altivec"
  CFLAGS_MOTIONALTIVEC="$CFLAGS_MOTIONALTIVEC $ac_cv_c_altivec"
Sam Hocevar's avatar
   
Sam Hocevar committed
476
  CFLAGS_VLC="$CFLAGS_VLC $ac_cv_c_altivec"
477
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
478
479
480
481
482
483
484
485
486
487
fi

AC_CACHE_CHECK([if linker needs -framework vecLib],
    [ac_cv_ld_altivec],
    [save_LDFLAGS=$LDFLAGS
     LDFLAGS="$LDFLAGS -framework vecLib"
     AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
     LDFLAGS=$save_LDFLAGS
    ])
if test x"$ac_cv_ld_altivec" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
488
489
  LIB_IDCTALTIVEC="${LIB_IDCTALTIVEC} -framework vecLib"
  LIB_MOTIONALTIVEC="${LIB_MOTIONALTIVEC} -framework vecLib"
Sam Hocevar's avatar
   
Sam Hocevar committed
490
  LIB="${LIB} -framework vecLib"
491
fi
gbazin's avatar
   
gbazin committed
492
fi # end if mingw32
493
494

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
495
dnl  DVD and VCD devices
496
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
497
498
case x$SYS in
  xmingw32)
Sam Hocevar's avatar
   
Sam Hocevar committed
499
500
501
502
503
504
505
506
507
508
509
510
    DVD_DEVICE="E:"
    VCD_DEVICE="E:"
    ;;
  *)
    DVD_DEVICE="/dev/dvd"
    VCD_DEVICE="/dev/cdrom"
    ;;
esac

AC_DEFINE_UNQUOTED(DVD_DEVICE, "$DVD_DEVICE")
AC_DEFINE_UNQUOTED(VCD_DEVICE, "$VCD_DEVICE")

511

Sam Hocevar's avatar
   
Sam Hocevar committed
512
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
513
dnl  libdvdcss: check for DVD ioctls
Sam Hocevar's avatar
   
Sam Hocevar committed
514
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
515

Sam Hocevar's avatar
   
Sam Hocevar committed
516
517
518
dnl  default is no
CAN_BUILD_LIBDVDCSS=0

Sam Hocevar's avatar
   
Sam Hocevar committed
519
520
dnl  for windoze
AC_CHECK_HEADERS(winioctl.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
521
  CAN_BUILD_LIBDVDCSS="${HAVE_LIBDVDCSS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
522
523
])

Sam Hocevar's avatar
   
Sam Hocevar committed
524
dnl  for Un*x and BeOS
Sam Hocevar's avatar
   
Sam Hocevar committed
525
AC_CHECK_HEADERS(sys/ioctl.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
526
  CAN_BUILD_LIBDVDCSS="${HAVE_LIBDVDCSS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
527
  AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h dvd.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
528
  BSD_DVD_STRUCT=0
Sam Hocevar's avatar
   
Sam Hocevar committed
529
  LINUX_DVD_STRUCT=0
530
  OPENBSD_DVD_STRUCT=0
Sam Hocevar's avatar
   
Sam Hocevar committed
531
532
533
  dnl
  dnl Old FreeBSD: sys/cdio.h
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
534
535
536
537
  AC_EGREP_HEADER(dvd_struct,sys/cdio.h,[
    AC_DEFINE(DVD_STRUCT_IN_SYS_CDIO_H, 1,
              Define if <sys/cdio.h> defines dvd_struct.)
    AC_EGREP_HEADER(struct dvd_struct,sys/cdio.h,[
538
                    BSD_DVD_STRUCT=1],[LINUX_DVD_STRUCT=1; OPENBSD_DVD_STRUCT=1])
Sam Hocevar's avatar
   
Sam Hocevar committed
539
540
541
542
  ])
  dnl
  dnl Newer FreeBSD: sys/dvdio.h
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
543
544
545
546
547
  AC_EGREP_HEADER(dvd_struct,sys/dvdio.h,[
    AC_DEFINE(DVD_STRUCT_IN_SYS_DVDIO_H, 1,
              Define if <sys/dvdio.h> defines dvd_struct.)
    AC_EGREP_HEADER(struct dvd_struct,sys/dvdio.h,[
                    BSD_DVD_STRUCT=1],[LINUX_DVD_STRUCT=1])
Sam Hocevar's avatar
   
Sam Hocevar committed
548
549
550
551
552
553
554
  ])
  dnl
  dnl Linux: linux/cdrom.h
  dnl
  AC_EGREP_HEADER(dvd_struct,linux/cdrom.h,[
    AC_DEFINE(DVD_STRUCT_IN_LINUX_CDROM_H, 1,
              Define if <linux/cdrom.h> defines DVD_STRUCT.)
Sam Hocevar's avatar
   
Sam Hocevar committed
555
556
557
558
559
    LINUX_DVD_STRUCT=1
  ])
  dnl
  dnl BSDI: dvd.h
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
560
  NEED_BSDI_LIBDVD=0
Sam Hocevar's avatar
   
Sam Hocevar committed
561
562
563
  AC_EGREP_HEADER(dvd_struct,dvd.h,[
    AC_DEFINE(DVD_STRUCT_IN_DVD_H, 1,
              Define if <dvd.h> defines DVD_STRUCT.)
Sam Hocevar's avatar
   
Sam Hocevar committed
564
    LIB_LIBDVDCSS="${LIB_LIBDVDCSS} -ldvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
565
    LINUX_DVD_STRUCT=1
Sam Hocevar's avatar
   
Sam Hocevar committed
566
567
568
569
570
571
  ],[
    dnl
    dnl BSDI: /sys/dev/scsi/scsi_ioctl.h, using our own libdvd
    dnl
    AC_CHECK_HEADERS(/sys/dev/scsi/scsi_ioctl.h,[
      NEED_BSDI_LIBDVD=1
Sam Hocevar's avatar
   
Sam Hocevar committed
572
573
      AC_DEFINE(DVD_STRUCT_IN_BSDI_DVDIOCTL_DVD_H, 1,
                Define if <extras/BSDI_dvdioctl/dvd.h> defines DVD_STRUCT.)
Sam Hocevar's avatar
   
Sam Hocevar committed
574
      SRC_DVDCSS_EXTRA="${SRC_DVDCSS_EXTRA} bsdi_dvdioctl.c"
Sam Hocevar's avatar
   
Sam Hocevar committed
575
576
      LINUX_DVD_STRUCT=1
    ])
Sam Hocevar's avatar
   
Sam Hocevar committed
577
  ])
Sam Hocevar's avatar
   
Sam Hocevar committed
578
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
579
  dnl Solaris: sys/scsi/scsi_types.h, sys/scsi/impl/uscsi.h
Sam Hocevar's avatar
   
Sam Hocevar committed
580
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
581
  AC_CHECK_HEADER(sys/scsi/scsi_types.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
582
583
584
585
586
    AC_CHECK_HEADER(sys/scsi/impl/uscsi.h,[
      AC_DEFINE(SOLARIS_USCSI, 1, Have userspace SCSI headers.)
    ])
  ])
  dnl
587
588
589
590
591
592
593
594
  dnl HP-UX: sys/scsi.h
  dnl
  AC_CHECK_HEADER(sys/scsi.h,[
    AC_EGREP_HEADER(sctl_io,sys/scsi.h,[
      AC_DEFINE(HPUX_SCTL_IO, 1, Define if <sys/scsi.h> defines sctl_io.)
    ])
  ])
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
595
596
597
598
599
  dnl Final tests to check what was detected
  dnl
  if test x$LINUX_DVD_STRUCT = x1; then
    AC_DEFINE(HAVE_LINUX_DVD_STRUCT, 1,
              Define if Linux-like dvd_struct is defined.)
600
601
602
603
    if test x$OPENBSD_DVD_STRUCT = x1; then
      AC_DEFINE(HAVE_OPENBSD_DVD_STRUCT, 1,
                Define if OpenBSD-like dvd_struct is defined.)
    fi
Sam Hocevar's avatar
   
Sam Hocevar committed
604
605
606
  else
    if test x$BSD_DVD_STRUCT = x1; then
      AC_DEFINE(HAVE_BSD_DVD_STRUCT, 1,
Sam Hocevar's avatar
   
Sam Hocevar committed
607
                Define if FreeBSD-like dvd_struct is defined.)
Sam Hocevar's avatar
   
Sam Hocevar committed
608
609
    fi
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
610
611
])

Sam Hocevar's avatar
   
Sam Hocevar committed
612
613
614
AC_ARG_WITH(,[])
AC_ARG_WITH(,[Optimization options:])

Sam Hocevar's avatar
   
Sam Hocevar committed
615
dnl
616
dnl  Special arch tuning
Sam Hocevar's avatar
   
Sam Hocevar committed
617
dnl
618
AC_ARG_WITH(tuning,
Sam Hocevar's avatar
   
Sam Hocevar committed
619
[  --with-tuning=ARCH      enable special tuning for an architecture
620
621
622
623
                          (default i686 on IA-32 and 750 on PPC)])
if test "x$withval" != "x"; then
    TUNING=$withval
else
624
    if test x${target_cpu} = xi686 -o x${target_cpu} = xi586 -o x${target_cpu} = xi486 -o x${target_cpu} = xi386; then TUNING="pentiumpro"
625
    else
626
        if test x${target_cpu} = xpowerpc; then TUNING="750"; fi
627
628
    fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
629
630

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
631
dnl  x86 accelerations
Sam Hocevar's avatar
   
Sam Hocevar committed
632
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
633
634
635
636
637
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"
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
638

Sam Hocevar's avatar
   
Sam Hocevar committed
639
640
641
642
643
644
645
646
dnl
dnl  Enable/disable optimizations
dnl
AC_ARG_ENABLE(optimizations,
[  --disable-optimizations disable compiler optimizations (default enabled)],
[ if test x$enableval = xno; then OPTIMS=0; fi ],
[ OPTIMS=1 ])

Sam Hocevar's avatar
   
Sam Hocevar committed
647
648
649
dnl
dnl  AltiVec acceleration
dnl
650
AC_ARG_ENABLE(altivec,
Sam Hocevar's avatar
   
Sam Hocevar committed
651
[  --disable-altivec       disable altivec optimizations (default enabled on PPC)],
652
653
[ if test x$enableval = xyes; then ARCH="${ARCH} altivec";
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
654
[ if test x${target_cpu} = xpowerpc; then ARCH="${ARCH} altivec";
655
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
656
657
658
659

dnl
dnl  Debugging mode
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
660
DEBUG=0
661
AC_ARG_ENABLE(debug,
Sam Hocevar's avatar
   
Sam Hocevar committed
662
[  --enable-debug          debug mode (default disabled)],
663
[ if test x$enableval = xyes; then DEBUG=1; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
664

Sam Hocevar's avatar
   
Sam Hocevar committed
665
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
666
dnl  Enable release-specific flags
Sam Hocevar's avatar
   
Sam Hocevar committed
667
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
668
669
670
671
672
AC_ARG_ENABLE(release,
[  --enable-release        activate extra optimizations (default disabled)],
[ if test x$enableval = xyes; then RELEASE=1; fi ],
[ VLC_VERSION="${VLC_VERSION}_`date +%Y-%m-%d`";
  LIBDVDCSS_VERSION="${LIBDVDCSS_VERSION}_`date +%Y-%m-%d`"; ])
Sam Hocevar's avatar
   
Sam Hocevar committed
673

Sam Hocevar's avatar
   
Sam Hocevar committed
674
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
675
dnl  Input plugins
Sam Hocevar's avatar
   
Sam Hocevar committed
676
677
dnl

Sam Hocevar's avatar
   
Sam Hocevar committed
678
AC_ARG_WITH(,[Input plugins:])
Sam Hocevar's avatar
   
Sam Hocevar committed
679
680

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
681
dnl  DVD module: check for installed libdvdcss or local libdvdcss
Sam Hocevar's avatar
   
Sam Hocevar committed
682
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
683
NEED_LIBDVDCSS=0
Sam Hocevar's avatar
   
Sam Hocevar committed
684
STATIC_LIBDVDCSS=0
Sam Hocevar's avatar
   
Sam Hocevar committed
685
DUMMY_LIBDVDCSS=0
Sam Hocevar's avatar
   
Sam Hocevar committed
686
AC_ARG_WITH(dvdcss,
Sam Hocevar's avatar
   
Sam Hocevar committed
687
688
689
  [  --with-dvdcss[=name]    use libdvdcss, either 'yes', 'no', 'local-static',
                          'local-shared', or a path to another libdvdcss such
                          as '/usr/local' (default 'local-static')],
Sam Hocevar's avatar
   
Sam Hocevar committed
690
691
692
  [ case "x${withval}" in
    xlocal-static|xyes)
      # local libdvdcss, statically linked
Stéphane Borel's avatar
   
Stéphane Borel committed
693
      BUILTINS="${BUILTINS} dvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
694
695
      if test x${CAN_BUILD_LIBDVDCSS} = x1
      then
Sam Hocevar's avatar
   
Sam Hocevar committed
696
        NEED_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
697
698
        STATIC_LIBDVDCSS=1
        CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss"
Sam Hocevar's avatar
   
Sam Hocevar committed
699
        LIB_DVD="${LIB_DVD} lib/libdvdcss.a ${LIB_LIBDVDCSS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
700
701
702
703
      fi
    ;;
    xlocal-shared)
      # local libdvdcss, dynamically linked
Stéphane Borel's avatar
   
Stéphane Borel committed
704
      PLUGINS="${PLUGINS} dvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
705
706
      if test x${CAN_BUILD_LIBDVDCSS} = x1
      then
Sam Hocevar's avatar
   
Sam Hocevar committed
707
        NEED_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
708
        CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss"
709
        LIB_DVD="${LIB_DVD} -L../../lib -ldvdcss"
Sam Hocevar's avatar
   
Sam Hocevar committed
710
      fi
Sam Hocevar's avatar
   
Sam Hocevar committed
711
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
712
713
    xno)
      # don't use libdvdcss at all, build a DVD module that can dlopen() it
Sam Hocevar's avatar
   
Sam Hocevar committed
714
      PLUGINS="${PLUGINS} dvd"
715
      DUMMY_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
716
      SRC_DVD_EXTRA="${SRC_DVD_EXTRA} dummy_dvdcss.c"
Sam Hocevar's avatar
   
Sam Hocevar committed
717
      CFLAGS_DVD="${CFLAGS_DVD} -DGOD_DAMN_DMCA"
Sam Hocevar's avatar
   
Sam Hocevar committed
718
      CFLAGS_DVD="${CFLAGS_DVD} -DLIBDVDCSS_VERSION=\"${LIBDVDCSS_VERSION}\""
Sam Hocevar's avatar
   
Sam Hocevar committed
719
720
      LIB_DVD="${LIB_DVD} -ldl"
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
721
    *)
Sam Hocevar's avatar
   
Sam Hocevar committed
722
      # existing libdvdcss
Stéphane Borel's avatar
   
Stéphane Borel committed
723
      PLUGINS="${PLUGINS} dvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
724
725
      if test "x$withval" != "xyes"
      then
726
        LIB_DVD="${LIB_DVD} -L"$withval"/lib"
Sam Hocevar's avatar
   
Sam Hocevar committed
727
728
729
        CFLAGS_DVD="${CFLAGS_DVD} -I"$withval"/include"
      fi
      LIB_DVD="${LIB_DVD} -ldvdcss"
Sam Hocevar's avatar
   
Sam Hocevar committed
730
    esac ],
Sam Hocevar's avatar
   
Sam Hocevar committed
731
  # user didn't decide, we choose to use local libdvdcss and link statically
Sam Hocevar's avatar
   
Sam Hocevar committed
732
  # if libdvdcss is in the archive, or to use the dummy replacement otherwise.
Sam Hocevar's avatar
   
Sam Hocevar committed
733
734
  [ if test x${CAN_BUILD_LIBDVDCSS} = x1
    then
Stéphane Borel's avatar
   
Stéphane Borel committed
735
      BUILTINS="${BUILTINS} dvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
736
      NEED_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
737
738
      STATIC_LIBDVDCSS=1
      CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss"
Sam Hocevar's avatar
   
Sam Hocevar committed
739
      LIB_DVD="${LIB_DVD} lib/libdvdcss.a ${LIB_LIBDVDCSS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
740
741
    else
      # XXX: no check for libdl is done, don't try this at home !
Sam Hocevar's avatar
   
Sam Hocevar committed
742
      PLUGINS="${PLUGINS} dvd"
743
      DUMMY_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
744
      SRC_DVD_EXTRA="${SRC_DVD_EXTRA} dummy_dvdcss.c"
Sam Hocevar's avatar
   
Sam Hocevar committed
745
746
      CFLAGS_DVD="${CFLAGS_DVD} -DGOD_DAMN_DMCA"
      LIB_DVD="${LIB_DVD} -ldl"
Sam Hocevar's avatar
   
Sam Hocevar committed
747
    fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
748

Stéphane Borel's avatar
Stéphane Borel committed
749
750
751
dnl
dnl DVDREAD module: check for libdvdread plugin
dnl
752
753
754
if test x${DUMMY_LIBDVDCSS} = x1; then STATIC_LIBDVDREAD=1; fi
if test x${STATIC_LIBDVDCSS} = x1; then STATIC_LIBDVDREAD=1; fi
AC_ARG_WITH(dvdread,
Sam Hocevar's avatar
   
Sam Hocevar committed
755
  [  --with-dvdread[=name]   use libdvdread, same options as dvdcss (default 'no')],
756
757
758
759
760
761
762
763
  [ case "x${withval}" in
    xlocal-static|xyes)
      if test x${STATIC_LIBDVDREAD} = x1
      then
        BUILTINS="${BUILTINS} dvdread" 
        CFLAGS_DVDREAD="${CFLAGS_DVDREAD} ${CFLAGS_DVD} -I../../extras/libdvdread"
        LIB_DVDREAD="${LIB_DVDREAD} lib/libdvdread.a ${LIB_DVD}"
      else
764
        AC_MSG_ERROR([Can't link static dvdread with shared dvdcss])
765
766
767
768
769
770
771
      fi
    ;;
    xno)
    ;;
    x)
      if test x${STATIC_LIBDVDREAD} = x1
      then
Christophe Massiot's avatar
Christophe Massiot committed
772
        #BUILTINS="${BUILTINS} dvdread" 
773
774
775
        CFLAGS_DVDREAD="${CFLAGS_DVDREAD} ${CFLAGS_DVD} -I../../extras/libdvdread"
        LIB_DVDREAD="${LIB_DVDREAD} lib/libdvdread.a ${LIB_DVD}"
      else
Christophe Massiot's avatar
Christophe Massiot committed
776
        #PLUGINS="${PLUGINS} dvdread"
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
        CFLAGS_DVDREAD="${CFLAGS_DVDREAD} -I../../extras/libdvdread  ${CFLAGS_DVD}"
        LIB_DVDREAD="${LIB_DVDREAD} -Llib -ldvdread ${LIB_DVD}"
      fi 
    ;;
    *)
      if test "x$withval" != "xlocal-shared"
      then
        LIB_DVDREAD="${LIB_DVDREAD} -L"$withval"/lib"
        CFLAGS_DVDREAD="${CFLAGS_DVDREAD} -I"$withval"/include"
      else
        LIB_DVDREAD="${LIB_DVDREAD} -L../../lib"
        CFLAGS_DVDREAD="${CFLAGS_DVDREAD} -I../../extras/libdvdread"
      fi
      if test x${STATIC_LIBDVDCSS} = x1
      then
792
        AC_MSG_ERROR([Can't link shared dvdread with static dvdcss])
793
      else
Christophe Massiot's avatar
Christophe Massiot committed
794
        #PLUGINS="${PLUGINS} dvdread"
795
796
797
798
799
800
801
802
803
804
        CFLAGS_DVDREAD="${CFLAGS_DVDREAD} ${CFLAGS_DVD}"
        LIB_DVDREAD="${LIB_DVDREAD} -ldvdread ${LIB_DVD}"
      fi
    esac
    if test x${DUMMY_LIBDVDCSS} = x1
    then
      LIB_LIBDVDREAD="${LIB_LIBDVDREAD} -ldl"
    else
      LIB_LIBDVDREAD="${LIB_LIBDVDREAD} -L../../lib -ldvdcss"
    fi ])
Stéphane Borel's avatar
Stéphane Borel committed
805

806
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
807
dnl  VCD module
808
809
dnl
AC_ARG_ENABLE(vcd,
Sam Hocevar's avatar
   
Sam Hocevar committed
810
  [  --enable-vcd            VCD support for Linux (default enabled)])
811

Sam Hocevar's avatar
   
Sam Hocevar committed
812
813
814
if test x$enable_vcd != xno
then
  AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
815
    PLUGINS="${PLUGINS} vcd"
Sam Hocevar's avatar
   
Sam Hocevar committed
816
  ])
817

Sam Hocevar's avatar
   
Sam Hocevar committed
818
819
820
821
  if test "x${SYS}" = "xbsdi"
  then
    PLUGINS="${PLUGINS} vcd"
  fi
822

Sam Hocevar's avatar
   
Sam Hocevar committed
823
824
825
826
827
  if test "x${SYS}" = "xdarwin"
  then
    PLUGINS="${PLUGINS} vcd"
    LIB_VCD="${LIB_VCD} -framework IOKit" 
  fi
Jon Lech Johansen's avatar
Jon Lech Johansen committed
828
829
fi

830
831
832
833
834
835
dnl
dnl  ipv6 plugin
dnl
AC_EGREP_HEADER(in6_addr,netinet/in.h,[
  PLUGINS="${PLUGINS} ipv6"])

Sam Hocevar's avatar
   
Sam Hocevar committed
836
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
837
dnl  Codec plugins
Sam Hocevar's avatar
   
Sam Hocevar committed
838
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
839

Sam Hocevar's avatar
   
Sam Hocevar committed
840
AC_ARG_WITH(,[Codec plugins:])
Sam Hocevar's avatar
   
Sam Hocevar committed
841

842
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
843
dnl  mad plugin
844
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
845
846
847
848
849
850
851
852
853
854
AC_ARG_ENABLE(mad,
  [  --enable-mad            libmad module (default disabled)])
if test x$enable_mad == xyes
then
  PLUGINS="${PLUGINS} mad"
  LIB_MAD="${LIB_MAD} -lmad"
  AC_ARG_WITH(mad,
    [    --with-mad=PATH       path to libmad],
    [ if test "x$with_val" != "xno" -a "x$with_val" != "x"
      then
Sam Hocevar's avatar
   
Sam Hocevar committed
855
        CFLAGS_MAD="${CFLAGS_MAD} -I$with_val/include"
Sam Hocevar's avatar
   
Sam Hocevar committed
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
        LIB_MAD="${LIB_MAD} -L$with_val/lib"
      fi ])
  save_CFLAGS=$CFLAGS
  save_LDFLAGS=$LDFLAGS
  CFLAGS="$CFLAGS $CFLAGS_MAD"
  LDFLAGS="$LDFLAGS $LIB_MAD"
  AC_CHECK_HEADERS(mad.h, ,
  [ echo "Cannot find development headers for libmad..."
    exit 1
  ])
  AC_CHECK_LIB(mad, mad_bit_init, ,
  [ echo "Cannot find libmad library..."
    exit 1
  ])
  CFLAGS=$save_CFLAGS
  LDFLAGS=$save_LDFLAGS
fi
873

Sam Hocevar's avatar
   
Sam Hocevar committed
874
dnl special case for BeOS
Sam Hocevar's avatar
   
Sam Hocevar committed
875
876
if test x$SYS = xbeos
then
Sam Hocevar's avatar
   
Sam Hocevar committed
877
    PLUGINS="${PLUGINS} beos"
878
879
880
881

dnl default case
else

gbazin's avatar
   
gbazin committed
882
dnl
gbazin's avatar
   
gbazin committed
883
dnl  a52 AC3 decoder plugin
gbazin's avatar
   
gbazin committed
884
dnl
gbazin's avatar
   
gbazin committed
885
886
AC_ARG_ENABLE(a52,
  [  --disable-a52           AC3 support with liba52 (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
887
if test "x$enableval" != "xno" -a x$SYS != xmingw32
gbazin's avatar
   
gbazin committed
888
889
  then
    AC_CHECK_HEADERS(a52dec/a52.h, [
gbazin's avatar
   
gbazin committed
890
891
      BUILTINS="${BUILTINS} a52"
      LIB_A52="${LIB_A52} -la52"
gbazin's avatar
   
gbazin committed
892
893
894
     ],[])
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
895
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
896
dnl  Video plugins
Sam Hocevar's avatar
   
Sam Hocevar committed
897
898
dnl

Sam Hocevar's avatar
   
Sam Hocevar committed
899
AC_ARG_WITH(,[Video plugins:])
Sam Hocevar's avatar
   
Sam Hocevar committed
900

Sam Hocevar's avatar
   
Sam Hocevar committed
901
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
902
903
dnl  X11 module
dnl  (enabled by default except on win32)
Sam Hocevar's avatar
   
Sam Hocevar committed
904
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
AC_ARG_ENABLE(x11,
  [  --disable-x11           X11 support (default enabled)])
if test x$enable_x11 != xno &&
  (test x$SYS != xmingw32 || test x$enable_x11 = xyes); 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
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS -I$x_includes"
  AC_CHECK_HEADERS(X11/Xlib.h, [
    PLUGINS="${PLUGINS} x11"
    LIB_X11="${LIB_X11} -L$x_libraries -lX11 -lXext"
    CFLAGS_X11="${CFLAGS_X11} -I$x_includes"
  ])
  CPPFLAGS=$saved_CPPFLAGS
fi

dnl
dnl  XVideo module
dnl  (enabled by default except on win32)
dnl
AC_ARG_ENABLE(xvideo,
  [  --disable-xvideo        XVideo support (default enabled)])
if test x$enable_xvideo != xno &&
  (test x$SYS != xmingw32 || test x$enable_xvideo = xyes); 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
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS -I$x_includes"
  AC_CHECK_HEADERS(X11/extensions/Xv.h, [
    saved_CFLAGS=$CFLAGS
    CFLAGS="$CFLAGS -L$x_libraries -lX11 -lXext"
    AC_CHECK_LIB(Xv_pic,XvSetPortAttribute,
      # We have Xv_pic, that's good, we can build an xvideo.so plugin !
      PLUGINS="${PLUGINS} xvideo"
      LIB_XVIDEO="${LIB_XVIDEO} -L$x_libraries -lX11 -lXext -lXv_pic"
      CFLAGS_XVIDEO="${CFLAGS_XVIDEO} -I$x_includes",
      # We don't have Xv_pic, let's make xvideo.a as builtin
      BUILTINS="${BUILTINS} xvideo"
      LIB_XVIDEO="${LIB_XVIDEO} -L$x_libraries -lX11 -lXext -lXv"
      CFLAGS_XVIDEO="${CFLAGS_XVIDEO} -I$x_includes")
    CFLAGS=$saved_CFLAGS
  ]
  CPPFLAGS=$saved_CPPFLAGS)
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
957
958
959
960

dnl
dnl  SDL module
dnl
961
962
AC_ARG_ENABLE(sdl,
  [  --disable-sdl           SDL support (default enabled)])
963
if test "x$enable_sdl" != "xno"
964
then
965
966
  SDL_PATH=$PATH
  AC_ARG_WITH(sdl-config-path,
Sam Hocevar's avatar
   
Sam Hocevar committed
967
    [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
968
969
970
971
972
    [ if test "x$withval" != "xno"
      then
        SDL_PATH=$withval:$PATH
      fi ])
  AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, $SDL_PATH)
973
974
  SDL_CONFIG=${SDL12_CONFIG}
  SDL_HEADER="SDL12/SDL.h"
Sam Hocevar's avatar
   
Sam Hocevar committed
975
976
  if test x${SDL_CONFIG} = xno
  then
977
    AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, $SDL_PATH)
Sam Hocevar's avatar
   
Sam Hocevar committed
978
    SDL_CONFIG=${SDL11_CONFIG}
979
980
    SDL_HEADER="SDL11/SDL.h"
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
981
982
  if test x${SDL_CONFIG} = xno
  then
983
    AC_PATH_PROG(SDL_CONFIG, sdl-config, no, $SDL_PATH)
984
    SDL_HEADER="SDL/SDL.h"
985
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
986
987
  if test x${SDL_CONFIG} != xno
  then
988
    PLUGINS="${PLUGINS} sdl"
Sam Hocevar's avatar
   
Sam Hocevar committed
989
990
    CFLAGS_SDL="${CFLAGS_SDL} `${SDL_CONFIG} --cflags`"
    LIB_SDL="${LIB_SDL} `${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`"
Sam Hocevar's avatar
   
Sam Hocevar committed
991
992
    save_CPPFLAGS=$CPPFLAGS
    CPPFLAGS="$CPPFLAGS $CFLAGS_SDL"
993
994
    AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
      <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
995
996
997
998
      [ AC_MSG_ERROR([The development package for SDL is not installed. 
Please install it and try again. Alternatively you can also configure with 
--disable-sdl.])
      ])
Sam Hocevar's avatar
   
Sam Hocevar committed
999
    CPPFLAGS=$save_CPPFLAGS
Sam Hocevar's avatar
   
Sam Hocevar committed
1000
    if expr 1.1.5 \> `$SDL_CONFIG --version` >/dev/null