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

Gildas Bazin's avatar
 
Gildas Bazin committed
3
AC_INIT(vlc,0.6.0)
4

Sam Hocevar's avatar
Sam Hocevar committed
5
CONFIGURE_LINE="$0 $*"
6
CODENAME="Trevelyan"
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.
Gildas Bazin's avatar
 
Gildas Bazin committed
15
AM_INIT_AUTOMAKE(vlc,0.6.0)
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)

Gildas Bazin's avatar
 
Gildas Bazin 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, :)
Gildas Bazin's avatar
 
Gildas Bazin 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

Gildas Bazin's avatar
 
Gildas Bazin committed
72 73 74
dnl
dnl  Check the operating system
dnl
Sam Hocevar's avatar
Sam Hocevar committed
75 76
case "${target_os}" in
  "")
77 78
    SYS=unknown
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
79
  linux*)
80 81
    SYS=linux
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
82
  bsdi*)
83 84 85
    SYS=bsdi
    CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
    LDFLAGS_dvd="${LDFLAGS_dvd} -ldvd"
Gildas Bazin's avatar
 
Gildas Bazin committed
86
    LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -ldvd"
87
    LDFLAGS_vcd="${LDFLAGS_vcd} -ldvd"
Gildas Bazin's avatar
 
Gildas Bazin committed
88
    LDFLAGS_cdda="${LDFLAGS_cdda} -ldvd"
89
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
90
  *bsd*)
91 92 93
    SYS="${target_os}"
    CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
94
  darwin*)
95
    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"
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
103
  *mingw32* | *cygwin*)
104 105
    AC_CHECK_TOOL(WINDRES, windres, :)
    LIBEXT=".dll"
Gildas Bazin's avatar
 
Gildas Bazin committed
106

Sam Hocevar's avatar
Sam Hocevar committed
107 108
    case "${target_os}" in
      *mingw32*)
Gildas Bazin's avatar
 
Gildas Bazin committed
109 110
        SYS=mingw32
        ;;
Sam Hocevar's avatar
Sam Hocevar committed
111
      *cygwin*)
Gildas Bazin's avatar
 
Gildas Bazin committed
112 113 114 115 116 117 118 119 120 121
        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

Sam Hocevar's avatar
Sam Hocevar committed
122
    if test "${SYS}" = "mingw32"; then
123
        # add ws2_32 for closesocket, select, recv
124
        CPPFLAGS_save="${CPPFLAGS_save} -D_OFF_T_ -D_off_t=long"
Gildas Bazin's avatar
 
Gildas Bazin committed
125
        CPPFLAGS="${CPPFLAGS_save}"
Gildas Bazin's avatar
 
Gildas Bazin committed
126
        LDFLAGS_vlc="${LDFLAGS_vlc} -lws2_32 -lnetapi32 -lwinmm -mwindows"
Gildas Bazin's avatar
 
Gildas Bazin committed
127 128
        LDFLAGS_ipv4="${LDFLAGS_ipv4} -lws2_32"
        LDFLAGS_ipv6="${LDFLAGS_ipv6} -lws2_32"
Gildas Bazin's avatar
 
Gildas Bazin 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"
Gildas Bazin's avatar
 
Gildas Bazin committed
136
        LDFLAGS_http="${LDFLAGS_http} -lws2_32"
Gildas Bazin's avatar
 
Gildas Bazin committed
137
        LDFLAGS_httpd="${LDFLAGS_httpd} -lws2_32"
Gildas Bazin's avatar
 
Gildas Bazin committed
138
    fi
139
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
140
  *nto*)
141 142 143 144
    SYS=nto
    LDFLAGS_x11="${LDFLAGS_x11} -lsocket"
    LDFLAGS_xvideo="${LDFLAGS_xvideo} -lsocket"
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
145
  solaris*)
146 147
    SYS=solaris
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
148
  hpux*)
149 150 151
    SYS=hpux
    LIBEXT=".sl"
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
152
  beos)
153
    SYS=beos
154 155
    CFLAGS_save="${CFLAGS_save} -Wno-multichar"; CFLAGS="${CFLAGS_save}"
    CXXFLAGS_save="${CXXFLAGS_save} -Wno-multichar"; CXXFLAGS="${CXXFLAGS_save}"
156
    LDFLAGS_vlc="${LDFLAGS_vlc} -lbe"
157 158
    CXXFLAGS_beos="${CXXFLAGS_beos}"
    LDFLAGS_beos="${LDFLAGS_beos} -lbe -lmedia -ltranslation -ltracker -lgame"
159 160 161 162 163 164
    dnl Check if we have BONE (old net_server doesn't have libsocket.so)
    AC_CHECK_LIB( socket, connect,
        LDFLAGS_vlc="${LDFLAGS_vlc} -lsocket -lbind" 
        LDFLAGS_access_mms="${LDFLAGS_access_mms} -lsocket -lbind"
        LDFLAGS_ipv4="${LDFLAGS_ipv4} -lsocket -lbind"
        LDFLAGS_httpd="${LDFLAGS_httpd} -lsocket -lbind" )
165
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
166
  *)
167 168
    SYS="${target_os}"
    ;;
Gildas Bazin's avatar
 
Gildas Bazin committed
169
esac
Sam Hocevar's avatar
Sam Hocevar committed
170 171 172
AM_CONDITIONAL(HAVE_BEOS, test "${SYS}" = "beos")
AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin")
AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
173

174 175 176
dnl
dnl Gettext stuff
dnl
177
ALL_LINGUAS="de en_GB fr it ja no ru nl pl sv"
Gildas Bazin's avatar
 
Gildas Bazin 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")
Derk-Jan Hartman's avatar
ALL:  
Derk-Jan Hartman committed
192
XGETTEXT="${XGETTEXT} --keyword=_NS --keyword=_ANS"
193

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

Gildas Bazin's avatar
 
Gildas Bazin committed
197
dnl Check for the need to include the mingwex lib for mingw32
Sam Hocevar's avatar
Sam Hocevar committed
198
if test "${SYS}" = "mingw32"
Gildas Bazin's avatar
 
Gildas Bazin committed
199 200 201
then
    AC_CHECK_LIB(mingwex,opendir,
        AC_CHECK_LIB(mingw32,opendir,LDFLAGS_vlc="${LDFLAGS_vlc}",
Gildas Bazin's avatar
 
Gildas Bazin committed
202 203
            [LDFLAGS_vlc="${LDFLAGS_vlc} -lmingwex"
             LDFLAGS_gtk="${LDFLAGS_gtk} -lmingwex"])
Gildas Bazin's avatar
 
Gildas Bazin committed
204 205 206
    )
fi

Gildas Bazin's avatar
 
Gildas Bazin committed
207
dnl Check for fnative-struct or mms-bitfields support for mingw32
Sam Hocevar's avatar
Sam Hocevar committed
208
if test "${SYS}" = "mingw32"
Gildas Bazin's avatar
 
Gildas Bazin committed
209 210 211 212 213
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)])
Sam Hocevar's avatar
Sam Hocevar committed
214
    if test "${ac_cv_c_mms_bitfields}" != "no"; then
215 216
        CFLAGS_save="${CFLAGS_save} -mms-bitfields";
        CXXFLAGS_save="${CXXFLAGS_save} -mms-bitfields";
Gildas Bazin's avatar
 
Gildas Bazin committed
217
    else
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)])
Sam Hocevar's avatar
Sam Hocevar committed
222
        if test "${ac_cv_c_fnative_struct}" != "no"; then
223 224 225
            CFLAGS_save="${CFLAGS_save} -fnative-struct";
            CXXFLAGS_save="${CXXFLAGS_save} -fnative-struct";
        fi
Gildas Bazin's avatar
 
Gildas Bazin committed
226 227
    fi

Gildas Bazin's avatar
 
Gildas Bazin committed
228 229 230 231
    CFLAGS="${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
fi

dnl Check for fvtable-thunks support for mingw32
Sam Hocevar's avatar
Sam Hocevar committed
232
if test "${SYS}" = "mingw32"
Gildas Bazin's avatar
 
Gildas Bazin committed
233 234 235 236 237 238 239
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)])
Sam Hocevar's avatar
Sam Hocevar committed
240
    if test "${ac_cv_cxx_fvtable_thunks}" = "yes"; then
Gildas Bazin's avatar
 
Gildas Bazin committed
241 242 243 244 245 246
        CXXFLAGS_mingw32_special="-fvtable-thunks"
    fi

    CXXFLAGS_save="${CXXFLAGS_save} ${CXXFLAGS_mingw32_special}"
    CXXFLAGS="${CXXFLAGS_save}"
AC_LANG_POP(C++)
Gildas Bazin's avatar
 
Gildas Bazin committed
247 248
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
249
dnl Flags for plugin compilation
Sam Hocevar's avatar
Sam Hocevar committed
250 251
case "${SYS}" in
  mingw32|cygwin)
Gildas Bazin's avatar
 
Gildas Bazin committed
252
    CFLAGS_pics="${CFLAGS_pics} ${CFLAGS_mingw32_special}"
Gildas Bazin's avatar
 
Gildas Bazin committed
253
    CXXFLAGS_pics="${CXXFLAGS_pics} ${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}"
Gildas Bazin's avatar
 
Gildas Bazin committed
254 255
    OBJCFLAGS_pics="${OBJCFLAGS_pics} ${CFLAGS_mingw32_special}"
    CFLAGS_plugins="${CFLAGS_plugins} ${CFLAGS_mingw32_special}"
Gildas Bazin's avatar
 
Gildas Bazin committed
256
    CXXFLAGS_plugins="${CXXFLAGS_plugins} ${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}"
Gildas Bazin's avatar
 
Gildas Bazin committed
257
    OBJCFLAGS_plugins="${OBJCFLAGS_plugins} ${CFLAGS_mingw32_special}"
258
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
259
  *)
260 261 262 263 264 265 266 267 268
    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
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 if_nametoindex atoll getenv putenv setenv gmtime_r)
277 278

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,
Gildas Bazin's avatar
 
Gildas Bazin 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"
Gildas Bazin's avatar
 
Gildas Bazin 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,,[
Gildas Bazin's avatar
 
Gildas Bazin committed
301
  AC_CHECK_LIB(nsl,gethostbyname,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lnsl" LDFLAGS_httpd="${LDFLAGS_httpd} -lnsl" LDFLAGS_vlc="${LDFLAGS_vlc} -lnsl",[
302
    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
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)])
Sam Hocevar's avatar
Sam Hocevar committed
313
if test "${ac_cv_type_socklen_t}" != "no"; then
314 315 316 317 318 319 320 321 322 323
  AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define if <sys/socket.h> defines socklen_t.])
fi

dnl Check for va_copy
AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy,
  AC_TRY_LINK(
    [#include <stdarg.h>],
    [va_list ap1, ap2; va_copy(ap1,ap2);],
    [ac_cv_c_va_copy="yes"],
    [ac_cv_c_va_copy="no"]))
Sam Hocevar's avatar
Sam Hocevar committed
324
if test "${ac_cv_c_va_copy}" = "yes"; then
325 326 327 328 329 330 331 332
  AC_DEFINE(HAVE_VA_COPY, 1, [Define if <stdarg.h> defines va_copy.])
fi
AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy,
  AC_TRY_LINK(
    [#include <stdarg.h>],
    [va_list ap1, ap2; __va_copy(ap1,ap2);],
    [ac_cv_c___va_copy="yes"],
    [ac_cv_c___va_copy="no"]))
Sam Hocevar's avatar
Sam Hocevar committed
333
if test "${ac_cv_c___va_copy}" = "yes"; then
334
  AC_DEFINE(HAVE___VA_COPY, 1, [Define if <stdarg.h> defines __va_copy.])
335 336
fi

337
AC_CHECK_FUNCS(inet_aton,,[
338
  AC_CHECK_LIB(resolv,inet_aton,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lresolv" LDFLAGS_httpd="${LDFLAGS_httpd} -lresolv")
339
])
Sam Hocevar's avatar
 
Sam Hocevar committed
340

Sam Hocevar's avatar
 
Sam Hocevar committed
341
dnl Check for getopt
342
need_getopt=false
343
AC_CHECK_FUNCS(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
Sam Hocevar's avatar
 
Sam Hocevar committed
344
[ # FreeBSD has a gnugetopt library for this:
345 346 347 348
  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
349

Sam Hocevar's avatar
Sam Hocevar committed
350
if test "${SYS}" != "mingw32"; then
351
AC_TYPE_SIGNAL
352
AC_CHECK_LIB(dl,dlopen,LDFLAGS_vlc="${LDFLAGS_vlc} -ldl")
Sam Hocevar's avatar
 
Sam Hocevar committed
353
AC_CHECK_LIB(m,cos,
354
  LDFLAGS_imdct="${LDFLAGS_imdct} -lm"
355 356
  LDFLAGS_adjust="${LDFLAGS_adjust} -lm"
  LDFLAGS_distort="${LDFLAGS_distort} -lm"
357
  LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -lm")
Sam Hocevar's avatar
 
Sam Hocevar committed
358
AC_CHECK_LIB(m,pow,
359
  LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lm"
360
  LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -lm"
361 362 363 364 365
  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
366
)
367 368 369
AC_CHECK_LIB(m,sqrt,
  LDFLAGS_headphone_channel_mixer="${LDFLAGS_headphone_channel_mixer} -lm"
)
Sam Hocevar's avatar
Sam Hocevar committed
370
fi # end "${SYS}" != "mingw32"
Sam Hocevar's avatar
 
Sam Hocevar committed
371

Sam Hocevar's avatar
Sam Hocevar committed
372
if test "${SYS}" != "mingw32"; then
Sam Hocevar's avatar
 
Sam Hocevar committed
373
dnl Check for pthreads - borrowed from XMMS
Sam Hocevar's avatar
 
Sam Hocevar committed
374
THREAD_LIB=error
Sam Hocevar's avatar
Sam Hocevar committed
375
if test "${THREAD_LIB}" = "error"; then
376
  AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
Sam Hocevar's avatar
 
Sam Hocevar committed
377
fi
Sam Hocevar's avatar
Sam Hocevar committed
378
if test "${THREAD_LIB}" = "error"; then
379
  AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
Sam Hocevar's avatar
 
Sam Hocevar committed
380
fi
Sam Hocevar's avatar
Sam Hocevar committed
381
if test "${THREAD_LIB}" = "error"; then
382
  AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
Sam Hocevar's avatar
 
Sam Hocevar committed
383
fi
Sam Hocevar's avatar
Sam Hocevar committed
384
if test "${THREAD_LIB}" = "error"; then
385
  AC_CHECK_FUNCS(pthread_mutex_lock)
386
  THREAD_LIB=""
Sam Hocevar's avatar
 
Sam Hocevar committed
387
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
388 389 390

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

Gildas Bazin's avatar
 
Gildas Bazin committed
392 393 394 395 396
dnl
dnl  GNU portable threads
dnl
AC_ARG_ENABLE(pth,
  [  --enable-pth            GNU Pth support (default disabled)],
Sam Hocevar's avatar
Sam Hocevar committed
397
  [ if test "${enable_pth}" = "yes"; then
Gildas Bazin's avatar
 
Gildas Bazin committed
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
    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)],
Sam Hocevar's avatar
Sam Hocevar committed
416
  [ if test "${enable_st}" = "yes"; then
Gildas Bazin's avatar
 
Gildas Bazin committed
417 418 419 420 421 422 423 424 425 426 427 428 429
    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
])

Gildas Bazin's avatar
 
Gildas Bazin committed
430 431
LDFLAGS_vlc="${LDFLAGS_vlc} ${THREAD_LIB}"
LDFLAGS_plugins="${LDFLAGS_plugins} ${THREAD_LIB}"
Gildas Bazin's avatar
 
Gildas Bazin committed
432 433

dnl Don't link with rt when using GNU-pth
Sam Hocevar's avatar
Sam Hocevar committed
434
if test "${THREAD_LIB}" != "-lpth" && test "${THREAD_LIB}" != "-lst"; then
Gildas Bazin's avatar
 
Gildas Bazin committed
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
  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
452
dnl Check for misc headers
453
AC_MSG_CHECKING(for pthread_cond_t in pthread.h)
Sam Hocevar's avatar
 
Sam Hocevar committed
454
AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
455
  AC_MSG_RESULT(yes)
456
  AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
457 458 459 460
            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
461
AC_EGREP_HEADER(pthread_once,pthread.h,[
462
  AC_MSG_RESULT(yes)
463
  AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
464 465
            Define if <pthread.h> defines pthread_once.)],[
  AC_MSG_RESULT(no)])
Sam Hocevar's avatar
Sam Hocevar committed
466
fi # end "${SYS}" != "mingw32"
467 468

AC_MSG_CHECKING(for strncasecmp in strings.h)
Sam Hocevar's avatar
 
Sam Hocevar committed
469
AC_EGREP_HEADER(strncasecmp,strings.h,[
470
  AC_MSG_RESULT(yes)
471
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
472 473
            Define if <strings.h> defines strncasecmp.)],[
  AC_MSG_RESULT(no)])
Sam Hocevar's avatar
 
Sam Hocevar committed
474

Sam Hocevar's avatar
 
Sam Hocevar committed
475
dnl Check for headers
476 477
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
478 479
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
480
if test "${SYS}" != "mingw32"; then
Sam Hocevar's avatar
 
Sam Hocevar committed
481
AC_CHECK_HEADERS(machine/param.h sys/shm.h)
482
AC_CHECK_HEADERS(linux/version.h)
Sam Hocevar's avatar
Sam Hocevar committed
483
fi # end "${SYS}" != "mingw32"
Sam Hocevar's avatar
 
Sam Hocevar committed
484

Sam Hocevar's avatar
 
Sam Hocevar committed
485 486
AC_HEADER_TIME

487 488
dnl Check for dirent
need_dirent=false
489
AC_CHECK_HEADERS(dirent.h,,[need_dirent=:])
490 491
AM_CONDITIONAL(BUILD_DIRENT, ${need_dirent})

492
dnl Mac OS X and other OSes don't have declaration for nanosleep
Sam Hocevar's avatar
Sam Hocevar committed
493
if test "${SYS}" != "mingw32"; then
494
AC_MSG_CHECKING(for nanosleep in time.h)
495
AC_EGREP_HEADER(nanosleep,time.h,[
496
  AC_MSG_RESULT(yes)
497 498
  AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
            Define if <time.h> defines nanosleep.)
499 500
],[
  AC_MSG_RESULT(no)
501
])
Sam Hocevar's avatar
Sam Hocevar committed
502
fi # end "${SYS}" != "mingw32"
503 504

dnl Make sure we have timespecs
505
AC_MSG_CHECKING(for timespec in sys/time.h)
506
AC_EGREP_HEADER(timespec,sys/time.h,[
507
  AC_MSG_RESULT(yes)
508 509
  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
            Define if <sys/time.h> defines struct timespec.)
510 511
],[
  AC_MSG_RESULT(no)
512
])
513

Sam Hocevar's avatar
 
Sam Hocevar committed
514
dnl Check for threads library
Sam Hocevar's avatar
Sam Hocevar committed
515
if test "${SYS}" != "mingw32"; then
Sam Hocevar's avatar
 
Sam Hocevar committed
516
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
Sam Hocevar's avatar
Sam Hocevar committed
517
fi # end "${SYS}" != "mingw32"
Sam Hocevar's avatar
 
Sam Hocevar committed
518

519
dnl Default X headers and libraries
Sam Hocevar's avatar
Sam Hocevar committed
520
if test "${x_includes}" = "NONE"; then
521
  x_includes="/usr/X11R6/include"
522
fi
Sam Hocevar's avatar
Sam Hocevar committed
523
if test "${x_libraries}" = "NONE"; then
524
  x_libraries="/usr/X11R6/lib"
525 526
fi

527
dnl Build the gtk_main plugins?
528
NEED_GTK_MAIN=no
529
NEED_GNOME_MAIN=no
530 531
NEED_GTK2_MAIN=no
NEED_GNOME2_MAIN=no
532

533 534 535
dnl build the qte plugin ?
NEED_QTE_MAIN=no

Sam Hocevar's avatar
 
Sam Hocevar committed
536
dnl Check for ntohl, etc.
537
AC_CACHE_CHECK([for ntohl in sys/param.h],
538 539 540 541 542
    [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)])
Sam Hocevar's avatar
Sam Hocevar committed
543
if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
544
    AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
545
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
546

Sam Hocevar's avatar
 
Sam Hocevar committed
547
dnl Check for inline function size limit
548
AC_CACHE_CHECK([if \$CC accepts -finline-limit],
549 550 551
    [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)])
Sam Hocevar's avatar
Sam Hocevar committed
552
if test "${ac_cv_c_inline_limit}" != "no"; then
553 554 555
    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}"
556
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
557

558 559 560 561 562 563 564 565
# 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)])
Sam Hocevar's avatar
Sam Hocevar committed
566
#    if test "${ac_cv_c_W${flag}}" != "no"; then
567 568 569 570 571 572
#        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

573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592
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)])

Sam Hocevar's avatar
Sam Hocevar committed
593
if test "${ac_cv_c_Wall}" != "no"; then
594 595 596 597
    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
598

Sam Hocevar's avatar
Sam Hocevar committed
599
if test "${ac_cv_c_Wsign_compare}" != "no"; then
600 601 602 603 604
    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

Sam Hocevar's avatar
 
Sam Hocevar committed
605 606
dnl Check for -pipe
AC_CACHE_CHECK([if \$CC accepts -pipe],
607 608 609
    [ac_cv_c_pipe],
    [CFLAGS="${CFLAGS_save} -pipe"
     AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
Sam Hocevar's avatar
Sam Hocevar committed
610
if test "${ac_cv_c_pipe}" != "no"; then
611 612 613
    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
614 615 616 617
fi

dnl Check for various optimization flags
AC_CACHE_CHECK([if \$CC accepts -O3],
618 619 620
    [ac_cv_c_o3],
    [CFLAGS="${CFLAGS_save} -O3"
     AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
Sam Hocevar's avatar
Sam Hocevar committed
621
if test "${ac_cv_c_o3}" != "no"; then
622
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
623 624 625 626 627 628
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)])
Sam Hocevar's avatar
Sam Hocevar committed
629 630
if test "${ac_cv_c_o2}" != "no"; then
    if test "${ac_cv_c_o3}" = "no"; then
631
        CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
632 633 634 635 636 637 638
    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)])
Sam Hocevar's avatar
Sam Hocevar committed
639 640
    if test "${ac_cv_c_o}" != "no"; then
        if test "${ac_cv_c_o3}" = "no"; then
641
            CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
642 643
	fi
        CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O"
Sam Hocevar's avatar
 
Sam Hocevar committed
644 645 646 647 648
    fi
fi

dnl Check for -ffast-math
AC_CACHE_CHECK([if \$CC accepts -ffast-math],
649 650 651
    [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)])
Sam Hocevar's avatar
Sam Hocevar committed
652
if test "${ac_cv_c_fast_math}" != "no"; then
653
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
Sam Hocevar's avatar
 
Sam Hocevar committed
654 655 656
fi

dnl Check for -funroll-loops
657
dnl Disabled on BeOS because BeOS' gcc is buggy and may crash with it
Sam Hocevar's avatar
Sam Hocevar committed
658
if test "${SYS}" != "beos"
659 660 661 662 663
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)])
Sam Hocevar's avatar
Sam Hocevar committed
664
  if test "${ac_cv_c_unroll_loops}" != "no"; then
665 666
      CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
  fi
Sam Hocevar's avatar
 
Sam Hocevar committed
667 668 669 670
fi

dnl Check for -fomit-frame-pointer
AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
671 672 673
    [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)])
Sam Hocevar's avatar
Sam Hocevar committed
674
if test "${ac_cv_c_omit_frame_pointer}" != "no"; then
675 676 677
    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
678 679
fi

680 681 682 683 684
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)])
Sam Hocevar's avatar
Sam Hocevar committed
685
if test "${ac_cv_c_dynamic_no_pic}" != "no"; then
Christophe Massiot's avatar
Christophe Massiot committed
686 687
    CFLAGS_builtins="${CFLAGS_builtins} -mdynamic-no-pic"
    CFLAGS_libvlc="${CFLAGS_libvlc} -mdynamic-no-pic"
688 689
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
690
dnl Check for Darwin plugin linking flags
Christophe Massiot's avatar
Christophe Massiot committed
691
AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
692 693 694
    [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)])
Sam Hocevar's avatar
Sam Hocevar committed
695
if test "${ac_cv_ld_darwin}" != "no"; then
696
    LDFLAGS_plugins="${LDFLAGS_plugins} -bundle -undefined error -lcc_dynamic"
697
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
698 699

dnl Check for standard plugin linking flags
700
dnl BeOS' gcc needs -nostart instead of -shared, even if -shared isn't harmful (just a warning)
Sam Hocevar's avatar
Sam Hocevar committed
701
if test "${SYS}" = "beos"; then
702 703 704 705 706 707
    LDFLAGS_plugins="${LDFLAGS_plugins} -nostart"
else
    AC_CACHE_CHECK([if \$CC accepts -shared],
        [ac_cv_ld_plugins],
        [CFLAGS="${CFLAGS_save} -shared"
         AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
Sam Hocevar's avatar
Sam Hocevar committed
708
    if test "${ac_cv_ld_plugins}" != "no"; then
709 710
        LDFLAGS_plugins="${LDFLAGS_plugins} -shared"
    fi
Sam Hocevar's avatar
 
Sam Hocevar committed
711
fi
712

713 714
dnl Check for variadic macros
AC_CACHE_CHECK([for variadic cpp macros],
715 716 717 718 719 720 721 722
    [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)])
Sam Hocevar's avatar
Sam Hocevar committed
723
if test "${ac_cv_cpp_variadic_macros}" != "no"; then
724
    AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
725 726
fi

727 728
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
729 730 731 732 733 734 735 736 737
    [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}"])
Sam Hocevar's avatar
Sam Hocevar committed
738
if test "${ac_cv_c_attribute_aligned}" != "0"; then
739 740
    AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
        [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
741 742
fi

743 744 745 746 747 748 749 750 751
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}"])
Sam Hocevar's avatar
Sam Hocevar committed
752
if test "${ac_cv_c_attribute_format}" != "no"; then
753 754 755
    AC_DEFINE(HAVE_ATTRIBUTE_FORMAT, 1, Support for __attribute__((format())) with function pointers)
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
756 757 758
dnl
dnl  Check the CPU
dnl
Sam Hocevar's avatar
Sam Hocevar committed
759 760
case "${target_cpu}" in
  "")
761 762 763 764 765 766 767 768 769
    ARCH=unknown
    ;;
  *)
    ARCH="${target_cpu}"
    ;;
esac

case "${ARCH}" in
  hppa64)
770
    CFLAGS_mpeg_video_old="${CFLAGS_mpeg_video_old} -ffunction-sections"
771
    ;;
Sam Hocevar's avatar
 
Sam Hocevar committed
772
esac
Sam Hocevar's avatar
 
Sam Hocevar committed
773

774 775 776 777 778 779 780 781 782 783
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
784 785 786
dnl
dnl  default modules
dnl
787
#BUILTINS="${BUILTINS} mpeg_video_old idct idctclassic motion"
Gildas Bazin's avatar
 
Gildas Bazin committed
788
PLUGINS="${PLUGINS} dummy rc logger gestures memcpy"
Gildas Bazin's avatar
 
Gildas Bazin committed
789
PLUGINS="${PLUGINS} es audio m4v mpeg_system ps ts avi asf aac mp4 rawdv"
Jon Lech Johansen's avatar
Jon Lech Johansen committed
790
PLUGINS="${PLUGINS} spudec mpeg_audio lpcm a52 dts cinepak"
791
PLUGINS="${PLUGINS} deinterlace invert adjust wall transform distort clone crop motionblur"
792
PLUGINS="${PLUGINS} float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif dtstospdif fixed32tofloat32 fixed32tos16 s16tofixed32 s16tofloat32 s16tofloat32swab s8tofloat32 u8tofixed32 u8tofloat32"
Gildas Bazin's avatar
 
Gildas Bazin committed
793
PLUGINS="${PLUGINS} trivial_resampler ugly_resampler linear_resampler bandlimited_resampler"
794
PLUGINS="${PLUGINS} trivial_channel_mixer headphone_channel_mixer"
Christophe Massiot's avatar
Christophe Massiot committed
795
PLUGINS="${PLUGINS} trivial_mixer spdif_mixer float32_mixer"
796 797 798
PLUGINS="${PLUGINS} aout_file"
#PLUGINS="${PLUGINS} scope"
PLUGINS="${PLUGINS} i420_rgb i420_yuy2 i422_yuy2 i420_ymga"
799
PLUGINS="${PLUGINS} id3 m3u"
800
PLUGINS="${PLUGINS} rawvideo"
801
PLUGINS="${PLUGINS} wav araw demuxdump demuxsub adpcm a52sys au"
Gildas Bazin's avatar
 
Gildas Bazin committed
802
PLUGINS="${PLUGINS} access_file access_udp access_http ipv4 access_mms"
Gildas Bazin's avatar
 
Gildas Bazin committed
803
PLUGINS="${PLUGINS} access_ftp access_directory sap httpd http"
Gildas Bazin's avatar
 
Gildas Bazin committed
804

Gildas Bazin's avatar
 
Gildas Bazin committed
805 806 807 808 809
dnl
dnl  Switch to enable a version of VLC where most modules will be builtin
dnl
AC_ARG_ENABLE(mostly-builtin,
[  --enable-mostly-builtin most modules will be built-in (default disabled)])
Sam Hocevar's avatar
Sam Hocevar committed
810
if test "${enable_mostly_builtin}" = "yes"; then
Gildas Bazin's avatar
 
Gildas Bazin committed
811 812 813 814
  BUILTINS="${BUILTINS} ${PLUGINS}"
  PLUGINS=""
fi

Gildas Bazin's avatar
 
Gildas Bazin committed
815 816 817
dnl
dnl Some plugins aren't useful on some platforms
dnl
Sam Hocevar's avatar
Sam Hocevar committed
818
if test "${SYS}" != "mingw32"; then
Gildas Bazin's avatar
 
Gildas Bazin committed
819 820
    PLUGINS="${PLUGINS} screensaver"
fi
821

Sam Hocevar's avatar
 
Sam Hocevar committed
822 823 824
dnl
dnl  Accelerated modules
dnl
825 826 827 828
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"
829 830
THREEDNOW_MODULES="memcpy3dn"
SSE_MODULES=""
831 832
ALTIVEC_MODULES="memcpyaltivec"
#ALTIVEC_MODULES="${ALTIVEC_MODULES} idctaltivec motionaltivec"
833

834 835 836 837 838
if test "${enable_gprof}" != "yes"
then
  MMX_MODULES="${MMX_MODULES} i420_yuy2_mmx"
fi

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

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

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

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

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

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