XML serialization for set files, bug fixes and a new full screen mode
[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.74)
4 AM_CONFIG_HEADER(config.h)
5
6 dnl AC_ARG_ENABLE(closedev, [  --enable-closedev       close audio device if not in use. [default=yes] ])
7 AC_ARG_ENABLE(sox, [  --enable-sox            use sox as input converter. (default=auto) ])
8 AC_ARG_ENABLE(mpg123, [  --enable-mpg123         use mpg123 as input converter. (default=auto) ])
9 AC_ARG_ENABLE(ogg123, [  --enable-ogg123         use ogg123 as input converter. (default=auto) ])
10 dnl AC_ARG_ENABLE(wavonly,  [  --enable-wavonly        enable the builtin wav routines. ])
11 dnl AC_ARG_ENABLE(scheduler,[  --enable-scheduler      enable rt-scheduling (req. root-priv). (default=yes) ])
12 AC_ARG_ENABLE(debug,    [  --enable-debug          enable debug output. (default=no) ])
13 dnl AC_ARG_ENABLE(3dnow,    [  --enable-3dnow          enables 3DNow! support. (default=no) ])
14 dnl AC_ARG_ENABLE(benchmark,[  --enable-benchmark      creates a non-functional test version (default=no) ])
15 AC_ARG_ENABLE(wav,          [  --enable-wav            enables the builtin wav-loader (default=yes) ])
16 AC_ARG_ENABLE(xsetpointer,  [  --enable-xsetpointer    enables executing of xsetpointer (default=auto) ])
17 dnl AC_ARG_ENABLE(alsa,         [  --enable-alsa           use ALSA for sound output (default=auto) ])
18 AC_ARG_ENABLE(oss,          [  --enable-oss            use OSS for sound output (default=auto) ])
19 dnl AC_ARG_ENABLE(movqfix,          [  --disable-movqfix       don't use movq fix for gcc >= 2.96 [default=on] ])
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(legacy,           [  --disable-legacy        disable support for old terminatorX files (default=on) ])
26
27 dnl Checks for programs.
28 AC_PROG_AWK
29 AC_PROG_CC
30 AC_PROG_CXX
31 AC_PROG_INSTALL
32 AC_PROG_LN_S
33 AC_PROG_RANLIB
34
35 OPTION_SOX="no"
36 OPTION_MPG123="no"
37 OPTION_MAD="no"
38 OPTION_OGG123="no"
39 OPTION_VORBIS="no"
40 OPTION_AUDIOFILE="no"
41 OPTION_WAV="no"
42 OPTION_GNOME="no"
43 OPTION_SCHEDULER="no"
44
45 dnl Checks for libraries.
46 AC_CHECK_LIB(m, floor,, AC_MSG_ERROR([** math-lib not installed or broken **]))
47
48 dnl Checking whether -pthreads, -lpthreads or simply nothing
49
50 tX_threads=no
51
52 dnl Some machines don't require any switches for pthread support...
53
54 AC_MSG_CHECKING([whether pthreads works without switches])
55         no_threads_flags=no
56         AC_LANG_SAVE
57         AC_LANG_C
58         AC_TRY_LINK([#include <pthread.h>], [ pthread_t thread; pthread_create(&thread, NULL, NULL, NULL);],
59                 no_threads_flags=yes,
60                 no_threads_flags=no
61         )
62         AC_LANG_RESTORE
63 AC_MSG_RESULT([$no_threads_flags])
64
65 if test "$no_threads_flags" = "yes"; then
66         tX_threads=auto
67 fi
68
69 dnl Some machines prefer the -lpthread...
70
71 if test "$tX_threads" = "no"; then
72         pthread_lib=no
73         AC_CHECK_LIB(pthread, pthread_detach, pthread_lib=yes, pthread_lib=no)
74         
75         if test "$pthread_lib" = "yes"; then
76                 tX_threads=lpthread
77                 LIBS="$LIBS -lpthread"
78         fi
79 fi
80
81 dnl Some machines prefer a -pthread...
82
83 if test "$tX_threads" = "no"; then
84         AC_MSG_CHECKING([whether -pthread is required for pthreads])
85                 use_gcc_threads=no
86                 ac_save_CFLAGS=$CFLAGS
87                 CFLAGS="$CFLAGS -pthread"
88                 AC_LANG_SAVE
89                 AC_LANG_C
90                 AC_TRY_LINK([#include <pthread.h>], [ pthread_t thread; pthread_create(&thread, NULL, NULL, NULL);],
91                         use_gcc_threads=yes,
92                         use_gcc_threads=no
93                 )
94                 AC_LANG_RESTORE
95                 CFLAGS=$ac_save_CFLAGS
96         AC_MSG_RESULT([$use_gcc_threads])
97         
98         if test "$use_gcc_threads" = "yes"; then
99                 tX_threads=gcc
100                 CFLAGS="$CFLAGS -pthread"
101         fi
102 fi
103
104 dnl If we still haven't found pthreads, we panic...
105
106 if test "$tX_threads" = "no"; then
107         AC_MSG_ERROR([** failed to detect pthreads implementation **])
108 fi
109
110 AM_PATH_GTK_2_0(, [
111   GTK2_CFLAGS="$GTK_CFLAGS"
112   GTK2_LIBS="$GTK_LIBS"
113   gtk2="yes"
114   GTK2_VERSION="`$PKG_CONFIG --modversion gtk+-2.0`"], [ gtk2="yes" ]) 
115   OPTION_GTK_VERSION="Version 2 - ($GTK2_VERSION)"
116
117 if test "$gtk2" = "no"; then
118         AC_MSG_ERROR([** couldn't find gtk+ > Version 2. Please upgrade (http://www.gtk.org). **])
119 fi
120
121 dnl Checks for header files.
122 AC_HEADER_STDC
123 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h unistd.h)
124
125 dnl Disable LADSPA caching..
126 unset ac_cv_header_ladspa_h
127
128 have_ladspa=no
129 AC_CHECK_HEADERS(ladspa.h, have_ladspa=yes, have_ladspa=no)
130
131 dnl Disable LADSPA caching..
132 unset ac_cv_header_ladspa_h
133
134 dnl Some people install LADSPA in /usr/local
135
136 if test "$have_ladspa" = "no"; then
137         ac_save_CFLAGS=$CFLAGS
138         CFLAGS="$CFLAGS -I/usr/local/include"
139         AC_CHECK_HEADERS(ladspa.h, have_ladspa=yes, have_ladspa=no)
140         CFLAGS=$ac_save_CFLAGS
141         
142         if test "$have_ladspa" = "yes"; then
143                 CFLAGS="$CFLAGS -I/usr/local/include"
144         fi
145 fi
146
147 if test "$have_ladspa" = "no"; then
148         AC_MSG_ERROR([** couldn't find ladspa.h - Install the LADSPA SDK from http://www.ladspa.org first. **])
149 fi
150
151 dnl Checks for typedefs, structures, and compiler characteristics.
152 AC_C_BIGENDIAN
153 AC_TYPE_SIZE_T
154
155 dnl Checks for library functions.
156 AC_PROG_GCC_TRADITIONAL
157
158 dnl Eval args
159 if test "$enable_closedev" = "no"; then
160         AC_DEFINE(KEEP_DEV_OPEN)
161 fi
162
163
164 if test "$enable_sox" != "no"; then
165         AC_CHECK_PROG(SOX_PROG, sox, yes)
166         if test "$SOX_PROG" = "yes"; then
167                 AC_DEFINE(USE_SOX_INPUT)
168                 OPTION_SOX="yes"
169         fi
170 fi
171
172 if test "$enable_mad" != "no"; then
173         AC_CHECK_HEADERS(mad.h,madheader=yes,madheader=no)
174         if test "$madheader" = "yes"; then
175                 AC_CHECK_LIB(mad,mad_decoder_init,madlib=yes,madlib=no)
176                 if test "$madlib" = "yes"; then
177                         LIBS="$LIBS -lmad"
178                         AC_DEFINE(USE_MAD_INPUT)
179                         OPTION_MAD="yes"
180                 fi
181         fi
182 fi
183
184 if test "$enable_vorbis" != "no"; then
185         AC_CHECK_HEADERS(vorbis/codec.h vorbis/vorbisfile.h,vorbis_headers=yes,vorbis_headers="no")
186         if test "$vorbis_headers" = "yes"; then
187                 AC_CHECK_LIB(vorbis,vorbis_info_init,vorbis_libs=yes,vorbis_libs=no)
188                 if test "$vorbis_libs" = "yes"; then
189                         PREV_LIBS=LIBS
190                         LIBS="$LIBS -lvorbis"
191                         AC_CHECK_LIB(vorbisfile,ov_open_callbacks,vorbisfile_libs=yes,vorbisfile_libs=no)
192                         if test "$vorbisfile_libs" = "yes"; then
193                                 LIBS="$LIBS -lvorbisfile"
194                                 AC_DEFINE(USE_VORBIS_INPUT)
195                                 OPTION_VORBIS="yes"
196                         else
197                                 LIBS=PREV_LIBS
198                         fi
199                 fi
200         fi
201 fi
202
203 if test "$enable_audiofile" != "no"; then
204         AC_CHECK_PROG(af_config,audiofile-config,yes,no)
205         if test "$af_config" = "yes"; then
206                 af_cflags=`audiofile-config --cflags`
207                 if test "$af_cflags" != ""; then
208                         CFLAGS="$CFLAGS $af_cflags"
209                 fi
210                 af_libs=`audiofile-config --libs`
211                 LIBS="$LIBS $af_libs"
212                 AC_DEFINE(USE_AUDIOFILE_INPUT)
213                 OPTION_AUDIOFILE="yes"
214         else
215                 AC_CHECK_HEADERS(audiofile.h,audiofile_headers=yes,audiofile_headers=no)
216                 if test "$audiofile_headers" = "yes"; then
217                         AC_CHECK_LIB(audiofile,afOpenFile,audiofile_libs=yes,audiofile_libs=no)
218                         if test "$audiofile_libs" = "yes"; then
219                                 LIBS="$LIBS -laudiofile"
220                                 AC_DEFINE(USE_AUDIOFILE_INPUT)
221                                 OPTION_AUDIOFILE="yes"
222                         fi
223                 fi
224         fi
225 fi
226
227 if test "$enable_mpg123" != "no"; then
228         AC_CHECK_PROG(MPG123_PROG, mpg123, yes)
229         if test "$MPG123_PROG" = "yes"; then
230                 if test "$SOX_PROG" = "yes"; then       
231                         AC_DEFINE(USE_MPG123_INPUT)
232                         OPTION_MPG123="yes"
233                 else
234                         AC_CHECK_PROG(SOX_PROG, sox, yes)
235                         if test "$SOX_PROG" = "yes"; then       
236                                 AC_DEFINE(USE_MPG123_INPUT)
237                                 OPTION_MPG123="yes"
238                         else
239                                 AC_MSG_RESULT([** mpg123 support disabled: couldn't find sox! **])
240                         fi
241                 fi
242         fi
243 fi
244
245 if test "$enable_ogg123" != "no"; then
246         AC_CHECK_PROG(OGG123_PROG, ogg123, yes)
247         if test "$OGG123_PROG" = "yes"; then
248                 AC_DEFINE(USE_OGG123_INPUT)
249                 OPTION_OGG123="yes"
250         fi
251 fi
252
253 if test "$enable_xsetpointer" != "no"; then
254         AC_CHECK_PROG(XSETPOINTER_PROG, xsetpointer, yes)
255         if test "$XSETPOINTER_PROG" = "yes"; then
256                 AC_DEFINE(USE_XSETPOINTER)
257         else
258                 if test "$enable_xsetpointer" = "yes"; then
259                         AC_MSG_ERROR([** xsetpointer not found. **])
260                 fi
261         fi
262 fi
263
264 if test "$enable_movqfix" = "no"; then
265         AC_DEFINE(OVERRIDE_MOVQ_AUTODETECT)
266 fi
267
268 using_alsa=no
269 using_oss=no
270
271 dnl if test "$enable_alsa" != "no"; then
272 dnl     AC_CHECK_LIB(asound, snd_ctl_open,alsalib=yes,alsalib=no)
273 dnl     AC_CHECK_HEADERS(sys/asoundlib.h,alsaheader=yes,alsaheader=no)
274 dnl
275 dnl     if test "$alsalib" = "yes"; then
276 dnl             if test "$alsaheader" = "yes"; then
277 dnl                     AC_DEFINE(USE_ALSA)
278 dnl                     using_alsa=yes;
279 dnl             else 
280 dnl                     if test "$enable_alsa" = "yes"; then
281 dnl                             AC_MSG_ERROR([** Coulnd't find ALSA header file sys/asoundlib.h **])
282 dnl                     fi
283 dnl             fi
284 dnl     else
285 dnl             if test "$enable_alsa" = "yes"; then
286 dnl                     AC_MSG_ERROR([** Coulnd'f find ALSA library libasound. **])
287 dnl             fi
288 dnl     fi
289 dnl fi
290
291 if test "$enable_oss" != "no"; then
292         AC_CHECK_HEADERS(sys/ioctl.h sys/soundcard.h,oss=yes,oss=no)
293         
294         if test "$oss" = "yes"; then
295                 AC_DEFINE(USE_OSS)
296                 using_oss=yes;
297         else
298                 if test "$enable_oss" = "yes"; then
299                         AC_MSG_ERROR([** Couldn't find OSS header files. ***])
300                 fi
301         fi
302 fi
303
304 dnl if test "$using_alsa" = "yes"; then
305 dnl     AC_MSG_RESULT([termnatorX audiodevice: using ALSA.])
306 dnl fi
307
308 if test "$using_oss" = "yes"; then
309         AC_MSG_RESULT([termnatorX audiodevice: using OSS.])
310 fi
311
312 if test "$using_alsa" != "yes"; then
313         if test "$using_oss" != "yes"; then
314                 AC_MSG_ERROR([** Found neither OSS nor ALSA! **])
315         fi
316 fi      
317         
318 if test "$enable_wav" != "no";
319 then
320         AC_DEFINE(USE_BUILTIN_WAV)
321         OPTION_WAV="yes"
322 fi
323
324 if test "$enable_flash" = "no"; then
325         AC_DEFINE(DONT_USE_FLASH)
326 fi 
327
328 if test "$enable_3dnow" = "yes"; then
329         AC_DEFINE(USE_3DNOW)
330 fi 
331
332 if test "$enable_scheduler" != "no"; then
333         OPTION_SCHEDULER="yes";
334         AC_DEFINE(USE_SCHEDULER)
335 fi
336
337 if test "$enable_debug" = yes; then
338         AC_DEFINE(ENABLE_DEBUG_OUTPUT)
339 fi
340
341 if test "$enable_benchmark" = yes; then
342         AC_DEFINE(CREATE_BENCHMARK)
343 fi
344
345 dnl AC_MSG_CHECKING(whether to use dials)
346 dnl if test "$enable_dial" = no; then
347 dnl     AC_MSG_RESULT(no)
348 dnl else
349 dnl     AC_MSG_RESULT(yes)
350         AC_DEFINE(USE_DIAL)
351 dnl fi
352
353 AC_MSG_CHECKING(for necessary scratching skillz)
354 AC_MSG_RESULT(yes)
355
356 if test "$enable_bigdial" = yes; then
357         AC_DEFINE(USE_DIAL)
358         AC_DEFINE(USE_BIG_BUTTONS)
359 fi
360
361 if test "$enable_legacy" != no; then
362         AC_DEFINE(ENABLE_TX_LEGACY)
363 fi
364
365 if test "$enable_dga2" = yes; then
366         AC_DEFINE(USE_DGA2)
367 fi
368
369 AC_MSG_CHECKING(for GNOME)
370         AC_MSG_RESULT([in progress])
371         AC_CHECK_PROG(gnomepresent, gnome-name-service, yes, no)
372         if test "$gnomepresent" = yes; then
373                 AC_CHECK_PROG(gnomeconfig, gnome-config, yes)
374                 if test "$gnomeconfig" = yes; then
375                         gnomedatadir=`gnome-config --datadir`
376                 else
377                         gnomedatadir=${datadir}
378                 fi
379                 AC_SUBST(gnomedatadir)
380                 AM_CONDITIONAL(GNOMEpresent, test "$gnomepresent" = yes)
381                 AC_MSG_RESULT([Found GNOME - installing terminatorX.desktop.])
382                 OPTION_GNOME="yes"
383         else
384                 AC_MSG_RESULT([GNOME not found.])
385         fi
386
387
388 dnl Detecting libxml. Based on dia's test.
389 found_libxml=false
390
391 if test "$enable_libxml2" != "no"; then
392         if ! $found_libxml; then
393           AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
394           if test "x$XML2_CONFIG" != x ; then
395             AC_MSG_CHECKING(for libxml >= 2.3.9)
396             vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
397
398             if test "$vers" -ge 2003009; then
399               AC_MSG_RESULT(yes)
400               found_libxml=true
401               XML_LIBS="`$XML2_CONFIG --libs`"
402               XML_CFLAGS="`$XML2_CONFIG --cflags`"
403             else
404               AC_MSG_RESULT(no)
405             fi
406           fi
407         fi
408 fi      
409
410 if ! $found_libxml 
411 then
412         AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
413         if test "x$XML_CONFIG" != x ; then
414           AC_MSG_CHECKING(for libxml >= 1.8.14)
415           vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
416
417           dnl 1.18.14 is required for xmlUseNewParser()    
418           if test "$vers" -ge 1008014; then
419             AC_MSG_RESULT(yes)
420             found_libxml=true
421             XML_LIBS="`$XML_CONFIG --libs`"
422             XML_CFLAGS="`$XML_CONFIG --cflags`"
423           else
424             AC_MSG_RESULT(no)
425           fi
426         fi
427 fi
428
429 if ! $found_libxml; then
430     AC_MSG_ERROR([** libxml not found. Get libxml(2) at http://www.libxml.org **])
431 fi
432
433 AC_SUBST(XML_LIBS)
434 AC_SUBST(XML_CFLAGS)
435
436 CFLAGS="$XML_CFLAGS $CFLAGS"
437 LIBS="$XML_LIBS $LIBS"
438
439 dnl Now Check for Xlibs - I do this here as other tests fail if these run earlier
440 AC_PATH_XTRA
441
442 AC_SUBST(X_CFLAGS)
443 AC_SUBST(X_PRE_LIBS)
444 AC_SUBST(X_EXTRA_LIBS)
445 AC_SUBST(X_LIBS)
446 AC_SUBST(x_libraries)
447
448 GTK_LIBS="$GTK_LIBS $X_LIBS"
449 AC_CHECK_LIB(X11, XOpenDisplay,, AC_MSG_ERROR([** X11-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
450 AC_CHECK_LIB(Xext, XShmQueryExtension,, AC_MSG_ERROR([** Xext-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
451 AC_CHECK_LIB(Xi, XOpenDevice,, AC_MSG_ERROR([** XInput not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
452 AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,, AC_MSG_ERROR([** DGA not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
453 if test "$enable_dga2" = yes; then
454         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)
455 fi
456 AC_OUTPUT(Makefile src/Makefile gnome-support/Makefile gnome-support/terminatorX.keys src/gui_icons/Makefile src/smallknob/Makefile doc/Makefile doc/img/Makefile terminatorX.spec terminatorX.1)
457
458 function option_info() {
459         echo "$option support: $option_val"
460         if test "$option_val" != "yes"; then
461                 echo "  - If you want $option support get $option from"
462                 echo "  -       $option_url"
463                 echo "  - and reconfigure terminatorX"
464         fi
465 }
466
467 echo
468 echo configured terminatorX for:
469 echo ---------------------------
470 echo
471
472 option=sox; option_val=$OPTION_SOX; option_url=http://sox.sourceforge.net/
473 option_info;
474
475 echo "mpg123 support: $OPTION_MPG123"
476 if test "$OPTION_MPG123" = "no"; then
477 echo "  - If you want mpg123 support get either mpg321 from"
478 echo "  -       http://mpg321.sourceforge.net/ or mpg123 from"
479 echo "  -       http://www.mpg123.de/"
480 echo "  - and reconfigure terminatorX"
481 fi
482
483 option=mad; option_val=$OPTION_MAD; option_url=http://www.mars.org/home/rob/proj/mpeg/
484 option_info;
485
486 option=ogg123; option_val=$OPTION_OGG123; option_url=http://www.xiph.org/ogg/vorbis/
487 option_info;
488
489 option=libvorbis; option_val=$OPTION_VORBIS; option_url=http://www.xiph.org/ogg/vorbis/
490 option_info;
491
492 option=audiofile; option_val=$OPTION_AUDIOFILE; option_url=http://www.68k.org/~michael/audiofile/
493 option_info;
494
495 echo "builtin-wav support: $OPTION_WAV"
496 echo "enhanced scheduling support: $OPTION_SCHEDULER"
497 echo "GNOME support: $OPTION_GNOME"
498 echo
499 echo You can now run \'make\' to compile terminatorX