configure.in 46 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 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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, :)
    LIB_MPEG_TS="${LIB_MPEG_TS} -lws2_32"
    LIB_RC="${LIB_RC} -lws2_32"
    ;;
  x*nto*)
    SYS=nto
    LIB_X11="${LIB_X11} -lsocket"
    LIB_XVIDEO="${LIB_XVIDEO} -lsocket"
    ;;
  xbeos)
    SYS=beos
    LIB="${LIB} -lbe"
    LIB_BEOS="${LIB_BEOS} -lbe -lgame -lroot -ltracker"
    PLDFLAGS="${PLDFLAGS} -nostart"
    ;;
  x*)
    SYS=${target_os}
    ;;
esac

84
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
85
dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
86
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
87
88
89
90
91
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)])
92
93
94
95
96
97
98
99
100
101
  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
102
103
104
105
      AC_CACHE_CHECK([whether the byte order is big-endian],
        [ac_cv_c_bigendian],
        [ac_cv_c_bigendian=unknown
        [cat >conftest.c <<EOF
106
107
108
109
110
111
112
113
        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
114
115
116
117
118
        ]
        if test -f conftest.c
        then 
          if ${CC-cc} conftest.c -o conftest.o >config.log 2>&1 \
              && test -f conftest.o
119
          then
120
121
122
123
124
125
126
127
            if test `grep -l BIGenDianSyS conftest.o`
            then
              ac_cv_c_bigendian=yes
            fi
            if test `grep -l LiTTleEnDian conftest.o`
            then
              ac_cv_c_bigendian=no
            fi
128
129
          fi
        fi
130
      ])
131
132
133
134
135
136
      if test $ac_cv_c_bigendian = xunknown
      then
        AC_MSG_ERROR([Could not guess endianness, please use --with-words])
      fi
      ;;
  esac
137
138
139
140
141
dnl  Now we know what to use for endianness, just put it in the header
if test $ac_cv_c_bigendian = yes
then
  AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
fi
142
143

dnl Check for system libs needed
Sam Hocevar's avatar
   
Sam Hocevar committed
144
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty)
Sam Hocevar's avatar
   
Sam Hocevar committed
145
146
147
148
149
150
151
152
153
154
155
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")
  ])
])
156
AC_CHECK_FUNCS(usleep)
Sam Hocevar's avatar
   
Sam Hocevar committed
157
158
159
AC_CHECK_FUNC(inet_aton,,[
  AC_CHECK_LIB(resolv,inet_aton,LIB="${LIB} -lresolv")
])
Sam Hocevar's avatar
   
Sam Hocevar committed
160
AC_CHECK_FUNCS(vasprintf)
Sam Hocevar's avatar
   
Sam Hocevar committed
161
AC_CHECK_FUNCS(swab)
162
AC_CHECK_FUNCS([memalign valloc])
Sam Hocevar's avatar
   
Sam Hocevar committed
163

Sam Hocevar's avatar
   
Sam Hocevar committed
164
165
AC_CHECK_FUNCS(sigrelse)

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

174
AC_TYPE_SIGNAL
Sam Hocevar's avatar
   
Sam Hocevar committed
175
AC_CHECK_LIB(dl,dlopen,LIB="${LIB} -ldl")
Sam Hocevar's avatar
   
Sam Hocevar committed
176
177
178
AC_CHECK_LIB(m,cos,
  LIB_IMDCT="${LIB_IMDCT} -lm"
  LIB_FILTER_DISTORT="${LIB_FILTER_DISTORT} -lm")
Sam Hocevar's avatar
   
Sam Hocevar committed
179
180
181
182
183
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
184

Sam Hocevar's avatar
   
Sam Hocevar committed
185
dnl Check for pthreads - borrowed from XMMS
Sam Hocevar's avatar
   
Sam Hocevar committed
186
187
188
189
190
191
192
193
194
195
196
197
198
199
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
200
201
202

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

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

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

Sam Hocevar's avatar
   
Sam Hocevar committed
220
221
AC_HEADER_TIME

Sam Hocevar's avatar
   
Sam Hocevar committed
222
223
224
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
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
245
dnl Check for ntohl, etc.
246
247
248
249
250
251
252
253
254
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
255

Sam Hocevar's avatar
   
Sam Hocevar committed
256
dnl Check for inline function size limit
257
258
259
260
261
262
263
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
264

Sam Hocevar's avatar
   
Sam Hocevar committed
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
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
343
dnl Check for Darwin plugin linking flags
344
345
346
347
348
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
349
    PLDFLAGS="${PLDFLAGS} -bundle -undefined error"
350
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
351
352

dnl Check for standard plugin linking flags
353
354
355
356
357
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
358
    PLDFLAGS="${PLDFLAGS} -shared"
Sam Hocevar's avatar
   
Sam Hocevar committed
359
fi
360
361
        
dnl Check for soname setting
Sam Hocevar's avatar
   
Sam Hocevar committed
362
if test x"${SOFLAGS}" = x; then
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
    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.
------------
"
385
    fi
Sam Hocevar's avatar
   
Sam Hocevar committed
386
387
fi

388
389
390
391
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
392
        CFLAGS="${save_CFLAGS} -Werror"
393
394
395
396
397
398
399
400
401
402
    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
403
dnl End of the bizarre compilation tests
Sam Hocevar's avatar
   
Sam Hocevar committed
404
CFLAGS="${save_CFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
405
LDFLAGS="${save_LDFLAGS}"
Christophe Massiot's avatar
Christophe Massiot committed
406

407
dnl Check for boolean_t
408
409
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
410
    [AC_TRY_COMPILE([#include <sys/types.h>], [boolean_t foo;],
411
412
413
414
415
416
417
     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
418
    [AC_TRY_COMPILE([#include <pthread.h>], [boolean_t foo;],
419
420
421
422
423
424
425
     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
426
    [AC_TRY_COMPILE([#include <cthreads.h>], [boolean_t foo;],
427
428
429
430
     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
431

Sam Hocevar's avatar
   
Sam Hocevar committed
432
433
434
435
436
437
438
439
440
441
442
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
443
444
445
446

dnl
dnl  default modules
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
447
448
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 ac3_adec mpeg_vdec"
PLUGINS="${PLUGINS} lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort"
Sam Hocevar's avatar
   
Sam Hocevar committed
449
450
451
452

dnl
dnl  Accelerated modules
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
453
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
454
455
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
Sam Hocevar's avatar
   
Sam Hocevar committed
456
SSE_MODULES="imdctsse downmixsse"
457
ALTIVEC_MODULES="idctaltivec motionaltivec"
458

459
460
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
461
    [AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
462
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
463
if test x"$ac_cv_mmx_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
464
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
465
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
466

467
468
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
469
    [AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
470
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
471
if test x"$ac_cv_mmxext_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
472
  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
473
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
474

475
476
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
477
    [AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
478
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
479
if test x"$ac_cv_3dnow_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
480
  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
481
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
482
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
483

484
485
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
486
    [AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
487
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
488
if test x"$ac_cv_sse_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
489
  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
490
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
491
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
492

gbazin's avatar
   
gbazin committed
493
494
495
# 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
496
497
AC_CACHE_CHECK([if \$CC groks Altivec inline assembly],
    [ac_cv_altivec_inline],
Sam Hocevar's avatar
   
Sam Hocevar committed
498
    [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
499
500
501
         ac_cv_altivec_inline=yes,
         [save_CFLAGS=$CFLAGS
          CFLAGS="$CFLAGS -Wa,-m7400"
Sam Hocevar's avatar
   
Sam Hocevar committed
502
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
503
            [ac_cv_altivec_inline="-Wa,-m7400"],
504
            ac_cv_altivec_inline=no)
505
506
          CFLAGS=$save_CFLAGS
         ])])
507
if test x"$ac_cv_altivec_inline" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
508
  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks ALTIVEC inline assembly.)
509
  if test x"$ac_cv_altivec_inline" != x"yes"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
510
511
    CFLAGS_IDCTALTIVEC="$CFLAGS_IDCTALTIVEC $ac_cv_altivec_inline"
    CFLAGS_MOTIONALTIVEC="$CFLAGS_MOTIONALTIVEC $ac_cv_altivec_inline"
Sam Hocevar's avatar
   
Sam Hocevar committed
512
    CFLAGS_VLC="$CFLAGS_VLC $ac_cv_altivec_inline"
513
  fi
514
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
515
fi
516

517
518
AC_CACHE_CHECK([if \$CC groks Altivec C extensions],
    [ac_cv_c_altivec],
519
520
521
    [save_CFLAGS=$CFLAGS
     CFLAGS="$CFLAGS -faltivec"
     # Darwin test
Sam Hocevar's avatar
   
Sam Hocevar committed
522
     AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
523
524
        ac_cv_c_altivec=-faltivec, [
        # Linux/PPC test
Sam Hocevar's avatar
   
Sam Hocevar committed
525
        CFLAGS="$save_CFLAGS $CFLAGS_IDCTALTIVEC -fvec"
Sam Hocevar's avatar
   
Sam Hocevar committed
526
        AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
527
528
529
530
            [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
        ])
     CFLAGS=$save_CFLAGS
    ])
531
if test x"$ac_cv_c_altivec" != x"no"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
532
  AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C altivec extensions.)
Sam Hocevar's avatar
   
Sam Hocevar committed
533
534
  CFLAGS_IDCTALTIVEC="$CFLAGS_IDCTALTIVEC $ac_cv_c_altivec"
  CFLAGS_MOTIONALTIVEC="$CFLAGS_MOTIONALTIVEC $ac_cv_c_altivec"
Sam Hocevar's avatar
   
Sam Hocevar committed
535
  CFLAGS_VLC="$CFLAGS_VLC $ac_cv_c_altivec"
536
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
537
538
539
540
541
542
543
544
545
546
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
547
548
  LIB_IDCTALTIVEC="${LIB_IDCTALTIVEC} -framework vecLib"
  LIB_MOTIONALTIVEC="${LIB_MOTIONALTIVEC} -framework vecLib"
Sam Hocevar's avatar
   
Sam Hocevar committed
549
  LIB="${LIB} -framework vecLib"
550
fi
gbazin's avatar
   
gbazin committed
551
fi # end if mingw32
552
553

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
554
dnl  DVD and VCD devices
555
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
556
557
case x$SYS in
  xmingw32)
Sam Hocevar's avatar
   
Sam Hocevar committed
558
559
560
561
562
563
564
565
566
567
568
569
    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")

570

Sam Hocevar's avatar
   
Sam Hocevar committed
571
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
572
dnl  libdvdcss: check for DVD ioctls
Sam Hocevar's avatar
   
Sam Hocevar committed
573
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
574

Sam Hocevar's avatar
   
Sam Hocevar committed
575
576
577
dnl  default is no
CAN_BUILD_LIBDVDCSS=0

Sam Hocevar's avatar
   
Sam Hocevar committed
578
579
dnl  for windoze
AC_CHECK_HEADERS(winioctl.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
580
  CAN_BUILD_LIBDVDCSS="${HAVE_LIBDVDCSS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
581
582
])

Sam Hocevar's avatar
   
Sam Hocevar committed
583
dnl  for Un*x and BeOS
Sam Hocevar's avatar
   
Sam Hocevar committed
584
AC_CHECK_HEADERS(sys/ioctl.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
585
  CAN_BUILD_LIBDVDCSS="${HAVE_LIBDVDCSS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
586
  AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h dvd.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
587
  BSD_DVD_STRUCT=0
Sam Hocevar's avatar
   
Sam Hocevar committed
588
  LINUX_DVD_STRUCT=0
589
  OPENBSD_DVD_STRUCT=0
Sam Hocevar's avatar
   
Sam Hocevar committed
590
591
592
  dnl
  dnl Old FreeBSD: sys/cdio.h
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
593
594
595
596
  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,[
597
                    BSD_DVD_STRUCT=1],[LINUX_DVD_STRUCT=1; OPENBSD_DVD_STRUCT=1])
Sam Hocevar's avatar
   
Sam Hocevar committed
598
599
600
601
  ])
  dnl
  dnl Newer FreeBSD: sys/dvdio.h
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
602
603
604
605
606
  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
607
608
609
610
611
612
613
  ])
  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
614
615
616
617
618
    LINUX_DVD_STRUCT=1
  ])
  dnl
  dnl BSDI: dvd.h
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
619
  NEED_BSDI_LIBDVD=0
Sam Hocevar's avatar
   
Sam Hocevar committed
620
621
622
  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
623
    LIB_LIBDVDCSS="${LIB_LIBDVDCSS} -ldvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
624
    LINUX_DVD_STRUCT=1
Sam Hocevar's avatar
   
Sam Hocevar committed
625
626
627
628
629
630
  ],[
    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
631
632
      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
633
      SRC_DVDCSS_EXTRA="${SRC_DVDCSS_EXTRA} bsdi_dvdioctl.c"
Sam Hocevar's avatar
   
Sam Hocevar committed
634
635
      LINUX_DVD_STRUCT=1
    ])
Sam Hocevar's avatar
   
Sam Hocevar committed
636
  ])
Sam Hocevar's avatar
   
Sam Hocevar committed
637
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
638
  dnl Solaris: sys/scsi/scsi_types.h, sys/scsi/impl/uscsi.h
Sam Hocevar's avatar
   
Sam Hocevar committed
639
  dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
640
  AC_CHECK_HEADER(sys/scsi/scsi_types.h,[
Sam Hocevar's avatar
   
Sam Hocevar committed
641
642
643
644
645
    AC_CHECK_HEADER(sys/scsi/impl/uscsi.h,[
      AC_DEFINE(SOLARIS_USCSI, 1, Have userspace SCSI headers.)
    ])
  ])
  dnl
646
647
648
649
650
651
652
653
  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
654
655
656
657
658
  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.)
659
660
661
662
    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
663
664
665
  else
    if test x$BSD_DVD_STRUCT = x1; then
      AC_DEFINE(HAVE_BSD_DVD_STRUCT, 1,
Sam Hocevar's avatar
   
Sam Hocevar committed
666
                Define if FreeBSD-like dvd_struct is defined.)
Sam Hocevar's avatar
   
Sam Hocevar committed
667
668
    fi
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
669
670
671
])

dnl
672
dnl  Special arch tuning
Sam Hocevar's avatar
   
Sam Hocevar committed
673
dnl
674
675
676
677
678
679
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
680
    if test x${target_cpu} = xi686 -o x${target_cpu} = xi586 -o x${target_cpu} = xi486 -o x${target_cpu} = xi386; then TUNING="pentiumpro"
681
    else
682
        if test x${target_cpu} = xpowerpc; then TUNING="750"; fi
683
684
    fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
685

686
687
688
689
690
691
692
693
694
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
695
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
696
dnl  x86 accelerations
Sam Hocevar's avatar
   
Sam Hocevar committed
697
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
698
699
700
701
702
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
703
704
705
706

dnl
dnl  AltiVec acceleration
dnl
707
AC_ARG_ENABLE(altivec,
708
709
710
[  --disable-altivec       Disable altivec optimizations (default enabled on PPC)],
[ if test x$enableval = xyes; then ARCH="${ARCH} altivec";
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
711
[ if test x${target_cpu} = xpowerpc; then ARCH="${ARCH} altivec";
712
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
713
714
715
716

dnl
dnl  Debugging mode
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
717
DEBUG=0
718
AC_ARG_ENABLE(debug,
719
[  --enable-debug          Enable debug mode (default disabled)],
720
[ if test x$enableval = xyes; then DEBUG=1; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
721

Sam Hocevar's avatar
   
Sam Hocevar committed
722
dnl
723
dnl  Profiling
Sam Hocevar's avatar
   
Sam Hocevar committed
724
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
725
726
727
728
729
730
731
732
733
734
735
736
737
738
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
739

Sam Hocevar's avatar
   
Sam Hocevar committed
740
741
742
dnl
dnl  Enable/disable optimizations
dnl
743
AC_ARG_ENABLE(optimizations,
744
[  --disable-optimizations Disable compiler optimizations (default enabled)],
745
746
[ if test x$enableval = xno; then OPTIMS=0; fi ],
[ OPTIMS=1 ])
747

Sam Hocevar's avatar
   
Sam Hocevar committed
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
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
765
dnl  DVD module: check for installed libdvdcss or local libdvdcss
Sam Hocevar's avatar
   
Sam Hocevar committed
766
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
767
NEED_LIBDVDCSS=0
Sam Hocevar's avatar
   
Sam Hocevar committed
768
STATIC_LIBDVDCSS=0
Sam Hocevar's avatar
   
Sam Hocevar committed
769
DUMMY_LIBDVDCSS=0
Sam Hocevar's avatar
   
Sam Hocevar committed
770
AC_ARG_WITH(dvdcss,
771
772
773
774
  [  --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
775
776
777
  [ case "x${withval}" in
    xlocal-static|xyes)
      # local libdvdcss, statically linked
778
      BUILTINS="${BUILTINS} dvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
779
780
      if test x${CAN_BUILD_LIBDVDCSS} = x1
      then
Sam Hocevar's avatar
   
Sam Hocevar committed
781
        NEED_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
782
783
        STATIC_LIBDVDCSS=1
        CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss"
Sam Hocevar's avatar
   
Sam Hocevar committed
784
        LIB_DVD="${LIB_DVD} lib/libdvdcss.a ${LIB_LIBDVDCSS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
785
786
787
788
      fi
    ;;
    xlocal-shared)
      # local libdvdcss, dynamically linked
789
      PLUGINS="${PLUGINS} dvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
790
791
      if test x${CAN_BUILD_LIBDVDCSS} = x1
      then
Sam Hocevar's avatar
   
Sam Hocevar committed
792
        NEED_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
793
        CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss"
794
        LIB_DVD="${LIB_DVD} -L../../lib -ldvdcss"
Sam Hocevar's avatar
   
Sam Hocevar committed
795
      fi
Sam Hocevar's avatar
   
Sam Hocevar committed
796
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
797
798
799
    xno)
      # don't use libdvdcss at all, build a DVD module that can dlopen() it
      BUILTINS="${BUILTINS} dvd"
800
      DUMMY_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
801
      SRC_DVD_EXTRA="${SRC_DVD_EXTRA} dummy_dvdcss.c"
Sam Hocevar's avatar
   
Sam Hocevar committed
802
      CFLAGS_DVD="${CFLAGS_DVD} -DGOD_DAMN_DMCA"
Sam Hocevar's avatar
   
Sam Hocevar committed
803
      CFLAGS_DVD="${CFLAGS_DVD} -DLIBDVDCSS_VERSION=\"${LIBDVDCSS_VERSION}\""
Sam Hocevar's avatar
   
Sam Hocevar committed
804
805
      LIB_DVD="${LIB_DVD} -ldl"
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
806
    *)
Sam Hocevar's avatar
   
Sam Hocevar committed
807
      # existing libdvdcss
808
      PLUGINS="${PLUGINS} dvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
809
810
      if test "x$withval" != "xyes"
      then
811
        LIB_DVD="${LIB_DVD} -L"$withval"/lib"
Sam Hocevar's avatar
   
Sam Hocevar committed
812
813
814
        CFLAGS_DVD="${CFLAGS_DVD} -I"$withval"/include"
      fi
      LIB_DVD="${LIB_DVD} -ldvdcss"
Sam Hocevar's avatar
   
Sam Hocevar committed
815
    esac ],
Sam Hocevar's avatar
   
Sam Hocevar committed
816
  # user didn't decide, we choose to use local libdvdcss and link statically
Sam Hocevar's avatar
   
Sam Hocevar committed
817
  # if libdvdcss is in the archive, or to use the dummy replacement otherwise.
Sam Hocevar's avatar
   
Sam Hocevar committed
818
819
  [ if test x${CAN_BUILD_LIBDVDCSS} = x1
    then
820
      BUILTINS="${BUILTINS} dvd"
Sam Hocevar's avatar
   
Sam Hocevar committed
821
      NEED_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
822
823
      STATIC_LIBDVDCSS=1
      CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss"
Sam Hocevar's avatar
   
Sam Hocevar committed
824
      LIB_DVD="${LIB_DVD} lib/libdvdcss.a ${LIB_LIBDVDCSS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
825
826
827
    else
      # XXX: no check for libdl is done, don't try this at home !
      BUILTINS="${BUILTINS} dvd"
828
      DUMMY_LIBDVDCSS=1
Sam Hocevar's avatar
   
Sam Hocevar committed
829
      SRC_DVD_EXTRA="${SRC_DVD_EXTRA} dummy_dvdcss.c"
Sam Hocevar's avatar
   
Sam Hocevar committed
830
831
      CFLAGS_DVD="${CFLAGS_DVD} -DGOD_DAMN_DMCA"
      LIB_DVD="${LIB_DVD} -ldl"
Sam Hocevar's avatar
   
Sam Hocevar committed
832
    fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
833

Stéphane Borel's avatar
Stéphane Borel committed
834
835
836
dnl
dnl DVDREAD module: check for libdvdread plugin
dnl
837
838
839
840
841
842
843
844
845
846
847
848
849
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,
  [  --with-dvdread[=name]   way to use libdvdread,
                          same options as --with-dvdcss (default no)],
  [ 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
850
        AC_MSG_ERROR([Can't link static dvdread with shared dvdcss])
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
      fi
    ;;
    xno)
    ;;
    x)
      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
        PLUGINS="${PLUGINS} dvdread"
        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
878
        AC_MSG_ERROR([Can't link shared dvdread with static dvdcss])
879
880
881
882
883
884
885
886
887
888
889
890
      else
        PLUGINS="${PLUGINS} dvdread"
        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
891

892
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
893
dnl  VCD module
894
895
dnl
AC_ARG_ENABLE(vcd,
Sam Hocevar's avatar
   
Sam Hocevar committed
896
  [  --enable-vcd            VCD support for Linux (default enabled)])
897

Sam Hocevar's avatar
   
Sam Hocevar committed
898
899
900
901
902
903
if test x$enable_vcd != xno
then
  AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
    BUILTINS="${BUILTINS} vcd"
  ])
fi
904

905
906
907
908
909
if test x$enable_vcd != xno -a "${SYS}" = "bsdi"
then
  BUILTINS="${BUILTINS} vcd"
fi

Jon Lech Johansen's avatar
Jon Lech Johansen committed
910
911
912
913
914
915
if test x$enable_vcd != xno -a "${SYS}" = "darwin"
then
  BUILTINS="${BUILTINS} vcd"
  LIB_VCD="${LIB_VCD} -framework IOKit" 
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
916
917
918
919
920
dnl
dnl  dummy plugin
dnl
AC_ARG_ENABLE(dummy,
  [  --disable-dummy         dummy module (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
921
922
923

if test x$enable_dummy != xno
then
Sam Hocevar's avatar
   
Sam Hocevar committed
924
925
926
927
928
929
930
931
932
933
934
935
  PLUGINS="${PLUGINS} dummy"
fi

dnl
dnl  log plugin
dnl
AC_ARG_ENABLE(logger,
  [  --disable-logger        file logger module (default enabled)])

if test x$enable_logger != xno
then
  PLUGINS="${PLUGINS} logger"
Sam Hocevar's avatar
   
Sam Hocevar committed
936
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
937
938
939
940
941
942

dnl
dnl  null plugin
dnl
AC_ARG_ENABLE(null,
  [  --disable-null          Null module (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
943
944
945

if test x$enable_null != xno
then
Sam Hocevar's avatar
   
Sam Hocevar committed
946
  PLUGINS="${PLUGINS} null"
Sam Hocevar's avatar
   
Sam Hocevar committed
947
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
948
949
950
951
952

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

Sam Hocevar's avatar
   
Sam Hocevar committed
955
956
if test x$enable_rc != xno
then
Sam Hocevar's avatar
   
Sam Hocevar committed
957
  PLUGINS="${PLUGINS} rc"
Sam Hocevar's avatar
   
Sam Hocevar committed
958
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
959

960
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
961
dnl  mad plugin
962
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
963
964
AC_ARG_WITH(mad,
  [  --with-mad[=PATH]       libmad module (default disabled)],
965
966
  [ if test "x$with_val" != "xno"; then
      if test -n $with_val; then
Sam Hocevar's avatar
   
Sam Hocevar committed
967
968
        CFLAGS_MAD="${CFLAGS_MAD} -I$with_val/include"
        LIB_MAD="${LIB_MAD} -L$with_val/lib -lmad"
969
      else
Sam Hocevar's avatar
   
Sam Hocevar committed
970
        LIB_MAD="${LIB_MAD} -lmad"
971
972
973
      fi
      save_CFLAGS=$CFLAGS
      save_LDFLAGS=$LDFLAGS
Sam Hocevar's avatar
   
Sam Hocevar committed
974
975
      CFLAGS="$CFLAGS $CFLAGS_MAD"
      LDFLAGS="$LDFLAGS $LIB_MAD"
976
977
978
979
980
981
982
983
984
985
      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
986
      PLUGINS="${PLUGINS} mad"
987
988
    fi ])

Sam Hocevar's avatar
   
Sam Hocevar committed
989
dnl special case for BeOS
Sam Hocevar's avatar
   
Sam Hocevar committed
990
991
if test x$SYS = xbeos
then
Sam Hocevar's avatar
   
Sam Hocevar committed
992
    PLUGINS="${PLUGINS} beos"
993
994
995
996

dnl default case
else

Sam Hocevar's avatar
   
Sam Hocevar committed
997
998
dnl
dnl  OSS /dev/dsp module
999
dnl  (enabled by default except on win32)
Sam Hocevar's avatar
   
Sam Hocevar committed
1000
dnl
1001
AC_ARG_ENABLE(dsp,
1002
  [  --disable-dsp           Linux /dev/dsp support (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
1003

1004
if test x$enable_dsp != xno &&
Sam Hocevar's avatar
   
Sam Hocevar committed
1005
  (test x$SYS != xmingw32 || test x$enable_dsp = xyes)
Sam Hocevar's avatar
   
Sam Hocevar committed
1006
then
Sam Hocevar's avatar
   
Sam Hocevar committed
1007
  AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h, [
Sam Hocevar's avatar
   
Sam Hocevar committed
1008
    PLUGINS="${PLUGINS} dsp"
Sam Hocevar's avatar
   
Sam Hocevar committed
1009
  ])
1010
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
1011
1012
1013
1014

dnl
dnl  Esound module
dnl
1015
AC_ARG_ENABLE(esd,
1016
  [  --enable-esd            Esound library support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
1017
1018
  [if test x$enable_esd = xyes
   then
Sam Hocevar's avatar
   
Sam Hocevar committed
1019
     AC_PATH_PROG(ESD_CONFIG, esd-config, no)
Sam Hocevar's avatar
   
Sam Hocevar committed
1020
1021
     if test x${ESD_CONFIG} != xno
     then
Sam Hocevar's avatar
   
Sam Hocevar committed
1022
       PLUGINS="${PLUGINS} esd"
Sam Hocevar's avatar
   
Sam Hocevar committed
1023
1024
       CFLAGS_ESD="${CFLAGS_ESD} `${ESD_CONFIG} --cflags`"
       LIB_ESD="${LIB_ESD} `${ESD_CONFIG} --libs`"
Sam Hocevar's avatar
   
Sam Hocevar committed
1025
     fi
Sam Hocevar's avatar
   
Sam Hocevar committed
1026
1027
   fi])

Sam Hocevar's avatar
   
Sam Hocevar committed
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
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"
Sam Hocevar's avatar
   
Sam Hocevar committed
1039
1040
       CFLAGS_ARTS="${CFLAGS_ARTS} `${ARTS_CONFIG} --cflags`"
       LIB_ARTS="${LIB_ARTS} `${ARTS_CONFIG} --libs `"
Sam Hocevar's avatar
   
Sam Hocevar committed
1041
1042
1043
     fi
   fi])

Sam Hocevar's avatar
   
Sam Hocevar committed
1044
1045
1046
dnl
dnl  MacOS X module
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
1047
AC_ARG_ENABLE(macosx,
1048
  [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
Sam Hocevar's avatar
   
Sam Hocevar committed
1049
1050
  [if test x$enable_macosx = xyes
   then
1051
     BUILTINS="${BUILTINS} macosx"
Sam Hocevar's avatar
   
Sam Hocevar committed
1052
1053
     LIB_MACOSX="${LIB_MACOSX} -framework CoreAudio -framework Cocoa -framework AGL -framework QuickTime -lobjc"
     CFLAGS_MACOSX="${CFLAGS_MACOSX} -ObjC"
1054
     LIB="${LIB} -ObjC"
Sam Hocevar's avatar
   
Sam Hocevar committed
1055
   fi],
1056
1057
  [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
     BUILTINS="${BUILTINS} macosx"
Sam Hocevar's avatar
   
Sam Hocevar committed
1058
1059
     LIB_MACOSX="${LIB_MACOSX} -framework CoreAudio -framework Cocoa -framework AGL -framework QuickTime -lobjc"
     CFLAGS_MACOSX="${CFLAGS_MACOSX} -ObjC"
1060
     LIB="${LIB} -ObjC"
Sam Hocevar's avatar
   
Sam Hocevar committed
1061
1062
   )])

1063
1064
1065
1066
dnl
dnl  QNX RTOS module
dnl
AC_ARG_ENABLE(qnx,
1067
  [  --disable-qnx           QNX RTOS support (default enabled on QNX RTOS)])
Sam Hocevar's avatar
   
Sam Hocevar committed
1068
1069
    if test x$enable_qnx != xno
    then
1070
1071
      AC_CHECK_HEADERS(Ph.h, [
        PLUGINS="${PLUGINS} qnx"
Sam Hocevar's avatar
   
Sam Hocevar committed
1072
        LIB_QNX="${LIB_QNX} -lasound -lph"
1073
1074
1075
      ])
    fi

gbazin's avatar
   
gbazin committed
1076
dnl
gbazin's avatar
   
gbazin committed
1077
dnl  a52 AC3 decoder plugin
gbazin's avatar
   
gbazin committed
1078
dnl
gbazin's avatar
   
gbazin committed
1079
1080
AC_ARG_ENABLE(a52,
  [  --disable-a52           AC3 support with liba52 (default enabled)])
Sam Hocevar's avatar
   
Sam Hocevar committed
1081
if test "x$enableval" != "xno" -a x$SYS != xmingw32
gbazin's avatar
   
gbazin committed
1082
1083
  then
    AC_CHECK_HEADERS(a52dec/a52.h, [
gbazin's avatar
   
gbazin committed
1084
1085
      BUILTINS="${BUILTINS} a52"
      LIB_A52="${LIB_A52} -la52"
gbazin's avatar
   
gbazin committed
1086
1087
1088
     ],[])
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
1089
1090
1091
dnl
dnl  Linux framebuffer module
dnl
1092
1093
AC_ARG_ENABLE(fb,
  [  --enable-fb             Linux framebuffer support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
1094
1095
1096
1097
  [ if test x$enable_fb = xyes
    then
      PLUGINS="${PLUGINS} fb"
    fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
1098

Sam Hocevar's avatar
   
Sam Hocevar committed
1099
1100
1101
1102
1103
1104
1105
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
1106
      PLUGINS="${PLUGINS} mga xmga"
Sam Hocevar's avatar
   
Sam Hocevar committed
1107
1108
    fi ])

Sam Hocevar's avatar
   
Sam Hocevar committed
1109
1110
1111
dnl
dnl  GGI module
dnl
Christophe Massiot's avatar
Christophe Massiot committed
1112
1113
AC_ARG_WITH(ggi,
  [  --with-ggi[=name]       GGI support (default disabled)],
Sam Hocevar's avatar
   
Sam Hocevar committed
1114
  [ if test "x$withval" != "xno"
Christophe Massiot's avatar
Christophe Massiot committed
1115
    then
Sam Hocevar's avatar
   
Sam Hocevar committed
1116
1117
      PLUGINS="${PLUGINS} ggi"
      if test "x$withval" != "xyes"
Sam Hocevar's avatar
   
Sam Hocevar committed
1118
      then
Sam Hocevar's avatar
   
Sam Hocevar committed
1119
        LIB_GGI="${LIB_GGI} -l$withval"
Sam Hocevar's avatar
   
Sam Hocevar committed
1120
      else
Sam Hocevar's avatar
   
Sam Hocevar committed
1121
        LIB_GGI="${LIB_GGI} -lggi"
Sam Hocevar's avatar
   
Sam Hocevar committed
1122
      fi
Christophe Massiot's avatar
Christophe Massiot committed
1123
    fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
1124
1125
1126
1127

dnl
dnl  SDL module
dnl
1128
1129
AC_ARG_ENABLE(sdl,
  [  --disable-sdl           SDL support (default enabled)])
1130
if test "x$enable_sdl" != "xno"
1131
then
1132
1133
1134
1135
1136
1137
1138
1139
  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)
1140
1141
  SDL_CONFIG=${SDL12_CONFIG}
  SDL_HEADER="SDL12/SDL.h"
Sam Hocevar's avatar
   
Sam Hocevar committed
1142
1143
  if test x${SDL_CONFIG} = xno
  then
1144
    AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, $SDL_PATH)
Sam Hocevar's avatar
   
Sam Hocevar committed
1145
    SDL_CONFIG=${SDL11_CONFIG}
1146
1147
    SDL_HEADER="SDL11/SDL.h"
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
1148
1149
  if test x${SDL_CONFIG} = xno
  then
1150
    AC_PATH_PROG(SDL_CONFIG, sdl-config, no, $SDL_PATH)
1151
    SDL_HEADER="SDL/SDL.h"
1152
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
1153
1154
  if test x${SDL_CONFIG} != xno
  then
1155
    PLUGINS="${PLUGINS} sdl"
Sam Hocevar's avatar
   
Sam Hocevar committed
1156
1157
    CFLAGS_SDL="${CFLAGS_SDL} `${SDL_CONFIG} --cflags`"
    LIB_SDL="${LIB_SDL} `${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`"
Sam Hocevar's avatar
   
Sam Hocevar committed
1158
1159
    save_CPPFLAGS=$CPPFLAGS
    CPPFLAGS="$CPPFLAGS $CFLAGS_SDL"
1160
1161
    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),
1162
1163
1164
1165
      [ 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
1166
    CPPFLAGS=$save_CPPFLAGS
Sam Hocevar's avatar
   
Sam Hocevar committed
1167
    if expr 1.1.5 \> `$SDL_CONFIG --version` >/dev/null
Sam Hocevar's avatar
   
Sam Hocevar committed
1168
    then
1169
1170
1171
      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
1172
    fi
1173
  elif test "x$enable_sdl" =  "xyes"
Sam Hocevar's avatar
   
Sam Hocevar committed
1174
  then
1175
1176
1177
    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.
    ])
1178
1179
  fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
1180

Sam Hocevar's avatar
   
Sam Hocevar committed
1181
1182
1183
dnl
dnl  Windows DirectX module
dnl
1184
AC_ARG_ENABLE(directx,
gbazin's avatar
   
gbazin committed
1185
  [  --disable-directx       Win32 DirectX support (default enabled on Win32)])
1186
1187
if test "x$enableval" != "xno"
then
Sam Hocevar's avatar
   
Sam Hocevar committed
1188
  if test x$SYS = xmingw32
1189
1190
  then
    AC_ARG_WITH(directx-path, 
gbazin's avatar
   
gbazin committed
1191
    [  --with-directx-path=path Win32 DirectX headers and libraries])
1192
    if test "x$with_directx_path" = "x"
Sam Hocevar's avatar
   
Sam Hocevar committed
1193
    then
gbazin's avatar
   
gbazin committed
1194
      AC_CHECK_HEADERS(ddraw.h,
1195
      [ PLUGINS="${PLUGINS} directx"
Sam Hocevar's avatar
   
Sam Hocevar committed
1196
        LIB_DIRECTX="${LIB_DIRECTX} -lgdi32" ])
1197
1198
    else
      AC_MSG_CHECKING(for directX headers in ${withval})
gbazin's avatar
   
gbazin committed
1199
      if test -f ${withval}/ddraw.h
gbazin's avatar
   
gbazin committed
1200
      then
1201
        PLUGINS="${PLUGINS} directx"
Sam Hocevar's avatar
   
Sam Hocevar committed
1202
        LIB_DIRECTX="${LIB_DIRECTX} -L${withval}/lib -lgdi32"
gbazin's avatar
   
gbazin committed
1203
        INCLUDE="${INCLUDE} -I${withval}"