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