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

3
AC_INIT(vlc,0.5.2-test2)
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.2-test2)
15
16
AM_CONFIG_HEADER(config.h)

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

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

36
37
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.
38
AC_EGREP_CPP(foo,foo)
39

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

58
59
60
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL

61
62
63
64
dnl Check for compiler properties
AC_C_CONST
AC_C_INLINE

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

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

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

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

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

gbazin's avatar
   
gbazin committed
193
194
195
196
197
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
198
199
            [LDFLAGS_vlc="${LDFLAGS_vlc} -lmingwex"
             LDFLAGS_gtk="${LDFLAGS_gtk} -lmingwex"])
gbazin's avatar
   
gbazin committed
200
201
202
    )
fi

gbazin's avatar
   
gbazin committed
203
204
205
206
207
208
209
210
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
211
212
        CFLAGS_save="${CFLAGS_save} -mms-bitfields";
        CXXFLAGS_save="${CXXFLAGS_save} -mms-bitfields";
gbazin's avatar
   
gbazin committed
213
    else
214
215
216
217
218
219
220
221
        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
222
223
    fi

gbazin's avatar
   
gbazin committed
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
    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
243
244
fi

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

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

269
dnl Check for system libs needed
270
need_libc=false
271

272
273
274
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
275
AC_CHECK_FUNCS(strdup strndup atof lseek)
276
277
AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
Sam Hocevar's avatar
   
Sam Hocevar committed
278

279
AC_CHECK_FUNCS(connect,,[
280
281
282
  AC_CHECK_LIB(socket,connect,
    LDFLAGS_ipv4="${LDFLAGS_ipv4} -lsocket"
    LDFLAGS_vlc="${LDFLAGS_vlc} -lsocket"
Sam Hocevar's avatar
   
Sam Hocevar committed
283
)])
284

285
AC_CHECK_FUNCS(send,,[
286
  AC_CHECK_LIB(socket,send,
gbazin's avatar
   
gbazin committed
287
288
289
    LDFLAGS_access_http="${LDFLAGS_access_http} -lsocket"
    LDFLAGS_access_mms="${LDFLAGS_access_mms} -lsocket"
    LDFLAGS_access_udp="${LDFLAGS_access_udp} -lsocket"
290
    LDFLAGS_access_ftp="${LDFLAGS_access_ftp} -lsocket"
291
    LDFLAGS_sap="${LDFLAGS_sap} -lsocket"
292
    LDFLAGS_access_output_udp="${LDFLAGS_access_output_udp} -lsocket"
Sam Hocevar's avatar
Sam Hocevar committed
293
)])
294

295
AC_CHECK_FUNCS(gethostbyname,,[
296
297
  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
298
])
299

300
301
302
303
304
305
306
307
308
309
310
311
312
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

313
AC_CHECK_FUNCS(inet_aton,,[
314
  AC_CHECK_LIB(resolv,inet_aton,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lresolv" LDFLAGS_httpd="${LDFLAGS_httpd} -lresolv")
315
])
Sam Hocevar's avatar
   
Sam Hocevar committed
316

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

326
AC_TYPE_SIGNAL
327
AC_CHECK_LIB(dl,dlopen,LDFLAGS_vlc="${LDFLAGS_vlc} -ldl")
Sam Hocevar's avatar
   
Sam Hocevar committed
328
AC_CHECK_LIB(m,cos,
329
  LDFLAGS_imdct="${LDFLAGS_imdct} -lm"
330
331
  LDFLAGS_adjust="${LDFLAGS_adjust} -lm"
  LDFLAGS_distort="${LDFLAGS_distort} -lm"
332
  LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -lm")
Sam Hocevar's avatar
   
Sam Hocevar committed
333
AC_CHECK_LIB(m,pow,
334
335
336
337
338
339
  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
340
)
341
342
343
AC_CHECK_LIB(m,sqrt,
  LDFLAGS_headphone_channel_mixer="${LDFLAGS_headphone_channel_mixer} -lm"
)
Sam Hocevar's avatar
   
Sam Hocevar committed
344

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

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

gbazin's avatar
   
gbazin committed
364
365
366
367
368
369
370
371
372
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
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
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
])

if test "x${SYS}" != "xmingw32"; then
  LDFLAGS_vlc="${LDFLAGS_vlc} ${THREAD_LIB}"
  LDFLAGS_plugins="${LDFLAGS_plugins} ${THREAD_LIB}"
fi

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
426
dnl Check for misc headers
427
AC_MSG_CHECKING(for pthread_cond_t in pthread.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
428
AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
429
  AC_MSG_RESULT(yes)
430
  AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
431
432
433
434
            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
435
AC_EGREP_HEADER(pthread_once,pthread.h,[
436
  AC_MSG_RESULT(yes)
437
  AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
438
439
440
441
            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
442
AC_EGREP_HEADER(strncasecmp,strings.h,[
443
  AC_MSG_RESULT(yes)
444
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
445
446
            Define if <strings.h> defines strncasecmp.)],[
  AC_MSG_RESULT(no)])
Sam Hocevar's avatar
   
Sam Hocevar committed
447

Sam Hocevar's avatar
   
Sam Hocevar committed
448
dnl Check for headers
449
450
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
451
452
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
453
AC_CHECK_HEADERS(machine/param.h sys/shm.h)
454
AC_CHECK_HEADERS(linux/version.h)
Sam Hocevar's avatar
   
Sam Hocevar committed
455

Sam Hocevar's avatar
   
Sam Hocevar committed
456
457
AC_HEADER_TIME

458
459
dnl Check for dirent
need_dirent=false
460
AC_CHECK_HEADERS(dirent.h,,[need_dirent=:])
461
462
AM_CONDITIONAL(BUILD_DIRENT, ${need_dirent})

463
dnl Mac OS X and other OSes don't have declaration for nanosleep
464
AC_MSG_CHECKING(for nanosleep in time.h)
465
AC_EGREP_HEADER(nanosleep,time.h,[
466
  AC_MSG_RESULT(yes)
467
468
  AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
            Define if <time.h> defines nanosleep.)
469
470
],[
  AC_MSG_RESULT(no)
471
])
472
473

dnl Make sure we have timespecs
474
AC_MSG_CHECKING(for timespec in sys/time.h)
475
AC_EGREP_HEADER(timespec,sys/time.h,[
476
  AC_MSG_RESULT(yes)
477
478
  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
            Define if <sys/time.h> defines struct timespec.)
479
480
],[
  AC_MSG_RESULT(no)
481
])
482

Sam Hocevar's avatar
   
Sam Hocevar committed
483
484
485
dnl Check for threads library
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)

486
487
dnl Default X headers and libraries
if test "x${x_includes}" = "xNONE"; then
488
  x_includes="/usr/X11R6/include"
489
490
fi
if test "x${x_libraries}" = "xNONE"; then
491
  x_libraries="/usr/X11R6/lib"
492
493
fi

494
dnl Build the gtk_main plugins?
495
NEED_GTK_MAIN=no
496
NEED_GNOME_MAIN=no
497

498
499
500
dnl build the qte plugin ?
NEED_QTE_MAIN=no

Sam Hocevar's avatar
   
Sam Hocevar committed
501
dnl Check for DPMS
502
if test "x${SYS}" != "xmingw32"
Sam Hocevar's avatar
   
Sam Hocevar committed
503
then
504
505
  CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
  AC_CHECK_HEADERS(X11/extensions/dpms.h, [
506
    AC_MSG_CHECKING(for DPMSInfo in X11/extensions/dpms.h)
507
    AC_EGREP_HEADER(DPMSInfo,X11/extensions/dpms.h,[
508
      AC_MSG_RESULT(yes)
509
510
      AC_DEFINE(DPMSINFO_IN_DPMS_H, 1,
                Define if <X11/extensions/dpms.h> defines DPMSInfo.)
511
512
    ],[
      AC_MSG_RESULT(no)
513
    ])
514
515
  ],,[
    #include <X11/Xlib.h>
516
517
  ])
  CPPFLAGS="${CPPFLAGS_save}"
Sam Hocevar's avatar
   
Sam Hocevar committed
518
519
fi

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

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

542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# 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

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
584
585
586
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)])

587
588
589
590
591
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
592

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

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

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

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

dnl Check for various optimization flags
AC_CACHE_CHECK([if \$CC accepts -O3],
641
642
643
    [ac_cv_c_o3],
    [CFLAGS="${CFLAGS_save} -O3"
     AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
644
if test "x${ac_cv_c_o3}" != "xno"; then
645
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
646
647
648
649
650
651
652
653
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
654
        CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
655
656
657
658
659
660
661
662
663
    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
664
            CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
665
666
	fi
        CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O"
Sam Hocevar's avatar
   
Sam Hocevar committed
667
668
669
670
671
    fi
fi

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

dnl Check for -funroll-loops
AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
681
682
683
    [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)])
684
if test "x${ac_cv_c_unroll_loops}" != "xno"; then
685
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
Sam Hocevar's avatar
   
Sam Hocevar committed
686
687
688
689
fi

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

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

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

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

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

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

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

788
789
790
791
792
793
794
795
796
797
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
798
799
800
dnl
dnl  default modules
dnl
801
BUILTINS="${BUILTINS} mpeg_video idct idctclassic motion"
802
PLUGINS="${PLUGINS} dummy rc logger gestures access_file memcpy"
gbazin's avatar
   
gbazin committed
803
PLUGINS="${PLUGINS} es audio m4v mpeg_system ps ts avi asf aac mp4 rawdv"
804
PLUGINS="${PLUGINS} spudec mpeg_audio lpcm a52 cinepak"
805
PLUGINS="${PLUGINS} deinterlace invert adjust wall transform distort clone crop motionblur"
806
PLUGINS="${PLUGINS} float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif fixed32tofloat32 fixed32tos16 s16tofloat32 s16tofloat32swab s8tofloat32 u8tofixed32 u8tofloat32"
gbazin's avatar
   
gbazin committed
807
PLUGINS="${PLUGINS} trivial_resampler ugly_resampler linear_resampler bandlimited_resampler"
808
PLUGINS="${PLUGINS} trivial_channel_mixer headphone_channel_mixer"
Christophe Massiot's avatar
Christophe Massiot committed
809
PLUGINS="${PLUGINS} trivial_mixer spdif_mixer float32_mixer"
810
811
812
PLUGINS="${PLUGINS} aout_file"
#PLUGINS="${PLUGINS} scope"
PLUGINS="${PLUGINS} i420_rgb i420_yuy2 i422_yuy2 i420_ymga"
813
PLUGINS="${PLUGINS} id3 m3u"
814
PLUGINS="${PLUGINS} wav araw demuxdump demuxsub adpcm a52sys"
815
PLUGINS="${PLUGINS} access_udp access_http ipv4 access_mms access_ftp"
816
PLUGINS="${PLUGINS} sap screensaver"
817
PLUGINS="${PLUGINS} httpd"
818

Sam Hocevar's avatar
   
Sam Hocevar committed
819
820
821
dnl
dnl  Accelerated modules
dnl
822
MMX_MODULES="memcpymmx idctmmx motionmmx i420_rgb_mmx i422_yuy2_mmx i420_ymga_mmx"
823
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
824
825
THREEDNOW_MODULES="memcpy3dn"
SSE_MODULES=""
826
ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec"
827

828
829
830
831
832
if test "${enable_gprof}" != "yes"
then
  MMX_MODULES="${MMX_MODULES} i420_yuy2_mmx"
fi

833
834
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
835
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
836
     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
837
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
838
if test "x${ac_cv_mmx_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
839
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
840
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
841

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

851
852
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
853
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
854
     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
855
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
856
if test "x${ac_cv_3dnow_inline}" != "xno"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
857
  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
858
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
859
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
860

861
862
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
863
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
864
     AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
865
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
866
if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
   
Sam Hocevar committed
867
  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
Sam Hocevar's avatar
   
Sam Hocevar committed
868
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
869
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
870

Sam Hocevar's avatar
Sam Hocevar committed
871
# don't try to grok AltiVec with native mingw32 it doesn't work right now
gbazin's avatar
   
gbazin committed
872
# we should be able to remove this test with future versions of mingw32
873
if test "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
Sam Hocevar committed
874
AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
875
    [ac_cv_altivec_inline],
876
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
877
     AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
878
         ac_cv_altivec_inline=yes,
879
         [CFLAGS="${CFLAGS_save} -Wa,-m7400"
Sam Hocevar's avatar
   
Sam Hocevar committed
880
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
881
            [ac_cv_altivec_inline="-Wa,-m7400"],
882
            ac_cv_altivec_inline=no)
883
         ])])
884
if test "x${ac_cv_altivec_inline}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
885
  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
886
  if test "x${ac_cv_altivec_inline}" != "xyes"; then
887
888
889
890
    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}"
891
  fi
892
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
893
fi
894

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

AC_CACHE_CHECK([if linker needs -framework vecLib],
    [ac_cv_ld_altivec],
918
    [LDFLAGS="${LDFLAGS_vlc} -framework vecLib"
919
     AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
920
     LDFLAGS="${LDFLAGS_save}"
921
    ])
922
if test "x${ac_cv_ld_altivec}" != "xno"; then
923
924
925
926
  LDFLAGS_idctaltivec="${LDFLAGS_idctaltivec} -framework vecLib"
  LDFLAGS_motionaltivec="${LDFLAGS_motionaltivec} -framework vecLib"
  LDFLAGS_memcpyaltivec="${LDFLAGS_memcpyaltivec} -framework vecLib"
  LDFLAGS_vlc="${LDFLAGS_vlc} -framework vecLib"
927
fi
gbazin's avatar
   
gbazin committed
928
fi # end if mingw32
929

Sam Hocevar's avatar
   
Sam Hocevar committed
930
931
932
AC_ARG_WITH(,[])
AC_ARG_WITH(,[Optimization options:])

Sam Hocevar's avatar
   
Sam Hocevar committed
933
dnl
934
dnl  Special arch tuning
Sam Hocevar's avatar
   
Sam Hocevar committed
935
dnl
936
AC_ARG_WITH(tuning,
Sam Hocevar's avatar
   
Sam Hocevar committed
937
[  --with-tuning=ARCH      enable special tuning for an architecture
938
                          (default i686 on IA-32 and 750 on PPC)])
939
if test "x${with_tuning}" != "x"; then
940
941
942
943
944
    if test "x${target_cpu}" = "xpowerpc"; then
        CFLAGS_TUNING="-mtune=${with_tuning}"
    else
        CFLAGS_TUNING="-mcpu=${with_tuning}"
    fi
945
else
946
    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"
947
    else
948
        if test "x${target_cpu}" = "xpowerpc"; then CFLAGS_TUNING="-mtune=750"; fi
949
950
    fi
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
951
952

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
953
dnl  x86 accelerations
Sam Hocevar's avatar
   
Sam Hocevar committed
954
dnl
955
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
956
957
then
    ARCH="${ARCH} mmx"
958
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"
Sam Hocevar's avatar
   
Sam Hocevar committed
959
fi
Sam Hocevar's avatar
   
Sam Hocevar committed
960

Sam Hocevar's avatar
   
Sam Hocevar committed
961
962
963
964
dnl
dnl  Enable/disable optimizations
dnl
AC_ARG_ENABLE(optimizations,
965
966
[  --disable-optimizations disable compiler optimizations (default enabled)])
AM_CONDITIONAL(OPTIM, test "x${enable_optimizations}" != "xno")
Sam Hocevar's avatar
   
Sam Hocevar committed
967

Sam Hocevar's avatar
   
Sam Hocevar committed
968
969
970
dnl
dnl  AltiVec acceleration
dnl
971
AC_ARG_ENABLE(altivec,
Sam Hocevar's avatar
Sam Hocevar committed
972
[  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
973
[ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
974
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
975
[ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
976
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
   
Sam Hocevar committed
977
978
979
980

dnl
dnl  Debugging mode
dnl
981
AC_ARG_ENABLE(debug,
982
983
[  --enable-debug          debug mode (default disabled)])
AM_CONDITIONAL(DEBUG, test "x${enable_debug}" = "xyes")
Sam Hocevar's avatar
   
Sam Hocevar committed
984

Sam Hocevar's avatar
   
Sam Hocevar committed
985
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
986
dnl  Enable release-specific flags
Sam Hocevar's avatar
   
Sam Hocevar committed
987
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
988
AC_ARG_ENABLE(release,
989
990
[  --enable-release        activate extra optimizations (default disabled)])
AM_CONDITIONAL(RELEASE, test "x${enable_release}" = "xyes")
Sam Hocevar's avatar
   
Sam Hocevar committed
991

992
993
994
995
996
997
998
dnl
dnl Stream output
dnl
AC_ARG_ENABLE(sout,
  [  --enable-sout           Stream output modules (default enabled)])
if test "x${enable_sout}" != "xno"
then
999
  PLUGINS="${PLUGINS} access_output_dummy access_output_udp access_output_file access_output_http"
1000
  PLUGINS="${PLUGINS} mux_ts mux_ps mux_avi mux_dummy"
1001
  PLUGINS="${PLUGINS} packetizer_mpegaudio packetizer_mpegvideo packetizer_a52"
1002
1003
  PLUGINS="${PLUGINS} packetizer_mpeg4video packetizer_mpeg4audio"
  PLUGINS="${PLUGINS} packetizer_copy"
1004
1005

  PLUGINS="${PLUGINS} vout_encoder"
1006
1007
1008
1009
1010
1011
1012

    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" ])
    ],[])
1013
1014
1015
fi


Sam Hocevar's avatar
   
Sam Hocevar committed
1016
dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
1017
dnl  Input plugins
Sam Hocevar's avatar
   
Sam Hocevar committed
1018
1019
dnl

Sam Hocevar's avatar
   
Sam Hocevar committed
1020
AC_ARG_WITH(,[Input plugins:])
Sam Hocevar's avatar
   
Sam Hocevar committed
1021
1022

dnl
Sam Hocevar's avatar
   
Sam Hocevar committed
1023
1024
1025
1026
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
1027
if test "x${enable_dvd}" != "xno"
Sam Hocevar's avatar
   
Sam Hocevar committed
1028
then
1029
  AC_ARG_WITH(dvdcss,
Sam Hocevar's avatar
   
Sam Hocevar committed
1030
  [    --with-dvdcss=PATH    libdvdcss headers and libraries])
1031
  AC_ARG_WITH(dvdcss-tree,
Sam Hocevar's avatar
   
Sam Hocevar committed
1032
  [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
1033
  case "x${with_dvdcss}" in
Sam Hocevar's avatar
   
Sam Hocevar committed
1034
  x|xyes)
1035
    if test "x${with_dvdcss_tree}" = x
Sam Hocevar's avatar
   
Sam Hocevar committed
1036
1037
    then
      AC_CHECK_HEADERS(dvdcss/dvdcss.h,
1038
        [ PLUGINS="${PLUGINS} dvd"
1039
1040
          LDFLAGS_dvd="${LDFLAGS_dvd} -ldvdcss"
          LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -ldvdcss" ],
Sam Hocevar's avatar
   
Sam Hocevar committed
1041
1042
1043
1044
1045
        [ 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`"
1046
      if test "x${real_dvdcss_tree}" = "x"
Sam Hocevar's avatar