~ubuntu-branches/ubuntu/hoary/flac/hoary

« back to all changes in this revision

Viewing changes to src/libOggFLAC/libOggFLAC.m4

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2004-04-16 15:14:31 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040416151431-eyloggqxpwbwpogz
Tags: 1.1.0-11
Ensure that libFLAC is linked with -lm on all architectures, and
regardless of whether nasm is present

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Configure paths for libOggFLAC
 
2
# "Inspired" by ogg.m4
 
3
 
 
4
dnl AM_PATH_LIBOGGFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
 
5
dnl Test for libOggFLAC, and define LIBOGGFLAC_CFLAGS and LIBOGGFLAC_LIBS
 
6
dnl
 
7
AC_DEFUN(AM_PATH_LIBOGGFLAC,
 
8
[dnl 
 
9
dnl Get the cflags and libraries
 
10
dnl
 
11
AC_ARG_WITH(libOggFLAC,[  --with-libOggFLAC=PFX   Prefix where libOggFLAC is installed (optional)], libOggFLAC_prefix="$withval", libOggFLAC_prefix="")
 
12
AC_ARG_WITH(libOggFLAC-libraries,[  --with-libOggFLAC-libraries=DIR   Directory where libOggFLAC library is installed (optional)], libOggFLAC_libraries="$withval", libOggFLAC_libraries="")
 
13
AC_ARG_WITH(libOggFLAC-includes,[  --with-libOggFLAC-includes=DIR   Directory where libOggFLAC header files are installed (optional)], libOggFLAC_includes="$withval", libOggFLAC_includes="")
 
14
AC_ARG_ENABLE(libOggFLACtest, [  --disable-libOggFLACtest       Do not try to compile and run a test libOggFLAC program],, enable_libOggFLACtest=yes)
 
15
 
 
16
  if test "x$libOggFLAC_libraries" != "x" ; then
 
17
    LIBOGGFLAC_LIBS="-L$libOggFLAC_libraries"
 
18
  elif test "x$libOggFLAC_prefix" != "x" ; then
 
19
    LIBOGGFLAC_LIBS="-L$libOggFLAC_prefix/lib"
 
20
  elif test "x$prefix" != "xNONE" ; then
 
21
    LIBOGGFLAC_LIBS="-L$prefix/lib"
 
22
  fi
 
23
 
 
24
  LIBOGGFLAC_LIBS="$LIBOGGFLAC_LIBS -lOggFLAC -lFLAC -lm"
 
25
 
 
26
  if test "x$libOggFLAC_includes" != "x" ; then
 
27
    LIBOGGFLAC_CFLAGS="-I$libOggFLAC_includes"
 
28
  elif test "x$libOggFLAC_prefix" != "x" ; then
 
29
    LIBOGGFLAC_CFLAGS="-I$libOggFLAC_prefix/include"
 
30
  elif test "$prefix" != "xNONE"; then
 
31
    LIBOGGFLAC_CFLAGS="-I$prefix/include"
 
32
  fi
 
33
 
 
34
  AC_MSG_CHECKING(for libOggFLAC)
 
35
  no_libOggFLAC=""
 
36
 
 
37
 
 
38
  if test "x$enable_libOggFLACtest" = "xyes" ; then
 
39
    ac_save_CFLAGS="$CFLAGS"
 
40
    ac_save_CXXFLAGS="$CXXFLAGS"
 
41
    ac_save_LIBS="$LIBS"
 
42
    CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS"
 
43
    CXXFLAGS="$CXXFLAGS $LIBOGGFLAC_CFLAGS"
 
44
    LIBS="$LIBS $LIBOGGFLAC_LIBS"
 
45
dnl
 
46
dnl Now check if the installed libOggFLAC is sufficiently new.
 
47
dnl
 
48
      rm -f conf.libOggFLACtest
 
49
      AC_TRY_RUN([
 
50
#include <stdio.h>
 
51
#include <stdlib.h>
 
52
#include <string.h>
 
53
#include <OggFLAC/stream_decoder.h>
 
54
 
 
55
int main ()
 
56
{
 
57
  system("touch conf.libOggFLACtest");
 
58
  return 0;
 
59
}
 
60
 
 
61
],, no_libOggFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
 
62
       CFLAGS="$ac_save_CFLAGS"
 
63
       LIBS="$ac_save_LIBS"
 
64
  fi
 
65
 
 
66
  if test "x$no_libOggFLAC" = "x" ; then
 
67
     AC_MSG_RESULT(yes)
 
68
     ifelse([$1], , :, [$1])     
 
69
  else
 
70
     AC_MSG_RESULT(no)
 
71
     if test -f conf.libOggFLACtest ; then
 
72
       :
 
73
     else
 
74
       echo "*** Could not run libOggFLAC test program, checking why..."
 
75
       CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS"
 
76
       LIBS="$LIBS $LIBOGGFLAC_LIBS"
 
77
       AC_TRY_LINK([
 
78
#include <stdio.h>
 
79
#include <OggFLAC/stream_decoder.h>
 
80
],     [ return 0; ],
 
81
       [ echo "*** The test program compiled, but did not run. This usually means"
 
82
       echo "*** that the run-time linker is not finding libOggFLAC or finding the wrong"
 
83
       echo "*** version of libOggFLAC. If it is not finding libOggFLAC, you'll need to set your"
 
84
       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
 
85
       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
 
86
       echo "*** is required on your system"
 
87
       echo "***"
 
88
       echo "*** If you have an old version installed, it is best to remove it, although"
 
89
       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
 
90
       [ echo "*** The test program failed to compile or link. See the file config.log for the"
 
91
       echo "*** exact error that occured. This usually means libOggFLAC was incorrectly installed"
 
92
       echo "*** or that you have moved libOggFLAC since it was installed. In the latter case, you"
 
93
       echo "*** may want to edit the libOggFLAC-config script: $LIBOGGFLAC_CONFIG" ])
 
94
       CFLAGS="$ac_save_CFLAGS"
 
95
       LIBS="$ac_save_LIBS"
 
96
     fi
 
97
     LIBOGGFLAC_CFLAGS=""
 
98
     LIBOGGFLAC_LIBS=""
 
99
     ifelse([$2], , :, [$2])
 
100
  fi
 
101
  AC_SUBST(LIBOGGFLAC_CFLAGS)
 
102
  AC_SUBST(LIBOGGFLAC_LIBS)
 
103
  rm -f conf.libOggFLACtest
 
104
])