1 dnl Autoconf settings for vlc
2 AC_INIT(src/interface/main.c)
3 AC_CONFIG_HEADER(include/defs.h)
10 AC_SUBST(VLC_CODENAME)
13 save_CFLAGS="${CFLAGS}"
24 dnl Check for compiler environment
27 dnl Check for endianness if not cross-compiling
28 if test x${cross_compiling} != xyes; then
32 dnl Check for system libs needed
33 AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol)
34 AC_CHECK_FUNCS(setenv putenv)
35 AC_CHECK_FUNC(connect,,[
36 AC_CHECK_LIB(socket,connect,LIB="${LIB} -lsocket")
38 AC_CHECK_FUNC(gethostbyname,,[
39 AC_CHECK_LIB(nsl,gethostbyname,LIB="${LIB} -lnsl")
41 AC_CHECK_FUNC(nanosleep,,[
42 AC_CHECK_LIB(rt,nanosleep,LIB="${LIB} -lrt",[
43 AC_CHECK_LIB(posix4,nanosleep,LIB="${LIB} -lposix4")
46 AC_CHECK_FUNCS(usleep)
47 AC_CHECK_FUNC(inet_aton,,[
48 AC_CHECK_LIB(resolv,inet_aton,LIB="${LIB} -lresolv")
50 AC_CHECK_FUNCS(vasprintf)
53 AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
54 [ # FreeBSD has a gnugetopt library for this:
55 AC_CHECK_LIB([gnugetopt],[getopt_long],
56 [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) LIB="${LIB} -lgnugetopt"],
62 AC_CHECK_LIB(dl,dlopen,LIB="${LIB} -ldl")
63 AC_CHECK_LIB(m,pow,LIB_YUV="${LIB_YUV} -lm")
64 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
66 [#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version <= 500001
70 DEFINE="${DEFINE} -D_THREAD_SAFE" LIB="${LIB} -pthread",
72 AC_CHECK_LIB(pthread,pthread_create,LIB="${LIB} -lpthread"))
73 AC_CHECK_LIB(threads,thread_create,LIB="${LIB} -lthreads")
75 CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
78 AC_CHECK_HEADERS(stddef.h getopt.h strings.h)
79 AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/time.h unistd.h)
80 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h)
81 AC_CHECK_HEADERS(dlfcn.h image.h)
82 AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
83 AC_CHECK_HEADERS(machine/param.h)
85 dnl Check for threads library
86 AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
88 dnl Check for misc headers
89 AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
90 AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
91 Define if <pthread.h> defines pthread_cond_t.)
93 AC_EGREP_HEADER(strncasecmp,strings.h,[
94 AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
95 Define if <strings.h> defines strncasecmp.)
98 dnl Check for ntohl, etc.
99 CFLAGS="${CFLAGS} -Wall -Werror"
100 AC_MSG_CHECKING([for ntohl in sys/param.h])
101 AC_TRY_COMPILE([#include <sys/param.h>
102 void foo() { int meuh; ntohl(meuh); }],,
103 AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
104 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
106 dnl Check for -rdynamic flag
107 CFLAGS="${CFLAGS} -rdynamic -Wall -Werror"
108 AC_MSG_CHECKING([if \$CC miserably fails with the -rdynamic flag])
110 LCFLAGS="${LCFLAGS} -rdynamic"
111 AC_MSG_RESULT(no), AC_MSG_RESULT(yes))
113 dnl End of the bizarre compilation tests
114 CFLAGS="${save_CFLAGS}"
116 dnl Check for boolean_t
117 AC_MSG_CHECKING([for boolean_t in sys/types.h])
118 AC_TRY_COMPILE([#include <sys/types.h>
119 void quux() { boolean_t foo; }],,
120 AC_DEFINE(BOOLEAN_T_IN_SYS_TYPES_H, 1, Define if <sys/types.h> defines boolean_t.)
121 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
122 AC_MSG_CHECKING([for boolean_t in pthread.h])
123 AC_TRY_COMPILE([#include <pthread.h>
124 void quux() { boolean_t foo; }],,
125 AC_DEFINE(BOOLEAN_T_IN_PTHREAD_H, 1, Define if <pthread.h> defines boolean_t.)
126 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
128 dnl Checks for typedefs, structures, and compiler characteristics.
138 BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion"
141 dnl Accelerated modules
145 MMX_PLUGINS="idctmmx motionmmx"
148 MMX_PLUGINS="yuvmmx idctmmx motionmmx"
152 AC_MSG_CHECKING([if \$CC groks MMX inline assembly])
153 AC_TRY_COMPILE([void quux(){void *p;asm("packuswb %%mm1,%%mm2"::"r"(p));}],,
154 ACCEL_PLUGINS="${ACCEL_PLUGINS} ${MMX_PLUGINS}"
155 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
157 AC_MSG_CHECKING([if \$CC groks MMX EXT (SSE) inline assembly])
158 AC_TRY_COMPILE([void quux(){void *p;asm("maskmovq %%mm1,%%mm2"::"r"(p));}],,
159 ACCEL_PLUGINS="${ACCEL_PLUGINS} idctmmxext motionmmxext"
160 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
163 dnl DVD module: check for DVD ioctls
165 AC_CHECK_HEADERS(sys/ioctl.h,[
166 BUILTINS="${BUILTINS} dvd"
167 AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h)
170 dnl Old FreeBSD: sys/cdio.h
172 AC_EGREP_HEADER(dvd_struct,sys/dvdio.h,[
173 AC_DEFINE(DVD_STRUCT_IN_SYS_DVDIO_H, 1,
174 Define if <sys/dvdio.h> defines dvd_struct.)
178 dnl Newer FreeBSD: sys/dvdio.h
180 AC_EGREP_HEADER(dvd_struct,sys/cdio.h,[
181 AC_DEFINE(DVD_STRUCT_IN_SYS_CDIO_H, 1,
182 Define if <sys/cdio.h> defines dvd_struct.)
185 if test x$BSD_DVD_STRUCT = x1; then
186 AC_DEFINE(HAVE_BSD_DVD_STRUCT, 1,
187 Define if BSD-like dvd_struct is defined.)
190 dnl Linux: linux/cdrom.h
192 AC_EGREP_HEADER(dvd_struct,linux/cdrom.h,[
193 AC_DEFINE(DVD_STRUCT_IN_LINUX_CDROM_H, 1,
194 Define if <linux/cdrom.h> defines DVD_STRUCT.)
202 [ --disable-dummy dummy module (default enabled)])
203 if test x$enable_dummy != xno; then
204 BUILTINS="${BUILTINS} dummy"; fi
210 [ --disable-null Null module (default enabled)])
211 if test x$enable_null != xno; then
212 BUILTINS="${BUILTINS} null"; fi
218 [ --disable-rc rc module (default enabled)])
219 if test x$enable_rc != xno; then
220 BUILTINS="${BUILTINS} rc"; fi
223 dnl PentiumPro acceleration
226 [ --disable-ppro Disable PentiumPro optimizations (default enabled for x86)],
227 [ if test x$enableval = xyes; then ARCH="${ARCH} ppro"; fi ],
228 [ if test x${host_cpu} = xi686; then ARCH="${ARCH} ppro"; fi ])
234 [ --disable-mmx Disable MMX optimizations (default enabled for x86)],
235 [ if test x$enableval = xyes; then ARCH="${ARCH} mmx";
236 BUILTINS="${BUILTINS} ${ACCEL_PLUGINS}"; fi ],
237 [ if test x${host_cpu} = xi686 -o x${host_cpu} = xi586 -o x${host_cpu} = xx86 -o x${host_cpu} = xi386; then ARCH="${ARCH} mmx";
238 BUILTINS="${BUILTINS} ${ACCEL_PLUGINS}"; fi ])
241 dnl AltiVec acceleration
243 AC_ARG_ENABLE(altivec,
244 [ --enable-altivec Enable altivec optimizations (default disabled since it is broken)],
245 [ if test x$enableval = xyes; then ARCH="${ARCH} altivec";
246 BUILTINS="${BUILTINS} idctaltivec"
247 LIB_IDCTALTIVEC="-framework vecLib"
249 #[ if test -d /System/Library/Frameworks/vecLib.framework; then ARCH="${ARCH} altivec"; PLUGINS="${PLUGINS} idctaltivec"; fi ])
252 dnl CSS DVD decryption
255 [ --disable-css Disable DVD CSS decryption (default enabled)],
256 [ if test x$enableval = xyes; then CSS=1; else CSS=0; fi ], [ CSS=1; ])
257 if test x${CSS} = x1; then AC_DEFINE(HAVE_CSS, 1, Define if you want DVD CSS decryption.) fi
263 [ --enable-debug Enable debug mode (default disabled)],
264 [ if test x$enableval = xyes; then DEBUG=1; fi ])
267 dnl Enable/disable statistics
270 [ --enable-stats Enable printing of statistics (default disabled)],
271 [ if test x$enableval = xyes; then STATS=1; fi ])
277 [ --enable-trace Enable trace mode (default disabled)],
278 [ if test x$enableval = xyes; then TRACE=1; fi ])
281 dnl Enable/disable optimizations
283 AC_ARG_ENABLE(optimizations,
284 [ --disable-optimizations Disable compiler optimizations (default enabled)],
285 [ if test x$enableval = xno; then OPTIMS=0; fi ],
290 dnl special case for BeOS
291 if test x$host_os = xbeos; then
292 BUILTINS="${BUILTINS} beos"
293 LIB_BEOS="-lbe -lgame -lroot -ltracker"
299 dnl OSS /dev/dsp module
302 [ --disable-dsp Linux /dev/dsp support (default enabled)])
303 if test x$enable_dsp != xno; then
304 if test -c /dev/dsp; then
305 PLUGINS="${PLUGINS} dsp"
313 [ --enable-esd Esound library support (default disabled)],
314 [if test x$enable_esd = xyes; then
315 AC_PATH_PROG(ESD_CONFIG, esd-config, no)
316 if test x${ESD_CONFIG} != xno; then
317 PLUGINS="${PLUGINS} esd"
318 LIB_ESD="`${ESD_CONFIG} --libs`"
325 AC_ARG_ENABLE(darwin,
326 [ --enable-darwin Darwin sound support (default disabled)],
327 [if test x$enable_darwin = xyes; then
328 PLUGINS="${PLUGINS} darwin"
329 LIB_DARWIN="-framework CoreAudio"
335 AC_ARG_ENABLE(macosx,
336 [ --enable-macosx Mac OS X interface support (default enabled in Mac OS X)],
337 [if test x$enable_macosx = xyes; then
338 BUILTINS="${BUILTINS} macosx"
339 LIB_MACOSX="-framework CoreAudio -framework Carbon -framework AGL"
340 LIB_TS="${LIB_TS} -framework AGL -framework Carbon"
341 LIB_SDL="${LIB_SDL} -framework AGL -framework Carbon"
343 [AC_CHECK_HEADERS(Carbon/Carbon.h,
344 BUILTINS="${BUILTINS} macosx"
345 LIB_MACOSX="-framework CoreAudio -framework Carbon -framework AGL"
346 LIB_TS="${LIB_TS} -framework AGL -framework Carbon"
347 LIB_SDL="${LIB_SDL} -framework AGL -framework Carbon"
351 dnl Linux framebuffer module
354 [ --enable-fb Linux framebuffer support (default disabled)],
355 [if test x$enable_fb = xyes; then PLUGINS="${PLUGINS} fb"; fi])
361 [ --with-ggi[=name] GGI support (default disabled)],
362 [ if test "x$withval" != "xno";
364 PLUGINS="${PLUGINS} ggi";
365 if test "x$withval" != "xyes";
377 [ --with-sdl[=name] SDL support (default enabled)],
378 [ if test "x$withval" != "xno";
380 PLUGINS="${PLUGINS} sdl";
381 if test "x$withval" != "xyes";
383 LIB_SDL="${LIB_SDL} -L/usr/X11R6/lib -L"$withval"/lib -lSDL"
384 INCLUDE="${INCLUDE} -I"$withval"/include"
386 AC_CHECK_HEADERS(SDL/SDL.h, , [echo "Cannot find SDL headers !"; exit])
387 LIB_SDL="${LIB_SDL} -L/usr/X11R6/lib -lSDL"
390 if test "x$withval" = "x";
392 AC_CHECK_HEADERS(SDL/SDL.h,
393 [PLUGINS="${PLUGINS} sdl"
394 LIB_SDL="${LIB_SDL} -L/usr/X11R6/lib -lSDL"])
401 [ --with-glide[=name] Glide (3dfx) support (default disabled)],
402 [ if test "x$withval" != "xno";
404 PLUGINS="${PLUGINS} glide";
405 if test "x$withval" != "xyes";
407 LIB_GLIDE="-l"$withval
409 LIB_GLIDE="-lglide2x"
416 AC_ARG_ENABLE(ncurses,
417 [ --enable-ncurses ncurses interface support (default disabled)],
418 [if test x$enable_ncurses = xyes; then
419 PLUGINS="${PLUGINS} ncurses"
420 LIB_NCURSES="-lncurses"
427 [ --enable-qt Qt interface support (default disabled)],
428 [if test x$enable_qt = xyes; then
429 PLUGINS="${PLUGINS} qt"
430 ALIASES="${ALIASES} qvlc"
431 LIB_QT="-lqt -L${QTDIR}/lib"
432 if test -x ${QTDIR}/bin/moc ;
444 [ --enable-kde KDE interface support (default disabled)],
445 [if test x$enable_kde = xyes; then PLUGINS="${PLUGINS} kde"; ALIASES="${ALIASES} kvlc"; fi])
451 [ --enable-gnome Gnome interface support (default disabled)],
452 [if test x$enable_gnome = xyes; then
453 PLUGINS="${PLUGINS} gnome"
454 ALIASES="${ALIASES} gnome-vlc"
455 LIB_GNOME="`gnome-config --libs gnomeui | sed 's,-rdynamic,,'`"
462 [ --disable-gtk Gtk+ support (default enabled)])
463 if test x$enable_gtk != xno; then
464 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
465 if test x${GTK_CONFIG} != xno; then
466 PLUGINS="${PLUGINS} gtk"
467 ALIASES="${ALIASES} gvlc"
468 CFLAGS_GTK="`${GTK_CONFIG} --cflags gtk`"
469 LIB_GTK="`${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
477 [ --disable-x11 X11 support (default enabled)])
478 if test x$enable_x11 != xno; then
479 if test x$x_includes = xNONE; then
480 x_includes=/usr/X11R6/include
482 if test x$x_libraries = xNONE; then
483 x_libraries=/usr/X11R6/lib
485 saved_CPPFLAGS=$CPPFLAGS
486 CPPFLAGS="$CPPFLAGS -I$x_includes"
487 AC_CHECK_HEADERS(X11/Xlib.h, [
488 PLUGINS="${PLUGINS} x11"
489 LIB_X11="-L$x_libraries -lX11 -lXext"
490 CFLAGS_X11="-I$x_includes"
492 CPPFLAGS=$saved_CPPFLAGS)
498 AC_ARG_ENABLE(xvideo,
499 [ --disable-xvideo XVideo support (default enabled)])
500 if test x$enable_xvideo != xno; then
501 if test x$x_includes = xNONE; then
502 x_includes=/usr/X11R6/include
504 if test x$x_libraries = xNONE; then
505 x_libraries=/usr/X11R6/lib
507 saved_CPPFLAGS=$CPPFLAGS
508 CPPFLAGS="$CPPFLAGS -I$x_includes"
509 AC_CHECK_HEADERS(X11/extensions/Xv.h, [
510 PLUGINS="${PLUGINS} xvideo"
511 LIB_XVIDEO="-L$x_libraries -lX11 -lXext -lXv"
512 CFLAGS_X11="-I$x_includes"
514 CPPFLAGS=$saved_CPPFLAGS)
521 [ --enable-alsa Alsa sound drivers support (Only for linux) (default disabled)],
522 [if test x$enable_alsa = xyes; then AC_CHECK_HEADER(sys/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false") if test x$have_alsa = xtrue; then
523 PLUGINS="${PLUGINS} alsa"
527 dnl end of non-BeOS stuff
531 dnl Configuration is finished
558 AC_SUBST(LIB_IDCTALTIVEC)
560 AC_SUBST(LIB_NCURSES)
572 AC_OUTPUT([Makefile.opts include/config.h])
577 vlc version : ${VLC_VERSION}
579 architecture : ${ARCH}
580 debug mode : ${DEBUG}
581 statistics : ${STATS}
582 trace mode : ${TRACE}
583 optimizations : ${OPTIMS}
584 CSS decryption : ${CSS}
585 need builtin getopt : ${GETOPT}
586 built-in modules :${BUILTINS}
587 plugin modules :${PLUGINS}
588 vlc aliases :${ALIASES}
590 You may now tune Makefile.opts at your convenience."