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(libxml2, [ --disable-libxml2 use libxml even if verion 2 detected (default=auto) ])
20 AC_ARG_ENABLE(mad, [ --disable-mad disable mad for mp3 support (default=auto) ])
21 AC_ARG_ENABLE(vorbis, [ --disable-vorbis disable libvorbis support (default=auto) ])
22 AC_ARG_ENABLE(audiofile, [ --disable-audiofile disable audiofile support (default=auto) ])
23 AC_ARG_ENABLE(startup, [ --disable-startup disable startup-notification (default=auto) ])
24 AC_ARG_ENABLE(legacy, [ --enable-legacy enable support for old terminatorX files (default=no) ])
25 AC_ARG_ENABLE(alsamidi, [ --disable-alsamidi disable support ALSA MIDI in (default=auto) ])
26 AC_ARG_ENABLE(lrdf, [ --disable-lrdf disable support for liblrdf (default=auto) ])
27 AC_ARG_ENABLE(capabilities, [ --enable-capabilities to use rt-scheduling (default=auto) ])
28 AC_ARG_ENABLE(deprecated, [ --disable-deprecated compile without deprecated G*-headers (default=no) ])
29 AC_ARG_WITH(docdir, [ --with-docdir=/some/dir the final location the docs will be installed to. ])
31 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 if test "$enable_vorbis" != "no"; then
214 AC_CHECK_HEADERS(vorbis/codec.h vorbis/vorbisfile.h,vorbis_headers=yes,vorbis_headers="no")
215 if test "$vorbis_headers" = "yes"; then
216 AC_CHECK_LIB(vorbis,vorbis_info_init,vorbis_libs=yes,vorbis_libs=no)
217 if test "$vorbis_libs" = "yes"; then
219 LIBS="$LIBS -lvorbis"
220 AC_CHECK_LIB(vorbisfile,ov_open_callbacks,vorbisfile_libs=yes,vorbisfile_libs=no)
221 if test "$vorbisfile_libs" = "yes"; then
222 LIBS="$LIBS -lvorbisfile"
223 AC_DEFINE_UNQUOTED([USE_VORBIS_INPUT], 1, [Define to use libvorbis for ogg support])
232 if test "$enable_audiofile" != "no"; then
233 AC_CHECK_PROG(af_config,audiofile-config,yes,no)
234 if test "$af_config" = "yes"; then
235 af_cflags=`audiofile-config --cflags`
236 if test "$af_cflags" != ""; then
237 CFLAGS="$CFLAGS $af_cflags"
239 af_libs=`audiofile-config --libs`
240 LIBS="$LIBS $af_libs"
241 AC_DEFINE_UNQUOTED([USE_AUDIOFILE_INPUT], 1, [Define to compile libaudiofile support])
242 OPTION_AUDIOFILE="yes"
244 AC_CHECK_HEADERS(audiofile.h,audiofile_headers=yes,audiofile_headers=no)
245 if test "$audiofile_headers" = "yes"; then
246 AC_CHECK_LIB(audiofile,afOpenFile,audiofile_libs=yes,audiofile_libs=no)
247 if test "$audiofile_libs" = "yes"; then
248 LIBS="$LIBS -laudiofile"
249 AC_DEFINE_UNQUOTED([USE_AUDIOFILE_INPUT], 1, [Define to compile libaudiofile support])
250 OPTION_AUDIOFILE="yes"
256 if test "$enable_mpg123" != "no"; then
257 AC_CHECK_PROG(MPG123_PROG, mpg123, yes)
258 if test "$MPG123_PROG" = "yes"; then
259 if test "$SOX_PROG" = "yes"; then
260 AC_DEFINE_UNQUOTED([USE_MPG123_INPUT], 1, [Define mp3-input through mpg123 - requires sox as well])
263 AC_CHECK_PROG(SOX_PROG, sox, yes)
264 if test "$SOX_PROG" = "yes"; then
265 AC_DEFINE_UNQUOTED([USE_MPG123_INPUT], 1, [Define mp3-input through mpg123 - requires sox as well])
268 AC_MSG_RESULT([** mpg123 support disabled: couldn't find sox! **])
274 if test "$enable_ogg123" != "no"; then
275 AC_CHECK_PROG(OGG123_PROG, ogg123, yes)
276 if test "$OGG123_PROG" = "yes"; then
277 AC_DEFINE_UNQUOTED([USE_OGG123_INPUT], 1, [Define if you want UGLY ogg-input "support" - also requires sox])
282 if test "$enable_movqfix" = "no"; then
283 AC_DEFINE_UNQUOTED([OVERRIDE_MOVQ_AUTODETECT], 1, [Do nott use movqfix])
291 if test "$enable_alsa" != "no"; then
292 AC_CHECK_LIB(asound, snd_pcm_writei,alsalib=yes,alsalib=no)
293 AC_CHECK_HEADERS(alsa/asoundlib.h,alsaheader=yes,alsaheader=no)
295 if test "$alsalib" = "yes"; then
296 if test "$alsaheader" = "yes"; then
297 AC_DEFINE_UNQUOTED([USE_ALSA], 1, [ Define to enable ALSA audio backend. ])
298 LIBS="$LIBS -lasound"
302 if test "$enable_alsa" = "yes"; then
303 AC_MSG_ERROR([** Could not find ALSA header file sys/asoundlib.h **])
307 if test "$enable_alsa" = "yes"; then
308 AC_MSG_ERROR([** Could not find ALSA library libasound. **])
313 if test "$enable_jack" != "no"; then
314 AC_CHECK_LIB(jack,jack_activate,jacklib=yes,jacklib=no)
315 AC_CHECK_HEADERS(jack/jack.h,jackheader=yes,jackheader=no)
317 if test "$jacklib" = "yes"; then
318 if test "$jackheader" = "yes"; then
319 AC_DEFINE_UNQUOTED([USE_JACK], 1, [ Define to enable JACK audio backend.])
324 if test "$enable_jack" = "yes"; then
325 AC_MSG_ERROR([** Could not find JACK header file jack/jack.h **])
329 if test "$enable_jack" = "yes"; then
330 AC_MSG_ERROR([** Could not find JACK library libjack. **])
335 if test "$enable_pulse" != "no"; then
336 AC_CHECK_LIB(pulse-simple,pa_simple_new,pulselib=yes,pulselib=no)
337 AC_CHECK_HEADERS(pulse/pulseaudio.h,pulseheader=yes,pulseheader=no)
339 if test "$pulselib" = "yes"; then
340 if test "$pulseheader" = "yes"; then
341 AC_DEFINE_UNQUOTED([USE_PULSE], 1, [ Define to enable PULSE audio backend.])
342 LIBS="$LIBS -lpulse-simple -lpulse"
346 if test "$enable_pulse" = "yes"; then
347 AC_MSG_ERROR([** Could not find PULSE header file pulse/pulseaudio.h **])
351 if test "$enable_pulse" = "yes"; then
352 AC_MSG_ERROR([** Could not find PULSE library libpulse. **])
359 if test "$enable_oss" != "no"; then
360 AC_CHECK_HEADERS(sys/ioctl.h sys/soundcard.h,oss=yes,oss=no)
362 if test "$oss" = "yes"; then
363 AC_DEFINE_UNQUOTED([USE_OSS], 1, [Use OSS])
367 if test "$enable_oss" = "yes"; then
368 AC_MSG_ERROR([** Could not find OSS header files. ***])
373 if test "$enable_alsamidi" != "no"; then
374 if test "$using_alsa" = "yes"; then
375 AC_DEFINE_UNQUOTED([USE_ALSA_MIDI_IN], 1, [Define for ALSA MIDI in support])
376 OPTION_ALSAMIDI="yes"
378 AC_CHECK_LIB(asound, snd_seq_open,alsalib=yes,alsalib=no)
379 AC_CHECK_HEADERS(alsa/asoundlib.h,alsaheader=yes,alsaheader=no)
381 if test "$alsalib" = "yes"; then
382 if test "$alsaheader" = "yes"; then
383 AC_DEFINE_UNQUOTED([USE_ALSA_MIDI_IN], 1, [Define for ALSA MIDI in support])
384 LIBS="$LIBS -lasound"
385 OPTION_ALSAMIDI="yes"
387 if test "$enable_alsamidi" = "yes"; then
388 AC_MSG_ERROR([** Coulnd't find ALSA header file alsa/asoundlib.h **])
392 if test "$enable_alsamidin" = "yes"; then
393 AC_MSG_ERROR([** Couldn't find ALSA library libasound. **])
399 if test "$using_alsa" != "yes"; then
400 if test "$using_oss" != "yes"; then
401 if test "$using_jack" != "yes"; then
402 if test "$using_pulse" != "yes"; then
403 AC_MSG_ERROR([** Found neither OSS, ALSA, JACK nor PULSE - no output device! **])
409 if test "$enable_wav" != "no";
411 AC_DEFINE_UNQUOTED([USE_BUILTIN_WAV], 1, [Define to enable the built-in wav loading routines])
415 if test "$enable_3dnow" = "yes"; then
416 AC_DEFINE_UNQUOTED([USE_3DNOW], 1, [Do not define this])
419 if test "$enable_scheduler" != "no"; then
420 OPTION_SCHEDULER="yes";
421 AC_DEFINE_UNQUOTED([USE_SCHEDULER], 1, [Define this to compile with rt scheduling support])
424 if test "$enable_debug" = yes; then
425 AC_DEFINE_UNQUOTED([ENABLE_DEBUG_OUTPUT], 1, [Define this to enable debug output.])
428 if test "$enable_benchmark" = yes; then
429 AC_DEFINE_UNQUOTED([CREATE_BENCHMARK], 1, [Define this to build an performance benchmark - WARNING: You cannot use the resulting binary for normal operation])
432 if test "$enable_capabilities" != "no"; then
433 AC_CHECK_HEADERS(sys/capability.h,capheader=yes,capheader=no)
434 AC_CHECK_HEADERS(sys/prctl.h,prctlheader=yes,prctlheader=no)
436 if test "$capheader" = "yes"; then
437 if test "$prctlheader" = "yes"; then
438 AC_CHECK_LIB(cap,cap_get_proc,caplib=yes,caplib=no)
439 if test "$caplib" = "yes"; then
441 AC_DEFINE_UNQUOTED([USE_CAPABILITIES], 1, [Define to use capabilities])
448 if test "$enable_capabilities" = "yes"; then
449 if test "$OPTION_CAP" != "yes"; then
450 AC_MSG_ERROR([** This system doesn't support capabilities. **])
456 if test "$enable_deprecated" = "no"; then
457 DEPRECATED_FLAGS="-DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
462 AC_SUBST(DEPRECATED_FLAGS)
464 AC_MSG_CHECKING(for necessary scratching skillz)
467 AC_DEFINE_UNQUOTED([USE_DIAL], 1, [ Define this. ])
469 dnl if test "$enable_bigdial" = yes; then
470 dnl AC_DEFINE(USE_DIAL)
471 dnl AC_DEFINE(USE_BIG_BUTTONS)
474 if test "$enable_legacy" = yes; then
475 AC_DEFINE_UNQUOTED([ENABLE_TX_LEGACY], 1, [Define this to enable support for old tX set files])
479 dnl Detecting libxml. Based on dia's test.
482 if test "$enable_libxml2" != "no"; then
483 if ! $found_libxml; then
484 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
485 if test "x$XML2_CONFIG" != x ; then
486 AC_MSG_CHECKING(for libxml >= 2.3.9)
487 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
489 if test "$vers" -ge 2003009; then
492 XML_LIBS="`$XML2_CONFIG --libs`"
493 XML_CFLAGS="`$XML2_CONFIG --cflags`"
503 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
504 if test "x$XML_CONFIG" != x ; then
505 AC_MSG_CHECKING(for libxml >= 1.8.14)
506 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
508 dnl 1.18.14 is required for xmlUseNewParser()
509 if test "$vers" -ge 1008014; then
512 XML_LIBS="`$XML_CONFIG --libs`"
513 XML_CFLAGS="`$XML_CONFIG --cflags`"
520 if ! $found_libxml; then
521 AC_MSG_ERROR([** libxml not found. Get libxml(2) at http://www.libxml.org **])
527 if test "$enable_lrdf" != "no"; then
528 AC_MSG_CHECKING(for liblrdf >= 0.2.4)
529 LRDF_VERS=`$PKG_CONFIG --modversion lrdf | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
530 if test "$LRDF_VERS" -ge 2004; then
534 lrdf_cflags=`$PKG_CONFIG --cflags lrdf`
535 if test "$lrdf_cflags" != ""; then
536 CFLAGS="$CFLAGS $lrdf_cflags"
538 lrdf_libs=`$PKG_CONFIG --libs lrdf`
539 LIBS="$LIBS $lrdf_libs"
540 AC_DEFINE_UNQUOTED([USE_LRDF], 1, [Define to compile librdf support])
541 OPTION_AUDIOFILE="yes"
551 xml_man="\\\"${datadir}/gnome/help/terminatorX-manual/C/terminatorX-manual.xml\\\""
553 dnl Now Check for Xlibs - I do this here as other tests fail if these run earlier
558 AC_SUBST(X_EXTRA_LIBS)
560 AC_SUBST(x_libraries)
562 GTK_LIBS="$GTK_LIBS $X_LIBS"
563 AC_CHECK_LIB(X11, XOpenDisplay,, AC_MSG_ERROR([** X11-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
565 CFLAGS="$XML_CFLAGS $CFLAGS -DXML_MANUAL=$xml_man"
566 LIBS="$XML_LIBS $LIBS"
578 echo "$option support: $option_val"
579 if test "$option_val" != "yes"; then
580 echo " - If you want $option support get $option from"
581 echo " - $option_url"
582 echo " - and reconfigure terminatorX"
587 echo configured terminatorX for:
588 echo ---------------------------
591 option=sox; option_val=$OPTION_SOX; option_url=http://sox.sourceforge.net/
594 echo "mpg123 support: $OPTION_MPG123"
595 if test "$OPTION_MPG123" = "no"; then
596 echo " - If you want mpg123 support get either mpg321 from"
597 echo " - http://mpg321.sourceforge.net/ or mpg123 from"
598 echo " - http://www.mpg123.de/"
599 echo " - and reconfigure terminatorX"
603 option=oss; option_val=$OPTION_OSS; option_url=http://www.kernel.org
606 option=alsa; option_val=$OPTION_ALSA; option_url=http://www.alsa-project.org
609 option=jack; option_val=$OPTION_JACK; option_url=http://jackit.sourceforge.net
612 option=pulse; option_val=$OPTION_PULSE; option_url=http://www.freedesktop.org/wiki/Software/PulseAudio/
615 option=mad; option_val=$OPTION_MAD; option_url=http://www.mars.org/home/rob/proj/mpeg/
618 option=ogg123; option_val=$OPTION_OGG123; option_url=http://www.xiph.org/ogg/vorbis/
621 option=libvorbis; option_val=$OPTION_VORBIS; option_url=http://www.xiph.org/ogg/vorbis/
624 option=audiofile; option_val=$OPTION_AUDIOFILE; option_url=http://www.68k.org/~michael/audiofile/
627 option="ALSA (MIDI in)"; option_val=$OPTION_ALSAMIDI; option_url=http://www.alsa-project.org
630 option=lrdf; option_val=$OPTION_LRDF; option_url=http://plugin.org.uk/releases/lrdf/
633 echo "legacy files support: $OPTION_LEGACY"
634 echo "builtin-wav support: $OPTION_WAV"
635 echo "enhanced scheduling support: $OPTION_SCHEDULER"
636 echo "capabilities support: $OPTION_CAP"
638 echo You can now run \'make\' to compile terminatorX