File: configure.in

package info (click to toggle)
ogle 0.9.2-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,940 kB
  • ctags: 3,499
  • sloc: ansic: 35,155; sh: 7,555; makefile: 259; asm: 71
file content (883 lines) | stat: -rw-r--r-- 24,846 bytes parent folder | download
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
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
dnl Process this file with autoconf to produce a configure script.
AC_INIT(ac3/ac3dec_wrap.c)
AM_INIT_AUTOMAKE(ogle, 0.9.2)
dnl AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AC_CANONICAL_HOST

dnl Checks for programs.
AC_PROG_CC

dnl AM_DISABLE_SHARED
AM_PROG_LIBTOOL

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_C_CONST
AC_C_ALWAYS_INLINE
AC_CHECK_GENERATE_INTTYPES([include])


dnl Checks for header files.
AC_CHECK_HEADERS([byteswap.h sys/bswap.h sys/endian.h sys/param.h stropts.h])

dnl Find X Window System
AC_PATH_XTRA
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
AC_CHECK_HEADER(X11/extensions/XShm.h, 
		[AC_DEFINE(HAVE_XSHM, 1, [X11 supports MIT-XShm])],,
		[#include <X11/Xlib.h>])
CPPFLAGS=$saved_CPPFLAGS
AC_CHECK_LIB(Xext, XShmQueryExtension, 
	     [XEXT_LIB=-lXext], 
	     [AC_MSG_ERROR(You need libXext)], 
	     [$X_LIBS -lX11 $X_EXTRA_LIBS])

AC_CHECK_LIB(Xmu, XSolarisGetVisualGamma, 
	     [AC_DEFINE([USE_SOLARIS_XMU], 1, [SolarisXmu present])
		XEXT_LIB="$XEXT_LIB -lXmu"
	   	],, 
	     [$X_LIBS -lX11 $X_EXTRA_LIBS])


dnl ---------------------------------------------------------
dnl Xvideo (Xv)
dnl ---------------------------------------------------------

use_xv=yes
AC_ARG_ENABLE(xv, 
  [  --disable-xv            disable the use of Xv ],
  [if test "x$enableval" != xyes; then
     use_xv=no
   fi])
if test "x$use_xv" = xyes; then
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
  AC_CHECK_HEADER(X11/extensions/Xv.h, xv_header=yes, xv_header=no)
  CPPFLAGS=$saved_CPPFLAGS
  AC_CHECK_LIB(Xv, XvQueryExtension, 
	       [ AC_DEFINE([HAVE_XV], 1, [X11 supports Xv])
		 XEXT_LIB="$XEXT_LIB -lXv"
		 BUILD_XV=1
	        ], 
	       [AC_MSG_WARN([You won't be able to use Xv])], 
	       [$X_LIBS -lX11 -lXext $X_EXTRA_LIBS])
fi
AC_SUBST(XEXT_LIB)

dnl ---------------------------------------------------------
dnl end Xvideo (Xv)
dnl ---------------------------------------------------------


dnl ---------------------------------------------------------
dnl libjpeg
dnl ---------------------------------------------------------

jpeg_path=""
AC_ARG_WITH(libjpeg, 
  AC_HELP_STRING([--with-libjpeg=path],
                 [specify the install prefix to libjpeg]), 
  [if test "x$withval" = xno; then
     AC_MSG_ERROR([You must have/use libjpeg])
   fi
   if test "x$withval" != xyes; then
     jpeg_path=$withval
   fi])
if test -z "$jpeg_path"; then
  dnl We have nothing better to go on, guess that it's installed in prefix
  if test "x$prefix" != xNONE; then
    jpeg_path=$prefix
  else
    jpeg_path=$ac_default_prefix
  fi  
fi
dnl Both this and the libdvdread should first test and see if any flags
dnl beside -lname are needed. Then they the suggested path (+ some standard?)
TMPCFLAGS=$CFLAGS
CFLAGS="-L$jpeg_path/lib"
AC_CHECK_LIB(jpeg, main, 
  [ JPEG_LIBS="-L$jpeg_path/lib -R$jpeg_path/lib -ljpeg"
    JPEG_CPPFLAGS=-I$jpeg_path/include
  ],
  [AC_MSG_ERROR([Need libjpeg, install it and/or specify it's location])], 
  -L$jpeg_path/lib)

CFLAGS=$TMPCFLAGS

AC_ARG_WITH(libjpeg-includes, 
  AC_HELP_STRING([--with-libjpeg-includes=path],
                 [specify location of libjpeg headers]), 
  [JPEG_CPPFLAGS=-I$with_libjpeg_includes])

dnl if test x"$JPEG_CPPFLAGS" = x"-I/usr/local/include"; then
dnl  JPEG_CPPFLAGS=""
dnl fi
if test x"$JPEG_CPPFLAGS" = x"-I/usr/include"; then
  JPEG_CPPFLAGS=""
fi

saved_CPPFLAGS=$CPPFLAGS
dnl -w added to shutup GCC3.1's cpp warning about -I/usr/local
CPPFLAGS="-w $CPPFLAGS $JPEG_CPPFLAGS"
AC_CHECK_HEADER(jpeglib.h,, 
  [ AC_MSG_WARN([Can not find jpeglib.h, need the libjpeg headers])
    AC_MSG_ERROR([Install the headers and/or specify their location]) 
  ])
CPPFLAGS=$saved_CPPFLAGS

AC_SUBST(JPEG_CPPFLAGS)
AC_SUBST(JPEG_LIBS)

dnl ---------------------------------------------------------
dnl end libjpeg
dnl ---------------------------------------------------------


dnl clock_gettime is in librt on Solaris
AC_CHECK_FUNC(clock_gettime, [ AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [ ]) ], 
  AC_CHECK_LIB(rt, clock_gettime, 
    [ AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [ ])
      LIBS="$LIBS -lrt"
    ]
  )
)

dnl nanosleep is in librt on Solaris
AC_CHECK_FUNC(nanosleep, , 
  AC_CHECK_LIB(rt, nanosleep, [ LIBS="$LIBS -lrt" ],
    AC_CHECK_LIB(posix4, nanosleep, [ LIBS="$LIBS -lposix4" ], 
      AC_MSG_ERROR(You need nanosleep)
    )
  )
)

dnl Should this also have some fallback library?
AC_CHECK_FUNCS(madvise)


dnl ---------------------------------------------------------
dnl dvdread
dnl ---------------------------------------------------------

dvd_path=""
AC_ARG_WITH(dvdread, 
  AC_HELP_STRING([--with-dvdread=path],
                 [specify the install prefix to libdvdread]), 
  [if test "x$with_dvdread" = xno; then
     AC_MSG_ERROR([You must have/use libdvdread])
   fi
   if test "x$with_dvdread" != xyes; then
     dvd_path=$with_dvdread
   fi])
if test -z "$dvd_path"; then
  dnl We have nothing better to go on, guess that it's installed in prefix
  if test "x$prefix" != xNONE; then
    dvd_path=$prefix
  else
    dvd_path=$ac_default_prefix
  fi
fi

TMPCFLAGS=$CFLAGS
CFLAGS="-L$dvd_path/lib"

AC_CHECK_LIB(dvdread, DVDDiscID, 
  [ DVDREAD_LIBS="-L$dvd_path/lib -R$dvd_path/lib -ldvdread" 
    DVDREAD_CPPFLAGS=-I$dvd_path/include
  ],
  [
    AC_CHECK_LIB(dvdread, DVDOpen, 
      [ AC_MSG_ERROR([Upgrade libdvdread to 0.9.4 or later]) ],
      [ AC_MSG_ERROR([Need libdvdread, install it or specify it's location])],
      -L$dvd_path/lib)
  ], -L$dvd_path/lib)

CFLAGS=$TMPCFLAGS

AC_ARG_WITH(dvdread-includes, 
  AC_HELP_STRING([--with-dvdread-includes=path],
              [specify location of libdvdread headers]), 
  [DVDREAD_CPPFLAGS=-I$with_dvdread_includes])

dnl if test x"$DVDREAD_CPPFLAGS" = x"-I/usr/local/include"; then
dnl  DVDREAD_CPPFLAGS=""
dnl fi
if test x"$DVDREAD_CPPFLAGS" = x"-I/usr/include"; then
  DVDREAD_CPPFLAGS=""
fi

dnl Linux and Solaris needs this to prototype lseek64 and others
dnl Should really be taken from getconf...
DVDREAD_CPPFLAGS="-D_LARGEFILE64_SOURCE $DVDREAD_CPPFLAGS"

saved_CPPFLAGS=$CPPFLAGS
dnl -w added to shutup GCC3.1's cpp warning about -I/usr/local
CPPFLAGS="-w $CPPFLAGS $DVDREAD_CPPFLAGS"
AC_CHECK_HEADER(dvdread/dvd_reader.h,, 
  [ AC_MSG_WARN([Can not find dvd_reader.h, need the libdvdread headers])
    AC_MSG_ERROR([Install the headers and/or specify their location]) 
  ])
CPPFLAGS=$saved_CPPFLAGS

AC_SUBST(DVDREAD_CPPFLAGS)
AC_SUBST(DVDREAD_ALIGN_CFLAGS)
AC_SUBST(DVDREAD_LIBS)

dnl ---------------------------------------------------------
dnl end dvdread
dnl ---------------------------------------------------------


dnl ---------------------------------------------------------
dnl Sun MediaLib
dnl ---------------------------------------------------------

have_mlib=no
mlib_path="/opt/SUNWmlib"
AC_ARG_WITH(libmlib,
  AC_HELP_STRING([--with-libmlib=path],
                 [specify where mediaLib is installed]),
  [if test "x$with_libmlib" != xyes; then
     mlib_path=$with_libmlib
   fi])
if test "x$mlib_path" != xno; then
  saved_CPPFLAGS=$CFLAGS
  CFLAGS="$CFLAGS -L$mlib_path/lib"
  AC_CHECK_LIB(mlib, mlib_VideoDCT8x8_S16_S16, 
	       [ MLIB_LIBS="-L$mlib_path/lib -R$mlib_path/lib -lmlib"
                 MLIB_CPPFLAGS=-I$mlib_path/include
                 have_mlib=yes
               ])
  CFLAGS=$saved_CPPFLAGS
fi
if test "x$have_mlib" = xyes; then
  dnl if test x"$MLIB_CPPFLAGS" = x"-I/usr/local/include"; then
  dnl   MLIB_CPPFLAGS=""
  dnl fi
  if test x"$MLIB_CPPFLAGS" = x"-I/usr/include"; then
    MLIB_CPPFLAGS=""
  fi

  saved_CPPFLAGS=$CPPFLAGS
  dnl -w added to shutup GCC3.1's cpp warning about -I/usr/local
  CPPFLAGS="-w $CPPFLAGS $MLIB_CPPFLAGS"
  AC_CHECK_HEADER(mlib_types.h,, 
    [ AC_MSG_WARN([Can not find mlib_types.h, need the mediaLib headers])
      AC_MSG_ERROR([Install the headers and/or specify their location]) 
    ])
  CPPFLAGS=$saved_CPPFLAGS
fi


AC_SUBST(MLIB_CPPFLAGS)
AC_SUBST(MLIB_LIBS)
AM_CONDITIONAL(MLIB_LIBS, [test "x$have_mlib" = xyes])
if test "x$have_mlib" = xyes; then
  AC_DEFINE(HAVE_MLIB, 1, [Solaris MultiMedia Library installed])
  BUILD_MLIB=1
fi

dnl ---------------------------------------------------------
dnl end Sun MediaLib
dnl ---------------------------------------------------------


dnl ---------------------------------------------------------
dnl liba52
dnl ---------------------------------------------------------

a52_path=""
AC_ARG_WITH(liba52, 
  AC_HELP_STRING([--with-liba52=path],
                 [specify the install prefix to liba52 (a52dec)]), 
  [if test "x$with_liba52" = xno; then
     AC_MSG_ERROR([You must have/use a52dec])
   fi
   if test "x$with_liba52" != xyes; then
     a52_path=$with_liba52
   fi])
if test -z "$a52_path"; then
  dnl We have nothing better to go on, guess that it's installed in prefix
  if test "x$prefix" != xNONE; then
    a52_path=$prefix
  else
    a52_path=$ac_default_prefix
  fi
fi

TMPCFLAGS=$CFLAGS
CFLAGS="-L$a52_path/lib"

dnl a52_free is a new function in 0.7.3
AC_CHECK_LIB(a52, a52_free, 
  [ 
    A52_LIBS="-L$a52_path/lib -R$a52_path/lib -la52" 
    A52_CPPFLAGS=-I$a52_path/include
  ],
  [
    if test "x$have_mlib" = xyes; then
      AC_CHECK_LIB(a52, a52_init, 
        [ AC_MSG_ERROR([You have liba52 0.7.2 or earlier, need 0.7.3 or later])
        ],
        [ AC_MSG_ERROR([Need liba52, install a52dec or specify it's location])
        ], -L$a52_path/lib -L$mlib_path/lib -lmlib -lm)
    else
      AC_CHECK_LIB(a52, a52_init, 
        [ AC_MSG_ERROR([You have liba52 0.7.2 or earlier, need 0.7.3 or later])
        ],
        [ AC_MSG_ERROR([Need liba52, install a52dec or specify it's location])
        ], -L$a52_path/lib -lm)
    fi
  ], [-L$a52_path/lib -lm])

CFLAGS=$TMPCFLAGS

AC_ARG_WITH(liba52-includes, 
  AC_HELP_STRING([--with-liba52-includes=path],
                 [specify location of liba52 headers]), 
  [A52_CPPFLAGS=-I$with_liba52_includes])

dnl update to test for 0.7.2 / 0.7.3 MM_ACCEL_DJBFFT ?

dnl if test x"$A52_CPPFLAGS" = x"-I/usr/local/include"; then
dnl  A52_CPPFLAGS=""
dnl fi
if test x"$A52_CPPFLAGS" = x"-I/usr/include"; then
  A52_CPPFLAGS=""
fi

saved_CPPFLAGS=$CPPFLAGS
dnl -w added to shutup GCC3.1's cpp warning about -I/usr/local
CPPFLAGS="-w $CPPFLAGS $A52_CPPFLAGS"
AC_CHECK_HEADER(a52dec/a52.h,, 
    [ AC_MSG_WARN([Can not find a52dec/a52.h, need the liba52 headers])
      AC_MSG_ERROR([Install a52dec(-dev) and/or specify it's location]) 
    ])
CPPFLAGS=$saved_CPPFLAGS

AC_SUBST(A52_CPPFLAGS)
AC_SUBST(A52_LIBS)

dnl ---------------------------------------------------------
dnl end liba52
dnl ---------------------------------------------------------

dnl ---------------------------------------------------------
dnl libmad
dnl ---------------------------------------------------------

mad_path=""
AC_ARG_WITH(libmad, 
  AC_HELP_STRING([--with-libmad=path],
                 [specify the install prefix to libmad]), 
  [if test "x$with_libmad" = xno; then
     AC_MSG_ERROR([You must have/use libmad])
   fi
   if test "x$with_libmad" != xyes; then
     mad_path=$with_libmad
   fi])
if test -z "$mad_path"; then
  dnl We have nothing better to go on, guess that it's installed in prefix
  if test "x$prefix" != xNONE; then
    mad_path=$prefix
  else
    mad_path=$ac_default_prefix
  fi
fi

TMPCFLAGS=$CFLAGS
CFLAGS="-L$mad_path/lib"

AC_CHECK_LIB(mad, mad_frame_decode, 
  [ 
    MAD_LIBS="-L$mad_path/lib -R$mad_path/lib -lmad" 
    MAD_CPPFLAGS=-I$mad_path/include
  ],[AC_MSG_ERROR([Need libmad, install it or specify it's location])],
    [-L$mad_path/lib])

CFLAGS=$TMPCFLAGS

AC_ARG_WITH(libmad-includes, 
  AC_HELP_STRING([--with-libmad-includes=path],
                 [specify location of libmad headers]), 
  [MAD_CPPFLAGS=-I$with_libmad_includes])

saved_CPPFLAGS=$CPPFLAGS
dnl -w added to shutup GCC3.1's cpp warning about -I/usr/local
CPPFLAGS="-w $CPPFLAGS $MAD_CPPFLAGS"
AC_CHECK_HEADER(mad.h,, 
    [ AC_MSG_WARN([Can not find mad.h, need the libmad headers])
      AC_MSG_ERROR([Install libmad and/or specify it's location]) 
    ])
CPPFLAGS=$saved_CPPFLAGS

AC_SUBST(MAD_CPPFLAGS)
AC_SUBST(MAD_LIBS)

dnl ---------------------------------------------------------
dnl end libmad
dnl ---------------------------------------------------------

dnl ---------------------------------------------------------
dnl our integrated audio library
dnl ---------------------------------------------------------

AC_DEFINE([LIBOGLEAO_NULL],,[libogleao null audio support])

dnl check for oss
AC_ARG_ENABLE([oss],
    [  --disable-oss           make a version not using oss])
if test "x$enable_oss" != xno; then
    case "$host" in
    *-linux*|*-openbsd*|*-freebsd*|*-bsdi*)

dnl check for headers.. only define LIBOGLEAO_OSS if library and headers found.
        AC_DEFINE([LIBOGLEAO_OSS],,[libogleao OSS audio support])
	BUILD_AUDIO_OSS=1
        AC_CHECK_LIB([ossaudio],[_oss_ioctl],
            [LIBOGLEAO_LIBS="$LIBOGLEAO_LIBS -lossaudio"])
	DEFAULT_AUDIO_DRIVER="oss"
	DEFAULT_AUDIO_DEVICE="/dev/dsp"
    ;;
    *-sun-solaris*|*-hpux*)
        AC_CHECK_LIB([OSSlib],[OSS_init],
            [LIBOGLEAO_LIBS="$LIBOGLEAO_LIBS -lOSSlib"
             AC_DEFINE([LIBOGLEAO_OSS],,[libogleao OSS audio support])
             BUILD_AUDIO_OSS=1
             DEFAULT_AUDIO_DRIVER="oss"
             DEFAULT_AUDIO_DEVICE="/dev/dsp"])
    ;;
    esac
fi

dnl check for openbsd audio 
AC_ARG_ENABLE([obsdaudio],
    [  --disable-obsdaudio     make a version not using OpenBSD audio])
if test "x$enable_obsdaudio" != xno; then
    case "$host" in
    *-openbsd* | *-netbsd* )

dnl only define LIBOGLEAO_OBSD headers found
dnl sys/audioio.h
        AC_DEFINE([LIBOGLEAO_OBSD],,[libogleao OpenBSD audio support])
	BUILD_AUDIO_OBSD=1
	DEFAULT_AUDIO_DRIVER="obsd"
	DEFAULT_AUDIO_DEVICE="/dev/audio"
    ;;
    esac
fi

dnl check for sunaudio
AC_ARG_ENABLE([sunaudio],
    [  --disable-sunaudio      make a version not using Sun audio])
if test "x$enable_sunaudio" != xno; then
    case "$host" in
    *-sun-solaris*)

dnl check for headers.. only define LIBOGLEAO_SOLARIS if headers are found.
        AC_DEFINE([LIBOGLEAO_SOLARIS],,[libogleao solaris audio support])
	BUILD_AUDIO_SOLARIS=1
	DEFAULT_AUDIO_DRIVER="solaris"
	DEFAULT_AUDIO_DEVICE="/dev/audio"
    esac
fi

dnl check for ALSA
AC_ARG_ENABLE([alsa],
    [  --disable-alsa          make a version not using alsa])
if test "x$enable_alsa" != xno; then
    case "$host" in
    *-linux*)
        AC_MSG_CHECKING([for alsa version])
        AC_EGREP_CPP([AP_maGiC_VALUE],
          [ 
#include <sys/asoundlib.h>
#if defined(SND_LIB_MAJOR) && defined(SND_LIB_MINOR)
#if SND_LIB_MAJOR>0 || (SND_LIB_MAJOR==0 && SND_LIB_MINOR==5)
AP_maGiC_VALUE
#endif
#endif
          ],
          [
            have_alsa_05x=yes
            AC_MSG_RESULT([found 0.5.x])
	    AC_MSG_WARN([Disabling ALSA support, install a 0.9.x version])
          ],
          [
            AC_EGREP_CPP([AP_maGiC_VALUE],
              [
#include <sys/asoundlib.h>
#if defined(SND_LIB_MAJOR) && defined(SND_LIB_MINOR)
#if SND_LIB_MAJOR>0 || (SND_LIB_MAJOR==0 && SND_LIB_MINOR>=6)
AP_maGiC_VALUE
#endif
#endif
              ],
              [
                have_alsa_final=yes
                AC_MSG_RESULT([found latest])
              ],
	      [
		AC_MSG_RESULT([no])	
	      ])
          ])
        if test "x$have_alsa_final" = x"yes"; then
                    dnl which symbol should we check for? 
          AC_CHECK_LIB([asound],[main],
                       [ AC_DEFINE([LIBOGLEAO_ALSA],,
                                   [libogleao ALSA audio support])
			 LIBOGLEAO_LIBS="$LIBGLEAO_LIBS -lasound"
			 BUILD_AUDIO_ALSA=1
			 DEFAULT_AUDIO_DRIVER="alsa"
			 DEFAULT_AUDIO_DEVICE="/dev/dsp"
                       ])
        fi;;
    esac
fi

AC_SUBST([LIBOGLEAO_LIBS])

dnl ---------------------------------------------------------
dnl end included audio out
dnl ---------------------------------------------------------


dnl ---------------------------------------------------------
dnl libxml
dnl ---------------------------------------------------------

AM_PATH_XML2(2.4.19, AC_DEFINE(HAVE_XML, 1, [libxml found]),
  [ AC_MSG_ERROR([Install libxml2(-dev) and/or specify it's location]) ])

dnl ---------------------------------------------------------
dnl end libxml
dnl ---------------------------------------------------------


dnl ---------------------------------------------------------
dnl XF86VidMode
dnl ---------------------------------------------------------

use_xf86vidmode=yes
AC_ARG_ENABLE(xf86vidmode, 
  [  --disable-xf86vidmode	  disable the use of XF86VidMode ],
  [if test "x$enableval" != xyes; then
     use_xf86vidmode=no
   fi])
if test "x$use_xf86vidmode" = xyes; then
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
  AC_CHECK_HEADER([X11/extensions/xf86vmode.h], 
                  [xf86vidmode_header=yes], 
                  [xf86vidmode_header=no],
                  [#include <X11/Xlib.h>])
  CPPFLAGS=$saved_CPPFLAGS
  AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, 
	       [ AC_DEFINE([HAVE_XF86VIDMODE], 1, [X11 supports XF86VidMode])
		 XF86VIDMODE_LIBS="-lXxf86vm"
	        ], 
	       [AC_MSG_WARN([You won't be able to use XF86VidMode])], 
	       [$X_LIBS -lX11 -lXext $X_EXTRA_LIBS])
fi
AC_SUBST(XF86VIDMODE_LIBS)

dnl ---------------------------------------------------------
dnl end XF86VidMode
dnl ---------------------------------------------------------


dnl ---------------------------------------------------------
dnl Xinerama
dnl ---------------------------------------------------------

use_xinerama=yes
AC_ARG_ENABLE(xinerama, 
  [  --disable-xinerama	  disable the use of Xinerama ],
  [if test "x$enableval" != xyes; then
     use_xinerama=no
   fi])
if test "x$use_xinerama" = xyes; then
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
  AC_CHECK_HEADER([X11/extensions/Xinerama.h], 
                  [xinerama_header=yes], 
                  [xinerama_header=no],
                  [#include <X11/Xlib.h>])
  CPPFLAGS=$saved_CPPFLAGS
  AC_CHECK_LIB(Xinerama, XineramaQueryExtension, 
	       [ AC_DEFINE([HAVE_XINERAMA], 1, [X11 supports Xinerama])
		 XINERAMA_LIBS="-lXinerama"
	        ], 
	       [AC_MSG_WARN([You won't be able to use Xinerama])], 
	       [$X_LIBS -lX11 -lXext $X_EXTRA_LIBS])
fi
AC_SUBST(XINERAMA_LIBS)

dnl ---------------------------------------------------------
dnl end Xinerama
dnl ---------------------------------------------------------


dnl ---------------------------------------------------------
dnl config file
dnl ---------------------------------------------------------

if test "x${prefix}" = "xNONE"; then
  AC_DEFINE_UNQUOTED(CONFIG_FILE, "${ac_default_prefix}/share/ogle/oglerc")
  CONFIG_FILE="${ac_default_prefix}/share/ogle/oglerc"
  CONFIG_FILE_DTD="${ac_default_prefix}/share/ogle/ogle_conf.dtd"
else
  AC_DEFINE_UNQUOTED(CONFIG_FILE, "${prefix}/share/ogle/oglerc")
  CONFIG_FILE="${prefix}/share/ogle/oglerc"
  CONFIG_FILE_DTD="${prefix}/share/ogle/ogle_conf.dtd"
fi

AC_SUBST(CONFIG_FILE)
AC_SUBST(CONFIG_FILE_DTD)

case $host_os in
solaris*)
	DEFAULT_DVD_DEVICE="/cdrom/cdrom0"
	;;
linux*)
	DEFAULT_DVD_DEVICE="/dev/dvd"
	;;
freebsd*)
	DEFAULT_DVD_DEVICE="/dev/acd0c"
	;;
netbsd*)
  	case "$host_cpu" in
   	i?86)
		DEFAULT_DVD_DEVICE="/dev/rcd0d"
		;;
   	*)
		DEFAULT_DVD_DEVICE="/dev/rcd0c"
		;;
  	esac
  	;;
openbsd*)
	DEFAULT_DVD_DEVICE="/dev/rcd0c"
	;;
bsdi*)
	DEFAULT_DVD_DEVICE="/dev/sr0c"
	;;
hpux*)
	DEFAULT_DVD_DEVICE="/dev/dvd"
	;;
*)
	DEFAULT_DVD_DEVICE=""
	;;
esac


AC_SUBST(DEFAULT_DVD_DEVICE)
AC_SUBST(DEFAULT_AUDIO_DEVICE)
AC_SUBST(DEFAULT_AUDIO_DRIVER)

dnl ---------------------------------------------------------
dnl end config file
dnl ---------------------------------------------------------




dnl ---------------------------------------------------------
dnl Compiler specific stuff
dnl ---------------------------------------------------------

if test "x$GCC" = xyes; then
  CFLAGS="$CFLAGS -Wall"
else
    dnl non-GCC flags - we probably need exact configuration triplets here.
    case "$host" in
    sparc-sun-solaris*)
	O_CFLAGS="-xCC -fast"
	dnl The pragma pack(0) parts are not sticky, so we need to give this
	dnl 'noalign' flag to cc for parts that access the ifo and nav structs.
	DVDREAD_ALIGN_CFLAGS="-xmemalign"
    ;;
    alpha*)
        dnl Compaq cc
        O_CFLAGS="-fast"
    esac
fi

dnl ---------------------------------------------------------
dnl end Compiler specific stuff
dnl ---------------------------------------------------------


dnl ---------------------------------------------------------
dnl Architecture specific stuff
dnl ---------------------------------------------------------

USE_MMX=
USE_ALTIVEC=
USE_SPARCASM=
case "$host_cpu" in
i?86)
	if test "x$GCC" = xyes; then
	  O_CFLAGS="$O_CFLAGS -fomit-frame-pointer -funroll-loops"
dnl Do we need this ? should we hard code it to pentium/pentiumpro?
dnl what about k6 / athlon
dnl will it still assemble the mmx instructions when -march=i386
dnl	  CFLAGS="$CFLAGS -march=$host_cpu"
	  XCFLAGS="$CFLAGS -march=i586 -mcpu=pentiumpro"
	fi
	USE_MMX=yes
	;;
sparc)
	if test "x$GCC" = xyes; then
dnl	  O_CFLAGS="$CFLAGS -mcpu=ultrasparc -mvis"
dnl	  AC_DEFINE([USE_SPARCASM],1,[use assembler routines])
dnl	  USE_SPARCASM=yes
	  :
	fi
	;;
powerpc|ppc)
	if test "x$GCC" = xyes; then
	  O_CFLAGS="$O_CFLAGS -fomit-frame-pointer -funroll-loops"
dnl is the right? needed? use just -m7400 ? need new gcc for that..
dnl is there a -mcpu -march flag that we should use?
dnl should be a try compile on this line.. 
	  XCFLAGS="-Wa,-m7400"
dnl that sets USE_ALTIVEC depending on the success
	  USE_ALTIVEC=yes
	fi
        ;;
alphaev6|alphaev67|alphaev68|alphaev7)
	if test "x$GCC" = xyes; then
	  O_CFLAGS="$O_CFLAGS -mcpu=ev6"
        else  dnl Probably compaq cc
          O_CFLAGS="$O_CFLAGS -mcpu=ev6"
	fi
esac

AC_ARG_ENABLE(altivec, 
  [  --disable-altivec       disable the use of Altivec (G4+)],
  [if test "x$enableval" != xyes; then
    USE_ALTIVEC=
   fi])
if test "x$USE_ALTIVEC" = xyes; then
  AC_DEFINE([HAVE_ALTIVEC],1,[Processor support ALTIVEC])
  BUILD_ALTIVEC=1
  CFLAGS="$XCFLAGS $CFLAGS"
fi

AC_ARG_ENABLE(mmx, 
  [  --disable-mmx           disable the use of MMX (x86)],
  [if test "x$enableval" != xyes; then
     USE_MMX=
   fi])
if test "x$USE_MMX" = xyes; then
  AC_DEFINE([HAVE_MMX],1,[Processor support MMX])
  BUILD_MMX=1
  CFLAGS="$CFLAGS $XCFLAGS"
fi
BUILDINFO="`uname -m -r -s -v`"
BUILDINFO="${BUILDINFO} `uname -p` `date`"
BUILDINFO="${BUILDINFO}${BUILD_MMX:+ mmx}${BUILD_ALTIVEC:+ Altivec}"
BUILDINFO="${BUILDINFO}${BUILD_MLIB:+ mlib}${BUILD_XV:+ Xv}"
BUILDINFO="${BUILDINFO}${BUILD_AUDIO_OSS:+ oss}${BUILD_AUDIO_ALSA:+ alsa}"
BUILDINFO="${BUILDINFO}${BUILD_AUDIO_SOLARIS:+ solaris}${BUILD_AUDIO_OBSD:+ obsd}"

CCASFLAGS="$O_CFLAGS $CFLAGS"
ifdef([AM_PROG_AS],[AM_PROG_AS],[])

AC_SUBST(O_CFLAGS)
AC_SUBST(BUILDINFO)
AC_SUBST(USE_MMX)
AM_CONDITIONAL(USE_MMX, [test "x$USE_MMX" = xyes])
AC_SUBST(USE_ALTIVEC)
AM_CONDITIONAL(USE_ALTIVEC, [test "x$USE_ALTIVEC" = xyes])
AC_SUBST(USE_SPARCASM)
AM_CONDITIONAL(USE_SPARCASM, [test "x$USE_SPARCASM" = xyes])

dnl ---------------------------------------------------------
dnl end Architecture specific stuff
dnl ---------------------------------------------------------

TOP_INCLUDES='-I$(top_srcdir) -I$(top_srcdir)/include'
AC_SUBST(TOP_INCLUDES)


AC_OUTPUT(Makefile 
ogle/Makefile 
include/Makefile 
common/Makefile 
ctrl/Makefile 
ac3/Makefile 
libogleao/Makefile 
mpeg2_video/Makefile 
vmg/Makefile 
mpeg2_program/Makefile 
scripts/Makefile
scripts/ogle
doc/Makefile
doc/man/Makefile
doc/man/oglerc.5
doc/man/ogle.1
dvd_cli/Makefile
oglerc)

echo "------------------------------------------------------"
echo "Going to build with the following configuration:"

if test "x$prefix" != xNONE; then
  echo "  prefix: $prefix"
else
  echo "  prefix: $ac_default_prefix"
fi  

echo ""

if test "x$BUILD_MMX" = x1; then
   echo "  mmx:           Yes"
else
   echo "  mmx:           No"
fi

if test "x$BUILD_ALTIVEC" = x1; then
   echo "  altivec:       Yes"
else
   echo "  altivec:       No"
fi

if test "x$BUILD_MLIB" = x1; then
   echo "  mlib:          Yes"
else
   echo "  mlib:          No"
fi

if test "x$BUILD_XV" = x1; then
   echo "  Xv:            Yes"
else
   echo "  Xv:            No"
fi

if test "x$BUILD_AUDIO_OSS" = x1; then
   echo "  oss audio:     Yes"
else
   echo "  oss audio:     No"
fi

if test "x$BUILD_AUDIO_ALSA" = x1; then
   echo "  alsa audio:    Yes"
else
   echo "  alsa audio:    No"
fi

if test "x$BUILD_AUDIO_SOLARIS" = x1; then
   echo "  solaris audio: Yes"
else
   echo "  solaris audio: No"
fi

if test "x$BUILD_AUDIO_OBSD" = x1; then
   echo "  obsd audio:    Yes"
else
   echo "  obsd audio:    No"
fi