~ubuntu-branches/ubuntu/wily/alsaplayer/wily

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
dnl Process this file with autoconf to produce a configure script.

AC_INIT(alsaplayer)

ALSAPLAYER_MAJOR_VERSION=0
ALSAPLAYER_MINOR_VERSION=99
ALSAPLAYER_MICRO_VERSION=81

BETA=

ALSAPLAYER_VERSION=$ALSAPLAYER_MAJOR_VERSION.$ALSAPLAYER_MINOR_VERSION.${ALSAPLAYER_MICRO_VERSION}${BETA}

AM_INIT_AUTOMAKE(alsaplayer, ${ALSAPLAYER_VERSION})
AM_MAINTAINER_MODE

dnl =======================================================
dnl alsaplayer control variables and their default values
dnl this config procedure shamelessly stolen from libmikmod
dnl =======================================================

have_gtk2=no
have_glib=no
have_opengl=no
have_audiofile=no
have_oggvorbis=no
have_flac=no
have_libFLAC_113=no
have_oggflac=no
have_alsa_05x=no
have_alsa_final=no
have_oss=no
have_esd=no
have_sparc=no
have_sgi=no
have_nas=no
have_mikmod=no
have_jack=no
have_xosd=no
dynload=no
use_3dnow_asm=no
have_libmad=no
use_libid3tag=no
can_systray=no
have_systray=no

if test "x$x_includes" = "xNONE"
then
    x_includes=/usr/X11R6/include
fi
if test "x$x_libraries" = "xNONE"
then
   x_libraries=/usr/X11R6/lib
fi

dnl Check for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_INSTALL
AC_GNU_SOURCE
AM_GNU_GETTEXT
AC_PROG_LN_S
dnl static libs make no sense for alsaplayer
AM_DISABLE_STATIC
AM_PROG_LIBTOOL
AM_PROG_CC_C_O
AC_PROG_MAKE_SET
AM_PATH_LIBMIKMOD(3.1.7, have_mikmod=yes, have_mikmod=no)
AM_PATH_OGG(have_ogg=yes, have_ogg=no)
AM_PATH_VORBIS(have_vorbis=yes, have_vorbis=no)
AM_PATH_AUDIOFILE(0.1.7, have_audiofile=yes, have_audiofile=no)
AC_CHECK_LIB(audiofile, afOpenFile,
	[have_audiofile=yes
	AUDIOFILE_CFLAGS=""
	AUDIOFILE_LIBS="-laudiofile"
	AC_SUBST(AUDIOFILE_CFLAGS)
	AC_SUBST(AUDIOFILE_LIBS)
	], )
AC_HEADER_STDC

dnl ======================
dnl PKGCONFIG preparations
dnl ======================

if test -z $PKG_CONFIG_PATH; then
	PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
fi

export PKG_CONFIG_PATH


dnl ===============
dnl Debugging stuff
dnl ===============

AC_ARG_ENABLE(debug, 
[  --enable-debug          Enable debugging (default=no)],, enable_debug=no)

if test "$enable_debug" = yes; then
DFLAGS="$DFLAGS -g"
fi


AC_ARG_ENABLE(profiling,
[  --enable-profiling      Enable profiling (-pg)],, enable_profiling=no)

if test "$enable_profiling" = yes; then
DFLAGS="$DFLAGS -pg"
fi


AC_SUBST(DFLAGS)


dnl =========
dnl NLS stuff
dnl =========

AC_ARG_ENABLE(nls,
[  --enable-nls            Enabled NLS support (default=yes)],, enable_nls=no)

if test "$enable_nls" = yes; then
echo NLS support use gettext
fi


dnl ======
dnl OpenGL
dnl ======

AC_ARG_ENABLE(opengl,
[  --enable-opengl         Enable OpenGL plugins (default=yes)],,
	enable_opengl=yes)

if test "x$enable_opengl" = xyes; then
	LIBS_save=$LIBS
	OPENGL_LIBS=error
	AC_CHECK_LIB(GL, glBegin, OPENGL_LIBS="-lGL -lpthread")
	
	if test "x$OPENGL_LIBS" = xerror; then
		AC_CHECK_LIB(MesaGL, glBegin, OPENGL_LIBS="-lMesaGL -lpthread")
	fi

	have_opengl_headers=yes
	AC_CHECK_HEADERS(GL/gl.h GL/glx.h,,have_opengl_headers=no)

	if test "x$OPENGL_LIBS" = xerror || test "x$have_opengl_headers" = xno; then
		have_opengl=no
	else
		have_opengl=yes
	fi	

	LIBS=$LIBS_save
else
	AC_MSG_RESULT([*** Disabling OpenGL plugins per user request ***])
	have_opengl=no
fi

AC_SUBST(OPENGL_LIBS)
AM_CONDITIONAL(HAVE_OPENGL, test "x$have_opengl" = xyes)

dnl ================
dnl Some input stuff
dnl ================
if test "$have_glib" = "no"
then
	have_gtk2=no
fi

if test "$have_ogg" = "yes"
then
	if test "$have_vorbis" = "yes"
	then
		have_oggvorbis=yes
	else
		have_oggvorbis=no
	fi
else
	have_oggvorbis=no
fi

AC_ARG_ENABLE(mikmod,
[  --enable-mikmod         Enable Mikmod plugin (default=yes)],
[if test "$enableval" = "no"
then
	if test "$have_mikmod" = "yes"
	then
		have_mikmod=no
	fi
fi])


AC_ARG_ENABLE(oggvorbis,
[  --enable-oggvorbis      Enable Ogg Vorbis plugin (default=yes)],
[if test "$enableval" = "no"
then
	if test "$have_oggvorbis" = "yes"
	then 
		have_oggvorbis=no
	fi	
fi])

AM_CONDITIONAL(HAVE_OGGVORBIS,test "$have_oggvorbis" = "yes")

audiofile_enable=no

AC_ARG_ENABLE(audiofile,
[  --enable-audiofile      Enable Audiofile plugin (default=no)],
[if test "$enableval" = "yes"
then
	if test "$have_audiofile" = "yes"
	then
		audiofile_enable=yes
	fi	
fi])


if test "$audiofile_enable" = "yes"
then
	have_audiofile=yes
else
	have_audiofile=no
fi


dnl ============
dnl flac library
dnl ============

AC_CHECK_LIB(FLAC, FLAC__stream_decoder_new,
     FLC_LDADD="-lFLAC -lm"; have_flac=yes; AC_DEFINE(HAVE_LIBFLC, 1, [Define if you have FLAC library (-lFLAC)]), have_flac=no; FLC_LDADD=, -lm)


AC_ARG_ENABLE(flac,
[  --enable-flac           Enable FLAC plugin (default=yes)],
[if test "$enableval" = "no"
then
	if test "$have_flac" = "yes"
	then
		have_flac=no
	fi
fi])

dnl ========================
dnl check for libflac>=1.1.3
dnl ========================

AC_CHECK_LIB(FLAC, [FLAC__stream_decoder_init_ogg_stream],
     have_libFLAC_113=yes, have_libFLAC_113=no)

dnl ===============
dnl OggFLAC library
dnl ===============
if test "$have_libFLAC_113" = "no"
then
	AC_CHECK_LIB(OggFLAC, OggFLAC__stream_decoder_new,
	     OGGFLC_LDADD="-lOggFLAC -logg"; have_oggflac=yes; AC_DEFINE(HAVE_LIBOGGFLC, 1, [Define if you have OggFLAC library (-lOggFLAC)]), have_oggflac=no; OGGFLC_LDADD=, -lOggFLAC -lFLAC -logg -lm)
fi

AC_ARG_ENABLE(oggflac,
[  --enable-oggflac        Enable OggFLAC plugin (default=yes)],
[if test "$enableval" = "no"
then
	if test "$have_oggflac" = "yes"
	then
		have_oggflac=no
	fi
fi])


dnl ===========
dnl MAD library
dnl ===========

AC_CHECK_LIB(mad, mad_stream_init,
     MAD_LDADD=-lmad; have_libmad=yes; AC_DEFINE(HAVE_LIBMAD, 1, [Define if you have MAD library (-lmad)]), have_libmad=no; MAD_LDADD=, -lmad)

AC_ARG_ENABLE(mad,
[  --enable-mad            Enable MAD plugin (default=yes)],
[if test "$enableval" = "no"
then
	if test "$have_libmad" = "yes"
	then
		have_libmad=no
	fi
fi])

dnl ==============
dnl id3tab library
dnl ==============

oldcflags=$CFLAGS
CFLAGS="$CFLAGS -lz"

AC_CHECK_LIB(id3tag, id3_file_open,
     FLC_LDADD="$FLC_LDADD -lid3tag -lz"; use_libid3tag=yes; AC_DEFINE(HAVE_LIBID3TAG, 1, [Define if you have libid3tag library (-lid3tag)]), use_libid3tag=no)
AC_ARG_ENABLE(id3tag,
[  --enable-id3tag         Enable libid3tag support (default=yes)],
[if test "$enableval" = "no"
then
	if test "$use_libid3tag" = "yes"
	then
		use_libid3tag=no
	fi
fi])


CFLAGS=$oldcflags

AC_SUBST(FLC_LDADD)
AC_SUBST(OGGFLC_LDADD)
AC_SUBST(MAD_LDADD)

dnl =================
dnl audiofile library
dnl =================

AM_CONDITIONAL(HAVE_AUDIOFILE,test "x$have_audiofile" = xyes)

dnl ==========
dnl JACK stuff
dnl ==========
PKG_CHECK_MODULES(JACK, jack >= 0.61.0, have_jack=yes, have_jack=no)
AC_SUBST(JACK_LIBS)
AC_SUBST(JACK_CFLAGS)

dnl ==========
dnl XOSD stuff
dnl nb.: by checking for "xosd_create" instead of "xosd_init", we
dnl      implicitely require xosd 2.x instead of 1.x
dnl      (which is exactly what we want)
dnl ==========
AC_CHECK_LIB(xosd, xosd_create,
     XOSD_LDADD=-lxosd; have_xosd=yes; AC_DEFINE(HAVE_LIBXOSD, 1, [Define if you have XOSD library (-lxosd)]), have_xosd=no; XOSD_LDADD=, -lxosd)
AM_CONDITIONAL(HAVE_XOSD, test "x$have_xosd" = xyes)

dnl ==========
dnl glib stuff
dnl ==========

PKG_CHECK_MODULES(GLIB2, glib-2.0, have_glib2=yes, have_glib2=no)
AC_SUBST(GLIB2_LIBS)
AC_SUBST(GLIB2_CFLAGS)

dnl ==========
dnl GTK2 stuff
dnl ==========

PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.8.0 gthread-2.0 >= 2.0.3 pango, have_gtk2=yes, have_gtk2=no)
AC_SUBST(GTK2_LIBS)
AC_SUBST(GTK2_CFLAGS)

dnl ================
dnl GTK2 for systray
dnl ================

PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.10.0 gthread-2.0 >= 2.0.3 pango, can_systray=yes, can_systray=no)

AC_ARG_ENABLE(systray,
[  --enable-systray        Enable SysTray icon (default=no)],,
	enable_systray=no)

if test "x$enable_systray" = xyes;
then
	if test "$can_systray" = "yes"
	then
		have_systray=yes
	else
		have_systray=no
	fi
else
	have_systray=no
fi

AM_CONDITIONAL(HAVE_SYSTRAY,test "x$have_systray" = "xyes")

if test "$enable_systray" = yes; then
    if test "$have_systray" = no; then
    echo Systray support need gtk+>=2.10.n
    else
    echo Experimental systray support will be compiled
    fi
fi

if test "$have_systray" = "yes"
then
		AC_DEFINE(HAVE_SYSTRAY, yes, [Define if we have the systray icon])
fi

dnl ==================
dnl libsndfile library
dnl ==================

have_sndfile=no

PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.4, have_sndfile=yes, have_sndfile=no)
AC_SUBST(SNDFILE_LIBS)
AC_SUBST(SNDFILE_CFLAGS)
AM_CONDITIONAL(HAVE_SNDFILE, test "x$have_sndfile" = xyes)

dnl ===============
dnl POSIX.4 threads
dnl ===============

AC_CHECK_LIB(pthread,pthread_create, ,
AC_MSG_ERROR([** POSIX.4 threads not installed or broken **]))

dnl ======================
dnl Check for header files
dnl ======================

AC_HEADER_STDC
AC_HEADER_DIRENT
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(linux/cdrom.h)
AC_CHECK_HEADERS(sys/soundcard.h)
AC_CHECK_HEADERS(sys/audioio.h)
AC_CHECK_HEADERS(audio/audiolib.h)
AC_CHECK_HEADERS(libintl.h)
AC_CHECK_HEADERS(mad.h)
AC_CHECK_HEADERS(id3tag.h)
AC_CHECK_HEADERS(FLAC/stream_decoder.h)
AC_CHECK_HEADERS(OggFLAC/stream_decoder.h)

dnl ==========
dnl ALSA stuff
dnl ==========


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==5
AP_maGiC_VALUE
#endif
#endif
],
have_alsa_05x=yes
ALSA_LIB="-lasound"
AC_MSG_RESULT([found 0.5.x]),
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
ALSA_LIB="-lasound"
AC_MSG_RESULT([found latest])
)
)


dnl =========
dnl ESD stuff
dnl =========

AM_PATH_ESD(0.2.4, have_esd=yes, have_esd=no)

dnl ===========
dnl SPARC stuff
dnl ===========

if test "$ac_cv_header_sys_audioio_h" = "yes"
then
	have_sparc=yes
else
	have_sparc=no
fi


dnl =========
dnl OSS stuff
dnl =========

if test "$ac_cv_header_sys_soundcard_h" = "yes"
then
	have_oss=yes
else
	have_oss=no
fi

dnl =========
dnl SGI stuff
dnl =========

AC_CHECK_LIB(audio, alOpenPort,
[have_sgi=yes
SGI_LIBS=-laudio],
have_sgi=no)

AC_SUBST(SGI_LIBS)

dnl =========
dnl NAS stuff
dnl =========

oldcflags=$CFLAGS
CFLAGS="$CFLAGS -I$x_includes -L$x_libraries -lXt"
AC_CHECK_LIB(audio,AuStartFlow, [have_nas=yes NAS_LIB="-L$x_libraries -laudio -lXt"], have_nas=no)
CFLAGS=$oldcflags
AC_SUBST(NAS_LIB)


dnl ======================
dnl JACK conditional stuff
dnl ======================

AC_ARG_ENABLE(jack,[  --enable-jack           Enable jack support (default=yes)],[if test "$enableval" = "no"
then
have_jack=no
fi])


dnl =====================================================
dnl Sound output stuff. This will go away once everything
dnl is really modular
dnl =====================================================

AC_ARG_ENABLE(alsa,
[  --enable-alsa		  Enable ALSA (default=yes)],
[if test "$enableval" = "no"
then
have_alsa=no
fi])

AC_ARG_ENABLE(esd,
[  --enable-esd            Enable esd driver (default=yes)],
[if test "$enableval" = "no"
then
have_esd=no
fi])


AC_ARG_ENABLE(sparc,
[  --enable-sparc          Enable SPARC driver (default=yes)],

[if test "$enableval" = "no"
then
have_sparc=no
fi])


AC_ARG_ENABLE(oss,
[  --enable-oss            Enable OSS driver (default=yes)],
[if test "$enableval" = "no"
then
have_oss=no
fi])


AC_ARG_ENABLE(sgi,
[  --enable-sgi            Enable SGI driver (default=yes)],
[if test "$enableval" = "no"
then
have_sgi=no
fi])

AC_ARG_ENABLE(gtk2,
[  --enable-gtk2           Enable GTK2 graphical interface (default=yes)],
[if test "$enableval" = "no"
then
have_gtk2=no
fi])

AC_ARG_ENABLE(nas,
[  --enable-nas            Enable NAS driver (default=yes)],
[if test "$enableval" = "no"
then
have_nas=no
fi])

if test "x$ac_cv_header_mad_h" = "xno"
then
	have_libmad=no
fi	

if test "x$ac_cv_header_id3tag_h" = "xno"
then
	use_libid3tag=no
fi	


dnl =======
dnl DOXYGEN
dnl =======
AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
if test $HAVE_DOXYGEN = "false"; then
	AC_MSG_WARN([*** doxygen not found, docs will not be built])
fi


AM_CONDITIONAL(HAVE_DOXYGEN, $HAVE_DOXYGEN)
AM_CONDITIONAL(HAVE_LIBMAD,test "x$have_libmad" = xyes)
AM_CONDITIONAL(USE_LIBID3TAG, test "x$use_libid3tag" = xyes)
AM_CONDITIONAL(HAVE_FLC, test "x$have_flac" = xyes)
AM_CONDITIONAL(HAVE_OGGFLC, test "x$have_oggflac" = xyes)
AM_CONDITIONAL(HAVE_JACK,	test "x$have_jack" = xyes)
AM_CONDITIONAL(HAVE_ALSA_05X, test "x$have_alsa_05x" = xyes)
AM_CONDITIONAL(HAVE_ALSA_FINAL, test "x$have_alsa_final" = xyes)
AM_CONDITIONAL(HAVE_OSS, test "x$have_oss" = xyes)
AM_CONDITIONAL(HAVE_ESD, test "x$have_esd" = xyes)
AM_CONDITIONAL(HAVE_SPARC, test "x$have_sparc" = xyes)
AM_CONDITIONAL(HAVE_SGI, test "x$have_sgi" = xyes)
AM_CONDITIONAL(HAVE_NAS, test "x$have_nas" = xyes)
AM_CONDITIONAL(HAVE_LINUX_CDROM,test "x$ac_cv_header_linux_cdrom_h" = xyes)
AM_CONDITIONAL(HAVE_GLIB2, test "x$have_glib2" = xyes)
AM_CONDITIONAL(HAVE_GTK2, test "x$have_gtk2" = xyes)
AM_CONDITIONAL(HAVE_MIKMOD,test "x$have_mikmod" = xyes)
AM_CONDITIONAL(HAVE_SYSTRAY,test "x$have_systray" = xyes)


dnl ============
dnl Machine type
dnl ============

AC_MSG_CHECKING(machine architecture)
AC_SUBST(ARCH_TYPE)
ARCH_TYPE=`uname -m`
AC_MSG_RESULT($ARCH_TYPE)

AM_CONDITIONAL(ARCH_X86,test "$ARCH_TYPE" = "i486" || test "$ARCH_TYPE" = "i586" || test "$ARCH_TYPE" = "i686" )
AM_CONDITIONAL(ARCH_486,test "$ARCH_TYPE" = "i486")
AM_CONDITIONAL(ARCH_586,test "$ARCH_TYPE" = "i586")
AM_CONDITIONAL(ARCH_686,test "$ARCH_TYPE" = "i686")
AM_CONDITIONAL(ARCH_PPC,test "$ARCH_TYPE" = "ppc")
AM_CONDITIONAL(ARCH_ULTRA,test "$ARCH_TYPE" = "sun4u")
dnl cruft to satisfy gtk2's Makefile. Leave it in for now
AM_CONDITIONAL(BUILD_EXTERNAL, test "a" = "b")

AC_MSG_CHECKING(for gcc optimization flags)
old_cflags=$CFLAGS
CFLAGS="$CFLAGS -O2 -funroll-loops -finline-functions -ffast-math -Wall"
AC_TRY_COMPILE([#include <stdio.h>],
[ printf ("hello, world"); ],
[ EXTRA_OPT_CFLAGS="$CFLAGS -O2 -funroll-loops -finline-functions -ffast-math -Wall"],[ EXTRA_OPT_CFLAGS=""])
CFLAGS=$old_cflags
AC_MSG_RESULT([$EXTRA_OPT_CFLAGS])

ARCH_CFLAGS="$EXTRA_OPT_CFLAGS"

if test "$ARCH_TYPE" = "i486" || test "$ARCH_TYPE" = "i586" || test "$ARCH_TYPE" = "i686"
then
	AC_DEFINE(ARCH_X86, 1, [Define if on x86 platform])
fi

if test "$ARCH_TYPE" = "i486"
then
        AC_DEFINE(ARCH_486, 1, [Define if on a 486 platform])
fi

if test "$ARCH_TYPE" = "i586"
then
        AC_DEFINE(ARCH_586, 1, [Define if on a 586 platform])
fi

if test "$ARCH_TYPE" = "i686"
then
        AC_DEFINE(ARCH_686, 1, [Define if on a 686 platform])
#		EXTRA_CPU_CFLAGS=$(if $CC -march=i686 -S -o /dev/null -xc /dev/null > /dev/null; then echo "-march=i686"; fi)
fi

if test "$ARCH_TYPE" = "ppc"
then
		AC_DEFINE(ARCH_PPC, 1, [Define if on a PPC platform])
fi

if test "$ARCH_TYPE" = "sun4u"
then
		AC_DEFINE(ARCH_ULTRA, 1, [Define if on a SUN ULTRA platform])
fi

if test "$have_glib2" = "yes"
then
		AC_DEFINE(HAVE_GLIB2, 1, [Define if we have glib2])
fi

if test "$have_gtk2" = "yes"
then
		AC_DEFINE(HAVE_GTK2, 1, [Define if we have gtk2])
fi

dnl ================================================================
dnl Special assembly options. Note: Need to fix the above arch code!
dnl ================================================================

dnl AC_CANONICAL_HOST
AM_CONFIG_HEADER(config.h)

case "$host" in
	i?86-* | k?-* | athlon-*) dnl catch i386,i486,i586,i686,k6,k7
		AC_DEFINE(FPM_INTEL, 1, [Define if we are on Intel])
	;;	
	*-*)
		echo "host_alias = $host_alias"
		AC_DEFINE(FPM_64BIT, 1, [Use this otherwise])
	;;	
esac

ARCH_CFLAGS="$ARCH_CFLAGS $EXTRA_CPU_CFLAGS"

AC_SUBST(ARCH_CFLAGS)

dnl ============================================================
dnl Check for typedefs, structures, and compiler characteristics
dnl ============================================================

AC_C_CONST
AC_TYPE_SIZE_T


dnl ===========================
dnl Check for library functions
dnl ===========================

AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_CHECK_FUNCS(madvise)
AC_CHECK_FUNCS(strdup strstr)

ADDON_DIR=${libdir}/$PACKAGE

dnl ================
dnl Create Makefiles
dnl ================

AC_SUBST(ARCH_CFLAGS)
AC_SUBST(ALSA_LIB)
AC_SUBST(ADDON_DIR)
AC_SUBST(AS)
AC_SUBST(ASFLAGS)

AC_SUBST(ALSAPLAYER_MAJOR_VERSION)
AC_SUBST(ALSAPLAYER_MINOR_VERSION)
AC_SUBST(ALSAPLAYER_MICRO_VERSION)
AC_SUBST(ALSAPLAYER_VERSION)

AC_OUTPUT([ intl/Makefile po/Makefile.in
Makefile
alsaplayer.1
alsaplayer.pc
alsaplayer.spec
app/Makefile
interface/Makefile
interface/gtk2/Makefile
interface/gtk2/pixmaps/Makefile
interface/text/Makefile
interface/daemon/Makefile
interface/xosd/Makefile
scopes2/Makefile
scopes2/monoscope/Makefile
scopes2/levelmeter/Makefile
scopes2/spacescope/Makefile
scopes2/logbarfft/Makefile
scopes2/synaescope/Makefile
scopes2/blurscope/Makefile
scopes2/opengl_spectrum/Makefile
output/Makefile
output/alsa-0.5.x/Makefile
output/alsa-final/Makefile
output/jack/Makefile
output/oss/Makefile
output/esound/Makefile
output/sgi/Makefile
output/sparc/Makefile
output/null/Makefile
output/nas/Makefile
input/Makefile
input/mad/Makefile
input/cdda/Makefile
input/mikmod/Makefile
input/wav/Makefile
input/vorbis/Makefile
input/audiofile/Makefile
input/flac/Makefile
input/sndfile/Makefile
reader/Makefile
reader/file/Makefile
reader/http/Makefile
alsaplayer/Makefile
libalsaplayer/Makefile
extra/Makefile
examples/Makefile
m4/Makefile
docs/Makefile
docs/reference.doxygen
])

echo "
Configuration:
  
  Install path:                       ${prefix}
  Use libmad shared library:          ${have_libmad}
  Enable libid3tag support:           ${use_libid3tag}
  Build GTK2 interface:               ${have_gtk2}
  Build XOSD interface:               ${have_xosd}
  Build OpenGL based visual plugins:  ${have_opengl}
  Build alsa 0.5.x output plugin:     ${have_alsa_05x}
  Build alsa 0.9.x output plugin:     ${have_alsa_final}
  Build jack output plugin:           ${have_jack}
  Build oss output plugin:            ${have_oss}
  Build esound output plugin:         ${have_esd}
  Build sparc output plugin:          ${have_sparc}
  Build sgi output plugin:            ${have_sgi}
  Build nas output plugin:            ${have_nas}
  Build vorbis input plugin:          ${have_oggvorbis}
  Build cdda input plugin:            ${ac_cv_header_linux_cdrom_h}
  Build mikmod input plugin:          ${have_mikmod}
  Build audiofile input plugin:       ${have_audiofile}
  Build FLAC input plugin:            ${have_flac}
  Included OggFLAC input plugin:      ${have_libFLAC_113}
  Separated OggFLAC input plugin:     ${have_oggflac}
  Build sndfile input plugin:         ${have_sndfile}
  Build systray icon:                 ${have_systray}"
echo

if test $have_jack = "no" -a $have_sparc = "no" -a $have_alsa_05x = "no" -a $have_alsa_final = "no" -a $have_oss = "no" -a $have_esd = "no" -a $have_sgi = "no" -a $have_nas = "no"
then
echo "
**WARNING**: NO OUTPUT MODULES selected. AlsaPlayer won't be
**WARNING**: able to produce sound output unless you manually
**WARNING**: add output modules to:
**WARNING**: ${prefix}/alsaplayer/output/"
echo
fi

echo Now type \'make\' to build AlsaPlayer.