configure.ac.in 90.8 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)
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)
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
AC_PROG_EGREP
36

37
38
39
40
41
42
43
44
45
46
47
48
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
49
50
dnl Find the right ranlib, even when cross-compiling
AC_CHECK_TOOL(RANLIB, ranlib, :)
Sam Hocevar's avatar
   
Sam Hocevar committed
51
AC_CHECK_TOOL(STRIP, strip, :)
Jean-Paul Saman's avatar
Jean-Paul Saman committed
52
53
AC_CHECK_TOOL(AR, ar, :)
AC_CHECK_TOOL(LD, ld, :)
gbazin's avatar
   
gbazin committed
54

55
56
57
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL

58
59
60
61
dnl Check for compiler properties
AC_C_CONST
AC_C_INLINE

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

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

    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
117
        # add ws2_32 for closesocket, select, recv
gbazin's avatar
   
gbazin committed
118
119
120
121
122
        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"
gbazin's avatar
   
gbazin committed
123
124
125
126
        LDFLAGS_access_http="${LDFLAGS_access_http} -lws2_32"
        LDFLAGS_access_mms="${LDFLAGS_access_mms} -lws2_32"
        LDFLAGS_access_rtp="${LDFLAGS_access_rtp} -lws2_32"
        LDFLAGS_access_udp="${LDFLAGS_access_udp} -lws2_32"
127
        LDFLAGS_access_ftp="${LDFLAGS_access_ftp} -lws2_32"
128
        LDFLAGS_access_output_udp="${LDFLAGS_access_output_udp} -lws2_32"
gbazin's avatar
   
gbazin committed
129
        LDFLAGS_rc="${LDFLAGS_rc} -lws2_32"
130
        LDFLAGS_sap="${LDFLAGS_sap} -lws2_32"
gbazin's avatar
   
gbazin committed
131
    fi
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
    ;;
  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"
151
    LDFLAGS_beos="${LDFLAGS_beos} -lbe -lmedia -lroot -ltracker -lstdc++.r4 -ltranslation"
152
153
154
155
156
    dnl BONE or not BONE ?
    AC_CHECK_LIB( bind, inet_ntoa,
        [ LDFLAGS_access_mms="${LDFLAGS_access_mms} -lbind"
          LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind"],
        [])
157
158
159
160
    ;;
  x*)
    SYS="${target_os}"
    ;;
gbazin's avatar
   
gbazin committed
161
esac
162
163
164
165
AM_CONDITIONAL(HAVE_BEOS, test "x${SYS}" = "xbeos")
AM_CONDITIONAL(HAVE_DARWIN, test "x${SYS}" = "xdarwin")
AM_CONDITIONAL(HAVE_WIN32, test "x${SYS}" = "xmingw32")

166
167
168
169
170
171
172
173
174
175
176
177
178
dnl
dnl Gettext stuff
dnl
ALL_LINGUAS="de en_GB fr it ja no ru nl pl se"
AM_GNU_GETTEXT_VERSION(0.10.40)
AM_GNU_GETTEXT
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")
XGETTEXT="${XGETTEXT} --keyword=_NS"

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

gbazin's avatar
   
gbazin committed
182
183
184
185
186
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
187
188
            [LDFLAGS_vlc="${LDFLAGS_vlc} -lmingwex"
             LDFLAGS_gtk="${LDFLAGS_gtk} -lmingwex"])
gbazin's avatar
   
gbazin committed
189
190
191
    )
fi

gbazin's avatar
   
gbazin committed
192
193
194
195
196
197
198
199
200
201
202
203
204
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

gbazin's avatar
   
gbazin committed
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
    CFLAGS_save="${CFLAGS_save} ${CFLAGS_mingw32_special}";
    CXXFLAGS_save="${CXXFLAGS_save} ${CFLAGS_mingw32_special}";
    CFLAGS="${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
fi

dnl Check for fvtable-thunks support for mingw32
if test x$SYS = xmingw32
then
AC_LANG_PUSH(C++)
    AC_CACHE_CHECK([if \$CXX accepts -fvtable-thunks],
        [ac_cv_cxx_fvtable_thunks],
        [CXXFLAGS="${CXXFLAGS_save} -Wall -Werror -fvtable-thunks"
         AC_TRY_COMPILE([],,ac_cv_cxx_fvtable_thunks=yes,
                        ac_cv_cxx_fvtable_thunks=no)])
    if test x"$ac_cv_cxx_fvtable_thunks" = x"yes"; then
        CXXFLAGS_mingw32_special="-fvtable-thunks"
    fi

    CXXFLAGS_save="${CXXFLAGS_save} ${CXXFLAGS_mingw32_special}"
    CXXFLAGS="${CXXFLAGS_save}"
AC_LANG_POP(C++)
gbazin's avatar
   
gbazin committed
226
227
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
228
dnl Flags for plugin compilation
229
230
case "x${SYS}" in
  xmingw32|xcygwin)
gbazin's avatar
   
gbazin committed
231
    CFLAGS_pics="${CFLAGS_pics} ${CFLAGS_mingw32_special}"
gbazin's avatar
   
gbazin committed
232
    CXXFLAGS_pics="${CXXFLAGS_pics} ${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}"
gbazin's avatar
   
gbazin committed
233
234
    OBJCFLAGS_pics="${OBJCFLAGS_pics} ${CFLAGS_mingw32_special}"
    CFLAGS_plugins="${CFLAGS_plugins} ${CFLAGS_mingw32_special}"
gbazin's avatar
   
gbazin committed
235
    CXXFLAGS_plugins="${CXXFLAGS_plugins} ${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}"
gbazin's avatar
   
gbazin committed
236
    OBJCFLAGS_plugins="${OBJCFLAGS_plugins} ${CFLAGS_mingw32_special}"
237
238
239
240
241
242
243
244
245
246
247
    ;;
  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
248
249

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

252
dnl Check for system libs needed
253
need_libc=false
254

255
256
257
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll getenv putenv setenv)

dnl Check for usual libc functions
258
259
260
AC_CHECK_FUNCS(strdup strndup atof lseek)
AC_CHECK_FUNC(strcasecmp,,[AC_CHECK_FUNC(stricmp)])
AC_CHECK_FUNC(strncasecmp,,[AC_CHECK_FUNC(strnicmp)])
Sam Hocevar's avatar
   
Sam Hocevar committed
261

Sam Hocevar's avatar
   
Sam Hocevar committed
262
AC_CHECK_FUNC(connect,,[
263
264
265
  AC_CHECK_LIB(socket,connect,
    LDFLAGS_ipv4="${LDFLAGS_ipv4} -lsocket"
    LDFLAGS_vlc="${LDFLAGS_vlc} -lsocket"
Sam Hocevar's avatar
   
Sam Hocevar committed
266
)])
267

Sam Hocevar's avatar
Sam Hocevar committed
268
AC_CHECK_FUNC(send,,[
269
  AC_CHECK_LIB(socket,send,
gbazin's avatar
   
gbazin committed
270
271
272
273
    LDFLAGS_access_http="${LDFLAGS_access_http} -lsocket"
    LDFLAGS_access_mms="${LDFLAGS_access_mms} -lsocket"
    LDFLAGS_access_rtp="${LDFLAGS_access_rtp} -lsocket"
    LDFLAGS_access_udp="${LDFLAGS_access_udp} -lsocket"
274
    LDFLAGS_access_ftp="${LDFLAGS_access_ftp} -lsocket"
275
    LDFLAGS_sap="${LDFLAGS_sap} -lsocket"
276
    LDFLAGS_access_output_udp="${LDFLAGS_access_output_udp} -lsocket"
Sam Hocevar's avatar
Sam Hocevar committed
277
)])
278

Sam Hocevar's avatar
   
Sam Hocevar committed
279
AC_CHECK_FUNC(gethostbyname,,[
280
281
  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
282
])
283
284
285

have_nanosleep=false
AC_CHECK_FUNC(nanosleep,have_nanosleep=:,[
286
  AC_CHECK_LIB(rt,nanosleep,
287
    [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"; have_nanosleep=:],
288
    [AC_CHECK_LIB(posix4,nanosleep,
289
        [LDFLAGS_vlc="${LDFLAGS_vlc} -lposix4"; have_nanosleep=:])]
290
  )
Sam Hocevar's avatar
   
Sam Hocevar committed
291
])
292
293
294
if ${have_nanosleep}; then
  AC_DEFINE(HAVE_NANOSLEEP, 1,
            Define if nanosleep is available.)
295
fi
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310

dnl Check for socklen_t
AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
  [AC_TRY_COMPILE(
     [#include <sys/types.h>
      #include <sys/socket.h>],
     [socklen_t len = 42; return len;],
     ac_cv_type_socklen_t=yes,
     ac_cv_type_socklen_t=no)])
if test x$ac_cv_type_socklen_t != xno; then
  AC_DEFINE(HAVE_SOCKLEN_T, 1,
            Define if <sys/socket.h> defines socklen_t.)
fi

dnl HP/UX port
311
AC_CHECK_LIB(rt,sem_init, [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"])
312

Sam Hocevar's avatar
   
Sam Hocevar committed
313
AC_CHECK_FUNC(inet_aton,,[
314
  AC_CHECK_LIB(resolv,inet_aton,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lresolv")
315
316
])
AC_CHECK_FUNC(textdomain,,[
317
318
319
320
  AC_CHECK_LIB(intl,textdomain,
    LDFLAGS_vlc="${LDFLAGS_vlc} -lintl"
    LDFLAGS_plugins="${LDFLAGS_plugins} -lintl"
  )
Sam Hocevar's avatar
   
Sam Hocevar committed
321
])
Sam Hocevar's avatar
   
Sam Hocevar committed
322

Sam Hocevar's avatar
   
Sam Hocevar committed
323
dnl Check for getopt
324
need_getopt=false
Sam Hocevar's avatar
   
Sam Hocevar committed
325
326
AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
[ # FreeBSD has a gnugetopt library for this:
327
328
329
330
  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
331

332
AC_TYPE_SIGNAL
333
AC_CHECK_LIB(dl,dlopen,LDFLAGS_vlc="${LDFLAGS_vlc} -ldl")
Sam Hocevar's avatar
   
Sam Hocevar committed
334
AC_CHECK_LIB(m,cos,
335
  LDFLAGS_imdct="${LDFLAGS_imdct} -lm"
336
337
  LDFLAGS_filter_distort="${LDFLAGS_filter_distort} -lm"
  LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -lm")
Sam Hocevar's avatar
   
Sam Hocevar committed
338
AC_CHECK_LIB(m,pow,
339
340
341
342
343
344
  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
345
)
Sam Hocevar's avatar
   
Sam Hocevar committed
346

Sam Hocevar's avatar
   
Sam Hocevar committed
347
dnl Check for pthreads - borrowed from XMMS
Sam Hocevar's avatar
   
Sam Hocevar committed
348
THREAD_LIB=error
349
if test "x${THREAD_LIB}" = "xerror"; then
350
  AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
Sam Hocevar's avatar
   
Sam Hocevar committed
351
fi
352
if test "x${THREAD_LIB}" = "xerror"; then
353
  AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
Sam Hocevar's avatar
   
Sam Hocevar committed
354
fi
355
if test "x${THREAD_LIB}" = "xerror"; then
356
  AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
Sam Hocevar's avatar
   
Sam Hocevar committed
357
fi
358
if test "x${THREAD_LIB}" = "xerror"; then
359
360
  AC_CHECK_FUNC(pthread_mutex_lock)
  THREAD_LIB=""
Sam Hocevar's avatar
   
Sam Hocevar committed
361
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
362
363
364

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

Sam Hocevar's avatar
   
Sam Hocevar committed
366
dnl Check for misc headers
367
AC_MSG_CHECKING(for pthread_cond_t in pthread.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
368
AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
369
  AC_MSG_RESULT(yes)
370
  AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
371
372
373
374
            Define if <pthread.h> defines pthread_cond_t.)],[
  AC_MSG_RESULT(no)])

AC_MSG_CHECKING(for pthread_once in pthread.h)
Sam Hocevar's avatar
Sam Hocevar committed
375
AC_EGREP_HEADER(pthread_once,pthread.h,[
376
  AC_MSG_RESULT(yes)
377
  AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
378
379
380
381
            Define if <pthread.h> defines pthread_once.)],[
  AC_MSG_RESULT(no)])

AC_MSG_CHECKING(for strncasecmp in strings.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
382
AC_EGREP_HEADER(strncasecmp,strings.h,[
383
  AC_MSG_RESULT(yes)
384
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
385
386
            Define if <strings.h> defines strncasecmp.)],[
  AC_MSG_RESULT(no)])
Sam Hocevar's avatar
   
Sam Hocevar committed
387

Sam Hocevar's avatar
   
Sam Hocevar committed
388
dnl Check for headers
389
390
AC_CHECK_HEADERS(signal.h time.h errno.h stdint.h getopt.h strings.h inttypes.h sys/int_types.h)
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h sys/ioctl.h sys/stat.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
391
392
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
393
AC_CHECK_HEADERS(machine/param.h sys/shm.h)
394
AC_CHECK_HEADERS(linux/version.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
395

Sam Hocevar's avatar
   
Sam Hocevar committed
396
397
AC_HEADER_TIME

398
399
dnl Check for dirent
need_dirent=false
400
AC_CHECK_HEADERS(dirent.h,,[need_dirent=:])
401
402
AM_CONDITIONAL(BUILD_DIRENT, ${need_dirent})

403
dnl Mac OS X and other OSes don't have declaration for nanosleep
404
AC_MSG_CHECKING(for nanosleep in time.h)
405
AC_EGREP_HEADER(nanosleep,time.h,[
406
  AC_MSG_RESULT(yes)
407
408
  AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
            Define if <time.h> defines nanosleep.)
409
410
],[
  AC_MSG_RESULT(no)
411
])
412
413

dnl Make sure we have timespecs
414
AC_MSG_CHECKING(for timespec in sys/time.h)
415
AC_EGREP_HEADER(timespec,sys/time.h,[
416
  AC_MSG_RESULT(yes)
417
418
  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
            Define if <sys/time.h> defines struct timespec.)
419
420
],[
  AC_MSG_RESULT(no)
421
])
422

Sam Hocevar's avatar
   
Sam Hocevar committed
423
424
425
dnl Check for threads library
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)

426
427
dnl Default X headers and libraries
if test "x${x_includes}" = "xNONE"; then
428
  x_includes="/usr/X11R6/include"
429
430
fi
if test "x${x_libraries}" = "xNONE"; then
431
  x_libraries="/usr/X11R6/lib"
432
433
fi

434
dnl Build the gtk_main plugins?
435
NEED_GTK_MAIN=no
436
NEED_GNOME_MAIN=no
437

Sam Hocevar's avatar
   
Sam Hocevar committed
438
dnl Check for DPMS
439
if test "x${SYS}" != "xmingw32"
Sam Hocevar's avatar
   
Sam Hocevar committed
440
then
441
442
  CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
  AC_CHECK_HEADERS(X11/extensions/dpms.h, [
443
    AC_MSG_CHECKING(for DPMSInfo in X11/extensions/dpms.h)
444
    AC_EGREP_HEADER(DPMSInfo,X11/extensions/dpms.h,[
445
      AC_MSG_RESULT(yes)
446
447
      AC_DEFINE(DPMSINFO_IN_DPMS_H, 1,
                Define if <X11/extensions/dpms.h> defines DPMSInfo.)
448
449
    ],[
      AC_MSG_RESULT(no)
450
    ])
451
452
  ],,[
    #include <X11/Xlib.h>
453
454
  ])
  CPPFLAGS="${CPPFLAGS_save}"
Sam Hocevar's avatar
   
Sam Hocevar committed
455
456
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
457
dnl Check for ntohl, etc.
458
AC_CACHE_CHECK([for ntohl in sys/param.h],
459
460
461
462
463
    [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)])
464
if test "x${ac_cv_c_ntohl_sys_param_h}" != "xno"; then
465
    AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
466
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
467

Sam Hocevar's avatar
   
Sam Hocevar committed
468
dnl Check for inline function size limit
469
AC_CACHE_CHECK([if \$CC accepts -finline-limit],
470
471
472
    [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)])
473
if test "x${ac_cv_c_inline_limit}" != "xno"; then
474
475
476
    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}"
477
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
478

479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# XXX: do this with an M4 macro?
#dnl Check for various -W flags
#for flag in "" all unreachable-code conversion sign-compare disabled-optimization
#do
#    AC_CACHE_CHECK([if \$CC accepts -W${flag}],
#        [ac_cv_c_W${flag}],
#        [CFLAGS="-W${flag} ${CFLAGS_save}"
#         AC_TRY_COMPILE([],,ac_cv_c_W${flag}=yes, ac_cv_c_W${flag}=no)])
#    if test "x${ac_cv_c_W${flag}}" != "xno"; then
#        CFLAGS_save="-W${flag} ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
#        CXXFLAGS_save="-W${flag} ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
#        OBJCFLAGS_save="-W${flag} ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
#    fi
#done

494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
AC_CACHE_CHECK([if \$CC accepts -Wall],
    [ac_cv_c_Wall],
    [CFLAGS="-Wall ${CFLAGS_save}"
     AC_TRY_COMPILE([],,ac_cv_c_Wall=yes, ac_cv_c_Wall=no)])

AC_CACHE_CHECK([if \$CC accepts -Wconversion],
    [ac_cv_c_Wconversion],
    [CFLAGS="-Wconversion ${CFLAGS_save}"
     AC_TRY_COMPILE([],,ac_cv_c_Wconversion=yes, ac_cv_c_Wconversion=no)])

AC_CACHE_CHECK([if \$CC accepts -Wunreachable-code],
    [ac_cv_c_Wunreachable_code],
    [CFLAGS="-Wunreachable-code ${CFLAGS_save}"
     AC_TRY_COMPILE([],,ac_cv_c_Wunreachable_code=yes, ac_cv_c_Wunreachable_code=no)])

AC_CACHE_CHECK([if \$CC accepts -Wsign-compare],
    [ac_cv_c_Wsign_compare],
    [CFLAGS="-Wsign-compare ${CFLAGS_save}"
     AC_TRY_COMPILE([],,ac_cv_c_Wsign_compare=yes, ac_cv_c_Wsign_compare=no)])

AC_CACHE_CHECK([if \$CC accepts -Wdisabled-optimization],
    [ac_cv_c_Wdisabled_optimization],
    [CFLAGS="-Wdisabled-optimization ${CFLAGS_save}"
     AC_TRY_COMPILE([],,ac_cv_c_Wdisabled_optimization=yes, ac_cv_c_Wdisabled_optimization=no)])

AC_CACHE_CHECK([if \$CC accepts -Winline],
    [ac_cv_c_Winline],
    [CFLAGS="-Winline ${CFLAGS_save}"
     AC_TRY_COMPILE([],,ac_cv_c_Winline=yes, ac_cv_c_Winline=no)])

524
525
526
527
528
if test "x${ac_cv_c_Wall}" != "xno"; then
    CFLAGS_save="-Wall ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
    CXXFLAGS_save="-Wall ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
    OBJCFLAGS_save="-Wall ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
fi
529

530
if test "x${ac_cv_c_Wunreachable_code}" != "xno"; then
531
532
533
#    CFLAGS_save="-Wunreachable-code ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
#    CXXFLAGS_save="-Wunreachable-code ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
#    OBJCFLAGS_save="-Wunreachable-code ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
534

535
536
    dnl -Wunreachable-code means gcc-3.x, we can use -Wconversion and we can
    dnl activate -Winline for C++, it won't choke on system headers.
537
538
539
540
541
#    if test "x${ac_cv_c_Wconversion}" != "xno"; then
#        CFLAGS_save="-Wconversion ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
#        CXXFLAGS_save="-Wconversion ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
#        OBJCFLAGS_save="-Wconversion ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
#    fi
542
543
544
545
    if test "x${ac_cv_c_Winline}" != "xno"; then
        CXXFLAGS_save="-Winline ${CXXFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
    fi

546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
fi

if test "x${ac_cv_c_Wsign_compare}" != "xno"; then
    CFLAGS_save="-Wsign-compare ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
    CXXFLAGS_save="-Wsign-compare ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
    OBJCFLAGS_save="-Wsign-compare ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
fi

if test "x${ac_cv_c_Wdisabled_optimization}" != "xno"; then
    CFLAGS_save="-Wdisabled-optimization ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
    CXXFLAGS_save="-Wdisabled-optimization ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
    OBJCFLAGS_save="-Wdisabled-optimization ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
fi

if test "x${ac_cv_c_Winline}" != "xno"; then
    CFLAGS_save="-Winline ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
    OBJCFLAGS_save="-Winline ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
Sam Hocevar's avatar
   
Sam Hocevar committed
563
564
565
566
fi

dnl Check for -pipe
AC_CACHE_CHECK([if \$CC accepts -pipe],
567
568
569
    [ac_cv_c_pipe],
    [CFLAGS="${CFLAGS_save} -pipe"
     AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
570
if test "x${ac_cv_c_pipe}" != "xno"; then
571
572
573
    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
574
575
576
577
fi

dnl Check for various optimization flags
AC_CACHE_CHECK([if \$CC accepts -O3],
578
579
580
    [ac_cv_c_o3],
    [CFLAGS="${CFLAGS_save} -O3"
     AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
581
if test "x${ac_cv_c_o3}" != "xno"; then
582
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
583
else
584
585
586
587
588
589
590
591
592
593
594
595
596
597
    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
598
599
600
601
602
    fi
fi

dnl Check for -ffast-math
AC_CACHE_CHECK([if \$CC accepts -ffast-math],
603
604
605
    [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)])
606
if test "x${ac_cv_c_fast_math}" != "xno"; then
607
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
Sam Hocevar's avatar
   
Sam Hocevar committed
608
609
610
611
fi

dnl Check for -funroll-loops
AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
612
613
614
    [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)])
615
if test "x${ac_cv_c_unroll_loops}" != "xno"; then
616
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
Sam Hocevar's avatar
   
Sam Hocevar committed
617
618
619
620
fi

dnl Check for -fomit-frame-pointer
AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
621
622
623
    [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)])
624
if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
625
626
627
    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
628
629
fi

630
631
632
633
634
635
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
Christophe Massiot's avatar
Christophe Massiot committed
636
637
    CFLAGS_builtins="${CFLAGS_builtins} -mdynamic-no-pic"
    CFLAGS_libvlc="${CFLAGS_libvlc} -mdynamic-no-pic"
638
639
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
640
dnl Check for Darwin plugin linking flags
Christophe Massiot's avatar
Christophe Massiot committed
641
AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
642
643
644
    [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)])
645
if test "x${ac_cv_ld_darwin}" != "xno"; then
646
    LDFLAGS_plugins="${LDFLAGS_plugins} -bundle -undefined error -lcc_dynamic"
647
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
648
649

dnl Check for standard plugin linking flags
650
AC_CACHE_CHECK([if \$CC accepts -shared],
651
652
653
    [ac_cv_ld_plugins],
    [CFLAGS="${CFLAGS_save} -shared"
     AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
654
if test "x${ac_cv_ld_plugins}" != "xno"; then
655
    LDFLAGS_plugins="${LDFLAGS_plugins} -shared"
Sam Hocevar's avatar
   
Sam Hocevar committed
656
fi
657

658
659
dnl Check for variadic macros
AC_CACHE_CHECK([for variadic cpp macros],
660
661
662
663
664
665
666
667
    [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)])
668
if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
669
    AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
670
671
fi

672
673
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
674
675
676
677
678
679
680
681
682
    [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}"])
683
if test "x${ac_cv_c_attribute_aligned}" != "x0"; then
684
685
    AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
        [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
686
687
fi

688
689
690
691
692
693
694
695
696
697
698
699
700
dnl Checks for __attribute__(format()) directive
AC_CACHE_CHECK([__attribute__ ((format ())) support with function pointers],
    [ac_cv_c_attribute_format],
    [ac_cv_c_attribute_format=no
        CFLAGS="${CFLAGS_save} -Werror"
        AC_TRY_COMPILE([],
        [static void (*pf_printf)(const char *, ...) __attribute__ ((format(printf,1,2)));(void)pf_printf;],
        [ac_cv_c_attribute_format=yes])
        CFLAGS="${CFLAGS_save}"])
if test "x${ac_cv_c_attribute_format}" != "xno"; then
    AC_DEFINE(HAVE_ATTRIBUTE_FORMAT, 1, Support for __attribute__((format())) with function pointers)
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
701
702
703
dnl
dnl  Check the CPU
dnl
704
case "x${target_cpu}" in
705
706
707
708
709
710
711
712
713
714
715
716
  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
717
esac
Sam Hocevar's avatar
   
Sam Hocevar committed
718
719
720
721

dnl
dnl  default modules
dnl
722
PLUGINS="${PLUGINS} dummy rc logger access_file memcpy"
723
724
PLUGINS="${PLUGINS} es audio mpeg_system ps ts"
PLUGINS="${PLUGINS} idct idctclassic motion mpeg_video spudec mpeg_audio"
725
#PLUGINS="${PLUGINS} a52old imdct downmix imdct3dn downmix3dn imdctsse downmixsse"
726
PLUGINS="${PLUGINS} lpcm a52"
727
PLUGINS="${PLUGINS} deinterlace invert adjust wall transform distort clone crop motionblur"
728
PLUGINS="${PLUGINS} float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif fixed32tofloat32 fixed32tos16 s16tofloat32 s16tofloat32swab s8tofloat32 u8tofixed32 u8tofloat32"
729
PLUGINS="${PLUGINS} trivial_resampler ugly_resampler linear_resampler"
730
PLUGINS="${PLUGINS} trivial_channel_mixer headphone_channel_mixer"
Christophe Massiot's avatar
Christophe Massiot committed
731
PLUGINS="${PLUGINS} trivial_mixer spdif_mixer float32_mixer"
732
733
734
PLUGINS="${PLUGINS} aout_file"
#PLUGINS="${PLUGINS} scope"
PLUGINS="${PLUGINS} i420_rgb i420_yuy2 i422_yuy2 i420_ymga"
735
PLUGINS="${PLUGINS} id3 m3u"
736
PLUGINS="${PLUGINS} wav araw demuxdump demuxsub adpcm"
737
PLUGINS="${PLUGINS} access_udp access_http access_rtp ipv4 access_mms sap access_ftp"
738

Sam Hocevar's avatar
   
Sam Hocevar committed
739
740
741
dnl
dnl  Accelerated modules
dnl
742
743
MMX_MODULES="memcpymmx idctmmx motionmmx i420_rgb_mmx i420_yuy2_mmx i422_yuy2_mmx i420_ymga_mmx"
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
744
745
THREEDNOW_MODULES="memcpy3dn"
SSE_MODULES=""
746
ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec"
747

748
749
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
750
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
751
     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
752
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
753
if test "x${ac_cv_mmx_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
754
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
755
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
756

757
758
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
759
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
760
     AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
761
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
762
if test "x${ac_cv_mmxext_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
763
  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
764
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
765

766
767
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
768
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
769
     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
770
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
771
if test "x${ac_cv_3dnow_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
772
  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
773
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
774
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
775

776
777
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
778
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
779
     AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
780
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
781
if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
782
  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
783
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
784
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
785

Sam Hocevar's avatar
Sam Hocevar committed
786
# don't try to grok AltiVec with native mingw32 it doesn't work right now
gbazin's avatar
   
gbazin committed
787
# we should be able to remove this test with future versions of mingw32
788
if test "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
Sam Hocevar committed
789
AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
790
    [ac_cv_altivec_inline],
791
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
792
     AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
793
         ac_cv_altivec_inline=yes,
794
         [CFLAGS="${CFLAGS_save} -Wa,-m7400"
Sam Hocevar's avatar
   
Sam Hocevar committed
795
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
796
            [ac_cv_altivec_inline="-Wa,-m7400"],
797
            ac_cv_altivec_inline=no)
798
         ])])
799
if test "x${ac_cv_altivec_inline}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
800
  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
801
  if test "x${ac_cv_altivec_inline}" != "xyes"; then
802
803
804
805
    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}"
806
  fi
807
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
808
fi
809

Sam Hocevar's avatar
Sam Hocevar committed
810
AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
811
    [ac_cv_c_altivec],
812
    [CFLAGS="${CFLAGS_save} -faltivec"
813
     # Darwin test
Sam Hocevar's avatar
   
Sam Hocevar committed
814
     AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
815
816
        ac_cv_c_altivec=-faltivec, [
        # Linux/PPC test
817
        CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -fvec"
Sam Hocevar's avatar
   
Sam Hocevar committed
818
        AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
819
820
            [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
        ])
821
     CFLAGS="${CFLAGS_save}"])
822
if test "x${ac_cv_c_altivec}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
823
  AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
824
825
826
827
  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}"
828
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
829
830
831
832
fi

AC_CACHE_CHECK([if linker needs -framework vecLib],
    [ac_cv_ld_altivec],
833
    [LDFLAGS="${LDFLAGS_vlc} -framework vecLib"
834
     AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
835
     LDFLAGS="${LDFLAGS_save}"
836
    ])
837
if test "x${ac_cv_ld_altivec}" != "xno"; then
838
839
840
841
  LDFLAGS_idctaltivec="${LDFLAGS_idctaltivec} -framework vecLib"
  LDFLAGS_motionaltivec="${LDFLAGS_motionaltivec} -framework vecLib"
  LDFLAGS_memcpyaltivec="${LDFLAGS_memcpyaltivec} -framework vecLib"
  LDFLAGS_vlc="${LDFLAGS_vlc} -framework vecLib"
842
fi
gbazin's avatar
   
gbazin committed
843
fi # end if mingw32
844

Sam Hocevar's avatar
   
Sam Hocevar committed
845
846
847
AC_ARG_WITH(,[])
AC_ARG_WITH(,[Optimization options:])

Sam Hocevar's avatar
   
Sam Hocevar committed
848
dnl
849
dnl  Special arch tuning
Sam Hocevar's avatar
   
Sam Hocevar committed
850
dnl
851
AC_ARG_WITH(tuning,
Sam Hocevar's avatar
   
Sam Hocevar committed
852
[  --with-tuning=ARCH      enable special tuning for an architecture
853
                          (default i686 on IA-32 and 750 on PPC)])
854
if test "x${with_tuning}" != "x"; then
855
856
857
858
859
    if test "x${target_cpu}" = "xpowerpc"; then
        CFLAGS_TUNING="-mtune=${with_tuning}"
    else
        CFLAGS_TUNING="-mcpu=${with_tuning}"
    fi
860
else
861
    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"
862
    else
863
        if test "x${target_cpu}" = "xpowerpc"; then CFLAGS_TUNING="-mtune=750"; fi
864
865
    fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
866
867

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
868
dnl  x86 accelerations
Sam Hocevar's avatar
   
Sam Hocevar committed
869
dnl
870
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
871
872
then
    ARCH="${ARCH} mmx"
Sam Hocevar's avatar
Sam Hocevar committed
873
    PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
Sam Hocevar's avatar
   
Sam Hocevar committed
874
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
875

Sam Hocevar's avatar
   
Sam Hocevar committed
876
877
878
879
dnl
dnl  Enable/disable optimizations
dnl
AC_ARG_ENABLE(optimizations,
880
881
[  --disable-optimizations disable compiler optimizations (default enabled)])
AM_CONDITIONAL(OPTIM, test "x${enable_optimizations}" != "xno")
Sam Hocevar's avatar
   
Sam Hocevar committed
882

Sam Hocevar's avatar
   
Sam Hocevar committed
883
884
885
dnl
dnl  AltiVec acceleration
dnl
886
AC_ARG_ENABLE(altivec,
Sam Hocevar's avatar
Sam Hocevar committed
887
[  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
888
[ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
889
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
890
[ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
891
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
892
893
894
895

dnl
dnl  Debugging mode
dnl
896
AC_ARG_ENABLE(debug,
897
898
[  --enable-debug          debug mode (default disabled)])
AM_CONDITIONAL(DEBUG, test "x${enable_debug}" = "xyes")
Sam Hocevar's avatar
   
Sam Hocevar committed
899

Sam Hocevar's avatar
   
Sam Hocevar committed
900
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
901
dnl  Enable release-specific flags
Sam Hocevar's avatar
   
Sam Hocevar committed
902
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
903
AC_ARG_ENABLE(release,
904
905
[  --enable-release        activate extra optimizations (default disabled)])
AM_CONDITIONAL(RELEASE, test "x${enable_release}" = "xyes")
Sam Hocevar's avatar
   
Sam Hocevar committed
906

907
908
909
910
911
912
913
914
915
916
917
918
919
920
dnl
dnl Stream output
dnl
AC_ARG_ENABLE(sout,
  [  --enable-sout           Stream output modules (default enabled)])
if test "x${enable_sout}" != "xno"
then
  PLUGINS="${PLUGINS} access_output_dummy access_output_udp access_output_file"
  PLUGINS="${PLUGINS} mux_ts mux_ps mux_dummy"
  PLUGINS="${PLUGINS} packetizer_mpegaudio packetizer_mpegvideo packetizer_a52"
  PLUGINS="${PLUGINS} packetizer_mpeg4video packetizer_copy"
fi


Sam Hocevar's avatar
   
Sam Hocevar committed
921
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
922
dnl  Input plugins
Sam Hocevar's avatar
   
Sam Hocevar committed
923
924
dnl

Sam Hocevar's avatar
   
Sam Hocevar committed
925
AC_ARG_WITH(,[Input plugins:])
Sam Hocevar's avatar
   
Sam Hocevar committed
926
927

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
928
929
930
931
dnl  DVD module: optionally check for installed libdvdcss
dnl
AC_ARG_ENABLE(dvd,
[  --enable-dvd            DVD input module (default enabled)])
Eric Petit's avatar
Eric Petit committed
932
if test "x${enable_dvd}" != "xno"
Sam Hocevar's avatar
   
Sam Hocevar committed
933
then
934
  AC_ARG_WITH(dvdcss,
Sam Hocevar's avatar
   
Sam Hocevar committed
935
  [    --with-dvdcss=PATH    libdvdcss headers and libraries])
936
  AC_ARG_WITH(dvdcss-tree,
Sam Hocevar's avatar
   
Sam Hocevar committed
937
  [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
938
  case "x${with_dvdcss}" in
Sam Hocevar's avatar
   
Sam Hocevar committed
939
  x|xyes)
940
    if test "x${with_dvdcss_tree}" = x
Sam Hocevar's avatar
   
Sam Hocevar committed
941
942
    then
      AC_CHECK_HEADERS(dvdcss/dvdcss.h,
943
        [ PLUGINS="${PLUGINS} dvd"
944
945
          LDFLAGS_dvd="${LDFLAGS_dvd} -ldvdcss"
          LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -ldvdcss" ],
Sam Hocevar's avatar
   
Sam Hocevar committed
946
947
948
949
950
        [ 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`"
951
      if test "x${real_dvdcss_tree}" = "x"
Sam Hocevar's avatar
   
Sam Hocevar committed
952
953
954
955
956
957
958
959
960
      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)
961
962
        BUILTINS="${BUILTINS} dvd"
        LDFLAGS_dvd="${LDFLAGS_dvd} ${real_dvdcss_tree}/src/.libs/libdvdcss.a"
963
        LDFLAGS_dvdcss="${LDFLAGS_dvdcss} ${real_dvdcss_tree}/src/.libs/libdvdcss.a"
964
        CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${real_dvdcss_tree}/src"
Sam Hocevar's avatar
   
Sam Hocevar committed
965
966
967
968
969
970
      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
971
972
  ;;
  xno)
Sam Hocevar's avatar
   
Sam Hocevar committed
973
    dnl  Compile without dvdcss (dlopen version, works only under Linux)
974
975
976
    PLUGINS="${PLUGINS} dvd"
    CPPFLAGS_dvd="${CPPFLAGS_dvd} -DGOD_DAMN_DMCA"
    LDFLAGS_dvd="${LDFLAGS_dvd} -ldl"
Sam Hocevar's avatar
   
Sam Hocevar committed
977
978
  ;;
  *)
Sam Hocevar's avatar
   
Sam Hocevar committed
979
980
    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
981
    then
Sam Hocevar's avatar
   
Sam Hocevar committed
982
      dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
Sam Hocevar's avatar
   
Sam Hocevar committed
983
      AC_MSG_RESULT(yes)
984
985
      PLUGINS="${PLUGINS} dvd"
      LDFLAGS_dvd="${LDFLAGS_dvd} -L${with_dvdcss}/lib -ldvdcss"
986
      LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -L${with_dvdcss}/lib -ldvdcss"
987
      CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${with_dvdcss}/include"
Sam Hocevar's avatar
   
Sam Hocevar committed
988
    else
Sam Hocevar's avatar
   
Sam Hocevar committed
989
      dnl  No libdvdcss could be found, sorry
Sam Hocevar's avatar
   
Sam Hocevar committed
990
      AC_MSG_RESULT(no)
Sam Hocevar's avatar
   
Sam Hocevar committed
991
      AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
Sam Hocevar's avatar
   
Sam Hocevar committed
992
993
994
995
    fi
  ;;
  esac
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
996

Stéphane Borel's avatar
Stéphane Borel committed
997
dnl
998
dnl dvdread module: check for libdvdread
Stéphane Borel's avatar
Stéphane Borel committed
999
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
1000
1001
AC_ARG_ENABLE(dvdread,
[  --enable-dvdread        dvdread input module (default disabled)])
1002
if test "x${enable_dvdread}" != "xno"
Sam Hocevar's avatar
   
Sam Hocevar committed
1003
then
1004
  AC_ARG_WITH(dvdread,
1005
1006
1007
1008
  [    --with-dvdread=PATH    libdvdread headers and libraries])
  AC_ARG_WITH(dvdread-tree,
  [    --with-dvdread-tree=PATH libdvdread tree for static linking])
  if test "x${with_dvdread}" = x
Sam Hocevar's avatar
   
Sam Hocevar committed
1009
  then
1010
    if test "x${with_dvdread_tree}" = x
1011
    then
gbazin's avatar
   
gbazin committed
1012
      AC_CHECK_HEADERS(dvdread/dvd_reader.h,
1013
        [ PLUGINS="${PLUGINS} dvdread"
gbazin's avatar
   
gbazin committed
1014
          LDFLAGS_dvdread="${LDFLAGS_dvdread} -ldvdread ${LDFLAGS_dvdcss}" ],
1015
1016
1017
1018
1019
1020
1021
1022
1023
        [ if test "x${enable_dvdread}" != "x"
          then
            AC_MSG_WARN([Please get libdvdread from http://www.dtek.chalmers.se/groups/dvd/downloads.shtml])
            AC_MSG_ERROR([cannot find libdvdread headers])
          fi ])
    else
      AC_MSG_CHECKING(for libdvdread.a in ${with_dvdread_tree})
      real_dvdread_tree="`cd ${with_dvdread_tree} 2>/dev/null && pwd`"
      if test "x${real_dvdread_tree}" = "x"
Sam Hocevar's avatar
   
Sam Hocevar committed
1024
      then
1025
1026
1027
1028
1029
1030
1031
1032
1033
        dnl  The given directory can't be found
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot cd to ${with_dvdread_tree}])
      fi
      if test -f "${real_dvdread_tree}/dvdread/.libs/libdvdread.a"
      then
        dnl  Use a custom libdvdread
        AC_MSG_RESULT(${real_dvdread_tree}/dvdread/.libs/libdvdread.a)
        BUILTINS="${BUILTINS} dvdread"
gbazin's avatar
   
gbazin committed
1034
        LDFLAGS_dvdread="${LDFLAGS_dvdread} ${real_dvdread_tree}/dvdread/.libs/libdvdread.a ${LDFLAGS_dvdcss}"
1035
        CPPFLAGS_dvdread="${CPPFLAGS_dvdread} -I${real_dvdread_tree}"
Sam Hocevar's avatar
   
Sam Hocevar committed
1036
      else
1037