configure.ac 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. dnl Process this file with autoconf to produce a configure script
  2. dnl ------------------------------------------------
  3. dnl Initialization and Versioning
  4. dnl ------------------------------------------------
  5. AC_INIT(libtheora,[1.1beta4svn])
  6. AC_CANONICAL_HOST
  7. AC_CANONICAL_TARGET
  8. AM_CONFIG_HEADER([config.h])
  9. AC_CONFIG_SRCDIR([lib/fdct.c])
  10. AM_INIT_AUTOMAKE
  11. AM_MAINTAINER_MODE
  12. dnl Library versioning
  13. dnl CURRENT, REVISION, AGE
  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. TH_LIB_CURRENT=3
  19. TH_LIB_REVISION=8
  20. TH_LIB_AGE=3
  21. AC_SUBST(TH_LIB_CURRENT)
  22. AC_SUBST(TH_LIB_REVISION)
  23. AC_SUBST(TH_LIB_AGE)
  24. THDEC_LIB_CURRENT=2
  25. THDEC_LIB_REVISION=2
  26. THDEC_LIB_AGE=1
  27. AC_SUBST(THDEC_LIB_CURRENT)
  28. AC_SUBST(THDEC_LIB_REVISION)
  29. AC_SUBST(THDEC_LIB_AGE)
  30. THENC_LIB_CURRENT=2
  31. THENC_LIB_REVISION=2
  32. THENC_LIB_AGE=1
  33. AC_SUBST(THENC_LIB_CURRENT)
  34. AC_SUBST(THENC_LIB_REVISION)
  35. AC_SUBST(THENC_LIB_AGE)
  36. dnl Extra linker options (for version script)
  37. THEORA_LDFLAGS=""
  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. AM_PROG_CC_C_O
  48. AC_LIBTOOL_WIN32_DLL
  49. AM_PROG_LIBTOOL
  50. dnl Add parameters for aclocal
  51. AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
  52. dnl Check for doxygen
  53. AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
  54. AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
  55. if test $HAVE_DOXYGEN = "false"; then
  56. AC_MSG_WARN([*** doxygen not found, API documentation will not be built])
  57. fi
  58. dnl Check for tools used to build the format specification
  59. BUILD_SPEC="false"
  60. ac_build_spec=yes
  61. AC_ARG_ENABLE(spec,
  62. [ --disable-spec do not build spec ],
  63. [
  64. if test "x$enableval" = "xno"; then
  65. ac_build_spec=$enableval
  66. fi
  67. ], [
  68. ac_build_spec=yes
  69. ] )
  70. if test "x$ac_build_spec" = "xyes"; then
  71. AC_CHECK_PROG(HAVE_PDFLATEX, pdflatex, yes)
  72. AC_CHECK_PROG(HAVE_BIBTEX, bibtex, yes)
  73. AC_CHECK_PROG(HAVE_TRANSFIG, fig2dev, yes)
  74. if test -r doc/spec/spec.tex; then
  75. if test "x$HAVE_PDFLATEX" = "xyes"; then
  76. if test "x$HAVE_BIBTEX" = "xyes"; then
  77. if test "x$HAVE_TRANSFIG" = "xyes"; then
  78. tex_pkg_list=`fgrep usepackage doc/spec/spec.tex | grep \{ | grep -v ltablex`
  79. tex_pkg_ok="yes"
  80. for pkg_line in $tex_pkg_list; do
  81. pkg_name=`echo $pkg_line | sed -e 's/.*{\(.*\)}.*/\1/'`
  82. AC_MSG_CHECKING([for Tex package $pkg_name])
  83. cat >conftest.tex <<_ACEOF
  84. \\documentclass{book}
  85. $pkg_line
  86. \\begin{document}
  87. Hello World.
  88. \\end{document}
  89. _ACEOF
  90. if pdflatex -interaction batchmode -halt-on-error conftest < /dev/null > /dev/null 2>&1; then
  91. AC_MSG_RESULT([ok])
  92. else
  93. tex_pkg_ok="no"
  94. AC_MSG_RESULT([no])
  95. fi
  96. done
  97. if test -w conftest.tex; then rm conftest.tex; fi
  98. if test -w conftest.tex; then rm conftest.aux; fi
  99. if test -w conftest.pdf; then rm conftest.pdf; fi
  100. if test "x$tex_pkg_ok" = "xyes"; then
  101. BUILD_SPEC="true"
  102. fi
  103. fi
  104. fi
  105. fi
  106. fi
  107. fi
  108. AM_CONDITIONAL(BUILD_SPEC, $BUILD_SPEC)
  109. if test $BUILD_SPEC = "false"; then
  110. AC_MSG_WARN([*** Format Specification will not built.])
  111. fi
  112. dnl Check for valgrind
  113. VALGRIND_ENVIRONMENT=""
  114. ac_enable_valgrind=no
  115. AC_ARG_ENABLE(valgrind-testing,
  116. [ --enable-valgrind-testing enable running of tests inside Valgrind ], [ ac_enable_valgrind=yes ], [ ac_enable_valgrind=no] )
  117. if test "x${ac_enable_valgrind}" = xyes ; then
  118. if test "x${enable_shared}" = xyes ; then
  119. VALGRIND_ENVIRONMENT="libtool --mode=execute "
  120. fi
  121. AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
  122. if test "x$HAVE_VALGRIND" = xyes ; then
  123. VALGRIND_ENVIRONMENT="$VALGRIND_ENVIRONMENT valgrind -q --leak-check=yes --show-reachable=yes --num-callers=100"
  124. AC_SUBST(VALGRIND_ENVIRONMENT)
  125. TESTS_INFO="Type 'make check' to run test suite. Tests will be run under:
  126. ${VALGRIND_ENVIRONMENT}"
  127. else
  128. TESTS_INFO="Type 'make check' to run test suite (Valgrind not found)"
  129. fi
  130. else
  131. TESTS_INFO="Type 'make check' to run test suite (Valgrind testing not enabled)"
  132. fi
  133. dnl --------------------------------------------------
  134. dnl Set build flags based on environment
  135. dnl --------------------------------------------------
  136. dnl Set some target options
  137. cflags_save="$CFLAGS"
  138. if test -z "$GCC"; then
  139. case $host in
  140. *)
  141. DEBUG="-g -DDEBUG"
  142. CFLAGS="-O"
  143. PROFILE="-g -p -DDEBUG" ;;
  144. esac
  145. else
  146. case $host in
  147. *)
  148. DEBUG="-g -Wall -Wno-parentheses -DDEBUG -D__NO_MATH_INLINES"
  149. CFLAGS="-Wall -Wno-parentheses -O3 -fforce-addr -fomit-frame-pointer -finline-functions -funroll-loops"
  150. PROFILE="-Wall -Wno-parentheses -pg -g -O3 -fno-inline-functions -DDEBUG";;
  151. esac
  152. fi
  153. CFLAGS="$CFLAGS $cflags_save"
  154. cpu_x86_64=no
  155. cpu_x86_32=no
  156. AC_ARG_ENABLE(asm,
  157. [ --disable-asm disable assembly optimizations ],
  158. [ ac_enable_asm=$enableval ], [ ac_enable_asm=yes] )
  159. if test "x${ac_enable_asm}" = xyes; then
  160. cpu_optimization="no optimization for your platform, please send a patch"
  161. case $target_cpu in
  162. i[[3456]]86)
  163. cpu_x86_32=yes
  164. cpu_optimization="32 bit x86"
  165. AC_DEFINE([OC_X86_ASM], [], [make use of x86 asm optimization])
  166. if test "x$target_vendor" = "xapple"; then
  167. THEORA_LDFLAGS="$THEORA_LDFLAGS -Wl,-read_only_relocs,suppress"
  168. fi
  169. ;;
  170. x86_64)
  171. cpu_x86_64=yes
  172. cpu_optimization="64 bit x86"
  173. AC_DEFINE([OC_X86_ASM], [], [make use of x86 asm optimization])
  174. AC_DEFINE([OC_X86_64_ASM], [], [make use of x86_64 asm optimization])
  175. ;;
  176. esac
  177. else
  178. cpu_optimization="disabled"
  179. fi
  180. AM_CONDITIONAL([CPU_x86_64], [test x$cpu_x86_64 = xyes])
  181. AM_CONDITIONAL([CPU_x86_32], [test x$cpu_x86_32 = xyes])
  182. # Test whenever ld supports -version-script
  183. AC_PROG_LD
  184. AC_PROG_LD_GNU
  185. AC_MSG_CHECKING([how to control symbol export])
  186. THDEC_VERSION_ARG=""
  187. THENC_VERSION_ARG=""
  188. TH_VERSION_ARG=""
  189. if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
  190. case "$target_os" in
  191. *mingw*)
  192. THEORA_LDFLAGS="$THEORA_LDFLAGS -no-undefined"
  193. THDEC_VERSION_ARG="-export-symbols \$(top_srcdir)/win32/xmingw32/libtheoradec-all.def"
  194. THENC_VERSION_ARG="-export-symbols \$(top_srcdir)/win32/xmingw32/libtheoraenc-all.def"
  195. THENC_VERSION_ARG="$THENC_VERSION_ARG -ltheoradec"
  196. THC_VERSION_ARG="-export-symbols \$(top_srcdir)/win32/libtheora.def"
  197. AC_MSG_RESULT([-export-symbols])
  198. ;;
  199. linux* | solaris* )
  200. THDEC_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script-dec'
  201. THENC_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script-enc'
  202. TH_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script'
  203. AC_MSG_RESULT([--version-script])
  204. ;;
  205. *)
  206. # build without versioning
  207. AC_MSG_RESULT([no])
  208. ;;
  209. esac
  210. else
  211. case "$target_os" in
  212. darwin*)
  213. THDEC_VERSION_ARG='-Wl,-exported_symbols_list,$(srcdir)/theoradec.exp'
  214. THENC_VERSION_ARG='-Wl,-exported_symbols_list,$(srcdir)/theoraenc.exp'
  215. TH_VERSION_ARG='-Wl,-exported_symbols_list,$(srcdir)/theora.exp'
  216. AC_MSG_RESULT([-exported_symbols_list])
  217. ;;
  218. *)
  219. # build without versioning
  220. AC_MSG_RESULT([no])
  221. ;;
  222. esac
  223. fi
  224. THEORADEC_LDFLAGS="$THEORA_LDFLAGS $THDEC_VERSION_ARG"
  225. THEORAENC_LDFLAGS="$THEORA_LDFLAGS $THENC_VERSION_ARG"
  226. THEORA_LDFLAGS="$THEORA_LDFLAGS $TH_VERSION_ARG"
  227. AC_SUBST(THEORADEC_LDFLAGS)
  228. AC_SUBST(THEORAENC_LDFLAGS)
  229. AC_SUBST(THEORA_LDFLAGS)
  230. dnl --------------------------------------------------
  231. dnl Checks for support libraries and headers
  232. dnl --------------------------------------------------
  233. dnl check for Ogg
  234. HAVE_OGG=no
  235. dnl first check through pkg-config since it's more flexible
  236. dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
  237. AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
  238. if test "x$HAVE_PKG_CONFIG" = "xyes"
  239. then
  240. PKG_CHECK_MODULES(OGG, ogg >= 1.1, HAVE_OGG=yes, HAVE_OGG=no)
  241. fi
  242. if test "x$HAVE_OGG" = "xno"
  243. then
  244. dnl fall back to the old school test
  245. XIPH_PATH_OGG(, AC_MSG_ERROR([
  246. libogg is required to build this package!
  247. please see http://www.xiph.org/ for how to
  248. obtain a copy.
  249. ]))
  250. cflags_save=$CFLAGS
  251. libs_save=$LIBS
  252. CFLAGS="$CFLAGS $OGG_CFLAGS"
  253. LIBS="$LIBS $OGG_LIBS"
  254. AC_CHECK_FUNC(oggpackB_read, , [
  255. AC_MSG_ERROR([newer libogg version (1.1 or later) required])
  256. ])
  257. CFLAGS=$cflags_save
  258. LIBS=$libs_save
  259. fi
  260. dnl check for Vorbis
  261. HAVE_VORBIS=no
  262. dnl first check through pkg-config since it's more flexible
  263. if test "x$HAVE_PKG_CONFIG" = "xyes"
  264. then
  265. PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0.1, HAVE_VORBIS=yes, HAVE_VORBIS=no)
  266. dnl also set VORBISENC_LIBS since an examples needs it
  267. dnl the old .m4 sets this to a value to use on top of VORBIS_LIBS,
  268. dnl so we do the same here.
  269. VORBISENC_LIBS="-lvorbisenc"
  270. AC_SUBST(VORBISENC_LIBS)
  271. fi
  272. if test "x$HAVE_VORBIS" = "xno"
  273. then
  274. dnl fall back to the old school test
  275. XIPH_PATH_VORBIS(HAVE_VORBIS=yes, HAVE_VORBIS=no)
  276. fi
  277. dnl check for SDL
  278. HAVE_SDL=no
  279. AM_PATH_SDL(,[
  280. HAVE_SDL=yes
  281. SDL_LIBS=`$SDL_CONFIG --libs`
  282. ],AC_MSG_WARN([*** Unable to find SDL -- Not compiling example players ***]))
  283. dnl check for OSS
  284. HAVE_OSS=no
  285. AC_CHECK_HEADERS([sys/soundcard.h soundcard.h machine/soundcard.h],[
  286. HAVE_OSS=yes
  287. break
  288. ])
  289. if test x$HAVE_OSS != xyes; then
  290. AC_MSG_WARN([OSS audio support not found -- not compiling player_example])
  291. fi
  292. dnl OpenBSD needs -lossaudio to use the oss interface
  293. OSS_LIBS=
  294. case "$target_os" in
  295. openbsd*)
  296. OSS_LIBS='-lossaudio'
  297. ;;
  298. esac
  299. AC_SUBST(OSS_LIBS)
  300. dnl check for libpng
  301. HAVE_PNG=no
  302. if test "x$HAVE_PKG_CONFIG" = "xyes"
  303. then
  304. PKG_CHECK_MODULES(PNG, libpng, HAVE_PNG=yes, HAVE_PNG=no)
  305. fi
  306. AC_SUBST(PNG_CFLAGS)
  307. AC_SUBST(PNG_LIBS)
  308. dnl check for libcairo
  309. HAVE_CAIRO=no
  310. AC_ARG_ENABLE(telemetry,
  311. [ --enable-telemetry enable debugging output controls ],
  312. [ ac_enable_telemetry=$enableval ], [ ac_enable_telemetry=no] )
  313. if test "x${ac_enable_telemetry}" = xyes; then
  314. if test "x$HAVE_PKG_CONFIG" = "xyes"
  315. then
  316. PKG_CHECK_MODULES(CAIRO, cairo, HAVE_CAIRO=yes, HAVE_CAIRO=no)
  317. AC_DEFINE([HAVE_CAIRO], [], [libcairo is available for visual debugging output])
  318. fi
  319. if test x$HAVE_CAIRO != xyes; then
  320. AC_MSG_WARN([libcairo not found -- not compiling telemetry output support ])
  321. fi
  322. AC_SUBST(CAIRO_CFLAGS)
  323. AC_SUBST(CAIRO_LIBS)
  324. fi
  325. dnl --------------------------------------------------
  326. dnl Overall build configuration options
  327. dnl --------------------------------------------------
  328. dnl Configuration option for building of floating point code.
  329. ac_enable_float=yes
  330. AC_ARG_ENABLE(float,
  331. [ --disable-float disable use of floating point code ],
  332. [ ac_enable_float=$enableval ], [ ac_enable_float=yes] )
  333. if test "x${ac_enable_float}" != xyes ; then
  334. AC_DEFINE([THEORA_DISABLE_FLOAT], [],
  335. [Define to exclude floating point code from the build])
  336. fi
  337. AM_CONDITIONAL(THEORA_DISABLE_FLOAT, [test "x${ac_enable_float}" != xyes])
  338. dnl Configuration option for building of encoding support.
  339. ac_enable_encode=yes
  340. AC_ARG_ENABLE(encode,
  341. [ --disable-encode disable encoding support ],
  342. [ ac_enable_encode=$enableval ], [ ac_enable_encode=yes] )
  343. if test "x${ac_enable_encode}" != xyes ; then
  344. AC_DEFINE([THEORA_DISABLE_ENCODE], [],
  345. [Define to exclude encode support from the build])
  346. else
  347. if test x$HAVE_VORBIS = xyes; then
  348. BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES encoder_example\$(EXEEXT)"
  349. else
  350. AC_MSG_NOTICE([Vorbis missing, cannot build example encoder])
  351. fi
  352. fi
  353. AM_CONDITIONAL(THEORA_DISABLE_ENCODE, [test "x${ac_enable_encode}" != xyes])
  354. dnl Configuration option for examples
  355. ac_enable_examples=yes
  356. AC_ARG_ENABLE(examples,
  357. [ --disable-examples disable examples ],
  358. [ ac_enable_examples=$enableval ], [ ac_enable_examples=yes] )
  359. AM_CONDITIONAL(THEORA_ENABLE_EXAMPLES, [test "x${ac_enable_examples}" != xno])
  360. dnl --------------------------------------------------
  361. dnl Check for headers
  362. dnl --------------------------------------------------
  363. dnl none here
  364. dnl --------------------------------------------------
  365. dnl Check for typedefs, structures, etc
  366. dnl --------------------------------------------------
  367. dnl none
  368. dnl --------------------------------------------------
  369. dnl Check for library functions
  370. dnl --------------------------------------------------
  371. dnl OpenBSD needs -lcompat for ftime() used by dump_video.c
  372. AC_SEARCH_LIBS([ftime], [compat])
  373. dnl substitute the included getopt if the system doesn't support long options
  374. AC_CHECK_FUNC(getopt_long,
  375. [GETOPT_OBJS=''],
  376. [GETOPT_OBJS='getopt.$(OBJEXT) getopt1.$(OBJEXT)'])
  377. AC_SUBST(GETOPT_OBJS)
  378. if test x$HAVE_SDL = xyes -a x$HAVE_OSS = xyes -a x$HAVE_VORBIS = xyes; then
  379. BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES player_example\$(EXEEXT)"
  380. fi
  381. if test x$HAVE_PNG = xyes; then
  382. BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES png2theora\$(EXEEXT)"
  383. fi
  384. AC_SUBST(BUILDABLE_EXAMPLES)
  385. dnl --------------------------------------------------
  386. dnl Do substitutions
  387. dnl --------------------------------------------------
  388. AC_SUBST(DEBUG)
  389. AC_SUBST(PROFILE)
  390. AC_OUTPUT([
  391. Makefile
  392. lib/Makefile
  393. include/Makefile include/theora/Makefile
  394. examples/Makefile
  395. doc/Makefile doc/Doxyfile doc/spec/Makefile
  396. tests/Makefile
  397. m4/Makefile
  398. libtheora.spec
  399. theora.pc
  400. theora-uninstalled.pc
  401. theoradec.pc
  402. theoradec-uninstalled.pc
  403. theoraenc.pc
  404. theoraenc-uninstalled.pc
  405. ])
  406. AS_AC_EXPAND(LIBDIR, ${libdir})
  407. AS_AC_EXPAND(INCLUDEDIR, ${includedir})
  408. AS_AC_EXPAND(BINDIR, ${bindir})
  409. AS_AC_EXPAND(DOCDIR, ${datadir}/doc)
  410. if test $HAVE_DOXYGEN = "false"; then
  411. doc_build="no"
  412. else
  413. doc_build="yes"
  414. fi
  415. if test $BUILD_SPEC = "false"; then
  416. spec_build="no"
  417. else
  418. spec_build="yes"
  419. fi
  420. AC_MSG_RESULT([
  421. ------------------------------------------------------------------------
  422. $PACKAGE $VERSION: Automatic configuration OK.
  423. General configuration:
  424. Encoding support: ........... ${ac_enable_encode}
  425. Floating point support: ..... ${ac_enable_float}
  426. Assembly optimization: ...... ${cpu_optimization}
  427. Debugging telemetry: ........ ${ac_enable_telemetry}
  428. Build example code: ......... ${ac_enable_examples}
  429. API Documentation: .......... ${doc_build}
  430. Format Documentation: ....... ${spec_build}
  431. Installation paths:
  432. libtheora: ................... ${LIBDIR}
  433. C header files: .............. ${INCLUDEDIR}/theora
  434. Documentation: ............... ${DOCDIR}/$PACKAGE
  435. Building:
  436. Type 'make' to compile $PACKAGE.
  437. Type 'make install' to install $PACKAGE.
  438. ${TESTS_INFO}
  439. Example programs will be built but not installed.
  440. ------------------------------------------------------------------------
  441. ])