File: configure.in.in

package info (click to toggle)
arts 1.5.9-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 8,436 kB
  • ctags: 9,848
  • sloc: ansic: 44,670; cpp: 33,776; sh: 10,486; perl: 3,470; makefile: 372; yacc: 347; lex: 160
file content (851 lines) | stat: -rw-r--r-- 22,647 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas

dnl Process this file with autoconf to produce a configure script.
AC_INIT(acinclude.m4) dnl a source file from your sub dir

dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR(admin)

dnl right now: install aRts in the same prefix as KDE3.x currently
KDE_SET_PREFIX_CORE

AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM

dnl Version (we /might/ want to use libtool versioning, too)
ARTS_MAJOR_VERSION=1
ARTS_MINOR_VERSION=5
ARTS_MICRO_VERSION=9
ARTS_VERSION=$ARTS_MAJOR_VERSION.$ARTS_MINOR_VERSION.$ARTS_MICRO_VERSION

dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(arts, $ARTS_VERSION) dnl searches for some needed programs

AC_PROG_INSTALL

dnl generate the config header
AM_CONFIG_HEADER(config.h) dnl at the distribution this done

dnl Checks for programs.
AC_CHECK_COMPILERS
AC_LIBLTDL_CONVENIENCE

AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL

AC_LANG_SAVE
AC_LANG_C
KDE_LIB_LTDL
AC_LANG_RESTORE

# this checks for --with-extra-libs
KDE_CHECK_EXTRA_LIBS
KDE_MISC_TESTS
dnl KDE_CHECK_LIBDL
dnl AC_PROG_LIBTOOL
KDE_CHECK_QT_DIRECT
KDE_ENABLE_HIDDEN_VISIBILITY

dnl for NLS support. Call them in this order!
dnl WITH_NLS is for the po files, GNU_GETTEXT for the sources
dnl AM_KDE_WITH_NLS
dnl AM_KDE_GNU_GETTEXT

dnl Checks for header files.
KDE_CHECK_STL
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h sys/cdefs.h fnmatch.h sysent.h strings.h sys/stat.h sys/select.h sys/socket.h linux/socket.h socketbits.h sigaction.h paths.h malloc.h monetary.h sys/param.h limits.h sys/mnttab.h mntent.h fstab.h)

KDE_CHECK_HEADERS(sys/soundcard.h)

dnl Checks for libraries.
AC_BASE_PATH_KDE([don't test]) dnl arts is a special case
AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD
AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for FreeBSD
AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(rt, sem_init, [LIBSEM="-lrt"]))

AM_CONDITIONAL(HAVE_LIBJPEG, test -n "$LIBJPEG" )
AM_CONDITIONAL(HAVE_LIBPNG, test -n "$LIBPNG" )
AM_CONDITIONAL(HAVE_LIBTIFF, test -n "$LIBTIFF")

# configure would do this very late. Too late for us!
test "x$prefix" = xNONE && prefix=$ac_default_prefix

AC_DEFINE_UNQUOTED(KDEDIR, "$prefix", [The prefix to use as fallback])

ac_cpp_safe=$ac_cpp
ac_cpp='$CXXCPP $CPPFLAGS $X_INCLUDES'
KDE_CHECK_HEADERS(X11/ICE/ICElib.h)
ac_cpp=$ac_cpp_safe

dnl Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME
AC_C_BIGENDIAN

dnl check if the compiler has bool
AC_CHECK_BOOL
dnl AC_CHECK_GNU_EXTENSIONS

dnl Checks for library functions.
AC_CHECK_FUNCS(socket snprintf vsnprintf seteuid setegid random strfmon stpcpy mkstemp setmntent gettimeofday vasprintf)
AC_FUNC_VFORK
AC_CHECK_USLEEP
AC_CHECK_SETENV
AC_CHECK_GETHOSTNAME
AC_CHECK_RANDOM
AC_CHECK_S_ISSOCK
AC_CHECK_SOCKLEN_T

dnl output files
AC_SUBST(x_includes)
AC_SUBST(x_libraries)
AC_SUBST(LIBSOCKET)
AC_SUBST(LIBCOMPAT)
AC_SUBST(LIBUTIL)
AC_SUBST(LIBSEM)
AC_SUBST(LIBICE)

all_includes="$all_includes $INCLTDL"
AC_SUBST(all_includes)

AC_SUBST(EXTRA_SUBDIRS)

topdir=`cd $srcdir && pwd`
ac_configure_args="$ac_configure_args --with-auxdir=$topdir/admin"

CXXFLAGS="$CXXFLAGS $USE_RTTI"

dnl----------------------------------------------------------------------------
dnl aRts specific configure tests
dnl
dnl Check for libaudioio (which can be used to get solaris audio support)
AC_DEFUN([AC_CHECK_LIBAUDIOIO],
[
  ac_ldflags_save="$LDFLAGS"
  ac_CPPFLAGS_save="$CPPFLAGS"
  LDFLAGS="$all_libraries $LDFLAGS"
  CPPFLAGS="$CPPFLAGS $all_includes"
  arts_libaudioio_found=no
  AC_LANG_SAVE
  AC_LANG_C
  kde_have_libaudioio=no
  AC_CHECK_HEADER(libaudioio.h,
  [
    kde_have_libaudioio=yes
  ])
  if test "x$kde_have_libaudioio" = "xyes"; then
     AC_CHECK_LIB(audioio,AudioIOGetVersion,[
      dnl LDFLAGS in case it's in KDEDIR/lib
      LIBAUDIOIO="$LDFLAGS -laudioio"
      AC_DEFINE(HAVE_LIBAUDIOIO, 1,
        [Define if you have libaudioIO (required if you want to have libaudioio support)])
      arts_libaudioio_found=yes
    ])
  fi
  AC_SUBST(LIBAUDIOIO)
  AC_LANG_RESTORE
  CPPFLAGS="$ac_CPPFLAGS_save"
  LDFLAGS="$ac_ldflags_save"
])

dnl aRts specific configure tests
dnl
dnl Check for libaudio (which can be used to get network audio support)
AC_DEFUN([AC_CHECK_LIBAUDIONAS],
[
  ac_ldflags_save="$LDFLAGS"
  ac_CPPFLAGS_save="$CPPFLAGS"
  LDFLAGS="$all_libraries $LDFLAGS"
  CPPFLAGS="$CPPFLAGS $all_includes"

  AC_LANG_SAVE
  AC_LANG_C
  arts_libaudionas_include=no
  AC_CHECK_HEADER(audio/audiolib.h,
  [
    arts_libaudionas_include=yes
  ])
  if test "x$arts_libaudionas_include" = "xyes"; then
    AC_CHECK_LIB(audio,AuOpenServer,[
     dnl LDFLAGS in case it's in KDEDIR/lib
     LIBAUDIONAS="-laudio -lXt"
     LIBAUDIONAS_LDFLAGS="$LDFLAGS"
     AC_DEFINE(HAVE_LIBAUDIONAS, 1,
        [Define if you have libaudio (required if you want to have NAS support)])
   ])
  fi
  AC_SUBST(LIBAUDIONAS)
  AC_SUBST(LIBAUDIONAS_LDFLAGS)
  AC_LANG_RESTORE
  CPPFLAGS="$ac_CPPFLAGS_save"
  LDFLAGS="$ac_ldflags_save"
])

dnl Check for libesd (for EsounD support)
AC_DEFUN([AC_CHECK_LIBESD],
[
  ac_ldflags_save="$LDFLAGS"
  ac_CPPFLAGS_save="$CPPFLAGS"
  LDFLAGS="$all_libraries $LDFLAGS"
  CPPFLAGS="$CPPFLAGS $all_includes"

  AC_LANG_SAVE
  AC_LANG_C
  arts_libaudionas_include=no
  AC_CHECK_HEADER(esd.h,
  [
    arts_libesd_include=yes
  ])
  if test "x$arts_libesd_include" = "xyes"; then
    AC_CHECK_LIB(esd,esd_open_sound,[
     dnl LDFLAGS in case it's in KDEDIR/lib
     LIBESD="-lesd"
     LIBESD_LDFLAGS="$LDFLAGS"
     AC_DEFINE(HAVE_LIBESD, 1,
        [Define if you have libesd (required if you want EsounD support)])
   ])
  fi
  AC_SUBST(LIBESD)
  AC_SUBST(LIBESD_LDFLAGS)
  AC_LANG_RESTORE
  CPPFLAGS="$ac_CPPFLAGS_save"
  LDFLAGS="$ac_ldflags_save"
])

dnl libaudiofile is used for loading wave files
AC_DEFUN([AC_CHECK_LIBAUDIOFILE],
[
  ac_ldflags_save="$LDFLAGS"
  ac_CPPFLAGS_save="$CPPFLAGS"
  LDFLAGS="$all_libraries $LDFLAGS"
  CPPFLAGS="$CPPFLAGS $all_includes"
  arts_audiolib_found=no
  dnl WAV reading
  AC_LANG_SAVE
  AC_LANG_C
  kde_has_audio_lib=no
  AC_CHECK_HEADER(audiofile.h,
  [
     kde_has_audio_lib=yes
  ])
  if test "x$kde_has_audio_lib" = "xyes"; then
      KDE_CHECK_LIB(audiofile,afOpenFile,[
      dnl LDFLAGS in case it's in KDEDIR/lib
      LIBAUDIOFILE="-laudiofile"
      LIBAUDIOFILE_LDFLAGS="$LDFLAGS"
      AC_DEFINE(HAVE_LIBAUDIOFILE, 1,
        [Define if you have libaudiofile (required for playing wavs with aRts)])
      arts_audiolib_found=yes
      ])
  fi
  AC_SUBST(LIBAUDIOFILE)
  AC_SUBST(LIBAUDIOFILE_LDFLAGS)
  AC_LANG_RESTORE
  CPPFLAGS="$ac_CPPFLAGS_save"
  LDFLAGS="$ac_ldflags_save"
])


dnl check if sgi libaudio is present
AC_DEFUN([AC_CHECK_SGILIBAUDIO],
[
  ac_ldflags_save="$LDFLAGS"
  ac_CPPFLAGS_save="$CPPFLAGS"
  LDFLAGS="$all_libraries $LDFLAGS"
  CPPFLAGS="$CPPFLAGS $all_includes"

  dnl SGI libaudio (required on IRIX)
  AC_LANG_SAVE
  AC_LANG_C
  arts_dmedia_include=no
  AC_CHECK_HEADER(dmedia/audio.h,
  [
     arts_dmedia_include=yes
  ])
  if test "x$arts_dmedia_include" = "xyes"; then
    KDE_CHECK_LIB(audio,alOpenPort,[
    SGILIBAUDIO="-laudio"
    AC_DEFINE(HAVE_SGILIBAUDIO, 1,
      [Define if you have libaudio (required for sound i/o on IRIX)])
    ])
  fi
  AC_SUBST(SGILIBAUDIO)
  AC_LANG_RESTORE
  CPPFLAGS="$ac_CPPFLAGS_save"
  LDFLAGS="$ac_ldflags_save"
])

dnl check if we want to build MAS support
AC_DEFUN([AC_CHECK_LIBMAS],
[
AC_PATH_PROG(MAS_CONFIG, mas-config, no)

if test "$MAS_CONFIG" != "no"; then
  AC_DEFINE(HAVE_LIBMAS, 1,
    [Define if you have libmas (required if you want MAS support)])
  MAS_CFLAGS="`$MAS_CONFIG --cflags`"
  tmp_mas_libs="`$MAS_CONFIG --libs` -lmas_jrtp"
  MAS_LDFLAGS="`for i in $tmp_mas_libs; do echo $i; done |grep ^-L`"
  MAS_LDFLAGS="$MAS_LDFLAGS `for i in $tmp_mas_libs; do echo $i; done |grep ^-L |sed s/^-L/-R/g`"
  LIBMAS="$MAS_LDFLAGS"
  for i in $tmp_mas_libs; do LIBMAS="$LIBMAS `echo $i |grep ^-l`"; done
fi
AC_SUBST(MAS_CFLAGS)
AC_SUBST(MAS_LDFLAGS)
AC_SUBST(LIBMAS)

])

dnl Posix realtime scheduling - this is helpful if you want arts to run with
dnl higher priority than everthing else

AC_DEFUN([ARTS_TRY_LINK_POSIX_REALTIME],
[
AC_TRY_LINK([
#include <sched.h>
],
[
sched_getscheduler(0);
],
arts_realtime_sched=yes,
arts_realtime_sched=no)
])

AC_DEFUN([AC_CHECK_REALTIME_SCHED],
[
AC_MSG_CHECKING([for posix realtime scheduling support])
save_LIBS="$LIBS"
LIBPOSIX4=""
ARTS_TRY_LINK_POSIX_REALTIME
if test "x$arts_realtime_sched" = "xno"; then
   LIBS="$LIBS -lposix4"
   ARTS_TRY_LINK_POSIX_REALTIME
   if test "x$arts_realtime_sched" = "xyes"; then
      LIBPOSIX4="-lposix4"
   fi
fi
LIBS="$save_LIBS"
AC_SUBST(LIBPOSIX4)
AC_MSG_RESULT($arts_realtime_sched)

if test "x$arts_realtime_sched" = "xyes"; then
  AC_DEFINE(HAVE_REALTIME_SCHED,1,
        [Define if your system supports realtime scheduling])
fi
])

dnl Type of the ioctl function test - after some tries, it seems that this
dnl not required for Linux vs. FreeBSD (for which this test was written), and
dnl that only the Linux documentation claims that it has an "int" as second
dnl argument. But maybe there will pop up systems for which the signature
dnl differs, later.

AC_DEFUN([AC_CHECK_IOCTL_TYPE],
[
  AC_MSG_CHECKING([ioctl type])
  AC_CACHE_VAL(ac_cv_ioctl_type,
  [
    AC_LANG_SAVE
    AC_LANG_C

    AC_TRY_COMPILE(
    [
      #include <unistd.h>
      #include <sys/ioctl.h>
	  int ioctl(int d, int request,...);
    ],
    [
    ],
	ac_cv_ioctl_type=1)
    AC_TRY_COMPILE(
    [
      #include <unistd.h>
      #include <sys/ioctl.h>
	  int ioctl(int d, unsigned long request,...);
    ],
    [
    ],
	ac_cv_ioctl_type=2)
    AC_TRY_COMPILE(
    [
      #include <unistd.h>
      #include <sys/ioctl.h>
	  int ioctl(int d, unsigned long int request,...);
    ],
    [
    ],
	ac_cv_ioctl_type=3)
     AC_LANG_RESTORE
  ])
  AC_MSG_RESULT($ac_cv_ioctl_type)
  

if test "$ac_cv_ioctl_type" = "1"; then
  AC_DEFINE(HAVE_IOCTL_INT_INT_DOTS,1,
	      [Define if ioctl is declared as int ioctl(int d, int request,...)])
fi
if test "$ac_cv_ioctl_type" = "2"; then
  AC_DEFINE(HAVE_IOCTL_INT_ULONG_DOTS,2,
	      [Define if ioctl is declared as int ioctl(int d, unsigned long request,...)])
fi
if test "$ac_cv_ioctl_type" = "3"; then
  AC_DEFINE(HAVE_IOCTL_INT_ULONGINT_DOTS,3,
	      [Define if ioctl is declared as int ioctl(int d, unsigned long int request,...)])
fi
])

dnl check whether we can do rouding using asm optimization

AC_DEFUN([AC_CHECK_X86_FLOAT_INT],
[
AC_MSG_CHECKING([for x86 float to int conversions])
AC_CACHE_VAL(ac_cv_x86_float_int,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_LINK([
#if defined(__i386__)
static inline long QRound (float inval)
{
  long ret;
  __asm__ ("fistpl %0" : "=m" (ret) : "t" (inval) : "st");
  return ret;
}
#else
error
#endif
],
[
long i = QRound(41.93);  /* should be 42 */
],
ac_cv_x86_float_int=yes,
ac_cv_x86_float_int=no)
AC_LANG_RESTORE
])
AC_MSG_RESULT($ac_cv_x86_float_int)
if test "x$ac_cv_x86_float_int" = "xyes"; then
  AC_DEFINE(HAVE_X86_FLOAT_INT,1,
        [Define if you want to use optimized x86 float to int conversion code])
fi
])

dnl check if the assembler supports SSE instructions
AC_DEFUN([AC_CHECK_X86_SSE],
[
AC_MSG_CHECKING([for x86 SSE instructions])
AC_CACHE_VAL(ac_cv_x86_sse,
[
AC_TRY_COMPILE(,
[
#if defined(__GNUC__) && defined(__i386__)
__asm__("movups %xmm0, (%esp)");
#else
/* IRIX's cc treats #error as a warning, make sure it errors out here */
error Not gcc on x86
#endif
],
ac_cv_x86_sse=yes,
ac_cv_x86_sse=no)
])
AC_MSG_RESULT($ac_cv_x86_sse)
if test "x$ac_cv_x86_sse" = "xyes"; then
	AC_DEFINE(HAVE_X86_SSE,1,
		[Define if your assembler supports x86 SSE instructions])
fi
])

dnl check whether we should try to emulate stdio fopen/fclose via
dnl glibc facilities (this *really* depends on glibc internals)

AC_DEFUN([AC_CHECK_ARTSDSP_STDIO_EMU],
[
AC_MSG_CHECKING([for stdio emulation in artsdsp])
AC_CACHE_VAL(ac_cv_artsdsp_stdio_emu,
[
AC_LANG_SAVE
AC_LANG_C
AC_TRY_LINK([
#define _GNU_SOURCE
#include <stdio.h>
],
[
	cookie_io_functions_t fns = { 0, 0, 0, 0 };
	struct fd_cookie *fdc = 0;
	FILE *out = fopencookie (fdc,"w", fns);
	out->_fileno = 0;
],
ac_cv_artsdsp_stdio_emu=yes,
ac_cv_artsdsp_stdio_emu=no)
])
AC_LANG_RESTORE
AC_MSG_RESULT($ac_cv_artsdsp_stdio_emu)
if test "x$ac_cv_artsdsp_stdio_emu" = "xyes"; then
  AC_DEFINE(HAVE_ARTSDSP_STDIO_EMU,1,
	[Define if you want to use glibc facilities to emulate stdio accesses in artsdsp])
fi
])

dnl call the tests
AC_ARG_WITH(libaudioio,
  [AC_HELP_STRING(--with-libaudioio,
    [enable support for libaudioio @<:@default=check@:>@])],
  [], with_libaudioio=check)

if test "x$with_libaudioio" != xno; then
  AC_CHECK_LIBAUDIOIO

  if test "x$with_libaudioio" != xcheck && test -z "$LIBAUDIOIO"; then
    AC_MSG_FAILURE([--with-libaudioio was given, but test for libaudioio failed])
  fi
fi

AC_ARG_WITH(nas,
  [AC_HELP_STRING(--with-nas,
    [enable support for NAS @<:@default=check@:>@])],
  [], with_nas=check)

if test "x$with_nas" != xno; then
  AC_CHECK_LIBAUDIONAS

  if test "x$with_nas" != xcheck && test -z "$LIBAUDIONAS"; then
    AC_MSG_FAILURE([--with-nas was given, but test for NAS failed])
  fi
fi

AC_ARG_WITH(esd,
  [AC_HELP_STRING(--with-esd,
    [enable support for EsounD @<:@default=check@:>@])],
  [], with_esd=check)

if test "x$with_esd" != xno; then
  AC_CHECK_LIBESD

  if test "x$with_esd" != xcheck && test -z "$LIBESD"; then
    AC_MSG_FAILURE([--with-esd was given, but test for EsounD failed])
  fi
fi

AC_ARG_WITH(audiofile,
  [AC_HELP_STRING(--with-audiofile,
    [enable support for audiofile @<:@default=check@:>@])],
  [], with_audiofile=check)

if test "x$with_audiofile" != xno; then
  AC_CHECK_LIBAUDIOFILE

  if test "x$with_audiofile" != xcheck && test -z "$LIBAUDIOFILE"; then
    AC_MSG_FAILURE([--with-audiofile was given, but test for audiofile failed])
  fi
fi
AM_CONDITIONAL(HAVE_WAVSUPPORT, test -n "$LIBAUDIOFILE")

AC_ARG_WITH(sgilibaudio,
  [AC_HELP_STRING(--with-sgilibaudio,
    [enable support for SGI libaudio @<:@default=check@:>@])],
  [], with_sgilibaudio=check)

if test "x$with_sgilibaudio" != xno; then
  AC_CHECK_SGILIBAUDIO

  if test "x$with_sgilibaudio" != xcheck && test -z "$SGILIBAUDIO"; then
    AC_MSG_FAILURE([--with-sgilibaudio was given, but test for SGI libaudio failed])
  fi
fi

AC_ARG_WITH(mas,
  [AC_HELP_STRING(--with-mas,
    [enable support for MAS @<:@default=check@:>@])],
  [], with_mas=check)

if test "x$with_mas" != xno; then
  AC_CHECK_LIBMAS

  if test "x$with_mas" != xcheck && test -z "$LIBMAS"; then
    AC_MSG_FAILURE([--with-mas was given, but test for MAS failed])
  fi
fi

AC_CHECK_REALTIME_SCHED
AC_CHECK_GETDOMAINNAME
AC_CHECK_IOCTL_TYPE
AC_CHECK_X86_FLOAT_INT
AC_CHECK_X86_SSE
AC_CHECK_ARTSDSP_STDIO_EMU
KDE_CHECK_THREADING

dnl somewhat more deeply nested template code than gcc understands by default
if test "$GXX" = "yes"; then
  KDE_CHECK_COMPILER_FLAG(ftemplate-depth-99,
  [
    CXXFLAGS="$CXXFLAGS -ftemplate-depth-99"
  ])
fi

dnl check for ALSA audio support
arts_with_alsa=yes
AC_ARG_WITH(alsa, [  --with-alsa             enable aRts ALSA support],
[arts_with_alsa=$withval])

if test "$arts_with_alsa" = "yes"; then
AC_DEFUN([AC_CHECK_LIBASOUND],
[
  ac_ldflags_save="$LDFLAGS"
  LDFLAGS="$all_libraries $LDFLAGS"
  kde_has_asoundlib=no

  AC_CHECK_HEADERS([ sys/asoundlib.h alsa/asoundlib.h ],
  [
    kde_has_asoundlib=yes
  ])

  dnl trial and error version check for ALSA 0.5.x / ALSA 0.9.x
  AC_LANG_SAVE
  AC_LANG_C
  if test "x$kde_has_asoundlib" = "xyes"; then
    AC_TRY_COMPILE([
      #include "confdefs.h"
      #ifdef HAVE_SYS_ASOUNDLIB_H
      #include <sys/asoundlib.h>
      #endif
      #ifdef HAVE_ALSA_ASOUNDLIB_H
      #include <alsa/asoundlib.h>
      #endif
    ],[
      #if (SND_LIB_MAJOR == 0) && (SND_LIB_MINOR == 9)
        /* we have ALSA 0.9.x */
      #else
        #error not ALSA 0.9.x
      #endif
    ],
    kde_has_alsa_0_9=yes,
    kde_has_alsa_0_9=no)
  fi

  if test "x$kde_has_asoundlib" = "xyes"; then
    AC_TRY_COMPILE([
      #include "confdefs.h"
      #ifdef HAVE_SYS_ASOUNDLIB_H
      #include <sys/asoundlib.h>
      #endif
      #ifdef HAVE_ALSA_ASOUNDLIB_H
      #include <alsa/asoundlib.h>
      #endif
    ],[
      #if (SND_LIB_MAJOR == 1) && (SND_LIB_MINOR == 0)
        /* we have ALSA 1.x */
      #else
        #error not ALSA 1.x
      #endif
    ],
    kde_has_alsa_1_0=yes,
    kde_has_alsa_1_0=no)
  fi

  if test "x$kde_has_asoundlib" = "xyes"; then
    AC_TRY_COMPILE([
      #include "confdefs.h"
      #ifdef HAVE_SYS_ASOUNDLIB_H
      #include <sys/asoundlib.h>
      #endif
      #ifdef HAVE_ALSA_ASOUNDLIB_H
      #include <alsa/asoundlib.h>
      #endif
    ],[
    #if (SND_LIB_MAJOR == 0) && (SND_LIB_MINOR == 5)
      /* we have ALSA 0.5.x */
    #else
      #error not ALSA 0.5.x
    #endif
    ],
    kde_has_alsa_0_5=yes,
    kde_has_alsa_0_5=no)
  fi
  AC_LANG_RESTORE

  if test "x$kde_has_asoundlib" = "xyes"; then
    AC_CHECK_LIB(asound,snd_seq_create_simple_port,[
      if test "x$kde_has_alsa_0_5" = "xyes"; then
        LIBASOUND="-lasound"
        AC_DEFINE(HAVE_LIBASOUND, 1,
        [Define if you have libasound.so.1 (required for ALSA 0.5.x support)])
      fi
      if test "x$kde_has_alsa_0_9" = "xyes"; then
        LIBASOUND="-lasound"
        AC_DEFINE(HAVE_LIBASOUND2, 1,
          [Define if you have libasound.so.2 (required for ALSA 0.9.x support)])
        AC_CHECK_LIB(asound,snd_pcm_resume,[
          AC_DEFINE(HAVE_SND_PCM_RESUME, 1,
            [Define if libasound has snd_pcm_resume()])])
      fi
      if test "x$kde_has_alsa_1_0" = "xyes"; then
        LIBASOUND="-lasound"
        AC_DEFINE(HAVE_LIBASOUND2, 1,
          [Define if you have libasound.so.2 (required for ALSA 0.9.x/1.x support)])
	AC_DEFINE(ALSA_PCM_OLD_SW_PARAMS_API, 1,
          [Define if you have alsa 1.x])
	AC_DEFINE(ALSA_PCM_OLD_HW_PARAMS_API, 1,
          [Define if you have alsa 1.x])
        AC_CHECK_LIB(asound,snd_pcm_resume,[
          AC_DEFINE(HAVE_SND_PCM_RESUME, 1,
            [Define if libasound has snd_pcm_resume()])])
      fi
    ])
  fi
  AC_SUBST(LIBASOUND)
  LDFLAGS="$ac_ldflags_save"
])
AC_CHECK_LIBASOUND
fi

AC_SUBST(LIBASOUND)

dnl check for IRIX audio support
AC_MSG_CHECKING([for IRIX])
if test `uname` = "IRIX" -o `uname` = "IRIX64" ; then
  AC_DEFINE(HAVE_IRIX, 1, [Define if you compile under IRIX])
  AC_MSG_RESULT("yes")
else
  AC_MSG_RESULT("no")
fi

dnl check wether we want to use libcsl style sound I/O
AC_ARG_ENABLE(csl,
[  --enable-csl      enable libcsl style sound I/O for aRts],
[arts_want_csl="$enableval"],[arts_want_csl="no"])

if test "$arts_want_csl" = "yes"; then
  LIBCSL="-lcsl"
  AC_DEFINE(HAVE_LIBCSL, 1,
        [Define if you have libcsl (required if you want to have CSL support)])
else
  LIBCSL=""
fi
AC_SUBST(LIBCSL)

dnl Check for pkg-config
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)

if test "$PKG_CONFIG" = "no"; then
  AC_MSG_ERROR([
This package requires pkg-config.
])
fi

dnl Check for Glib-2.0
# GLIB_CFLAGS:  cflags for compiling glib dependant sources
# GLIB_LIBADD:  glib libraries (-l options)
# GLIB_LDFLAGS: flags containing path to glib libraries (-L options)

GLIB_PACKAGES="gmodule-2.0 gthread-2.0"
GLIB_VERSION="1.3.3"
AC_MSG_CHECKING(for GLib-2.0 (at least $GLIB_VERSION))

if $PKG_CONFIG --atleast-pkgconfig-version 0.15 ; then
   if $PKG_CONFIG --atleast-version $GLIB_VERSION $GLIB_PACKAGES >/dev/null 2>&1 ; then
       GLIB_CFLAGS="`$PKG_CONFIG --cflags $GLIB_PACKAGES`"
       GLIB_LIBADD="`$PKG_CONFIG --libs-only-l --libs-only-other $GLIB_PACKAGES`"
       GLIB_LDFLAGS="`$PKG_CONFIG --libs-only-L $GLIB_PACKAGES`"
       AC_MSG_RESULT(yes)
   fi  
else
   if $PKG_CONFIG --atleast-version $GLIB_VERSION $GLIB_PACKAGES >/dev/null 2>&1 ; then
       GLIB_CFLAGS="`$PKG_CONFIG --cflags $GLIB_PACKAGES`"
       GLIB_LIBADD="`$PKG_CONFIG --libs $GLIB_PACKAGES`"
       GLIB_LDFLAGS="`$PKG_CONFIG --libs-only-L $GLIB_PACKAGES`"
       AC_MSG_RESULT(yes)
       AC_MSG_WARN([you may need to run make LDFLAGS=-pthread to compile arts])
   fi
fi

if test -z "$GLIB_LIBADD"; then
	AC_MSG_RESULT(not installed)
	AC_ERROR([
	Please install glib-2.0 (see http://www.gtk.org).
	])
    DO_NOT_COMPILE="$DO_NOT_COMPILE gmcop"
fi

CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"

AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBADD)
AC_SUBST(GLIB_LDFLAGS)

AC_ARG_WITH(jack,
  [AC_HELP_STRING(--with-jack,
    [enable support for Jack @<:@default=check@:>@])],
  [], with_jack=check)

if test "x$with_jack" != xno; then
  AC_MSG_CHECKING(for Jack Audio Connection Kit)
  if $PKG_CONFIG --atleast-version 0.90 jack >/dev/null 2>&1 ; then
    JACK_CFLAGS="`$PKG_CONFIG --cflags jack`"
    JACK_LIBADD="`$PKG_CONFIG --libs-only-l jack`"
    JACK_LDFLAGS="`$PKG_CONFIG --libs-only-L jack`"
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_LIBJACK, 1,
          [Define if you have libjack (required if you want Jack support)])
  else
    AC_MSG_RESULT(not installed)
  fi
  AC_SUBST(JACK_CFLAGS)
  AC_SUBST(JACK_LIBADD)
  AC_SUBST(JACK_LDFLAGS)

  if test "x$with_jack" != xcheck && test -z "$JACK_LIBADD"; then
    AC_MSG_FAILURE([--with-jack was given, but test for Jack failed])
  fi
fi

dnl OpenBSD requires an -lossaudio and soundcard.h to provide OSS audio I/O
AC_CHECK_HEADERS(soundcard.h)
AC_CHECK_LIB(ossaudio, _oss_ioctl, [LIBOSSAUDIO="-lossaudio"])
AC_SUBST(LIBOSSAUDIO)

AM_CONFIG_HEADER(mcop/arts_export.h)
AM_CONFIG_HEADER(artsc/artsc_export.h)

dnl Don't remove !
dnl AC_OUTPUT(artsc/artsc-config)

dnl Check if we are building as part of KDE. Arts can also be built as
dnl a standalone snapshot in which case KDE may not be present and things
dnl that depend on KDE should not be built.
dnl AC_MSG_CHECKING(if building standalone aRts snapshot without KDE)
dnl if test "$DCOPIDL" = ""; then
dnl	AC_MSG_RESULT(yes)
dnl	ARTS_BUILD_KDE=""
dnl	MOC="true"
dnl	DCOPIDL="true"
dnl	DCOPIDL2CPP="true"
dnl	AC_SUBST(MOC)
dnl	AC_SUBST(DCOPIDL)
dnl	AC_SUBST(DCOPIDL2CPP)
dnl else
dnl	AC_MSG_RESULT(no)
dnl	if test "x$kde_use_qt_emb" = "xyes"; then
dnl		ARTS_BUILD_KDE="qtmcop kde knotify message"
dnl	else
dnl		ARTS_BUILD_KDE="x11 qtmcop kde knotify message"
dnl	fi
dnl fi
dnl AC_SUBST(ARTS_BUILD_KDE)

MCOPIDL='$(top_builddir)/mcopidl/mcopidl'
AC_SUBST(MCOPIDL)

AC_SUBST(ARTS_MAJOR_VERSION)
AC_SUBST(ARTS_MINOR_VERSION)
AC_SUBST(ARTS_MICRO_VERSION)
AC_SUBST(ARTS_VERSION)

dnl Don't remove !
dnl AC_OUTPUT(artsc/artsdsp)
dnl AC_OUTPUT(soundserver/artsversion-new.h)
dnl AC_OUTPUT(flow/gsl/gslconfig.h)