configure.ac 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. dnl Process this file with autoconf to produce a configure script
  2. dnl ------------------------------------------------
  3. dnl Initialization and Versioning
  4. dnl ------------------------------------------------
  5. AC_INIT([libvorbis],[1.3.4],[vorbis-dev@xiph.org])
  6. AC_CONFIG_SRCDIR([lib/mdct.c])
  7. AC_CANONICAL_TARGET([])
  8. AM_INIT_AUTOMAKE
  9. AM_MAINTAINER_MODE
  10. dnl Add parameters for aclocal
  11. AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
  12. dnl Library versioning
  13. dnl - library source changed -> increment REVISION
  14. dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
  15. dnl - interfaces added -> increment AGE
  16. dnl - interfaces removed -> AGE = 0
  17. V_LIB_CURRENT=4
  18. V_LIB_REVISION=7
  19. V_LIB_AGE=4
  20. VF_LIB_CURRENT=6
  21. VF_LIB_REVISION=6
  22. VF_LIB_AGE=3
  23. VE_LIB_CURRENT=2
  24. VE_LIB_REVISION=10
  25. VE_LIB_AGE=0
  26. AC_SUBST(V_LIB_CURRENT)
  27. AC_SUBST(V_LIB_REVISION)
  28. AC_SUBST(V_LIB_AGE)
  29. AC_SUBST(VF_LIB_CURRENT)
  30. AC_SUBST(VF_LIB_REVISION)
  31. AC_SUBST(VF_LIB_AGE)
  32. AC_SUBST(VE_LIB_CURRENT)
  33. AC_SUBST(VE_LIB_REVISION)
  34. AC_SUBST(VE_LIB_AGE)
  35. dnl --------------------------------------------------
  36. dnl Check for programs
  37. dnl --------------------------------------------------
  38. dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
  39. dnl if $CFLAGS is blank
  40. cflags_save="$CFLAGS"
  41. AC_PROG_CC
  42. AC_PROG_CPP
  43. CFLAGS="$cflags_save"
  44. AC_C_INLINE
  45. AC_LIBTOOL_WIN32_DLL
  46. AC_PROG_LIBTOOL
  47. AM_PROG_CC_C_O
  48. dnl Check for doxygen
  49. if test "x$enable_docs" = xyes; then
  50. AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
  51. if test $HAVE_DOXYGEN = "false"; then
  52. AC_MSG_WARN([*** doxygen not found, API documentation will not be built])
  53. fi
  54. else
  55. HAVE_DOXYGEN=false
  56. fi
  57. AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
  58. dnl latex tools for the specification document
  59. AC_ARG_ENABLE(docs,
  60. AC_HELP_STRING([--enable-docs], [build the documentation]))
  61. if test "x$enable_docs" = xyes; then
  62. AC_CHECK_PROGS([PDFLATEX], pdflatex, [/bin/false])
  63. AC_CHECK_PROGS([HTLATEX], htlatex, [/bin/false])
  64. if test "x$PDFLATEX" = x/bin/false || test "x$HTLATEX" = x/bin/false; then
  65. enable_docs=no
  66. AC_MSG_WARN([Documentation will not be built!])
  67. fi
  68. fi
  69. AM_CONDITIONAL(BUILD_DOCS, [test "x$enable_docs" = xyes])
  70. AC_ARG_ENABLE(examples,
  71. AS_HELP_STRING([--enable-examples], [build the examples]))
  72. AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = xyes])
  73. dnl --------------------------------------------------
  74. dnl Set build flags based on environment
  75. dnl --------------------------------------------------
  76. dnl Set some target options
  77. cflags_save="$CFLAGS"
  78. if test -z "$GCC"; then
  79. case $host in
  80. *-*-irix*)
  81. dnl If we're on IRIX, we wanna use cc even if gcc
  82. dnl is there (unless the user has overriden us)...
  83. if test -z "$CC"; then
  84. CC=cc
  85. fi
  86. DEBUG="-g -signed"
  87. CFLAGS="-O2 -w -signed"
  88. PROFILE="-p -g3 -O2 -signed" ;;
  89. sparc-sun-solaris*)
  90. DEBUG="-v -g"
  91. CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
  92. PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
  93. *)
  94. DEBUG="-g"
  95. CFLAGS="-O"
  96. PROFILE="-g -p" ;;
  97. esac
  98. else
  99. AC_MSG_CHECKING([GCC version])
  100. GCC_VERSION=`$CC -dumpversion`
  101. AC_MSG_RESULT([$GCC_VERSION])
  102. case $host in
  103. *86-*-linux*)
  104. DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
  105. CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
  106. # PROFILE="-Wall -Wextra -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
  107. PROFILE="-Wall -Wextra -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline"
  108. # glibc < 2.1.3 has a serious FP bug in the math inline header
  109. # that will cripple Vorbis. Look to see if the magic FP stack
  110. # clobber is missing in the mathinline header, thus indicating
  111. # the buggy version
  112. AC_EGREP_CPP(log10.*fldlg2.*fxch,[
  113. #define __LIBC_INTERNAL_MATH_INLINES 1
  114. #define __OPTIMIZE__
  115. #include <math.h>
  116. ],bad=maybe,bad=no)
  117. if test ${bad} = "maybe" ;then
  118. AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
  119. [
  120. #define __LIBC_INTERNAL_MATH_INLINES 1
  121. #define __OPTIMIZE__
  122. #include <math.h>
  123. ],bad=no,bad=yes)
  124. fi
  125. if test ${bad} = "yes" ;then
  126. AC_MSG_WARN([ ])
  127. AC_MSG_WARN([********************************************************])
  128. AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
  129. AC_MSG_WARN([* in /usr/include/bits/mathinline.h This bug affects *])
  130. AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
  131. AC_MSG_WARN([* machine. Upgrading to glibc 2.1.3 is strongly urged *])
  132. AC_MSG_WARN([* to correct the problem. Note that upgrading glibc *])
  133. AC_MSG_WARN([* will not fix any previously built programs; this is *])
  134. AC_MSG_WARN([* a compile-time bug. *])
  135. AC_MSG_WARN([* To work around the problem for this build of Ogg, *])
  136. AC_MSG_WARN([* autoconf is disabling all math inlining. This will *])
  137. AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
  138. AC_MSG_WARN([* will actually work. Once glibc is upgraded, rerun *])
  139. AC_MSG_WARN([* configure and make to build with inlining. *])
  140. AC_MSG_WARN([********************************************************])
  141. AC_MSG_WARN([ ])
  142. CFLAGS=${OPT}" -D__NO_MATH_INLINES"
  143. PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
  144. fi;;
  145. powerpc-*-linux*spe)
  146. DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES"
  147. CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -D_REENTRANT"
  148. PROFILE="-pg -g -O3 -ffast-math -mfused-madd -D_REENTRANT";;
  149. powerpc-*-linux*)
  150. DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES"
  151. CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT"
  152. PROFILE="-pg -g -O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT";;
  153. *-*-linux*)
  154. DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
  155. CFLAGS="-O20 -Wall -Wextra -ffast-math -D_REENTRANT -fsigned-char"
  156. PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
  157. sparc-sun-*)
  158. sparc_cpu=""
  159. AC_MSG_CHECKING([if gcc supports -mv8])
  160. old_cflags="$CFLAGS"
  161. CFLAGS="$CFLAGS -mv8"
  162. AC_TRY_COMPILE(, [return 0;], [
  163. AC_MSG_RESULT([yes])
  164. sparc_cpu="-mv8"
  165. ])
  166. CFLAGS="$old_cflags"
  167. DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char $sparc_cpu"
  168. CFLAGS="-O20 -Wall -Wextra -ffast-math -D__NO_MATH_INLINES -fsigned-char $sparc_cpu"
  169. PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char $sparc_cpu" ;;
  170. *-*-darwin*)
  171. DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char"
  172. CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O4 -ffast-math -fsigned-char"
  173. PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O4 -ffast-math -fsigned-char";;
  174. *-*-os2*)
  175. # Use -W instead of -Wextra because gcc on OS/2 is an old version.
  176. DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
  177. CFLAGS="-O20 -Wall -W -ffast-math -D_REENTRANT -fsigned-char"
  178. PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
  179. *)
  180. DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
  181. CFLAGS="-O20 -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
  182. PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
  183. esac
  184. AC_ADD_CFLAGS([-Wdeclaration-after-statement])
  185. fi
  186. CFLAGS="$CFLAGS $cflags_save"
  187. dnl --------------------------------------------------
  188. dnl Check for headers
  189. dnl --------------------------------------------------
  190. AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
  191. dnl --------------------------------------------------
  192. dnl Check for typedefs, structures, etc
  193. dnl --------------------------------------------------
  194. dnl none
  195. dnl --------------------------------------------------
  196. dnl Check for libraries
  197. dnl --------------------------------------------------
  198. AC_CHECK_LIB(m, cos, VORBIS_LIBS="-lm", VORBIS_LIBS="")
  199. AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
  200. PKG_PROG_PKG_CONFIG
  201. HAVE_OGG=no
  202. if test "x$PKG_CONFIG" != "x"
  203. then
  204. PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
  205. fi
  206. if test "x$HAVE_OGG" = "xno"
  207. then
  208. dnl fall back to the old school test
  209. XIPH_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!))
  210. libs_save=$LIBS
  211. LIBS="$OGG_LIBS $VORBIS_LIBS"
  212. AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !))
  213. LIBS=$libs_save
  214. fi
  215. dnl --------------------------------------------------
  216. dnl Check for library functions
  217. dnl --------------------------------------------------
  218. AC_FUNC_ALLOCA
  219. AC_FUNC_MEMCMP
  220. dnl --------------------------------------------------
  221. dnl Do substitutions
  222. dnl --------------------------------------------------
  223. AC_SUBST(VORBIS_LIBS)
  224. AC_SUBST(DEBUG)
  225. AC_SUBST(PROFILE)
  226. AC_SUBST(pthread_lib)
  227. dnl The following line causes the libtool distributed with the source
  228. dnl to be replaced if the build system has a more recent version.
  229. AC_SUBST(LIBTOOL_DEPS)
  230. AC_CONFIG_FILES([
  231. Makefile
  232. m4/Makefile
  233. lib/Makefile
  234. lib/modes/Makefile
  235. lib/books/Makefile
  236. lib/books/coupled/Makefile
  237. lib/books/uncoupled/Makefile
  238. lib/books/floor/Makefile
  239. doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile doc/libvorbis/Makefile
  240. doc/Doxyfile
  241. include/Makefile include/vorbis/Makefile
  242. examples/Makefile
  243. test/Makefile
  244. vq/Makefile
  245. libvorbis.spec
  246. vorbis.pc
  247. vorbisenc.pc
  248. vorbisfile.pc
  249. vorbis-uninstalled.pc
  250. vorbisenc-uninstalled.pc
  251. vorbisfile-uninstalled.pc
  252. ])
  253. AC_CONFIG_HEADERS([config.h])
  254. AC_OUTPUT