Merge branch 'master' of lisas.de:/home/staff/alex/.public_html/tX/src/terminatorX
[terminatorX.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([terminatorX], [3.90], [https://terminatorx.org/bugs/], [terminatorX])
3
4 AC_CONFIG_SRCDIR([src/tX_global.h])
5 AM_INIT_AUTOMAKE
6 AM_CONFIG_HEADER(config.h)
7
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 AC_ARG_ENABLE(pulse,            [  --enable-pulse          use PULSE for sound output (default=auto) ])
20 dnl AC_ARG_ENABLE(dga2,         [  --enable-dga2           use DGA2 instead of DGA1. (experimental) (default=no) ])
21 AC_ARG_ENABLE(libxml2,          [  --disable-libxml2       use libxml even if verion 2 detected (default=auto) ])
22 AC_ARG_ENABLE(mad,              [  --disable-mad           disable mad for mp3 support (default=auto) ])
23 AC_ARG_ENABLE(vorbis,           [  --disable-vorbis        disable libvorbis support (default=auto) ])
24 AC_ARG_ENABLE(audiofile,        [  --disable-audiofile     disable audiofile support (default=auto) ])
25 AC_ARG_ENABLE(startup,          [  --disable-startup       disable startup-notification (default=auto) ])
26 AC_ARG_ENABLE(legacy,           [  --enable-legacy         enable support for old terminatorX files (default=no) ])
27 AC_ARG_ENABLE(alsamidi,         [  --disable-alsamidi      disable support  ALSA MIDI in (default=auto) ])
28 AC_ARG_ENABLE(lrdf,             [  --disable-lrdf          disable support for liblrdf (default=auto) ])
29 AC_ARG_ENABLE(capabilities,     [  --enable-capabilities   to use rt-scheduling (default=auto) ])
30 AC_ARG_ENABLE(deprecated,       [  --disable-deprecated    compile without deprecated G*-headers (default=no) ])
31 AC_ARG_WITH(docdir,             [  --with-docdir=/some/dir the final location the docs will be installed to. ])
32
33 dnl Checks for programs.
34 AC_PROG_AWK
35 AC_PROG_CC
36 AC_PROG_CXX
37 AC_PROG_INSTALL
38 AC_PROG_LN_S
39 AC_PROG_RANLIB
40
41 OPTION_OSS="no"
42 OPTION_ALSA="no"
43 OPTION_JACK="no"
44 OPTION_PULSE="no"
45 OPTION_SOX="no"
46 OPTION_MPG123="no"
47 OPTION_MAD="no"
48 OPTION_OGG123="no"
49 OPTION_VORBIS="no"
50 OPTION_AUDIOFILE="no"
51 OPTION_WAV="no"
52 OPTION_SCHEDULER="no"
53 OPTION_ALSAMIDI="no"
54 OPTION_LEGACY="no"
55 OPTION_LRDF="no"
56 OPTION_CAP="no"
57
58 dnl Checks for libraries.
59 AC_CHECK_LIB(m, floor,, AC_MSG_ERROR([** math-lib not installed or broken **]))
60
61 dnl Checking whether -pthreads, -lpthreads or simply nothing
62
63 tX_threads=no
64
65 dnl Some machines don't require any switches for pthread support...
66
67 AC_MSG_CHECKING([whether pthreads works without switches])
68         no_threads_flags=no
69         AC_LANG_SAVE
70         AC_LANG_C
71         AC_TRY_LINK([#include <pthread.h>], [ pthread_t thread; pthread_create(&thread, NULL, NULL, NULL);],
72                 no_threads_flags=yes,
73                 no_threads_flags=no
74         )
75         AC_LANG_RESTORE
76 AC_MSG_RESULT([$no_threads_flags])
77
78 if test "$no_threads_flags" = "yes"; then
79         tX_threads=auto
80 fi
81
82 dnl Some machines prefer the -lpthread...
83
84 if test "$tX_threads" = "no"; then
85         pthread_lib=no
86         AC_CHECK_LIB(pthread, pthread_detach, pthread_lib=yes, pthread_lib=no)
87         
88         if test "$pthread_lib" = "yes"; then
89                 tX_threads=lpthread
90                 LIBS="$LIBS -lpthread"
91         fi
92 fi
93
94 dnl Some machines prefer a -pthread...
95
96 if test "$tX_threads" = "no"; then
97         AC_MSG_CHECKING([whether -pthread is required for pthreads])
98                 use_gcc_threads=no
99                 ac_save_CFLAGS=$CFLAGS
100                 CFLAGS="$CFLAGS -pthread"
101                 AC_LANG_SAVE
102                 AC_LANG_C
103                 AC_TRY_LINK([#include <pthread.h>], [ pthread_t thread; pthread_create(&thread, NULL, NULL, NULL);],
104                         use_gcc_threads=yes,
105                         use_gcc_threads=no
106                 )
107                 AC_LANG_RESTORE
108                 CFLAGS=$ac_save_CFLAGS
109         AC_MSG_RESULT([$use_gcc_threads])
110         
111         if test "$use_gcc_threads" = "yes"; then
112                 tX_threads=gcc
113                 CFLAGS="$CFLAGS -pthread"
114         fi
115 fi
116
117 dnl If we still haven't found pthreads, we panic...
118
119 if test "$tX_threads" = "no"; then
120         AC_MSG_ERROR([** failed to detect pthreads implementation **])
121 fi
122
123
124 AC_SEARCH_LIBS([dlclose], [dl])
125
126 dnl Check for GTK
127
128 AM_PATH_GTK_3_0(, [
129         GTK3_CFLAGS="$GTK_CFLAGS"
130         GTK3_LIBS="$GTK_LIBS"
131         gtk3="yes"
132         GTK3_VERSION="`$PKG_CONFIG --modversion gtk+-3.0`"], [ gtk3="yes" ]) 
133
134 if test "$gtk3" = "yes"; then
135         AC_DEFINE_UNQUOTED([USE_STARTUP_NOTIFICATION], 1, [Use gtk+ statup notification.])
136 else
137         AC_MSG_ERROR([** couldn't find gtk+ > Version 3. Please upgrade (http://www.gtk.org). **])
138 fi
139
140 dnl Checks for header files.
141 AC_HEADER_STDC
142 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h unistd.h)
143
144 dnl Disable LADSPA caching..
145 unset ac_cv_header_ladspa_h
146
147 have_ladspa=no
148 AC_CHECK_HEADERS(ladspa.h, have_ladspa=yes, have_ladspa=no)
149
150 dnl Disable LADSPA caching..
151 unset ac_cv_header_ladspa_h
152
153 dnl Some people install LADSPA in /usr/local
154
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
160         
161         if test "$have_ladspa" = "yes"; then
162                 CFLAGS="$CFLAGS -I/usr/local/include"
163         fi
164 fi
165
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. **])
168 fi
169
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
174
175 if test "$have_utf8" = "yes"; then
176         CFLAGS="$CFLAGS -finput-charset=utf-8"
177 fi
178
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 **]))
181
182 dnl Checks for typedefs, structures, and compiler characteristics.
183 AC_C_BIGENDIAN
184 AC_TYPE_SIZE_T
185
186 dnl Checks for library functions.
187 AC_PROG_GCC_TRADITIONAL
188
189 dnl Eval args
190 if test "$enable_closedev" = "no"; then
191         AC_DEFINE_UNQUOTED([KEEP_DEV_OPEN], 1, [Define if you want keep device open])
192 fi
193
194
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])
199                 OPTION_SOX="yes"
200         fi
201 fi
202
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
208                         LIBS="$LIBS -lmad"
209                         AC_DEFINE_UNQUOTED([USE_MAD_INPUT], 1, [Define to use MAD for mp3 support])
210                         OPTION_MAD="yes"
211                 fi
212         fi
213 fi
214
215 AC_CHECK_HEADERS(X11/extensions/Xxf86dga.h,newDgaHeader=yes,newDgaHeader=no, [#include <X11/Xlib.h>])
216
217 if test "$newDgaHeader" = "no"; then
218         AC_CHECK_HEADERS(X11/extensions/xf86dga.h,oldDgaHeader=yes,oldDgaHeader=no, [#include <X11/Xlib.h>])
219         
220         if test "$oldDgaHeader" = "no"; then
221                 AC_MSG_ERROR([** couldn't find xf86dga.h header - Install X11 headers first. **])
222         fi
223 fi
224
225 if test "$enable_vorbis" != "no"; then
226         AC_CHECK_HEADERS(vorbis/codec.h vorbis/vorbisfile.h,vorbis_headers=yes,vorbis_headers="no")
227         if test "$vorbis_headers" = "yes"; then
228                 AC_CHECK_LIB(vorbis,vorbis_info_init,vorbis_libs=yes,vorbis_libs=no)
229                 if test "$vorbis_libs" = "yes"; then
230                         PREV_LIBS=LIBS
231                         LIBS="$LIBS -lvorbis"
232                         AC_CHECK_LIB(vorbisfile,ov_open_callbacks,vorbisfile_libs=yes,vorbisfile_libs=no)
233                         if test "$vorbisfile_libs" = "yes"; then
234                                 LIBS="$LIBS -lvorbisfile"
235                                 AC_DEFINE_UNQUOTED([USE_VORBIS_INPUT], 1, [Define to use libvorbis for ogg support])
236                                 OPTION_VORBIS="yes"
237                         else
238                                 LIBS=PREV_LIBS
239                         fi
240                 fi
241         fi
242 fi
243
244 if test "$enable_audiofile" != "no"; then
245         AC_CHECK_PROG(af_config,audiofile-config,yes,no)
246         if test "$af_config" = "yes"; then
247                 af_cflags=`audiofile-config --cflags`
248                 if test "$af_cflags" != ""; then
249                         CFLAGS="$CFLAGS $af_cflags"
250                 fi
251                 af_libs=`audiofile-config --libs`
252                 LIBS="$LIBS $af_libs"
253                 AC_DEFINE_UNQUOTED([USE_AUDIOFILE_INPUT], 1, [Define to compile libaudiofile support])
254                 OPTION_AUDIOFILE="yes"
255         else
256                 AC_CHECK_HEADERS(audiofile.h,audiofile_headers=yes,audiofile_headers=no)
257                 if test "$audiofile_headers" = "yes"; then
258                         AC_CHECK_LIB(audiofile,afOpenFile,audiofile_libs=yes,audiofile_libs=no)
259                         if test "$audiofile_libs" = "yes"; then
260                                 LIBS="$LIBS -laudiofile"
261                                 AC_DEFINE_UNQUOTED([USE_AUDIOFILE_INPUT], 1, [Define to compile libaudiofile support])
262                                 OPTION_AUDIOFILE="yes"
263                         fi
264                 fi
265         fi
266 fi
267
268 if test "$enable_mpg123" != "no"; then
269         AC_CHECK_PROG(MPG123_PROG, mpg123, yes)
270         if test "$MPG123_PROG" = "yes"; then
271                 if test "$SOX_PROG" = "yes"; then       
272                         AC_DEFINE_UNQUOTED([USE_MPG123_INPUT], 1, [Define mp3-input through mpg123 - requires sox as well])
273                         OPTION_MPG123="yes"
274                 else
275                         AC_CHECK_PROG(SOX_PROG, sox, yes)
276                         if test "$SOX_PROG" = "yes"; then       
277                                 AC_DEFINE_UNQUOTED([USE_MPG123_INPUT], 1, [Define mp3-input through mpg123 - requires sox as well])
278                                 OPTION_MPG123="yes"
279                         else
280                                 AC_MSG_RESULT([** mpg123 support disabled: couldn't find sox! **])
281                         fi
282                 fi
283         fi
284 fi
285
286 if test "$enable_ogg123" != "no"; then
287         AC_CHECK_PROG(OGG123_PROG, ogg123, yes)
288         if test "$OGG123_PROG" = "yes"; then
289                 AC_DEFINE_UNQUOTED([USE_OGG123_INPUT], 1, [Define if you want UGLY ogg-input "support" - also requires sox])
290                 OPTION_OGG123="yes"
291         fi
292 fi
293
294 if test "$enable_xsetpointer" != "no"; then
295         AC_CHECK_PROG(XSETPOINTER_PROG, xsetpointer, yes)
296         if test "$XSETPOINTER_PROG" = "yes"; then
297                 AC_DEFINE_UNQUOTED([USE_XSETPOINTER], 1, [Exec xsetpointer instead of using Xlib-calls.])
298         else
299                 if test "$enable_xsetpointer" = "yes"; then
300                         AC_MSG_ERROR([** xsetpointer not found. **])
301                 fi
302         fi
303 fi
304
305 if test "$enable_movqfix" = "no"; then
306         AC_DEFINE_UNQUOTED([OVERRIDE_MOVQ_AUTODETECT], 1, [Do nott use movqfix])
307 fi
308
309 using_alsa=no
310 using_oss=no
311 using_jack=no
312 using_pulse=no
313
314 if test "$enable_alsa" != "no"; then
315     AC_CHECK_LIB(asound, snd_pcm_writei,alsalib=yes,alsalib=no)
316     AC_CHECK_HEADERS(alsa/asoundlib.h,alsaheader=yes,alsaheader=no)
317
318     if test "$alsalib" = "yes"; then
319             if test "$alsaheader" = "yes"; then
320                     AC_DEFINE_UNQUOTED([USE_ALSA], 1, [ Define to enable ALSA audio backend. ])
321                     LIBS="$LIBS -lasound"
322                     using_alsa=yes
323                     OPTION_ALSA=yes
324             else 
325                     if test "$enable_alsa" = "yes"; then
326                             AC_MSG_ERROR([** Could not find ALSA header file sys/asoundlib.h **])
327                     fi
328             fi
329     else
330             if test "$enable_alsa" = "yes"; then
331                     AC_MSG_ERROR([** Could not find ALSA library libasound. **])
332             fi
333     fi
334 fi
335
336 if test "$enable_jack" != "no"; then
337     AC_CHECK_LIB(jack,jack_activate,jacklib=yes,jacklib=no)
338     AC_CHECK_HEADERS(jack/jack.h,jackheader=yes,jackheader=no)
339
340     if test "$jacklib" = "yes"; then
341             if test "$jackheader" = "yes"; then
342                     AC_DEFINE_UNQUOTED([USE_JACK], 1, [ Define to enable JACK audio backend.])
343                     LIBS="$LIBS -ljack"
344                     using_jack=yes
345                     OPTION_JACK=yes
346             else 
347                     if test "$enable_jack" = "yes"; then
348                             AC_MSG_ERROR([** Could not find JACK header file jack/jack.h **])
349                     fi
350             fi
351     else
352             if test "$enable_jack" = "yes"; then
353                     AC_MSG_ERROR([** Could not find JACK library libjack. **])
354             fi
355     fi
356 fi
357
358 if test "$enable_pulse" != "no"; then
359     AC_CHECK_LIB(pulse-simple,pa_simple_new,pulselib=yes,pulselib=no)
360     AC_CHECK_HEADERS(pulse/pulseaudio.h,pulseheader=yes,pulseheader=no)
361
362     if test "$pulselib" = "yes"; then
363             if test "$pulseheader" = "yes"; then
364                     AC_DEFINE_UNQUOTED([USE_PULSE], 1, [ Define to enable PULSE audio backend.])
365                     LIBS="$LIBS -lpulse-simple -lpulse"
366                     using_pulse=yes
367                     OPTION_PULSE=yes
368             else 
369                     if test "$enable_pulse" = "yes"; then
370                             AC_MSG_ERROR([** Could not find PULSE header file pulse/pulseaudio.h **])
371                     fi
372             fi
373     else
374             if test "$enable_pulse" = "yes"; then
375                     AC_MSG_ERROR([** Could not find PULSE library libpulse. **])
376             fi
377     fi
378
379 fi
380
381
382 if test "$enable_oss" != "no"; then
383         AC_CHECK_HEADERS(sys/ioctl.h sys/soundcard.h,oss=yes,oss=no)
384         
385         if test "$oss" = "yes"; then
386                 AC_DEFINE_UNQUOTED([USE_OSS], 1, [Use OSS])
387                 OPTION_OSS=yes
388                 using_oss=yes;
389         else
390                 if test "$enable_oss" = "yes"; then
391                         AC_MSG_ERROR([** Could not find OSS header files. ***])
392                 fi
393         fi
394 fi
395
396 if test "$enable_alsamidi" != "no"; then
397         if test "$using_alsa" = "yes"; then
398                 AC_DEFINE_UNQUOTED([USE_ALSA_MIDI_IN], 1, [Define for ALSA MIDI in support])
399                 OPTION_ALSAMIDI="yes"                           
400         else
401                 AC_CHECK_LIB(asound, snd_seq_open,alsalib=yes,alsalib=no)
402                 AC_CHECK_HEADERS(alsa/asoundlib.h,alsaheader=yes,alsaheader=no)
403
404                 if test "$alsalib" = "yes"; then
405                         if test "$alsaheader" = "yes"; then
406                                 AC_DEFINE_UNQUOTED([USE_ALSA_MIDI_IN], 1, [Define for ALSA MIDI in support])
407                                 LIBS="$LIBS -lasound"
408                                 OPTION_ALSAMIDI="yes"
409                         else 
410                                 if test "$enable_alsamidi" = "yes"; then
411                                         AC_MSG_ERROR([** Coulnd't find ALSA header file alsa/asoundlib.h **])
412                                 fi
413                         fi
414                 else
415                         if test "$enable_alsamidin" = "yes"; then
416                                 AC_MSG_ERROR([** Couldn't find ALSA library libasound. **])
417                         fi
418                 fi
419         fi
420 fi
421
422 if test "$using_alsa" != "yes"; then
423         if test "$using_oss" != "yes"; then
424                 if test "$using_jack" != "yes"; then
425                         if test "$using_pulse" != "yes"; then
426                                 AC_MSG_ERROR([** Found neither OSS, ALSA, JACK nor PULSE - no output device! **])
427                         fi
428                 fi
429         fi
430 fi      
431         
432 if test "$enable_wav" != "no";
433 then
434         AC_DEFINE_UNQUOTED([USE_BUILTIN_WAV], 1, [Define to enable the built-in wav loading routines])
435         OPTION_WAV="yes"
436 fi
437
438 if test "$enable_3dnow" = "yes"; then
439         AC_DEFINE_UNQUOTED([USE_3DNOW], 1, [Do not define this])
440 fi 
441
442 if test "$enable_scheduler" != "no"; then
443         OPTION_SCHEDULER="yes";
444         AC_DEFINE_UNQUOTED([USE_SCHEDULER], 1, [Define this to compile with rt scheduling support])
445 fi
446
447 if test "$enable_debug" = yes; then
448         AC_DEFINE_UNQUOTED([ENABLE_DEBUG_OUTPUT], 1, [Define this to enable debug output.])
449 fi
450
451 if test "$enable_benchmark" = yes; then
452         AC_DEFINE_UNQUOTED([CREATE_BENCHMARK], 1, [Define this to build an performance benchmark - WARNING: You cannot use the resulting binary for normal operation])
453 fi
454
455 if test "$enable_capabilities" != "no"; then
456         AC_CHECK_HEADERS(sys/capability.h,capheader=yes,capheader=no)
457         AC_CHECK_HEADERS(sys/prctl.h,prctlheader=yes,prctlheader=no)
458         
459         if test "$capheader" = "yes"; then
460                 if test "$prctlheader" = "yes"; then
461                         AC_CHECK_LIB(cap,cap_get_proc,caplib=yes,caplib=no)
462                         if test "$caplib" = "yes"; then
463                                 LIBS="$LIBS -lcap"
464                                 AC_DEFINE_UNQUOTED([USE_CAPABILITIES], 1, [Define to use capabilities])
465                                 OPTION_CAP="yes"
466                         fi
467                 fi
468         fi
469 fi
470
471 if test "$enable_capabilities" = "yes"; then
472         if test "$OPTION_CAP" != "yes"; then
473                 AC_MSG_ERROR([** This system doesn't support capabilities. **])
474         fi
475 fi
476
477
478
479 if test "$enable_deprecated" = "no"; then
480         DEPRECATED_FLAGS="-DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
481 else 
482     DEPRECATED_FLAGS=""
483 fi
484
485 AC_SUBST(DEPRECATED_FLAGS)
486
487 AC_MSG_CHECKING(for necessary scratching skillz)
488 AC_MSG_RESULT(yes)
489
490 AC_DEFINE_UNQUOTED([USE_DIAL], 1, [ Define this. ])
491
492 dnl if test "$enable_bigdial" = yes; then
493 dnl     AC_DEFINE(USE_DIAL)
494 dnl     AC_DEFINE(USE_BIG_BUTTONS)
495 dnl fi
496
497 if test "$enable_legacy" = yes; then
498         AC_DEFINE_UNQUOTED([ENABLE_TX_LEGACY], 1, [Define this to enable support for old tX set files])
499         OPTION_LEGACY="yes"
500 fi
501
502 dnl if test "$enable_dga2" = yes; then
503 dnl     AC_DEFINE(USE_DGA2)
504 dnl fi
505
506 dnl Detecting libxml. Based on dia's test.
507 found_libxml=false
508
509 if test "$enable_libxml2" != "no"; then
510         if ! $found_libxml; then
511           AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
512           if test "x$XML2_CONFIG" != x ; then
513             AC_MSG_CHECKING(for libxml >= 2.3.9)
514             vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
515
516             if test "$vers" -ge 2003009; then
517               AC_MSG_RESULT(yes)
518               found_libxml=true
519               XML_LIBS="`$XML2_CONFIG --libs`"
520               XML_CFLAGS="`$XML2_CONFIG --cflags`"
521             else
522               AC_MSG_RESULT(no)
523             fi
524           fi
525         fi
526 fi      
527
528 if ! $found_libxml 
529 then
530         AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
531         if test "x$XML_CONFIG" != x ; then
532           AC_MSG_CHECKING(for libxml >= 1.8.14)
533           vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
534
535           dnl 1.18.14 is required for xmlUseNewParser()    
536           if test "$vers" -ge 1008014; then
537             AC_MSG_RESULT(yes)
538             found_libxml=true
539             XML_LIBS="`$XML_CONFIG --libs`"
540             XML_CFLAGS="`$XML_CONFIG --cflags`"
541           else
542             AC_MSG_RESULT(no)
543           fi
544         fi
545 fi
546
547 if ! $found_libxml; then
548     AC_MSG_ERROR([** libxml not found. Get libxml(2) at http://www.libxml.org **])
549 fi
550
551 AC_SUBST(XML_LIBS)
552 AC_SUBST(XML_CFLAGS)
553
554 if test "$enable_lrdf" != "no"; then
555     AC_MSG_CHECKING(for liblrdf >= 0.2.4)
556         LRDF_VERS=`$PKG_CONFIG --modversion lrdf | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
557         if test "$LRDF_VERS" -ge 2004; then
558                 AC_MSG_RESULT(yes)
559                 OPTION_LRDF=yes
560
561                 lrdf_cflags=`$PKG_CONFIG --cflags lrdf`
562                 if test "$lrdf_cflags" != ""; then
563                         CFLAGS="$CFLAGS $lrdf_cflags"
564                 fi
565                 lrdf_libs=`$PKG_CONFIG --libs lrdf`
566                 LIBS="$LIBS $lrdf_libs"
567                 AC_DEFINE_UNQUOTED([USE_LRDF], 1, [Define to compile librdf support])
568                 OPTION_AUDIOFILE="yes"
569         else
570                 AC_MSG_RESULT(no)
571         fi
572
573 fi
574
575 dnl User Manual
576 GNOME_DOC_INIT
577
578 xml_man="\\\"${datadir}/gnome/help/terminatorX-manual/C/terminatorX-manual.xml\\\""
579
580 dnl Now Check for Xlibs - I do this here as other tests fail if these run earlier
581 AC_PATH_XTRA
582
583 AC_SUBST(X_CFLAGS)
584 AC_SUBST(X_PRE_LIBS)
585 AC_SUBST(X_EXTRA_LIBS)
586 AC_SUBST(X_LIBS)
587 AC_SUBST(x_libraries)
588
589 GTK_LIBS="$GTK_LIBS $X_LIBS"
590 AC_CHECK_LIB(X11, XOpenDisplay,, AC_MSG_ERROR([** X11-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
591 AC_CHECK_LIB(Xext, XShmQueryExtension,, AC_MSG_ERROR([** Xext-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
592 AC_CHECK_LIB(Xi, XOpenDevice,, AC_MSG_ERROR([** XInput not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
593 AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,, AC_MSG_ERROR([** DGA not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
594 if test "$enable_dga2" = yes; then
595         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)
596 fi
597
598 CFLAGS="$XML_CFLAGS $CFLAGS -DXML_MANUAL=$xml_man"
599 LIBS="$XML_LIBS $LIBS"
600
601 AC_OUTPUT(Makefile 
602         src/Makefile 
603         icons/Makefile 
604         src/icons/Makefile 
605         help/Makefile
606         terminatorX.keys 
607         terminatorX.spec 
608         terminatorX.1)
609
610 option_info() {
611         echo "$option support: $option_val"
612         if test "$option_val" != "yes"; then
613                 echo "  - If you want $option support get $option from"
614                 echo "  -       $option_url"
615                 echo "  - and reconfigure terminatorX"
616         fi
617 }
618
619 echo
620 echo configured terminatorX for:
621 echo ---------------------------
622 echo
623
624 option=sox; option_val=$OPTION_SOX; option_url=http://sox.sourceforge.net/
625 option_info;
626
627 echo "mpg123 support: $OPTION_MPG123"
628 if test "$OPTION_MPG123" = "no"; then
629 echo "  - If you want mpg123 support get either mpg321 from"
630 echo "  -       http://mpg321.sourceforge.net/ or mpg123 from"
631 echo "  -       http://www.mpg123.de/"
632 echo "  - and reconfigure terminatorX"
633 fi
634
635
636 option=oss; option_val=$OPTION_OSS; option_url=http://www.kernel.org
637 option_info;
638
639 option=alsa; option_val=$OPTION_ALSA; option_url=http://www.alsa-project.org
640 option_info;
641
642 option=jack; option_val=$OPTION_JACK; option_url=http://jackit.sourceforge.net
643 option_info;
644
645 option=pulse; option_val=$OPTION_PULSE; option_url=http://www.freedesktop.org/wiki/Software/PulseAudio/
646 option_info;
647
648 option=mad; option_val=$OPTION_MAD; option_url=http://www.mars.org/home/rob/proj/mpeg/
649 option_info;
650
651 option=ogg123; option_val=$OPTION_OGG123; option_url=http://www.xiph.org/ogg/vorbis/
652 option_info;
653
654 option=libvorbis; option_val=$OPTION_VORBIS; option_url=http://www.xiph.org/ogg/vorbis/
655 option_info;
656
657 option=audiofile; option_val=$OPTION_AUDIOFILE; option_url=http://www.68k.org/~michael/audiofile/
658 option_info;
659
660 option="ALSA (MIDI in)"; option_val=$OPTION_ALSAMIDI; option_url=http://www.alsa-project.org
661 option_info;
662
663 option=lrdf; option_val=$OPTION_LRDF; option_url=http://plugin.org.uk/releases/lrdf/
664 option_info;
665
666 echo "legacy files support: $OPTION_LEGACY"
667 echo "builtin-wav support: $OPTION_WAV"
668 echo "enhanced scheduling support: $OPTION_SCHEDULER"
669 echo "capabilities support: $OPTION_CAP"
670 echo
671 echo You can now run \'make\' to compile terminatorX