configure.ac 9.3 KB

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