configure.in 32.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/common.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
Sam Hocevar's avatar
   
Sam Hocevar committed
10
  VLC_VERSION=0.2.90
Sam Hocevar's avatar
   
Sam Hocevar committed
11
12
13
14
15
16
17
18
  AC_SUBST(VLC_VERSION)
  VLC_CODENAME=Ourumov
  AC_SUBST(VLC_CODENAME)
fi

HAVE_LIBDVDCSS=0
if test -r extras/libdvdcss/libdvdcss.c; then
  HAVE_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
19
  LIBDVDCSS_VERSION=0.0.3
Sam Hocevar's avatar
   
Sam Hocevar committed
20
  AC_SUBST(LIBDVDCSS_VERSION)
21
22
23
  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
24
fi
25

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

30
31
dnl Check for tools
AC_PROG_MAKE_SET
Sam Hocevar's avatar
   
Sam Hocevar committed
32
33
AC_PROG_CC
AC_PROG_CPP
Sam Hocevar's avatar
   
Sam Hocevar committed
34
AC_PROG_RANLIB
35
36
37
38

dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL

39
40
41
42
43
44
45
46
47
48
49
50
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
dnl
dnl  Endianness check, with a special test for cross-compilation
dnl
if test x${cross_compiling} != xyes; then
  AC_C_BIGENDIAN
else
  dnl  We are crosscompiling, give the user the opportunity to specify
  dnl  --with-words=big or --with-words=little ; otherwise, try to guess
  AC_ARG_WITH(words,
    [  --with-words=endianness Set endianness (big or little)])
  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
101
fi
102
103
104
105

dnl Check for system libs needed
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol)
AC_CHECK_FUNCS(setenv putenv)
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
136
AC_FUNC_MMAP
AC_TYPE_SIGNAL
Sam Hocevar's avatar
   
Sam Hocevar committed
137
138
AC_CHECK_LIB(dl,dlopen,LIB="${LIB} -ldl")
AC_CHECK_LIB(m,pow,LIB_YUV="${LIB_YUV} -lm")
Sam Hocevar's avatar
   
Sam Hocevar committed
139

Sam Hocevar's avatar
   
Sam Hocevar committed
140
dnl Check for pthreads - borrowed from XMMS
Sam Hocevar's avatar
   
Sam Hocevar committed
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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
155
156
157

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

Sam Hocevar's avatar
   
Sam Hocevar committed
159
160
161
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
162
            Define if <pthread.h> defines pthread_cond_t.)])
Sam Hocevar's avatar
   
Sam Hocevar committed
163
164
AC_EGREP_HEADER(strncasecmp,strings.h,[
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
Sam Hocevar's avatar
   
Sam Hocevar committed
165
            Define if <strings.h> defines strncasecmp.)])
Sam Hocevar's avatar
   
Sam Hocevar committed
166

Sam Hocevar's avatar
   
Sam Hocevar committed
167
168
dnl Check for headers
AC_CHECK_HEADERS(stddef.h getopt.h strings.h)
169
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/time.h sys/times.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
170
171
172
173
174
175
176
177
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)

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
178
dnl Check for ntohl, etc.
179
180
181
182
183
184
185
186
187
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
188

Sam Hocevar's avatar
   
Sam Hocevar committed
189
dnl Check for inline function size limit
190
191
192
193
194
195
196
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
197

Sam Hocevar's avatar
   
Sam Hocevar committed
198
dnl Check for Darwin plugin linking flags
199
200
201
202
203
204
205
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
    PLCFLAGS="${PLCFLAGS} -bundle -undefined error"
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
206
207

dnl Check for standard plugin linking flags
208
209
210
211
212
213
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
    PLCFLAGS="${PLCFLAGS} -shared"
Sam Hocevar's avatar
   
Sam Hocevar committed
214
fi
215
216
        
dnl Check for soname setting
Sam Hocevar's avatar
   
Sam Hocevar committed
217
if test x"${SOFLAGS}" = x; then
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
    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.
------------
"
240
    fi
Sam Hocevar's avatar
   
Sam Hocevar committed
241
242
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
243
dnl End of the bizarre compilation tests
Sam Hocevar's avatar
   
Sam Hocevar committed
244
CFLAGS="${save_CFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
245
LDFLAGS="${save_LDFLAGS}"
Christophe Massiot's avatar
Christophe Massiot committed
246

247
dnl Check for boolean_t
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
AC_CACHE_CHECK([for boolean_t in sys/types.h],
    [ac_cv_c_boolean_t_sys_types_h],
    [AC_TRY_COMPILE([#include <sys/types.h>], [void quux() { boolean_t foo; }],
     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],
    [AC_TRY_COMPILE([#include <pthread.h>], [void quux() { boolean_t foo; }],
     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],
    [AC_TRY_COMPILE([#include <cthreads.h>], [void quux() { boolean_t foo; }],
     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
271

272
273
274
275
276
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME

277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
    [ac_cv_c_attribute_aligned],
    [ac_cv_c_attribute_aligned=0
    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



293
ARCH=${target_cpu}
Sam Hocevar's avatar
   
Sam Hocevar committed
294
295
296
297

dnl
dnl  default modules
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
298
299
BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion imdct downmix"
PLUGINS="${PLUGINS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
300
301
302
303

dnl
dnl  Accelerated modules
dnl
gbazin's avatar
   
gbazin committed
304
MMX_MODULES="yuvmmx idctmmx motionmmx"
Sam Hocevar's avatar
   
Sam Hocevar committed
305
306
307
MMXEXT_MODULES="idctmmxext motionmmxext"
THREEDNOW_MODULES="imdct3dn downmix3dn"
SSE_MODULES="imdctsse downmixsse"
308
ALTIVEC_MODULES="idctaltivec motionaltivec"
309

310
311
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
312
    [AC_TRY_COMPILE(,[void quux(){void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));}],
313
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
314
if test x"$ac_cv_mmx_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
315
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
316
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
317

318
319
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
320
    [AC_TRY_COMPILE(,[void quux(){void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));}],
321
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
322
if test x"$ac_cv_mmxext_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
323
  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
324
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
325

326
327
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
328
    [AC_TRY_COMPILE(,[void quux(){void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));}],
329
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
330
if test x"$ac_cv_3dnow_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
331
  AC_DEFINE(HAVE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
332
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
333
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
334

335
336
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
337
    [AC_TRY_COMPILE(,[void quux(){void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));}],
338
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
339
if test x"$ac_cv_sse_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
340
  AC_DEFINE(HAVE_SSE, 1, Define if \$CC groks SSE inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
341
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
342
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
343

344
345
AC_CACHE_CHECK([if \$CC groks Altivec inline assembly],
    [ac_cv_altivec_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
346
    [AC_TRY_COMPILE(,[void quux(){asm volatile("vperm 0,1,2,3");}],
347
348
349
         ac_cv_altivec_inline=yes,
         [save_CFLAGS=$CFLAGS
          CFLAGS="$CFLAGS -Wa,-m7400"
Sam Hocevar's avatar
   
Sam Hocevar committed
350
          AC_TRY_COMPILE(,[void quux(){asm volatile("vperm 0,1,2,3");}],
351
            [ac_cv_altivec_inline=yes; CFLAGS_ALTIVEC="-Wa,-m7400"],
352
            ac_cv_altivec_inline=no)
353
354
          CFLAGS=$save_CFLAGS
         ])])
355
if test x"$ac_cv_altivec_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
356
  AC_DEFINE(HAVE_ALTIVEC, 1, Define if \$CC groks ALTIVEC inline assembly.)
357
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
358
fi
359

360
361
AC_CACHE_CHECK([if \$CC groks Altivec C extensions],
    [ac_cv_c_altivec],
362
363
364
365
366
367
368
369
370
371
372
373
    [save_CFLAGS=$CFLAGS
     CFLAGS="$CFLAGS -faltivec"
     # Darwin test
     AC_TRY_COMPILE(,[void quux(){vec_mtvscr((vector unsigned int)(0));}],
        ac_cv_c_altivec=-faltivec, [
        # Linux/PPC test
        CFLAGS="$save_CFLAGS $CFLAGS_ALTIVEC -fvec"
        AC_TRY_COMPILE(,[void quux(){vec_mtvscr((vector unsigned int)(0));}],
            [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
        ])
     CFLAGS=$save_CFLAGS
    ])
374
375
if test x"$ac_cv_c_altivec" != x"no"; then
  AC_DEFINE(HAVE_C_ALTIVEC, 1, Define if your compiler groks C altivec extensions.)
376
377
378
379
380
381
382
383
384
385
386
387
  CFLAGS_ALTIVEC="$CFLAGS_ALTIVEC $ac_cv_c_altivec"
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
  LIB_ALTIVEC="-framework vecLib"
388
389
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
390
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
391
dnl  libdvdcss: check for DVD ioctls
Sam Hocevar's avatar
   
Sam Hocevar committed
392
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
393

Sam Hocevar's avatar
   
Sam Hocevar committed
394
395
396
dnl  default is no
CAN_BUILD_LIBDVDCSS=0

Sam Hocevar's avatar
   
Sam Hocevar committed
397
398
dnl  for windoze
AC_CHECK_HEADERS(winioctl.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
399
  CAN_BUILD_LIBDVDCSS="${HAVE_LIBDVDCSS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
400
401
])

Sam Hocevar's avatar
   
Sam Hocevar committed
402
dnl  for Un*x and BeOS
Sam Hocevar's avatar
   
Sam Hocevar committed
403
AC_CHECK_HEADERS(sys/ioctl.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
404
  CAN_BUILD_LIBDVDCSS="${HAVE_LIBDVDCSS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
405
  AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h dvd.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
406
  BSD_DVD_STRUCT=0
Sam Hocevar's avatar
   
Sam Hocevar committed
407
  LINUX_DVD_STRUCT=0
Sam Hocevar's avatar
   
Sam Hocevar committed
408
409
410
  dnl
  dnl Old FreeBSD: sys/cdio.h
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
411
412
413
414
415
  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,[
                    BSD_DVD_STRUCT=1],[LINUX_DVD_STRUCT=1])
Sam Hocevar's avatar
   
Sam Hocevar committed
416
417
418
419
  ])
  dnl
  dnl Newer FreeBSD: sys/dvdio.h
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
420
421
422
423
424
  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
425
426
427
428
429
430
431
  ])
  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
432
433
434
435
436
    LINUX_DVD_STRUCT=1
  ])
  dnl
  dnl BSDI: dvd.h
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
437
  NEED_BSDI_LIBDVD=0
Sam Hocevar's avatar
   
Sam Hocevar committed
438
439
440
  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
441
    LIB_LIBDVDCSS="${LIB_LIBDVDCSS} -ldvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
442
    LINUX_DVD_STRUCT=1
Sam Hocevar's avatar
   
Sam Hocevar committed
443
444
445
446
447
448
  ],[
    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
449
450
      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
451
      OBJ_LIBDVDCSS="${OBJ_LIBDVDCSS} bsdi_dvdioctl.o"
Sam Hocevar's avatar
   
Sam Hocevar committed
452
453
      LINUX_DVD_STRUCT=1
    ])
Sam Hocevar's avatar
   
Sam Hocevar committed
454
  ])
Sam Hocevar's avatar
   
Sam Hocevar committed
455
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
456
  dnl Solaris: sys/scsi/scsi_types.h, sys/scsi/impl/uscsi.h
Sam Hocevar's avatar
   
Sam Hocevar committed
457
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
458
  AC_CHECK_HEADER(sys/scsi/scsi_types.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
459
460
461
462
463
    AC_CHECK_HEADER(sys/scsi/impl/uscsi.h,[
      AC_DEFINE(SOLARIS_USCSI, 1, Have userspace SCSI headers.)
    ])
  ])
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
464
465
466
467
468
469
470
471
  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.)
  else
    if test x$BSD_DVD_STRUCT = x1; then
      AC_DEFINE(HAVE_BSD_DVD_STRUCT, 1,
Sam Hocevar's avatar
   
Sam Hocevar committed
472
                Define if FreeBSD-like dvd_struct is defined.)
Sam Hocevar's avatar
   
Sam Hocevar committed
473
474
    fi
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
475
476
])

Sam Hocevar's avatar
   
Sam Hocevar committed
477

Sam Hocevar's avatar
   
Sam Hocevar committed
478
479
480
dnl
dnl  Check the operating system
dnl
481
case ${target_os} in
Sam Hocevar's avatar
   
Sam Hocevar committed
482
483
484
  bsdi*)
    SYS=bsdi
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
485
486
487
488
  darwin*)
    SYS=darwin
    ;;
  *)
489
    SYS=${target_os}
Sam Hocevar's avatar
   
Sam Hocevar committed
490
491
492
    ;;
esac

Sam Hocevar's avatar
   
Sam Hocevar committed
493
dnl
494
dnl  Special arch tuning
Sam Hocevar's avatar
   
Sam Hocevar committed
495
dnl
496
497
498
499
500
501
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
502
    if test x${target_cpu} = xi686 -o x${target_cpu} = xi586 -o x${target_cpu} = xi486 -o x${target_cpu} = xi386; then TUNING="pentiumpro"
503
    else
504
        if test x${target_cpu} = xpowerpc; then TUNING="750"; fi
505
506
    fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
507
508
509
510

dnl
dnl  MMX acceleration
dnl
511
AC_ARG_ENABLE(mmx,
Christophe Massiot's avatar
Christophe Massiot committed
512
[  --disable-mmx           Disable MMX optimizations (default enabled for x86)],
Sam Hocevar's avatar
   
Sam Hocevar committed
513
[ if test x$enableval = xyes; then ARCH="${ARCH} mmx";
514
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
515
[ 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";
516
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
517
518
519
520

dnl
dnl  AltiVec acceleration
dnl
521
AC_ARG_ENABLE(altivec,
522
523
524
[  --disable-altivec       Disable altivec optimizations (default enabled on PPC)],
[ if test x$enableval = xyes; then ARCH="${ARCH} altivec";
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
525
[ if test x${target_cpu} = xpowerpc; then ARCH="${ARCH} altivec";
526
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
527
528
529
530

dnl
dnl  Debugging mode
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
531
DEBUG=0
532
AC_ARG_ENABLE(debug,
533
[  --enable-debug          Enable debug mode (default disabled)],
534
[ if test x$enableval = xyes; then DEBUG=1; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
535

536
537
538
dnl
dnl  Trace mode
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
539
TRACE=0
540
541
542
543
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
544
dnl
545
dnl  Profiling
Sam Hocevar's avatar
   
Sam Hocevar committed
546
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
547
548
549
550
551
552
553
554
555
556
557
558
559
560
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
561

Sam Hocevar's avatar
   
Sam Hocevar committed
562
563
564
dnl
dnl  Enable/disable optimizations
dnl
565
AC_ARG_ENABLE(optimizations,
566
[  --disable-optimizations Disable compiler optimizations (default enabled)],
567
568
[ if test x$enableval = xno; then OPTIMS=0; fi ],
[ OPTIMS=1 ])
569

Sam Hocevar's avatar
   
Sam Hocevar committed
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
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
587
dnl  DVD module: check for installed libdvdcss or local libdvdcss
Sam Hocevar's avatar
   
Sam Hocevar committed
588
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
589
NEED_LIBDVDCSS=0
Sam Hocevar's avatar
   
Sam Hocevar committed
590
STATIC_LIBDVDCSS=0
Sam Hocevar's avatar
   
Sam Hocevar committed
591
DUMMY_LIBDVDCSS=0
Sam Hocevar's avatar
   
Sam Hocevar committed
592
AC_ARG_WITH(dvdcss,
593
594
595
596
  [  --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
597
598
599
600
601
  [ 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
602
        NEED_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
603
604
605
        STATIC_LIBDVDCSS=1
        BUILTINS="${BUILTINS} dvd"
        CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss"
Sam Hocevar's avatar
   
Sam Hocevar committed
606
607
        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
608
609
610
611
      fi
    ;;
    xlocal-shared)
      # local libdvdcss, dynamically linked
Sam Hocevar's avatar
   
Sam Hocevar committed
612
613
      if test x${CAN_BUILD_LIBDVDCSS} = x1
      then
Sam Hocevar's avatar
   
Sam Hocevar committed
614
        NEED_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
615
616
617
618
619
        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"
      fi
Sam Hocevar's avatar
   
Sam Hocevar committed
620
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
621
622
623
624
625
626
    xno)
      # don't use libdvdcss at all, build a DVD module that can dlopen() it
      DUMMY_LIBDVDCSS=1
      BUILTINS="${BUILTINS} dvd"
      OBJ_DVD="${OBJ_DVD} dummy_dvdcss.o"
      CFLAGS_DVD="${CFLAGS_DVD} -DGOD_DAMN_DMCA"
Sam Hocevar's avatar
   
Sam Hocevar committed
627
      CFLAGS_DVD="${CFLAGS_DVD} -DLIBDVDCSS_VERSION=\"${LIBDVDCSS_VERSION}\""
Sam Hocevar's avatar
   
Sam Hocevar committed
628
629
630
      LIB_DVD="${LIB_DVD} -ldl"
      LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} -ldl"
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
631
    *)
Sam Hocevar's avatar
   
Sam Hocevar committed
632
633
634
635
636
637
638
639
640
      # existing libdvdcss
      BUILTINS="${BUILTINS} dvd"
      if test "x$withval" != "xyes"
      then
        LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} -L"$withval"/lib"
        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
641
    esac ],
Sam Hocevar's avatar
   
Sam Hocevar committed
642
  # user didn't decide, we choose to use local libdvdcss and link statically
Sam Hocevar's avatar
   
Sam Hocevar committed
643
  # if libdvdcss is in the archive, or to use the dummy replacement otherwise.
Sam Hocevar's avatar
   
Sam Hocevar committed
644
645
  [ if test x${CAN_BUILD_LIBDVDCSS} = x1
    then
Sam Hocevar's avatar
   
Sam Hocevar committed
646
      NEED_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
647
648
649
      STATIC_LIBDVDCSS=1
      BUILTINS="${BUILTINS} dvd"
      CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss"
Sam Hocevar's avatar
   
Sam Hocevar committed
650
651
      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
652
653
654
655
656
657
658
659
    else
      # XXX: no check for libdl is done, don't try this at home !
      DUMMY_LIBDVDCSS=1
      BUILTINS="${BUILTINS} dvd"
      OBJ_DVD="${OBJ_DVD} dummy_dvdcss.o"
      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
660
    fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
661

Sam Hocevar's avatar
   
Sam Hocevar committed
662
663
664
665
666
dnl
dnl  dummy plugin
dnl
AC_ARG_ENABLE(dummy,
  [  --disable-dummy         dummy module (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
667
668
669
670
671

if test x$enable_dummy != xno
then
  BUILTINS="${BUILTINS} dummy"
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
672
673
674
675
676
677

dnl
dnl  null plugin
dnl
AC_ARG_ENABLE(null,
  [  --disable-null          Null module (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
678
679
680
681
682

if test x$enable_null != xno
then
  BUILTINS="${BUILTINS} null"
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
683
684
685
686
687
688

dnl
dnl  rc plugin
dnl
AC_ARG_ENABLE(rc,
  [  --disable-rc            rc module (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
689
690
691
692
693

if test x$enable_rc != xno
then
  BUILTINS="${BUILTINS} rc"
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
694

Sam Hocevar's avatar
   
Sam Hocevar committed
695
dnl special case for BeOS
Sam Hocevar's avatar
   
Sam Hocevar committed
696
697
if test x$SYS = xbeos
then
Sam Hocevar's avatar
   
Sam Hocevar committed
698
    BUILTINS="${BUILTINS} beos"
Sam Hocevar's avatar
   
Sam Hocevar committed
699
    LIB_BEOS="-lbe -lgame -lroot -ltracker"
Sam Hocevar's avatar
   
Sam Hocevar committed
700
    PLCFLAGS="${PLCFLAGS} -nostart"
701
702
703
704

dnl default case
else

Sam Hocevar's avatar
   
Sam Hocevar committed
705
706
707
dnl
dnl  OSS /dev/dsp module
dnl
708
AC_ARG_ENABLE(dsp,
709
  [  --disable-dsp           Linux /dev/dsp support (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
710
711
712
713
714

if test x$enable_dsp != xno
then
  if test -c /dev/dsp
  then
Sam Hocevar's avatar
   
Sam Hocevar committed
715
    PLUGINS="${PLUGINS} dsp"
716
717
  fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
718
719
720
721

dnl
dnl  Esound module
dnl
722
AC_ARG_ENABLE(esd,
723
  [  --enable-esd            Esound library support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
724
725
  [if test x$enable_esd = xyes
   then
Sam Hocevar's avatar
   
Sam Hocevar committed
726
     AC_PATH_PROG(ESD_CONFIG, esd-config, no)
Sam Hocevar's avatar
   
Sam Hocevar committed
727
728
     if test x${ESD_CONFIG} != xno
     then
Sam Hocevar's avatar
   
Sam Hocevar committed
729
       PLUGINS="${PLUGINS} esd"
Sam Hocevar's avatar
   
Sam Hocevar committed
730
731
       LIB_ESD="`${ESD_CONFIG} --libs`"
     fi
Sam Hocevar's avatar
   
Sam Hocevar committed
732
733
734
735
736
   fi])

dnl
dnl  Darwin module
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
737
AC_ARG_ENABLE(darwin,
738
  [  --enable-darwin         Darwin sound support (default enabled on MacOS X)],
Sam Hocevar's avatar
   
Sam Hocevar committed
739
  [if test x$enable_darwin = xyes; then
Sam Hocevar's avatar
   
Sam Hocevar committed
740
     PLUGINS="${PLUGINS} darwin"
Sam Hocevar's avatar
   
Sam Hocevar committed
741
742
743
744
745
746
     LIB_DARWIN="-framework CoreAudio"
   fi])

dnl
dnl  MacOS X module
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
747
AC_ARG_ENABLE(macosx,
748
  [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
Sam Hocevar's avatar
   
Sam Hocevar committed
749
750
  [if test x$enable_macosx = xyes
   then
751
752
     BUILTINS="${BUILTINS} macosx macosx_qt"
     LIB_MACOSX="-framework CoreAudio -framework Carbon -framework AGL -framework QuickTime"
Sam Hocevar's avatar
   
Sam Hocevar committed
753
754
     LIB_TS="${LIB_TS} -framework AGL -framework Carbon"
     LIB_SDL="${LIB_SDL} -framework AGL -framework Carbon"
Sam Hocevar's avatar
   
Sam Hocevar committed
755
756
   fi],
  [AC_CHECK_HEADERS(Carbon/Carbon.h,
757
758
     BUILTINS="${BUILTINS} macosx macosx_qt"
     LIB_MACOSX="-framework CoreAudio -framework Carbon -framework AGL -framework QuickTime"
Sam Hocevar's avatar
   
Sam Hocevar committed
759
760
     LIB_TS="${LIB_TS} -framework AGL -framework Carbon"
     LIB_SDL="${LIB_SDL} -framework AGL -framework Carbon"
Sam Hocevar's avatar
   
Sam Hocevar committed
761
762
   )])

763
764
765
766
dnl
dnl  QNX RTOS module
dnl
AC_ARG_ENABLE(qnx,
767
  [  --disable-qnx           QNX RTOS support (default enabled on QNX RTOS)])
Sam Hocevar's avatar
   
Sam Hocevar committed
768
769
    if test x$enable_qnx != xno
    then
770
771
772
773
774
775
      AC_CHECK_HEADERS(Ph.h, [
        PLUGINS="${PLUGINS} qnx"
        LIB_QNX="-lasound -lph"
      ])
    fi

Sam Hocevar's avatar
   
Sam Hocevar committed
776
777
778
dnl
dnl  Linux framebuffer module
dnl
779
780
AC_ARG_ENABLE(fb,
  [  --enable-fb             Linux framebuffer support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
781
782
783
784
  [ if test x$enable_fb = xyes
    then
      PLUGINS="${PLUGINS} fb"
    fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
785
786
787
788

dnl
dnl  GGI module
dnl
Christophe Massiot's avatar
Christophe Massiot committed
789
790
AC_ARG_WITH(ggi,
  [  --with-ggi[=name]       GGI support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
791
  [ if test "x$withval" != "xno"
Christophe Massiot's avatar
Christophe Massiot committed
792
    then
Sam Hocevar's avatar
   
Sam Hocevar committed
793
794
      PLUGINS="${PLUGINS} ggi"
      if test "x$withval" != "xyes"
Sam Hocevar's avatar
   
Sam Hocevar committed
795
796
797
798
799
      then
        LIB_GGI="-l"$withval
      else
        LIB_GGI="-lggi"
      fi
Christophe Massiot's avatar
Christophe Massiot committed
800
    fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
801
802
803
804

dnl
dnl  SDL module
dnl
805
806
AC_ARG_ENABLE(sdl,
  [  --disable-sdl           SDL support (default enabled)])
807
if test "x$enable_sdl" != "xno"
808
then
809
810
811
812
813
814
815
816
  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)
817
818
  SDL_CONFIG=${SDL12_CONFIG}
  SDL_HEADER="SDL12/SDL.h"
Sam Hocevar's avatar
   
Sam Hocevar committed
819
820
  if test x${SDL_CONFIG} = xno
  then
821
    AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, $SDL_PATH)
Sam Hocevar's avatar
   
Sam Hocevar committed
822
    SDL_CONFIG=${SDL11_CONFIG}
823
824
    SDL_HEADER="SDL11/SDL.h"
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
825
826
  if test x${SDL_CONFIG} = xno
  then
827
    AC_PATH_PROG(SDL_CONFIG, sdl-config, no, $SDL_PATH)
828
    SDL_HEADER="SDL/SDL.h"
829
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
830
831
  if test x${SDL_CONFIG} != xno
  then
832
833
834
    PLUGINS="${PLUGINS} sdl"
    CFLAGS_SDL="`${SDL_CONFIG} --cflags`"
    LIB_SDL="`${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`"
Sam Hocevar's avatar
   
Sam Hocevar committed
835
836
    save_CPPFLAGS=$CPPFLAGS
    CPPFLAGS="$CPPFLAGS $CFLAGS_SDL"
837
838
    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),
839
840
841
842
      [ 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
843
    CPPFLAGS=$save_CPPFLAGS
Sam Hocevar's avatar
   
Sam Hocevar committed
844
    if expr 1.1.5 \> `$SDL_CONFIG --version` >/dev/null
Sam Hocevar's avatar
   
Sam Hocevar committed
845
    then
846
847
848
      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
849
    fi
850
  elif test "x$enable_sdl" =  "xyes"
Sam Hocevar's avatar
   
Sam Hocevar committed
851
  then
852
853
854
    AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
    ])
855
856
  fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
857

Sam Hocevar's avatar
   
Sam Hocevar committed
858
859
860
861
862
dnl
dnl  Windows DirectX module
dnl
AC_ARG_WITH(directx,
  [  --with-directx[=name]   Windows DirectX support (default enabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
863
  [ if test "x$withval" != "xno"
Sam Hocevar's avatar
   
Sam Hocevar committed
864
    then
Sam Hocevar's avatar
   
Sam Hocevar committed
865
866
      PLUGINS="${PLUGINS} directx"
      if test "x$withval" != "xyes"
Sam Hocevar's avatar
   
Sam Hocevar committed
867
      then
Sam Hocevar's avatar
   
Sam Hocevar committed
868
        LIB_DIRECTX="${LIB_DIRECTX} -L"$withval"/lib -lgdi32 -ldxguid"
Sam Hocevar's avatar
   
Sam Hocevar committed
869
870
        INCLUDE="${INCLUDE} -I"$withval"/include"
      else
871
        AC_CHECK_HEADERS(directx.h, , 
872
873
          AC_MSG_ERROR([Cannot find DirectX headers !])
        )
Sam Hocevar's avatar
   
Sam Hocevar committed
874
        LIB_DIRECTX="${LIB_DIRECTX} -L/usr/lib -lgdi32 -ldxguid"
Sam Hocevar's avatar
   
Sam Hocevar committed
875
876
      fi
    fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
877
    if test "x$withval" = "x"
Sam Hocevar's avatar
   
Sam Hocevar committed
878
879
880
    then
      AC_CHECK_HEADERS(directx.h,
      [PLUGINS="${PLUGINS} directx"
Sam Hocevar's avatar
   
Sam Hocevar committed
881
       LIB_DIRECTX="${LIB_DIRECTX} -L/usr/lib -lgdi32 -ldxguid"])
Sam Hocevar's avatar
   
Sam Hocevar committed
882
883
    fi

Sam Hocevar's avatar
   
Sam Hocevar committed
884
885
886
dnl
dnl  Glide module
dnl
Christophe Massiot's avatar
Christophe Massiot committed
887
888
AC_ARG_WITH(glide,
  [  --with-glide[=name]     Glide (3dfx) support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
889
  [ if test "x$withval" != "xno"
Christophe Massiot's avatar
Christophe Massiot committed
890
    then
Sam Hocevar's avatar
   
Sam Hocevar committed
891
892
      PLUGINS="${PLUGINS} glide"
      if test "x$withval" != "xyes"
Sam Hocevar's avatar
   
Sam Hocevar committed
893
      then
Sam Hocevar's avatar
   
Sam Hocevar committed
894
        LIB_GLIDE="-l"$withval" -lm"
Sam Hocevar's avatar
   
Sam Hocevar committed
895
      else
Sam Hocevar's avatar
   
Sam Hocevar committed
896
        LIB_GLIDE="-lglide2x -lm"
Sam Hocevar's avatar
   
Sam Hocevar committed
897
      fi
Christophe Massiot's avatar
Christophe Massiot committed
898
    fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
899
900
901
902

dnl
dnl  ncurses module
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
903
904
AC_ARG_ENABLE(ncurses,
  [  --enable-ncurses        ncurses interface support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
905
  [if test x$enable_ncurses = xyes; then
Sam Hocevar's avatar
   
Sam Hocevar committed
906
     PLUGINS="${PLUGINS} ncurses"
Sam Hocevar's avatar
   
Sam Hocevar committed
907
908
909
910
911
912
     LIB_NCURSES="-lncurses"
   fi])

dnl
dnl  Qt module
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
913
914
AC_ARG_ENABLE(qt,
  [  --enable-qt             Qt interface support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
915
  [if test x$enable_qt = xyes; then
Sam Hocevar's avatar
   
Sam Hocevar committed
916
917
     PLUGINS="${PLUGINS} qt"
     ALIASES="${ALIASES} qvlc"
Sam Hocevar's avatar
   
Sam Hocevar committed
918
     LIB_QT="-lqt -L${QTDIR}/lib"
Sam Hocevar's avatar
   
Sam Hocevar committed
919
     if test -x ${QTDIR}/bin/moc
Sam Hocevar's avatar
   
Sam Hocevar committed
920
921
922
923
924
     then
       MOC=${QTDIR}/bin/moc
     else
       MOC=moc
     fi
Sam Hocevar's avatar
   
Sam Hocevar committed
925
926
927
928
929
   fi])

dnl 
dnl  KDE module
dnl
930
931
AC_ARG_ENABLE(kde,
  [  --enable-kde            KDE interface support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
932
  [if test x$enable_kde = xyes; then
Sam Hocevar's avatar
   
Sam Hocevar committed
933
934
     PLUGINS="${PLUGINS} kde"
     ALIASES="${ALIASES} kvlc"
935
936
937
938
939
940
941
     LIB_KDE="-L${KDEDIR}/lib -lkfile"
     if test -x ${QTDIR}/bin/moc
     then
       MOC=${QTDIR}/bin/moc
     else
       MOC=moc
     fi
Sam Hocevar's avatar
   
Sam Hocevar committed
942
   fi])
Sam Hocevar's avatar
   
Sam Hocevar committed
943
944
945
946

dnl
dnl  Gnome module
dnl
947
AC_ARG_ENABLE(gnome,
Sam Hocevar's avatar
   
Sam Hocevar committed
948
  [  --enable-gnome          Gnome interface support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
949
  [if test x$enable_gnome = xyes; then
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
    # look for gnome-config
    AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
    if test -x ${GNOME_CONFIG}
    then
       CFLAGS_GNOME="`${GNOME_CONFIG} --cflags gnomeui`"
       LIB_GNOME="`${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
    fi
    # now look for the gnome.h header
    saved_CPPFLAGS=$CPPFLAGS
    CPPFLAGS="$CPPFLAGS $CFLAGS_GNOME"
    AC_CHECK_HEADERS(gnome.h, [
      PLUGINS="${PLUGINS} gnome"
      ALIASES="${ALIASES} gnome-vlc"
     ],[
      AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
developement librairie or remove the --enable-gnome option])
     ])
  
    CPPFLAGS=$saved_CPPFLAGS
  fi])
Sam Hocevar's avatar
   
Sam Hocevar committed
970
971
972
973

dnl
dnl  Gtk+ module
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
974
975
AC_ARG_ENABLE(gtk,
  [  --disable-gtk           Gtk+ support (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
976
977
978
if test x$enable_gtk != xno
then
  # look for gtk-config
Sam Hocevar's avatar
   
Sam Hocevar committed
979
  AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
Sam Hocevar's avatar
   
Sam Hocevar committed
980
981
  if test -x ${GTK_CONFIG}
  then
Sam Hocevar's avatar
   
Sam Hocevar committed
982
983
    CFLAGS_GTK="`${GTK_CONFIG} --cflags gtk`"
    LIB_GTK="`${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
984
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
985
986
987
988
989
990
991
992
  # now look for the gtk.h header
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS $CFLAGS_GTK"
  AC_CHECK_HEADERS(gtk/gtk.h, [
    PLUGINS="${PLUGINS} gtk"
    ALIASES="${ALIASES} gvlc"
  ])
  CPPFLAGS=$saved_CPPFLAGS
993
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
994
995
996
997

dnl
dnl  X11 module
dnl
998
AC_ARG_ENABLE(x11,
Sam Hocevar's avatar
   
Sam Hocevar committed
999
  [  --disable-x11           X11 support (default enabled)])
1000
if test x$enable_x11 != xno; then