Blame m4/ogg.m4

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