Skip to content

Commit

Permalink
BUILD: Move libfaad checking into ax_check_faad.m4
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Dec 14, 2013
1 parent c1120ee commit 49b2b3b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 11 deletions.
12 changes: 1 addition & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,7 @@ dnl SDL2
AX_CHECK_SDL2(2000, , AC_MSG_ERROR([SDL2 (>= 2.0.0) is required and could not be found!]))

dnl faad
AC_CHECK_HEADER("neaacdec.h", , nolibfaad=1)

if test -n "$nolibfaad"; then
AC_MSG_ERROR([libfaad is required and could not be found])
fi

FAAD_CFLAGS=""
FAAD_LIBS="-lfaad"
AX_CHECK_FAAD(, AC_MSG_ERROR([libfaad is required and could not be found!]))

dnl MAD
AC_CHECK_HEADER("mad.h", , nolibmad=1)
Expand Down Expand Up @@ -196,9 +189,6 @@ AC_SUBST(GL_LIBS)
AC_SUBST(AL_CFLAGS)
AC_SUBST(AL_LIBS)

AC_SUBST(FAAD_CFLAGS)
AC_SUBST(FAAD_LIBS)

AC_SUBST(MAD_CFLAGS)
AC_SUBST(MAD_LIBS)

Expand Down
44 changes: 44 additions & 0 deletions m4/ax_check_faad.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
dnl @synopsis AX_CHECK_FAAD(action-if, action-if-not)
dnl
dnl @summary check for libfaad
dnl
dnl Defines FAAD_LIBS, FAAD_CFLAGS.
dnl
dnl @category InstalledPackages
dnl @author Sven Hesse <drmccoy@drmccoy.de>
dnl @version 2013-12-14
dnl @license AllPermissive

AC_DEFUN([AX_CHECK_FAAD], [
AC_ARG_VAR(FAAD_CFLAGS, [C compiler flags for libfaad])
AC_ARG_VAR(FAAD_LIBS, [libraries to pass to the linker for libfaad])
if test -z "$FAAD_CFLAGS"; then
FAAD_CFLAGS=""
fi
if test -z "$FAAD_LIBS"; then
FAAD_LIBS="-lfaad"
fi
save_CFLAGS="$CFLAGS"
save_CXXFLAGS="$CXXFLAGS"
save_LIBS="$LIBS"
CFLAGS="$CFLAGS $FAAD_CFLAGS"
CXXFLAGS="$CXXFLAGS $FAAD_CFLAGS"
LIBS="$LIBS $FAAD_LIBS"
AC_CHECK_HEADER([neaacdec.h], , nofaad=1)
CFLAGS="$save_CFLAGS"
CXXFLAGS="$save_CXXFLAGS"
LIBS="$save_LIBS"
if test "$nofaad" = "1"; then
ifelse([$2], , :, [$2])
else
ifelse([$1], , :, [$1])
fi
AC_SUBST(FAAD_CFLAGS)
AC_SUBST(FAAD_LIBS)
])

0 comments on commit 49b2b3b

Please sign in to comment.