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