configure.in 7.7 KB

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