annotate m4/libFLAC.m4 @ 731:9783edaae2b5 trunk

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