configure.in 39.5 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

Sam Hocevar's avatar
   
Sam Hocevar committed
33
dnl Gettext stuff
Sam Hocevar's avatar
   
Sam Hocevar committed
34
ALL_LINGUAS="de fr ru"
Sam Hocevar's avatar
Sam Hocevar committed
35

Sam Hocevar's avatar
   
Sam Hocevar committed
36
37
AC_DEFINE_UNQUOTED(PACKAGE, "vlc")
AC_DEFINE_UNQUOTED(VERSION, "$VLC_VERSION")
Sam Hocevar's avatar
   
Sam Hocevar committed
38
39
AM_GNU_GETTEXT

40
41
42
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL

43
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
44
dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
45
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
46
47
48
49
50
dnl  We give the user the opportunity to specify
dnl  --with-words=big or --with-words=little ; otherwise, try to guess
dnl
AC_ARG_WITH(words,
  [  --with-words=endianness Set endianness (big or little)])
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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
  case "x$withval" in
    xbig)
      ac_cv_c_bigendian=yes
      ;;
    xlittle)
      ac_cv_c_bigendian=no
      ;;
    *)
      dnl  Try to guess endianness by matching patterns on a compiled
      dnl  binary, by looking for an ASCII or EBCDIC string
      ac_cv_c_bigendian=unknown
      AC_MSG_CHECKING(what the byte order looks to be)[
        cat >conftest.c <<EOF
        short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
        short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
        void _a(void) { char*s = (char*)am; s = (char *)ai; }
        short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
        short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
        void _e(void) { char*s = (char*)em; s = (char*)ei; }
        int main(void) { _a(); _e(); return 0; }
EOF
      ]
      if test -f conftest.c
      then 
        if ${CC-cc} conftest.c -o conftest.o >config.log 2>&1 \
            && test -f conftest.o
        then
          if test `grep -l BIGenDianSyS conftest.o`
          then
            AC_MSG_RESULT("big endian")
            ac_cv_c_bigendian=yes
          fi
          if test `grep -l LiTTleEnDian conftest.o`
          then
            AC_MSG_RESULT("little endian")
            ac_cv_c_bigendian=no
          fi
        fi
      fi
      if test $ac_cv_c_bigendian = xunknown
      then
        AC_MSG_ERROR([Could not guess endianness, please use --with-words])
      fi
      dnl  Now we know what to use for endianness, just put it in the header
      if test $ac_cv_c_bigendian = yes
      then
        cat >> confdefs.h <<\EOF
#define WORDS_BIGENDIAN 1
EOF
      fi
      ;;
  esac
103
104

dnl Check for system libs needed
Sam Hocevar's avatar
   
Sam Hocevar committed
105
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty)
Sam Hocevar's avatar
   
Sam Hocevar committed
106
107
108
109
110
111
112
113
114
115
116
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")
  ])
])
117
AC_CHECK_FUNCS(usleep)
Sam Hocevar's avatar
   
Sam Hocevar committed
118
119
120
AC_CHECK_FUNC(inet_aton,,[
  AC_CHECK_LIB(resolv,inet_aton,LIB="${LIB} -lresolv")
])
Sam Hocevar's avatar
   
Sam Hocevar committed
121
AC_CHECK_FUNCS(vasprintf)
Sam Hocevar's avatar
   
Sam Hocevar committed
122
AC_CHECK_FUNCS(swab)
123
AC_CHECK_FUNCS([memalign valloc])
Sam Hocevar's avatar
   
Sam Hocevar committed
124

Sam Hocevar's avatar
   
Sam Hocevar committed
125
126
AC_CHECK_FUNCS(sigrelse)

Sam Hocevar's avatar
   
Sam Hocevar committed
127
dnl Check for getopt
Sam Hocevar's avatar
   
Sam Hocevar committed
128
NEED_GETOPT=0
Sam Hocevar's avatar
   
Sam Hocevar committed
129
130
131
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
132
    [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) LIB="${LIB} -lgnugetopt"],
Sam Hocevar's avatar
   
Sam Hocevar committed
133
    [NEED_GETOPT=1])])
Sam Hocevar's avatar
   
Sam Hocevar committed
134

135
AC_TYPE_SIGNAL
Sam Hocevar's avatar
   
Sam Hocevar committed
136
AC_CHECK_LIB(dl,dlopen,LIB="${LIB} -ldl")
Sam Hocevar's avatar
   
Sam Hocevar committed
137
138
139
AC_CHECK_LIB(m,cos,
  LIB_IMDCT="${LIB_IMDCT} -lm"
  LIB_FILTER_DISTORT="${LIB_FILTER_DISTORT} -lm")
Sam Hocevar's avatar
   
Sam Hocevar committed
140
141
142
143
144
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
145

Sam Hocevar's avatar
   
Sam Hocevar committed
146
dnl Check for pthreads - borrowed from XMMS
Sam Hocevar's avatar
   
Sam Hocevar committed
147
148
149
150
151
152
153
154
155
156
157
158
159
160
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
161
162
163

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

Sam Hocevar's avatar
   
Sam Hocevar committed
165
166
167
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
168
            Define if <pthread.h> defines pthread_cond_t.)])
Sam Hocevar's avatar
   
Sam Hocevar committed
169
170
AC_EGREP_HEADER(strncasecmp,strings.h,[
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
Sam Hocevar's avatar
   
Sam Hocevar committed
171
            Define if <strings.h> defines strncasecmp.)])
Sam Hocevar's avatar
   
Sam Hocevar committed
172

Sam Hocevar's avatar
   
Sam Hocevar committed
173
dnl Check for headers
Sam Hocevar's avatar
   
Sam Hocevar committed
174
AC_CHECK_HEADERS(getopt.h strings.h)
175
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/time.h sys/times.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
176
177
178
179
180
AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h)
AC_CHECK_HEADERS(dlfcn.h image.h)
AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
AC_CHECK_HEADERS(machine/param.h)

Sam Hocevar's avatar
   
Sam Hocevar committed
181
182
AC_HEADER_TIME

Sam Hocevar's avatar
   
Sam Hocevar committed
183
184
185
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
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
dnl Check for Darwin plugin linking flags
207
208
209
210
211
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
212
    PLDFLAGS="${PLDFLAGS} -bundle -undefined error"
213
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
214
215

dnl Check for standard plugin linking flags
216
217
218
219
220
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
221
    PLDFLAGS="${PLDFLAGS} -shared"
Sam Hocevar's avatar
   
Sam Hocevar committed
222
fi
223
224
        
dnl Check for soname setting
Sam Hocevar's avatar
   
Sam Hocevar committed
225
if test x"${SOFLAGS}" = x; then
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
    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.
------------
"
248
    fi
Sam Hocevar's avatar
   
Sam Hocevar committed
249
250
fi

251
252
253
254
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
255
        CFLAGS="${save_CFLAGS} -Werror"
256
257
258
259
260
261
262
263
264
265
    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
266
dnl End of the bizarre compilation tests
Sam Hocevar's avatar
   
Sam Hocevar committed
267
CFLAGS="${save_CFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
268
LDFLAGS="${save_LDFLAGS}"
Christophe Massiot's avatar
Christophe Massiot committed
269

270
dnl Check for boolean_t
271
272
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
273
    [AC_TRY_COMPILE([#include <sys/types.h>], [boolean_t foo;],
274
275
276
277
278
279
280
     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
281
    [AC_TRY_COMPILE([#include <pthread.h>], [boolean_t foo;],
282
283
284
285
286
287
288
     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
289
    [AC_TRY_COMPILE([#include <cthreads.h>], [boolean_t foo;],
290
291
292
293
     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
294

Sam Hocevar's avatar
   
Sam Hocevar committed
295
296
297
298
299
300
301
302
303
304
305
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
306
307
308
309

dnl
dnl  default modules
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
310
BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy idct idctclassic motion imdct downmix chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
Sam Hocevar's avatar
   
Sam Hocevar committed
311
PLUGINS="${PLUGINS} ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort"
Sam Hocevar's avatar
   
Sam Hocevar committed
312
313
314
315

dnl
dnl  Accelerated modules
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
316
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
317
318
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
Sam Hocevar's avatar
   
Sam Hocevar committed
319
SSE_MODULES="imdctsse downmixsse"
320
ALTIVEC_MODULES="idctaltivec motionaltivec"
321

322
323
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
324
    [AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
325
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
326
if test x"$ac_cv_mmx_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
327
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
328
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
329

330
331
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
332
    [AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
333
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
334
if test x"$ac_cv_mmxext_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
335
  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
336
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
337

338
339
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
340
    [AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
341
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
342
if test x"$ac_cv_3dnow_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
343
  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
344
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
345
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
346

347
348
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
349
    [AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
350
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
351
if test x"$ac_cv_sse_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
352
  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
353
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
354
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
355

356
357
AC_CACHE_CHECK([if \$CC groks Altivec inline assembly],
    [ac_cv_altivec_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
358
    [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
359
360
361
         ac_cv_altivec_inline=yes,
         [save_CFLAGS=$CFLAGS
          CFLAGS="$CFLAGS -Wa,-m7400"
Sam Hocevar's avatar
   
Sam Hocevar committed
362
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
363
            [ac_cv_altivec_inline="-Wa,-m7400"],
364
            ac_cv_altivec_inline=no)
365
366
          CFLAGS=$save_CFLAGS
         ])])
367
if test x"$ac_cv_altivec_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
368
  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks ALTIVEC inline assembly.)
369
  if test x"$ac_cv_altivec_inline" != x"yes"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
370
371
    CFLAGS_IDCTALTIVEC="$CFLAGS_IDCTALTIVEC $ac_cv_altivec_inline"
    CFLAGS_MOTIONALTIVEC="$CFLAGS_MOTIONALTIVEC $ac_cv_altivec_inline"
Sam Hocevar's avatar
   
Sam Hocevar committed
372
    CFLAGS_VLC="$CFLAGS_VLC $ac_cv_altivec_inline"
373
  fi
374
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
375
fi
376

377
378
AC_CACHE_CHECK([if \$CC groks Altivec C extensions],
    [ac_cv_c_altivec],
379
380
381
    [save_CFLAGS=$CFLAGS
     CFLAGS="$CFLAGS -faltivec"
     # Darwin test
Sam Hocevar's avatar
   
Sam Hocevar committed
382
     AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
383
384
        ac_cv_c_altivec=-faltivec, [
        # Linux/PPC test
Sam Hocevar's avatar
   
Sam Hocevar committed
385
        CFLAGS="$save_CFLAGS $CFLAGS_IDCTALTIVEC -fvec"
Sam Hocevar's avatar
   
Sam Hocevar committed
386
        AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
387
388
389
390
            [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
        ])
     CFLAGS=$save_CFLAGS
    ])
391
if test x"$ac_cv_c_altivec" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
392
  AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C altivec extensions.)
Sam Hocevar's avatar
   
Sam Hocevar committed
393
394
  CFLAGS_IDCTALTIVEC="$CFLAGS_IDCTALTIVEC $ac_cv_c_altivec"
  CFLAGS_MOTIONALTIVEC="$CFLAGS_MOTIONALTIVEC $ac_cv_c_altivec"
Sam Hocevar's avatar
   
Sam Hocevar committed
395
  CFLAGS_VLC="$CFLAGS_VLC $ac_cv_c_altivec"
396
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
397
398
399
400
401
402
403
404
405
406
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
407
408
  LIB_IDCTALTIVEC="${LIB_IDCTALTIVEC} -framework vecLib"
  LIB_MOTIONALTIVEC="${LIB_MOTIONALTIVEC} -framework vecLib"
Sam Hocevar's avatar
   
Sam Hocevar committed
409
  LIB="${LIB} -framework vecLib"
410
411
fi

412
413
414
dnl
dnl  Check the operating system
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
415
416
417
418
419
case x"${target_os}" in
  x)
    SYS=unknown
    ;;
  xlinux*)
420
    SYS=linux
Sam Hocevar's avatar
   
Sam Hocevar committed
421
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
422
  xbsdi*)
423
424
    SYS=bsdi
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
425
  xdarwin*)
426
427
    SYS=darwin
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
428
  x*mingw32*)
429
    SYS=mingw32
Sam Hocevar's avatar
   
Sam Hocevar committed
430
431
432
    AC_CHECK_TOOL(WINDRES, windres, :)
    LIB_MPEG_TS="-lws2_32"
    LIB_RC="-lws2_32"
433
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
434
  x*nto*)
Sam Hocevar's avatar
   
Sam Hocevar committed
435
436
437
438
    SYS=nto
    LIB_X11="${LIB_X11} -lsocket"
    LIB_XVIDEO="${LIB_XVIDEO} -lsocket"
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
439
  xbeos)
Sam Hocevar's avatar
   
Sam Hocevar committed
440
441
442
443
444
    SYS=beos
    LIB="${LIB} -lbe"
    LIB_BEOS="${LIB_BEOS} -lbe -lgame -lroot -ltracker"
    PLDFLAGS="${PLDFLAGS} -nostart"
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
445
  x*)
446
447
448
449
450
    SYS=${target_os}
    ;;
esac

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
451
dnl  DVD and VCD devices
452
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
453
454
455
456
457
458
459
460
461
462
463
464
465
466
case $SYS in
  mingw32)
    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")

467

Sam Hocevar's avatar
   
Sam Hocevar committed
468
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
469
dnl  libdvdcss: check for DVD ioctls
Sam Hocevar's avatar
   
Sam Hocevar committed
470
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
471

Sam Hocevar's avatar
   
Sam Hocevar committed
472
473
474
dnl  default is no
CAN_BUILD_LIBDVDCSS=0

Sam Hocevar's avatar
   
Sam Hocevar committed
475
476
dnl  for windoze
AC_CHECK_HEADERS(winioctl.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
477
  CAN_BUILD_LIBDVDCSS="${HAVE_LIBDVDCSS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
478
479
])

Sam Hocevar's avatar
   
Sam Hocevar committed
480
dnl  for Un*x and BeOS
Sam Hocevar's avatar
   
Sam Hocevar committed
481
AC_CHECK_HEADERS(sys/ioctl.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
482
  CAN_BUILD_LIBDVDCSS="${HAVE_LIBDVDCSS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
483
  AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h dvd.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
484
  BSD_DVD_STRUCT=0
Sam Hocevar's avatar
   
Sam Hocevar committed
485
  LINUX_DVD_STRUCT=0
486
  OPENBSD_DVD_STRUCT=0
Sam Hocevar's avatar
   
Sam Hocevar committed
487
488
489
  dnl
  dnl Old FreeBSD: sys/cdio.h
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
490
491
492
493
  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,[
494
                    BSD_DVD_STRUCT=1],[LINUX_DVD_STRUCT=1; OPENBSD_DVD_STRUCT=1])
Sam Hocevar's avatar
   
Sam Hocevar committed
495
496
497
498
  ])
  dnl
  dnl Newer FreeBSD: sys/dvdio.h
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
499
500
501
502
503
  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
504
505
506
507
508
509
510
  ])
  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
511
512
513
514
515
    LINUX_DVD_STRUCT=1
  ])
  dnl
  dnl BSDI: dvd.h
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
516
  NEED_BSDI_LIBDVD=0
Sam Hocevar's avatar
   
Sam Hocevar committed
517
518
519
  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
520
    LIB_LIBDVDCSS="${LIB_LIBDVDCSS} -ldvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
521
    LINUX_DVD_STRUCT=1
Sam Hocevar's avatar
   
Sam Hocevar committed
522
523
524
525
526
527
  ],[
    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
528
529
      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
530
      SRC_DVDCSS_EXTRA="${SRC_DVDCSS_EXTRA} bsdi_dvdioctl.c"
Sam Hocevar's avatar
   
Sam Hocevar committed
531
532
      LINUX_DVD_STRUCT=1
    ])
Sam Hocevar's avatar
   
Sam Hocevar committed
533
  ])
Sam Hocevar's avatar
   
Sam Hocevar committed
534
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
535
  dnl Solaris: sys/scsi/scsi_types.h, sys/scsi/impl/uscsi.h
Sam Hocevar's avatar
   
Sam Hocevar committed
536
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
537
  AC_CHECK_HEADER(sys/scsi/scsi_types.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
538
539
540
541
542
    AC_CHECK_HEADER(sys/scsi/impl/uscsi.h,[
      AC_DEFINE(SOLARIS_USCSI, 1, Have userspace SCSI headers.)
    ])
  ])
  dnl
543
544
545
546
547
548
549
550
  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
551
552
553
554
555
  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.)
556
557
558
559
    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
560
561
562
  else
    if test x$BSD_DVD_STRUCT = x1; then
      AC_DEFINE(HAVE_BSD_DVD_STRUCT, 1,
Sam Hocevar's avatar
   
Sam Hocevar committed
563
                Define if FreeBSD-like dvd_struct is defined.)
Sam Hocevar's avatar
   
Sam Hocevar committed
564
565
    fi
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
566
567
568
])

dnl
569
dnl  Special arch tuning
Sam Hocevar's avatar
   
Sam Hocevar committed
570
dnl
571
572
573
574
575
576
AC_ARG_WITH(tuning,
[  --with-tuning=[arch]    Enable special tuning for an architecture
                          (default i686 on IA-32 and 750 on PPC)])
if test "x$withval" != "x"; then
    TUNING=$withval
else
577
    if test x${target_cpu} = xi686 -o x${target_cpu} = xi586 -o x${target_cpu} = xi486 -o x${target_cpu} = xi386; then TUNING="pentiumpro"
578
    else
579
        if test x${target_cpu} = xpowerpc; then TUNING="750"; fi
580
581
    fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
582

583
584
585
586
587
588
589
590
591
dnl
dnl  Enable release-specific flags
dnl
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
592
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
593
dnl  x86 accelerations
Sam Hocevar's avatar
   
Sam Hocevar committed
594
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
595
596
597
598
599
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
600
601
602
603

dnl
dnl  AltiVec acceleration
dnl
604
AC_ARG_ENABLE(altivec,
605
606
607
[  --disable-altivec       Disable altivec optimizations (default enabled on PPC)],
[ if test x$enableval = xyes; then ARCH="${ARCH} altivec";
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
608
[ if test x${target_cpu} = xpowerpc; then ARCH="${ARCH} altivec";
609
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
610
611
612
613

dnl
dnl  Debugging mode
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
614
DEBUG=0
615
AC_ARG_ENABLE(debug,
616
[  --enable-debug          Enable debug mode (default disabled)],
617
[ if test x$enableval = xyes; then DEBUG=1; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
618

619
620
621
dnl
dnl  Trace mode
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
622
TRACE=0
623
624
625
626
AC_ARG_ENABLE(trace,
[  --enable-trace          Enable trace mode (default disabled)],
[ if test x$enableval = xyes; then TRACE=1; fi ])

Sam Hocevar's avatar
   
Sam Hocevar committed
627
dnl
628
dnl  Profiling
Sam Hocevar's avatar
   
Sam Hocevar committed
629
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
630
631
632
633
634
635
636
637
638
639
640
641
642
643
GPROF=0
AC_ARG_ENABLE(gprof,
[  --enable-gprof          Enable gprof profiling (default disabled)],
[ if test x$enableval = xyes; then GPROF=1; fi ])

CPROF=0
AC_ARG_ENABLE(cprof,
[  --enable-cprof          Enable cprof profiling (default disabled)],
[ if test x$enableval = xyes;
  then
    LIB="${LIB} -lcprof"
    CPROF=1
  fi
])
Sam Hocevar's avatar
   
Sam Hocevar committed
644

Sam Hocevar's avatar
   
Sam Hocevar committed
645
646
647
dnl
dnl  Enable/disable optimizations
dnl
648
AC_ARG_ENABLE(optimizations,
649
[  --disable-optimizations Disable compiler optimizations (default enabled)],
650
651
[ if test x$enableval = xno; then OPTIMS=0; fi ],
[ OPTIMS=1 ])
652

Sam Hocevar's avatar
   
Sam Hocevar committed
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
dnl
dnl  GNU portable threads
dnl
AC_ARG_ENABLE(pth,
  [  --enable-pth            Enable GNU Pth support (default disabled)],
  [ if test x$enableval = xyes; then
    AC_CHECK_LIB(pth,pth_init)
    AC_EGREP_HEADER(pth_init,pth.h,[
      AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
                Define if <pth.h> defines pth_init)
    THREAD_LIB="-lpth"
    fi])
])

LIB="${LIB} ${THREAD_LIB}"

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

Stéphane Borel's avatar
Stéphane Borel committed
752
753
754
755
dnl
dnl DVDREAD module: check for libdvdread plugin
dnl
AC_ARG_ENABLE(dvdread,
756
[  --enable-dvdread          Enable dvdread support (default disabled)],
Stéphane Borel's avatar
Stéphane Borel committed
757
758
759
760
761
762
763
[ if test x$enableval = xyes
  then
    NEED_LIBDVDCSS=1
    STATIC_LIBDVDCSS=1
    BUILTINS="${BUILTINS} dvdread" 
    CFLAGS_DVDREAD="${CFLAGS_DVDREAD} -I../../extras/libdvdread"
    LIB_DVDREAD="${LIB_DVDREAD} lib/libdvdread.a lib/libdvdcss.a"
764
  fi ])
Stéphane Borel's avatar
Stéphane Borel committed
765

766
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
767
dnl  VCD module
768
769
dnl
AC_ARG_ENABLE(vcd,
Sam Hocevar's avatar
   
Sam Hocevar committed
770
  [  --enable-vcd            VCD support for Linux (default enabled)])
771

Sam Hocevar's avatar
   
Sam Hocevar committed
772
773
774
775
776
777
if test x$enable_vcd != xno
then
  AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
    BUILTINS="${BUILTINS} vcd"
  ])
fi
778

779
780
781
782
783
if test x$enable_vcd != xno -a "${SYS}" = "bsdi"
then
  BUILTINS="${BUILTINS} vcd"
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
784
785
786
787
788
dnl
dnl  dummy plugin
dnl
AC_ARG_ENABLE(dummy,
  [  --disable-dummy         dummy module (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
789
790
791
792
793

if test x$enable_dummy != xno
then
  BUILTINS="${BUILTINS} dummy"
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
794
795
796
797
798
799

dnl
dnl  null plugin
dnl
AC_ARG_ENABLE(null,
  [  --disable-null          Null module (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
800
801
802
803
804

if test x$enable_null != xno
then
  BUILTINS="${BUILTINS} null"
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
805
806
807
808
809

dnl
dnl  rc plugin
dnl
AC_ARG_ENABLE(rc,
Sam Hocevar's avatar
   
Sam Hocevar committed
810
811
  [  --disable-rc            Remote Control module (default enabled)])

Sam Hocevar's avatar
   
Sam Hocevar committed
812
813
814
815
if test x$enable_rc != xno
then
  BUILTINS="${BUILTINS} rc"
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
816

817
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
818
dnl  mad plugin
819
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
820
821
AC_ARG_WITH(mad,
  [  --with-mad[=PATH]       libmad module (default disabled)],
822
823
  [ if test "x$with_val" != "xno"; then
      if test -n $with_val; then
Sam Hocevar's avatar
   
Sam Hocevar committed
824
        CFLAGS_MAD="-I$with_val/include"
Sam Hocevar's avatar
   
Sam Hocevar committed
825
        LIB_MAD="-L$with_val/lib -lmad"
826
      else
Sam Hocevar's avatar
   
Sam Hocevar committed
827
        LIB_MAD="-lmad"
828
829
830
      fi
      save_CFLAGS=$CFLAGS
      save_LDFLAGS=$LDFLAGS
Sam Hocevar's avatar
   
Sam Hocevar committed
831
832
      CFLAGS="$CFLAGS $CFLAGS_MAD"
      LDFLAGS="$LDFLAGS $LIB_MAD"
833
834
835
836
837
838
839
840
841
842
      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
Sam Hocevar's avatar
   
Sam Hocevar committed
843
      PLUGINS="${PLUGINS} mad"
844
845
    fi ])

Sam Hocevar's avatar
   
Sam Hocevar committed
846
dnl special case for BeOS
Sam Hocevar's avatar
   
Sam Hocevar committed
847
848
if test x$SYS = xbeos
then
Sam Hocevar's avatar
   
Sam Hocevar committed
849
    BUILTINS="${BUILTINS} beos"
850
851
852
853

dnl default case
else

Sam Hocevar's avatar
   
Sam Hocevar committed
854
855
dnl
dnl  OSS /dev/dsp module
856
dnl  (enabled by default except on win32)
Sam Hocevar's avatar
   
Sam Hocevar committed
857
dnl
858
AC_ARG_ENABLE(dsp,
859
  [  --disable-dsp           Linux /dev/dsp support (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
860

861
862
if test x$enable_dsp != xno &&
  (test $SYS != mingw32 || test x$enable_dsp = xyes)
Sam Hocevar's avatar
   
Sam Hocevar committed
863
864
865
then
  if test -c /dev/dsp
  then
Sam Hocevar's avatar
   
Sam Hocevar committed
866
    PLUGINS="${PLUGINS} dsp"
867
868
  fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
869
870
871
872

dnl
dnl  Esound module
dnl
873
AC_ARG_ENABLE(esd,
874
  [  --enable-esd            Esound library support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
875
876
  [if test x$enable_esd = xyes
   then
Sam Hocevar's avatar
   
Sam Hocevar committed
877
     AC_PATH_PROG(ESD_CONFIG, esd-config, no)
Sam Hocevar's avatar
   
Sam Hocevar committed
878
879
     if test x${ESD_CONFIG} != xno
     then
Sam Hocevar's avatar
   
Sam Hocevar committed
880
       PLUGINS="${PLUGINS} esd"
Sam Hocevar's avatar
   
Sam Hocevar committed
881
       CFLAGS_ESD="`${ESD_CONFIG} --cflags`"
Sam Hocevar's avatar
   
Sam Hocevar committed
882
883
       LIB_ESD="`${ESD_CONFIG} --libs`"
     fi
Sam Hocevar's avatar
   
Sam Hocevar committed
884
885
   fi])

Sam Hocevar's avatar
   
Sam Hocevar committed
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
dnl
dnl  aRts module
dnl
AC_ARG_ENABLE(arts,
  [  --enable-arts           aRts sound server (default disabled)],
  [if test x$enable_arts = xyes
   then
     AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
     if test x${ARTS_CONFIG} != xno
     then
       PLUGINS="${PLUGINS} arts"
       CFLAGS_ARTS="`${ARTS_CONFIG} --cflags`"
       LIB_ARTS="`${ARTS_CONFIG} --libs `"
     fi
   fi])

Sam Hocevar's avatar
   
Sam Hocevar committed
902
903
904
dnl
dnl  MacOS X module
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
905
AC_ARG_ENABLE(macosx,
906
  [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
Sam Hocevar's avatar
   
Sam Hocevar committed
907
908
  [if test x$enable_macosx = xyes
   then
909
     BUILTINS="${BUILTINS} macosx"
Sam Hocevar's avatar
   
Sam Hocevar committed
910
911
     LIB_MACOSX="-framework CoreAudio -framework Cocoa -framework AGL -framework QuickTime -lobjc"
     CFLAGS_MACOSX="-ObjC"
912
     LIB="${LIB} -ObjC"
Sam Hocevar's avatar
   
Sam Hocevar committed
913
   fi],
914
915
  [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
     BUILTINS="${BUILTINS} macosx"
Sam Hocevar's avatar
   
Sam Hocevar committed
916
917
     LIB_MACOSX="-framework CoreAudio -framework Cocoa -framework AGL -framework QuickTime -lobjc"
     CFLAGS_MACOSX="-ObjC"
918
     LIB="${LIB} -ObjC"
Sam Hocevar's avatar
   
Sam Hocevar committed
919
920
   )])

921
922
923
924
dnl
dnl  QNX RTOS module
dnl
AC_ARG_ENABLE(qnx,
925
  [  --disable-qnx           QNX RTOS support (default enabled on QNX RTOS)])
Sam Hocevar's avatar
   
Sam Hocevar committed
926
927
    if test x$enable_qnx != xno
    then
928
929
930
931
932
933
      AC_CHECK_HEADERS(Ph.h, [
        PLUGINS="${PLUGINS} qnx"
        LIB_QNX="-lasound -lph"
      ])
    fi

Sam Hocevar's avatar
   
Sam Hocevar committed
934
935
936
dnl
dnl  Linux framebuffer module
dnl
937
938
AC_ARG_ENABLE(fb,
  [  --enable-fb             Linux framebuffer support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
939
940
941
942
  [ if test x$enable_fb = xyes
    then
      PLUGINS="${PLUGINS} fb"
    fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
943

Sam Hocevar's avatar
   
Sam Hocevar committed
944
945
946
947
948
949
950
dnl
dnl  Linux MGA module
dnl
AC_ARG_ENABLE(mga,
  [  --enable-mga            Linux kernel Matrox support (default disabled)],
  [ if test x$enable_mga = xyes
    then
Sam Hocevar's avatar
   
Sam Hocevar committed
951
      PLUGINS="${PLUGINS} mga xmga"
Sam Hocevar's avatar
   
Sam Hocevar committed
952
953
    fi ])

Sam Hocevar's avatar
   
Sam Hocevar committed
954
955
956
dnl
dnl  GGI module
dnl
Christophe Massiot's avatar
Christophe Massiot committed
957
958
AC_ARG_WITH(ggi,
  [  --with-ggi[=name]       GGI support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
959
  [ if test "x$withval" != "xno"
Christophe Massiot's avatar
Christophe Massiot committed
960
    then
Sam Hocevar's avatar
   
Sam Hocevar committed
961
962
      PLUGINS="${PLUGINS} ggi"
      if test "x$withval" != "xyes"
Sam Hocevar's avatar
   
Sam Hocevar committed
963
964
965
966
967
      then
        LIB_GGI="-l"$withval
      else
        LIB_GGI="-lggi"
      fi
Christophe Massiot's avatar
Christophe Massiot committed
968
    fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
969
970
971
972

dnl
dnl  SDL module
dnl
973
974
AC_ARG_ENABLE(sdl,
  [  --disable-sdl           SDL support (default enabled)])
975
if test "x$enable_sdl" != "xno"
976
then
977
978
979
980
981
982
983
984
  SDL_PATH=$PATH
  AC_ARG_WITH(sdl-config-path,
    [  --with-sdl-config-path=path sdl-config path (default search in \$PATH)],
    [ if test "x$withval" != "xno"
      then
        SDL_PATH=$withval:$PATH
      fi ])
  AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, $SDL_PATH)
985
986
  SDL_CONFIG=${SDL12_CONFIG}
  SDL_HEADER="SDL12/SDL.h"
Sam Hocevar's avatar
   
Sam Hocevar committed
987
988
  if test x${SDL_CONFIG} = xno
  then
989
    AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, $SDL_PATH)
Sam Hocevar's avatar
   
Sam Hocevar committed
990
    SDL_CONFIG=${SDL11_CONFIG}
991
992
    SDL_HEADER="SDL11/SDL.h"
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
993
994
  if test x${SDL_CONFIG} = xno
  then
995
    AC_PATH_PROG(SDL_CONFIG, sdl-config, no, $SDL_PATH)
996
    SDL_HEADER="SDL/SDL.h"
997
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
998
999
  if test x${SDL_CONFIG} != xno
  then
1000
    PLUGINS="${PLUGINS} sdl"