1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([terminatorX], [3.90], [https://terminatorx.org/bugs/], [terminatorX])
4 AC_CONFIG_SRCDIR([src/tX_global.h])
6 AM_CONFIG_HEADER(config.h)
8 AC_ARG_ENABLE(sox, [ --enable-sox use sox as input converter. (default=auto) ])
9 AC_ARG_ENABLE(mpg123, [ --enable-mpg123 use mpg123 as input converter. (default=auto) ])
10 AC_ARG_ENABLE(ogg123, [ --enable-ogg123 use ogg123 as input converter. (default=auto) ])
11 AC_ARG_ENABLE(scheduler, [ --enable-scheduler enable rt-scheduling (default=auto) ])
12 AC_ARG_ENABLE(debug, [ --enable-debug enable debug output. (default=no) ])
13 dnl AC_ARG_ENABLE(benchmark [ --enable-benchmark creates a non-functional test version (default=no) ])
14 AC_ARG_ENABLE(wav, [ --enable-wav enables the built-in wav-loader (default=yes) ])
15 AC_ARG_ENABLE(xsetpointer, [ --enable-xsetpointer enables executing of xsetpointer (default=auto) ])
16 AC_ARG_ENABLE(alsa, [ --enable-alsa use ALSA for sound output (default=auto) ])
17 AC_ARG_ENABLE(jack, [ --enable-jack use JACK for sound output (default=auto) ])
18 AC_ARG_ENABLE(oss, [ --enable-oss use OSS for sound output (default=auto) ])
19 dnl AC_ARG_ENABLE(dga2, [ --enable-dga2 use DGA2 instead of DGA1. (experimental) (default=no) ])
20 AC_ARG_ENABLE(libxml2, [ --disable-libxml2 use libxml even if verion 2 detected (default=auto) ])
21 AC_ARG_ENABLE(mad, [ --disable-mad disable mad for mp3 support (default=auto) ])
22 AC_ARG_ENABLE(vorbis, [ --disable-vorbis disable libvorbis support (default=auto) ])
23 AC_ARG_ENABLE(audiofile, [ --disable-audiofile disable audiofile support (default=auto) ])
24 AC_ARG_ENABLE(startup, [ --disable-startup disable startup-notification (default=auto) ])
25 AC_ARG_ENABLE(legacy, [ --enable-legacy enable support for old terminatorX files (default=no) ])
26 AC_ARG_ENABLE(alsamidi, [ --disable-alsamidi disable support ALSA MIDI in (default=auto) ])
27 AC_ARG_ENABLE(lrdf, [ --disable-lrdf disable support for liblrdf (default=auto) ])
28 AC_ARG_ENABLE(capabilities, [ --enable-capabilities to use rt-scheduling (default=auto) ])
29 AC_ARG_ENABLE(deprecated, [ --disable-deprecated compile without deprecated G*-headers (default=no) ])
30 AC_ARG_WITH(docdir, [ --with-docdir=/some/dir the final location the docs will be installed to. ])
32 dnl Checks for programs.
56 dnl Checks for libraries.
57 AC_CHECK_LIB(m, floor,, AC_MSG_ERROR([** math-lib not installed or broken **]))
59 dnl Checking whether -pthreads, -lpthreads or simply nothing
63 dnl Some machines don't require any switches for pthread support...
65 AC_MSG_CHECKING([whether pthreads works without switches])
69 AC_TRY_LINK([#include <pthread.h>], [ pthread_t thread; pthread_create(&thread, NULL, NULL, NULL);],
74 AC_MSG_RESULT([$no_threads_flags])
76 if test "$no_threads_flags" = "yes"; then
80 dnl Some machines prefer the -lpthread...
82 if test "$tX_threads" = "no"; then
84 AC_CHECK_LIB(pthread, pthread_detach, pthread_lib=yes, pthread_lib=no)
86 if test "$pthread_lib" = "yes"; then
88 LIBS="$LIBS -lpthread"
92 dnl Some machines prefer a -pthread...
94 if test "$tX_threads" = "no"; then
95 AC_MSG_CHECKING([whether -pthread is required for pthreads])
97 ac_save_CFLAGS=$CFLAGS
98 CFLAGS="$CFLAGS -pthread"
101 AC_TRY_LINK([#include <pthread.h>], [ pthread_t thread; pthread_create(&thread, NULL, NULL, NULL);],
106 CFLAGS=$ac_save_CFLAGS
107 AC_MSG_RESULT([$use_gcc_threads])
109 if test "$use_gcc_threads" = "yes"; then
111 CFLAGS="$CFLAGS -pthread"
115 dnl If we still haven't found pthreads, we panic...
117 if test "$tX_threads" = "no"; then
118 AC_MSG_ERROR([** failed to detect pthreads implementation **])
122 AC_SEARCH_LIBS([dlclose], [dl])
127 GTK2_CFLAGS="$GTK_CFLAGS"
128 GTK2_LIBS="$GTK_LIBS"
130 GTK2_VERSION="`$PKG_CONFIG --modversion gtk+-2.0`"], [ gtk2="yes" ])
132 OPTION_GTK_VERSION="Version 2 - ($GTK2_VERSION)"
133 vers=`echo $GTK2_VERSION | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
135 if test "$gtk2" = "no"; then
136 AC_MSG_ERROR([** couldn't find gtk+ > Version 2. Please upgrade (http://www.gtk.org). **])
139 if test "$enable_startup" != "no"; then
140 AC_MSG_CHECKING([whether gtk+ does startup notification])
141 if test "$vers" -ge 2002000; then
143 AC_DEFINE_UNQUOTED([USE_STARTUP_NOTIFICATION], 1, [Use gtk+ statup notification.])
149 dnl Checks for header files.
151 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h unistd.h)
153 dnl Disable LADSPA caching..
154 unset ac_cv_header_ladspa_h
157 AC_CHECK_HEADERS(ladspa.h, have_ladspa=yes, have_ladspa=no)
159 dnl Disable LADSPA caching..
160 unset ac_cv_header_ladspa_h
162 dnl Some people install LADSPA in /usr/local
164 if test "$have_ladspa" = "no"; then
165 ac_save_CFLAGS=$CFLAGS
166 CFLAGS="$CFLAGS -I/usr/local/include"
167 AC_CHECK_HEADERS(ladspa.h, have_ladspa=yes, have_ladspa=no)
168 CFLAGS=$ac_save_CFLAGS
170 if test "$have_ladspa" = "yes"; then
171 CFLAGS="$CFLAGS -I/usr/local/include"
175 if test "$have_ladspa" = "no"; then
176 AC_MSG_ERROR([** couldn't find ladspa.h - Install the LADSPA SDK from http://www.ladspa.org first. **])
179 ac_save_CFLAGS=$CFLAGS
180 CFLAGS="$CFLAGS -finput-charset=utf-8"
181 AC_TRY_COMPILE([#include <stdio.h>],, have_utf8=yes, have_utf8=no)
182 CFLAGS=$ac_save_CFLAGS
184 if test "$have_utf8" = "yes"; then
185 CFLAGS="$CFLAGS -finput-charset=utf-8"
188 AC_CHECK_HEADERS(zlib.h,, AC_MSG_ERROR([** couldn't find zlib.h **]))
189 AC_CHECK_LIB(z,gzprintf, LIBS="$LIBS -lz", AC_MSG_ERROR([** couldn't find libz library **]))
191 dnl Checks for typedefs, structures, and compiler characteristics.
195 dnl Checks for library functions.
196 AC_PROG_GCC_TRADITIONAL
199 if test "$enable_closedev" = "no"; then
200 AC_DEFINE_UNQUOTED([KEEP_DEV_OPEN], 1, [Define if you want keep device open])
204 if test "$enable_sox" != "no"; then
205 AC_CHECK_PROG(SOX_PROG, sox, yes)
206 if test "$SOX_PROG" = "yes"; then
207 AC_DEFINE_UNQUOTED([USE_SOX_INPUT], 1, [Define if you want to use sox as input converter])
212 if test "$enable_mad" != "no"; then
213 AC_CHECK_HEADERS(mad.h,madheader=yes,madheader=no)
214 if test "$madheader" = "yes"; then
215 AC_CHECK_LIB(mad,mad_decoder_init,madlib=yes,madlib=no)
216 if test "$madlib" = "yes"; then
218 AC_DEFINE_UNQUOTED([USE_MAD_INPUT], 1, [Define to use MAD for mp3 support])
224 AC_CHECK_HEADERS(X11/extensions/Xxf86dga.h,newDgaHeader=yes,newDgaHeader=no, [#include <X11/Xlib.h>])
226 if test "$newDgaHeader" = "no"; then
227 AC_CHECK_HEADERS(X11/extensions/xf86dga.h,oldDgaHeader=yes,oldDgaHeader=no, [#include <X11/Xlib.h>])
229 if test "$oldDgaHeader" = "no"; then
230 AC_MSG_ERROR([** couldn't find xf86dga.h header - Install X11 headers first. **])
234 if test "$enable_vorbis" != "no"; then
235 AC_CHECK_HEADERS(vorbis/codec.h vorbis/vorbisfile.h,vorbis_headers=yes,vorbis_headers="no")
236 if test "$vorbis_headers" = "yes"; then
237 AC_CHECK_LIB(vorbis,vorbis_info_init,vorbis_libs=yes,vorbis_libs=no)
238 if test "$vorbis_libs" = "yes"; then
240 LIBS="$LIBS -lvorbis"
241 AC_CHECK_LIB(vorbisfile,ov_open_callbacks,vorbisfile_libs=yes,vorbisfile_libs=no)
242 if test "$vorbisfile_libs" = "yes"; then
243 LIBS="$LIBS -lvorbisfile"
244 AC_DEFINE_UNQUOTED([USE_VORBIS_INPUT], 1, [Define to use libvorbis for ogg support])
253 if test "$enable_audiofile" != "no"; then
254 AC_CHECK_PROG(af_config,audiofile-config,yes,no)
255 if test "$af_config" = "yes"; then
256 af_cflags=`audiofile-config --cflags`
257 if test "$af_cflags" != ""; then
258 CFLAGS="$CFLAGS $af_cflags"
260 af_libs=`audiofile-config --libs`
261 LIBS="$LIBS $af_libs"
262 AC_DEFINE_UNQUOTED([USE_AUDIOFILE_INPUT], 1, [Define to compile libaudiofile support])
263 OPTION_AUDIOFILE="yes"
265 AC_CHECK_HEADERS(audiofile.h,audiofile_headers=yes,audiofile_headers=no)
266 if test "$audiofile_headers" = "yes"; then
267 AC_CHECK_LIB(audiofile,afOpenFile,audiofile_libs=yes,audiofile_libs=no)
268 if test "$audiofile_libs" = "yes"; then
269 LIBS="$LIBS -laudiofile"
270 AC_DEFINE_UNQUOTED([USE_AUDIOFILE_INPUT], 1, [Define to compile libaudiofile support])
271 OPTION_AUDIOFILE="yes"
277 if test "$enable_mpg123" != "no"; then
278 AC_CHECK_PROG(MPG123_PROG, mpg123, yes)
279 if test "$MPG123_PROG" = "yes"; then
280 if test "$SOX_PROG" = "yes"; then
281 AC_DEFINE_UNQUOTED([USE_MPG123_INPUT], 1, [Define mp3-input through mpg123 - requires sox as well])
284 AC_CHECK_PROG(SOX_PROG, sox, yes)
285 if test "$SOX_PROG" = "yes"; then
286 AC_DEFINE_UNQUOTED([USE_MPG123_INPUT], 1, [Define mp3-input through mpg123 - requires sox as well])
289 AC_MSG_RESULT([** mpg123 support disabled: couldn't find sox! **])
295 if test "$enable_ogg123" != "no"; then
296 AC_CHECK_PROG(OGG123_PROG, ogg123, yes)
297 if test "$OGG123_PROG" = "yes"; then
298 AC_DEFINE_UNQUOTED([USE_OGG123_INPUT], 1, [Define if you want UGLY ogg-input "support" - also requires sox])
303 if test "$enable_xsetpointer" != "no"; then
304 AC_CHECK_PROG(XSETPOINTER_PROG, xsetpointer, yes)
305 if test "$XSETPOINTER_PROG" = "yes"; then
306 AC_DEFINE_UNQUOTED([USE_XSETPOINTER], 1, [Exec xsetpointer instead of using Xlib-calls.])
308 if test "$enable_xsetpointer" = "yes"; then
309 AC_MSG_ERROR([** xsetpointer not found. **])
314 if test "$enable_movqfix" = "no"; then
315 AC_DEFINE_UNQUOTED([OVERRIDE_MOVQ_AUTODETECT], 1, [Don't use movqfix])
322 if test "$enable_alsa" != "no"; then
323 AC_CHECK_LIB(asound, snd_pcm_writei,alsalib=yes,alsalib=no)
324 AC_CHECK_HEADERS(alsa/asoundlib.h,alsaheader=yes,alsaheader=no)
326 if test "$alsalib" = "yes"; then
327 if test "$alsaheader" = "yes"; then
328 AC_DEFINE_UNQUOTED([USE_ALSA], 1, [ Define to enable ALSA audio backend. ])
329 LIBS="$LIBS -lasound"
333 if test "$enable_alsa" = "yes"; then
334 AC_MSG_ERROR([** Coulnd't find ALSA header file sys/asoundlib.h **])
338 if test "$enable_alsa" = "yes"; then
339 AC_MSG_ERROR([** Coulnd'f find ALSA library libasound. **])
344 if test "$enable_jack" != "no"; then
345 AC_CHECK_LIB(jack,jack_activate,jacklib=yes,jacklib=no)
346 AC_CHECK_HEADERS(jack/jack.h,jackheader=yes,jackheader=no)
348 if test "$jacklib" = "yes"; then
349 if test "$jackheader" = "yes"; then
350 AC_DEFINE_UNQUOTED([USE_JACK], 1, [ Define to enable JACK audio backend.])
355 if test "$enable_jack" = "yes"; then
356 AC_MSG_ERROR([** Coulnd't find JACK header file jack/jack.h **])
360 if test "$enable_jack" = "yes"; then
361 AC_MSG_ERROR([** Coulnd'f find JACK library libjack. **])
367 if test "$enable_oss" != "no"; then
368 AC_CHECK_HEADERS(sys/ioctl.h sys/soundcard.h,oss=yes,oss=no)
370 if test "$oss" = "yes"; then
371 AC_DEFINE_UNQUOTED([USE_OSS], 1, [Use OSS])
375 if test "$enable_oss" = "yes"; then
376 AC_MSG_ERROR([** Couldn't find OSS header files. ***])
381 if test "$enable_alsamidi" != "no"; then
382 if test "$using_alsa" = "yes"; then
383 AC_DEFINE_UNQUOTED([USE_ALSA_MIDI_IN], 1, [Define for ALSA MIDI in support])
384 OPTION_ALSAMIDI="yes"
386 AC_CHECK_LIB(asound, snd_seq_open,alsalib=yes,alsalib=no)
387 AC_CHECK_HEADERS(alsa/asoundlib.h,alsaheader=yes,alsaheader=no)
389 if test "$alsalib" = "yes"; then
390 if test "$alsaheader" = "yes"; then
391 AC_DEFINE_UNQUOTED([USE_ALSA_MIDI_IN], 1, [Define for ALSA MIDI in support])
392 LIBS="$LIBS -lasound"
393 OPTION_ALSAMIDI="yes"
395 if test "$enable_alsamidi" = "yes"; then
396 AC_MSG_ERROR([** Coulnd't find ALSA header file alsa/asoundlib.h **])
400 if test "$enable_alsamidin" = "yes"; then
401 AC_MSG_ERROR([** Couldn't find ALSA library libasound. **])
407 if test "$using_alsa" != "yes"; then
408 if test "$using_oss" != "yes"; then
409 if test "$using_jack" != "yes"; then
410 AC_MSG_ERROR([** Found neither OSS, ALSA nor JACK - no output device! **])
415 if test "$enable_wav" != "no";
417 AC_DEFINE_UNQUOTED([USE_BUILTIN_WAV], 1, [Define to enable the built-in wav loading routines])
421 if test "$enable_3dnow" = "yes"; then
422 AC_DEFINE_UNQUOTED([USE_3DNOW], 1, [Do not define this])
425 if test "$enable_scheduler" != "no"; then
426 OPTION_SCHEDULER="yes";
427 AC_DEFINE_UNQUOTED([USE_SCHEDULER], 1, [Define this to compile with rt scheduling support])
430 if test "$enable_debug" = yes; then
431 AC_DEFINE_UNQUOTED([ENABLE_DEBUG_OUTPUT], 1, [Define this to enable debug output.])
434 if test "$enable_benchmark" = yes; then
435 AC_DEFINE_UNQUOTED([CREATE_BENCHMARK], 1, [Define this to build an performance benchmark - WARNING: You cannot use the resulting binary for normal operation])
438 if test "$enable_capabilities" != "no"; then
439 AC_CHECK_HEADERS(sys/capability.h,capheader=yes,capheader=no)
440 AC_CHECK_HEADERS(sys/prctl.h,prctlheader=yes,prctlheader=no)
442 if test "$capheader" = "yes"; then
443 if test "$prctlheader" = "yes"; then
444 AC_CHECK_LIB(cap,cap_get_proc,caplib=yes,caplib=no)
445 if test "$caplib" = "yes"; then
447 AC_DEFINE_UNQUOTED([USE_CAPABILITIES], 1, [Define to use capabilities])
454 if test "$enable_capabilities" = "yes"; then
455 if test "$OPTION_CAP" != "yes"; then
456 AC_MSG_ERROR([** This system doesn't support capabilities. **])
462 if test "$enable_deprecated" = "no"; then
463 DEPRECATED_FLAGS="-DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
468 AC_SUBST(DEPRECATED_FLAGS)
470 AC_MSG_CHECKING(for necessary scratching skillz)
473 AC_DEFINE_UNQUOTED([USE_DIAL], 1, [ Define this. ])
475 dnl if test "$enable_bigdial" = yes; then
476 dnl AC_DEFINE(USE_DIAL)
477 dnl AC_DEFINE(USE_BIG_BUTTONS)
480 if test "$enable_legacy" = yes; then
481 AC_DEFINE_UNQUOTED([ENABLE_TX_LEGACY], 1, [Define this to enable support for old tX set files])
485 dnl if test "$enable_dga2" = yes; then
486 dnl AC_DEFINE(USE_DGA2)
489 dnl Detecting libxml. Based on dia's test.
492 if test "$enable_libxml2" != "no"; then
493 if ! $found_libxml; then
494 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
495 if test "x$XML2_CONFIG" != x ; then
496 AC_MSG_CHECKING(for libxml >= 2.3.9)
497 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
499 if test "$vers" -ge 2003009; then
502 XML_LIBS="`$XML2_CONFIG --libs`"
503 XML_CFLAGS="`$XML2_CONFIG --cflags`"
513 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
514 if test "x$XML_CONFIG" != x ; then
515 AC_MSG_CHECKING(for libxml >= 1.8.14)
516 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
518 dnl 1.18.14 is required for xmlUseNewParser()
519 if test "$vers" -ge 1008014; then
522 XML_LIBS="`$XML_CONFIG --libs`"
523 XML_CFLAGS="`$XML_CONFIG --cflags`"
530 if ! $found_libxml; then
531 AC_MSG_ERROR([** libxml not found. Get libxml(2) at http://www.libxml.org **])
537 if test "$enable_lrdf" != "no"; then
538 AC_MSG_CHECKING(for liblrdf >= 0.2.4)
539 LRDF_VERS=`$PKG_CONFIG --modversion lrdf | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
540 if test "$LRDF_VERS" -ge 2004; then
544 lrdf_cflags=`$PKG_CONFIG --cflags lrdf`
545 if test "$lrdf_cflags" != ""; then
546 CFLAGS="$CFLAGS $lrdf_cflags"
548 lrdf_libs=`$PKG_CONFIG --libs lrdf`
549 LIBS="$LIBS $lrdf_libs"
550 AC_DEFINE_UNQUOTED([USE_LRDF], 1, [Define to compile librdf support])
551 OPTION_AUDIOFILE="yes"
561 xml_man="\\\"${datadir}/gnome/help/terminatorX-manual/C/terminatorX-manual.xml\\\""
563 dnl Now Check for Xlibs - I do this here as other tests fail if these run earlier
568 AC_SUBST(X_EXTRA_LIBS)
570 AC_SUBST(x_libraries)
572 GTK_LIBS="$GTK_LIBS $X_LIBS"
573 AC_CHECK_LIB(X11, XOpenDisplay,, AC_MSG_ERROR([** X11-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
574 AC_CHECK_LIB(Xext, XShmQueryExtension,, AC_MSG_ERROR([** Xext-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
575 AC_CHECK_LIB(Xi, XOpenDevice,, AC_MSG_ERROR([** XInput not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
576 AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,, AC_MSG_ERROR([** DGA not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
577 if test "$enable_dga2" = yes; then
578 AC_CHECK_LIB(Xxf86dga, XDGASelectInput,, AC_MSG_ERROR([** DGA2 not installed. Try using dga1 instead. **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
581 CFLAGS="$XML_CFLAGS $CFLAGS -DXML_MANUAL=$xml_man"
582 LIBS="$XML_LIBS $LIBS"
594 echo "$option support: $option_val"
595 if test "$option_val" != "yes"; then
596 echo " - If you want $option support get $option from"
597 echo " - $option_url"
598 echo " - and reconfigure terminatorX"
603 echo configured terminatorX for:
604 echo ---------------------------
607 option=sox; option_val=$OPTION_SOX; option_url=http://sox.sourceforge.net/
610 echo "mpg123 support: $OPTION_MPG123"
611 if test "$OPTION_MPG123" = "no"; then
612 echo " - If you want mpg123 support get either mpg321 from"
613 echo " - http://mpg321.sourceforge.net/ or mpg123 from"
614 echo " - http://www.mpg123.de/"
615 echo " - and reconfigure terminatorX"
619 option=oss; option_val=$OPTION_OSS; option_url=http://www.kernel.org
622 option=alsa; option_val=$OPTION_ALSA; option_url=http://www.alsa-project.org
625 option=jack; option_val=$OPTION_JACK; option_url=http://jackit.sourceforge.net
628 option=mad; option_val=$OPTION_MAD; option_url=http://www.mars.org/home/rob/proj/mpeg/
631 option=ogg123; option_val=$OPTION_OGG123; option_url=http://www.xiph.org/ogg/vorbis/
634 option=libvorbis; option_val=$OPTION_VORBIS; option_url=http://www.xiph.org/ogg/vorbis/
637 option=audiofile; option_val=$OPTION_AUDIOFILE; option_url=http://www.68k.org/~michael/audiofile/
640 option="ALSA (MIDI in)"; option_val=$OPTION_ALSAMIDI; option_url=http://www.alsa-project.org
643 option=lrdf; option_val=$OPTION_LRDF; option_url=http://plugin.org.uk/releases/lrdf/
646 echo "legacy files support: $OPTION_LEGACY"
647 echo "builtin-wav support: $OPTION_WAV"
648 echo "enhanced scheduling support: $OPTION_SCHEDULER"
649 echo "capabilities support: $OPTION_CAP"
651 echo You can now run \'make\' to compile terminatorX