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