1 dnl MPEG2DEC_CHECK-LIBHEADER(FEATURE-NAME, LIB-NAME, LIB-FUNCTION, HEADER-NAME,
2 dnl ACTION-IF-FOUND, ACTION-IF-NOT-FOUND,
3 dnl EXTRA-LDFLAGS, EXTRA-CPPFLAGS)
5 dnl FEATURE-NAME - feature name; library and header files are treated
6 dnl as feature, which we look for
7 dnl LIB-NAME - library name as in AC_CHECK_LIB macro
8 dnl LIB-FUNCTION - library symbol as in AC_CHECK_LIB macro
9 dnl HEADER-NAME - header file name as in AC_CHECK_HEADER
10 dnl ACTION-IF-FOUND - when feature is found then execute given action
11 dnl ACTION-IF-NOT-FOUND - when feature is not found then execute given action
12 dnl EXTRA-LDFLAGS - extra linker flags (-L or -l)
13 dnl EXTRA-CPPFLAGS - extra C preprocessor flags, i.e. -I/usr/X11R6/include
15 dnl Based on GST_CHECK_LIBHEADER from gstreamer plugins 0.3.1.
17 AC_DEFUN(MPEG2DEC_CHECK_LIBHEADER,
19 AC_CHECK_LIB([$2], [$3], HAVE_[$1]=yes, HAVE_[$1]=no, [$7])
20 check_libheader_feature_name=translit([$1], A-Z, a-z)
22 if test "x$HAVE_[$1]" = "xyes"; then
23 check_libheader_save_CPPFLAGS=$CPPFLAGS
24 CPPFLAGS="[$8] $CPPFLAGS"
25 AC_CHECK_HEADER([$4], :, HAVE_[$1]=no)
26 CPPFLAGS=$check_libheader_save_CPPFLAGS
29 if test "x$HAVE_[$1]" = "xyes"; then
30 ifelse([$5], , :, [$5])
32 ifelse([$6], , :, [$6])
38 dnl AC_CHECK_MPEG2DEC(ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
40 dnl ACTION-IF-FOUND - when feature is found then execute given action
41 dnl ACTION-IF-NOT-FOUND - when feature is not found then execute given action
43 dnl Defines HAVE_MPEG2DEC to yes if mpeg2dec is found
45 dnl CFLAGS and LDFLAGS for the library are stored in MPEG2DEC_CFLAGS and
46 dnl MPEG2DEC_LIBS, respectively
48 dnl Based on GST_CHECK_MPEG2DEC from gstreamer plugins 0.3.3.1
49 dnl Thomas Vander Stichele <thomas@apestaart.org>, Andy Wingo <wingo@pobox.com>
51 AC_DEFUN(AC_CHECK_MPEG2DEC,
53 AC_ARG_WITH(mpeg2dec-prefix,
54 AC_HELP_STRING([--with-mpeg2dec-prefix=PFX],
55 [prefix where mpeg2dec is installed (optional)]),
56 mpeg2dec_config_prefix="$withval", mpeg2dec_config_prefix="")
58 if test x$mpeg2dec_config_prefix = x ; then
59 MPEG2DEC_CHECK_LIBHEADER(MPEG2DEC, mpeg2, mpeg2_init, mpeg2dec/mpeg2.h,
60 MPEG2DEC_LIBS="-lmpeg2 -lcpuaccel",, -lcpuaccel)
62 MPEG2DEC_CHECK_LIBHEADER(MPEG2DEC, mpeg2, mpeg2_init, mpeg2dec/mpeg2.h, [
63 MPEG2DEC_LIBS="-lmpeg2 -lcpuaccel -L$mpeg2dec_config_prefix/lib"
64 MPEG2DEC_CFLAGS="-I$mpeg2dec_config_prefix/include"
65 ], , -L$mpeg2dec_config_prefix/lib -lcpuaccel, -I$mpeg2dec_config_prefix/include)
68 if test "x$HAVE_MPEG2DEC" = "xyes"; then
69 ifelse([$1], , :, [$1])
71 ifelse([$2], , :, [$2])
74 AC_SUBST(MPEG2DEC_CFLAGS)
75 AC_SUBST(MPEG2DEC_LIBS)