Blame acinclude.m4

Packit a38265
# Configure paths for libogg
Packit a38265
# Jack Moffitt <jack@icecast.org> 10-21-2000
Packit a38265
# Shamelessly stolen from Owen Taylor and Manish Singh
Packit a38265
Packit a38265
dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
Packit a38265
dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
Packit a38265
dnl
Packit a38265
AC_DEFUN([XIPH_PATH_OGG],
Packit a38265
[dnl 
Packit a38265
dnl Get the cflags and libraries
Packit a38265
dnl
Packit a38265
AC_ARG_WITH(ogg,AC_HELP_STRING([--with-ogg=PFX],[Prefix where libogg is installed (optional)]), ogg_prefix="$withval", ogg_prefix="")
Packit a38265
AC_ARG_WITH(ogg-libraries,AC_HELP_STRING([--with-ogg-libraries=DIR],[Directory where libogg library is installed (optional)]), ogg_libraries="$withval", ogg_libraries="")
Packit a38265
AC_ARG_WITH(ogg-includes,AC_HELP_STRING([--with-ogg-includes=DIR],[Directory where libogg header files are installed (optional)]), ogg_includes="$withval", ogg_includes="")
Packit a38265
AC_ARG_ENABLE(oggtest,AC_HELP_STRING([--disable-oggtest],[Do not try to compile and run a test Ogg program]),, enable_oggtest=yes)
Packit a38265
Packit a38265
  if test "x$ogg_libraries" != "x" ; then
Packit a38265
    OGG_LIBS="-L$ogg_libraries"
Packit a38265
  elif test "x$ogg_prefix" = "xno" || test "x$ogg_prefix" = "xyes" ; then
Packit a38265
    OGG_LIBS=""
Packit a38265
  elif test "x$ogg_prefix" != "x" ; then
Packit a38265
    OGG_LIBS="-L$ogg_prefix/lib"
Packit a38265
  elif test "x$prefix" != "xNONE" ; then
Packit a38265
    OGG_LIBS="-L$prefix/lib"
Packit a38265
  fi
Packit a38265
Packit a38265
  if test "x$ogg_prefix" != "xno" ; then
Packit a38265
    OGG_LIBS="$OGG_LIBS -logg"
Packit a38265
  fi
Packit a38265
Packit a38265
  if test "x$ogg_includes" != "x" ; then
Packit a38265
    OGG_CFLAGS="-I$ogg_includes"
Packit a38265
  elif test "x$ogg_prefix" = "xno" || test "x$ogg_prefix" = "xyes" ; then
Packit a38265
    OGG_CFLAGS=""
Packit a38265
  elif test "x$ogg_prefix" != "x" ; then
Packit a38265
    OGG_CFLAGS="-I$ogg_prefix/include"
Packit a38265
  elif test "x$prefix" != "xNONE"; then
Packit a38265
    OGG_CFLAGS="-I$prefix/include"
Packit a38265
  fi
Packit a38265
Packit a38265
  AC_MSG_CHECKING(for Ogg)
Packit a38265
  if test "x$ogg_prefix" = "xno" ; then
Packit a38265
    no_ogg="disabled"
Packit a38265
    enable_oggtest="no"
Packit a38265
  else
Packit a38265
    no_ogg=""
Packit a38265
  fi
Packit a38265
Packit a38265
Packit a38265
  if test "x$enable_oggtest" = "xyes" ; then
Packit a38265
    ac_save_CFLAGS="$CFLAGS"
Packit a38265
    ac_save_LIBS="$LIBS"
Packit a38265
    CFLAGS="$CFLAGS $OGG_CFLAGS"
Packit a38265
    LIBS="$LIBS $OGG_LIBS"
Packit a38265
dnl
Packit a38265
dnl Now check if the installed Ogg is sufficiently new.
Packit a38265
dnl
Packit a38265
      rm -f conf.oggtest
Packit a38265
      AC_TRY_RUN([
Packit a38265
#include <stdio.h>
Packit a38265
#include <stdlib.h>
Packit a38265
#include <string.h>
Packit a38265
#include <ogg/ogg.h>
Packit a38265
Packit a38265
int main ()
Packit a38265
{
Packit a38265
  system("touch conf.oggtest");
Packit a38265
  return 0;
Packit a38265
}
Packit a38265
Packit a38265
],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
Packit a38265
       CFLAGS="$ac_save_CFLAGS"
Packit a38265
       LIBS="$ac_save_LIBS"
Packit a38265
  fi
Packit a38265
Packit a38265
  if test "x$no_ogg" = "xdisabled" ; then
Packit a38265
     AC_MSG_RESULT(no)
Packit a38265
     ifelse([$2], , :, [$2])
Packit a38265
  elif test "x$no_ogg" = "x" ; then
Packit a38265
     AC_MSG_RESULT(yes)
Packit a38265
     ifelse([$1], , :, [$1])
Packit a38265
  else
Packit a38265
     AC_MSG_RESULT(no)
Packit a38265
     if test -f conf.oggtest ; then
Packit a38265
       :
Packit a38265
     else
Packit a38265
       echo "*** Could not run Ogg test program, checking why..."
Packit a38265
       CFLAGS="$CFLAGS $OGG_CFLAGS"
Packit a38265
       LIBS="$LIBS $OGG_LIBS"
Packit a38265
       AC_TRY_LINK([
Packit a38265
#include <stdio.h>
Packit a38265
#include <ogg/ogg.h>
Packit a38265
],     [ return 0; ],
Packit a38265
       [ echo "*** The test program compiled, but did not run. This usually means"
Packit a38265
       echo "*** that the run-time linker is not finding Ogg or finding the wrong"
Packit a38265
       echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
Packit a38265
       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
Packit a38265
       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
Packit a38265
       echo "*** is required on your system"
Packit a38265
       echo "***"
Packit a38265
       echo "*** If you have an old version installed, it is best to remove it, although"
Packit a38265
       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
Packit a38265
       [ echo "*** The test program failed to compile or link. See the file config.log for the"
Packit a38265
       echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
Packit a38265
       echo "*** or that you have moved Ogg since it was installed." ])
Packit a38265
       CFLAGS="$ac_save_CFLAGS"
Packit a38265
       LIBS="$ac_save_LIBS"
Packit a38265
     fi
Packit a38265
     OGG_CFLAGS=""
Packit a38265
     OGG_LIBS=""
Packit a38265
     ifelse([$2], , :, [$2])
Packit a38265
  fi
Packit a38265
  AC_SUBST(OGG_CFLAGS)
Packit a38265
  AC_SUBST(OGG_LIBS)
Packit a38265
  rm -f conf.oggtest
Packit a38265
])