Mercurial > audlegacy
annotate m4/libFLAC.m4 @ 916:4be0046a09e4 trunk
[svn] - more work here
author | nenolod |
---|---|
date | Wed, 05 Apr 2006 11:07:10 -0700 |
parents | 42380ff32bad |
children |
rev | line source |
---|---|
72 | 1 # For audacious by MSameer |
2 # Configure paths for libFLAC | |
3 # "Inspired" by ogg.m4 | |
4 | |
5 dnl AM_PATH_LIBFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) | |
6 dnl Test for libFLAC, and define LIBFLAC_CFLAGS and LIBFLAC_LIBS | |
7 dnl | |
8 AC_DEFUN([AM_PATH_LIBFLAC], | |
9 [dnl | |
10 dnl Get the cflags and libraries | |
11 dnl | |
12 AC_ARG_WITH(libFLAC,[ --with-libFLAC=PFX Prefix where libFLAC is installed (optional)], libFLAC_prefix="$withval", libFLAC_prefix="") | |
13 AC_ARG_WITH(libFLAC-libraries,[ --with-libFLAC-libraries=DIR Directory where libFLAC library is installed (optional)], libFLAC_libraries="$withval", libFLAC_libraries="") | |
14 AC_ARG_WITH(libFLAC-includes,[ --with-libFLAC-includes=DIR Directory where libFLAC header files are installed (optional)], libFLAC_includes="$withval", libFLAC_includes="") | |
523
42380ff32bad
[svn] updated configure.ac and macros; added amidi-plug and conditions for timidity compilation
giacomo
parents:
72
diff
changeset
|
15 AC_ARG_ENABLE(libFLACtest, [ --disable-libFLACtest do not try to compile and run a test libFLAC program],, enable_libFLACtest=yes) |
72 | 16 |
17 if test "x$libFLAC_libraries" != "x" ; then | |
18 LIBFLAC_LIBS="-L$libFLAC_libraries" | |
19 elif test "x$libFLAC_prefix" != "x" ; then | |
20 LIBFLAC_LIBS="-L$libFLAC_prefix/lib" | |
21 elif test "x$prefix" != "xNONE" ; then | |
22 LIBFLAC_LIBS="-L$libdir" | |
23 fi | |
24 | |
25 LIBFLAC_LIBS="$LIBFLAC_LIBS -lFLAC -lm" | |
26 | |
27 if test "x$libFLAC_includes" != "x" ; then | |
28 LIBFLAC_CFLAGS="-I$libFLAC_includes" | |
29 elif test "x$libFLAC_prefix" != "x" ; then | |
30 LIBFLAC_CFLAGS="-I$libFLAC_prefix/include" | |
31 elif test "$prefix" != "xNONE"; then | |
32 LIBFLAC_CFLAGS="-I$prefix/include" | |
33 fi | |
34 | |
35 AC_MSG_CHECKING(for libFLAC >= 1.1.2) | |
36 no_libFLAC="" | |
37 | |
38 | |
39 if test "x$enable_libFLACtest" = "xyes" ; then | |
40 ac_save_CFLAGS="$CFLAGS" | |
41 ac_save_CXXFLAGS="$CXXFLAGS" | |
42 ac_save_LIBS="$LIBS" | |
43 CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" | |
44 CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS" | |
45 LIBS="$LIBS $LIBFLAC_LIBS" | |
46 dnl | |
47 dnl Now check if the installed libFLAC is sufficiently new. | |
48 dnl | |
49 rm -f conf.libFLACtest | |
50 AC_TRY_RUN([ | |
51 #include <stdio.h> | |
52 #include <stdlib.h> | |
53 #include <string.h> | |
54 #include <FLAC/all.h> | |
55 | |
56 int main () | |
57 { | |
58 FLAC__format_vorbiscomment_entry_name_is_legal("foo"); | |
59 system("touch conf.libFLACtest"); | |
60 return 0; | |
61 } | |
62 | |
63 ],, no_libFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
64 CFLAGS="$ac_save_CFLAGS" | |
65 LIBS="$ac_save_LIBS" | |
66 fi | |
67 | |
68 if test "x$no_libFLAC" = "x" ; then | |
69 AC_MSG_RESULT(yes) | |
70 ifelse([$1], , :, [$1]) | |
71 else | |
72 AC_MSG_RESULT(no) | |
73 if test -f conf.libFLACtest ; then | |
74 : | |
75 else | |
76 echo "*** Could not run libFLAC test program, checking why..." | |
77 CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" | |
78 LIBS="$LIBS $LIBFLAC_LIBS" | |
79 AC_TRY_LINK([ | |
80 #include <stdio.h> | |
81 #include <FLAC/format.h> | |
82 ], [ return 0; ], | |
83 [ echo "*** The test program compiled, but did not run. This usually means" | |
84 echo "*** that the run-time linker is not finding libFLAC or finding the wrong" | |
85 echo "*** version of libFLAC. If it is not finding libFLAC, you'll need to set your" | |
86 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
87 echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
88 echo "*** is required on your system" | |
89 echo "***" | |
90 echo "*** If you have an old version installed, it is best to remove it, although" | |
91 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], | |
92 [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
93 echo "*** exact error that occured. This usually means libFLAC was incorrectly installed" | |
94 echo "*** or that you have moved libFLAC since it was installed. In the latter case, you" | |
95 echo "*** may want to edit the libFLAC-config script: $LIBFLAC_CONFIG" ]) | |
96 CFLAGS="$ac_save_CFLAGS" | |
97 LIBS="$ac_save_LIBS" | |
98 fi | |
99 LIBFLAC_CFLAGS="" | |
100 LIBFLAC_LIBS="" | |
101 ifelse([$2], , :, [$2]) | |
102 fi | |
103 AC_SUBST(LIBFLAC_CFLAGS) | |
104 AC_SUBST(LIBFLAC_LIBS) | |
105 rm -f conf.libFLACtest | |
106 ]) |