configure.ac.in 71.5 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

52
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
53
dnl Gettext stuff
54
dnl
55
ALL_LINGUAS="de en_GB fr ja no ru nl pl se"
56
AM_GNU_GETTEXT_VERSION(0.10.40)
Sam Hocevar's avatar
   
Sam Hocevar committed
57
AM_GNU_GETTEXT
58
59
60
61
62
if test "${nls_cv_force_use_gnu_gettext}" = "yes"; then
  AC_DEFINE(HAVE_INCLUDED_GETTEXT, 1, Define if we use the local libintl)
  INCLUDES="${INCLUDES} -I\\\$(top_srcdir)/intl"
fi
AM_CONDITIONAL(BUILD_INTL, test "${nls_cv_force_use_gnu_gettext}" = "yes")
Sam Hocevar's avatar
   
Sam Hocevar committed
63

64
65
66
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL

67
68
69
70
dnl Check for compiler properties
AC_C_CONST
AC_C_INLINE

Sam Hocevar's avatar
Sam Hocevar committed
71
dnl
72
dnl  Set default values
Sam Hocevar's avatar
Sam Hocevar committed
73
dnl
74
75
LDFLAGS_vlc="${LDFLAGS}"
LIBEXT=".so"
Sam Hocevar's avatar
Sam Hocevar committed
76

gbazin's avatar
   
gbazin committed
77
78
79
dnl
dnl  Check the operating system
dnl
80
case "x${target_os}" in
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
  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
105
  x*mingw32* | x*cygwin*)
106
107
    AC_CHECK_TOOL(WINDRES, windres, :)
    LIBEXT=".dll"
gbazin's avatar
   
gbazin committed
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

    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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
    ;;
  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"
152
    LDFLAGS_beos="${LDFLAGS_beos} -lbe -lmedia -lroot -ltracker -lstdc++.r4 -ltranslation"
153
154
155
156
157
    LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind"
    ;;
  x*)
    SYS="${target_os}"
    ;;
gbazin's avatar
   
gbazin committed
158
esac
159
160
161
162
163
164
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
165

gbazin's avatar
   
gbazin committed
166
167
168
169
170
dnl Check for the need to include the mingwex lib for mingw32
if test x$SYS = xmingw32
then
    AC_CHECK_LIB(mingwex,opendir,
        AC_CHECK_LIB(mingw32,opendir,LDFLAGS_vlc="${LDFLAGS_vlc}",
gbazin's avatar
   
gbazin committed
171
172
            [LDFLAGS_vlc="${LDFLAGS_vlc} -lmingwex"
             LDFLAGS_gtk="${LDFLAGS_gtk} -lmingwex"])
gbazin's avatar
   
gbazin committed
173
174
175
    )
fi

gbazin's avatar
   
gbazin committed
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
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
192
dnl Flags for plugin compilation
193
194
case "x${SYS}" in
  xmingw32|xcygwin)
gbazin's avatar
   
gbazin committed
195
196
197
198
199
200
    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}"
201
202
203
204
205
206
207
208
209
210
211
    ;;
  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
212
213

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

216
dnl Check for system libs needed
217
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
218

Sam Hocevar's avatar
   
Sam Hocevar committed
219
AC_CHECK_FUNC(connect,,[
220
221
222
  AC_CHECK_LIB(socket,connect,
    LDFLAGS_ipv4="${LDFLAGS_ipv4} -lsocket"
    LDFLAGS_vlc="${LDFLAGS_vlc} -lsocket"
Sam Hocevar's avatar
   
Sam Hocevar committed
223
)])
224

Sam Hocevar's avatar
Sam Hocevar committed
225
AC_CHECK_FUNC(send,,[
226
227
  AC_CHECK_LIB(socket,send,
    LDFLAGS_http="${LDFLAGS_http} -lsocket"
Sam Hocevar's avatar
Sam Hocevar committed
228
)])
229

Sam Hocevar's avatar
   
Sam Hocevar committed
230
AC_CHECK_FUNC(gethostbyname,,[
231
232
  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
233
])
234
235
236

have_nanosleep=false
AC_CHECK_FUNC(nanosleep,have_nanosleep=:,[
237
  AC_CHECK_LIB(rt,nanosleep,
238
    [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"; have_nanosleep=:],
239
    [AC_CHECK_LIB(posix4,nanosleep,
240
        [LDFLAGS_vlc="${LDFLAGS_vlc} -lposix4"; have_nanosleep=:])]
241
  )
Sam Hocevar's avatar
   
Sam Hocevar committed
242
])
243
244
245
if ${have_nanosleep}; then
  AC_DEFINE(HAVE_NANOSLEEP, 1,
            Define if nanosleep is available.)
246
fi
247
# HP/UX port
248
AC_CHECK_LIB(rt,sem_init, [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"])
249

Sam Hocevar's avatar
   
Sam Hocevar committed
250
AC_CHECK_FUNC(inet_aton,,[
251
  AC_CHECK_LIB(resolv,inet_aton,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lresolv")
252
253
])
AC_CHECK_FUNC(textdomain,,[
254
255
256
257
  AC_CHECK_LIB(intl,textdomain,
    LDFLAGS_vlc="${LDFLAGS_vlc} -lintl"
    LDFLAGS_plugins="${LDFLAGS_plugins} -lintl"
  )
Sam Hocevar's avatar
   
Sam Hocevar committed
258
])
Sam Hocevar's avatar
   
Sam Hocevar committed
259

Sam Hocevar's avatar
   
Sam Hocevar committed
260
dnl Check for getopt
261
need_getopt=false
Sam Hocevar's avatar
   
Sam Hocevar committed
262
263
AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
[ # FreeBSD has a gnugetopt library for this:
264
265
266
267
  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
268

269
AC_TYPE_SIGNAL
270
AC_CHECK_LIB(dl,dlopen,LDFLAGS_vlc="${LDFLAGS_vlc} -ldl")
Sam Hocevar's avatar
   
Sam Hocevar committed
271
AC_CHECK_LIB(m,cos,
272
273
  LDFLAGS_imdct="${LDFLAGS_imdct} -lm"
  LDFLAGS_filter_distort="${LDFLAGS_filter_distort} -lm")
Sam Hocevar's avatar
   
Sam Hocevar committed
274
AC_CHECK_LIB(m,pow,
275
276
277
278
279
280
  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
281
)
Sam Hocevar's avatar
   
Sam Hocevar committed
282

Sam Hocevar's avatar
   
Sam Hocevar committed
283
dnl Check for pthreads - borrowed from XMMS
Sam Hocevar's avatar
   
Sam Hocevar committed
284
THREAD_LIB=error
285
if test "x${THREAD_LIB}" = "xerror"; then
286
  AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
Sam Hocevar's avatar
   
Sam Hocevar committed
287
fi
288
if test "x${THREAD_LIB}" = "xerror"; then
289
  AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
Sam Hocevar's avatar
   
Sam Hocevar committed
290
fi
291
if test "x${THREAD_LIB}" = "xerror"; then
292
  AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
Sam Hocevar's avatar
   
Sam Hocevar committed
293
fi
294
if test "x${THREAD_LIB}" = "xerror"; then
295
296
  AC_CHECK_FUNC(pthread_mutex_lock)
  THREAD_LIB=""
Sam Hocevar's avatar
   
Sam Hocevar committed
297
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
298
299
300

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

Sam Hocevar's avatar
   
Sam Hocevar committed
302
303
dnl Check for misc headers
AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
304
305
  AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
            Define if <pthread.h> defines pthread_cond_t.)])
Sam Hocevar's avatar
Sam Hocevar committed
306
AC_EGREP_HEADER(pthread_once,pthread.h,[
307
308
  AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
            Define if <pthread.h> defines pthread_once.)])
Sam Hocevar's avatar
   
Sam Hocevar committed
309
AC_EGREP_HEADER(strncasecmp,strings.h,[
310
311
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
            Define if <strings.h> defines strncasecmp.)])
Sam Hocevar's avatar
   
Sam Hocevar committed
312

Sam Hocevar's avatar
   
Sam Hocevar committed
313
dnl Check for headers
Sam Hocevar's avatar
Sam Hocevar committed
314
AC_CHECK_HEADERS(stdint.h getopt.h strings.h inttypes.h sys/int_types.h)
gbazin's avatar
   
gbazin committed
315
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h sys/ioctl.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
316
317
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
318
AC_CHECK_HEADERS(machine/param.h sys/shm.h)
319
AC_CHECK_HEADERS(linux/version.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
320

Sam Hocevar's avatar
   
Sam Hocevar committed
321
322
AC_HEADER_TIME

323
dnl Mac OS X and other OSes don't have declaration for nanosleep
324
AC_EGREP_HEADER(nanosleep,time.h,[
325
326
  AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
            Define if <time.h> defines nanosleep.)
327
])
328
329

dnl Make sure we have timespecs
330
AC_EGREP_HEADER(timespec,sys/time.h,[
331
332
  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
            Define if <sys/time.h> defines struct timespec.)
333
])
334

Sam Hocevar's avatar
   
Sam Hocevar committed
335
336
337
dnl Check for threads library
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)

338
339
dnl Default X headers and libraries
if test "x${x_includes}" = "xNONE"; then
340
  x_includes="/usr/X11R6/include"
341
342
fi
if test "x${x_libraries}" = "xNONE"; then
343
  x_libraries="/usr/X11R6/lib"
344
345
fi

346
dnl Build the gtk_main plugins?
347
NEED_GTK_MAIN=no
348
NEED_GNOME_MAIN=no
349

Sam Hocevar's avatar
   
Sam Hocevar committed
350
dnl Check for DPMS
351
if test "x${SYS}" != "xmingw32"
Sam Hocevar's avatar
   
Sam Hocevar committed
352
then
353
354
355
356
357
358
359
360
  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
361
362
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
363
dnl Check for ntohl, etc.
364
AC_CACHE_CHECK([for ntohl in sys/param.h],
365
366
367
368
369
    [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)])
370
if test "x${ac_cv_c_ntohl_sys_param_h}" != "xno"; then
371
    AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
372
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
373

Sam Hocevar's avatar
   
Sam Hocevar committed
374
dnl Check for inline function size limit
375
AC_CACHE_CHECK([if \$CC accepts -finline-limit],
376
377
378
    [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)])
379
if test "x${ac_cv_c_inline_limit}" != "xno"; then
380
381
382
    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}"
383
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
384

Sam Hocevar's avatar
   
Sam Hocevar committed
385
386
dnl Check for -W or -w flags
AC_CACHE_CHECK([if \$CC accepts -Wall -Winline],
387
388
389
    [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)])
390
if test "x${ac_cv_c_Wall_Winline}" != "xno"; then
391
392
393
    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
394
else
395
396
397
398
399
400
401
402
403
    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
404
405
406
407
fi

dnl Check for -pipe
AC_CACHE_CHECK([if \$CC accepts -pipe],
408
409
410
    [ac_cv_c_pipe],
    [CFLAGS="${CFLAGS_save} -pipe"
     AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
411
if test "x${ac_cv_c_pipe}" != "xno"; then
412
413
414
    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
415
416
417
418
fi

dnl Check for various optimization flags
AC_CACHE_CHECK([if \$CC accepts -O3],
419
420
421
    [ac_cv_c_o3],
    [CFLAGS="${CFLAGS_save} -O3"
     AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
422
if test "x${ac_cv_c_o3}" != "xno"; then
423
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
424
else
425
426
427
428
429
430
431
432
433
434
435
436
437
438
    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
439
440
441
442
443
    fi
fi

dnl Check for -ffast-math
AC_CACHE_CHECK([if \$CC accepts -ffast-math],
444
445
446
    [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)])
447
if test "x${ac_cv_c_fast_math}" != "xno"; then
448
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
Sam Hocevar's avatar
   
Sam Hocevar committed
449
450
451
452
fi

dnl Check for -funroll-loops
AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
453
454
455
    [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)])
456
if test "x${ac_cv_c_unroll_loops}" != "xno"; then
457
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
Sam Hocevar's avatar
   
Sam Hocevar committed
458
459
460
461
fi

dnl Check for -fomit-frame-pointer
AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
462
463
464
    [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)])
465
if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
466
467
468
    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
469
470
fi

471
472
473
474
475
476
477
478
479
dnl Check for -mdynamic-no-pic
AC_CACHE_CHECK([if \$CC accepts -mdynamic-no-pic],
    [ac_cv_c_dynamic_no_pic],
    [CFLAGS="${CFLAGS_save} -mdynamic-no-pic"
     AC_TRY_COMPILE([],,ac_cv_c_dynamic_no_pic=yes, ac_cv_c_dynamic_no_pic=no)])
if test "x${ac_cv_c_dynamic_no_pic}" != "xno"; then
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -mdynamic-no-pic"
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
480
dnl Check for Darwin plugin linking flags
Christophe Massiot's avatar
Christophe Massiot committed
481
AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
482
483
484
    [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)])
485
if test "x${ac_cv_ld_darwin}" != "xno"; then
486
    LDFLAGS_plugins="${LDFLAGS_plugins} -bundle -undefined error -lcc_dynamic"
487
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
488
489

dnl Check for standard plugin linking flags
490
AC_CACHE_CHECK([if \$CC accepts -shared],
491
492
493
    [ac_cv_ld_plugins],
    [CFLAGS="${CFLAGS_save} -shared"
     AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
494
if test "x${ac_cv_ld_plugins}" != "xno"; then
495
    LDFLAGS_plugins="${LDFLAGS_plugins} -shared"
Sam Hocevar's avatar
   
Sam Hocevar committed
496
fi
497

498
499
dnl Check for variadic macros
AC_CACHE_CHECK([for variadic cpp macros],
500
501
502
503
504
505
506
507
    [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)])
508
if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
509
    AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
510
511
fi

512
513
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
514
515
516
517
518
519
520
521
522
    [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}"])
523
if test "x${ac_cv_c_attribute_aligned}" != "x0"; then
524
525
    AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
        [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
526
527
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
528
529
530
dnl
dnl  Check the CPU
dnl
531
case "x${target_cpu}" in
532
533
534
535
536
537
538
539
540
541
542
543
  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
544
esac
Sam Hocevar's avatar
   
Sam Hocevar committed
545
546
547
548

dnl
dnl  default modules
dnl
549
PLUGINS="${PLUGINS} dummy rc logger access_file memcpy"
550
551
552
PLUGINS="${PLUGINS} es audio mpeg_system ps ts"
PLUGINS="${PLUGINS} idct idctclassic motion mpeg_video spudec mpeg_audio"
#PLUGINS="${PLUGINS} a52old imdct downmix"
553
PLUGINS="${PLUGINS} lpcm a52"
554
PLUGINS="${PLUGINS} deinterlace invert yuv wall transform distort clone crop motionblur"
555
556
557
558
559
560
561
562
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"
563
PLUGINS="${PLUGINS} wav araw"
564

565
566
567
dnl
dnl  Network modules
dnl
568
NETWORK_MODULES="access_udp access_http access_rtp ipv4"
569

Sam Hocevar's avatar
   
Sam Hocevar committed
570
571
572
dnl
dnl  Accelerated modules
dnl
573
574
575
576
577
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"
578

579
if test x${SYS} != xbeos
580
then
581
  PLUGINS="${PLUGINS} ${NETWORK_MODULES}"
582
583
fi

584
585
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
586
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
587
     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
588
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
589
if test "x${ac_cv_mmx_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
590
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
591
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
592

593
594
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
595
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
596
     AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
597
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
598
if test "x${ac_cv_mmxext_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
599
  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
600
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
601

602
603
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
604
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
605
     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
606
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
607
if test "x${ac_cv_3dnow_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
608
  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
609
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
610
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
611

612
613
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
614
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
615
     AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
616
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
617
if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
618
  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
619
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
620
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
621

Sam Hocevar's avatar
Sam Hocevar committed
622
# don't try to grok AltiVec with native mingw32 it doesn't work right now
gbazin's avatar
   
gbazin committed
623
# we should be able to remove this test with future versions of mingw32
624
if test "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
Sam Hocevar committed
625
AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
626
    [ac_cv_altivec_inline],
627
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
628
     AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
629
         ac_cv_altivec_inline=yes,
630
         [CFLAGS="${CFLAGS_save} -Wa,-m7400"
Sam Hocevar's avatar
   
Sam Hocevar committed
631
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
632
            [ac_cv_altivec_inline="-Wa,-m7400"],
633
            ac_cv_altivec_inline=no)
634
         ])])
635
if test "x${ac_cv_altivec_inline}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
636
  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
637
  if test "x${ac_cv_altivec_inline}" != "xyes"; then
638
639
640
641
    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}"
642
  fi
643
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
644
fi
645

Sam Hocevar's avatar
Sam Hocevar committed
646
AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
647
    [ac_cv_c_altivec],
648
    [CFLAGS="${CFLAGS_save} -faltivec"
649
     # Darwin test
Sam Hocevar's avatar
   
Sam Hocevar committed
650
     AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
651
652
        ac_cv_c_altivec=-faltivec, [
        # Linux/PPC test
653
        CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -fvec"
Sam Hocevar's avatar
   
Sam Hocevar committed
654
        AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
655
656
            [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
        ])
657
     CFLAGS="${CFLAGS_save}"])
658
if test "x${ac_cv_c_altivec}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
659
  AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
660
661
662
663
  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}"
664
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
665
666
667
668
fi

AC_CACHE_CHECK([if linker needs -framework vecLib],
    [ac_cv_ld_altivec],
669
    [LDFLAGS="${LDFLAGS_vlc} -framework vecLib"
670
     AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
671
     LDFLAGS="${LDFLAGS_save}"
672
    ])
673
if test "x${ac_cv_ld_altivec}" != "xno"; then
674
675
676
677
  LDFLAGS_idctaltivec="${LDFLAGS_idctaltivec} -framework vecLib"
  LDFLAGS_motionaltivec="${LDFLAGS_motionaltivec} -framework vecLib"
  LDFLAGS_memcpyaltivec="${LDFLAGS_memcpyaltivec} -framework vecLib"
  LDFLAGS_vlc="${LDFLAGS_vlc} -framework vecLib"
678
fi
gbazin's avatar
   
gbazin committed
679
fi # end if mingw32
680

Sam Hocevar's avatar
   
Sam Hocevar committed
681
682
683
AC_ARG_WITH(,[])
AC_ARG_WITH(,[Optimization options:])

Sam Hocevar's avatar
   
Sam Hocevar committed
684
dnl
685
dnl  Special arch tuning
Sam Hocevar's avatar
   
Sam Hocevar committed
686
dnl
687
AC_ARG_WITH(tuning,
Sam Hocevar's avatar
   
Sam Hocevar committed
688
[  --with-tuning=ARCH      enable special tuning for an architecture
689
                          (default i686 on IA-32 and 750 on PPC)])
690
if test "x${with_tuning}" != "x"; then
691
692
693
694
695
    if test "x${target_cpu}" = "xpowerpc"; then
        CFLAGS_TUNING="-mtune=${with_tuning}"
    else
        CFLAGS_TUNING="-mcpu=${with_tuning}"
    fi
696
else
697
    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"
698
    else
699
        if test "x${target_cpu}" = "xpowerpc"; then CFLAGS_TUNING="-mtune=750"; fi
700
701
    fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
702
703

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
704
dnl  x86 accelerations
Sam Hocevar's avatar
   
Sam Hocevar committed
705
dnl
706
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
707
708
then
    ARCH="${ARCH} mmx"
Sam Hocevar's avatar
Sam Hocevar committed
709
    PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
Sam Hocevar's avatar
   
Sam Hocevar committed
710
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
711

Sam Hocevar's avatar
   
Sam Hocevar committed
712
713
714
715
dnl
dnl  Enable/disable optimizations
dnl
AC_ARG_ENABLE(optimizations,
716
717
[  --disable-optimizations disable compiler optimizations (default enabled)])
AM_CONDITIONAL(OPTIM, test "x${enable_optimizations}" != "xno")
Sam Hocevar's avatar
   
Sam Hocevar committed
718

Sam Hocevar's avatar
   
Sam Hocevar committed
719
720
721
dnl
dnl  AltiVec acceleration
dnl
722
AC_ARG_ENABLE(altivec,
Sam Hocevar's avatar
Sam Hocevar committed
723
[  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
724
[ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
725
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
726
[ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
727
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
728
729
730
731

dnl
dnl  Debugging mode
dnl
732
AC_ARG_ENABLE(debug,
733
734
[  --enable-debug          debug mode (default disabled)])
AM_CONDITIONAL(DEBUG, test "x${enable_debug}" = "xyes")
Sam Hocevar's avatar
   
Sam Hocevar committed
735

Sam Hocevar's avatar
   
Sam Hocevar committed
736
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
737
dnl  Enable release-specific flags
Sam Hocevar's avatar
   
Sam Hocevar committed
738
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
739
AC_ARG_ENABLE(release,
740
741
[  --enable-release        activate extra optimizations (default disabled)])
AM_CONDITIONAL(RELEASE, test "x${enable_release}" = "xyes")
Sam Hocevar's avatar
   
Sam Hocevar committed
742

Sam Hocevar's avatar
   
Sam Hocevar committed
743
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
744
dnl  Input plugins
Sam Hocevar's avatar
   
Sam Hocevar committed
745
746
dnl

Sam Hocevar's avatar
   
Sam Hocevar committed
747
AC_ARG_WITH(,[Input plugins:])
Sam Hocevar's avatar
   
Sam Hocevar committed
748
749

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
750
751
752
753
dnl  DVD module: optionally check for installed libdvdcss
dnl
AC_ARG_ENABLE(dvd,
[  --enable-dvd            DVD input module (default enabled)])
754
if test "x${enable_dvd}" != "xno"
Sam Hocevar's avatar
   
Sam Hocevar committed
755
then
756
  AC_ARG_WITH(dvdcss,
Sam Hocevar's avatar
   
Sam Hocevar committed
757
  [    --with-dvdcss=PATH    libdvdcss headers and libraries])
758
  AC_ARG_WITH(dvdcss-tree,
Sam Hocevar's avatar
   
Sam Hocevar committed
759
  [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
760
  case "x${with_dvdcss}" in
Sam Hocevar's avatar
   
Sam Hocevar committed
761
  x|xyes)
762
    if test "x${with_dvdcss_tree}" = x
Sam Hocevar's avatar
   
Sam Hocevar committed
763
764
    then
      AC_CHECK_HEADERS(dvdcss/dvdcss.h,
765
766
        [ PLUGINS="${PLUGINS} dvd"
          LDFLAGS_dvd="${LDFLAGS_dvd} -ldvdcss" ],
Sam Hocevar's avatar
   
Sam Hocevar committed
767
768
769
770
771
        [ 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`"
772
      if test "x${real_dvdcss_tree}" = "x"
Sam Hocevar's avatar
   
Sam Hocevar committed
773
774
775
776
777
778
779
780
781
      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)
782
783
784
        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
785
786
787
788
789
790
      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
791
792
  ;;
  xno)
Sam Hocevar's avatar
   
Sam Hocevar committed
793
    dnl  Compile without dvdcss (dlopen version, works only under Linux)
794
795
796
    PLUGINS="${PLUGINS} dvd"
    CPPFLAGS_dvd="${CPPFLAGS_dvd} -DGOD_DAMN_DMCA"
    LDFLAGS_dvd="${LDFLAGS_dvd} -ldl"
Sam Hocevar's avatar
   
Sam Hocevar committed
797
798
  ;;
  *)
Sam Hocevar's avatar
   
Sam Hocevar committed
799
800
    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
801
    then
Sam Hocevar's avatar
   
Sam Hocevar committed
802
      dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
Sam Hocevar's avatar
   
Sam Hocevar committed
803
      AC_MSG_RESULT(yes)
804
805
806
      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
807
    else
Sam Hocevar's avatar
   
Sam Hocevar committed
808
      dnl  No libdvdcss could be found, sorry
Sam Hocevar's avatar
   
Sam Hocevar committed
809
      AC_MSG_RESULT(no)
Sam Hocevar's avatar
   
Sam Hocevar committed
810
      AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
Sam Hocevar's avatar
   
Sam Hocevar committed
811
812
813
814
    fi
  ;;
  esac
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
815

Stéphane Borel's avatar
Stéphane Borel committed
816
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
817
dnl dvdread module: check for libdvdread plugin
Stéphane Borel's avatar
Stéphane Borel committed
818
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
819
820
AC_ARG_ENABLE(dvdread,
[  --enable-dvdread        dvdread input module (default disabled)])
821
if test "x${enable_dvdread}" != "xno"
Sam Hocevar's avatar
   
Sam Hocevar committed
822
then
823
  AC_ARG_WITH(dvdread,
Sam Hocevar's avatar
   
Sam Hocevar committed
824
  [    --with-dvdread=PATH   libdvdread headers and libraries])
825
  if test "x${with_dvdread}" = "x"
Sam Hocevar's avatar
   
Sam Hocevar committed
826
  then
827
828
    LDFLAGS_test=""
    CPPFLAGS_test=""
Sam Hocevar's avatar
   
Sam Hocevar committed
829
  else
830
831
    LDFLAGS_test="-L${with_dvdread}/lib"
    CPPFLAGS_test="-I${with_dvdread}/include"
Sam Hocevar's avatar
   
Sam Hocevar committed
832
  fi
833
  CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
Sam Hocevar's avatar
   
Sam Hocevar committed
834
835
  AC_CHECK_HEADERS(dvdread/dvd_reader.h, [
     AC_TRY_COMPILE([#include <dvdread/dvd_reader.h>],
836
        [int foo() { return DVD_VIDEO_LB_LEN; }],[
837
838
839
          PLUGINS="${PLUGINS} dvdread"
          LDFLAGS_dvdread="${LDFLAGS_dvdread} ${LDFLAGS_test} -ldvdread"
          CPPFLAGS_dvdread="${CPPFLAGS_dvdread} ${CPPFLAGS_test}"
Sam Hocevar's avatar
   
Sam Hocevar committed
840
        ],[
841
          if test "x${enable_dvdread}" != "x"
Sam Hocevar's avatar
   
Sam Hocevar committed
842
843
844
845
846
          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
        ])
  ],[
847
    if test "x${enable_dvdread}" != "x"
848
    then
849
      if test "x${with_dvdread}" != "x"
Sam Hocevar's avatar
   
Sam Hocevar committed
850
      then
851
        AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h in ${with_dvdread}/include])
Sam Hocevar's avatar
   
Sam Hocevar committed
852
853
854
      else
        AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h])
      fi
Sam Hocevar's avatar
   
Sam Hocevar committed
855
    fi
Sam Hocevar's avatar
   
Sam Hocevar committed
856
  ])
857
  CPPFLAGS="${CPPFLAGS_save}"
858
859
860
861
862
863
864
fi

dnl
dnl dvdplay module: check for libdvdplay
dnl
AC_ARG_ENABLE(dvdplay,
[  --enable-dvdplay        dvdplay input module (default disabled)])
865
if test "x${enable_dvdplay}" != "xno"
866
then
867
  AC_ARG_WITH(dvdplay,
868
  [    --with-dvdplay=PATH   libdvdplay headers and libraries])
869
  if test "x${with_dvdplay}" = x
870
  then
871
872
    LDFLAGS_test=""
    CPPFLAGS_test=""
873
  else
874
875
    LDFLAGS_test="-L${with_dvdplay}/lib"
    CPPFLAGS_test="-I${with_dvdplay}/include"
876
  fi
877
  CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
878
  AC_CHECK_HEADERS(dvdplay/dvdplay.h, [
879
880
881
      PLUGINS="${PLUGINS} dvdplay"
      LDFLAGS_dvdplay="${LDFLAGS_dvdplay} ${LDFLAGS_test} -ldvdplay -ldvdread"
      CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_test}"
882
    ],[
883
    if test "x${enable_dvdplay}" != x
884
    then
885
      if test "x${with_dvdplay}" != x
886
887
888
889
890
891
892
      then
        AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h in ${with_dvdplay}/include])
      else
        AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h])
      fi
    fi
  ])
893
  CPPFLAGS="${CPPFLAGS_save}"
Sam Hocevar's avatar
   
Sam Hocevar committed
894
fi
Stéphane Borel's avatar
Stéphane Borel committed
895

896

897
898
899
900
901
dnl
dnl  libdvbpsi ts demux
dnl
AC_ARG_ENABLE(dvbpsi,
[  --enable-dvbpsi        dvbpsi ts demux module (default disabled)])
902
if test "x${enable_dvbpsi}" != "xno"
903
then
904
  AC_ARG_WITH(dvbpsi,
905
  [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
906
907
  AC_ARG_WITH(dvbpsi,
  [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
908
  case "x${with_dvbpsi}" in
909
  x|xyes)
910
    if test "x${with_dvbpsi_tree}" = "x"
911
    then
Sam Hocevar's avatar
Sam Hocevar committed
912
      AC_CHECK_HEADERS(dvbpsi/dr.h,
913
914
        [ PLUGINS="${PLUGINS} ts_dvbpsi"
          LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} -ldvbpsi" ], [],
915
916
917
918
        [  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`"
919
      if test "x${real_dvbpsi_tree}" = "x"
920
921
922
923
924
925
926
927
928
      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)
929
930
931
        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"
932
933
934
935
936
      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
937
    fi
938
939
  ;;
  xno)
940
    dnl  Compile without dvbpsi
941
942
943
  ;;
  *)
    AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
944
    if test "x${with_dvbpsi}" = "x"
945
    then
946
947
      LDFLAGS_test=""
      CPPFLAGS_test=""
948
    else
949
950
      LDFLAGS_test="-L${with_dvbpsi}/lib"
      CPPFLAGS_test="-I${with_dvbpsi}/include"
951
    fi
952
    CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
953
    AC_CHECK_HEADER([dvbpsi/dr.h],[
954
955
956
      PLUGINS="${PLUGINS} ts_dvbpsi"
      LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} ${LDFLAGS_test} -ldvbpsi"
      CPPFLAGS_ts_dvbpsi="${CPPFLAGS_ts_dvbpsi} ${CPPFLAGS_test}"
957
      ],[
958
      if test "x${enable_dvbpsi}" != "x"
959
960
961
962
      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
    ])
963
    CPPFLAGS="${CPPFLAGS_save}"
964
965
  ;;
  esac
966
fi
967

968
969
970
971
972
973
974
975
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, [
976
    PLUGINS="${PLUGINS} v4l"
977
978
979