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(alsa, [ --enable-alsa use ALSA for sound output (default=auto) ])
16 AC_ARG_ENABLE(jack, [ --enable-jack use JACK for sound output (default=auto) ])
17 AC_ARG_ENABLE(oss, [ --enable-oss use OSS for sound output (default=auto) ])
18 AC_ARG_ENABLE(pulse, [ --enable-pulse use PULSE for sound output (default=auto) ])
19 AC_ARG_ENABLE(x11, [ --enable-x11 include X11 specific code (default=auto) ])
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_ENABLE(suidroot, [ --disable-suidroot to avoid setuid root upon installation (default=no) ])
31 AC_ARG_WITH(docdir, [ --with-docdir=/some/dir the final location the docs will be installed to. ])
33 dnl Checks for programs.
60 dnl Checks for libraries.
61 AC_CHECK_LIB(m, floor,, AC_MSG_ERROR([** math-lib not installed or broken **]))
63 dnl Checking whether -pthreads, -lpthreads or simply nothing
67 dnl Some machines don't require any switches for pthread support...
69 AC_MSG_CHECKING([whether pthreads works without switches])
73 AC_TRY_LINK([#include <pthread.h>], [ pthread_t thread; pthread_create(&thread, NULL, NULL, NULL);],
78 AC_MSG_RESULT([$no_threads_flags])
80 if test "$no_threads_flags" = "yes"; then
84 dnl Some machines prefer the -lpthread...
86 if test "$tX_threads" = "no"; then
88 AC_CHECK_LIB(pthread, pthread_detach, pthread_lib=yes, pthread_lib=no)
90 if test "$pthread_lib" = "yes"; then
92 LIBS="$LIBS -lpthread"
96 dnl Some machines prefer a -pthread...
98 if test "$tX_threads" = "no"; then
99 AC_MSG_CHECKING([whether -pthread is required for pthreads])
101 ac_save_CFLAGS=$CFLAGS
102 CFLAGS="$CFLAGS -pthread"
105 AC_TRY_LINK([#include <pthread.h>], [ pthread_t thread; pthread_create(&thread, NULL, NULL, NULL);],
110 CFLAGS=$ac_save_CFLAGS
111 AC_MSG_RESULT([$use_gcc_threads])
113 if test "$use_gcc_threads" = "yes"; then
115 CFLAGS="$CFLAGS -pthread"
119 dnl If we still haven't found pthreads, we panic...
121 if test "$tX_threads" = "no"; then
122 AC_MSG_ERROR([** failed to detect pthreads implementation **])
126 AC_SEARCH_LIBS([dlclose], [dl])
131 GTK3_CFLAGS="$GTK_CFLAGS"
132 GTK3_LIBS="$GTK_LIBS"
134 GTK3_VERSION="`$PKG_CONFIG --modversion gtk+-3.0`"], [ gtk3="yes" ])
136 if test "$gtk3" = "yes"; then
137 AC_DEFINE_UNQUOTED([USE_STARTUP_NOTIFICATION], 1, [Use gtk+ statup notification.])
139 AC_MSG_ERROR([** couldn't find gtk+ > Version 3. Please upgrade (http://www.gtk.org). **])
142 dnl Checks for header files.
144 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h unistd.h)
146 dnl Disable LADSPA caching..
147 unset ac_cv_header_ladspa_h
150 AC_CHECK_HEADERS(ladspa.h, have_ladspa=yes, have_ladspa=no)
152 dnl Disable LADSPA caching..
153 unset ac_cv_header_ladspa_h
155 dnl Some people install LADSPA in /usr/local
157 if test "$have_ladspa" = "no"; then
158 ac_save_CFLAGS=$CFLAGS
159 CFLAGS="$CFLAGS -I/usr/local/include"
160 AC_CHECK_HEADERS(ladspa.h, have_ladspa=yes, have_ladspa=no)
161 CFLAGS=$ac_save_CFLAGS
163 if test "$have_ladspa" = "yes"; then
164 CFLAGS="$CFLAGS -I/usr/local/include"
168 if test "$have_ladspa" = "no"; then
169 AC_MSG_ERROR([** couldn't find ladspa.h - Install the LADSPA SDK from http://www.ladspa.org first. **])
172 ac_save_CFLAGS=$CFLAGS
173 CFLAGS="$CFLAGS -finput-charset=utf-8"
174 AC_TRY_COMPILE([#include <stdio.h>],, have_utf8=yes, have_utf8=no)
175 CFLAGS=$ac_save_CFLAGS
177 if test "$have_utf8" = "yes"; then
178 CFLAGS="$CFLAGS -finput-charset=utf-8"
181 AC_CHECK_HEADERS(zlib.h,, AC_MSG_ERROR([** couldn't find zlib.h **]))
182 AC_CHECK_LIB(z,gzprintf, LIBS="$LIBS -lz", AC_MSG_ERROR([** couldn't find libz library **]))
184 dnl Checks for typedefs, structures, and compiler characteristics.
188 dnl Checks for library functions.
189 AC_PROG_GCC_TRADITIONAL
192 if test "$enable_closedev" = "no"; then
193 AC_DEFINE_UNQUOTED([KEEP_DEV_OPEN], 1, [Define if you want keep device open])
197 if test "$enable_sox" != "no"; then
198 AC_CHECK_PROG(SOX_PROG, sox, yes)
199 if test "$SOX_PROG" = "yes"; then
200 AC_DEFINE_UNQUOTED([USE_SOX_INPUT], 1, [Define if you want to use sox as input converter])
205 if test "$enable_mad" != "no"; then
206 AC_CHECK_HEADERS(mad.h,madheader=yes,madheader=no)
207 if test "$madheader" = "yes"; then
208 AC_CHECK_LIB(mad,mad_decoder_init,madlib=yes,madlib=no)
209 if test "$madlib" = "yes"; then
211 AC_DEFINE_UNQUOTED([USE_MAD_INPUT], 1, [Define to use MAD for mp3 support])
217 if test "$enable_vorbis" != "no"; then
218 AC_CHECK_HEADERS(vorbis/codec.h vorbis/vorbisfile.h,vorbis_headers=yes,vorbis_headers="no")
219 if test "$vorbis_headers" = "yes"; then
220 AC_CHECK_LIB(vorbis,vorbis_info_init,vorbis_libs=yes,vorbis_libs=no)
221 if test "$vorbis_libs" = "yes"; then
223 LIBS="$LIBS -lvorbis"
224 AC_CHECK_LIB(vorbisfile,ov_open_callbacks,vorbisfile_libs=yes,vorbisfile_libs=no)
225 if test "$vorbisfile_libs" = "yes"; then
226 LIBS="$LIBS -lvorbisfile"
227 AC_DEFINE_UNQUOTED([USE_VORBIS_INPUT], 1, [Define to use libvorbis for ogg support])
236 if test "$enable_audiofile" != "no"; then
237 AC_CHECK_PROG(af_config,audiofile-config,yes,no)
238 if test "$af_config" = "yes"; then
239 af_cflags=`audiofile-config --cflags`
240 if test "$af_cflags" != ""; then
241 CFLAGS="$CFLAGS $af_cflags"
243 af_libs=`audiofile-config --libs`
244 LIBS="$LIBS $af_libs"
245 AC_DEFINE_UNQUOTED([USE_AUDIOFILE_INPUT], 1, [Define to compile libaudiofile support])
246 OPTION_AUDIOFILE="yes"
248 AC_CHECK_HEADERS(audiofile.h,audiofile_headers=yes,audiofile_headers=no)
249 if test "$audiofile_headers" = "yes"; then
250 AC_CHECK_LIB(audiofile,afOpenFile,audiofile_libs=yes,audiofile_libs=no)
251 if test "$audiofile_libs" = "yes"; then
252 LIBS="$LIBS -laudiofile"
253 AC_DEFINE_UNQUOTED([USE_AUDIOFILE_INPUT], 1, [Define to compile libaudiofile support])
254 OPTION_AUDIOFILE="yes"
260 if test "$enable_mpg123" != "no"; then
261 AC_CHECK_PROG(MPG123_PROG, mpg123, yes)
262 if test "$MPG123_PROG" = "yes"; then
263 if test "$SOX_PROG" = "yes"; then
264 AC_DEFINE_UNQUOTED([USE_MPG123_INPUT], 1, [Define mp3-input through mpg123 - requires sox as well])
267 AC_CHECK_PROG(SOX_PROG, sox, yes)
268 if test "$SOX_PROG" = "yes"; then
269 AC_DEFINE_UNQUOTED([USE_MPG123_INPUT], 1, [Define mp3-input through mpg123 - requires sox as well])
272 AC_MSG_RESULT([** mpg123 support disabled: couldn't find sox! **])
278 if test "$enable_ogg123" != "no"; then
279 AC_CHECK_PROG(OGG123_PROG, ogg123, yes)
280 if test "$OGG123_PROG" = "yes"; then
281 AC_DEFINE_UNQUOTED([USE_OGG123_INPUT], 1, [Define if you want UGLY ogg-input "support" - also requires sox])
286 if test "$enable_movqfix" = "no"; then
287 AC_DEFINE_UNQUOTED([OVERRIDE_MOVQ_AUTODETECT], 1, [Do nott use movqfix])
295 if test "$enable_alsa" != "no"; then
296 AC_CHECK_LIB(asound, snd_pcm_writei,alsalib=yes,alsalib=no)
297 AC_CHECK_HEADERS(alsa/asoundlib.h,alsaheader=yes,alsaheader=no)
299 if test "$alsalib" = "yes"; then
300 if test "$alsaheader" = "yes"; then
301 AC_DEFINE_UNQUOTED([USE_ALSA], 1, [ Define to enable ALSA audio backend. ])
302 LIBS="$LIBS -lasound"
306 if test "$enable_alsa" = "yes"; then
307 AC_MSG_ERROR([** Could not find ALSA header file sys/asoundlib.h **])
311 if test "$enable_alsa" = "yes"; then
312 AC_MSG_ERROR([** Could not find ALSA library libasound. **])
317 if test "$enable_jack" != "no"; then
318 AC_CHECK_LIB(jack,jack_activate,jacklib=yes,jacklib=no)
319 AC_CHECK_HEADERS(jack/jack.h,jackheader=yes,jackheader=no)
321 if test "$jacklib" = "yes"; then
322 if test "$jackheader" = "yes"; then
323 AC_DEFINE_UNQUOTED([USE_JACK], 1, [ Define to enable JACK audio backend.])
328 if test "$enable_jack" = "yes"; then
329 AC_MSG_ERROR([** Could not find JACK header file jack/jack.h **])
333 if test "$enable_jack" = "yes"; then
334 AC_MSG_ERROR([** Could not find JACK library libjack. **])
339 if test "$enable_pulse" != "no"; then
340 AC_CHECK_LIB(pulse-simple,pa_simple_new,pulselib=yes,pulselib=no)
341 AC_CHECK_HEADERS(pulse/pulseaudio.h,pulseheader=yes,pulseheader=no)
343 if test "$pulselib" = "yes"; then
344 if test "$pulseheader" = "yes"; then
345 AC_DEFINE_UNQUOTED([USE_PULSE], 1, [ Define to enable PULSE audio backend.])
346 LIBS="$LIBS -lpulse-simple -lpulse"
350 if test "$enable_pulse" = "yes"; then
351 AC_MSG_ERROR([** Could not find PULSE header file pulse/pulseaudio.h **])
355 if test "$enable_pulse" = "yes"; then
356 AC_MSG_ERROR([** Could not find PULSE library libpulse. **])
363 if test "$enable_oss" != "no"; then
364 AC_CHECK_HEADERS(sys/ioctl.h sys/soundcard.h,oss=yes,oss=no)
366 if test "$oss" = "yes"; then
367 AC_DEFINE_UNQUOTED([USE_OSS], 1, [Use OSS])
371 if test "$enable_oss" = "yes"; then
372 AC_MSG_ERROR([** Could not find OSS header files. ***])
377 if test "$enable_alsamidi" != "no"; then
378 if test "$using_alsa" = "yes"; then
379 AC_DEFINE_UNQUOTED([USE_ALSA_MIDI_IN], 1, [Define for ALSA MIDI in support])
380 OPTION_ALSAMIDI="yes"
382 AC_CHECK_LIB(asound, snd_seq_open,alsalib=yes,alsalib=no)
383 AC_CHECK_HEADERS(alsa/asoundlib.h,alsaheader=yes,alsaheader=no)
385 if test "$alsalib" = "yes"; then
386 if test "$alsaheader" = "yes"; then
387 AC_DEFINE_UNQUOTED([USE_ALSA_MIDI_IN], 1, [Define for ALSA MIDI in support])
388 LIBS="$LIBS -lasound"
389 OPTION_ALSAMIDI="yes"
391 if test "$enable_alsamidi" = "yes"; then
392 AC_MSG_ERROR([** Coulnd't find ALSA header file alsa/asoundlib.h **])
396 if test "$enable_alsamidin" = "yes"; then
397 AC_MSG_ERROR([** Couldn't find ALSA library libasound. **])
403 if test "$using_alsa" != "yes"; then
404 if test "$using_oss" != "yes"; then
405 if test "$using_jack" != "yes"; then
406 if test "$using_pulse" != "yes"; then
407 AC_MSG_ERROR([** Found neither OSS, ALSA, JACK nor PULSE - no output device! **])
413 if test "$enable_x11" != "no"; then
414 AC_CHECK_LIB(X11, XOpenDisplay, x11lib=yes, x11lib=no)
415 AC_CHECK_HEADERS(X11/Xlib.h, x11header=yes, x11header=no)
417 if test "$x11lib" = "yes"; then
418 if test "$x11header" = "yes"; then
419 AC_DEFINE_UNQUOTED([USE_X11], 1, [ Define to enable X11 specific code (e.g. fullscreen mode ).])
424 if test "$enable_x11" = "yes"; then
425 AC_MSG_ERROR([** X11 headers not installed or broken **])
429 if test "$enable_x11" = "yes"; then
430 AC_MSG_ERROR([** X11 libs not installed or broken **])
435 if test "$enable_wav" != "no";
437 AC_DEFINE_UNQUOTED([USE_BUILTIN_WAV], 1, [Define to enable the built-in wav loading routines])
441 if test "$enable_3dnow" = "yes"; then
442 AC_DEFINE_UNQUOTED([USE_3DNOW], 1, [Do not define this])
445 if test "$enable_scheduler" != "no"; then
446 OPTION_SCHEDULER="yes";
447 AC_DEFINE_UNQUOTED([USE_SCHEDULER], 1, [Define this to compile with rt scheduling support])
450 if test "$enable_debug" = yes; then
451 AC_DEFINE_UNQUOTED([ENABLE_DEBUG_OUTPUT], 1, [Define this to enable debug output.])
454 if test "$enable_benchmark" = yes; then
455 AC_DEFINE_UNQUOTED([CREATE_BENCHMARK], 1, [Define this to build an performance benchmark - WARNING: You cannot use the resulting binary for normal operation])
458 if test "$enable_capabilities" != "no"; then
459 AC_CHECK_HEADERS(sys/capability.h,capheader=yes,capheader=no)
460 AC_CHECK_HEADERS(sys/prctl.h,prctlheader=yes,prctlheader=no)
462 if test "$capheader" = "yes"; then
463 if test "$prctlheader" = "yes"; then
464 AC_CHECK_LIB(cap,cap_get_proc,caplib=yes,caplib=no)
465 if test "$caplib" = "yes"; then
467 AC_DEFINE_UNQUOTED([USE_CAPABILITIES], 1, [Define to use capabilities])
474 if test "$enable_capabilities" = "yes"; then
475 if test "$OPTION_CAP" != "yes"; then
476 AC_MSG_ERROR([** This system doesn't support capabilities. **])
480 if test "$enable_deprecated" = "no"; then
481 DEPRECATED_FLAGS="-DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
486 AC_SUBST(DEPRECATED_FLAGS)
488 if test "$enable_suidroot" = "no"; then
491 OPTION_SUIDROOT="yes"
494 AM_CONDITIONAL([SUIDROOT], [ test x$OPTION_SUIDROOT = xyes])
496 AC_MSG_CHECKING(for necessary scratching skillz)
499 AC_DEFINE_UNQUOTED([USE_DIAL], 1, [ Define this. ])
501 dnl if test "$enable_bigdial" = yes; then
502 dnl AC_DEFINE(USE_DIAL)
503 dnl AC_DEFINE(USE_BIG_BUTTONS)
506 if test "$enable_legacy" = yes; then
507 AC_DEFINE_UNQUOTED([ENABLE_TX_LEGACY], 1, [Define this to enable support for old tX set files])
511 dnl Detecting libxml. Based on dia's test.
514 if test "$enable_libxml2" != "no"; then
515 if ! $found_libxml; then
516 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
517 if test "x$XML2_CONFIG" != x ; then
518 AC_MSG_CHECKING(for libxml >= 2.3.9)
519 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
521 if test "$vers" -ge 2003009; then
524 XML_LIBS="`$XML2_CONFIG --libs`"
525 XML_CFLAGS="`$XML2_CONFIG --cflags`"
535 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
536 if test "x$XML_CONFIG" != x ; then
537 AC_MSG_CHECKING(for libxml >= 1.8.14)
538 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
540 dnl 1.18.14 is required for xmlUseNewParser()
541 if test "$vers" -ge 1008014; then
544 XML_LIBS="`$XML_CONFIG --libs`"
545 XML_CFLAGS="`$XML_CONFIG --cflags`"
552 if ! $found_libxml; then
553 AC_MSG_ERROR([** libxml not found. Get libxml(2) at http://www.libxml.org **])
559 if test "$enable_lrdf" != "no"; then
560 AC_MSG_CHECKING(for liblrdf >= 0.2.4)
561 LRDF_VERS=`$PKG_CONFIG --modversion lrdf | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
562 if test "$LRDF_VERS" -ge 2004; then
566 lrdf_cflags=`$PKG_CONFIG --cflags lrdf`
567 if test "$lrdf_cflags" != ""; then
568 CFLAGS="$CFLAGS $lrdf_cflags"
570 lrdf_libs=`$PKG_CONFIG --libs lrdf`
571 LIBS="$LIBS $lrdf_libs"
572 AC_DEFINE_UNQUOTED([USE_LRDF], 1, [Define to compile librdf support])
573 OPTION_AUDIOFILE="yes"
583 xml_man="\\\"${datadir}/gnome/help/terminatorX-manual/C/terminatorX-manual.xml\\\""
586 CFLAGS="$XML_CFLAGS $CFLAGS -DXML_MANUAL=$xml_man"
587 LIBS="$XML_LIBS $LIBS"
599 echo "$option support: $option_val"
600 if test "$option_val" != "yes"; then
601 echo " - If you want $option support get $option from"
602 echo " - $option_url"
603 echo " - and reconfigure terminatorX"
608 echo configured terminatorX for:
609 echo ---------------------------
612 option=sox; option_val=$OPTION_SOX; option_url=http://sox.sourceforge.net/
615 echo "mpg123 support: $OPTION_MPG123"
616 if test "$OPTION_MPG123" = "no"; then
617 echo " - If you want mpg123 support get either mpg321 from"
618 echo " - http://mpg321.sourceforge.net/ or mpg123 from"
619 echo " - http://www.mpg123.de/"
620 echo " - and reconfigure terminatorX"
624 option=oss; option_val=$OPTION_OSS; option_url=http://www.kernel.org
627 option=alsa; option_val=$OPTION_ALSA; option_url=http://www.alsa-project.org
630 option=jack; option_val=$OPTION_JACK; option_url=http://jackit.sourceforge.net
633 option=pulse; option_val=$OPTION_PULSE; option_url=http://www.freedesktop.org/wiki/Software/PulseAudio/
636 option=mad; option_val=$OPTION_MAD; option_url=http://www.mars.org/home/rob/proj/mpeg/
639 option=ogg123; option_val=$OPTION_OGG123; option_url=http://www.xiph.org/ogg/vorbis/
642 option=libvorbis; option_val=$OPTION_VORBIS; option_url=http://www.xiph.org/ogg/vorbis/
645 option=audiofile; option_val=$OPTION_AUDIOFILE; option_url=http://www.68k.org/~michael/audiofile/
648 option="ALSA (MIDI in)"; option_val=$OPTION_ALSAMIDI; option_url=http://www.alsa-project.org
651 option=lrdf; option_val=$OPTION_LRDF; option_url=http://plugin.org.uk/releases/lrdf/
654 echo "x11 support: $OPTION_X11"
655 echo "legacy files support: $OPTION_LEGACY"
656 echo "builtin-wav support: $OPTION_WAV"
657 echo "enhanced scheduling support: $OPTION_SCHEDULER"
658 echo "capabilities support: $OPTION_CAP"
659 echo "install setuid-root: $OPTION_SUIDROOT"
661 echo You can now run \'make\' to compile terminatorX