]> git.sesse.net Git - vlc/blob - configure.in
* Updated the TODO list.
[vlc] / configure.in
1 dnl Autoconf settings for vlc
2 AC_INIT(src/interface/main.c)
3 AC_CONFIG_HEADER(include/defs.h)
4
5 AC_CANONICAL_HOST
6
7 VLC_VERSION=0.2.72
8 AC_SUBST(VLC_VERSION)
9 VLC_CODENAME=Ourumov
10 AC_SUBST(VLC_CODENAME)
11
12 dnl Check for tools
13 AC_PROG_MAKE_SET
14 AC_PROG_CC
15 AC_PROG_CPP
16
17 dnl AM_PROG_LIBTOOL
18 AC_PROG_INSTALL
19
20 dnl Check for compiler environment
21 AC_C_CONST
22 AC_C_BIGENDIAN
23
24 dnl Check for system libs needed
25 AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol)
26 AC_CHECK_FUNCS(setenv putenv)
27 AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect,LIB="${LIB} -lsocket")])
28 AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname,LIB="${LIB} -lnsl")])
29 AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,LIB="${LIB} -lrt",[AC_CHECK_LIB(posix4,nanosleep,LIB="${LIB} -lposix4")])])
30 AC_CHECK_FUNCS(usleep)
31 AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton,LIB="${LIB} -lresolv")])
32 AC_CHECK_FUNCS(vasprintf)
33
34 AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
35 [ # FreeBSD has a gnugetopt library for this:
36   AC_CHECK_LIB([gnugetopt],[getopt_long],
37     [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) LIB="${LIB} -lgnugetopt"],
38     [GETOPT=1])])
39 AC_SUBST(GETOPT)
40
41 AC_FUNC_MMAP
42 AC_TYPE_SIGNAL
43 AC_CHECK_LIB(dl,dlopen,LIB="${LIB} -ldl")
44 AC_CHECK_LIB(m,pow,LIB_YUV="${LIB_YUV} -lm")
45 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
46 AC_EGREP_CPP(yes,
47         [#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version <= 500001
48           yes
49         #endif
50         ], AC_MSG_RESULT(yes)
51         DEFINE="${DEFINE} -D_THREAD_SAFE" LIB="${LIB} -pthread",
52         AC_MSG_RESULT(no)
53         AC_CHECK_LIB(pthread,pthread_create,LIB="${LIB} -lpthread"))
54 AC_CHECK_LIB(threads,thread_create,LIB="${LIB} -lthreads")
55
56 CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
57 AC_CHECK_HEADERS(stddef.h)
58 AC_CHECK_HEADERS(getopt.h)
59 AC_CHECK_HEADERS(sys/sockio.h)
60 AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h)
61 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h)
62 AC_CHECK_HEADERS(dlfcn.h image.h)
63 AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
64 AC_CHECK_HEADERS(machine/param.h)
65
66 dnl Check for threads library
67 AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
68
69 dnl Do a series of bizarre compilation tests
70 save_CFLAGS=$CFLAGS
71
72 dnl Check for ntohl, etc.
73 CFLAGS="${CFLAGS} -Wall -Werror"
74 AC_MSG_CHECKING([for ntohl in sys/param.h])
75 AC_TRY_COMPILE([#include <sys/param.h>
76 void foo() { int meuh; ntohl(meuh); }],,
77  AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if ntohl is in <sys/param.h>.)
78  AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
79
80 dnl Check for -rdynamic flag
81 CFLAGS="${CFLAGS} -rdynamic -Wall -Werror"
82 AC_MSG_CHECKING([if \$CC groks -rdynamic without complaining too much])
83 AC_TRY_COMPILE([],,
84  LCFLAGS="${LCFLAGS} -rdynamic"
85  AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
86
87 dnl End of the bizarre compilation tests
88 CFLAGS=$save_CFLAGS
89
90 dnl Check for boolean_t
91 AC_MSG_CHECKING([for boolean_t in sys/types.h])
92 AC_TRY_COMPILE([#include <sys/types.h>
93 void quux() { boolean_t foo; }],,
94  AC_DEFINE(BOOLEAN_T_IN_SYS_TYPES_H, 1, Define if <sys/types.h> defines boolean_t.)
95  AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
96 AC_MSG_CHECKING([for boolean_t in pthread.h])
97 AC_TRY_COMPILE([#include <pthread.h>
98 void quux() { boolean_t foo; }],,
99  AC_DEFINE(BOOLEAN_T_IN_PTHREAD_H, 1, Define if <pthread.h> defines boolean_t.)
100  AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
101
102 dnl Checks for typedefs, structures, and compiler characteristics.
103 AC_C_CONST
104 AC_TYPE_SIZE_T
105 AC_HEADER_TIME
106
107 ARCH=${host_cpu}
108
109 dnl
110 dnl  default modules
111 dnl
112 BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion"
113 if test x$host_os = xbeos; then
114     ACCEL_PLUGINS="yuvmmx idctmmx motionmmx"
115 else
116     ACCEL_PLUGINS="yuvmmx idctmmx idctmmxext motionmmx motionmmxext"
117 fi
118
119 dnl
120 dnl  DVD module: check for DVD ioctls
121 dnl
122 AC_CHECK_HEADERS(sys/ioctl.h,[
123   BUILTINS="${BUILTINS} dvd"
124   AC_CHECK_HEADERS(linux/cdrom.h)
125   AC_EGREP_HEADER(dvd,linux/cdrom.h,[
126     AC_DEFINE(LINUX_DVD,1, DVD support for linux)
127   ])
128 ])
129
130 dnl
131 dnl  dummy plugin
132 dnl
133 AC_ARG_ENABLE(dummy,
134   [  --disable-dummy         dummy module (default enabled)])
135 if test x$enable_dummy != xno; then
136   BUILTINS="${BUILTINS} dummy"; fi
137
138 dnl
139 dnl  null plugin
140 dnl
141 AC_ARG_ENABLE(null,
142   [  --disable-null          Null module (default enabled)])
143 if test x$enable_null != xno; then
144   BUILTINS="${BUILTINS} null"; fi
145
146 dnl
147 dnl  PentiumPro acceleration
148 dnl
149 AC_ARG_ENABLE(ppro,
150 [  --disable-ppro          Disable PentiumPro optimizations (default enabled for x86)],
151 [ if test x$enableval = xyes; then ARCH="${ARCH} ppro"; fi ],
152 [ if test x${host_cpu} = xi686; then ARCH="${ARCH} ppro"; fi ])
153
154 dnl
155 dnl  MMX acceleration
156 dnl
157 AC_ARG_ENABLE(mmx,
158 [  --disable-mmx           Disable MMX optimizations (default enabled for x86)],
159 [ if test x$enableval = xyes; then ARCH="${ARCH} mmx";
160   BUILTINS="${BUILTINS} ${ACCEL_PLUGINS}"; fi ],
161 [ if test x${host_cpu} = xi686 -o x${host_cpu} = xi586 -o x${host_cpu} = xx86; then ARCH="${ARCH} mmx";
162   BUILTINS="${BUILTINS} ${ACCEL_PLUGINS}"; fi ])
163
164 dnl
165 dnl  AltiVec acceleration
166 dnl
167 AC_ARG_ENABLE(altivec,
168 [  --enable-altivec        Enable altivec optimizations (default disabled since it is broken)],
169 [ if test x$enableval = xyes; then ARCH="${ARCH} altivec";
170     BUILTINS="${BUILTINS} idctaltivec"
171     LIB_IDCTALTIVEC="-framework vecLib"
172   fi ])
173 #[ if test -d /System/Library/Frameworks/vecLib.framework; then ARCH="${ARCH} altivec"; PLUGINS="${PLUGINS} idctaltivec"; fi ])
174
175 dnl
176 dnl  CSS DVD decryption
177 dnl
178 AC_ARG_ENABLE(css,
179 [  --disable-css           Disable DVD CSS decryption (default enabled)],
180 [ if test x$enableval = xyes; then CSS=1; else CSS=0; fi ], [ CSS=1; ])
181 if test x${CSS} = x1; then AC_DEFINE(HAVE_CSS, 1, Define if you want DVD CSS decryption.) fi
182
183 dnl
184 dnl  Debugging mode
185 dnl
186 AC_ARG_ENABLE(debug,
187 [  --enable-debug          Enable debug mode (default disabled)],
188 [ if test x$enableval = xyes; then DEBUG=1; fi ])
189
190 dnl
191 dnl  Enable/disable statistics
192 dnl
193 AC_ARG_ENABLE(stats,
194 [  --enable-stats          Enable printing of statistics (default disabled)],
195 [ if test x$enableval = xyes; then STATS=1; fi ])
196
197 dnl
198 dnl  Enable/disable optimizations
199 dnl
200 AC_ARG_ENABLE(optimizations,
201 [  --disable-optimizations Disable compiler optimizations (default enabled)],
202 [ if test x$enableval = xno; then OPTIMS=0; fi ],
203 [ OPTIMS=1 ])
204
205 SYS=${host_os}
206
207 dnl special case for BeOS
208 if test x$host_os = xbeos; then
209     BUILTINS="${BUILTINS} beos"
210     LIB_BEOS="-lbe -lgame -lroot -ltracker"
211
212 dnl default case
213 else
214
215 dnl
216 dnl  OSS /dev/dsp module
217 dnl
218 AC_ARG_ENABLE(dsp,
219   [  --disable-dsp           Linux /dev/dsp support (default enabled)])
220 if test x$enable_dsp != xno; then
221   if test -c /dev/dsp; then
222     PLUGINS="${PLUGINS} dsp"
223   fi
224 fi
225
226 dnl
227 dnl  Esound module
228 dnl
229 AC_ARG_ENABLE(esd,
230   [  --enable-esd            Esound library support (default disabled)],
231   [if test x$enable_esd = xyes; then
232      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
233      if test x${ESD_CONFIG} != xno; then
234        PLUGINS="${PLUGINS} esd"
235        LIB_ESD="`${ESD_CONFIG} --libs`"
236      fi
237    fi])
238
239 dnl
240 dnl  Darwin module
241 dnl
242 AC_ARG_ENABLE(darwin,
243   [  --enable-darwin         Darwin sound support (default disabled)],
244   [if test x$enable_darwin = xyes; then
245      PLUGINS="${PLUGINS} darwin"
246      LIB_DARWIN="-framework CoreAudio"
247    fi])
248
249 dnl
250 dnl  MacOS X module
251 dnl
252 AC_ARG_ENABLE(macosx,
253   [  --enable-macosx         Mac OS X interface support (default enabled in Mac OS X)],
254   [if test x$enable_macosx = xyes; then
255      BUILTINS="${BUILTINS} macosx"
256      LIB_MACOSX="-framework CoreAudio -framework Carbon -framework AGL"
257      LIB_TS="${LIB_TS} -framework AGL -framework Carbon"
258      LIB_SDL="${LIB_SDL} -framework AGL -framework Carbon"
259    fi],
260   [AC_CHECK_HEADERS(Carbon/Carbon.h,
261      BUILTINS="${BUILTINS} macosx"
262      LIB_MACOSX="-framework CoreAudio -framework Carbon -framework AGL"
263      LIB_TS="${LIB_TS} -framework AGL -framework Carbon"
264      LIB_SDL="${LIB_SDL} -framework AGL -framework Carbon"
265    )])
266
267 dnl
268 dnl  Linux framebuffer module
269 dnl
270 AC_ARG_ENABLE(fb,
271   [  --enable-fb             Linux framebuffer support (default disabled)],
272   [if test x$enable_fb = xyes; then PLUGINS="${PLUGINS} fb"; fi])
273
274 dnl
275 dnl  GGI module
276 dnl
277 AC_ARG_WITH(ggi,
278   [  --with-ggi[=name]       GGI support (default disabled)],
279   [ if test "x$withval" != "xno";
280     then
281       PLUGINS="${PLUGINS} ggi";
282       if test "x$withval" != "xyes";
283       then
284         LIB_GGI="-l"$withval
285       else
286         LIB_GGI="-lggi"
287       fi
288     fi ])
289
290 dnl
291 dnl  SDL module
292 dnl
293 AC_ARG_WITH(sdl,
294   [  --with-sdl[=name]       SDL support (default enabled)],
295   [ if test "x$withval" != "xno";
296     then
297       PLUGINS="${PLUGINS} sdl";
298       if test "x$withval" != "xyes";
299       then
300         LIB_SDL="${LIB_SDL} -L/usr/X11R6/lib -L"$withval"/lib -l"$withval
301         INCLUDE="${INCLUDE} -I"$withval"/include"
302       else
303         AC_CHECK_HEADERS(SDL/SDL.h, , [echo "Cannot find SDL headers !"; exit])
304         LIB_SDL="${LIB_SDL} -L/usr/X11R6/lib -lSDL"
305       fi
306     fi ])
307     if test "x$withval" = "x";
308     then
309       AC_CHECK_HEADERS(SDL/SDL.h,
310       [PLUGINS="${PLUGINS} sdl"
311        LIB_SDL="${LIB_SDL} -L/usr/X11R6/lib -lSDL"])
312     fi
313
314 dnl
315 dnl  Glide module
316 dnl
317 AC_ARG_WITH(glide,
318   [  --with-glide[=name]     Glide (3dfx) support (default disabled)],
319   [ if test "x$withval" != "xno";
320     then
321       PLUGINS="${PLUGINS} glide";
322       if test "x$withval" != "xyes";
323       then
324         LIB_GLIDE="-l"$withval
325       else
326         LIB_GLIDE="-lglide2x"
327       fi
328     fi ])
329
330 dnl
331 dnl  ncurses module
332 dnl
333 AC_ARG_ENABLE(ncurses,
334   [  --enable-ncurses        ncurses interface support (default disabled)],
335   [if test x$enable_ncurses = xyes; then
336      PLUGINS="${PLUGINS} ncurses"
337      LIB_NCURSES="-lncurses"
338    fi])
339
340 dnl
341 dnl  Qt module
342 dnl
343 AC_ARG_ENABLE(qt,
344   [  --enable-qt             Qt interface support (default disabled)],
345   [if test x$enable_qt = xyes; then
346      PLUGINS="${PLUGINS} qt"
347      ALIASES="${ALIASES} qvlc"
348      LIB_QT="-lqt -L${QTDIR}/lib"
349    fi])
350
351 dnl 
352 dnl  KDE module
353 dnl
354 AC_ARG_ENABLE(kde,
355   [  --enable-kde            KDE interface support (default disabled)],
356   [if test x$enable_kde = xyes; then PLUGINS="${PLUGINS} kde"; ALIASES="${ALIASES} kvlc"; fi])
357
358 dnl
359 dnl  Gnome module
360 dnl
361 AC_ARG_ENABLE(gnome,
362   [  --enable-gnome          Gnome interface support (default disabled)],
363   [if test x$enable_gnome = xyes; then
364      PLUGINS="${PLUGINS} gnome"
365      ALIASES="${ALIASES} gnome-vlc"
366      LIB_GNOME="`gnome-config --libs gnomeui | sed 's,-rdynamic,,'`"
367    fi])
368
369 dnl
370 dnl  Gtk+ module
371 dnl
372 AC_ARG_ENABLE(gtk,
373   [  --disable-gtk           Gtk+ support (default enabled)])
374 if test x$enable_gtk != xno; then
375   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
376   if test x${GTK_CONFIG} != xno; then
377     PLUGINS="${PLUGINS} gtk"
378     ALIASES="${ALIASES} gvlc"
379     CFLAGS_GTK="`${GTK_CONFIG} --cflags gtk`"
380     LIB_GTK="`${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
381   fi
382 fi
383
384 dnl
385 dnl  X11 module
386 dnl
387 AC_ARG_ENABLE(x11,
388   [  --disable-x11           X11 support (default enabled)])
389 if test x$enable_x11 != xno; then
390   if test x$x_includes = xNONE; then
391     x_includes=/usr/X11R6/include
392   fi
393   if test x$x_libraries = xNONE; then
394     x_libraries=/usr/X11R6/lib
395   fi
396   saved_CPPFLAGS=$CPPFLAGS
397   CPPFLAGS="$CPPFLAGS -I$x_includes"
398   AC_CHECK_HEADERS(X11/Xlib.h, [
399     PLUGINS="${PLUGINS} x11"
400     LIB_X11="-L$x_libraries -lX11 -lXext"
401     CFLAGS_X11="-I$x_includes"
402   ]
403   CPPFLAGS=$saved_CPPFLAGS)
404 fi
405
406 dnl
407 dnl  XVideo module
408 dnl
409 AC_ARG_ENABLE(xvideo,
410   [  --disable-xvideo        XVideo support (default enabled)])
411 if test x$enable_xvideo != xno; then
412   if test x$x_includes = xNONE; then
413     x_includes=/usr/X11R6/include
414   fi
415   if test x$x_libraries = xNONE; then
416     x_libraries=/usr/X11R6/lib
417   fi
418   saved_CPPFLAGS=$CPPFLAGS
419   CPPFLAGS="$CPPFLAGS -I$x_includes"
420   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
421     PLUGINS="${PLUGINS} xvideo"
422     LIB_XVIDEO="-L$x_libraries -lX11 -lXext -lXv"
423     CFLAGS_X11="-I$x_includes"
424   ]
425   CPPFLAGS=$saved_CPPFLAGS)
426 fi
427
428 dnl
429 dnl  ALSA module
430 dnl
431 AC_ARG_ENABLE(alsa,
432   [  --enable-alsa           Alsa sound drivers support (Only for linux) (default disabled)],
433   [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
434      PLUGINS="${PLUGINS} alsa"
435      LIB_ALSA="-lasound"
436    fi; fi])
437
438 dnl  end of non-BeOS stuff
439 fi
440
441 dnl 
442 dnl  Configuration is finished
443 dnl
444 AC_SUBST(SYS)
445 AC_SUBST(ARCH)
446 AC_SUBST(PLUGINS)
447 AC_SUBST(BUILTINS)
448 AC_SUBST(ALIASES)
449 AC_SUBST(DEFINE)
450 AC_SUBST(INCLUDE)
451 AC_SUBST(DEBUG)
452 AC_SUBST(STATS)
453 AC_SUBST(OPTIMS)
454 AC_SUBST(CSS)
455
456 AC_SUBST(LCFLAGS)
457 AC_SUBST(LIB)
458
459 AC_SUBST(LIB_ALSA)
460 AC_SUBST(LIB_BEOS)
461 AC_SUBST(LIB_DARWIN)
462 AC_SUBST(LIB_ESD)
463 AC_SUBST(LIB_GGI)
464 AC_SUBST(LIB_GLIDE)
465 AC_SUBST(LIB_GNOME)
466 AC_SUBST(LIB_GTK)
467 AC_SUBST(LIB_IDCTALTIVEC)
468 AC_SUBST(LIB_MACOSX)
469 AC_SUBST(LIB_NCURSES)
470 AC_SUBST(LIB_QT)
471 AC_SUBST(LIB_TS)
472 AC_SUBST(LIB_SDL)
473 AC_SUBST(LIB_X11)
474 AC_SUBST(LIB_XVIDEO)
475 AC_SUBST(LIB_YUV)
476
477 AC_SUBST(CFLAGS_GTK)
478 AC_SUBST(CFLAGS_X11)
479
480 AC_OUTPUT([Makefile.opts include/config.h])
481
482 echo "
483 vlc configuration
484 -----------------
485 vlc version           : ${VLC_VERSION}
486 system                : ${SYS}
487 architecture          : ${ARCH}
488 debug mode            : ${DEBUG}
489 statistics            : ${STATS}
490 optimizations         : ${OPTIMS}
491 CSS decryption        : ${CSS}
492 need builtin getopt   : ${GETOPT}
493 plugin modules        : ${PLUGINS}
494 built-in modules      : ${BUILTINS}
495 vlc aliases           : ${ALIASES}
496
497 You may now tune Makefile.opts at your convenience."
498