2 dnl MPEG2DEC_CHECK-LIBHEADER(FEATURE-NAME, LIB-NAME, LIB-FUNCTION, HEADER-NAME,
3 dnl ACTION-IF-FOUND, ACTION-IF-NOT-FOUND,
4 dnl EXTRA-LDFLAGS, EXTRA-CPPFLAGS)
6 dnl FEATURE-NAME - feature name; library and header files are treated
7 dnl as feature, which we look for
8 dnl LIB-NAME - library name as in AC_CHECK_LIB macro
9 dnl LIB-FUNCTION - library symbol as in AC_CHECK_LIB macro
10 dnl HEADER-NAME - header file name as in AC_CHECK_HEADER
11 dnl ACTION-IF-FOUND - when feature is found then execute given action
12 dnl ACTION-IF-NOT-FOUND - when feature is not found then execute given action
13 dnl EXTRA-LDFLAGS - extra linker flags (-L or -l)
14 dnl EXTRA-CPPFLAGS - extra C preprocessor flags, i.e. -I/usr/X11R6/include
16 dnl Based on GST_CHECK_LIBHEADER from gstreamer plugins 0.3.1.
18 AC_DEFUN(MPEG2DEC_CHECK_LIBHEADER,
20 AC_CHECK_LIB([$2], [$3], HAVE_[$1]=yes, HAVE_[$1]=no, [$7])
21 check_libheader_feature_name=translit([$1], A-Z, a-z)
23 if test "x$HAVE_[$1]" = "xyes"; then
24 check_libheader_save_CPPFLAGS=$CPPFLAGS
25 CPPFLAGS="[$8] $CPPFLAGS"
26 AC_CHECK_HEADER([$4], :, HAVE_[$1]=no)
27 CPPFLAGS=$check_libheader_save_CPPFLAGS
30 if test "x$HAVE_[$1]" = "xyes"; then
31 ifelse([$5], , :, [$5])
33 ifelse([$6], , :, [$6])
39 dnl AC_CHECK_MPEG2DEC(ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
41 dnl ACTION-IF-FOUND - when feature is found then execute given action
42 dnl ACTION-IF-NOT-FOUND - when feature is not found then execute given action
44 dnl Defines HAVE_MPEG2DEC to yes if mpeg2dec is found
46 dnl CFLAGS and LDFLAGS for the library are stored in MPEG2DEC_CFLAGS and
47 dnl MPEG2DEC_LIBS, respectively
49 dnl Based on GST_CHECK_MPEG2DEC from gstreamer plugins 0.3.3.1
50 dnl Thomas Vander Stichele <thomas@apestaart.org>, Andy Wingo <wingo@pobox.com>
52 AC_DEFUN(AC_CHECK_MPEG2DEC,
54 AC_ARG_WITH(mpeg2dec-prefix,
55 [ --with-mpeg2dec-prefix=PFX 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")
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, -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)