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 GTK3_CFLAGS="$GTK_CFLAGS"
128 GTK3_LIBS="$GTK_LIBS"
130 GTK3_VERSION="`$PKG_CONFIG --modversion gtk+-3.0`"], [ gtk3="yes" ])
132 if test "$gtk3" = "yes"; then
133 AC_DEFINE_UNQUOTED([USE_STARTUP_NOTIFICATION], 1, [Use gtk+ statup notification.])
135 AC_MSG_ERROR([** couldn't find gtk+ > Version 3. Please upgrade (http://www.gtk.org). **])
138 dnl Checks for header files.
140 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h unistd.h)
142 dnl Disable LADSPA caching..
143 unset ac_cv_header_ladspa_h
146 AC_CHECK_HEADERS(ladspa.h, have_ladspa=yes, have_ladspa=no)
148 dnl Disable LADSPA caching..
149 unset ac_cv_header_ladspa_h
151 dnl Some people install LADSPA in /usr/local
153 if test "$have_ladspa" = "no"; then
154 ac_save_CFLAGS=$CFLAGS
155 CFLAGS="$CFLAGS -I/usr/local/include"
156 AC_CHECK_HEADERS(ladspa.h, have_ladspa=yes, have_ladspa=no)
157 CFLAGS=$ac_save_CFLAGS
159 if test "$have_ladspa" = "yes"; then
160 CFLAGS="$CFLAGS -I/usr/local/include"
164 if test "$have_ladspa" = "no"; then
165 AC_MSG_ERROR([** couldn't find ladspa.h - Install the LADSPA SDK from http://www.ladspa.org first. **])
168 ac_save_CFLAGS=$CFLAGS
169 CFLAGS="$CFLAGS -finput-charset=utf-8"
170 AC_TRY_COMPILE([#include <stdio.h>],, have_utf8=yes, have_utf8=no)
171 CFLAGS=$ac_save_CFLAGS
173 if test "$have_utf8" = "yes"; then
174 CFLAGS="$CFLAGS -finput-charset=utf-8"
177 AC_CHECK_HEADERS(zlib.h,, AC_MSG_ERROR([** couldn't find zlib.h **]))
178 AC_CHECK_LIB(z,gzprintf, LIBS="$LIBS -lz", AC_MSG_ERROR([** couldn't find libz library **]))
180 dnl Checks for typedefs, structures, and compiler characteristics.
184 dnl Checks for library functions.
185 AC_PROG_GCC_TRADITIONAL
188 if test "$enable_closedev" = "no"; then
189 AC_DEFINE_UNQUOTED([KEEP_DEV_OPEN], 1, [Define if you want keep device open])
193 if test "$enable_sox" != "no"; then
194 AC_CHECK_PROG(SOX_PROG, sox, yes)
195 if test "$SOX_PROG" = "yes"; then
196 AC_DEFINE_UNQUOTED([USE_SOX_INPUT], 1, [Define if you want to use sox as input converter])
201 if test "$enable_mad" != "no"; then
202 AC_CHECK_HEADERS(mad.h,madheader=yes,madheader=no)
203 if test "$madheader" = "yes"; then
204 AC_CHECK_LIB(mad,mad_decoder_init,madlib=yes,madlib=no)
205 if test "$madlib" = "yes"; then
207 AC_DEFINE_UNQUOTED([USE_MAD_INPUT], 1, [Define to use MAD for mp3 support])
213 AC_CHECK_HEADERS(X11/extensions/Xxf86dga.h,newDgaHeader=yes,newDgaHeader=no, [#include <X11/Xlib.h>])
215 if test "$newDgaHeader" = "no"; then
216 AC_CHECK_HEADERS(X11/extensions/xf86dga.h,oldDgaHeader=yes,oldDgaHeader=no, [#include <X11/Xlib.h>])
218 if test "$oldDgaHeader" = "no"; then
219 AC_MSG_ERROR([** couldn't find xf86dga.h header - Install X11 headers first. **])
223 if test "$enable_vorbis" != "no"; then
224 AC_CHECK_HEADERS(vorbis/codec.h vorbis/vorbisfile.h,vorbis_headers=yes,vorbis_headers="no")
225 if test "$vorbis_headers" = "yes"; then
226 AC_CHECK_LIB(vorbis,vorbis_info_init,vorbis_libs=yes,vorbis_libs=no)
227 if test "$vorbis_libs" = "yes"; then
229 LIBS="$LIBS -lvorbis"
230 AC_CHECK_LIB(vorbisfile,ov_open_callbacks,vorbisfile_libs=yes,vorbisfile_libs=no)
231 if test "$vorbisfile_libs" = "yes"; then
232 LIBS="$LIBS -lvorbisfile"
233 AC_DEFINE_UNQUOTED([USE_VORBIS_INPUT], 1, [Define to use libvorbis for ogg support])
242 if test "$enable_audiofile" != "no"; then
243 AC_CHECK_PROG(af_config,audiofile-config,yes,no)
244 if test "$af_config" = "yes"; then
245 af_cflags=`audiofile-config --cflags`
246 if test "$af_cflags" != ""; then
247 CFLAGS="$CFLAGS $af_cflags"
249 af_libs=`audiofile-config --libs`
250 LIBS="$LIBS $af_libs"
251 AC_DEFINE_UNQUOTED([USE_AUDIOFILE_INPUT], 1, [Define to compile libaudiofile support])
252 OPTION_AUDIOFILE="yes"
254 AC_CHECK_HEADERS(audiofile.h,audiofile_headers=yes,audiofile_headers=no)
255 if test "$audiofile_headers" = "yes"; then
256 AC_CHECK_LIB(audiofile,afOpenFile,audiofile_libs=yes,audiofile_libs=no)
257 if test "$audiofile_libs" = "yes"; then
258 LIBS="$LIBS -laudiofile"
259 AC_DEFINE_UNQUOTED([USE_AUDIOFILE_INPUT], 1, [Define to compile libaudiofile support])
260 OPTION_AUDIOFILE="yes"
266 if test "$enable_mpg123" != "no"; then
267 AC_CHECK_PROG(MPG123_PROG, mpg123, yes)
268 if test "$MPG123_PROG" = "yes"; then
269 if test "$SOX_PROG" = "yes"; then
270 AC_DEFINE_UNQUOTED([USE_MPG123_INPUT], 1, [Define mp3-input through mpg123 - requires sox as well])
273 AC_CHECK_PROG(SOX_PROG, sox, yes)
274 if test "$SOX_PROG" = "yes"; then
275 AC_DEFINE_UNQUOTED([USE_MPG123_INPUT], 1, [Define mp3-input through mpg123 - requires sox as well])
278 AC_MSG_RESULT([** mpg123 support disabled: couldn't find sox! **])
284 if test "$enable_ogg123" != "no"; then
285 AC_CHECK_PROG(OGG123_PROG, ogg123, yes)
286 if test "$OGG123_PROG" = "yes"; then
287 AC_DEFINE_UNQUOTED([USE_OGG123_INPUT], 1, [Define if you want UGLY ogg-input "support" - also requires sox])
292 if test "$enable_xsetpointer" != "no"; then
293 AC_CHECK_PROG(XSETPOINTER_PROG, xsetpointer, yes)
294 if test "$XSETPOINTER_PROG" = "yes"; then
295 AC_DEFINE_UNQUOTED([USE_XSETPOINTER], 1, [Exec xsetpointer instead of using Xlib-calls.])
297 if test "$enable_xsetpointer" = "yes"; then
298 AC_MSG_ERROR([** xsetpointer not found. **])
303 if test "$enable_movqfix" = "no"; then
304 AC_DEFINE_UNQUOTED([OVERRIDE_MOVQ_AUTODETECT], 1, [Don't use movqfix])
311 if test "$enable_alsa" != "no"; then
312 AC_CHECK_LIB(asound, snd_pcm_writei,alsalib=yes,alsalib=no)
313 AC_CHECK_HEADERS(alsa/asoundlib.h,alsaheader=yes,alsaheader=no)
315 if test "$alsalib" = "yes"; then
316 if test "$alsaheader" = "yes"; then
317 AC_DEFINE_UNQUOTED([USE_ALSA], 1, [ Define to enable ALSA audio backend. ])
318 LIBS="$LIBS -lasound"
322 if test "$enable_alsa" = "yes"; then
323 AC_MSG_ERROR([** Coulnd't find ALSA header file sys/asoundlib.h **])
327 if test "$enable_alsa" = "yes"; then
328 AC_MSG_ERROR([** Coulnd'f find ALSA library libasound. **])
333 if test "$enable_jack" != "no"; then
334 AC_CHECK_LIB(jack,jack_activate,jacklib=yes,jacklib=no)
335 AC_CHECK_HEADERS(jack/jack.h,jackheader=yes,jackheader=no)
337 if test "$jacklib" = "yes"; then
338 if test "$jackheader" = "yes"; then
339 AC_DEFINE_UNQUOTED([USE_JACK], 1, [ Define to enable JACK audio backend.])
344 if test "$enable_jack" = "yes"; then
345 AC_MSG_ERROR([** Coulnd't find JACK header file jack/jack.h **])
349 if test "$enable_jack" = "yes"; then
350 AC_MSG_ERROR([** Coulnd'f find JACK library libjack. **])
356 if test "$enable_oss" != "no"; then
357 AC_CHECK_HEADERS(sys/ioctl.h sys/soundcard.h,oss=yes,oss=no)
359 if test "$oss" = "yes"; then
360 AC_DEFINE_UNQUOTED([USE_OSS], 1, [Use OSS])
364 if test "$enable_oss" = "yes"; then
365 AC_MSG_ERROR([** Couldn't find OSS header files. ***])
370 if test "$enable_alsamidi" != "no"; then
371 if test "$using_alsa" = "yes"; then
372 AC_DEFINE_UNQUOTED([USE_ALSA_MIDI_IN], 1, [Define for ALSA MIDI in support])
373 OPTION_ALSAMIDI="yes"
375 AC_CHECK_LIB(asound, snd_seq_open,alsalib=yes,alsalib=no)
376 AC_CHECK_HEADERS(alsa/asoundlib.h,alsaheader=yes,alsaheader=no)
378 if test "$alsalib" = "yes"; then
379 if test "$alsaheader" = "yes"; then
380 AC_DEFINE_UNQUOTED([USE_ALSA_MIDI_IN], 1, [Define for ALSA MIDI in support])
381 LIBS="$LIBS -lasound"
382 OPTION_ALSAMIDI="yes"
384 if test "$enable_alsamidi" = "yes"; then
385 AC_MSG_ERROR([** Coulnd't find ALSA header file alsa/asoundlib.h **])
389 if test "$enable_alsamidin" = "yes"; then
390 AC_MSG_ERROR([** Couldn't find ALSA library libasound. **])
396 if test "$using_alsa" != "yes"; then
397 if test "$using_oss" != "yes"; then
398 if test "$using_jack" != "yes"; then
399 AC_MSG_ERROR([** Found neither OSS, ALSA nor JACK - no output device! **])
404 if test "$enable_wav" != "no";
406 AC_DEFINE_UNQUOTED([USE_BUILTIN_WAV], 1, [Define to enable the built-in wav loading routines])
410 if test "$enable_3dnow" = "yes"; then
411 AC_DEFINE_UNQUOTED([USE_3DNOW], 1, [Do not define this])
414 if test "$enable_scheduler" != "no"; then
415 OPTION_SCHEDULER="yes";
416 AC_DEFINE_UNQUOTED([USE_SCHEDULER], 1, [Define this to compile with rt scheduling support])
419 if test "$enable_debug" = yes; then
420 AC_DEFINE_UNQUOTED([ENABLE_DEBUG_OUTPUT], 1, [Define this to enable debug output.])
423 if test "$enable_benchmark" = yes; then
424 AC_DEFINE_UNQUOTED([CREATE_BENCHMARK], 1, [Define this to build an performance benchmark - WARNING: You cannot use the resulting binary for normal operation])
427 if test "$enable_capabilities" != "no"; then
428 AC_CHECK_HEADERS(sys/capability.h,capheader=yes,capheader=no)
429 AC_CHECK_HEADERS(sys/prctl.h,prctlheader=yes,prctlheader=no)
431 if test "$capheader" = "yes"; then
432 if test "$prctlheader" = "yes"; then
433 AC_CHECK_LIB(cap,cap_get_proc,caplib=yes,caplib=no)
434 if test "$caplib" = "yes"; then
436 AC_DEFINE_UNQUOTED([USE_CAPABILITIES], 1, [Define to use capabilities])
443 if test "$enable_capabilities" = "yes"; then
444 if test "$OPTION_CAP" != "yes"; then
445 AC_MSG_ERROR([** This system doesn't support capabilities. **])
451 if test "$enable_deprecated" = "no"; then
452 DEPRECATED_FLAGS="-DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
457 AC_SUBST(DEPRECATED_FLAGS)
459 AC_MSG_CHECKING(for necessary scratching skillz)
462 AC_DEFINE_UNQUOTED([USE_DIAL], 1, [ Define this. ])
464 dnl if test "$enable_bigdial" = yes; then
465 dnl AC_DEFINE(USE_DIAL)
466 dnl AC_DEFINE(USE_BIG_BUTTONS)
469 if test "$enable_legacy" = yes; then
470 AC_DEFINE_UNQUOTED([ENABLE_TX_LEGACY], 1, [Define this to enable support for old tX set files])
474 dnl if test "$enable_dga2" = yes; then
475 dnl AC_DEFINE(USE_DGA2)
478 dnl Detecting libxml. Based on dia's test.
481 if test "$enable_libxml2" != "no"; then
482 if ! $found_libxml; then
483 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
484 if test "x$XML2_CONFIG" != x ; then
485 AC_MSG_CHECKING(for libxml >= 2.3.9)
486 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
488 if test "$vers" -ge 2003009; then
491 XML_LIBS="`$XML2_CONFIG --libs`"
492 XML_CFLAGS="`$XML2_CONFIG --cflags`"
502 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
503 if test "x$XML_CONFIG" != x ; then
504 AC_MSG_CHECKING(for libxml >= 1.8.14)
505 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
507 dnl 1.18.14 is required for xmlUseNewParser()
508 if test "$vers" -ge 1008014; then
511 XML_LIBS="`$XML_CONFIG --libs`"
512 XML_CFLAGS="`$XML_CONFIG --cflags`"
519 if ! $found_libxml; then
520 AC_MSG_ERROR([** libxml not found. Get libxml(2) at http://www.libxml.org **])
526 if test "$enable_lrdf" != "no"; then
527 AC_MSG_CHECKING(for liblrdf >= 0.2.4)
528 LRDF_VERS=`$PKG_CONFIG --modversion lrdf | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
529 if test "$LRDF_VERS" -ge 2004; then
533 lrdf_cflags=`$PKG_CONFIG --cflags lrdf`
534 if test "$lrdf_cflags" != ""; then
535 CFLAGS="$CFLAGS $lrdf_cflags"
537 lrdf_libs=`$PKG_CONFIG --libs lrdf`
538 LIBS="$LIBS $lrdf_libs"
539 AC_DEFINE_UNQUOTED([USE_LRDF], 1, [Define to compile librdf support])
540 OPTION_AUDIOFILE="yes"
550 xml_man="\\\"${datadir}/gnome/help/terminatorX-manual/C/terminatorX-manual.xml\\\""
552 dnl Now Check for Xlibs - I do this here as other tests fail if these run earlier
557 AC_SUBST(X_EXTRA_LIBS)
559 AC_SUBST(x_libraries)
561 GTK_LIBS="$GTK_LIBS $X_LIBS"
562 AC_CHECK_LIB(X11, XOpenDisplay,, AC_MSG_ERROR([** X11-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
563 AC_CHECK_LIB(Xext, XShmQueryExtension,, AC_MSG_ERROR([** Xext-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
564 AC_CHECK_LIB(Xi, XOpenDevice,, AC_MSG_ERROR([** XInput not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
565 AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,, AC_MSG_ERROR([** DGA not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
566 if test "$enable_dga2" = yes; then
567 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)
570 CFLAGS="$XML_CFLAGS $CFLAGS -DXML_MANUAL=$xml_man"
571 LIBS="$XML_LIBS $LIBS"
583 echo "$option support: $option_val"
584 if test "$option_val" != "yes"; then
585 echo " - If you want $option support get $option from"
586 echo " - $option_url"
587 echo " - and reconfigure terminatorX"
592 echo configured terminatorX for:
593 echo ---------------------------
596 option=sox; option_val=$OPTION_SOX; option_url=http://sox.sourceforge.net/
599 echo "mpg123 support: $OPTION_MPG123"
600 if test "$OPTION_MPG123" = "no"; then
601 echo " - If you want mpg123 support get either mpg321 from"
602 echo " - http://mpg321.sourceforge.net/ or mpg123 from"
603 echo " - http://www.mpg123.de/"
604 echo " - and reconfigure terminatorX"
608 option=oss; option_val=$OPTION_OSS; option_url=http://www.kernel.org
611 option=alsa; option_val=$OPTION_ALSA; option_url=http://www.alsa-project.org
614 option=jack; option_val=$OPTION_JACK; option_url=http://jackit.sourceforge.net
617 option=mad; option_val=$OPTION_MAD; option_url=http://www.mars.org/home/rob/proj/mpeg/
620 option=ogg123; option_val=$OPTION_OGG123; option_url=http://www.xiph.org/ogg/vorbis/
623 option=libvorbis; option_val=$OPTION_VORBIS; option_url=http://www.xiph.org/ogg/vorbis/
626 option=audiofile; option_val=$OPTION_AUDIOFILE; option_url=http://www.68k.org/~michael/audiofile/
629 option="ALSA (MIDI in)"; option_val=$OPTION_ALSAMIDI; option_url=http://www.alsa-project.org
632 option=lrdf; option_val=$OPTION_LRDF; option_url=http://plugin.org.uk/releases/lrdf/
635 echo "legacy files support: $OPTION_LEGACY"
636 echo "builtin-wav support: $OPTION_WAV"
637 echo "enhanced scheduling support: $OPTION_SCHEDULER"
638 echo "capabilities support: $OPTION_CAP"
640 echo You can now run \'make\' to compile terminatorX