configure.ac.in 70.2 KB
Newer Older
Sam Hocevar's avatar
   
Sam Hocevar committed
1
dnl Autoconf settings for vlc
2

3
AC_INIT(vlc,0.5.0-cvs-am)
4

Sam Hocevar's avatar
Sam Hocevar committed
5
6
CONFIGURE_LINE="$0 $*"
CODENAME="Natalya"
7

8
9
10
11
AC_PREREQ(2.50)
AC_CONFIG_SRCDIR(src/libvlc.c)
AC_CANONICAL_SYSTEM

12
13
dnl XXX: we don't put any flags here, because automake 1.5 doesn't support
dnl them. And we need the comma otherwize automake will choke on it.
14
AM_INIT_AUTOMAKE(vlc,0.5.0-cvs-am)
15
16
AM_CONFIG_HEADER(config.h)

Sam Hocevar's avatar
Sam Hocevar committed
17
18
19
dnl
dnl  Save *FLAGS
dnl
20
21
22
23
24
CPPFLAGS_save="${CPPFLAGS}"
CFLAGS_save="${CFLAGS}"
CXXFLAGS_save="${CXXFLAGS}"
OBJCFLAGS_save="${OBJCFLAGS}"
LDFLAGS_save="${LDFLAGS}"
Sam Hocevar's avatar
   
Sam Hocevar committed
25

Sam Hocevar's avatar
Sam Hocevar committed
26
dnl
27
dnl Check for tools
Sam Hocevar's avatar
Sam Hocevar committed
28
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
29
AC_PROG_CC
30
AM_PROG_CC_C_O
Sam Hocevar's avatar
   
Sam Hocevar committed
31
AC_PROG_CPP
32
AC_PROG_CXX
33
34
AC_PROG_MAKE_SET
AC_PROG_INSTALL
35

36
37
38
39
40
41
42
43
44
45
46
47
dnl AC_PROG_OBJC doesn't seem to exist, this is the KDE workaround
AC_MSG_CHECKING(for an Objective-C compiler)
OBJC="${CXX}"
AC_SUBST(OBJC)
OBJCFLAGS="${CXXFLAGS} -fgnu-runtime -fconstant-string-class=NSConstantString"
AC_SUBST(OBJCFLAGS)
dnl _AM_DEPENDENCIES(OBJC) doesn't work, so hard code OBJCDEPMODE here
#OBJCDEPMODE="depmode=gcc3"
#AC_SUBST(OBJCDEPMODE)
_AM_DEPENDENCIES(OBJC)
AC_MSG_RESULT(not implemented yet)

gbazin's avatar
   
gbazin committed
48
49
dnl Find the right ranlib, even when cross-compiling
AC_CHECK_TOOL(RANLIB, ranlib, :)
Sam Hocevar's avatar
   
Sam Hocevar committed
50
AC_CHECK_TOOL(STRIP, strip, :)
gbazin's avatar
   
gbazin committed
51

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

57
58
59
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL

60
61
62
63
dnl Check for compiler properties
AC_C_CONST
AC_C_INLINE

Sam Hocevar's avatar
Sam Hocevar committed
64
dnl
65
dnl  Set default values
Sam Hocevar's avatar
Sam Hocevar committed
66
dnl
67
68
LDFLAGS_vlc="${LDFLAGS}"
LIBEXT=".so"
Sam Hocevar's avatar
Sam Hocevar committed
69

gbazin's avatar
   
gbazin committed
70
71
72
dnl
dnl  Check the operating system
dnl
73
case "x${target_os}" in
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
  x)
    SYS=unknown
    ;;
  xlinux*)
    SYS=linux
    ;;
  xbsdi*)
    SYS=bsdi
    CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
    LDFLAGS_dvd="${LDFLAGS_dvd} -ldvd"
    LDFLAGS_vcd="${LDFLAGS_vcd} -ldvd"
    ;;
  x*bsd*)
    SYS="${target_os}"
    CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
    ;;
  xdarwin*)
    SYS=darwin
    CFLAGS_save="${CFLAGS_save} -no-cpp-precomp"; CFLAGS="${CFLAGS_save}"
    CXXFLAGS_save="${CXXFLAGS_save} -no-cpp-precomp"; CXXFLAGS="${CXXFLAGS_save}"
    OBJCFLAGS_save="${OBJCFLAGS_save} -no-cpp-precomp"; OBJCFLAGS="${OBJCFLAGS_save}"
    LDFLAGS_vlc="${LDFLAGS_vlc} -all_load"
    LIBEXT=".dylib"
    ;;
gbazin's avatar
   
gbazin committed
98
  x*mingw32* | x*cygwin*)
99
100
    AC_CHECK_TOOL(WINDRES, windres, :)
    LIBEXT=".dll"
gbazin's avatar
   
gbazin committed
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

    case "x${target_os}" in
      x*mingw32*)
        SYS=mingw32
        ;;
      x*cygwin*)
        dnl Check if we are using the mno-cygwin mode in which case we are
        dnl actually dealing with a mingw32 compiler.
        AC_EGREP_CPP(yes,
            [#ifdef WIN32
             yes
             #endif],
            SYS=mingw32, SYS=cygwin)
        ;;
    esac

    if test "x$SYS" = "xmingw32"; then
        CPPFLAGS_save="${CPPFLAGS_save} -D_OFF_T_ -D_off_t=long"
        CPPFLAGS="${CPPFLAGS_save}"
        LDFLAGS_vlc="${LDFLAGS_vlc} -lws2_32 -lnetapi32 -mwindows"
        LDFLAGS_ipv4="${LDFLAGS_ipv4} -lws2_32"
        LDFLAGS_ipv6="${LDFLAGS_ipv6} -lws2_32"
        LDFLAGS_access_http="${LDFLAGS_http} -lws2_32"
        LDFLAGS_rc="${LDFLAGS_rc} -lws2_32"
    fi
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
    ;;
  x*nto*)
    SYS=nto
    LDFLAGS_x11="${LDFLAGS_x11} -lsocket"
    LDFLAGS_xvideo="${LDFLAGS_xvideo} -lsocket"
    ;;
  xsolaris*)
    SYS=solaris
    ;;
  xhpux*)
    SYS=hpux
    LIBEXT=".sl"
    ;;
  xbeos)
    SYS=beos
    CFLAGS_save="${CFLAGS_save} -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual"; CFLAGS="${CFLAGS_save}"
    CXXFLAGS_save="${CXXFLAGS_save} -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual"; CXXFLAGS="${CXXFLAGS_save}"
    LDFLAGS_vlc="${LDFLAGS_vlc} -lbe"
    LDFLAGS_plugins="${LDFLAGS_plugins} -nostart"
145
    LDFLAGS_beos="${LDFLAGS_beos} -lbe -lmedia -lroot -ltracker -lstdc++.r4 -ltranslation"
146
147
148
149
150
    LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind"
    ;;
  x*)
    SYS="${target_os}"
    ;;
gbazin's avatar
   
gbazin committed
151
esac
152
153
154
155
156
157
AM_CONDITIONAL(HAVE_BEOS, test "x${SYS}" = "xbeos")
AM_CONDITIONAL(HAVE_DARWIN, test "x${SYS}" = "xdarwin")
AM_CONDITIONAL(HAVE_WIN32, test "x${SYS}" = "xmingw32")

AC_MSG_CHECKING(for suffix of libraries)
AC_MSG_RESULT(${LIBEXT})
gbazin's avatar
   
gbazin committed
158

gbazin's avatar
   
gbazin committed
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
dnl Check for fnative-struct or mms-bitfields support for mingw32
if test x$SYS = xmingw32
then
    AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
        [ac_cv_c_mms_bitfields],
        [CFLAGS="${CFLAGS_save} -mms-bitfields"
         AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
    if test x"$ac_cv_c_mms_bitfields" != x"no"; then
        CFLAGS_mingw32_special="-mms-bitfields"
    else
        CFLAGS_mingw32_special="-fnative-struct"
    fi

    CFLAGS_save="${CFLAGS_save} ${CFLAGS_mingw32_special}"; CFLAGS="${CFLAGS_save}"
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
175
dnl Flags for plugin compilation
176
177
case "x${SYS}" in
  xmingw32|xcygwin)
gbazin's avatar
   
gbazin committed
178
179
180
181
182
183
    CFLAGS_pics="${CFLAGS_pics} ${CFLAGS_mingw32_special}"
    CXXFLAGS_pics="${CXXFLAGS_pics} ${CFLAGS_mingw32_special}"
    OBJCFLAGS_pics="${OBJCFLAGS_pics} ${CFLAGS_mingw32_special}"
    CFLAGS_plugins="${CFLAGS_plugins} ${CFLAGS_mingw32_special}"
    CXXFLAGS_plugins="${CXXFLAGS_plugins} ${CFLAGS_mingw32_special}"
    OBJCFLAGS_plugins="${OBJCFLAGS_plugins} ${CFLAGS_mingw32_special}"
184
185
186
187
188
189
190
191
192
193
194
    ;;
  x*)
    CFLAGS_pics="${CFLAGS_pics} -fPIC"
    CXXFLAGS_pics="${CXXFLAGS_pics} -fPIC"
    OBJCFLAGS_pics="${OBJCFLAGS_pics} -fPIC"
    CFLAGS_plugins="${CFLAGS_plugins} -fPIC"
    CXXFLAGS_plugins="${CXXFLAGS_plugins} -fPIC"
    OBJCFLAGS_plugins="${OBJCFLAGS_plugins} -fPIC"
    LDFLAGS_plugins="${LDFLAGS_plugins} -fPIC"
    ;;
esac
Sam Hocevar's avatar
   
Sam Hocevar committed
195
196

dnl The -DSYS_FOO flag
197
CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CPPFLAGS="${CPPFLAGS_save}"
Sam Hocevar's avatar
   
Sam Hocevar committed
198

199
dnl Check for system libs needed
200
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll strndup)
Sam Hocevar's avatar
   
Sam Hocevar committed
201

Sam Hocevar's avatar
   
Sam Hocevar committed
202
AC_CHECK_FUNC(connect,,[
203
204
205
  AC_CHECK_LIB(socket,connect,
    LDFLAGS_ipv4="${LDFLAGS_ipv4} -lsocket"
    LDFLAGS_vlc="${LDFLAGS_vlc} -lsocket"
Sam Hocevar's avatar
   
Sam Hocevar committed
206
)])
207

Sam Hocevar's avatar
Sam Hocevar committed
208
AC_CHECK_FUNC(send,,[
209
210
  AC_CHECK_LIB(socket,send,
    LDFLAGS_http="${LDFLAGS_http} -lsocket"
Sam Hocevar's avatar
Sam Hocevar committed
211
)])
212

Sam Hocevar's avatar
   
Sam Hocevar committed
213
AC_CHECK_FUNC(gethostbyname,,[
214
215
  AC_CHECK_LIB(nsl,gethostbyname,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lnsl",[
    AC_CHECK_LIB(bind,gethostbyname,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind")])
Sam Hocevar's avatar
   
Sam Hocevar committed
216
])
217
218
219

have_nanosleep=false
AC_CHECK_FUNC(nanosleep,have_nanosleep=:,[
220
  AC_CHECK_LIB(rt,nanosleep,
221
    [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"; have_nanosleep=:],
222
    [AC_CHECK_LIB(posix4,nanosleep,
223
        [LDFLAGS_vlc="${LDFLAGS_vlc} -lposix4"; have_nanosleep=:])]
224
  )
Sam Hocevar's avatar
   
Sam Hocevar committed
225
])
226
227
228
if ${have_nanosleep}; then
  AC_DEFINE(HAVE_NANOSLEEP, 1,
            Define if nanosleep is available.)
229
fi
230
# HP/UX port
231
AC_CHECK_LIB(rt,sem_init, [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"])
232

Sam Hocevar's avatar
   
Sam Hocevar committed
233
AC_CHECK_FUNC(inet_aton,,[
234
  AC_CHECK_LIB(resolv,inet_aton,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lresolv")
235
236
])
AC_CHECK_FUNC(textdomain,,[
237
238
239
240
  AC_CHECK_LIB(intl,textdomain,
    LDFLAGS_vlc="${LDFLAGS_vlc} -lintl"
    LDFLAGS_plugins="${LDFLAGS_plugins} -lintl"
  )
Sam Hocevar's avatar
   
Sam Hocevar committed
241
])
Sam Hocevar's avatar
   
Sam Hocevar committed
242

Sam Hocevar's avatar
   
Sam Hocevar committed
243
dnl Check for getopt
244
need_getopt=false
Sam Hocevar's avatar
   
Sam Hocevar committed
245
246
AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
[ # FreeBSD has a gnugetopt library for this:
247
248
249
250
  AC_CHECK_LIB([gnugetopt],[getopt_long],
    [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) LDFLAGS_vlc="${LDFLAGS_vlc} -lgnugetopt"],
    [need_getopt=:])])
AM_CONDITIONAL(BUILD_GETOPT, ${need_getopt})
Sam Hocevar's avatar
   
Sam Hocevar committed
251

252
AC_TYPE_SIGNAL
253
AC_CHECK_LIB(dl,dlopen,LDFLAGS_vlc="${LDFLAGS_vlc} -ldl")
Sam Hocevar's avatar
   
Sam Hocevar committed
254
AC_CHECK_LIB(m,cos,
255
256
  LDFLAGS_imdct="${LDFLAGS_imdct} -lm"
  LDFLAGS_filter_distort="${LDFLAGS_filter_distort} -lm")
Sam Hocevar's avatar
   
Sam Hocevar committed
257
AC_CHECK_LIB(m,pow,
258
259
260
261
262
263
  LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lm"
  LDFLAGS_imdct="${LDFLAGS_imdct} -lm"
  LDFLAGS_imdct3dn="${LDFLAGS_imdct3dn} -lm"
  LDFLAGS_imdctsse="${LDFLAGS_imdctsse} -lm"
  LDFLAGS_i420_rgb="${LDFLAGS_i420_rgb} -lm"
  LDFLAGS_faad="${LDFLAGS_faad} -lm"
Sam Hocevar's avatar
   
Sam Hocevar committed
264
)
Sam Hocevar's avatar
   
Sam Hocevar committed
265

Sam Hocevar's avatar
   
Sam Hocevar committed
266
dnl Check for pthreads - borrowed from XMMS
Sam Hocevar's avatar
   
Sam Hocevar committed
267
THREAD_LIB=error
268
if test "x${THREAD_LIB}" = "xerror"; then
269
  AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
Sam Hocevar's avatar
   
Sam Hocevar committed
270
fi
271
if test "x${THREAD_LIB}" = "xerror"; then
272
  AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
Sam Hocevar's avatar
   
Sam Hocevar committed
273
fi
274
if test "x${THREAD_LIB}" = "xerror"; then
275
  AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
Sam Hocevar's avatar
   
Sam Hocevar committed
276
fi
277
if test "x${THREAD_LIB}" = "xerror"; then
278
279
  AC_CHECK_FUNC(pthread_mutex_lock)
  THREAD_LIB=""
Sam Hocevar's avatar
   
Sam Hocevar committed
280
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
281
282
283

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

Sam Hocevar's avatar
   
Sam Hocevar committed
285
286
dnl Check for misc headers
AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
287
288
  AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
            Define if <pthread.h> defines pthread_cond_t.)])
Sam Hocevar's avatar
Sam Hocevar committed
289
AC_EGREP_HEADER(pthread_once,pthread.h,[
290
291
  AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
            Define if <pthread.h> defines pthread_once.)])
Sam Hocevar's avatar
   
Sam Hocevar committed
292
AC_EGREP_HEADER(strncasecmp,strings.h,[
293
294
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
            Define if <strings.h> defines strncasecmp.)])
Sam Hocevar's avatar
   
Sam Hocevar committed
295

Sam Hocevar's avatar
   
Sam Hocevar committed
296
dnl Check for headers
Sam Hocevar's avatar
Sam Hocevar committed
297
AC_CHECK_HEADERS(stdint.h getopt.h strings.h inttypes.h sys/int_types.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
298
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
299
300
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
301
AC_CHECK_HEADERS(machine/param.h sys/shm.h)
302
AC_CHECK_HEADERS(linux/version.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
303

Sam Hocevar's avatar
   
Sam Hocevar committed
304
305
AC_HEADER_TIME

306
dnl Mac OS X and other OSes don't have declaration for nanosleep
307
AC_EGREP_HEADER(nanosleep,time.h,[
308
309
  AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
            Define if <time.h> defines nanosleep.)
310
])
311
312

dnl Make sure we have timespecs
313
AC_EGREP_HEADER(timespec,sys/time.h,[
314
315
  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
            Define if <sys/time.h> defines struct timespec.)
316
])
317

Sam Hocevar's avatar
   
Sam Hocevar committed
318
319
320
dnl Check for threads library
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)

321
322
dnl Default X headers and libraries
if test "x${x_includes}" = "xNONE"; then
323
  x_includes="/usr/X11R6/include"
324
325
fi
if test "x${x_libraries}" = "xNONE"; then
326
  x_libraries="/usr/X11R6/lib"
327
328
fi

329
dnl Build the gtk_main plugins?
330
NEED_GTK_MAIN=no
331
NEED_GNOME_MAIN=no
332

Sam Hocevar's avatar
   
Sam Hocevar committed
333
dnl Check for DPMS
334
if test "x${SYS}" != "xmingw32"
Sam Hocevar's avatar
   
Sam Hocevar committed
335
then
336
337
338
339
340
341
342
343
  CPPFLAGS="${CPPFLAGS_save} -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="${CPPFLAGS_save}"
Sam Hocevar's avatar
   
Sam Hocevar committed
344
345
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
346
dnl Check for ntohl, etc.
347
AC_CACHE_CHECK([for ntohl in sys/param.h],
348
349
350
351
352
    [ac_cv_c_ntohl_sys_param_h],
    [CFLAGS="${CFLAGS_save} -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)])
353
if test "x${ac_cv_c_ntohl_sys_param_h}" != "xno"; then
354
    AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
355
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
356

Sam Hocevar's avatar
   
Sam Hocevar committed
357
dnl Check for inline function size limit
358
AC_CACHE_CHECK([if \$CC accepts -finline-limit],
359
360
361
    [ac_cv_c_inline_limit],
    [CFLAGS="${CFLAGS_save} -finline-limit-30000"
     AC_TRY_COMPILE([],,ac_cv_c_inline_limit=yes, ac_cv_c_inline_limit=no)])
362
if test "x${ac_cv_c_inline_limit}" != "xno"; then
363
364
365
    CFLAGS_save="${CFLAGS_save} -finline-limit-30000"; CFLAGS="${CFLAGS_save}"
    CXXFLAGS_save="${CXXFLAGS_save} -finline-limit-30000"; CXXFLAGS="${CXXFLAGS_save}"
    OBJCFLAGS_save="${OBJCFLAGS_save} -finline-limit-30000"; OBJCFLAGS="${OBJCFLAGS_save}"
366
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
367

Sam Hocevar's avatar
   
Sam Hocevar committed
368
369
dnl Check for -W or -w flags
AC_CACHE_CHECK([if \$CC accepts -Wall -Winline],
370
371
372
    [ac_cv_c_Wall_Winline],
    [CFLAGS="-Wall -Winline ${CFLAGS_save}"
     AC_TRY_COMPILE([],,ac_cv_c_Wall_Winline=yes, ac_cv_c_Wall_Winline=no)])
373
if test "x${ac_cv_c_Wall_Winline}" != "xno"; then
374
375
376
    CFLAGS_save="-Wall -Winline ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
    CXXFLAGS_save="-Wall -Winline ${CXXFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
    OBJCFLAGS_save="-Wall -Winline ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
Sam Hocevar's avatar
   
Sam Hocevar committed
377
else
378
379
380
381
382
383
384
385
386
    AC_CACHE_CHECK([if \$CC accepts -wall -winline],
        [ac_cv_c_wall_winline],
        [CFLAGS="-wall -winline ${CFLAGS_save}"
         AC_TRY_COMPILE([],,ac_cv_c_wall_winline=yes, ac_cv_c_wall_winline=no)])
    if test "x${ac_cv_c_wall_winline}" != "xno"; then
        CFLAGS_save="-wall -winline ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
        CXXFLAGS_save="-wall -winline ${CXXFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
        OBJCFLAGS_save="-wall -winline ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
    fi
Sam Hocevar's avatar
   
Sam Hocevar committed
387
388
389
390
fi

dnl Check for -pipe
AC_CACHE_CHECK([if \$CC accepts -pipe],
391
392
393
    [ac_cv_c_pipe],
    [CFLAGS="${CFLAGS_save} -pipe"
     AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
394
if test "x${ac_cv_c_pipe}" != "xno"; then
395
396
397
    CFLAGS_save="${CFLAGS_save} -pipe"; CFLAGS="${CFLAGS_save}"
    CXXFLAGS_save="${CXXFLAGS_save} -pipe"; CXXFLAGS="${CXXFLAGS_save}"
    OBJCFLAGS_save="${OBJCFLAGS_save} -pipe"; OBJCFLAGS="${OBJCFLAGS_save}"
Sam Hocevar's avatar
   
Sam Hocevar committed
398
399
400
401
fi

dnl Check for various optimization flags
AC_CACHE_CHECK([if \$CC accepts -O3],
402
403
404
    [ac_cv_c_o3],
    [CFLAGS="${CFLAGS_save} -O3"
     AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
405
if test "x${ac_cv_c_o3}" != "xno"; then
406
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
407
else
408
409
410
411
412
413
414
415
416
417
418
419
420
421
    AC_CACHE_CHECK([if \$CC accepts -O2],
        [ac_cv_c_o2],
        [CFLAGS="${CFLAGS_save} -O2"
         AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)])
    if test "x${ac_cv_c_o2}" != "xno"; then
        CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
    else
        AC_CACHE_CHECK([if \$CC accepts -O],
            [ac_cv_c_o],
            [CFLAGS="${CFLAGS_save} -O"
             AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
        if test "x${ac_cv_c_o}" != "xno"; then
            CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
        fi
Sam Hocevar's avatar
   
Sam Hocevar committed
422
423
424
425
426
    fi
fi

dnl Check for -ffast-math
AC_CACHE_CHECK([if \$CC accepts -ffast-math],
427
428
429
    [ac_cv_c_fast_math],
    [CFLAGS="${CFLAGS_save} -ffast-math"
     AC_TRY_COMPILE([],,ac_cv_c_fast_math=yes, ac_cv_c_fast_math=no)])
430
if test "x${ac_cv_c_fast_math}" != "xno"; then
431
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
Sam Hocevar's avatar
   
Sam Hocevar committed
432
433
434
435
fi

dnl Check for -funroll-loops
AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
436
437
438
    [ac_cv_c_unroll_loops],
    [CFLAGS="${CFLAGS_save} -funroll-loops"
     AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)])
439
if test "x${ac_cv_c_unroll_loops}" != "xno"; then
440
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
Sam Hocevar's avatar
   
Sam Hocevar committed
441
442
443
444
fi

dnl Check for -fomit-frame-pointer
AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
445
446
447
    [ac_cv_c_omit_frame_pointer],
    [CFLAGS="${CFLAGS_save} -fomit-frame-pointer"
     AC_TRY_COMPILE([],,ac_cv_c_omit_frame_pointer=yes, ac_cv_c_omit_frame_pointer=no)])
448
if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
449
450
451
    CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
    # this plugin does not compile without -fomit-frame-pointer, damn gcc!
    CFLAGS_i420_yuy2_mmx="${CFLAGS_i420_yuy2_mmx} -fomit-frame-pointer"
Sam Hocevar's avatar
   
Sam Hocevar committed
452
453
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
454
dnl Check for Darwin plugin linking flags
Christophe Massiot's avatar
Christophe Massiot committed
455
AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
456
457
458
    [ac_cv_ld_darwin],
    [CFLAGS="${CFLAGS_save} -bundle -undefined error -lcc_dynamic"
     AC_TRY_COMPILE([],,ac_cv_ld_darwin=yes, ac_cv_ld_darwin=no)])
459
if test "x${ac_cv_ld_darwin}" != "xno"; then
460
    LDFLAGS_plugins="${LDFLAGS_plugins} -bundle -undefined error -lcc_dynamic"
461
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
462
463

dnl Check for standard plugin linking flags
464
AC_CACHE_CHECK([if \$CC accepts -shared],
465
466
467
    [ac_cv_ld_plugins],
    [CFLAGS="${CFLAGS_save} -shared"
     AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
468
if test "x${ac_cv_ld_plugins}" != "xno"; then
469
    LDFLAGS_plugins="${LDFLAGS_plugins} -shared"
Sam Hocevar's avatar
   
Sam Hocevar committed
470
fi
471

472
473
dnl Check for variadic macros
AC_CACHE_CHECK([for variadic cpp macros],
474
475
476
477
478
479
480
481
    [ac_cv_cpp_variadic_macros],
    [CFLAGS="${CFLAGS_save}"
     AC_TRY_COMPILE(
         [#include <stdio.h>
          #define a(b,c...) printf(b,##c)],
         [a("foo");a("%s","bar");a("%s%s","baz","quux");],
         ac_cv_cpp_variadic_macros=yes,
         ac_cv_cpp_variadic_macros=no)])
482
if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
483
    AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
484
485
fi

486
487
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
488
489
490
491
492
493
494
495
496
    [ac_cv_c_attribute_aligned],
    [ac_cv_c_attribute_aligned=0
        CFLAGS="${CFLAGS_save} -Werror"
    for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
        AC_TRY_COMPILE([],
        [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
        [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
    done
        CFLAGS="${CFLAGS_save}"])
497
if test "x${ac_cv_c_attribute_aligned}" != "x0"; then
498
499
    AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
        [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
500
501
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
502
503
504
dnl
dnl  Check the CPU
dnl
505
case "x${target_cpu}" in
506
507
508
509
510
511
512
513
514
515
516
517
  x)
    ARCH=unknown
    ;;
  *)
    ARCH="${target_cpu}"
    ;;
esac

case "${ARCH}" in
  hppa64)
    CFLAGS_mpeg_video="${CFLAGS_mpeg_video} -ffunction-sections"
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
518
esac
Sam Hocevar's avatar
   
Sam Hocevar committed
519
520
521
522

dnl
dnl  default modules
dnl
523
PLUGINS="${PLUGINS} dummy rc logger access_file memcpy"
524
525
526
PLUGINS="${PLUGINS} es audio mpeg_system ps ts"
PLUGINS="${PLUGINS} idct idctclassic motion mpeg_video spudec mpeg_audio"
#PLUGINS="${PLUGINS} a52old imdct downmix"
527
PLUGINS="${PLUGINS} lpcm a52"
528
529
530
531
532
533
534
535
536
537
PLUGINS="${PLUGINS} deinterlace invert wall transform distort clone crop motionblur"
PLUGINS="${PLUGINS} float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif fixed32tofloat32 fixed32tos16 s16tofloat32 s16tofloat32swab"
PLUGINS="${PLUGINS} trivial_resampler ugly_resampler"
PLUGINS="${PLUGINS} trivial_channel_mixer"
PLUGINS="${PLUGINS} trivial_mixer spdif_mixer"
PLUGINS="${PLUGINS} aout_file"
#PLUGINS="${PLUGINS} scope"
PLUGINS="${PLUGINS} i420_rgb i420_yuy2 i422_yuy2 i420_ymga"
PLUGINS="${PLUGINS} id3"

538
539
540
dnl
dnl  Network modules
dnl
541
NETWORK_MODULES="access_udp access_http access_rtp ipv4"
542

Sam Hocevar's avatar
   
Sam Hocevar committed
543
544
545
dnl
dnl  Accelerated modules
dnl
546
547
548
549
550
MMX_MODULES="memcpymmx idctmmx motionmmx i420_rgb_mmx i420_yuy2_mmx i422_yuy2_mmx i420_ymga_mmx"
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
SSE_MODULES="imdctsse downmixsse"
ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec"
551

552
if test x${SYS} != xbeos
553
then
554
  PLUGINS="${PLUGINS} ${NETWORK_MODULES}"
555
556
fi

557
558
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
559
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
560
     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
561
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
562
if test "x${ac_cv_mmx_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
563
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
564
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
565

566
567
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
568
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
569
     AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
570
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
571
if test "x${ac_cv_mmxext_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
572
  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
573
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
574

575
576
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
577
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
578
     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
579
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
580
if test "x${ac_cv_3dnow_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
581
  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
582
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
583
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
584

585
586
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
587
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
588
     AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
589
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
590
if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
591
  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
592
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
593
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
594

Sam Hocevar's avatar
Sam Hocevar committed
595
# don't try to grok AltiVec with native mingw32 it doesn't work right now
gbazin's avatar
   
gbazin committed
596
# we should be able to remove this test with future versions of mingw32
597
if test "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
Sam Hocevar committed
598
AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
599
    [ac_cv_altivec_inline],
600
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
601
     AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
602
         ac_cv_altivec_inline=yes,
603
         [CFLAGS="${CFLAGS_save} -Wa,-m7400"
Sam Hocevar's avatar
   
Sam Hocevar committed
604
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
605
            [ac_cv_altivec_inline="-Wa,-m7400"],
606
            ac_cv_altivec_inline=no)
607
         ])])
608
if test "x${ac_cv_altivec_inline}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
609
  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
610
  if test "x${ac_cv_altivec_inline}" != "xyes"; then
611
612
613
614
    CFLAGS_idctaltivec="${CFLAGS_idctaltivec} ${ac_cv_altivec_inline}"
    CFLAGS_motionaltivec="${CFLAGS_motionaltivec} ${ac_cv_altivec_inline}"
    CFLAGS_memcpyaltivec="${CFLAGS_memcpyaltivec} ${ac_cv_altivec_inline}"
    CFLAGS_vlc="${CFLAGS_vlc} ${ac_cv_altivec_inline}"
615
  fi
616
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
617
fi
618

Sam Hocevar's avatar
Sam Hocevar committed
619
AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
620
    [ac_cv_c_altivec],
621
    [CFLAGS="${CFLAGS_save} -faltivec"
622
     # Darwin test
Sam Hocevar's avatar
   
Sam Hocevar committed
623
     AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
624
625
        ac_cv_c_altivec=-faltivec, [
        # Linux/PPC test
626
        CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -fvec"
Sam Hocevar's avatar
   
Sam Hocevar committed
627
        AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
628
629
            [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
        ])
630
     CFLAGS="${CFLAGS_save}"])
631
if test "x${ac_cv_c_altivec}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
632
  AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
633
634
635
636
  CFLAGS_idctaltivec="${CFLAGS_idctaltivec} ${ac_cv_c_altivec}"
  CFLAGS_motionaltivec="${CFLAGS_motionaltivec} ${ac_cv_c_altivec}"
  CFLAGS_memcpyaltivec="${CFLAGS_memcpyaltivec} ${ac_cv_c_altivec}"
  CFLAGS_vlc="${CFLAGS_vlc} ${ac_cv_c_altivec}"
637
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
638
639
640
641
fi

AC_CACHE_CHECK([if linker needs -framework vecLib],
    [ac_cv_ld_altivec],
642
    [LDFLAGS="${LDFLAGS_vlc} -framework vecLib"
643
     AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
644
     LDFLAGS="${LDFLAGS_save}"
645
    ])
646
if test "x${ac_cv_ld_altivec}" != "xno"; then
647
648
649
650
  LDFLAGS_idctaltivec="${LDFLAGS_idctaltivec} -framework vecLib"
  LDFLAGS_motionaltivec="${LDFLAGS_motionaltivec} -framework vecLib"
  LDFLAGS_memcpyaltivec="${LDFLAGS_memcpyaltivec} -framework vecLib"
  LDFLAGS_vlc="${LDFLAGS_vlc} -framework vecLib"
651
fi
gbazin's avatar
   
gbazin committed
652
fi # end if mingw32
653

Sam Hocevar's avatar
   
Sam Hocevar committed
654
655
656
AC_ARG_WITH(,[])
AC_ARG_WITH(,[Optimization options:])

Sam Hocevar's avatar
   
Sam Hocevar committed
657
dnl
658
dnl  Special arch tuning
Sam Hocevar's avatar
   
Sam Hocevar committed
659
dnl
660
AC_ARG_WITH(tuning,
Sam Hocevar's avatar
   
Sam Hocevar committed
661
[  --with-tuning=ARCH      enable special tuning for an architecture
662
                          (default i686 on IA-32 and 750 on PPC)])
663
if test "x${with_tuning}" != "x"; then
664
665
666
667
668
    if test "x${target_cpu}" = "xpowerpc"; then
        CFLAGS_TUNING="-mtune=${with_tuning}"
    else
        CFLAGS_TUNING="-mcpu=${with_tuning}"
    fi
669
else
670
    if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xi486" -o "x${target_cpu}" = "xi386"; then CFLAGS_TUNING="-mcpu=pentiumpro"
671
    else
672
        if test "x${target_cpu}" = "xpowerpc"; then CFLAGS_TUNING="-mtune=750"; fi
673
674
    fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
675
676

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
677
dnl  x86 accelerations
Sam Hocevar's avatar
   
Sam Hocevar committed
678
dnl
679
if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xx86" -o "x${target_cpu}" = "xi386"
Sam Hocevar's avatar
   
Sam Hocevar committed
680
681
then
    ARCH="${ARCH} mmx"
Sam Hocevar's avatar
Sam Hocevar committed
682
    PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
Sam Hocevar's avatar
   
Sam Hocevar committed
683
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
684

Sam Hocevar's avatar
   
Sam Hocevar committed
685
686
687
688
dnl
dnl  Enable/disable optimizations
dnl
AC_ARG_ENABLE(optimizations,
689
690
[  --disable-optimizations disable compiler optimizations (default enabled)])
AM_CONDITIONAL(OPTIM, test "x${enable_optimizations}" != "xno")
Sam Hocevar's avatar
   
Sam Hocevar committed
691

Sam Hocevar's avatar
   
Sam Hocevar committed
692
693
694
dnl
dnl  AltiVec acceleration
dnl
695
AC_ARG_ENABLE(altivec,
Sam Hocevar's avatar
Sam Hocevar committed
696
[  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
697
[ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
698
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
699
[ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
700
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
701
702
703
704

dnl
dnl  Debugging mode
dnl
705
AC_ARG_ENABLE(debug,
706
707
[  --enable-debug          debug mode (default disabled)])
AM_CONDITIONAL(DEBUG, test "x${enable_debug}" = "xyes")
Sam Hocevar's avatar
   
Sam Hocevar committed
708

Sam Hocevar's avatar
   
Sam Hocevar committed
709
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
710
dnl  Enable release-specific flags
Sam Hocevar's avatar
   
Sam Hocevar committed
711
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
712
AC_ARG_ENABLE(release,
713
714
[  --enable-release        activate extra optimizations (default disabled)])
AM_CONDITIONAL(RELEASE, test "x${enable_release}" = "xyes")
Sam Hocevar's avatar
   
Sam Hocevar committed
715

Sam Hocevar's avatar
   
Sam Hocevar committed
716
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
717
dnl  Input plugins
Sam Hocevar's avatar
   
Sam Hocevar committed
718
719
dnl

Sam Hocevar's avatar
   
Sam Hocevar committed
720
AC_ARG_WITH(,[Input plugins:])
Sam Hocevar's avatar
   
Sam Hocevar committed
721
722

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
723
724
725
726
dnl  DVD module: optionally check for installed libdvdcss
dnl
AC_ARG_ENABLE(dvd,
[  --enable-dvd            DVD input module (default enabled)])
727
if test "x${enable_dvd}" != "xno"
Sam Hocevar's avatar
   
Sam Hocevar committed
728
then
729
  AC_ARG_WITH(dvdcss,
Sam Hocevar's avatar
   
Sam Hocevar committed
730
  [    --with-dvdcss=PATH    libdvdcss headers and libraries])
731
  AC_ARG_WITH(dvdcss-tree,
Sam Hocevar's avatar
   
Sam Hocevar committed
732
  [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
733
  case "x${with_dvdcss}" in
Sam Hocevar's avatar
   
Sam Hocevar committed
734
  x|xyes)
735
    if test "x${with_dvdcss_tree}" = x
Sam Hocevar's avatar
   
Sam Hocevar committed
736
737
    then
      AC_CHECK_HEADERS(dvdcss/dvdcss.h,
738
739
        [ PLUGINS="${PLUGINS} dvd"
          LDFLAGS_dvd="${LDFLAGS_dvd} -ldvdcss" ],
Sam Hocevar's avatar
   
Sam Hocevar committed
740
741
742
743
744
        [ AC_MSG_WARN([libdvdcss is no longer provided with vlc; please get libdvdcss from http://www.videolan.org/libdvdcss/ and build it. Then either use --with-dvdcss=<path/where/libdvdcss/was/installed> for dynamic linking (recommended under Unix) or --with-dvdcss-tree=<path/where/libdvdcss/was/built> for static linking (recommended under BeOS, Windows, MacOS X). Alternatively you can use --disable-dvd to disable the DVD plugin.])
          AC_MSG_ERROR([cannot find libdvdcss headers]) ])
    else
      AC_MSG_CHECKING(for libdvdcss.a in ${with_dvdcss_tree})
      real_dvdcss_tree="`cd ${with_dvdcss_tree} 2>/dev/null && pwd`"
745
      if test "x${real_dvdcss_tree}" = "x"
Sam Hocevar's avatar
   
Sam Hocevar committed
746
747
748
749
750
751
752
753
754
      then
        dnl  The given directory can't be found
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot cd to ${with_dvdcss_tree}])
      fi
      if test -f "${real_dvdcss_tree}/src/.libs/libdvdcss.a"
      then
        dnl  Use a custom libdvdcss
        AC_MSG_RESULT(${real_dvdcss_tree}/src/.libs/libdvdcss.a)
755
756
757
        BUILTINS="${BUILTINS} dvd"
        LDFLAGS_dvd="${LDFLAGS_dvd} ${real_dvdcss_tree}/src/.libs/libdvdcss.a"
        CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${real_dvdcss_tree}/src"
Sam Hocevar's avatar
   
Sam Hocevar committed
758
759
760
761
762
763
      else
        dnl  The given libdvdcss wasn't built
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot find ${real_dvdcss_tree}/src/.libs/libdvdcss.a, make sure you compiled libdvdcss in ${with_dvdcss_tree}])
      fi
    fi
Sam Hocevar's avatar
   
Sam Hocevar committed
764
765
  ;;
  xno)
Sam Hocevar's avatar
   
Sam Hocevar committed
766
    dnl  Compile without dvdcss (dlopen version, works only under Linux)
767
768
769
    PLUGINS="${PLUGINS} dvd"
    CPPFLAGS_dvd="${CPPFLAGS_dvd} -DGOD_DAMN_DMCA"
    LDFLAGS_dvd="${LDFLAGS_dvd} -ldl"
Sam Hocevar's avatar
   
Sam Hocevar committed
770
771
  ;;
  *)
Sam Hocevar's avatar
   
Sam Hocevar committed
772
773
    AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
    if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
Sam Hocevar's avatar
   
Sam Hocevar committed
774
    then
Sam Hocevar's avatar
   
Sam Hocevar committed
775
      dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
Sam Hocevar's avatar
   
Sam Hocevar committed
776
      AC_MSG_RESULT(yes)
777
778
779
      PLUGINS="${PLUGINS} dvd"
      LDFLAGS_dvd="${LDFLAGS_dvd} -L${with_dvdcss}/lib -ldvdcss"
      CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${with_dvdcss}/include"
Sam Hocevar's avatar
   
Sam Hocevar committed
780
    else
Sam Hocevar's avatar
   
Sam Hocevar committed
781
      dnl  No libdvdcss could be found, sorry
Sam Hocevar's avatar
   
Sam Hocevar committed
782
      AC_MSG_RESULT(no)
Sam Hocevar's avatar
   
Sam Hocevar committed
783
      AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
Sam Hocevar's avatar
   
Sam Hocevar committed
784
785
786
787
    fi
  ;;
  esac
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
788

Stéphane Borel's avatar
Stéphane Borel committed
789
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
790
dnl dvdread module: check for libdvdread plugin
Stéphane Borel's avatar
Stéphane Borel committed
791
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
792
793
AC_ARG_ENABLE(dvdread,
[  --enable-dvdread        dvdread input module (default disabled)])
794
if test "x${enable_dvdread}" != "xno"
Sam Hocevar's avatar
   
Sam Hocevar committed
795
then
796
  AC_ARG_WITH(dvdread,
Sam Hocevar's avatar
   
Sam Hocevar committed
797
  [    --with-dvdread=PATH   libdvdread headers and libraries])
798
  if test "x${with_dvdread}" = "x"
Sam Hocevar's avatar
   
Sam Hocevar committed
799
  then
800
801
    LDFLAGS_test=""
    CPPFLAGS_test=""
Sam Hocevar's avatar
   
Sam Hocevar committed
802
  else
803
804
    LDFLAGS_test="-L${with_dvdread}/lib"
    CPPFLAGS_test="-I${with_dvdread}/include"
Sam Hocevar's avatar
   
Sam Hocevar committed
805
  fi
806
  CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
Sam Hocevar's avatar
   
Sam Hocevar committed
807
808
  AC_CHECK_HEADERS(dvdread/dvd_reader.h, [
     AC_TRY_COMPILE([#include <dvdread/dvd_reader.h>],
809
        [int foo() { return DVD_VIDEO_LB_LEN; }],[
810
811
812
          PLUGINS="${PLUGINS} dvdread"
          LDFLAGS_dvdread="${LDFLAGS_dvdread} ${LDFLAGS_test} -ldvdread"
          CPPFLAGS_dvdread="${CPPFLAGS_dvdread} ${CPPFLAGS_test}"
Sam Hocevar's avatar
   
Sam Hocevar committed
813
        ],[
814
          if test "x${enable_dvdread}" != "x"
Sam Hocevar's avatar
   
Sam Hocevar committed
815
816
817
818
819
          then
            AC_MSG_ERROR([Cannot find DVD_VIDEO_LB_LEN in dvdread/dvd_reader.h, please install libdvdread version 0.9.2 or later])
          fi
        ])
  ],[
820
    if test "x${enable_dvdread}" != "x"
821
    then
822
      if test "x${with_dvdread}" != "x"
Sam Hocevar's avatar
   
Sam Hocevar committed
823
      then
824
        AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h in ${with_dvdread}/include])
Sam Hocevar's avatar
   
Sam Hocevar committed
825
826
827
      else
        AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h])
      fi
Sam Hocevar's avatar
   
Sam Hocevar committed
828
    fi
Sam Hocevar's avatar
   
Sam Hocevar committed
829
  ])
830
  CPPFLAGS="${CPPFLAGS_save}"
831
832
833
834
835
836
837
fi

dnl
dnl dvdplay module: check for libdvdplay
dnl
AC_ARG_ENABLE(dvdplay,
[  --enable-dvdplay        dvdplay input module (default disabled)])
838
if test "x${enable_dvdplay}" != "xno"
839
then
840
  AC_ARG_WITH(dvdplay,
841
  [    --with-dvdplay=PATH   libdvdplay headers and libraries])
842
  if test "x${with_dvdplay}" = x
843
  then
844
845
    LDFLAGS_test=""
    CPPFLAGS_test=""
846
  else
847
848
    LDFLAGS_test="-L${with_dvdplay}/lib"
    CPPFLAGS_test="-I${with_dvdplay}/include"
849
  fi
850
  CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
851
  AC_CHECK_HEADERS(dvdplay/dvdplay.h, [
852
853
854
      PLUGINS="${PLUGINS} dvdplay"
      LDFLAGS_dvdplay="${LDFLAGS_dvdplay} ${LDFLAGS_test} -ldvdplay -ldvdread"
      CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_test}"
855
    ],[
856
    if test "x${enable_dvdplay}" != x
857
    then
858
      if test "x${with_dvdplay}" != x
859
860
861
862
863
864
865
      then
        AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h in ${with_dvdplay}/include])
      else
        AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h])
      fi
    fi
  ])
866
  CPPFLAGS="${CPPFLAGS_save}"
Sam Hocevar's avatar
   
Sam Hocevar committed
867
fi
Stéphane Borel's avatar
Stéphane Borel committed
868

869

870
871
872
873
874
dnl
dnl  libdvbpsi ts demux
dnl
AC_ARG_ENABLE(dvbpsi,
[  --enable-dvbpsi        dvbpsi ts demux module (default disabled)])
875
if test "x${enable_dvbpsi}" != "xno"
876
then
877
  AC_ARG_WITH(dvbpsi,
878
  [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
879
880
  AC_ARG_WITH(dvbpsi,
  [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
881
  case "x${with_dvbpsi}" in
882
  x|xyes)
883
    if test "x${with_dvbpsi_tree}" = "x"
884
    then
Sam Hocevar's avatar
Sam Hocevar committed
885
      AC_CHECK_HEADERS(dvbpsi/dr.h,
886
887
        [ PLUGINS="${PLUGINS} ts_dvbpsi"
          LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} -ldvbpsi" ], [],
888
889
890
891
        [  AC_MSG_ERROR([cannot find libdvbpsi headers]) ])
    else
      AC_MSG_CHECKING(for libdvbpsi.a in ${with_dvbpsi_tree})
      real_dvbpsi_tree="`cd ${with_dvbpsi_tree} 2>/dev/null && pwd`"
892
      if test "x${real_dvbpsi_tree}" = "x"
893
894
895
896
897
898
899
900
901
      then
        dnl  The given directory can't be found
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot cd to ${with_dvbpsi_tree}])
      fi
      if test -f "${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
      then
        dnl  Use a custom libdvbpsi
        AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
902
903
904
        BUILTINS="${BUILTINS} ts_dvbpsi"
        LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
        CPPFLAGS_ts_dvbpsi="${CPPFLAGS_ts_dvbpsi} -I${real_dvbpsi_tree}/src"
905
906
907
908
909
      else
        dnl  The given libdvbpsi wasn't built
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot find ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a, make sure you compiled libdvbpsi in ${with_dvbpsi_tree}])
      fi
910
    fi
911
912
  ;;
  xno)
913
    dnl  Compile without dvbpsi
914
915
916
  ;;
  *)
    AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
917
    if test "x${with_dvbpsi}" = "x"
918
    then
919
920
      LDFLAGS_test=""
      CPPFLAGS_test=""
921
    else
922
923
      LDFLAGS_test="-L${with_dvbpsi}/lib"
      CPPFLAGS_test="-I${with_dvbpsi}/include"
924
    fi
925
    CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
926
    AC_CHECK_HEADER([dvbpsi/dr.h],[
927
928
929
      PLUGINS="${PLUGINS} ts_dvbpsi"
      LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} ${LDFLAGS_test} -ldvbpsi"
      CPPFLAGS_ts_dvbpsi="${CPPFLAGS_ts_dvbpsi} ${CPPFLAGS_test}"
930
      ],[
931
      if test "x${enable_dvbpsi}" != "x"
932
933
934
935
      then
        AC_MSG_ERROR([Could not find libdvbpsi on your system: you may get it from www.videolan.org, you'll need at least version 0.1.1])
      fi
    ])
936
    CPPFLAGS="${CPPFLAGS_save}"
937
938
  ;;
  esac
939
fi
940

941
942
943
944
945
946
947
948
dnl
dnl  Video4Linux plugin
dnl
AC_ARG_ENABLE(v4l,
  [  --enable-v4l            Video4Linux input support (default disabled)])
if test "x${enable_v4l}" = "xyes"
then
  AC_CHECK_HEADERS(libv4l/v4l.h, [
949
    PLUGINS="${PLUGINS} v4l"
950
951
952
   ],[])
fi

953
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
954
dnl  VCD module
955
956
dnl
AC_ARG_ENABLE(vcd,
957
  [  --enable-vcd            VCD support for Linux, FreeBSD and MacOS X (default enabled)])
958

959
if test "x${enable_vcd}" != "xno"