forked from rbrito/deprecated-lame-mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
1176 lines (1028 loc) · 31.6 KB
/
configure.in
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
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl $Id$
dnl
dnl
dnl don't forget to set ASM_FOR_ARCH to a space delimited list of
dnl processor architectures, for which assembler routines exist
dnl
dnl
dnl Exported and configured variables:
dnl CC
dnl CFLAGS
dnl LDFLAGS
dnl LDADD
dnl NASM
dnl extra vars for frontend:
dnl FRONTEND_LDFLAGS
dnl FRONTEND_CFLAGS
dnl FRONTEND_LDADD
AC_PREREQ(2.68)
AC_INIT([lame],[3.100],[[email protected]])
AC_CONFIG_SRCDIR([libmp3lame/lame.c])
AC_LANG([C])
dnl check system
AC_CANONICAL_HOST
dnl automake
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])
AH_TOP([
#ifndef LAME_CONFIG_H
#define LAME_CONFIG_H
])
AH_BOTTOM([#endif /* LAME_CONFIG_H */])
AM_MAINTAINER_MODE
AM_MAKE_INCLUDE
dnl check environment
AC_AIX
AC_ISC_POSIX
AC_MINIX
case $host_os in
*cygwin* ) CYGWIN=yes;;
* ) CYGWIN=no;;
esac
dnl libtool
# AC_DISABLE_SHARED
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
CFLAGS="${ac_save_CFLAGS}"
# increase this when the shared lib becomes totally incompatible
LIB_MAJOR_VERSION=0
# increase this when changes are made, but they are upward compatible
# to previous versions
LIB_MINOR_VERSION=0
dnl # work around for a bug, don't know where it is exactly
if test "${ac_cv_cygwin}" = "yes"; then
if test "${CC}" != "gcc"; then
AC_MSG_ERROR([Please use]
[ CC=gcc ./configure]
[Abort this configure run and add "CC=gcc" or you will]
[see errors and no lame.exe will be build.])
fi
fi
dnl check programs
AC_PROG_CC()
if test "${GCC}" = "yes"; then
AC_MSG_CHECKING(version of GCC)
GCC_version=`${CC} --version | sed -n '1s/^[[^ ]]* (.*) //;s/ .*$//;1p'`
AC_MSG_RESULT(${GCC_version})
fi
AC_CHECK_HEADER(dmalloc.h)
if test "${ac_cv_header_dmalloc_h}" = "yes"; then
AM_WITH_DMALLOC
fi
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS( \
errno.h \
fcntl.h \
limits.h \
stdint.h \
string.h \
sys/soundcard.h \
sys/time.h \
unistd.h \
xmmintrin.h \
linux/soundcard.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
if test ${cross_compiling} = "no"; then
AC_C_BIGENDIAN
fi
AC_SYS_LARGEFILE
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(unsigned short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
if test $ac_cv_sizeof_short -eq 0 \
-o $ac_cv_sizeof_unsigned_short -eq 0 \
-o $ac_cv_sizeof_int -eq 0 \
-o $ac_cv_sizeof_unsigned_int -eq 0 \
-o $ac_cv_sizeof_long -eq 0 \
-o $ac_cv_sizeof_unsigned_long -eq 0 \
-o $ac_cv_sizeof_long_long -eq 0 \
-o $ac_cv_sizeof_unsigned_long_long -eq 0 \
-o $ac_cv_sizeof_float -eq 0 \
-o $ac_cv_sizeof_double -eq 0; then
echo '*** I have a problem determining the size of some variable types. Either'
echo '*** you compiler is broken, or your system+compiler combination is not'
echo '*** supportet by the "autoconf" framework we use to generate this'
echo '*** configure script.'
exit 1
fi
AC_C_LONG_DOUBLE
if test "${ac_cv_c_have_long_double}" = "yes" ; then
AC_CHECK_SIZEOF(long double)
fi
AC_CHECK_TYPES([uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t])
AH_VERBATIM([HAVE_UINT8_T],
[/* add uint8_t type */
#undef HAVE_UINT8_T
#ifndef HAVE_UINT8_T
typedef unsigned char uint8_t;
#endif])
AH_VERBATIM([HAVE_INT8_T],
[/* add int8_t type */
#undef HAVE_INT8_T
#ifndef HAVE_INT8_T
typedef char int8_t;
#endif])
AH_VERBATIM([HAVE_UINT16_T],
[/* add uint16_t type */
#undef HAVE_UINT16_T
#ifndef HAVE_UINT16_T
typedef unsigned short uint16_t;
#endif])
AH_VERBATIM([HAVE_INT16_T],
[/* add int16_t type */
#undef HAVE_INT16_T
#ifndef HAVE_INT16_T
typedef short int16_t;
#endif])
if test "${HAVE_INT32_T}" = yes; then
AC_DEFINE(A_UINT32_T,unsigned int32_t)
else
if test "${ac_cv_sizeof_unsigned_short}" = "4"; then
AC_DEFINE(A_UINT32_T,unsigned short)
else
if test "${ac_cv_sizeof_unsigned_int}" = "4"; then
AC_DEFINE(A_UINT32_T,unsigned int)
else
if test "${ac_cv_sizeof_unsigned_long}" = "4"; then
AC_DEFINE(A_UINT32_T,unsigned long)
else
AC_MSG_ERROR([CHECK_TYPE_uint32_t - please report to [email protected]])
fi
fi
fi
fi
AH_VERBATIM([HAVE_UINT32_T],
[/* add uint32_t type */
#undef HAVE_UINT32_T
#ifndef HAVE_UINT32_T
#undef A_UINT32_T
typedef A_UINT32_T uint32_t;
#endif])
if test "${ac_cv_sizeof_short}" = "4"; then
AC_DEFINE(A_INT32_T,short)
else
if test "${ac_cv_sizeof_int}" = "4"; then
AC_DEFINE(A_INT32_T,int)
else
if test "${ac_cv_sizeof_long}" = "4"; then
AC_DEFINE(A_INT32_T,long)
else
AC_MSG_ERROR([CHECK_TYPE_int32_t - please report to [email protected]])
fi
fi
fi
AH_VERBATIM([HAVE_INT32_T],
[/* add int32_t type */
#undef HAVE_INT32_T
#ifndef HAVE_INT32_T
#undef A_INT32_T
typedef A_INT32_T int32_t;
#endif])
if test "${HAVE_INT64_T}" = yes; then
AC_DEFINE(A_UINT64_T,unsigned int64_t)
else
if test "${ac_cv_sizeof_unsigned_int}" = "8"; then
AC_DEFINE(A_UINT64_T,unsigned int)
else
if test "${ac_cv_sizeof_unsigned_long}" = "8"; then
AC_DEFINE(A_UINT64_T,unsigned long)
else
if test "${ac_cv_sizeof_unsigned_long_long}" = "8"; then
AC_DEFINE(A_UINT64_T,unsigned long long)
else
AC_MSG_ERROR([CHECK_TYPE_uint64_t - please report to [email protected]])
fi
fi
fi
fi
AH_VERBATIM([HAVE_UINT64_T],
[/* add uint64_t type */
#undef HAVE_UINT64_T
#ifndef HAVE_UINT64_T
#undef A_UINT64_T
typedef A_UINT64_T uint64_t;
#endif])
if test "${ac_cv_sizeof_int}" = "8"; then
AC_DEFINE(A_INT64_T,int)
else
if test "${ac_cv_sizeof_long}" = "8"; then
AC_DEFINE(A_INT64_T,long)
else
if test "${ac_cv_sizeof_long_long}" = "8"; then
AC_DEFINE(A_INT64_T,long long)
else
AC_MSG_ERROR([CHECK_TYPE_int64_t - please report to [email protected]])
fi
fi
fi
AH_VERBATIM([HAVE_INT64_T],
[/* add int64_t type */
#undef HAVE_INT64_T
#ifndef HAVE_INT64_T
#undef A_INT64_T
typedef A_INT64_T int64_t;
#endif])
alex_IEEE854_FLOAT80
if test "${alex_cv_ieee854_float80}" = "yes" ; then
if test "${ac_cv_c_long_double}" = "yes" ; then
AC_CHECK_TYPES(ieee854_float80_t, long double)
AH_VERBATIM([HAVE_IEEE854_FLOAT80_T],
[/* add ieee854_float80_t type */
#undef HAVE_IEEE854_FLOAT80_T
#ifndef HAVE_IEEE854_FLOAT80_T
typedef long double ieee854_float80_t;
#endif])
AC_DEFINE(HAVE_IEEE854_FLOAT80, 1, [system has 80 bit floats])
fi
fi
AC_CHECK_TYPES([ieee754_float64_t, ieee754_float32_t])
AH_VERBATIM([HAVE_IEEE754_FLOAT64_T],
[/* add ieee754_float64_t type */
#undef HAVE_IEEE754_FLOAT64_T
#ifndef HAVE_IEEE754_FLOAT64_T
typedef double ieee754_float64_t;
#endif])
AH_VERBATIM([HAVE_IEEE754_FLOAT32_T],
[/* add ieee754_float32_t type */
#undef HAVE_IEEE754_FLOAT32_T
#ifndef HAVE_IEEE754_FLOAT32_T
typedef float ieee754_float32_t;
#endif])
AC_DEFINE(LAME_LIBRARY_BUILD, 1, [requested by Frank, seems to be temporary needed for a smooth transition])
if test ${cross_compiling} = "yes"; then
AC_MSG_WARN([]
[**************************************************************************]
[* *]
[* You are cross compiling: *]
[* - I did not have a change to determine *]
[* + the size of: *]
[* - short *]
[* - unsigned short *]
[* - int *]
[* - unsigned int *]
[* - long *]
[* - unsigned long *]
[* - float *]
[* - double *]
[* - long double *]
[* + the endianess of the system *]
[* - You have to provide appropriate defines for them in config.h, e.g. *]
[* + define SIZEOF_SHORT to 2 if the size of a short is 2 *]
[* + define WORDS_BIGENDIAN if your system is a big endian system *]
[* *]
[**************************************************************************])
fi
AC_TYPE_SIZE_T
AC_HEADER_TIME
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(gettimeofday strtol)
if test "X${ac_cv_func_strtol}" != "Xyes"; then
AC_MSG_ERROR([function strtol is mandatory])
fi
dnl Check if we are on a mingw system, which needs libwsock32
SOCKETFUNCTION=unknown
AC_CHECK_FUNCS(socket)
if test $ac_cv_func_socket = no; then
# maybe it is in libsocket
AC_CHECK_LIB(socket, socket, [AC_DEFINE(HAVE_SOCKET)
LIBS="$LIBS -lsocket"])
if test "X${ac_cv_lib_socket_socket}" != "Xyes"; then
SOCKETFUNCTION=NO
else
case ${host_os} in
*solaris*)
LIBS="$LIBS -lnsl"
;;
esac
fi
fi
dnl Initialize configuration variables for the Makefile
CFLAGS=${CFLAGS}
CONFIG_DEFS=${CONFIG_DEFS}
NASM=
INCLUDES="-I\$(top_srcdir)/include -I\$(srcdir)"
FRONTEND_LDFLAGS=
FRONTEND_CFLAGS=
LIB_SOURCES=
MAKEDEP="-M"
RM_F="rm -f"
AC_ARG_ENABLE(nasm,
[ --enable-nasm Allow the use of nasm if available],
ASM_FOR_ARCH="i386", ASM_FOR_ARCH="")
dnl Checks for libraries.
AC_CHECK_HEADERS(termcap.h)
AC_CHECK_HEADERS(ncurses/termcap.h)
AC_CHECK_LIB(termcap, initscr, HAVE_TERMCAP="termcap")
AC_CHECK_LIB(curses, initscr, HAVE_TERMCAP="curses")
AC_CHECK_LIB(ncurses, initscr, HAVE_TERMCAP="ncurses")
AM_ICONV
dnl math lib
AC_CHECK_LIB(m, cos, USE_LIBM="-lm")
dnl free fast math library
AC_CHECK_LIB(ffm, cos, USE_LIBM="-lffm -lm")
dnl Compaq fast math library.
AC_ARG_ENABLE(cpml,
[ --disable-cpml Do not use Compaq's fast Math Library],
CONFIG_CPML="no", CONFIG_CPML="yes")
if test "${CONFIG_CPML}" = yes; then
AC_CHECK_LIB(cpml, cos, USE_LIBM="-lcpml")
fi
CONFIG_MATH_LIB="${USE_LIBM}"
dnl configure use of features
AM_PATH_GTK(1.2.0, HAVE_GTK="yes", HAVE_GTK="no")
dnl ElectricFence malloc debugging
AC_MSG_CHECKING(use of ElectricFence malloc debugging)
AC_ARG_ENABLE(efence,
[ --enable-efence Use ElectricFence for malloc debugging],
CONFIG_EFENCE="${enableval}", CONFIG_EFENCE="no")
case "${CONFIG_EFENCE}" in
yes)
AC_CHECK_LIB(efence, EF_Print, HAVE_EFENCE="-lefence")
if test "x${HAVE_EFENCE}" != "x-lefence"; then
AC_MSG_RESULT(yes, but libefence not found)
else
LDADD="${LDADD} ${HAVE_EFENCE}"
AC_DEFINE(HAVE_EFENCE, 1, we link against libefence)
AC_MSG_RESULT(${CONFIG_EFENCE})
fi
;;
no)
AC_MSG_RESULT(${CONFIG_EFENCE})
;;
*)
AC_MSG_ERROR(bad value �${CONFIG_EFENCE}� for efence option)
;;
esac
dnl libsndfile
WARNING=
AC_ARG_WITH(fileio,
[ --with-fileio=lame Use lame's internal file io routines [default]]
[ =sndfile Use Erik de Castro Lopo's libsndfile]
[ (no stdin possible currently)],
CONFIG_FILEIO="${withval}", CONFIG_FILEIO="lame")
if test "${CONFIG_FILEIO}" = "sndfile" ; then
PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.2, HAVE_SNDFILE="yes", HAVE_SNDFILE="no")
fi
AC_MSG_CHECKING(use of file io)
if test "${CONFIG_FILEIO}" = "sndfile" ; then
if test "${HAVE_SNDFILE}" = "yes" -o "x${SNDFILE_LIBS}" != "x" \
-o "x${SNDFILE_CFLAGS}" != "x"; then
SNDFILE_LIBS=`echo ${SNDFILE_LIBS}`
SNDFILE_CFLAGS=`echo ${SNDFILE_CFLAGS}`
if test -n "${SNDFILE_LIBS}" ; then
FRONTEND_LDFLAGS="${SNDFILE_LIBS} ${FRONTEND_LDFLAGS}"
fi
FRONTEND_LDADD="-lsndfile ${FRONTEND_LDADD}"
if test -n "${SNDFILE_CFLAGS}" ; then
INCLUDES="${SNDFILE_CFLAGS} ${INCLUDES}"
fi
AC_DEFINE(LIBSNDFILE, 1, set to 1 if you have libsndfile)
else
# default
CONFIG_FILEIO="lame"
WARNING="${WARNING} Could not find any sndfile lib on system."
fi
else
CONFIG_FILEIO="lame"
fi
AC_MSG_RESULT(${CONFIG_FILEIO})
if test "x${WARNING}" != "x" ; then
AC_MSG_WARN($WARNING)
fi
dnl check if we should remove hooks for analyzer code in library
dnl default library must include these hooks
AC_MSG_CHECKING(use of analyzer hooks)
AC_ARG_ENABLE(analyzer-hooks,
[ --disable-analyzer-hooks Exclude analyzer hooks],
CONFIG_ANALYZER="${enableval}", CONFIG_ANALYZER="yes")
case "${CONFIG_ANALYZER}" in
yes)
;;
no)
AC_DEFINE(NOANALYSIS, 1, build without hooks for analyzer)
;;
*)
AC_MSG_ERROR(bad value �${CONFIG_ANALYZER}� for analyzer-hooks option)
;;
esac
AC_MSG_RESULT($CONFIG_ANALYZER)
dnl mpg123 decoder
AC_MSG_CHECKING(use of mpg123 decoder)
AC_ARG_ENABLE(decoder,
[ --disable-decoder Exclude mpg123 decoder],
CONFIG_DECODER="${enableval}", CONFIG_DECODER="yes")
AM_CONDITIONAL(LIB_WITH_DECODER, test "x${CONFIG_DECODER}" = "xyes")
if test "${CONFIG_DECODER}" != "no" ; then
CONFIG_DECODER="yes (Layer 1, 2, 3)"
AC_DEFINE(HAVE_MPGLIB, 1, build with mpglib support)
AC_DEFINE(DECODE_ON_THE_FLY, 1, allow to compute a more accurate replaygain value)
fi
AC_MSG_RESULT($CONFIG_DECODER)
AC_MSG_CHECKING(if the lame frontend should be build)
AC_ARG_ENABLE(frontend,
[ --disable-frontend Do not build the lame executable [default=build]],
WITH_FRONTEND="${enableval}", WITH_FRONTEND=yes)
if test "x${WITH_FRONTEND}" = "xyes"; then
WITH_FRONTEND=lame${ac_exeext}
AC_MSG_RESULT(yes)
else
WITH_FRONTEND=
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(if mp3x is requested)
AC_ARG_ENABLE(mp3x,
[ --enable-mp3x Build GTK frame analyzer [default=no]],
WITH_MP3X="${enableval}", WITH_MP3X=no)
if test "x${WITH_MP3X}" = "xyes"; then
WITH_MP3X=mp3x${ac_exeext}
AC_MSG_RESULT(yes)
else
WITH_MP3X=
AC_MSG_RESULT(no)
fi
if test "${HAVE_GTK}" = "no"; then
if test "x${WITH_MP3X}" = "xmp3x"; then
AC_MSG_WARN(can't build mp3x, no GTK installed)
WITH_MP3X=
fi
if test "x${CONFIG_ANALYZER}" != "xyes"; then
AC_MSG_WARN(can't build mp3x because of disabled analyzer hooks)
WITH_MP3X=
fi
fi
AC_MSG_CHECKING(if mp3rtp is requested)
AC_ARG_ENABLE(mp3rtp,
[ --enable-mp3rtp Build mp3rtp [default=no]],
WITH_MP3RTP="${enableval}", WITH_MP3RTP=no)
if test "x${WITH_MP3RTP}" = "xyes"; then
if test ${SOCKETFUNCTION} = NO; then
AC_MSG_ERROR([function socket is mandatory for mp3rtp])
fi
WITH_MP3RTP=mp3rtp${ac_exeext}
AC_MSG_RESULT(yes)
else
WITH_MP3RTP=
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(if dynamic linking of the frontends is requested)
AC_ARG_ENABLE(dynamic-frontends,
[ --enable-dynamic-frontends Link frontends against shared libraries [default=no]],
FRONTEND_LDFLAGS="${FRONTEND_LDFLAGS}", FRONTEND_LDFLAGS="${FRONTEND_LDFLAGS} -static")
case "x${FRONTEND_LDFLAGS}" in
*-static*)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT(yes)
;;
esac
#
# this is from vorbis
#
dnl check GLIBC
case $host in
*86-*-linux*)
# glibc < 2.1.3 has a serious FP bug in the math inline header
# that will cripple Vorbis. Look to see if the magic FP stack
# clobber is missing in the mathinline header, thus indicating
# the buggy version
AC_EGREP_CPP(log10.*fldlg2.*fxch,[
#define __LIBC_INTERNAL_MATH_INLINES 1
#define __OPTIMIZE__
#include <math.h>
],bad=maybe,bad=no)
AC_MSG_CHECKING(glibc mathinline bug)
if test ${bad} = "maybe" ;then
AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
[
#define __LIBC_INTERNAL_MATH_INLINES 1
#define __OPTIMIZE__
#include <math.h>
],bad=no,bad=yes)
fi
AC_MSG_RESULT(${bad})
if test ${bad} = "yes" ;then
AC_MSG_WARN([ ])
AC_MSG_WARN([********************************************************])
AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
AC_MSG_WARN([* in /usr/include/bits/mathinline.h This bug affects *])
AC_MSG_WARN([* all floating point code, not only LAME, but all code *])
AC_MSG_WARN([* built on this machine. Upgrading to glibc 2.1.3 is *])
AC_MSG_WARN([* strongly urged to correct the problem. *])
AC_MSG_WARN([*Note: that upgrading glibc will not fix any previously*])
AC_MSG_WARN([* built programs; this is a compile-time bug. *])
AC_MSG_WARN([* To work around the problem for this build of LAME, *])
AC_MSG_WARN([* autoconf is disabling all math inlining. This will *])
AC_MSG_WARN([* hurt LAME performace but is necessary for LAME to *])
AC_MSG_WARN([* work correctly. Once glibc is upgraded, rerun *])
AC_MSG_WARN([* configure and make to build with inlining. *])
AC_MSG_WARN([********************************************************])
AC_MSG_WARN([ ])
AC_DEFINE(__NO_MATH_INLINES, 1, work around a glibc bug)
fi;;
esac
dnl configure use of VBR bitrate histogram
dnl todo: always use yes as default, use simulation instead ?
AC_MSG_CHECKING(for termcap)
if test "x${HAVE_TERMCAP}" != "x"; then
FRONTEND_LDADD="-l${HAVE_TERMCAP} ${FRONTEND_LDADD}"
AC_DEFINE(HAVE_TERMCAP, 1, have termcap)
TERMCAP_DEFAULT="yes"
else
TERMCAP_DEFAULT="no"
fi
AC_MSG_RESULT(${TERMCAP_DEFAULT})
dnl ### processor specific options ###
WITH_VECTOR=no
case $host_cpu in
x86_64|amd64)
CPUTYPE="no"
if test $ac_cv_header_xmmintrin_h = yes ; then
WITH_XMM=yes
WITH_VECTOR=yes
fi
AC_DEFINE(TAKEHIRO_IEEE754_HACK, 1, IEEE754 compatible machine)
AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enoug
h precission)
;;
*86)
CPUTYPE="i386"
if test $ac_cv_header_xmmintrin_h = yes ; then
WITH_XMM=yes
WITH_VECTOR=yes
fi
# use internal knowledge of the IEEE 754 layout
AC_DEFINE(TAKEHIRO_IEEE754_HACK, 1, IEEE754 compatible machine)
AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enough precission)
;;
powerpc)
CPUTYPE="no"
# use internal knowledge of the IEEE 754 layout
AC_DEFINE(TAKEHIRO_IEEE754_HACK, 1, IEEE754 compatible machine)
# The following should not get enabled on a G5. HOWTO check for a G5?
AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enough precission)
;;
*)
CPUTYPE="no"
;;
esac
# which vector code do we support to build on this machine?
AM_CONDITIONAL(WITH_XMM, test "x${WITH_XMM}" = "xyes")
# needs to be defined to link in the internal vector lib
AM_CONDITIONAL(WITH_VECTOR, test "x${WITH_VECTOR}" = "xyes")
AC_MSG_CHECKING(if I have to build the internal vector lib)
AC_MSG_RESULT(${WITH_VECTOR})
AC_PATH_PROG(NASM, nasm, no)
case "${NASM}" in
no)
;;
*)
AC_MSG_CHECKING(for assembler routines for this processor type)
for recurse_over in ${ASM_FOR_ARCH}
do
if test "${CPUTYPE}" = "${recurse_over}"; then
include_asm_routines="yes"
fi
case $host_os in
*darwin*)
# currently we have problems because of a wrong
# libtool hack in the darwin case (for nasm code)
include_asm_routines="no"
;;
esac
done
if test "x${include_asm_routines}" = "xyes"; then
AC_DEFINE(HAVE_NASM, 1, have nasm)
AC_DEFINE(MMX_choose_table, 1, use MMX version of choose_table)
else
include_asm_routines="no"
NASM="no"
fi
AC_MSG_RESULT(${include_asm_routines})
;;
esac
AM_CONDITIONAL(HAVE_NASM, test "${NASM}" != "no")
case $host_os in
*cygwin*|*mingw32*)
CYGWIN=yes
NASM_FORMAT="-f win32 -DWIN32"
;;
*darwin*)
NASM_FORMAT="-f macho"
;;
*)
CYGWIN=no
NASM_FORMAT="-f elf"
;;
esac
#
# 'expopt' is used for "additional optimizations", not for optimizations which
# are marked as "experimental" in the guide for the compiler.
# They are "experimental" here in the LAME project (at least
# "--enable-expopt=full").
#
AC_MSG_CHECKING(for additional optimizations)
AC_ARG_ENABLE(expopt,
[ --enable-expopt=full,norm Whether to enable experimental optimizations]
[ [default=no]],
CONFIG_EXPOPT="${enableval}", CONFIG_EXPOPT="no")
if test "x$GCC" = "xyes"; then
# gcc defaults. OS specific options go in versious sections below
# from the gcc man pages: "there is no reason to use -pedantic"
if test "x${with_gnu_ld}" = "xyes"; then
CFLAGS="-Wall -pipe ${CFLAGS}"
else
# some vendor ld's don't like '-pipe'
CFLAGS="-Wall ${CFLAGS}"
fi
# GCC version specific generic options
case "${GCC_version}" in
2.96*)
# for buggy version of gcc shipped with RH7.1, back of on some
# optimizations
OPTIMIZATION="-O -fomit-frame-pointer -ffast-math \
-funroll-loops"
OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
-fsched-interblock -fbranch-count-reg -fforce-addr \
-fforce-mem"
;;
3.0*)
# -funroll-loops seems to produce buggy code with gcc 3.0.3
OPTIMIZATION="-O -fomit-frame-pointer -ffast-math"
OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
-fbranch-count-reg -fforce-addr -fforce-mem"
;;
3.*|4.0.*|4.1.*)
# -fomit-frame-pointer seems to be buggy on cygwin
case ${host_os} in
*cygwin*)
OMIT_FRAME_POINTER=
;;
*)
OMIT_FRAME_POINTER=-fomit-frame-pointer
;;
esac
OPTIMIZATION="-O3 ${OMIT_FRAME_POINTER} -ffast-math"
OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
-fbranch-count-reg -fforce-addr -fforce-mem"
;;
4.*)
OPTIMIZATION="-O3 -fomit-frame-pointer -ffast-math"
OPTIMIZATION_FULL="-fbranch-count-reg -fforce-addr"
;;
*)
# default
OPTIMIZATION="-O3 ${OMIT_FRAME_POINTER} -ffast-math \
-funroll-loops"
OPTIMIZATION_FULL="-fbranch-count-reg -fforce-addr"
;;
esac
# GCC version independend generic options
OPTIMIZATION_NORM="-fschedule-insns2"
# generic CPU specific options
case ${host_cpu} in
sparc)
case "${GCC_version}" in
3.0*)
;;
3.*|4.*)
# doesn't work on 3.0.x, but on 3.[12] and
# hopefully on every other release after that too
if test -x /usr/bin/isalist; then
/usr/bin/isalist | grep sparcv8plus \
>/dev/null 2>&1 && \
OPTIMIZATION="${OPTIMIZATION} \
-mcpu=ultrasparc \
-mtune=ultrasparc"
fi
;;
esac
;;
*86)
case "${GCC_version}" in
3.*|4.*)
OPTIMIZATION="${OPTIMIZATION} \
-maccumulate-outgoing-args"
;;
esac
;;
esac
expopt_msg_result_printed=no
case "${CONFIG_EXPOPT}" in
no)
# if someone supplies own CFLAGS, we don't add our own
if test "x${ac_save_CFLAGS}" != "x"; then
OPTIMIZATION=""
fi
;;
norm|yes)
OPTIMIZATION="${OPTIMIZATION} ${OPTIMIZATION_NORM}"
;;
full)
OPTIMIZATION="${OPTIMIZATION} ${OPTIMIZATION_NORM} \
${OPTIMIZATION_FULL}"
# some hardware dependend options
case "${GCC_version}" in
2.9*|3.*|4.0.*|4.1.*)
# "new" GCC, use some "new" CPU specific optimizations
# use -mtune instead of -m486 or -mcpu= etc, since they are
# deprecated by GCC <rbrito>
case ${host_cpu} in
*486)
OPTIMIZATION="${OPTIMIZATION} -mcpu=i486 \
-mfancy-math-387"
;;
*586)
OPTIMIZATION="${OPTIMIZATION} -mcpu=pentium \
-march=pentium -mfancy-math-387"
;;
*686)
OPTIMIZATION="${OPTIMIZATION} -mcpu=pentiumpro \
-march=pentiumpro -mfancy-math-387 \
-malign-double"
;;
*86)
OPTIMIZATION="${OPTIMIZATION} -mfancy-math-387"
;;
alpha*)
OPTIMIZATION="${OPTIMIZATION} -mfp-regs"
AC_DEFINE(FLOAT, double, double is faster than float on Alpha)
# add "-mcpu=21164a -Wa,-m21164a" to optimize
# for 21164a (ev56) CPU
;;
*)
OPTIMIZATION="${OPTIMIZATION} -fdelayed-branch"
;;
esac
;;
4.*)
case ${host_cpu} in
*486)
OPTIMIZATION="${OPTIMIZATION} -march=i486"
;;
*586)
OPTIMIZATION="${OPTIMIZATION} -march=i586 \
-mtune=native"
;;
*686)
OPTIMIZATION="${OPTIMIZATION} -march=i686 \
-mtune=native"
;;
*86)
OPTIMIZATION="${OPTIMIZATION} -march=native \
-mtune=native"
;;
arm*-gnueabi)
if [ -z "$(echo ${GCC_version} | awk '/4\.0/')" ]; then
# Work round buggy softfloat optimization in ARM EABI compilers
# -gnueabi in only gcc-4.1 onwards
OPTIMIZATION="${OPTIMIZATION} -fno-finite-math-only"
fi
;;
esac
;;
*)
# no special optimization for other versions
AC_MSG_RESULT(no)
expopt_msg_result_printed=yes
AC_MSG_WARN(LAME doesn't know about your version (${GCC_version}) of gcc, please report it to [email protected]. Please make sure you try the latest LAME version first!)
;;
esac
;;
*)
AC_MSG_ERROR(bad value �${CONFIG_EXPOPT}� for expopt option)
;;
esac
if test "${expopt_msg_result_printed}" = "no" ; then
AC_MSG_RESULT(${CONFIG_EXPOPT})
fi
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(for debug options)
AC_ARG_ENABLE(debug,
[ --enable-debug=alot,norm Enable debugging (disables optimizations)]
[ [default=no]],
CONFIG_DEBUG="${enableval}", CONFIG_DEBUG="no")
if test "x$GCC" = "xyes"; then
DEBUG_NORM_OPT="-O -g -Wall"
DEBUG_ANOYING="-Wbad-function-cast -Wcast-align \
-Wcast-qual -Wchar-subscripts -Wconversion \
-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
-Wredundant-decls -Wshadow -Wstrict-prototypes \
-Wwrite-strings -Winline \
-Wformat -Wswitch -Waggregate-return -Wmissing-noreturn \
-Wimplicit-int -fno-builtin"
case "${CONFIG_DEBUG}" in
no)
AC_DEFINE(NDEBUG, 1, no debug build)
;;
norm|yes)
AC_DEFINE(ABORTFP, 1, debug define)
OPTIMIZATION="${DEBUG_NORM_OPT}"
;;
anoying)
AC_DEFINE(ABORTFP, 1, debug define)
OPTIMIZATION="${DEBUG_NORM_OPT} ${DEBUG_ANOYING}"
;;
alot)
AC_DEFINE(ABORTFP, 1, debug define)
AC_DEFINE(DEBUG, 1, alot of debug output)
OPTIMIZATION="${DEBUG_NORM_OPT}"
;;
*)
AC_MSG_ERROR(bad value �${CONFIG_DEBUG}� for debug option)
esac
AC_MSG_RESULT(${CONFIG_DEBUG})
else
AC_MSG_RESULT(no)
fi
dnl ### system specific options ###
##########################################################################
# LINUX on Digital/Compaq Alpha CPUs
##########################################################################
case $host in
alpha*-*-linux*)
################################################################
#### Check if 'ccc' is in our path
################################################################
if test "`which ccc 2>/dev/null | grep -c ccc`" != "0" ; then
# Compaq's C Compiler
CC=ccc
################################################################
#### set 'OPTIMIZATION = -arch host -tune host'
#### to generate/tune instructions for this machine
#### 'OPTIMIZATION += -migrate -fast -inline speed -unroll 0'
#### tweak to run as fast as possible :)
#### 'OPTIMIZATION += -w0'
#### set warning and linking flags
################################################################
OPTIMIZATION="-arch host -tune host"
OPTIMIZATION="-migrate -fast -inline speed -unroll 0 $OPTIMIZATION"
OPTIMIZATION="-w0 $OPTIMIZATION"
################################################################
#### to debug, uncomment
################################################################
# For Debugging
#OPTIMIZATION="-g3 $OPTIMIZATION"