~ubuntu-branches/ubuntu/wily/gmerlin-encoders/wily-proposed

« back to all changes in this revision

Viewing changes to m4/avcodec.m4

  • Committer: Bazaar Package Importer
  • Author(s): IOhannes m zmoelnig (gpg-key at iem)
  • Date: 2011-01-15 20:19:05 UTC
  • Revision ID: james.westby@ubuntu.com-20110115201905-qign5pihv1b977ct
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Configure paths for libavcodec
 
2
# Burkhard Plaum, 2004-08-12
 
3
 
 
4
dnl Compile an avcodec test program and figure out the version
 
5
 
 
6
AC_DEFUN([ACL_CHECK_AVCODEC],[
 
7
AC_MSG_CHECKING([for build ID in libavcodec, libs: $AVCODEC_LIBS])
 
8
CFLAGS_save=$CFLAGS
 
9
LIBS_save=$LIBS
 
10
 
 
11
CFLAGS="$GMERLIN_DEP_CFLAGS $CFLAGS $AVCODEC_CFLAGS"
 
12
LIBS="$GMERLIN_DEP_LIBS $AVCODEC_LIBS"
 
13
 
 
14
AVCODEC_HEADER=""
 
15
 
 
16
dnl Look for header
 
17
found_header="false"
 
18
 
 
19
AC_TRY_COMPILE([
 
20
#include <libavcodec/avcodec.h>],[], [found_header="true";AVCODEC_HEADER="<libavcodec/avcodec.h>" ],)
 
21
 
 
22
if test $found_header = "false"; then
 
23
AC_TRY_COMPILE([
 
24
#include <avcodec.h>],[],[found_header="true";AVCODEC_HEADER="<avcodec.h>"])
 
25
fi
 
26
 
 
27
if test $found_header = "false"; then
 
28
AC_TRY_COMPILE([
 
29
#include <ffmpeg/avcodec.h>],[], [found_header="true";AVCODEC_HEADER="<ffmpeg/avcodec.h>" ],)
 
30
fi
 
31
 
 
32
avcodec_ok="false"
 
33
AC_TRY_RUN([
 
34
    #include <stdio.h>
 
35
    #include $AVCODEC_HEADER
 
36
    int main()
 
37
    {
 
38
    FILE * output;
 
39
    if(LIBAVCODEC_BUILD < $1)
 
40
      return -1;
 
41
    output=fopen("avcodec_version", "w");
 
42
    fprintf(output, AV_TOSTRING(LIBAVCODEC_VERSION));
 
43
    fclose(output);
 
44
    return 0;
 
45
    }
 
46
  ],
 
47
  [
 
48
    # program could be run
 
49
    if test "x$AVCODEC_VERSION" = "x"; then 
 
50
      AVCODEC_VERSION=`cat avcodec_version`
 
51
    fi
 
52
    rm -f avcodec_version
 
53
    avcodec_ok="true"
 
54
    AC_MSG_RESULT(ok)
 
55
  ],
 
56
  [
 
57
    # program could not be run
 
58
    AC_MSG_RESULT(failed)
 
59
  ])
 
60
CFLAGS="$CFLAGS_save"
 
61
LIBS="$LIBS_save"
 
62
])
 
63
 
 
64
dnl ACL_PATH_AVCODEC(BUILD_ID [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
 
65
dnl Test for libavcodec, and define AVCODEC_CFLAGS, AVCODEC_LIBS and
 
66
dnl AVCODEC_VERSION
 
67
 
 
68
AC_DEFUN([ACL_PATH_AVCODEC],[
 
69
AC_ARG_WITH(avcodec,[  --with-avcodec=PFX   Prefix where libavcodec is installed (optional)], avcodec_prefix="$withval", avcodec_prefix="")
 
70
dnl We need the _save variables because PKG_CHECK_MODULES will change
 
71
dnl the other variables
 
72
AVCODEC_CFLAGS_save=""
 
73
AVCODEC_LIBS_save=""
 
74
avcodec_done="false"
 
75
 
 
76
AH_TEMPLATE([AVCODEC_HEADER],
 
77
            [Header for libavcodec])
 
78
 
 
79
dnl
 
80
dnl First preference: configure options
 
81
dnl
 
82
 
 
83
if test "x$avcodec_prefix" != x; then
 
84
AVCODEC_CFLAGS="-I$avcodec_prefix/include"
 
85
AVCODEC_LIBS="-L$avcodec_prefix/lib -lavcodec"
 
86
ACL_CHECK_AVCODEC([$1])
 
87
  if test "x$avcodec_ok" = "xtrue"; then
 
88
    avcodec_done="true"
 
89
  fi
 
90
fi
 
91
 
 
92
dnl
 
93
dnl Second Perference: Autodetect
 
94
dnl
 
95
 
 
96
if test "x$avcodec_done" = "xfalse"; then
 
97
  PKG_CHECK_MODULES(AVCODEC, libavcodec, avcodec_orig="true", avcodec_orig="false")
 
98
  ACL_CHECK_AVCODEC([$1])
 
99
  if test "x$avcodec_ok" = "xtrue"; then
 
100
    avcodec_done="true"
 
101
  fi
 
102
fi
 
103
 
 
104
if test "x$avcodec_done" = "xtrue"; then
 
105
  ifelse([$2], , :, [$2])
 
106
  AC_DEFINE_UNQUOTED(AVCODEC_HEADER, $AVCODEC_HEADER)
 
107
else
 
108
  ifelse([$3], , :, [$3])
 
109
fi
 
110
])