1dnl 2dnl A52_CHECK-LIBHEADER(FEATURE-NAME, LIB-NAME, LIB-FUNCTION, HEADER-NAME, 3dnl ACTION-IF-FOUND, ACTION-IF-NOT-FOUND, 4dnl EXTRA-LDFLAGS, EXTRA-CPPFLAGS) 5dnl 6dnl FEATURE-NAME - feature name; library and header files are treated 7dnl as feature, which we look for 8dnl LIB-NAME - library name as in AC_CHECK_LIB macro 9dnl LIB-FUNCTION - library symbol as in AC_CHECK_LIB macro 10dnl HEADER-NAME - header file name as in AC_CHECK_HEADER 11dnl ACTION-IF-FOUND - when feature is found then execute given action 12dnl ACTION-IF-NOT-FOUND - when feature is not found then execute given action 13dnl EXTRA-LDFLAGS - extra linker flags (-L or -l) 14dnl EXTRA-CPPFLAGS - extra C preprocessor flags, i.e. -I/usr/X11R6/include 15dnl 16dnl Based on GST_CHECK_LIBHEADER from gstreamer plugins 0.3.1. 17dnl 18AC_DEFUN([A52_CHECK_LIBHEADER], 19[ 20 AC_CHECK_LIB([$2], [$3], HAVE_[$1]=yes, HAVE_[$1]=no, [$7]) 21 check_libheader_feature_name=translit([$1], A-Z, a-z) 22 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 28 fi 29 30 if test "x$HAVE_[$1]" = "xyes"; then 31 ifelse([$5], , :, [$5]) 32 else 33 ifelse([$6], , :, [$6]) 34 fi 35] 36) 37 38dnl 39dnl AC_CHECK_A52DEC(ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) 40dnl 41dnl ACTION-IF-FOUND - when feature is found then execute given action 42dnl ACTION-IF-NOT-FOUND - when feature is not found then execute given action 43dnl 44dnl Defines HAVE_A52DEC to yes if liba52 is found 45dnl 46dnl CFLAGS and LDFLAGS for the library are stored in A52DEC_CFLAGS and 47dnl A52DEC_LIBS, respectively 48dnl 49dnl Based on GST_CHECK_A52DEC from gstreamer plugins 0.3.3.1 50dnl Thomas Vander Stichele <thomas@apestaart.org>, Andy Wingo <wingo@pobox.com> 51dnl 52AC_DEFUN([AC_CHECK_A52DEC], 53[dnl 54AC_ARG_WITH(a52dec-prefix, 55 AC_HELP_STRING([--with-a52dec-prefix=PFX], 56 [prefix where a52dec is installed (optional)]), 57 a52dec_config_prefix="$withval", a52dec_config_prefix="") 58 59if test x$a52dec_config_prefix = x ; then 60 A52_CHECK_LIBHEADER(A52DEC, a52, a52_init, a52dec/a52.h, 61 A52DEC_LIBS="-la52 -lm", , -lm) 62else 63 A52_CHECK_LIBHEADER(A52DEC, a52, a52_init, a52dec/a52.h, [ 64 A52DEC_LIBS="-la52 -L$a52dec_config_prefix/lib -lm" 65 A52DEC_CFLAGS="-I$a52dec_config_prefix/include" 66 ], , -L$a52dec_config_prefix/lib, -I$a52dec_config_prefix/include) 67fi 68 69if test $HAVE_A52DEC = "yes"; then 70 ac_save_CFLAGS="$CFLAGS" 71 ac_save_LIBS="$LIBS" 72 CFLAGS="$CFLAGS $A52DEC_CFLAGS" 73 LIBS="$A52DEC_LIBS $LIBS" 74 AC_TRY_RUN([ 75#include <inttypes.h> 76#include <a52dec/a52.h> 77 78int 79main () 80{ 81 a52_state_t *state; 82 state = a52_init (0); 83 a52_free (state); 84 return 0; 85} 86 ],, HAVE_A52DEC=no, [echo $ac_n "cross compiling; assumed OK... $ac_c"]) 87 88 if test HAVE_A52DEC = "no"; then 89 echo "*** Your a52dec is borked somehow. Please update to 0.7.4." 90 else 91 AC_TRY_RUN([ 92#include <inttypes.h> 93#include <a52dec/a52.h> 94 95int 96main () 97{ 98 int i = sizeof (a52_state_t); 99 if ( i ) 100 return 0; 101} 102 ], HAVE_A52DEC=no,, [echo $ac_n "cross compiling; assumed OK... $ac_c"]) 103 104 if test HAVE_A52DEC = "no"; then 105 echo "*** Your a52dec is too old. Please update to 0.7.4." 106 fi 107 fi 108 CFLAGS="$ac_save_CFLAGS" 109 LIBS="$ac_save_LIBS" 110fi 111 112if test HAVE_A52DEC = "no"; then 113 A52DEC_CFLAGS="" 114 A52DEC_LIBS="" 115fi 116 117if test "x$HAVE_A52DEC" = "xyes"; then 118 ifelse([$1], , :, [$1]) 119else 120 ifelse([$2], , :, [$2]) 121fi 122 123AC_SUBST(A52DEC_CFLAGS) 124AC_SUBST(A52DEC_LIBS) 125]) 126