liblame check from autostars
[platform/upstream/gstreamer.git] / m4 / as-liblame.m4
1 # CFLAGS and library paths for LIBLAME
2 # taken from Autostar Sandbox, http://autostars.sourceforge.net/
3 # inspired by xmms.m4
4
5 dnl Usage:
6 dnl AM_PATH_LIBLAME([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
7 dnl FIXME: version checking does not work currently
8 dnl
9 dnl Example:
10 dnl AM_PATH_LIBLAME(3.89, , AC_MSG_ERROR([*** LIBLAME >= 3.89 not installed)) 
11 dnl
12 dnl Defines LIBLAME_LIBS
13 dnl FIXME: should define LIBLAME_VERSION
14 dnl
15
16 AC_DEFUN(AM_PATH_LIBLAME,
17 [
18   dnl check for the library
19   AC_CHECK_LIB(mp3lame, lame_init, HAVE_LIBLAME=yes, HAVE_LIBLAME=no, -lm)
20   dnl check if lame.h is available in the standard location or not
21   HAVE_LAME_H_STD=no
22   AC_CHECK_HEADER(lame.h, HAVE_LAME_H_STD=no, :)
23   AC_CHECK_HEADER(lame/lame.h, HAVE_LAME_H_STD=yes, :)
24   AC_MSG_CHECKING(for lame.h in right location)
25   if test "x$HAVE_LAME_H_STD" = "xyes"; then
26     AC_MSG_RESULT(yes)
27   else
28     AC_MSG_RESULT(no)
29     HAVE_LIBLAME=no
30     if test "x$HAVE_LAME_H_STD"="xno"; then
31       AC_MSG_WARN(lame.h found in include dir,)
32       AC_MSG_WARN( while it should be in it's own lame/ dir !)
33     fi
34  fi
35
36   dnl now do the actual "do we have it ?" test
37   if test "x$HAVE_LIBLAME" = "xyes"; then
38     LIBLAME_LIBS="-lmp3lame -lm"
39     dnl execute what we have to because it's found
40     ifelse([$2], , :, [$2])
41   else
42     LIBLAME_LIBS=""
43     dnl execute what we have to because it's not found
44     ifelse([$3], , :, [$3])
45   fi
46
47   dnl make variables available
48   AC_SUBST(LIBLAME_LIBS)
49   AC_SUBST(HAVE_LIBLAME)
50 ])