configure.in 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. dnl Process this file with autoconf to produce a configure script
  2. dnl ------------------------------------------------
  3. dnl Initialization and Versioning
  4. dnl ------------------------------------------------
  5. AC_INIT(lib/mdct.c)
  6. AM_INIT_AUTOMAKE(libvorbis,1.0.0)
  7. dnl Library versioning
  8. V_LIB_CURRENT=0
  9. V_LIB_REVISION=0
  10. V_LIB_AGE=0
  11. VF_LIB_CURRENT=0
  12. VF_LIB_REVISION=0
  13. VF_LIB_AGE=0
  14. VE_LIB_CURRENT=0
  15. VE_LIB_REVISION=0
  16. VE_LIB_AGE=0
  17. AC_SUBST(V_LIB_CURRENT)
  18. AC_SUBST(V_LIB_REVISION)
  19. AC_SUBST(V_LIB_AGE)
  20. AC_SUBST(VF_LIB_CURRENT)
  21. AC_SUBST(VF_LIB_REVISION)
  22. AC_SUBST(VF_LIB_AGE)
  23. AC_SUBST(VE_LIB_CURRENT)
  24. AC_SUBST(VE_LIB_REVISION)
  25. AC_SUBST(VE_LIB_AGE)
  26. dnl --------------------------------------------------
  27. dnl Check for programs
  28. dnl --------------------------------------------------
  29. dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
  30. dnl if $CFLAGS is blank
  31. cflags_save="$CFLAGS"
  32. AC_PROG_CC
  33. CFLAGS="$cflags_save"
  34. AM_PROG_LIBTOOL
  35. dnl --------------------------------------------------
  36. dnl Set build flags based on environment
  37. dnl --------------------------------------------------
  38. AC_CANONICAL_HOST
  39. dnl Set some target options
  40. if test -z "$GCC"; then
  41. case $host in
  42. *-*-irix*)
  43. dnl If we're on IRIX, we wanna use cc even if gcc
  44. dnl is there (unless the user has overriden us)...
  45. if test -z "$CC"; then
  46. CC=cc
  47. fi
  48. DEBUG="-g -signed"
  49. CFLAGS="-O2 -w -signed"
  50. PROFILE="-p -g3 -O2 -signed" ;;
  51. sparc-sun-solaris*)
  52. DEBUG="-v -g"
  53. CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
  54. PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
  55. *)
  56. DEBUG="-g"
  57. CFLAGS="-O"
  58. PROFILE="-g -p" ;;
  59. esac
  60. else
  61. case $host in
  62. *86-*-linux*)
  63. DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
  64. CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
  65. # PROFILE="-Wall -W -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
  66. PROFILE="-Wall -W -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline -static"
  67. # glibc < 2.1.3 has a serious FP bug in the math inline header
  68. # that will cripple Vorbis. Look to see if the magic FP stack
  69. # clobber is missing in the mathinline header, thus indicating
  70. # the buggy version
  71. AC_EGREP_CPP(log10.*fldlg2.*fxch,[
  72. #define __LIBC_INTERNAL_MATH_INLINES 1
  73. #define __OPTIMIZE__
  74. #include <math.h>
  75. ],bad=maybe,bad=no)
  76. if test ${bad} = "maybe" ;then
  77. AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
  78. [
  79. #define __LIBC_INTERNAL_MATH_INLINES 1
  80. #define __OPTIMIZE__
  81. #include <math.h>
  82. ],bad=no,bad=yes)
  83. fi
  84. if test ${bad} = "yes" ;then
  85. AC_MSG_WARN([ ])
  86. AC_MSG_WARN([********************************************************])
  87. AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
  88. AC_MSG_WARN([* in /usr/include/bits/mathinline.h This bug affects *])
  89. AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
  90. AC_MSG_WARN([* machine. Upgrading to glibc 2.1.3 is strongly urged *])
  91. AC_MSG_WARN([* to correct the problem. Note that upgrading glibc *])
  92. AC_MSG_WARN([* will not fix any previously built programs; this is *])
  93. AC_MSG_WARN([* a compile-time time bug. *])
  94. AC_MSG_WARN([* To work around the problem for this build of Ogg, *])
  95. AC_MSG_WARN([* autoconf is disabling all math inlining. This will *])
  96. AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
  97. AC_MSG_WARN([* will actually work. Once glibc is upgraded, rerun *])
  98. AC_MSG_WARN([* configure and make to build with inlining. *])
  99. AC_MSG_WARN([********************************************************])
  100. AC_MSG_WARN([ ])
  101. CFLAGS=${OPT}" -D__NO_MATH_INLINES"
  102. PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
  103. fi;;
  104. *-*-linux*)
  105. DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
  106. CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char"
  107. PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
  108. sparc-sun-*)
  109. DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -mv8"
  110. CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
  111. PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
  112. *)
  113. DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
  114. CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char"
  115. PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
  116. esac
  117. fi
  118. dnl --------------------------------------------------
  119. dnl Check for headers
  120. dnl --------------------------------------------------
  121. AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
  122. dnl --------------------------------------------------
  123. dnl Check for typedefs, structures, etc
  124. dnl --------------------------------------------------
  125. dnl none
  126. dnl --------------------------------------------------
  127. dnl Check for libraries
  128. dnl --------------------------------------------------
  129. AC_CHECK_LIB(m, cos, LIBS="-lm", LIBS="")
  130. AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
  131. AM_PATH_OGG(have_ogg=yes, have_ogg=no)
  132. dnl --------------------------------------------------
  133. dnl Check for library functions
  134. dnl --------------------------------------------------
  135. AC_FUNC_ALLOCA
  136. AC_FUNC_MEMCMP
  137. dnl --------------------------------------------------
  138. dnl Do substitutions
  139. dnl --------------------------------------------------
  140. AC_SUBST(DEBUG)
  141. AC_SUBST(PROFILE)
  142. AC_SUBST(pthread_lib)
  143. AC_OUTPUT(Makefile lib/Makefile lib/modes/Makefile lib/books/Makefile doc/Makefile doc/vorbisfile/Makefile include/Makefile include/vorbis/Makefile examples/Makefile)