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

3
AC_INIT(vlc,0.5.0-cvs)
4

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

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

12 13
dnl XXX: we don't put any flags here, because automake 1.5 doesn't support
dnl them. And we need the comma otherwize automake will choke on it.
14
AM_INIT_AUTOMAKE(vlc,0.5.0-cvs)
15 16
AM_CONFIG_HEADER(config.h)

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

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

36 37 38 39 40 41 42 43 44 45 46 47
dnl AC_PROG_OBJC doesn't seem to exist, this is the KDE workaround
AC_MSG_CHECKING(for an Objective-C compiler)
OBJC="${CXX}"
AC_SUBST(OBJC)
OBJCFLAGS="${CXXFLAGS} -fgnu-runtime -fconstant-string-class=NSConstantString"
AC_SUBST(OBJCFLAGS)
dnl _AM_DEPENDENCIES(OBJC) doesn't work, so hard code OBJCDEPMODE here
#OBJCDEPMODE="depmode=gcc3"
#AC_SUBST(OBJCDEPMODE)
_AM_DEPENDENCIES(OBJC)
AC_MSG_RESULT(not implemented yet)

Gildas Bazin's avatar
 
Gildas Bazin committed
48 49
dnl Find the right ranlib, even when cross-compiling
AC_CHECK_TOOL(RANLIB, ranlib, :)
Sam Hocevar's avatar
 
Sam Hocevar committed
50
AC_CHECK_TOOL(STRIP, strip, :)
Gildas Bazin's avatar
 
Gildas Bazin committed
51

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

64 65 66
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL

67 68 69 70
dnl Check for compiler properties
AC_C_CONST
AC_C_INLINE

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

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

    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
125
        # add ws2_32 for closesocket, select, recv
Gildas Bazin's avatar
 
Gildas Bazin committed
126 127 128 129 130
        CPPFLAGS_save="${CPPFLAGS_save} -D_OFF_T_ -D_off_t=long"
        CPPFLAGS="${CPPFLAGS_save}"
        LDFLAGS_vlc="${LDFLAGS_vlc} -lws2_32 -lnetapi32 -mwindows"
        LDFLAGS_ipv4="${LDFLAGS_ipv4} -lws2_32"
        LDFLAGS_ipv6="${LDFLAGS_ipv6} -lws2_32"
Gildas Bazin's avatar
 
Gildas Bazin committed
131 132 133 134
        LDFLAGS_access_http="${LDFLAGS_access_http} -lws2_32"
        LDFLAGS_access_mms="${LDFLAGS_access_mms} -lws2_32"
        LDFLAGS_access_rtp="${LDFLAGS_access_rtp} -lws2_32"
        LDFLAGS_access_udp="${LDFLAGS_access_udp} -lws2_32"
Gildas Bazin's avatar
 
Gildas Bazin committed
135 136
        LDFLAGS_rc="${LDFLAGS_rc} -lws2_32"
    fi
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
    ;;
  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"
156
    LDFLAGS_beos="${LDFLAGS_beos} -lbe -lmedia -lroot -ltracker -lstdc++.r4 -ltranslation"
157 158 159 160 161
    LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind"
    ;;
  x*)
    SYS="${target_os}"
    ;;
Gildas Bazin's avatar
 
Gildas Bazin committed
162
esac
163 164 165 166 167 168
AM_CONDITIONAL(HAVE_BEOS, test "x${SYS}" = "xbeos")
AM_CONDITIONAL(HAVE_DARWIN, test "x${SYS}" = "xdarwin")
AM_CONDITIONAL(HAVE_WIN32, test "x${SYS}" = "xmingw32")

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

Gildas Bazin's avatar
 
Gildas Bazin committed
170 171 172 173 174
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}",
Gildas Bazin's avatar
 
Gildas Bazin committed
175 176
            [LDFLAGS_vlc="${LDFLAGS_vlc} -lmingwex"
             LDFLAGS_gtk="${LDFLAGS_gtk} -lmingwex"])
Gildas Bazin's avatar
 
Gildas Bazin committed
177 178 179
    )
fi

Gildas Bazin's avatar
 
Gildas Bazin committed
180 181 182 183 184 185 186 187 188 189 190 191 192
dnl Check for fnative-struct or mms-bitfields support for mingw32
if test x$SYS = xmingw32
then
    AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
        [ac_cv_c_mms_bitfields],
        [CFLAGS="${CFLAGS_save} -mms-bitfields"
         AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
    if test x"$ac_cv_c_mms_bitfields" != x"no"; then
        CFLAGS_mingw32_special="-mms-bitfields"
    else
        CFLAGS_mingw32_special="-fnative-struct"
    fi

Gildas Bazin's avatar
 
Gildas Bazin committed
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
    CFLAGS_save="${CFLAGS_save} ${CFLAGS_mingw32_special}";
    CXXFLAGS_save="${CXXFLAGS_save} ${CFLAGS_mingw32_special}";
    CFLAGS="${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
fi

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

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

Sam Hocevar's avatar
 
Sam Hocevar committed
216
dnl Flags for plugin compilation
217 218
case "x${SYS}" in
  xmingw32|xcygwin)
Gildas Bazin's avatar
 
Gildas Bazin committed
219
    CFLAGS_pics="${CFLAGS_pics} ${CFLAGS_mingw32_special}"
Gildas Bazin's avatar
 
Gildas Bazin committed
220
    CXXFLAGS_pics="${CXXFLAGS_pics} ${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}"
Gildas Bazin's avatar
 
Gildas Bazin committed
221 222
    OBJCFLAGS_pics="${OBJCFLAGS_pics} ${CFLAGS_mingw32_special}"
    CFLAGS_plugins="${CFLAGS_plugins} ${CFLAGS_mingw32_special}"
Gildas Bazin's avatar
 
Gildas Bazin committed
223
    CXXFLAGS_plugins="${CXXFLAGS_plugins} ${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}"
Gildas Bazin's avatar
 
Gildas Bazin committed
224
    OBJCFLAGS_plugins="${OBJCFLAGS_plugins} ${CFLAGS_mingw32_special}"
225 226 227 228 229 230 231 232 233 234 235
    ;;
  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
236 237

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

240
dnl Check for system libs needed
241
need_libc=false
242

243 244 245 246 247 248 249 250 251 252 253
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
AC_CHECK_FUNCS(strdup,,[need_libc=:])
AC_CHECK_FUNCS(strndup,,[need_libc=:])
AC_CHECK_FUNCS(atof,,[need_libc=:])
AC_CHECK_FUNCS(lseek,,[need_libc=:])
AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp,,[need_libc=:])])
AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp,,[need_libc=:])])

AM_CONDITIONAL(BUILD_LIBC, ${need_libc})
Sam Hocevar's avatar
 
Sam Hocevar committed
254

Sam Hocevar's avatar
 
Sam Hocevar committed
255
AC_CHECK_FUNC(connect,,[
256 257 258
  AC_CHECK_LIB(socket,connect,
    LDFLAGS_ipv4="${LDFLAGS_ipv4} -lsocket"
    LDFLAGS_vlc="${LDFLAGS_vlc} -lsocket"
Sam Hocevar's avatar
 
Sam Hocevar committed
259
)])
260

Sam Hocevar's avatar
Sam Hocevar committed
261
AC_CHECK_FUNC(send,,[
262
  AC_CHECK_LIB(socket,send,
Gildas Bazin's avatar
 
Gildas Bazin committed
263 264 265 266
    LDFLAGS_access_http="${LDFLAGS_access_http} -lsocket"
    LDFLAGS_access_mms="${LDFLAGS_access_mms} -lsocket"
    LDFLAGS_access_rtp="${LDFLAGS_access_rtp} -lsocket"
    LDFLAGS_access_udp="${LDFLAGS_access_udp} -lsocket"
Sam Hocevar's avatar
Sam Hocevar committed
267
)])
268

Sam Hocevar's avatar
 
Sam Hocevar committed
269
AC_CHECK_FUNC(gethostbyname,,[
270 271
  AC_CHECK_LIB(nsl,gethostbyname,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lnsl",[
    AC_CHECK_LIB(bind,gethostbyname,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind")])
Sam Hocevar's avatar
 
Sam Hocevar committed
272
])
273 274 275

have_nanosleep=false
AC_CHECK_FUNC(nanosleep,have_nanosleep=:,[
276
  AC_CHECK_LIB(rt,nanosleep,
277
    [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"; have_nanosleep=:],
278
    [AC_CHECK_LIB(posix4,nanosleep,
279
        [LDFLAGS_vlc="${LDFLAGS_vlc} -lposix4"; have_nanosleep=:])]
280
  )
Sam Hocevar's avatar
 
Sam Hocevar committed
281
])
282 283 284
if ${have_nanosleep}; then
  AC_DEFINE(HAVE_NANOSLEEP, 1,
            Define if nanosleep is available.)
285
fi
286
# HP/UX port
287
AC_CHECK_LIB(rt,sem_init, [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"])
288

Sam Hocevar's avatar
 
Sam Hocevar committed
289
AC_CHECK_FUNC(inet_aton,,[
290
  AC_CHECK_LIB(resolv,inet_aton,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lresolv")
291 292
])
AC_CHECK_FUNC(textdomain,,[
293 294 295 296
  AC_CHECK_LIB(intl,textdomain,
    LDFLAGS_vlc="${LDFLAGS_vlc} -lintl"
    LDFLAGS_plugins="${LDFLAGS_plugins} -lintl"
  )
Sam Hocevar's avatar
 
Sam Hocevar committed
297
])
Sam Hocevar's avatar
 
Sam Hocevar committed
298

Sam Hocevar's avatar
 
Sam Hocevar committed
299
dnl Check for getopt
300
need_getopt=false
Sam Hocevar's avatar
 
Sam Hocevar committed
301 302
AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
[ # FreeBSD has a gnugetopt library for this:
303 304 305 306
  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
307

308
AC_TYPE_SIGNAL
309
AC_CHECK_LIB(dl,dlopen,LDFLAGS_vlc="${LDFLAGS_vlc} -ldl")
Sam Hocevar's avatar
 
Sam Hocevar committed
310
AC_CHECK_LIB(m,cos,
311 312
  LDFLAGS_imdct="${LDFLAGS_imdct} -lm"
  LDFLAGS_filter_distort="${LDFLAGS_filter_distort} -lm")
Sam Hocevar's avatar
 
Sam Hocevar committed
313
AC_CHECK_LIB(m,pow,
314 315 316 317 318 319
  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
320
)
Sam Hocevar's avatar
 
Sam Hocevar committed
321

Sam Hocevar's avatar
 
Sam Hocevar committed
322
dnl Check for pthreads - borrowed from XMMS
Sam Hocevar's avatar
 
Sam Hocevar committed
323
THREAD_LIB=error
324
if test "x${THREAD_LIB}" = "xerror"; then
325
  AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
Sam Hocevar's avatar
 
Sam Hocevar committed
326
fi
327
if test "x${THREAD_LIB}" = "xerror"; then
328
  AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
Sam Hocevar's avatar
 
Sam Hocevar committed
329
fi
330
if test "x${THREAD_LIB}" = "xerror"; then
331
  AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
Sam Hocevar's avatar
 
Sam Hocevar committed
332
fi
333
if test "x${THREAD_LIB}" = "xerror"; then
334 335
  AC_CHECK_FUNC(pthread_mutex_lock)
  THREAD_LIB=""
Sam Hocevar's avatar
 
Sam Hocevar committed
336
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
337 338 339

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

Sam Hocevar's avatar
 
Sam Hocevar committed
341 342
dnl Check for misc headers
AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
343 344
  AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
            Define if <pthread.h> defines pthread_cond_t.)])
Sam Hocevar's avatar
Sam Hocevar committed
345
AC_EGREP_HEADER(pthread_once,pthread.h,[
346 347
  AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
            Define if <pthread.h> defines pthread_once.)])
Sam Hocevar's avatar
 
Sam Hocevar committed
348
AC_EGREP_HEADER(strncasecmp,strings.h,[
349 350
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
            Define if <strings.h> defines strncasecmp.)])
Sam Hocevar's avatar
 
Sam Hocevar committed
351

Sam Hocevar's avatar
 
Sam Hocevar committed
352
dnl Check for headers
353 354
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
355 356
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
357
AC_CHECK_HEADERS(machine/param.h sys/shm.h)
358
AC_CHECK_HEADERS(linux/version.h)
Sam Hocevar's avatar
 
Sam Hocevar committed
359

Sam Hocevar's avatar
 
Sam Hocevar committed
360 361
AC_HEADER_TIME

362 363
dnl Check for dirent
need_dirent=false
364
AC_CHECK_HEADERS(dirent.h,,[need_dirent=:])
365 366
AM_CONDITIONAL(BUILD_DIRENT, ${need_dirent})

367
dnl Mac OS X and other OSes don't have declaration for nanosleep
368
AC_EGREP_HEADER(nanosleep,time.h,[
369 370
  AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
            Define if <time.h> defines nanosleep.)
371
])
372 373

dnl Make sure we have timespecs
374
AC_EGREP_HEADER(timespec,sys/time.h,[
375 376
  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
            Define if <sys/time.h> defines struct timespec.)
377
])
378

Sam Hocevar's avatar
 
Sam Hocevar committed
379 380 381
dnl Check for threads library
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)

382 383
dnl Default X headers and libraries
if test "x${x_includes}" = "xNONE"; then
384
  x_includes="/usr/X11R6/include"
385 386
fi
if test "x${x_libraries}" = "xNONE"; then
387
  x_libraries="/usr/X11R6/lib"
388 389
fi

390
dnl Build the gtk_main plugins?
391
NEED_GTK_MAIN=no
392
NEED_GNOME_MAIN=no
393

Sam Hocevar's avatar
 
Sam Hocevar committed
394
dnl Check for DPMS
395
if test "x${SYS}" != "xmingw32"
Sam Hocevar's avatar
 
Sam Hocevar committed
396
then
397 398 399 400 401 402 403 404
  CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
  AC_CHECK_HEADERS(X11/extensions/dpms.h, [
    AC_EGREP_HEADER(DPMSInfo,X11/extensions/dpms.h,[
      AC_DEFINE(DPMSINFO_IN_DPMS_H, 1,
                Define if <X11/extensions/dpms.h> defines DPMSInfo.)
    ])
  ])
  CPPFLAGS="${CPPFLAGS_save}"
Sam Hocevar's avatar
 
Sam Hocevar committed
405 406
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
407
dnl Check for ntohl, etc.
408
AC_CACHE_CHECK([for ntohl in sys/param.h],
409 410 411 412 413
    [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)])
414
if test "x${ac_cv_c_ntohl_sys_param_h}" != "xno"; then
415
    AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
416
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
417

Sam Hocevar's avatar
 
Sam Hocevar committed
418
dnl Check for inline function size limit
419
AC_CACHE_CHECK([if \$CC accepts -finline-limit],
420 421 422
    [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)])
423
if test "x${ac_cv_c_inline_limit}" != "xno"; then
424 425 426
    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}"
427
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
428

Sam Hocevar's avatar
 
Sam Hocevar committed
429 430
dnl Check for -W or -w flags
AC_CACHE_CHECK([if \$CC accepts -Wall -Winline],
431 432 433
    [ac_cv_c_Wall_Winline],
    [CFLAGS="-Wall -Winline ${CFLAGS_save}"
     AC_TRY_COMPILE([],,ac_cv_c_Wall_Winline=yes, ac_cv_c_Wall_Winline=no)])
434
if test "x${ac_cv_c_Wall_Winline}" != "xno"; then
435
    CFLAGS_save="-Wall -Winline ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
Gildas Bazin's avatar
 
Gildas Bazin committed
436
    CXXFLAGS_save="-Wall ${CXXFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
437
    OBJCFLAGS_save="-Wall -Winline ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
Sam Hocevar's avatar
 
Sam Hocevar committed
438
else
439 440 441 442 443 444 445 446 447
    AC_CACHE_CHECK([if \$CC accepts -wall -winline],
        [ac_cv_c_wall_winline],
        [CFLAGS="-wall -winline ${CFLAGS_save}"
         AC_TRY_COMPILE([],,ac_cv_c_wall_winline=yes, ac_cv_c_wall_winline=no)])
    if test "x${ac_cv_c_wall_winline}" != "xno"; then
        CFLAGS_save="-wall -winline ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
        CXXFLAGS_save="-wall -winline ${CXXFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
        OBJCFLAGS_save="-wall -winline ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
    fi
Sam Hocevar's avatar
 
Sam Hocevar committed
448 449 450 451
fi

dnl Check for -pipe
AC_CACHE_CHECK([if \$CC accepts -pipe],
452 453 454
    [ac_cv_c_pipe],
    [CFLAGS="${CFLAGS_save} -pipe"
     AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
455
if test "x${ac_cv_c_pipe}" != "xno"; then
456 457 458
    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
459 460 461 462
fi

dnl Check for various optimization flags
AC_CACHE_CHECK([if \$CC accepts -O3],
463 464 465
    [ac_cv_c_o3],
    [CFLAGS="${CFLAGS_save} -O3"
     AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
466
if test "x${ac_cv_c_o3}" != "xno"; then
467
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
468
else
469 470 471 472 473 474 475 476 477 478 479 480 481 482
    AC_CACHE_CHECK([if \$CC accepts -O2],
        [ac_cv_c_o2],
        [CFLAGS="${CFLAGS_save} -O2"
         AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)])
    if test "x${ac_cv_c_o2}" != "xno"; then
        CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
    else
        AC_CACHE_CHECK([if \$CC accepts -O],
            [ac_cv_c_o],
            [CFLAGS="${CFLAGS_save} -O"
             AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
        if test "x${ac_cv_c_o}" != "xno"; then
            CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
        fi
Sam Hocevar's avatar
 
Sam Hocevar committed
483 484 485 486 487
    fi
fi

dnl Check for -ffast-math
AC_CACHE_CHECK([if \$CC accepts -ffast-math],
488 489 490
    [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)])
491
if test "x${ac_cv_c_fast_math}" != "xno"; then
492
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
Sam Hocevar's avatar
 
Sam Hocevar committed
493 494 495 496
fi

dnl Check for -funroll-loops
AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
497 498 499
    [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)])
500
if test "x${ac_cv_c_unroll_loops}" != "xno"; then
501
    CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
Sam Hocevar's avatar
 
Sam Hocevar committed
502 503 504 505
fi

dnl Check for -fomit-frame-pointer
AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
506 507 508
    [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)])
509
if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
510 511 512
    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
513 514
fi

515 516 517 518 519 520
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
521 522
    CFLAGS_builtins="${CFLAGS_builtins} -mdynamic-no-pic"
    CFLAGS_libvlc="${CFLAGS_libvlc} -mdynamic-no-pic"
523 524
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
525
dnl Check for Darwin plugin linking flags
Christophe Massiot's avatar
Christophe Massiot committed
526
AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
527 528 529
    [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)])
530
if test "x${ac_cv_ld_darwin}" != "xno"; then
531
    LDFLAGS_plugins="${LDFLAGS_plugins} -bundle -undefined error -lcc_dynamic"
532
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
533 534

dnl Check for standard plugin linking flags
535
AC_CACHE_CHECK([if \$CC accepts -shared],
536 537 538
    [ac_cv_ld_plugins],
    [CFLAGS="${CFLAGS_save} -shared"
     AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
539
if test "x${ac_cv_ld_plugins}" != "xno"; then
540
    LDFLAGS_plugins="${LDFLAGS_plugins} -shared"
Sam Hocevar's avatar
 
Sam Hocevar committed
541
fi
542

543 544
dnl Check for variadic macros
AC_CACHE_CHECK([for variadic cpp macros],
545 546 547 548 549 550 551 552
    [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)])
553
if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
554
    AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
555 556
fi

557 558
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
559 560 561 562 563 564 565 566 567
    [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}"])
568
if test "x${ac_cv_c_attribute_aligned}" != "x0"; then
569 570
    AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
        [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
571 572
fi

Sam Hocevar's avatar
 
Sam Hocevar committed
573 574 575
dnl
dnl  Check the CPU
dnl
576
case "x${target_cpu}" in
577 578 579 580 581 582 583 584 585 586 587 588
  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
589
esac
Sam Hocevar's avatar
 
Sam Hocevar committed
590 591 592 593

dnl
dnl  default modules
dnl
594
PLUGINS="${PLUGINS} dummy rc logger access_file memcpy"
595 596 597
PLUGINS="${PLUGINS} es audio mpeg_system ps ts"
PLUGINS="${PLUGINS} idct idctclassic motion mpeg_video spudec mpeg_audio"
#PLUGINS="${PLUGINS} a52old imdct downmix"
598
PLUGINS="${PLUGINS} lpcm a52"
599
PLUGINS="${PLUGINS} deinterlace invert yuv wall transform distort clone crop motionblur"
600
PLUGINS="${PLUGINS} float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif fixed32tofloat32 fixed32tos16 s16tofloat32 s16tofloat32swab s8tofloat32 u8tofixed32 u8tofloat32"
601
PLUGINS="${PLUGINS} trivial_resampler ugly_resampler linear_resampler"
602
PLUGINS="${PLUGINS} trivial_channel_mixer"
Christophe Massiot's avatar
Christophe Massiot committed
603
PLUGINS="${PLUGINS} trivial_mixer spdif_mixer float32_mixer"
604 605 606
PLUGINS="${PLUGINS} aout_file"
#PLUGINS="${PLUGINS} scope"
PLUGINS="${PLUGINS} i420_rgb i420_yuy2 i422_yuy2 i420_ymga"
607
PLUGINS="${PLUGINS} id3 m3u"
608
PLUGINS="${PLUGINS} wav araw demuxdump demuxsub"
609

610 611 612
dnl
dnl  Network modules
dnl
613
NETWORK_MODULES="access_udp access_http access_rtp ipv4 access_mms"
614

Sam Hocevar's avatar
 
Sam Hocevar committed
615 616 617
dnl
dnl  Accelerated modules
dnl
618 619 620 621 622
MMX_MODULES="memcpymmx idctmmx motionmmx i420_rgb_mmx i420_yuy2_mmx i422_yuy2_mmx i420_ymga_mmx"
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
SSE_MODULES="imdctsse downmixsse"
ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec"
623

624
if test x${SYS} != xbeos
625
then
626
  PLUGINS="${PLUGINS} ${NETWORK_MODULES}"
627 628
fi

629 630
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
    [ac_cv_mmx_inline],
631
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
632
     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
633
                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
634
if test "x${ac_cv_mmx_inline}" != "xno"; then
Sam Hocevar's avatar
 
Sam Hocevar committed
635
  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
636
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
637

638 639
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
    [ac_cv_mmxext_inline],
640
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
641
     AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
642
                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
643
if test "x${ac_cv_mmxext_inline}" != "xno"; then
Sam Hocevar's avatar
 
Sam Hocevar committed
644
  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
645
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
646

647 648
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
    [ac_cv_3dnow_inline],
649
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
650
     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
651
                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
652
if test "x${ac_cv_3dnow_inline}" != "xno"; then
Sam Hocevar's avatar
 
Sam Hocevar committed
653
  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
Sam Hocevar's avatar
 
Sam Hocevar committed
654
  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
655
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
656

657 658
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
    [ac_cv_sse_inline],
659
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
660
     AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
661
                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
662
if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
 
Sam Hocevar committed
663
  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
Sam Hocevar's avatar
 
Sam Hocevar committed
664
  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
665
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
666

Sam Hocevar's avatar
Sam Hocevar committed
667
# don't try to grok AltiVec with native mingw32 it doesn't work right now
Gildas Bazin's avatar
 
Gildas Bazin committed
668
# we should be able to remove this test with future versions of mingw32
669
if test "x${SYS}" != "xmingw32"; then
Sam Hocevar's avatar
Sam Hocevar committed
670
AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
671
    [ac_cv_altivec_inline],
672
    [CFLAGS="${CFLAGS_save}"
Sam Hocevar's avatar
Sam Hocevar committed
673
     AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
674
         ac_cv_altivec_inline=yes,
675
         [CFLAGS="${CFLAGS_save} -Wa,-m7400"
Sam Hocevar's avatar
 
Sam Hocevar committed
676
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
677
            [ac_cv_altivec_inline="-Wa,-m7400"],
678
            ac_cv_altivec_inline=no)
679
         ])])
680
if test "x${ac_cv_altivec_inline}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
681
  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
682
  if test "x${ac_cv_altivec_inline}" != "xyes"; then
683 684 685 686
    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}"
687
  fi
688
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
689
fi
690

Sam Hocevar's avatar
Sam Hocevar committed
691
AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
692
    [ac_cv_c_altivec],
693
    [CFLAGS="${CFLAGS_save} -faltivec"
694
     # Darwin test
Sam Hocevar's avatar
 
Sam Hocevar committed
695
     AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
696 697
        ac_cv_c_altivec=-faltivec, [
        # Linux/PPC test
698
        CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -fvec"
Sam Hocevar's avatar
 
Sam Hocevar committed
699
        AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
700 701
            [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
        ])
702
     CFLAGS="${CFLAGS_save}"])
703
if test "x${ac_cv_c_altivec}" != "xno"; then
Sam Hocevar's avatar
Sam Hocevar committed
704
  AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
705 706 707 708
  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}"
709
  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
710 711 712 713
fi

AC_CACHE_CHECK([if linker needs -framework vecLib],
    [ac_cv_ld_altivec],
714
    [LDFLAGS="${LDFLAGS_vlc} -framework vecLib"
715
     AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
716
     LDFLAGS="${LDFLAGS_save}"
717
    ])
718
if test "x${ac_cv_ld_altivec}" != "xno"; then
719 720 721 722
  LDFLAGS_idctaltivec="${LDFLAGS_idctaltivec} -framework vecLib"
  LDFLAGS_motionaltivec="${LDFLAGS_motionaltivec} -framework vecLib"
  LDFLAGS_memcpyaltivec="${LDFLAGS_memcpyaltivec} -framework vecLib"
  LDFLAGS_vlc="${LDFLAGS_vlc} -framework vecLib"
723
fi
Gildas Bazin's avatar
 
Gildas Bazin committed
724
fi # end if mingw32
725

Sam Hocevar's avatar
 
Sam Hocevar committed
726 727 728
AC_ARG_WITH(,[])
AC_ARG_WITH(,[Optimization options:])

Sam Hocevar's avatar
 
Sam Hocevar committed
729
dnl
730
dnl  Special arch tuning
Sam Hocevar's avatar
 
Sam Hocevar committed
731
dnl
732
AC_ARG_WITH(tuning,
Sam Hocevar's avatar
 
Sam Hocevar committed
733
[  --with-tuning=ARCH      enable special tuning for an architecture
734
                          (default i686 on IA-32 and 750 on PPC)])
735
if test "x${with_tuning}" != "x"; then
736 737 738 739 740
    if test "x${target_cpu}" = "xpowerpc"; then
        CFLAGS_TUNING="-mtune=${with_tuning}"
    else
        CFLAGS_TUNING="-mcpu=${with_tuning}"
    fi
741
else
742
    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"
743
    else
744
        if test "x${target_cpu}" = "xpowerpc"; then CFLAGS_TUNING="-mtune=750"; fi
745 746
    fi
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
747 748

dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
749
dnl  x86 accelerations
Sam Hocevar's avatar
 
Sam Hocevar committed
750
dnl
751
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
752 753
then
    ARCH="${ARCH} mmx"
Sam Hocevar's avatar
Sam Hocevar committed
754
    PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
Sam Hocevar's avatar
 
Sam Hocevar committed
755
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
756

Sam Hocevar's avatar
 
Sam Hocevar committed
757 758 759 760
dnl
dnl  Enable/disable optimizations
dnl
AC_ARG_ENABLE(optimizations,
761 762
[  --disable-optimizations disable compiler optimizations (default enabled)])
AM_CONDITIONAL(OPTIM, test "x${enable_optimizations}" != "xno")
Sam Hocevar's avatar
 
Sam Hocevar committed
763

Sam Hocevar's avatar
 
Sam Hocevar committed
764 765 766
dnl
dnl  AltiVec acceleration
dnl
767
AC_ARG_ENABLE(altivec,
Sam Hocevar's avatar
Sam Hocevar committed
768
[  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
769
[ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
770
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
771
[ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
772
    BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
Sam Hocevar's avatar
 
Sam Hocevar committed
773 774 775 776

dnl
dnl  Debugging mode
dnl
777
AC_ARG_ENABLE(debug,
778 779
[  --enable-debug          debug mode (default disabled)])
AM_CONDITIONAL(DEBUG, test "x${enable_debug}" = "xyes")
Sam Hocevar's avatar
 
Sam Hocevar committed
780

Sam Hocevar's avatar
 
Sam Hocevar committed
781
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
782
dnl  Enable release-specific flags
Sam Hocevar's avatar
 
Sam Hocevar committed
783
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
784
AC_ARG_ENABLE(release,
785 786
[  --enable-release        activate extra optimizations (default disabled)])
AM_CONDITIONAL(RELEASE, test "x${enable_release}" = "xyes")
Sam Hocevar's avatar
 
Sam Hocevar committed
787

Sam Hocevar's avatar
 
Sam Hocevar committed
788
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
789
dnl  Input plugins
Sam Hocevar's avatar
 
Sam Hocevar committed
790 791
dnl

Sam Hocevar's avatar
 
Sam Hocevar committed
792
AC_ARG_WITH(,[Input plugins:])
Sam Hocevar's avatar
 
Sam Hocevar committed
793 794

dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
795 796 797 798
dnl  DVD module: optionally check for installed libdvdcss
dnl
AC_ARG_ENABLE(dvd,
[  --enable-dvd            DVD input module (default enabled)])
799
if test "x${enable_dvd}" != "xno"
Sam Hocevar's avatar
 
Sam Hocevar committed
800
then
801
  AC_ARG_WITH(dvdcss,
Sam Hocevar's avatar
 
Sam Hocevar committed
802
  [    --with-dvdcss=PATH    libdvdcss headers and libraries])
803
  AC_ARG_WITH(dvdcss-tree,
Sam Hocevar's avatar
 
Sam Hocevar committed
804
  [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
805
  case "x${with_dvdcss}" in
Sam Hocevar's avatar
 
Sam Hocevar committed
806
  x|xyes)
807
    if test "x${with_dvdcss_tree}" = x
Sam Hocevar's avatar
 
Sam Hocevar committed
808 809
    then
      AC_CHECK_HEADERS(dvdcss/dvdcss.h,
810
        [ PLUGINS="${PLUGINS} dvd"
811 812
          LDFLAGS_dvd="${LDFLAGS_dvd} -ldvdcss"
          LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -ldvdcss" ],
Sam Hocevar's avatar
 
Sam Hocevar committed
813 814 815 816 817
        [ 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`"
818
      if test "x${real_dvdcss_tree}" = "x"
Sam Hocevar's avatar
 
Sam Hocevar committed
819 820 821 822 823 824 825 826 827
      then
        dnl  The given directory can't be found
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot cd to ${with_dvdcss_tree}])
      fi
      if test -f "${real_dvdcss_tree}/src/.libs/libdvdcss.a"
      then
        dnl  Use a custom libdvdcss
        AC_MSG_RESULT(${real_dvdcss_tree}/src/.libs/libdvdcss.a)
828 829
        BUILTINS="${BUILTINS} dvd"
        LDFLAGS_dvd="${LDFLAGS_dvd} ${real_dvdcss_tree}/src/.libs/libdvdcss.a"
830
        LDFLAGS_dvdcss="${LDFLAGS_dvdcss} ${real_dvdcss_tree}/src/.libs/libdvdcss.a"
831
        CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${real_dvdcss_tree}/src"
Sam Hocevar's avatar
 
Sam Hocevar committed
832 833 834 835 836 837
      else
        dnl  The given libdvdcss wasn't built
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot find ${real_dvdcss_tree}/src/.libs/libdvdcss.a, make sure you compiled libdvdcss in ${with_dvdcss_tree}])
      fi
    fi
Sam Hocevar's avatar
 
Sam Hocevar committed
838 839
  ;;
  xno)
Sam Hocevar's avatar
 
Sam Hocevar committed
840
    dnl  Compile without dvdcss (dlopen version, works only under Linux)
841 842 843
    PLUGINS="${PLUGINS} dvd"
    CPPFLAGS_dvd="${CPPFLAGS_dvd} -DGOD_DAMN_DMCA"
    LDFLAGS_dvd="${LDFLAGS_dvd} -ldl"
Sam Hocevar's avatar
 
Sam Hocevar committed
844 845
  ;;
  *)
Sam Hocevar's avatar
 
Sam Hocevar committed
846 847
    AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
    if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
Sam Hocevar's avatar
 
Sam Hocevar committed
848
    then
Sam Hocevar's avatar
 
Sam Hocevar committed
849
      dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
Sam Hocevar's avatar
 
Sam Hocevar committed
850
      AC_MSG_RESULT(yes)
851 852
      PLUGINS="${PLUGINS} dvd"
      LDFLAGS_dvd="${LDFLAGS_dvd} -L${with_dvdcss}/lib -ldvdcss"
853
      LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -L${with_dvdcss}/lib -ldvdcss"
854
      CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${with_dvdcss}/include"
Sam Hocevar's avatar
 
Sam Hocevar committed
855
    else
Sam Hocevar's avatar
 
Sam Hocevar committed
856
      dnl  No libdvdcss could be found, sorry
Sam Hocevar's avatar
 
Sam Hocevar committed
857
      AC_MSG_RESULT(no)
Sam Hocevar's avatar
 
Sam Hocevar committed
858
      AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
Sam Hocevar's avatar
 
Sam Hocevar committed
859 860 861 862
    fi
  ;;
  esac
fi
Sam Hocevar's avatar
 
Sam Hocevar committed
863

Stéphane Borel's avatar
Stéphane Borel committed
864
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
865
dnl dvdread module: check for libdvdread plugin
Stéphane Borel's avatar
Stéphane Borel committed
866
dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
867 868
AC_ARG_ENABLE(dvdread,
[  --enable-dvdread        dvdread input module (default disabled)])
869
if test "x${enable_dvdread}" != "xno"
Sam Hocevar's avatar
 
Sam Hocevar committed
870
then
871
  AC_ARG_WITH(dvdread,
Sam Hocevar's avatar
 
Sam Hocevar committed
872
  [    --with-dvdread=PATH   libdvdread headers and libraries])
873
  if test "x${with_dvdread}" = "x"
Sam Hocevar's avatar
 
Sam Hocevar committed
874
  then
875 876
    LDFLAGS_test=""
    CPPFLAGS_test=""
Sam Hocevar's avatar
 
Sam Hocevar committed
877
  else
878 879
    LDFLAGS_test="-L${with_dvdread}/lib"
    CPPFLAGS_test="-I${with_dvdread}/include"
Sam Hocevar's avatar
 
Sam Hocevar committed
880
  fi
881
  CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
Sam Hocevar's avatar
 
Sam Hocevar committed
882 883
  AC_CHECK_HEADERS(dvdread/dvd_reader.h, [
     AC_TRY_COMPILE([#include <dvdread/dvd_reader.h>],
884
        [int foo() { return DVD_VIDEO_LB_LEN; }],[
885
          PLUGINS="${PLUGINS} dvdread"
886
          LDFLAGS_dvdread="${LDFLAGS_dvdread} ${LDFLAGS_test} -ldvdread ${LDFLAGS_dvdcss}"
887
          CPPFLAGS_dvdread="${CPPFLAGS_dvdread} ${CPPFLAGS_test}"
Sam Hocevar's avatar
 
Sam Hocevar committed
888
        ],[
889
          if test "x${enable_dvdread}" != "x"
Sam Hocevar's avatar
 
Sam Hocevar committed
890 891 892 893 894
          then
            AC_MSG_ERROR([Cannot find DVD_VIDEO_LB_LEN in dvdread/dvd_reader.h, please install libdvdread version 0.9.2 or later])
          fi
        ])
  ],[
895
    if test "x${enable_dvdread}" != "x"
896
    then
897
      if test "x${with_dvdread}" != "x"
Sam Hocevar's avatar
 
Sam Hocevar committed
898
      then
899
        AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h in ${with_dvdread}/include])
Sam Hocevar's avatar
 
Sam Hocevar committed
900 901 902
      else
        AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h])
      fi
Sam Hocevar's avatar
 
Sam Hocevar committed
903
    fi
Sam Hocevar's avatar
 
Sam Hocevar committed
904
  ])
905
  CPPFLAGS="${CPPFLAGS_save}"
906 907 908 909 910 911 912
fi

dnl
dnl dvdplay module: check for libdvdplay
dnl
AC_ARG_ENABLE(dvdplay,
[  --enable-dvdplay        dvdplay input module (default disabled)])
913
if test "x${enable_dvdplay}" != "xno"
914
then
915
  AC_ARG_WITH(dvdplay,
916
  [    --with-dvdplay=PATH   libdvdplay headers and libraries])
917
  if test "x${with_dvdplay}" = x
918
  then
919 920
    LDFLAGS_test=""
    CPPFLAGS_test=""
921
  else
922 923
    LDFLAGS_test="-L${with_dvdplay}/lib"
    CPPFLAGS_test="-I${with_dvdplay}/include"
924
  fi