configure.ac 9.4 KB

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