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