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_ENABLE(suidroot, [ --disable-suidroot to avoid setuid root upon installation (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.
58 dnl Checks for libraries.
59 AC_CHECK_LIB(m, floor,, AC_MSG_ERROR([** math-lib not installed or broken **]))
61 dnl Checking whether -pthreads, -lpthreads or simply nothing
65 dnl Some machines don't require any switches for pthread support...
67 AC_MSG_CHECKING([whether pthreads works without switches])
71 AC_TRY_LINK([#include <pthread.h>], [ pthread_t thread; pthread_create(&thread, NULL, NULL, NULL);],
76 AC_MSG_RESULT([$no_threads_flags])
78 if test "$no_threads_flags" = "yes"; then
82 dnl Some machines prefer the -lpthread...
84 if test "$tX_threads" = "no"; then
86 AC_CHECK_LIB(pthread, pthread_detach, pthread_lib=yes, pthread_lib=no)
88 if test "$pthread_lib" = "yes"; then
90 LIBS="$LIBS -lpthread"
94 dnl Some machines prefer a -pthread...
96 if test "$tX_threads" = "no"; then
97 AC_MSG_CHECKING([whether -pthread is required for pthreads])
99 ac_save_CFLAGS=$CFLAGS
100 CFLAGS="$CFLAGS -pthread"
103 AC_TRY_LINK([#include <pthread.h>], [ pthread_t thread; pthread_create(&thread, NULL, NULL, NULL);],
108 CFLAGS=$ac_save_CFLAGS
109 AC_MSG_RESULT([$use_gcc_threads])
111 if test "$use_gcc_threads" = "yes"; then
113 CFLAGS="$CFLAGS -pthread"
117 dnl If we still haven't found pthreads, we panic...
119 if test "$tX_threads" = "no"; then
120 AC_MSG_ERROR([** failed to detect pthreads implementation **])
124 AC_SEARCH_LIBS([dlclose], [dl])
129 GTK3_CFLAGS="$GTK_CFLAGS"
130 GTK3_LIBS="$GTK_LIBS"
132 GTK3_VERSION="`$PKG_CONFIG --modversion gtk+-3.0`"], [ gtk3="yes" ])
134 if test "$gtk3" = "yes"; then
135 AC_DEFINE_UNQUOTED([USE_STARTUP_NOTIFICATION], 1, [Use gtk+ statup notification.])
137 AC_MSG_ERROR([** couldn't find gtk+ > Version 3. Please upgrade (http://www.gtk.org). **])
140 dnl Checks for header files.
142 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h unistd.h)
144 dnl Disable LADSPA caching..
145 unset ac_cv_header_ladspa_h
148 AC_CHECK_HEADERS(ladspa.h, have_ladspa=yes, have_ladspa=no)
150 dnl Disable LADSPA caching..
151 unset ac_cv_header_ladspa_h
153 dnl Some people install LADSPA in /usr/local
155 if test "$have_ladspa" = "no"; then
156 ac_save_CFLAGS=$CFLAGS
157 CFLAGS="$CFLAGS -I/usr/local/include"
158 AC_CHECK_HEADERS(ladspa.h, have_ladspa=yes, have_ladspa=no)
159 CFLAGS=$ac_save_CFLAGS
161 if test "$have_ladspa" = "yes"; then
162 CFLAGS="$CFLAGS -I/usr/local/include"
166 if test "$have_ladspa" = "no"; then
167 AC_MSG_ERROR([** couldn't find ladspa.h - Install the LADSPA SDK from http://www.ladspa.org first. **])
170 ac_save_CFLAGS=$CFLAGS
171 CFLAGS="$CFLAGS -finput-charset=utf-8"
172 AC_TRY_COMPILE([#include <stdio.h>],, have_utf8=yes, have_utf8=no)
173 CFLAGS=$ac_save_CFLAGS
175 if test "$have_utf8" = "yes"; then
176 CFLAGS="$CFLAGS -finput-charset=utf-8"
179 AC_CHECK_HEADERS(zlib.h,, AC_MSG_ERROR([** couldn't find zlib.h **]))
180 AC_CHECK_LIB(z,gzprintf, LIBS="$LIBS -lz", AC_MSG_ERROR([** couldn't find libz library **]))
182 dnl Checks for typedefs, structures, and compiler characteristics.
186 dnl Checks for library functions.
187 AC_PROG_GCC_TRADITIONAL
190 if test "$enable_closedev" = "no"; then
191 AC_DEFINE_UNQUOTED([KEEP_DEV_OPEN], 1, [Define if you want keep device open])
195 if test "$enable_sox" != "no"; then
196 AC_CHECK_PROG(SOX_PROG, sox, yes)
197 if test "$SOX_PROG" = "yes"; then
198 AC_DEFINE_UNQUOTED([USE_SOX_INPUT], 1, [Define if you want to use sox as input converter])
203 if test "$enable_mad" != "no"; then
204 AC_CHECK_HEADERS(mad.h,madheader=yes,madheader=no)
205 if test "$madheader" = "yes"; then
206 AC_CHECK_LIB(mad,mad_decoder_init,madlib=yes,madlib=no)
207 if test "$madlib" = "yes"; then
209 AC_DEFINE_UNQUOTED([USE_MAD_INPUT], 1, [Define to use MAD for mp3 support])
215 if test "$enable_vorbis" != "no"; then
216 AC_CHECK_HEADERS(vorbis/codec.h vorbis/vorbisfile.h,vorbis_headers=yes,vorbis_headers="no")
217 if test "$vorbis_headers" = "yes"; then
218 AC_CHECK_LIB(vorbis,vorbis_info_init,vorbis_libs=yes,vorbis_libs=no)
219 if test "$vorbis_libs" = "yes"; then
221 LIBS="$LIBS -lvorbis"
222 AC_CHECK_LIB(vorbisfile,ov_open_callbacks,vorbisfile_libs=yes,vorbisfile_libs=no)
223 if test "$vorbisfile_libs" = "yes"; then
224 LIBS="$LIBS -lvorbisfile"
225 AC_DEFINE_UNQUOTED([USE_VORBIS_INPUT], 1, [Define to use libvorbis for ogg support])
234 if test "$enable_audiofile" != "no"; then
235 AC_CHECK_PROG(af_config,audiofile-config,yes,no)
236 if test "$af_config" = "yes"; then
237 af_cflags=`audiofile-config --cflags`
238 if test "$af_cflags" != ""; then
239 CFLAGS="$CFLAGS $af_cflags"
241 af_libs=`audiofile-config --libs`
242 LIBS="$LIBS $af_libs"
243 AC_DEFINE_UNQUOTED([USE_AUDIOFILE_INPUT], 1, [Define to compile libaudiofile support])
244 OPTION_AUDIOFILE="yes"
246 AC_CHECK_HEADERS(audiofile.h,audiofile_headers=yes,audiofile_headers=no)
247 if test "$audiofile_headers" = "yes"; then
248 AC_CHECK_LIB(audiofile,afOpenFile,audiofile_libs=yes,audiofile_libs=no)
249 if test "$audiofile_libs" = "yes"; then
250 LIBS="$LIBS -laudiofile"
251 AC_DEFINE_UNQUOTED([USE_AUDIOFILE_INPUT], 1, [Define to compile libaudiofile support])
252 OPTION_AUDIOFILE="yes"
258 if test "$enable_mpg123" != "no"; then
259 AC_CHECK_PROG(MPG123_PROG, mpg123, yes)
260 if test "$MPG123_PROG" = "yes"; then
261 if test "$SOX_PROG" = "yes"; then
262 AC_DEFINE_UNQUOTED([USE_MPG123_INPUT], 1, [Define mp3-input through mpg123 - requires sox as well])
265 AC_CHECK_PROG(SOX_PROG, sox, yes)
266 if test "$SOX_PROG" = "yes"; then
267 AC_DEFINE_UNQUOTED([USE_MPG123_INPUT], 1, [Define mp3-input through mpg123 - requires sox as well])
270 AC_MSG_RESULT([** mpg123 support disabled: couldn't find sox! **])
276 if test "$enable_ogg123" != "no"; then
277 AC_CHECK_PROG(OGG123_PROG, ogg123, yes)
278 if test "$OGG123_PROG" = "yes"; then
279 AC_DEFINE_UNQUOTED([USE_OGG123_INPUT], 1, [Define if you want UGLY ogg-input "support" - also requires sox])
284 if test "$enable_movqfix" = "no"; then
285 AC_DEFINE_UNQUOTED([OVERRIDE_MOVQ_AUTODETECT], 1, [Do nott use movqfix])
293 if test "$enable_alsa" != "no"; then
294 AC_CHECK_LIB(asound, snd_pcm_writei,alsalib=yes,alsalib=no)
295 AC_CHECK_HEADERS(alsa/asoundlib.h,alsaheader=yes,alsaheader=no)
297 if test "$alsalib" = "yes"; then
298 if test "$alsaheader" = "yes"; then
299 AC_DEFINE_UNQUOTED([USE_ALSA], 1, [ Define to enable ALSA audio backend. ])
300 LIBS="$LIBS -lasound"
304 if test "$enable_alsa" = "yes"; then
305 AC_MSG_ERROR([** Could not find ALSA header file sys/asoundlib.h **])
309 if test "$enable_alsa" = "yes"; then
310 AC_MSG_ERROR([** Could not find ALSA library libasound. **])
315 if test "$enable_jack" != "no"; then
316 AC_CHECK_LIB(jack,jack_activate,jacklib=yes,jacklib=no)
317 AC_CHECK_HEADERS(jack/jack.h,jackheader=yes,jackheader=no)
319 if test "$jacklib" = "yes"; then
320 if test "$jackheader" = "yes"; then
321 AC_DEFINE_UNQUOTED([USE_JACK], 1, [ Define to enable JACK audio backend.])
326 if test "$enable_jack" = "yes"; then
327 AC_MSG_ERROR([** Could not find JACK header file jack/jack.h **])
331 if test "$enable_jack" = "yes"; then
332 AC_MSG_ERROR([** Could not find JACK library libjack. **])
337 if test "$enable_pulse" != "no"; then
338 AC_CHECK_LIB(pulse-simple,pa_simple_new,pulselib=yes,pulselib=no)
339 AC_CHECK_HEADERS(pulse/pulseaudio.h,pulseheader=yes,pulseheader=no)
341 if test "$pulselib" = "yes"; then
342 if test "$pulseheader" = "yes"; then
343 AC_DEFINE_UNQUOTED([USE_PULSE], 1, [ Define to enable PULSE audio backend.])
344 LIBS="$LIBS -lpulse-simple -lpulse"
348 if test "$enable_pulse" = "yes"; then
349 AC_MSG_ERROR([** Could not find PULSE header file pulse/pulseaudio.h **])
353 if test "$enable_pulse" = "yes"; then
354 AC_MSG_ERROR([** Could not find PULSE library libpulse. **])
361 if test "$enable_oss" != "no"; then
362 AC_CHECK_HEADERS(sys/ioctl.h sys/soundcard.h,oss=yes,oss=no)
364 if test "$oss" = "yes"; then
365 AC_DEFINE_UNQUOTED([USE_OSS], 1, [Use OSS])
369 if test "$enable_oss" = "yes"; then
370 AC_MSG_ERROR([** Could not find OSS header files. ***])
375 if test "$enable_alsamidi" != "no"; then
376 if test "$using_alsa" = "yes"; then
377 AC_DEFINE_UNQUOTED([USE_ALSA_MIDI_IN], 1, [Define for ALSA MIDI in support])
378 OPTION_ALSAMIDI="yes"
380 AC_CHECK_LIB(asound, snd_seq_open,alsalib=yes,alsalib=no)
381 AC_CHECK_HEADERS(alsa/asoundlib.h,alsaheader=yes,alsaheader=no)
383 if test "$alsalib" = "yes"; then
384 if test "$alsaheader" = "yes"; then
385 AC_DEFINE_UNQUOTED([USE_ALSA_MIDI_IN], 1, [Define for ALSA MIDI in support])
386 LIBS="$LIBS -lasound"
387 OPTION_ALSAMIDI="yes"
389 if test "$enable_alsamidi" = "yes"; then
390 AC_MSG_ERROR([** Coulnd't find ALSA header file alsa/asoundlib.h **])
394 if test "$enable_alsamidin" = "yes"; then
395 AC_MSG_ERROR([** Couldn't find ALSA library libasound. **])
401 if test "$using_alsa" != "yes"; then
402 if test "$using_oss" != "yes"; then
403 if test "$using_jack" != "yes"; then
404 if test "$using_pulse" != "yes"; then
405 AC_MSG_ERROR([** Found neither OSS, ALSA, JACK nor PULSE - no output device! **])
411 if test "$enable_wav" != "no";
413 AC_DEFINE_UNQUOTED([USE_BUILTIN_WAV], 1, [Define to enable the built-in wav loading routines])
417 if test "$enable_3dnow" = "yes"; then
418 AC_DEFINE_UNQUOTED([USE_3DNOW], 1, [Do not define this])
421 if test "$enable_scheduler" != "no"; then
422 OPTION_SCHEDULER="yes";
423 AC_DEFINE_UNQUOTED([USE_SCHEDULER], 1, [Define this to compile with rt scheduling support])
426 if test "$enable_debug" = yes; then
427 AC_DEFINE_UNQUOTED([ENABLE_DEBUG_OUTPUT], 1, [Define this to enable debug output.])
430 if test "$enable_benchmark" = yes; then
431 AC_DEFINE_UNQUOTED([CREATE_BENCHMARK], 1, [Define this to build an performance benchmark - WARNING: You cannot use the resulting binary for normal operation])
434 if test "$enable_capabilities" != "no"; then
435 AC_CHECK_HEADERS(sys/capability.h,capheader=yes,capheader=no)
436 AC_CHECK_HEADERS(sys/prctl.h,prctlheader=yes,prctlheader=no)
438 if test "$capheader" = "yes"; then
439 if test "$prctlheader" = "yes"; then
440 AC_CHECK_LIB(cap,cap_get_proc,caplib=yes,caplib=no)
441 if test "$caplib" = "yes"; then
443 AC_DEFINE_UNQUOTED([USE_CAPABILITIES], 1, [Define to use capabilities])
450 if test "$enable_capabilities" = "yes"; then
451 if test "$OPTION_CAP" != "yes"; then
452 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 if test "$enable_suidroot" = "no"; then
467 OPTION_SUIDROOT="yes"
470 AM_CONDITIONAL([SUIDROOT], [ test x$OPTION_SUIDROOT = xyes])
472 AC_MSG_CHECKING(for necessary scratching skillz)
475 AC_DEFINE_UNQUOTED([USE_DIAL], 1, [ Define this. ])
477 dnl if test "$enable_bigdial" = yes; then
478 dnl AC_DEFINE(USE_DIAL)
479 dnl AC_DEFINE(USE_BIG_BUTTONS)
482 if test "$enable_legacy" = yes; then
483 AC_DEFINE_UNQUOTED([ENABLE_TX_LEGACY], 1, [Define this to enable support for old tX set files])
487 dnl Detecting libxml. Based on dia's test.
490 if test "$enable_libxml2" != "no"; then
491 if ! $found_libxml; then
492 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
493 if test "x$XML2_CONFIG" != x ; then
494 AC_MSG_CHECKING(for libxml >= 2.3.9)
495 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
497 if test "$vers" -ge 2003009; then
500 XML_LIBS="`$XML2_CONFIG --libs`"
501 XML_CFLAGS="`$XML2_CONFIG --cflags`"
511 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
512 if test "x$XML_CONFIG" != x ; then
513 AC_MSG_CHECKING(for libxml >= 1.8.14)
514 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
516 dnl 1.18.14 is required for xmlUseNewParser()
517 if test "$vers" -ge 1008014; then
520 XML_LIBS="`$XML_CONFIG --libs`"
521 XML_CFLAGS="`$XML_CONFIG --cflags`"
528 if ! $found_libxml; then
529 AC_MSG_ERROR([** libxml not found. Get libxml(2) at http://www.libxml.org **])
535 if test "$enable_lrdf" != "no"; then
536 AC_MSG_CHECKING(for liblrdf >= 0.2.4)
537 LRDF_VERS=`$PKG_CONFIG --modversion lrdf | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
538 if test "$LRDF_VERS" -ge 2004; then
542 lrdf_cflags=`$PKG_CONFIG --cflags lrdf`
543 if test "$lrdf_cflags" != ""; then
544 CFLAGS="$CFLAGS $lrdf_cflags"
546 lrdf_libs=`$PKG_CONFIG --libs lrdf`
547 LIBS="$LIBS $lrdf_libs"
548 AC_DEFINE_UNQUOTED([USE_LRDF], 1, [Define to compile librdf support])
549 OPTION_AUDIOFILE="yes"
559 xml_man="\\\"${datadir}/gnome/help/terminatorX-manual/C/terminatorX-manual.xml\\\""
561 dnl Now Check for Xlibs - I do this here as other tests fail if these run earlier
566 AC_SUBST(X_EXTRA_LIBS)
568 AC_SUBST(x_libraries)
570 GTK_LIBS="$GTK_LIBS $X_LIBS"
571 AC_CHECK_LIB(X11, XOpenDisplay,, AC_MSG_ERROR([** X11-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
573 CFLAGS="$XML_CFLAGS $CFLAGS -DXML_MANUAL=$xml_man"
574 LIBS="$XML_LIBS $LIBS"
586 echo "$option support: $option_val"
587 if test "$option_val" != "yes"; then
588 echo " - If you want $option support get $option from"
589 echo " - $option_url"
590 echo " - and reconfigure terminatorX"
595 echo configured terminatorX for:
596 echo ---------------------------
599 option=sox; option_val=$OPTION_SOX; option_url=http://sox.sourceforge.net/
602 echo "mpg123 support: $OPTION_MPG123"
603 if test "$OPTION_MPG123" = "no"; then
604 echo " - If you want mpg123 support get either mpg321 from"
605 echo " - http://mpg321.sourceforge.net/ or mpg123 from"
606 echo " - http://www.mpg123.de/"
607 echo " - and reconfigure terminatorX"
611 option=oss; option_val=$OPTION_OSS; option_url=http://www.kernel.org
614 option=alsa; option_val=$OPTION_ALSA; option_url=http://www.alsa-project.org
617 option=jack; option_val=$OPTION_JACK; option_url=http://jackit.sourceforge.net
620 option=pulse; option_val=$OPTION_PULSE; option_url=http://www.freedesktop.org/wiki/Software/PulseAudio/
623 option=mad; option_val=$OPTION_MAD; option_url=http://www.mars.org/home/rob/proj/mpeg/
626 option=ogg123; option_val=$OPTION_OGG123; option_url=http://www.xiph.org/ogg/vorbis/
629 option=libvorbis; option_val=$OPTION_VORBIS; option_url=http://www.xiph.org/ogg/vorbis/
632 option=audiofile; option_val=$OPTION_AUDIOFILE; option_url=http://www.68k.org/~michael/audiofile/
635 option="ALSA (MIDI in)"; option_val=$OPTION_ALSAMIDI; option_url=http://www.alsa-project.org
638 option=lrdf; option_val=$OPTION_LRDF; option_url=http://plugin.org.uk/releases/lrdf/
641 echo "legacy files support: $OPTION_LEGACY"
642 echo "builtin-wav support: $OPTION_WAV"
643 echo "enhanced scheduling support: $OPTION_SCHEDULER"
644 echo "capabilities support: $OPTION_CAP"
645 echo "install setuid-root: $OPTION_SUIDROOT"
647 echo You can now run \'make\' to compile terminatorX