configure.in 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. AC_CANONICAL_HOST
  7. AC_CANONICAL_TARGET
  8. AM_CONFIG_HEADER([config.h])
  9. AM_INIT_AUTOMAKE(libvorbis,1.1.1)
  10. AM_MAINTAINER_MODE
  11. dnl Library versioning
  12. V_LIB_CURRENT=3
  13. V_LIB_REVISION=0
  14. V_LIB_AGE=3
  15. VF_LIB_CURRENT=4
  16. VF_LIB_REVISION=0
  17. VF_LIB_AGE=1
  18. VE_LIB_CURRENT=2
  19. VE_LIB_REVISION=1
  20. VE_LIB_AGE=0
  21. AC_SUBST(V_LIB_CURRENT)
  22. AC_SUBST(V_LIB_REVISION)
  23. AC_SUBST(V_LIB_AGE)
  24. AC_SUBST(VF_LIB_CURRENT)
  25. AC_SUBST(VF_LIB_REVISION)
  26. AC_SUBST(VF_LIB_AGE)
  27. AC_SUBST(VE_LIB_CURRENT)
  28. AC_SUBST(VE_LIB_REVISION)
  29. AC_SUBST(VE_LIB_AGE)
  30. dnl --------------------------------------------------
  31. dnl Check for programs
  32. dnl --------------------------------------------------
  33. dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
  34. dnl if $CFLAGS is blank
  35. cflags_save="$CFLAGS"
  36. AC_PROG_CC
  37. AC_PROG_CPP
  38. CFLAGS="$cflags_save"
  39. AM_PROG_LIBTOOL
  40. dnl docbook xml transform and processing tools
  41. AC_ARG_ENABLE(docs,
  42. [ --enable-docs build the documentation],
  43. [case "${enableval}" in
  44. yes) build_docs=true;;
  45. no) build_docs=false;;
  46. *) AC_MSG_ERROR(unknown value ${enableval} for --enable-docs);;
  47. esac],[build_docs=false])
  48. dnl ideally we'd look for other tools and support them
  49. if test x$build_docs = xtrue; then
  50. AC_CHECK_PROGS([XSLTPROC], xsltproc, [/bin/false])
  51. AC_CHECK_PROGS([PDFXMLTEX], pdfxmltex, [/bin/false])
  52. if test "x$XSLTPROC" = "x/bin/false" || test "x$PDFXMLTEX" = "x/bin/false"; then
  53. build_docs=false
  54. AC_MSG_WARN([Documentation will not be built!])
  55. fi
  56. fi
  57. AM_CONDITIONAL(BUILD_DOCS, [test x$build_docs = xtrue])
  58. dnl --------------------------------------------------
  59. dnl Set build flags based on environment
  60. dnl --------------------------------------------------
  61. dnl Set some target options
  62. cflags_save="$CFLAGS"
  63. ldflags_save="$LDFLAGS"
  64. if test -z "$GCC"; then
  65. case $host in
  66. *-*-irix*)
  67. dnl If we're on IRIX, we wanna use cc even if gcc
  68. dnl is there (unless the user has overriden us)...
  69. if test -z "$CC"; then
  70. CC=cc
  71. fi
  72. DEBUG="-g -signed"
  73. CFLAGS="-O2 -w -signed"
  74. PROFILE="-p -g3 -O2 -signed" ;;
  75. sparc-sun-solaris*)
  76. DEBUG="-v -g"
  77. CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
  78. PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
  79. *)
  80. DEBUG="-g"
  81. CFLAGS="-O"
  82. PROFILE="-g -p" ;;
  83. esac
  84. else
  85. case $host in
  86. *86-*-linux*)
  87. DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
  88. CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
  89. # PROFILE="-Wall -W -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
  90. PROFILE="-Wall -W -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline"
  91. # glibc < 2.1.3 has a serious FP bug in the math inline header
  92. # that will cripple Vorbis. Look to see if the magic FP stack
  93. # clobber is missing in the mathinline header, thus indicating
  94. # the buggy version
  95. AC_EGREP_CPP(log10.*fldlg2.*fxch,[
  96. #define __LIBC_INTERNAL_MATH_INLINES 1
  97. #define __OPTIMIZE__
  98. #include <math.h>
  99. ],bad=maybe,bad=no)
  100. if test ${bad} = "maybe" ;then
  101. AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
  102. [
  103. #define __LIBC_INTERNAL_MATH_INLINES 1
  104. #define __OPTIMIZE__
  105. #include <math.h>
  106. ],bad=no,bad=yes)
  107. fi
  108. if test ${bad} = "yes" ;then
  109. AC_MSG_WARN([ ])
  110. AC_MSG_WARN([********************************************************])
  111. AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
  112. AC_MSG_WARN([* in /usr/include/bits/mathinline.h This bug affects *])
  113. AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
  114. AC_MSG_WARN([* machine. Upgrading to glibc 2.1.3 is strongly urged *])
  115. AC_MSG_WARN([* to correct the problem. Note that upgrading glibc *])
  116. AC_MSG_WARN([* will not fix any previously built programs; this is *])
  117. AC_MSG_WARN([* a compile-time time bug. *])
  118. AC_MSG_WARN([* To work around the problem for this build of Ogg, *])
  119. AC_MSG_WARN([* autoconf is disabling all math inlining. This will *])
  120. AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
  121. AC_MSG_WARN([* will actually work. Once glibc is upgraded, rerun *])
  122. AC_MSG_WARN([* configure and make to build with inlining. *])
  123. AC_MSG_WARN([********************************************************])
  124. AC_MSG_WARN([ ])
  125. CFLAGS=${OPT}" -D__NO_MATH_INLINES"
  126. PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
  127. fi;;
  128. powerpc-*-linux*)
  129. DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES"
  130. CFLAGS="-O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT"
  131. PROFILE="-pg -g -O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT";;
  132. *-*-linux*)
  133. DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
  134. CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char"
  135. PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
  136. sparc-sun-*)
  137. DEBUG="-g -Wall -W -D__NO_MATH_INLINES -fsigned-char -mv8"
  138. CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
  139. PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
  140. *-*-darwin*)
  141. DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char"
  142. CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O4 -ffast-math -fsigned-char"
  143. PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O4 -ffast-math -fsigned-char";;
  144. *)
  145. DEBUG="-g -Wall -W -D__NO_MATH_INLINES -fsigned-char"
  146. CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char"
  147. PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
  148. esac
  149. fi
  150. CFLAGS="$CFLAGS $cflags_save"
  151. LDFLAGS="$LDFLAGS $ldflags_save"
  152. dnl --------------------------------------------------
  153. dnl Check for headers
  154. dnl --------------------------------------------------
  155. AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
  156. dnl --------------------------------------------------
  157. dnl Check for typedefs, structures, etc
  158. dnl --------------------------------------------------
  159. dnl none
  160. dnl --------------------------------------------------
  161. dnl Check for libraries
  162. dnl --------------------------------------------------
  163. AC_CHECK_LIB(m, cos, VORBIS_LIBS="-lm", VORBIS_LIBS="")
  164. AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
  165. HAVE_OGG=no
  166. dnl first check through pkg-config
  167. dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
  168. AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
  169. if test "x$HAVE_PKG_CONFIG" = "xyes"
  170. then
  171. PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
  172. fi
  173. if test "x$HAVE_OGG" = "xno"
  174. then
  175. dnl fall back to the old school test
  176. XIPH_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!))
  177. libs_save=$LIBS
  178. LIBS="$OGG_LIBS $VORBIS_LIBS"
  179. AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !))
  180. LIBS=$libs_save
  181. fi
  182. dnl --------------------------------------------------
  183. dnl Check for library functions
  184. dnl --------------------------------------------------
  185. AC_FUNC_ALLOCA
  186. AC_FUNC_MEMCMP
  187. dnl --------------------------------------------------
  188. dnl Do substitutions
  189. dnl --------------------------------------------------
  190. AC_SUBST(VORBIS_LIBS)
  191. AC_SUBST(DEBUG)
  192. AC_SUBST(PROFILE)
  193. AC_SUBST(pthread_lib)
  194. AC_OUTPUT([
  195. Makefile
  196. lib/Makefile
  197. lib/modes/Makefile
  198. lib/books/Makefile
  199. lib/books/coupled/Makefile
  200. lib/books/uncoupled/Makefile
  201. lib/books/floor/Makefile
  202. doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile
  203. include/Makefile include/vorbis/Makefile
  204. examples/Makefile
  205. win32/Makefile
  206. debian/Makefile
  207. vq/Makefile
  208. libvorbis.spec
  209. vorbis.pc
  210. vorbisenc.pc
  211. vorbisfile.pc
  212. vorbis-uninstalled.pc
  213. vorbisenc-uninstalled.pc
  214. vorbisfile-uninstalled.pc
  215. ])