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