configure.ac 8.5 KB

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