File: avformat.m4

package info (click to toggle)
gmerlin-encoders 1.2.0-10
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid
  • size: 3,460 kB
  • sloc: ansic: 11,619; sh: 11,014; makefile: 203; sed: 16
file content (104 lines) | stat: -rw-r--r-- 2,624 bytes parent folder | download | duplicates (9)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Configure paths for libavformat
# Burkhard Plaum, 2004-08-12

dnl Compile an avformat test program and figure out the version

AC_DEFUN([ACL_CHECK_AVFORMAT],[
AC_MSG_CHECKING([for build ID in libavformat, libs: $AVFORMAT_LIBS])
CFLAGS_save=$CFLAGS
LIBS_save=$LIBS

dnl Look for header
found_header="false"

CFLAGS="$CFLAGS $GMERLIN_DEP_CFLAGS $AVFORMAT_CFLAGS"
LIBS="$LIBS $GMERLIN_DEP_LIBS"

AC_TRY_COMPILE([
#include <libavformat/avformat.h>],[], [found_header="true";AVFORMAT_HEADER="<libavformat/avformat.h>" ],)

if test $found_header = "false"; then
AC_TRY_COMPILE([
#include <ffmpeg/avformat.h>],[], [found_header="true";AVFORMAT_HEADER="<ffmpeg/avformat.h>" ],)
fi

if test $found_header = "false"; then
AC_TRY_COMPILE([
#include <avformat.h>],[],[found_header="true";AVFORMAT_HEADER="<avformat.h>"])
fi

avformat_ok="false"
AC_TRY_RUN([
    #include <stdio.h>
    #include $AVFORMAT_HEADER
    int main()
    {
    FILE * output;
    if(LIBAVFORMAT_BUILD < $1)
      return -1;
    output=fopen("avformat_version", "w");
    fprintf(output, AV_TOSTRING(LIBAVFORMAT_VERSION));
    fclose(output);
    return 0;
    }
  ],
  [
    # program could be run
    if test "x$AVFORMAT_VERSION" = "x"; then 
      AVFORMAT_VERSION=`cat avformat_version`
    fi
    rm -f avformat_version
    avformat_ok="true"
    AC_MSG_RESULT(ok)
  ],
  [
    # program could not be run
    AC_MSG_RESULT(failed)
  ])
CFLAGS="$CFLAGS_save"
LIBS="$LIBS_save"
])

dnl ACL_PATH_AVFORMAT(BUILD_ID [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for libavformat, and define AVFORMAT_CFLAGS, AVFORMAT_LIBS and
dnl AVFORMAT_VERSION

AC_DEFUN([ACL_PATH_AVFORMAT],[
AC_ARG_WITH(avformat,[  --with-avformat=PFX   Prefix where libavformat is installed (optional)], avformat_prefix="$withval", avformat_prefix="")
dnl We need the _save variables because PKG_CHECK_MODULES will change
dnl the other variables
AVFORMAT_CFLAGS_save=""
AVFORMAT_LIBS_save=""
avformat_done="false"

dnl
dnl First preference: configure options
dnl

if test "x$avformat_prefix" != x; then
AVFORMAT_CFLAGS="-I$avformat_prefix/include"
AVFORMAT_LIBS="-L$avformat_prefix/lib -lavformat"
ACL_CHECK_AVFORMAT([$1])
  if test "x$avformat_ok" = "xtrue"; then
    avformat_done="true"
  fi
fi

dnl
dnl Second Perference: Autodetect
dnl

if test "x$avformat_done" = "xfalse"; then
  PKG_CHECK_MODULES(AVFORMAT, libavformat, avformat_orig="true", avformat_orig="false")
  ACL_CHECK_AVFORMAT([$1])
  if test "x$avformat_ok" = "xtrue"; then
    avformat_done="true"
  fi
fi

if test "x$avformat_done" = "xtrue"; then
  ifelse([$2], , :, [$2])
else
  ifelse([$3], , :, [$3])
fi
])