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