[16] | 1 | # acinclude.m4 |
---|
| 2 | # all .m4 files needed that might not be installed go here |
---|
| 3 | |
---|
| 4 | # Configure paths for libogg |
---|
| 5 | # Jack Moffitt <jack@icecast.org> 10-21-2000 |
---|
| 6 | # Shamelessly stolen from Owen Taylor and Manish Singh |
---|
| 7 | |
---|
| 8 | dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) |
---|
| 9 | dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS |
---|
| 10 | dnl |
---|
| 11 | AC_DEFUN([XIPH_PATH_OGG], |
---|
| 12 | [dnl |
---|
| 13 | dnl Get the cflags and libraries |
---|
| 14 | dnl |
---|
| 15 | AC_ARG_WITH(ogg,[ --with-ogg=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="") |
---|
| 16 | AC_ARG_WITH(ogg-libraries,[ --with-ogg-libraries=DIR Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="") |
---|
| 17 | AC_ARG_WITH(ogg-includes,[ --with-ogg-includes=DIR Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="") |
---|
| 18 | AC_ARG_ENABLE(oggtest, [ --disable-oggtest Do not try to compile and run a test Ogg program],, enable_oggtest=yes) |
---|
| 19 | |
---|
| 20 | if test "x$ogg_libraries" != "x" ; then |
---|
| 21 | OGG_LIBS="-L$ogg_libraries" |
---|
| 22 | elif test "x$ogg_prefix" != "x" ; then |
---|
| 23 | OGG_LIBS="-L$ogg_prefix/lib" |
---|
| 24 | elif test "x$prefix" != "xNONE" ; then |
---|
| 25 | OGG_LIBS="-L$prefix/lib" |
---|
| 26 | fi |
---|
| 27 | |
---|
| 28 | OGG_LIBS="$OGG_LIBS -logg" |
---|
| 29 | |
---|
| 30 | if test "x$ogg_includes" != "x" ; then |
---|
| 31 | OGG_CFLAGS="-I$ogg_includes" |
---|
| 32 | elif test "x$ogg_prefix" != "x" ; then |
---|
| 33 | OGG_CFLAGS="-I$ogg_prefix/include" |
---|
| 34 | elif test "x$prefix" != "xNONE"; then |
---|
| 35 | OGG_CFLAGS="-I$prefix/include" |
---|
| 36 | fi |
---|
| 37 | |
---|
| 38 | AC_MSG_CHECKING(for Ogg) |
---|
| 39 | no_ogg="" |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | if test "x$enable_oggtest" = "xyes" ; then |
---|
| 43 | ac_save_CFLAGS="$CFLAGS" |
---|
| 44 | ac_save_LIBS="$LIBS" |
---|
| 45 | CFLAGS="$CFLAGS $OGG_CFLAGS" |
---|
| 46 | LIBS="$LIBS $OGG_LIBS" |
---|
| 47 | dnl |
---|
| 48 | dnl Now check if the installed Ogg is sufficiently new. |
---|
| 49 | dnl |
---|
| 50 | rm -f conf.oggtest |
---|
| 51 | AC_TRY_RUN([ |
---|
| 52 | #include <stdio.h> |
---|
| 53 | #include <stdlib.h> |
---|
| 54 | #include <string.h> |
---|
| 55 | #include <ogg/ogg.h> |
---|
| 56 | |
---|
| 57 | int main () |
---|
| 58 | { |
---|
| 59 | system("touch conf.oggtest"); |
---|
| 60 | return 0; |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
---|
| 64 | CFLAGS="$ac_save_CFLAGS" |
---|
| 65 | LIBS="$ac_save_LIBS" |
---|
| 66 | fi |
---|
| 67 | |
---|
| 68 | if test "x$no_ogg" = "x" ; then |
---|
| 69 | AC_MSG_RESULT(yes) |
---|
| 70 | ifelse([$1], , :, [$1]) |
---|
| 71 | else |
---|
| 72 | AC_MSG_RESULT(no) |
---|
| 73 | if test -f conf.oggtest ; then |
---|
| 74 | : |
---|
| 75 | else |
---|
| 76 | echo "*** Could not run Ogg test program, checking why..." |
---|
| 77 | CFLAGS="$CFLAGS $OGG_CFLAGS" |
---|
| 78 | LIBS="$LIBS $OGG_LIBS" |
---|
| 79 | AC_TRY_LINK([ |
---|
| 80 | #include <stdio.h> |
---|
| 81 | #include <ogg/ogg.h> |
---|
| 82 | ], [ return 0; ], |
---|
| 83 | [ echo "*** The test program compiled, but did not run. This usually means" |
---|
| 84 | echo "*** that the run-time linker is not finding Ogg or finding the wrong" |
---|
| 85 | echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your" |
---|
| 86 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
---|
| 87 | echo "*** to the installed location Also, make sure you have run ldconfig if that" |
---|
| 88 | echo "*** is required on your system" |
---|
| 89 | echo "***" |
---|
| 90 | echo "*** If you have an old version installed, it is best to remove it, although" |
---|
| 91 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], |
---|
| 92 | [ echo "*** The test program failed to compile or link. See the file config.log for the" |
---|
| 93 | echo "*** exact error that occured. This usually means Ogg was incorrectly installed" |
---|
| 94 | echo "*** or that you have moved Ogg since it was installed. In the latter case, you" |
---|
| 95 | echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ]) |
---|
| 96 | CFLAGS="$ac_save_CFLAGS" |
---|
| 97 | LIBS="$ac_save_LIBS" |
---|
| 98 | fi |
---|
| 99 | OGG_CFLAGS="" |
---|
| 100 | OGG_LIBS="" |
---|
| 101 | ifelse([$2], , :, [$2]) |
---|
| 102 | fi |
---|
| 103 | AC_SUBST(OGG_CFLAGS) |
---|
| 104 | AC_SUBST(OGG_LIBS) |
---|
| 105 | rm -f conf.oggtest |
---|
| 106 | ]) |
---|
| 107 | |
---|
| 108 | dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) |
---|
| 109 | dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page |
---|
| 110 | dnl also defines GSTUFF_PKG_ERRORS on error |
---|
| 111 | AC_DEFUN([PKG_CHECK_MODULES], [ |
---|
| 112 | succeeded=no |
---|
| 113 | |
---|
| 114 | if test -z "$PKG_CONFIG"; then |
---|
| 115 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
---|
| 116 | fi |
---|
| 117 | |
---|
| 118 | if test "$PKG_CONFIG" = "no" ; then |
---|
| 119 | echo "*** The pkg-config script could not be found. Make sure it is" |
---|
| 120 | echo "*** in your path, or set the PKG_CONFIG environment variable" |
---|
| 121 | echo "*** to the full path to pkg-config." |
---|
| 122 | echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." |
---|
| 123 | else |
---|
| 124 | PKG_CONFIG_MIN_VERSION=0.9.0 |
---|
| 125 | if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then |
---|
| 126 | AC_MSG_CHECKING(for $2) |
---|
| 127 | |
---|
| 128 | if $PKG_CONFIG --exists "$2" ; then |
---|
| 129 | AC_MSG_RESULT(yes) |
---|
| 130 | succeeded=yes |
---|
| 131 | |
---|
| 132 | AC_MSG_CHECKING($1_CFLAGS) |
---|
| 133 | $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` |
---|
| 134 | AC_MSG_RESULT($$1_CFLAGS) |
---|
| 135 | |
---|
| 136 | AC_MSG_CHECKING($1_LIBS) |
---|
| 137 | $1_LIBS=`$PKG_CONFIG --libs "$2"` |
---|
| 138 | AC_MSG_RESULT($$1_LIBS) |
---|
| 139 | else |
---|
| 140 | $1_CFLAGS="" |
---|
| 141 | $1_LIBS="" |
---|
| 142 | ## If we have a custom action on failure, don't print errors, but |
---|
| 143 | ## do set a variable so people can do so. |
---|
| 144 | $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` |
---|
| 145 | ifelse([$4], ,echo $$1_PKG_ERRORS,) |
---|
| 146 | fi |
---|
| 147 | |
---|
| 148 | AC_SUBST($1_CFLAGS) |
---|
| 149 | AC_SUBST($1_LIBS) |
---|
| 150 | else |
---|
| 151 | echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." |
---|
| 152 | echo "*** See http://www.freedesktop.org/software/pkgconfig" |
---|
| 153 | fi |
---|
| 154 | fi |
---|
| 155 | |
---|
| 156 | if test $succeeded = yes; then |
---|
| 157 | ifelse([$3], , :, [$3]) |
---|
| 158 | else |
---|
| 159 | ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) |
---|
| 160 | fi |
---|
| 161 | ]) |
---|