File: audacity_checklib_ffmpeg.m4

package info (click to toggle)
audacity 2.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 44,240 kB
  • sloc: cpp: 182,841; ansic: 120,375; sh: 26,421; lisp: 7,495; makefile: 1,606; python: 240; xml: 104; perl: 31
file content (82 lines) | stat: -rw-r--r-- 3,700 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
dnl Todo: Add Audacity / FFmpeg license
dnl
dnl Please increment the serial number below whenever you alter this macro
dnl for the benefit of automatic macro update systems
# audacity_checklib_ffmpeg.m4 serial 1
dnl Check for a copy of ffmpeg, whoose headers we will use for the importer
AC_DEFUN([AUDACITY_CHECKLIB_FFMPEG], [
   AC_ARG_WITH(ffmpeg,
               [AS_HELP_STRING([--with-ffmpeg],
                               [use ffmpeg for import and export support ])],
               FFMPEG_ARGUMENT=$withval,
               FFMPEG_ARGUMENT="unspecified")

   if false ; then
      AC_DEFINE(USE_FFMPEG, 1,
                [Define if ffmpeg (multi-format import and export) support should be enabled])
   fi

   dnl Check for a system copy of ffmpeg to use. For now I'm insiting on a
   dnl current version to make maintenance easier. We need both avcodec and
   dnl avformat, so I'm going to check for both

   PKG_CHECK_MODULES(AVCODEC, libavcodec >= 51.53,
                     avcodec_available_system="yes",
                     avcodec_available_system="no")
   PKG_CHECK_MODULES(AVFORMAT, libavformat >= 52.12,
                     avformat_available_system="yes",
                     avformat_available_system="no")
   PKG_CHECK_MODULES(AVUTIL, libavutil,
                     libavutil_available_system="yes",
                     libavutil_available_system="no")

   FFMPEG_SYSTEM_AVAILABLE="no"
   if test "$avcodec_available_system" = "yes" -a "$avformat_available_system" = "yes" -a "$libavutil_available_system" = "yes"; then
      FFMPEG_SYSTEM_AVAILABLE="yes"
      FFMPEG_SYSTEM_CXXFLAGS="$AVCODEC_CFLAGS $AVFORMAT_CFLAGS $AVUTIL_CFLAGS"
      FFMPEG_SYSTEM_CPPSYMBOLS="USE_FFMPEG"
      if test "x$dynamic_loading" = "xno"; then
         FFMPEG_SYSTEM_LIBS="$AVCODEC_LIBS $AVFORMAT_LIBS $AVUTIL_LIBS"
         AC_DEFINE(DISABLE_DYNAMIC_LOADING_FFMPEG, 1, [Use system FFmpeg library and disable dynamic loading of it.])
      fi
      dnl build the extra object files needed to use FFmpeg. Paths inside
      dnl the audacity src/ dir, as this is subsitiuted into src/Makefile.in
      FFMPEG_SYSTEM_OPTOBJS="import/ImportFFmpeg.o export/ExportFFmpeg.o \
         export/ExportFFmpegDialogs.o"
      AC_MSG_NOTICE([FFmpeg library available as system library])
   fi
   if test "x$FFMPEG_SYSTEM_AVAILABLE" = "xno" ; then
      AC_MSG_NOTICE([FFmpeg library NOT available as system library])
   fi

   dnl see if ffmpeg is available locally, or rather that we have some headers
   dnl in lib-src/ffmpeg/ we can use.
   FFMPEG_LOCAL_AVAILABLE="no"
   AC_CHECK_FILE(${srcdir}/lib-src/ffmpeg/libavcodec/avcodec.h,
                 avcodec_h_found="yes",
                 avcodec_h_found="no")

   AC_CHECK_FILE(${srcdir}/lib-src/ffmpeg/libavformat/avformat.h,
                 avformat_h_found="yes",
                 avformat_h_found="no")

   if test "x$avcodec_h_found" = "xyes" ; then
      if test "x$avformat_h_found" = "xyes" ; then
         FFMPEG_LOCAL_AVAILABLE="yes"
         FFMPEG_LOCAL_LIBS=""
         FFMPEG_LOCAL_CXXFLAGS='-I$(top_srcdir)/lib-src/ffmpeg'
         FFMPEG_LOCAL_CPPSYMBOLS="USE_FFMPEG"
         dnl build the extra object files needed to use FFmpeg. Paths inside
         dnl the audacity src/ dir, as this is subsitiuted into src/Makefile.in
         FFMPEG_LOCAL_OPTOBJS="import/ImportFFmpeg.o export/ExportFFmpeg.o \
            export/ExportFFmpegDialogs.o"
         AC_MSG_NOTICE([FFmpeg headers are available in the local tree])
      fi
   fi
   if test "x$FFMPEG_LOCAL_AVAILABLE" = "xno" ; then
      AC_MSG_NOTICE([ffmpeg library is NOT available in the local tree])
   fi
   
   FFMPEG_MIMETYPES="audio/aac;audio/mp4;audio/x-ms-wma;"
])