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