You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lol-ffmpeg.m4 2.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. dnl
  2. dnl Lol Engine
  3. dnl
  4. dnl Copyright © 2010—2017 Sam Hocevar <sam@hocevar.net>
  5. dnl
  6. dnl Lol Engine is free software. It comes without any warranty, to
  7. dnl the extent permitted by applicable law. You can redistribute it
  8. dnl and/or modify it under the terms of the Do What the Fuck You Want
  9. dnl to Public License, Version 2, as published by the WTFPL Task Force.
  10. dnl See http://www.wtfpl.net/ for more details.
  11. dnl
  12. # LOL_AC_CHECK_FFMPEG()
  13. # ---------------------
  14. AC_DEFUN([LOL_AC_CHECK_FFMPEG],
  15. [
  16. ac_cv_my_have_ffmpeg="no"
  17. if test "${enable_ffmpeg}" != "no"; then
  18. LOL_AC_CHECK_FFMPEG_INNER()
  19. fi
  20. AM_CONDITIONAL(LOL_USE_FFMPEG, test "${ac_cv_my_have_ffmpeg}" != "no")
  21. ])
  22. # LOL_AC_CHECK_FFMPEG_INNER()
  23. # ---------------------------
  24. AC_DEFUN([LOL_AC_CHECK_FFMPEG_INNER],
  25. [
  26. ac_cv_my_have_ffmpeg="yes"
  27. PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec], [:], [ac_cv_my_have_ffmpeg=no])
  28. PKG_CHECK_MODULES([LIBAVUTIL], [libavutil], [:], [ac_cv_my_have_ffmpeg=no])
  29. PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat], [:], [ac_cv_my_have_ffmpeg=no])
  30. PKG_CHECK_MODULES([LIBSWSCALE], [libswscale], [:], [ac_cv_my_have_ffmpeg=no])
  31. LOL_FFMPEG_EXTRA_LIBS=""
  32. if test "${ac_cv_my_have_ffmpeg}" != "yes"; then
  33. ac_cv_my_have_ffmpeg="yes"
  34. AC_CHECK_HEADERS(libavcodec/avcodec.h, [:], [ac_cv_my_have_ffmpeg=no])
  35. AC_CHECK_HEADERS(libavformat/avformat.h, [:], [ac_cv_my_have_ffmpeg=no])
  36. AC_CHECK_HEADERS(libswscale/swscale.h, [:], [ac_cv_my_have_ffmpeg=no])
  37. if test "${ac_cv_my_have_ffmpeg}" = "yes"; then
  38. LIBAVCODEC_LIBS="-lavcodec"
  39. LIBAVUTIL_LIBS="-lavutil"
  40. LIBAVFORMAT_LIBS="-lavformat"
  41. LIBSWSCALE_LIBS="-lswscale"
  42. LIBSWRESAMPLE_LIBS="-lswresample"
  43. dnl Required by avformat/network.c
  44. AC_CHECK_LIB(ws2_32, main, LOL_FFMPEG_EXTRA_LIBS="${LOL_FFMPEG_EXTRA_LIBS} -lws2_32")
  45. dnl Required by avformat/tls_schannel.c
  46. AC_CHECK_LIB(secur32, main, LOL_FFMPEG_EXTRA_LIBS="${LOL_FFMPEG_EXTRA_LIBS} -lsecur32")
  47. dnl Required by avutil/random_seed.c
  48. AC_CHECK_LIB(bcrypt, main, LOL_FFMPEG_EXTRA_LIBS="${LOL_FFMPEG_EXTRA_LIBS} -lbcrypt")
  49. dnl Required by avcodec/dxva2.c
  50. AC_CHECK_LIB(ole32, main, LOL_FFMPEG_EXTRA_LIBS="${LOL_FFMPEG_EXTRA_LIBS} -lole32")
  51. fi
  52. fi
  53. if test "${ac_cv_my_have_ffmpeg}" = "yes"; then
  54. AC_DEFINE(LOL_USE_FFMPEG, 1, Define to 1 to use FFmpeg)
  55. LOL_CFLAGS="${LOL_CFLAGS} ${LIBAVFORMAT_CFLAGS} ${LIBAVUTIL_CFLAGS} ${LIBAVCODEC_CFLAGS} ${LIBSWSCALE_CFLAGS}"
  56. LOL_LIBS="${LOL_LIBS} ${LIBAVFORMAT_LIBS} ${LIBAVCODEC_LIBS} ${LIBAVUTIL_LIBS} ${LIBSWSCALE_LIBS} ${LIBSWRESAMPLE_LIBS} ${LOL_FFMPEG_EXTRA_LIBS}"
  57. fi
  58. ]) # LOL_AC_CHECK_FFMPEG_INNER