configure.in 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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.0beta4)
  7. dnl Library versioning
  8. V_LIB_CURRENT=0
  9. V_LIB_REVISION=1
  10. V_LIB_AGE=0
  11. VF_LIB_CURRENT=0
  12. VF_LIB_REVISION=1
  13. VF_LIB_AGE=0
  14. VE_LIB_CURRENT=0
  15. VE_LIB_REVISION=1
  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. AC_PROG_CPP
  34. CFLAGS="$cflags_save"
  35. AM_PROG_LIBTOOL
  36. dnl --------------------------------------------------
  37. dnl Set build flags based on environment
  38. dnl --------------------------------------------------
  39. AC_CANONICAL_HOST
  40. dnl Set some target options
  41. cflags_save="$CFLAGS"
  42. ldflags_save="$LDFLAGS"
  43. if test -z "$GCC"; then
  44. case $host in
  45. *-*-irix*)
  46. dnl If we're on IRIX, we wanna use cc even if gcc
  47. dnl is there (unless the user has overriden us)...
  48. if test -z "$CC"; then
  49. CC=cc
  50. fi
  51. DEBUG="-g -signed"
  52. CFLAGS="-O2 -w -signed"
  53. PROFILE="-p -g3 -O2 -signed" ;;
  54. sparc-sun-solaris*)
  55. DEBUG="-v -g"
  56. CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
  57. PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
  58. *)
  59. DEBUG="-g"
  60. CFLAGS="-O"
  61. PROFILE="-g -p" ;;
  62. esac
  63. else
  64. case $host in
  65. *86-*-linux*)
  66. DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
  67. CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
  68. # PROFILE="-Wall -W -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
  69. PROFILE="-Wall -W -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline -static"
  70. # glibc < 2.1.3 has a serious FP bug in the math inline header
  71. # that will cripple Vorbis. Look to see if the magic FP stack
  72. # clobber is missing in the mathinline header, thus indicating
  73. # the buggy version
  74. AC_EGREP_CPP(log10.*fldlg2.*fxch,[
  75. #define __LIBC_INTERNAL_MATH_INLINES 1
  76. #define __OPTIMIZE__
  77. #include <math.h>
  78. ],bad=maybe,bad=no)
  79. if test ${bad} = "maybe" ;then
  80. AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
  81. [
  82. #define __LIBC_INTERNAL_MATH_INLINES 1
  83. #define __OPTIMIZE__
  84. #include <math.h>
  85. ],bad=no,bad=yes)
  86. fi
  87. if test ${bad} = "yes" ;then
  88. AC_MSG_WARN([ ])
  89. AC_MSG_WARN([********************************************************])
  90. AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
  91. AC_MSG_WARN([* in /usr/include/bits/mathinline.h This bug affects *])
  92. AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
  93. AC_MSG_WARN([* machine. Upgrading to glibc 2.1.3 is strongly urged *])
  94. AC_MSG_WARN([* to correct the problem. Note that upgrading glibc *])
  95. AC_MSG_WARN([* will not fix any previously built programs; this is *])
  96. AC_MSG_WARN([* a compile-time time bug. *])
  97. AC_MSG_WARN([* To work around the problem for this build of Ogg, *])
  98. AC_MSG_WARN([* autoconf is disabling all math inlining. This will *])
  99. AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
  100. AC_MSG_WARN([* will actually work. Once glibc is upgraded, rerun *])
  101. AC_MSG_WARN([* configure and make to build with inlining. *])
  102. AC_MSG_WARN([********************************************************])
  103. AC_MSG_WARN([ ])
  104. CFLAGS=${OPT}" -D__NO_MATH_INLINES"
  105. PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
  106. fi;;
  107. *-*-linux*)
  108. DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
  109. CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char"
  110. PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
  111. sparc-sun-*)
  112. DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -mv8"
  113. CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
  114. PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
  115. *-*-darwin*)
  116. DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char"
  117. CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O4 -ffast-math -fsigned-char"
  118. PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O4 -ffast-math -fsigned-char";;
  119. *)
  120. DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
  121. CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char"
  122. PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
  123. esac
  124. fi
  125. CFLAGS="$CFLAGS $cflags_save"
  126. LDFLAGS="$LDFLAGS $ldflags_save"
  127. dnl --------------------------------------------------
  128. dnl Check for headers
  129. dnl --------------------------------------------------
  130. AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
  131. dnl --------------------------------------------------
  132. dnl Check for typedefs, structures, etc
  133. dnl --------------------------------------------------
  134. dnl none
  135. dnl --------------------------------------------------
  136. dnl Check for libraries
  137. dnl --------------------------------------------------
  138. AC_CHECK_LIB(m, cos, LIBS="-lm", LIBS="")
  139. AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
  140. AM_PATH_OGG(LIBS="$LIBS $OGG_LIBS", AC_MSG_ERROR(must have Ogg installed!))
  141. dnl --------------------------------------------------
  142. dnl Check for library functions
  143. dnl --------------------------------------------------
  144. AC_FUNC_ALLOCA
  145. AC_FUNC_MEMCMP
  146. AC_CHECK_FUNCS(sqrtf)
  147. AC_CHECK_FUNCS(logf)
  148. AC_CHECK_FUNCS(expf)
  149. AC_CHECK_FUNCS(acosf)
  150. AC_CHECK_FUNCS(atanf)
  151. AC_CHECK_FUNCS(frexpf)
  152. AC_CHECK_FUNCS(rintf)
  153. dnl --------------------------------------------------
  154. dnl Do substitutions
  155. dnl --------------------------------------------------
  156. AC_SUBST(DEBUG)
  157. AC_SUBST(PROFILE)
  158. AC_SUBST(pthread_lib)
  159. AC_OUTPUT(Makefile lib/Makefile lib/modes/Makefile lib/books/Makefile doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile include/Makefile include/vorbis/Makefile examples/Makefile win32/Makefile debian/Makefile vq/Makefile)