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

gbazin's avatar
   
gbazin committed
3
AC_INIT(vlc,0.6.0-test1)
4

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

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

13
14
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.
gbazin's avatar
   
gbazin committed
15
AM_INIT_AUTOMAKE(vlc,0.6.0-test1)
16
17
AM_CONFIG_HEADER(config.h)

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

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

37
38
dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
dnl now otherwise it might be set in an obscure if statement.
39
AC_EGREP_CPP(foo,foo)
40

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

59
60
61
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL

62
63
64
65
dnl Check for compiler properties
AC_C_CONST
AC_C_INLINE

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

gbazin's avatar
   
gbazin committed
72
73
74
dnl
dnl  Check the operating system
dnl
75
case "x${target_os}" in
76
77
78
79
80
81
82
83
84
85
  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
86
    LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -ldvd"
87
    LDFLAGS_vcd="${LDFLAGS_vcd} -ldvd"
gbazin's avatar
   
gbazin committed
88
    LDFLAGS_cdda="${LDFLAGS_cdda} -ldvd"
89
90
91
92
93
94
95
    ;;
  x*bsd*)
    SYS="${target_os}"
    CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
    ;;
  xdarwin*)
    SYS=darwin
96
97
98
    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}"
99
    LDFLAGS_vlc="${LDFLAGS_vlc} -all_load"
100
    LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -all_load"
101
102
    LIBEXT=".dylib"
    ;;
gbazin's avatar
   
gbazin committed
103
  x*mingw32* | x*cygwin*)
104
105
    AC_CHECK_TOOL(WINDRES, windres, :)
    LIBEXT=".dll"
gbazin's avatar
   
gbazin committed
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

    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
123
        # add ws2_32 for closesocket, select, recv
124
        CPPFLAGS_save="${CPPFLAGS_save} -D_OFF_T_ -D_off_t=long"
gbazin's avatar
   
gbazin committed
125
        CPPFLAGS="${CPPFLAGS_save}"
gbazin's avatar
   
gbazin committed
126
        LDFLAGS_vlc="${LDFLAGS_vlc} -lws2_32 -lnetapi32 -lwinmm -mwindows"
gbazin's avatar
   
gbazin committed
127
128
        LDFLAGS_ipv4="${LDFLAGS_ipv4} -lws2_32"
        LDFLAGS_ipv6="${LDFLAGS_ipv6} -lws2_32"
gbazin's avatar
   
gbazin committed
129
130
131
        LDFLAGS_access_http="${LDFLAGS_access_http} -lws2_32"
        LDFLAGS_access_mms="${LDFLAGS_access_mms} -lws2_32"
        LDFLAGS_access_udp="${LDFLAGS_access_udp} -lws2_32"
132
        LDFLAGS_access_ftp="${LDFLAGS_access_ftp} -lws2_32"
133
        LDFLAGS_access_output_udp="${LDFLAGS_access_output_udp} -lws2_32"
134
        LDFLAGS_sap="${LDFLAGS_sap} -lws2_32"
135
        LDFLAGS_slp="${LDFLAGS_slp} -lws2_32"
gbazin's avatar
   
gbazin committed
136
        LDFLAGS_http="${LDFLAGS_http} -lws2_32"
gbazin's avatar
   
gbazin committed
137
        LDFLAGS_httpd="${LDFLAGS_httpd} -lws2_32"
gbazin's avatar
   
gbazin committed
138
    fi
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
    ;;
  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"
158
    LDFLAGS_beos="${LDFLAGS_beos} -lbe -lmedia -lroot -ltracker -lstdc++.r4 -ltranslation -lgame"
159
    dnl BONE or not BONE ? only BONE has libbind.so
160
    AC_CHECK_LIB( bind, inet_ntoa,
161
162
163
        [ LDFLAGS_access_mms="${LDFLAGS_access_mms} -lsocket -lbind"
          LDFLAGS_ipv4="${LDFLAGS_ipv4} -lsocket -lbind"
          LDFLAGS_httpd="${LDFLAGS_httpd} -lsocket -lbind"],
164
        [])
165
166
167
168
    ;;
  x*)
    SYS="${target_os}"
    ;;
gbazin's avatar
   
gbazin committed
169
esac
170
171
172
173
AM_CONDITIONAL(HAVE_BEOS, test "x${SYS}" = "xbeos")
AM_CONDITIONAL(HAVE_DARWIN, test "x${SYS}" = "xdarwin")
AM_CONDITIONAL(HAVE_WIN32, test "x${SYS}" = "xmingw32")

174
175
176
dnl
dnl Gettext stuff
dnl
177
ALL_LINGUAS="de en_GB fr it ja no ru nl pl sv"
gbazin's avatar
   
gbazin committed
178
AM_GNU_GETTEXT_VERSION(0.11.5)
179
180
181
182
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"
183
else
184
  AC_CHECK_FUNCS(textdomain,,[
185
    AC_CHECK_LIB(intl,textdomain,
186
      LDFLAGS_vlc="${LDFLAGS_vlc} ${LIBINTL}",,
187
      ${LIBINTL}
188
189
    )
  ])
190
191
fi
AM_CONDITIONAL(BUILD_INTL, test "${nls_cv_force_use_gnu_gettext}" = "yes")
hartman's avatar
ALL:    
hartman committed
192
XGETTEXT="${XGETTEXT} --keyword=_NS --keyword=_ANS"
193

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

gbazin's avatar
   
gbazin committed
197
198
199
200
201
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
202
203
            [LDFLAGS_vlc="${LDFLAGS_vlc} -lmingwex"
             LDFLAGS_gtk="${LDFLAGS_gtk} -lmingwex"])
gbazin's avatar
   
gbazin committed
204
205
206
    )
fi

gbazin's avatar
   
gbazin committed
207
208
209
210
211
212
213
214
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
215
216
        CFLAGS_save="${CFLAGS_save} -mms-bitfields";
        CXXFLAGS_save="${CXXFLAGS_save} -mms-bitfields";
gbazin's avatar
   
gbazin committed
217
    else
218
219
220
221
222
223
224
225
        AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
            [ac_cv_c_fnative_struct],
            [CFLAGS="${CFLAGS_save} -fnative-struct"
             AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
        if test x"$ac_cv_c_fnative_struct" != x"no"; then
            CFLAGS_save="${CFLAGS_save} -fnative-struct";
            CXXFLAGS_save="${CXXFLAGS_save} -fnative-struct";
        fi
gbazin's avatar
   
gbazin committed
226
227
    fi

gbazin's avatar
   
gbazin committed
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
    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
247
248
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
249
dnl Flags for plugin compilation
250
251
case "x${SYS}" in
  xmingw32|xcygwin)
gbazin's avatar
   
gbazin committed
252
    CFLAGS_pics="${CFLAGS_pics} ${CFLAGS_mingw32_special}"
gbazin's avatar
   
gbazin committed
253
    CXXFLAGS_pics="${CXXFLAGS_pics} ${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}"
gbazin's avatar
   
gbazin committed
254
255
    OBJCFLAGS_pics="${OBJCFLAGS_pics} ${CFLAGS_mingw32_special}"
    CFLAGS_plugins="${CFLAGS_plugins} ${CFLAGS_mingw32_special}"
gbazin's avatar
   
gbazin committed
256
    CXXFLAGS_plugins="${CXXFLAGS_plugins} ${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}"
gbazin's avatar
   
gbazin committed
257
    OBJCFLAGS_plugins="${OBJCFLAGS_plugins} ${CFLAGS_mingw32_special}"
258
259
260
261
262
263
264
265
266
267
268
    ;;
  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
269
270

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

273
dnl Check for system libs needed
274
need_libc=false
275

276
277
278
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
279
AC_CHECK_FUNCS(strdup strndup atof lseek)
280
281
AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
Sam Hocevar's avatar
   
Sam Hocevar committed
282

283
AC_CHECK_FUNCS(connect,,[
284
285
286
  AC_CHECK_LIB(socket,connect,
    LDFLAGS_ipv4="${LDFLAGS_ipv4} -lsocket"
    LDFLAGS_vlc="${LDFLAGS_vlc} -lsocket"
Sam Hocevar's avatar
   
Sam Hocevar committed
287
)])
288

289
AC_CHECK_FUNCS(send,,[
290
  AC_CHECK_LIB(socket,send,
gbazin's avatar
   
gbazin committed
291
292
293
    LDFLAGS_access_http="${LDFLAGS_access_http} -lsocket"
    LDFLAGS_access_mms="${LDFLAGS_access_mms} -lsocket"
    LDFLAGS_access_udp="${LDFLAGS_access_udp} -lsocket"
294
    LDFLAGS_access_ftp="${LDFLAGS_access_ftp} -lsocket"
295
    LDFLAGS_sap="${LDFLAGS_sap} -lsocket"
gbazin's avatar
   
gbazin committed
296
    LDFLAGS_http="${LDFLAGS_http} -lsocket"
297
    LDFLAGS_access_output_udp="${LDFLAGS_access_output_udp} -lsocket"
Sam Hocevar's avatar
Sam Hocevar committed
298
)])
299

300
AC_CHECK_FUNCS(gethostbyname,,[
301
302
  AC_CHECK_LIB(nsl,gethostbyname,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lnsl" LDFLAGS_httpd="${LDFLAGS_httpd} -lnsl",[
    AC_CHECK_LIB(bind,gethostbyname,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind" LDFLAGS_httpd="${LDFLAGS_httpd} -lbind")])
Sam Hocevar's avatar
   
Sam Hocevar committed
303
])
304

305
306
307
308
309
310
311
312
313
314
315
316
317
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

318
AC_CHECK_FUNCS(inet_aton,,[
319
  AC_CHECK_LIB(resolv,inet_aton,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lresolv" LDFLAGS_httpd="${LDFLAGS_httpd} -lresolv")
320
])
Sam Hocevar's avatar
   
Sam Hocevar committed
321

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

gbazin's avatar
   
gbazin committed
331
if test "x$SYS" != "xmingw32"; then
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_adjust="${LDFLAGS_adjust} -lm"
  LDFLAGS_distort="${LDFLAGS_distort} -lm"
338
  LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -lm")
Sam Hocevar's avatar
   
Sam Hocevar committed
339
AC_CHECK_LIB(m,pow,
340
  LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lm"
341
  LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -lm"
342
343
344
345
346
  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
347
)
348
349
350
AC_CHECK_LIB(m,sqrt,
  LDFLAGS_headphone_channel_mixer="${LDFLAGS_headphone_channel_mixer} -lm"
)
gbazin's avatar
   
gbazin committed
351
fi # end "x$SYS" != "xmingw32"
Sam Hocevar's avatar
   
Sam Hocevar committed
352

gbazin's avatar
   
gbazin committed
353
if test "x$SYS" != "xmingw32"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
354
dnl Check for pthreads - borrowed from XMMS
Sam Hocevar's avatar
   
Sam Hocevar committed
355
THREAD_LIB=error
356
if test "x${THREAD_LIB}" = "xerror"; then
357
  AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
Sam Hocevar's avatar
   
Sam Hocevar committed
358
fi
359
if test "x${THREAD_LIB}" = "xerror"; then
360
  AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
Sam Hocevar's avatar
   
Sam Hocevar committed
361
fi
362
if test "x${THREAD_LIB}" = "xerror"; then
363
  AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
Sam Hocevar's avatar
   
Sam Hocevar committed
364
fi
365
if test "x${THREAD_LIB}" = "xerror"; then
366
  AC_CHECK_FUNCS(pthread_mutex_lock)
367
  THREAD_LIB=""
Sam Hocevar's avatar
   
Sam Hocevar committed
368
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
369
370
371

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

gbazin's avatar
   
gbazin committed
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
dnl
dnl  GNU portable threads
dnl
AC_ARG_ENABLE(pth,
  [  --enable-pth            GNU Pth support (default disabled)],
  [ if test "x${enable_pth}" = "xyes"; then
    AC_CHECK_LIB(pth,pth_init)
    AC_MSG_CHECKING(for pth_init in pth.h)
    AC_EGREP_HEADER(pth_init,pth.h,[
      AC_MSG_RESULT(yes)
      AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
                Define if <pth.h> defines pth_init)
      THREAD_LIB="-lpth"
    ],[
      AC_MSG_RESULT(no)
    ])
    fi
])

dnl
dnl  State Threads
dnl
AC_ARG_ENABLE(st,
  [  --enable-st             State Threads (default disabled)],
  [ if test "x${enable_st}" = "xyes"; then
    AC_CHECK_LIB(st,st_init)
    AC_MSG_CHECKING(for st_init in st.h)
    AC_EGREP_HEADER(st_init,st.h,[
      AC_MSG_RESULT(yes)
      AC_DEFINE(ST_INIT_IN_ST_H, 1,
                Define if <st.h> defines st_init)
      THREAD_LIB="-lst"
    ],[
      AC_MSG_RESULT(yes)
    ])
    fi
])

gbazin's avatar
   
gbazin committed
411
412
LDFLAGS_vlc="${LDFLAGS_vlc} ${THREAD_LIB}"
LDFLAGS_plugins="${LDFLAGS_plugins} ${THREAD_LIB}"
gbazin's avatar
   
gbazin committed
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432

dnl Don't link with rt when using GNU-pth
if test "x${THREAD_LIB}" != "x-lpth" && test "x${THREAD_LIB}" != "x-lst"; then
  dnl HP/UX port
  AC_CHECK_LIB(rt,sem_init, [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"])

  have_nanosleep=false
  AC_CHECK_FUNCS(nanosleep,have_nanosleep=:,[
    AC_CHECK_LIB(rt,nanosleep,
      [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"; have_nanosleep=:],
      [AC_CHECK_LIB(posix4,nanosleep,
          [LDFLAGS_vlc="${LDFLAGS_vlc} -lposix4"; have_nanosleep=:])]
    )
  ])
  if ${have_nanosleep}; then
    AC_DEFINE(HAVE_NANOSLEEP, 1,
              Define if nanosleep is available.)
  fi
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
433
dnl Check for misc headers
434
AC_MSG_CHECKING(for pthread_cond_t in pthread.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
435
AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
436
  AC_MSG_RESULT(yes)
437
  AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
438
439
440
441
            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
442
AC_EGREP_HEADER(pthread_once,pthread.h,[
443
  AC_MSG_RESULT(yes)
444
  AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
445
446
            Define if <pthread.h> defines pthread_once.)],[
  AC_MSG_RESULT(no)])
gbazin's avatar
   
gbazin committed
447
fi # end "x$SYS" != "xmingw32"
448
449

AC_MSG_CHECKING(for strncasecmp in strings.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
450
AC_EGREP_HEADER(strncasecmp,strings.h,[
451
  AC_MSG_RESULT(yes)
452
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
453
454
            Define if <strings.h> defines strncasecmp.)],[
  AC_MSG_RESULT(no)])
Sam Hocevar's avatar
   
Sam Hocevar committed
455

Sam Hocevar's avatar
   
Sam Hocevar committed
456
dnl Check for headers
457
458
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
459
460
AC_CHECK_HEADERS(dlfcn.h image.h)
AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
gbazin's avatar
   
gbazin committed
461
if test "x$SYS" != "xmingw32"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
462
AC_CHECK_HEADERS(machine/param.h sys/shm.h)
463
AC_CHECK_HEADERS(linux/version.h)
gbazin's avatar
   
gbazin committed
464
fi # end "x$SYS" != "xmingw32"
Sam Hocevar's avatar
   
Sam Hocevar committed
465

Sam Hocevar's avatar
   
Sam Hocevar committed
466
467
AC_HEADER_TIME

468
469
dnl Check for dirent
need_dirent=false
470
AC_CHECK_HEADERS(dirent.h,,[need_dirent=:])
471
472
AM_CONDITIONAL(BUILD_DIRENT, ${need_dirent})

473
dnl Mac OS X and other OSes don't have declaration for nanosleep
gbazin's avatar
   
gbazin committed
474
if test "x$SYS" != "xmingw32"; then
475
AC_MSG_CHECKING(for nanosleep in time.h)
476
AC_EGREP_HEADER(nanosleep,time.h,[
477
  AC_MSG_RESULT(yes)
478
479
  AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
            Define if <time.h> defines nanosleep.)
480
481
],[
  AC_MSG_RESULT(no)
482
])
gbazin's avatar
   
gbazin committed
483
fi # end "x$SYS" != "xmingw32"
484
485

dnl Make sure we have timespecs
486
AC_MSG_CHECKING(for timespec in sys/time.h)
487
AC_EGREP_HEADER(timespec,sys/time.h,[
488
  AC_MSG_RESULT(yes)
489
490
  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
            Define if <sys/time.h> defines struct timespec.)
491
492
],[
  AC_MSG_RESULT(no)
493
])
494

Sam Hocevar's avatar
   
Sam Hocevar committed
495
dnl Check for threads library
gbazin's avatar
   
gbazin committed
496
if test "x$SYS" != "xmingw32"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
497
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
gbazin's avatar
   
gbazin committed
498
fi # end "x$SYS" != "xmingw32"
Sam Hocevar's avatar
   
Sam Hocevar committed
499

500
501
dnl Default X headers and libraries
if test "x${x_includes}" = "xNONE"; then
502
  x_includes="/usr/X11R6/include"
503
504
fi
if test "x${x_libraries}" = "xNONE"; then
505
  x_libraries="/usr/X11R6/lib"
506
507
fi

508
dnl Build the gtk_main plugins?
509
NEED_GTK_MAIN=no
510
NEED_GNOME_MAIN=no
511
512
NEED_GTK2_MAIN=no
NEED_GNOME2_MAIN=no
513

514
515
516
dnl build the qte plugin ?
NEED_QTE_MAIN=no

Sam Hocevar's avatar
   
Sam Hocevar committed
517
dnl Check for ntohl, etc.
518
AC_CACHE_CHECK([for ntohl in sys/param.h],
519
520
521
522
523
    [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)])
524
if test "x${ac_cv_c_ntohl_sys_param_h}" != "xno"; then
525
    AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
526
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
527

Sam Hocevar's avatar
   
Sam Hocevar committed
528
dnl Check for inline function size limit
529
AC_CACHE_CHECK([if \$CC accepts -finline-limit],
530
531
532
    [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)])
533
if test "x${ac_cv_c_inline_limit}" != "xno"; then
534
535
536
    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}"
537
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
538

539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# 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

554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
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)])

584
585
586
587
588
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
589

590
if test "x${ac_cv_c_Wunreachable_code}" != "xno"; then
591
592
593
#    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}"
594

595
596
    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.
597
598
599
600
601
#    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
602
603
604
605
    if test "x${ac_cv_c_Winline}" != "xno"; then
        CXXFLAGS_save="-Winline ${CXXFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
    fi

606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
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
623
624
625
626
fi

dnl Check for -pipe
AC_CACHE_CHECK([if \$CC accepts -pipe],
627
628
629
    [ac_cv_c_pipe],
    [CFLAGS="${CFLAGS_save} -pipe"
     AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
630
if test "x${ac_cv_c_pipe}" != "xno"; then
631
632
633
    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
634
635
636
637
fi

dnl Check for various optimization flags
AC_CACHE_CHECK([if \$CC accepts -O3],
638
639
640
    [ac_cv_c_o3],
    [CFLAGS="${CFLAGS_save} -O3"
     AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
641
if test "x${ac_cv_c_o3}" != "xno"; then
642
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
643
644
645
646
647
648
649
650
fi

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
    if test "x${ac_cv_c_o3}" = "xno"; then
651
        CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
652
653
654
655
656
657
658
659
660
    fi
    CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -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
        if test "x${ac_cv_c_o3}" = "xno"; then
661
            CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
662
663
	fi
        CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O"
Sam Hocevar's avatar
   
Sam Hocevar committed
664
665
666
667
668
    fi
fi

dnl Check for -ffast-math
AC_CACHE_CHECK([if \$CC accepts -ffast-math],
669
670
671
    [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)])
672
if test "x${ac_cv_c_fast_math}" != "xno"; then
673
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
Sam Hocevar's avatar
   
Sam Hocevar committed
674
675
676
fi

dnl Check for -funroll-loops
677
678
679
680
681
682
683
684
685
686
dnl Disabled on BeOS because BeOS' gcc is buggy and may crash with it
if test "x${SYS}" != "xbeos"
then
  AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
      [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)])
  if test "x${ac_cv_c_unroll_loops}" != "xno"; then
      CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
  fi
Sam Hocevar's avatar
   
Sam Hocevar committed
687
688
689
690
fi

dnl Check for -fomit-frame-pointer
AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
691
692
693
    [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)])
694
if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
695
696
697
    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
698
699
fi

700
701
702
703
704
705
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
706
707
    CFLAGS_builtins="${CFLAGS_builtins} -mdynamic-no-pic"
    CFLAGS_libvlc="${CFLAGS_libvlc} -mdynamic-no-pic"
708
709
fi

Sam Hocevar's avatar
   
Sam Hocevar committed
710
dnl Check for Darwin plugin linking flags
Christophe Massiot's avatar
Christophe Massiot committed
711
AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
712
713
714
    [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)])
715
if test "x${ac_cv_ld_darwin}" != "xno"; then
716
    LDFLAGS_plugins="${LDFLAGS_plugins} -bundle -undefined error -lcc_dynamic"
717
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
718
719

dnl Check for standard plugin linking flags
720
AC_CACHE_CHECK([if \$CC accepts -shared],
721
722
723
    [ac_cv_ld_plugins],
    [CFLAGS="${CFLAGS_save} -shared"
     AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
724
if test "x${ac_cv_ld_plugins}" != "xno"; then
725
    LDFLAGS_plugins="${LDFLAGS_plugins} -shared"
Sam Hocevar's avatar
   
Sam Hocevar committed
726
fi
727

728
729
dnl Check for variadic macros
AC_CACHE_CHECK([for variadic cpp macros],
730
731
732
733
734
735
736
737
    [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)])
738
if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
739
    AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
740
741
fi

742
743
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
744
745
746
747
748
749
750
751
752
    [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}"])
753
if test "x${ac_cv_c_attribute_aligned}" != "x0"; then
754
755
    AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
        [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
756
757
fi

758
759
760
761
762
763
764
765
766
767
768
769
770
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
771
772
773
dnl
dnl  Check the CPU
dnl
774
case "x${target_cpu}" in
775
776
777
778
779
780
781
782
783
784
785
786
  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
787
esac
Sam Hocevar's avatar
   
Sam Hocevar committed
788

789
790
791
792
793
794
795
796
797
798
dnl
dnl  Enable profiling
dnl
AC_ARG_ENABLE(gprof,
[  --enable-gprof          gprof profiling (default disabled)])
AC_ARG_ENABLE(cprof,
[  --enable-cprof          cprof profiling (default disabled)])
AM_CONDITIONAL(GPROF, test "${enable_gprof}" = "yes")
AM_CONDITIONAL(CPROF, test "${enable_gprof}" = "yes")

Sam Hocevar's avatar
   
Sam Hocevar committed
799
800
801
dnl
dnl  default modules
dnl
802
#BUILTINS="${BUILTINS} mpeg_video idct idctclassic motion"
gbazin's avatar
   
gbazin committed
803
PLUGINS="${PLUGINS} dummy rc logger gestures memcpy"
gbazin's avatar
   
gbazin committed
804
PLUGINS="${PLUGINS} es audio m4v mpeg_system ps ts avi asf aac mp4 rawdv"
Jon Lech Johansen's avatar
Jon Lech Johansen committed
805
PLUGINS="${PLUGINS} spudec mpeg_audio lpcm a52 dts cinepak"
806
PLUGINS="${PLUGINS} deinterlace invert adjust wall transform distort clone crop motionblur"
807
PLUGINS="${PLUGINS} float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif dtstospdif fixed32tofloat32 fixed32tos16 s16tofixed32 s16tofloat32 s16tofloat32swab s8tofloat32 u8tofixed32 u8tofloat32"
gbazin's avatar
   
gbazin committed
808
PLUGINS="${PLUGINS} trivial_resampler ugly_resampler linear_resampler bandlimited_resampler"
809
PLUGINS="${PLUGINS} trivial_channel_mixer headphone_channel_mixer"
Christophe Massiot's avatar
Christophe Massiot committed
810
PLUGINS="${PLUGINS} trivial_mixer spdif_mixer float32_mixer"
811
812
813
PLUGINS="${PLUGINS} aout_file"
#PLUGINS="${PLUGINS} scope"
PLUGINS="${PLUGINS} i420_rgb i420_yuy2 i422_yuy2 i420_ymga"
814
PLUGINS="${PLUGINS} id3 m3u"
815
PLUGINS="${PLUGINS} rawvideo"
816
PLUGINS="${PLUGINS} wav araw demuxdump demuxsub adpcm a52sys au"
gbazin's avatar
   
gbazin committed
817
PLUGINS="${PLUGINS} access_file access_udp access_http ipv4 access_mms"
gbazin's avatar
   
gbazin committed
818
PLUGINS="${PLUGINS} access_ftp access_directory sap httpd http"
gbazin's avatar
   
gbazin committed
819
820
821
822

dnl
dnl Some plugins aren't useful on some platforms
dnl
gbazin's avatar
   
gbazin committed
823
if test "x${SYS}" != "xmingw32"; then
gbazin's avatar
   
gbazin committed
824
825
    PLUGINS="${PLUGINS} screensaver"
fi
826

Sam Hocevar's avatar
   
Sam Hocevar committed
827
828
829
dnl
dnl  Accelerated modules
dnl
830
831
832
833
MMX_MODULES="memcpymmx i420_rgb_mmx i422_yuy2_mmx i420_ymga_mmx"
#MMX_MODULES="${MMX_MODULES} idctmmx motionmmx"
MMXEXT_MODULES="memcpymmxext"
#MMXEXT_MODULES="${MMXEXT_MODULES} idctmmxext motionmmxext"
834
835
THREEDNOW_MODULES="memcpy3dn"
SSE_MODULES=""
836
837
ALTIVEC_MODULES="memcpyaltivec"
#ALTIVEC_MODULES="${ALTIVEC_MODULES} idctaltivec motionaltivec"
838

839
840
841
842
843
if test "${enable_gprof}" != "yes"
then
  MMX_MODULES="${MMX_MODULES} i420_yuy2_mmx"
fi

844
845
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
846
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
847
     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
848
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
849
if test "x${ac_cv_mmx_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
850
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
851
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
852

853
854
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
855
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
856
     AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
857
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
858
if test "x${ac_cv_mmxext_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
859
  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
860
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
861

862
863
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
864
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
865
     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
866
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
867
if test "x${ac_cv_3dnow_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
868
  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
869
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
870
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
871

872
873
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
874
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
875
     AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
876
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
877
if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
878
  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
879
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
880
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
881

882
if test "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
Sam Hocevar committed
883
AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
884
    [ac_cv_altivec_inline],
885
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
886
     AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
887
         ac_cv_altivec_inline=yes,
888
         [CFLAGS="${CFLAGS_save} -Wa,-m7400"
Sam Hocevar's avatar
   
Sam Hocevar committed
889
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
890
            [ac_cv_altivec_inline="-Wa,-m7400"],
891
            ac_cv_altivec_inline=no)
892
         ])])
893
if test "x${ac_cv_altivec_inline}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
894
  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
895
  if test "x${ac_cv_altivec_inline}" != "xyes"; then
896
897
898
899
    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}"
900
  fi
901
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
902
fi
903

Sam Hocevar's avatar
Sam Hocevar committed
904
AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
905
    [ac_cv_c_altivec],
906
    [CFLAGS="${CFLAGS_save} -faltivec"
907
     # Darwin test
Sam Hocevar's avatar
   
Sam Hocevar committed
908
     AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
909
910
        ac_cv_c_altivec=-faltivec, [
        # Linux/PPC test
911
        CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -fvec"
Sam Hocevar's avatar
   
Sam Hocevar committed
912
        AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
913
914
            [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
        ])
915
     CFLAGS="${CFLAGS_save}"])
916
if test "x${ac_cv_c_altivec}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
917
  AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
918
919
920
921
  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}"
922
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
923
924
925
926
fi

AC_CACHE_CHECK([if linker needs -framework vecLib],
    [ac_cv_ld_altivec],
927
    [LDFLAGS="${LDFLAGS_vlc} -framework vecLib"
928
     AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
929
     LDFLAGS="${LDFLAGS_save}"
930
    ])
931
if test "x${ac_cv_ld_altivec}" != "xno"; then
932
933
934
935
  LDFLAGS_idctaltivec="${LDFLAGS_idctaltivec} -framework vecLib"
  LDFLAGS_motionaltivec="${LDFLAGS_motionaltivec} -framework vecLib"
  LDFLAGS_memcpyaltivec="${LDFLAGS_memcpyaltivec} -framework vecLib"
  LDFLAGS_vlc="${LDFLAGS_vlc} -framework vecLib"
936
fi
gbazin's avatar
   
gbazin committed
937
fi # end "x$SYS" != "xmingw32"
938

Sam Hocevar's avatar
   
Sam Hocevar committed
939
940
941
AC_ARG_WITH(,[])
AC_ARG_WITH(,[Optimization options:])

Sam Hocevar's avatar
   
Sam Hocevar committed
942
dnl
943
dnl  Special arch tuning
Sam Hocevar's avatar
   
Sam Hocevar committed
944
dnl
945
AC_ARG_WITH(tuning,
Sam Hocevar's avatar
   
Sam Hocevar committed
946
[  --with-tuning=ARCH      enable special tuning for an architecture
947
                          (default i686 on IA-32 and 750 on PPC)])
948
if test "x${with_tuning}" != "x"; then
949
950
951
952
953
    if test "x${target_cpu}" = "xpowerpc"; then
        CFLAGS_TUNING="-mtune=${with_tuning}"
    else
        CFLAGS_TUNING="-mcpu=${with_tuning}"
    fi
954
else
955
    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"
956
    else
957
        if test "x${target_cpu}" = "xpowerpc"; then CFLAGS_TUNING="-mtune=750"; fi
958
959
    fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
960
961

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
962
dnl  x86 accelerations
Sam Hocevar's avatar
   
Sam Hocevar committed
963
dnl
964
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
965
966
then
    ARCH="${ARCH} mmx"
967
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"
Sam Hocevar's avatar
   
Sam Hocevar committed
968
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
969

Sam Hocevar's avatar
   
Sam Hocevar committed
970
971
972
973
dnl
dnl  Enable/disable optimizations
dnl
AC_ARG_ENABLE(optimizations,
974
975
[  --disable-optimizations disable compiler optimizations (default enabled)])
AM_CONDITIONAL(OPTIM, test "x${enable_optimizations}" != "xno")
Sam Hocevar's avatar
   
Sam Hocevar committed
976

Sam Hocevar's avatar
   
Sam Hocevar committed
977
978
979
dnl
dnl  AltiVec acceleration
dnl
980
AC_ARG_ENABLE(altivec,
Sam Hocevar's avatar
Sam Hocevar committed
981
[  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
982
[ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
983
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
984
[ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
985
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
986
987
988
989

dnl
dnl  Debugging mode
dnl
990
AC_ARG_ENABLE(debug,
991
992
[  --enable-debug          debug mode (default disabled)])
AM_CONDITIONAL(DEBUG, test "x${enable_debug}" = "xyes")
Sam Hocevar's avatar
   
Sam Hocevar committed
993

Sam Hocevar's avatar
   
Sam Hocevar committed
994
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
995
dnl  Enable release-specific flags
Sam Hocevar's avatar
   
Sam Hocevar committed
996
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
997
AC_ARG_ENABLE(release,
998
999
[  --enable-release        activate extra optimizations (default disabled)])
AM_CONDITIONAL(RELEASE, test "x${enable_release}" = "xyes")
Sam Hocevar's avatar
   
Sam Hocevar committed
1000

1001
1002
1003
1004
1005
1006
1007
dnl
dnl Stream output
dnl
AC_ARG_ENABLE(sout,
  [  --enable-sout           Stream output modules (default enabled)])
if test "x${enable_sout}" != "xno"
then
1008
  PLUGINS="${PLUGINS} access_output_dummy access_output_udp access_output_file access_output_http"
1009
  PLUGINS="${PLUGINS} mux_ts mux_ps mux_avi mux_dummy"
1010
  PLUGINS="${PLUGINS} packetizer_mpegaudio packetizer_mpegvideo packetizer_a52"
1011
1012
  PLUGINS="${PLUGINS} packetizer_mpeg4video packetizer_mpeg4audio"
  PLUGINS="${PLUGINS} packetizer_copy"
1013

1014
1015
  PLUGINS="${PLUGINS} stream_out_dummy stream_out_standard stream_out_es"
  PLUGINS="${PLUGINS} stream_out_duplicate stream_out_display"
1016
1017
1018
1019
1020
1021
1022

    dnl Ogg/ogm
    AC_CHECK_HEADERS(ogg/ogg.h, [
      AC_CHECK_LIB( ogg, ogg_stream_packetin, [
        PLUGINS="${PLUGINS} mux_ogg"
        LDFLAGS_mux_ogg="${LDFLAGS_mux_ogg} -logg" ])
    ],[])
1023
1024
1025
fi


Sam Hocevar's avatar
   
Sam Hocevar committed
1026
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
1027
dnl  Input plugins
Sam Hocevar's avatar
   
Sam Hocevar committed
1028
1029
dnl

Sam Hocevar's avatar
   
Sam Hocevar committed
1030
AC_ARG_WITH(,[Input plugins:])
Sam Hocevar's avatar
   
Sam Hocevar committed
1031
1032

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
1033
1034