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