From: <ny...@us...> - 2006-06-03 01:16:48
|
Revision: 27 Author: nyaochi Date: 2006-06-02 18:16:42 -0700 (Fri, 02 Jun 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=27&view=rev Log Message: ----------- Added iconv.m4, ogg.m4, vorbis.m4 Modified Paths: -------------- trunk/configure.in Added Paths: ----------- trunk/m4/iconv.m4 trunk/m4/ogg.m4 trunk/m4/vorbis.m4 Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2006-06-03 00:40:44 UTC (rev 26) +++ trunk/configure.in 2006-06-03 01:16:42 UTC (rev 27) @@ -130,76 +130,8 @@ AC_CHECK_LIB(z, uncompress, , [AC_MSG_ERROR(libz not found!)]) dnl Check for iconv library -AC_ARG_WITH( - iconv-header, - [AC_HELP_STRING(--with-iconv-header=DIR, [iconv header directory])], - [CFLAGS="-I$withval ${CFLAGS}"] -) +AM_ICONV -AC_ARG_WITH( - iconv-library, - [AC_HELP_STRING(--with-iconv-library=DIR, [iconv library directory])], - [LDFLAGS="-L$withval ${LDFLAGS}"; with_libiconv=native], - [with_libiconv=maybe] -) - -AC_CHECK_HEADER(iconv.h, , [AC_MSG_ERROR(iconv.h not found!)]) - -found_iconv=no -case $with_libiconv in - maybe) - # Check in the C library first - AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes]) - # Check if we have GNU libiconv - if test $found_iconv = "no"; then - AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes]) - fi - # Check if we have a iconv in -liconv, possibly from vendor - if test $found_iconv = "no"; then - AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes]) - fi - ;; - no) - AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes]) - ;; - gnu|yes) - AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes]) - ;; - native) - echo "native" - echo $LDFLAGS - # Check if we have GNU libiconv - if test $found_iconv = "no"; then - AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes]) - fi - # Check if we have a iconv in -liconv, possibly from vendor - if test $found_iconv = "no"; then - AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes]) - fi - ;; -esac - -if test "x$found_iconv" = "xno" ; then - AC_MSG_ERROR([*** No iconv() implementation found in C library or libiconv]) -fi - -if test x$with_libiconv != xno ; then - case " $INTLLIBS " in - *[[\ \ ]]-liconv[[\ \ ]]*) ;; - *) ICONV_LIBS="-liconv" ;; - esac -fi - -case $with_libiconv in - gnu) - AC_DEFINE(USE_LIBICONV_GNU, 1, [Using GNU libiconv]) - ;; - native) - AC_DEFINE(USE_LIBICONV_NATIVE, 1, [Using a native implementation of iconv in a separate library]) - ;; -esac - - dnl Checks for id3tag AC_ARG_WITH( id3tag-header, @@ -226,66 +158,11 @@ ) dnl Checks for ogg -AC_ARG_WITH( - ogg-header, - [AC_HELP_STRING(--with-ogg-header=DIR, [ogg header directory])], - [CFLAGS="-I$withval ${CFLAGS}"] -) +AM_PATH_OGG -AC_ARG_WITH( - ogg-library, - [AC_HELP_STRING(--with-ogg-library=DIR, [ogg library directory])], - [LDFLAGS="-L$withval ${LDFLAGS}"] -) - -AC_CHECK_HEADER( - ogg/ogg.h, - , - [AC_MSG_ERROR(ogg header not found!)] -) -AC_CHECK_LIB( - ogg, - ogg_stream_init, - [OGG_LIBS="-logg"], - AC_MSG_ERROR([ogg library is not found!]) -) - dnl Checks for vorbis -AC_ARG_WITH( - vorbis-header, - [AC_HELP_STRING(--with-vorbis-header=DIR, [vorbis header directory])], - [CFLAGS="-I$withval ${CFLAGS}"] -) +AM_PATH_VORBIS -AC_ARG_WITH( - vorbis-library, - [AC_HELP_STRING(--with-vorbis-library=DIR, [vorbis library directory])], - [LDFLAGS="-L$withval ${LDFLAGS}"] -) - -AC_CHECK_HEADER( - vorbis/codec.h, - , - [AC_MSG_ERROR(vorbis header not found!)] -) -AC_CHECK_HEADER( - vorbis/vorbisfile.h, - , - [AC_MSG_ERROR(vorbisfile header not found!)] -) -AC_CHECK_LIB( - vorbis, - vorbis_synthesis_init, - [VORBIS_LIBS="-lvorbis"], - AC_MSG_ERROR([vorbis library is not found!]) -) -AC_CHECK_LIB( - vorbisfile, - ov_open, - [VORBISFILE_LIBS="-lvorbisfile"], - AC_MSG_ERROR([vorbisfile library is not found!]) -) - dnl ------------------------------------------------------------------ dnl Check for libsmjs (SpiderMonkey JavaScript engine) dnl ------------------------------------------------------------------ Added: trunk/m4/iconv.m4 =================================================================== --- trunk/m4/iconv.m4 (rev 0) +++ trunk/m4/iconv.m4 2006-06-03 01:16:42 UTC (rev 27) @@ -0,0 +1,69 @@ +#serial AM2 + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + AC_ARG_WITH([libiconv-prefix], +[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ + for dir in `echo "$withval" | tr : ' '`; do + if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi + if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi + done + ]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include <stdlib.h> +#include <iconv.h> +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi + LIBICONV= + if test "$am_cv_lib_iconv" = yes; then + LIBICONV="-liconv" + fi + AC_SUBST(LIBICONV) +]) Added: trunk/m4/ogg.m4 =================================================================== --- trunk/m4/ogg.m4 (rev 0) +++ trunk/m4/ogg.m4 2006-06-03 01:16:42 UTC (rev 27) @@ -0,0 +1,95 @@ +# Configure paths for libogg +# Jack Moffitt <ja...@ic...> 10-21-2000 +# Shamelessly stolen from Owen Taylor and Manish Singh + +dnl AM_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS +dnl +AC_DEFUN([AM_PATH_OGG], +[dnl +dnl Get the cflags and libraries +dnl +AC_ARG_WITH(ogg-prefix, AC_HELP_STRING([--with-ogg-prefix=DIR], [prefix where libogg is installed (optional)]), ogg_prefix="$withval", ogg_prefix="") +AC_ARG_ENABLE(oggtest, AC_HELP_STRING([--disable-oggtest], [do not try to compile and run a test Ogg program]), enable_oggtest=$enableval, enable_oggtest=yes) + + if test x$ogg_prefix != x ; then + ogg_args="$ogg_args --prefix=$ogg_prefix" + OGG_CFLAGS="-I$ogg_prefix/include" + OGG_LIBS="-L$ogg_prefix/$XINE_LIBNAME" + fi + + OGG_LIBS="$OGG_LIBS -logg" + + AC_MSG_CHECKING(for Ogg) + no_ogg="" + + + if test "x$enable_oggtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $OGG_CFLAGS" + LIBS="$LIBS $OGG_LIBS" +dnl +dnl Now check if the installed Ogg is sufficiently new. +dnl + rm -f conf.oggtest + AC_TRY_RUN([ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ogg/ogg.h> + +int main () +{ + system("touch conf.oggtest"); + return 0; +} + +],, no_ogg=yes, + AC_TRY_LINK([ +#include <stdio.h> +#include <ogg/ogg.h> +], [ return 0; ],, no_ogg=yes)) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + + if test "x$no_ogg" = x ; then + AC_MSG_RESULT(yes) + ifelse([$1], , :, [$1]) + else + AC_MSG_RESULT(no) + if test -f conf.oggtest ; then + : + else + echo "*** Could not run Ogg test program, checking why..." + CFLAGS="$CFLAGS $OGG_CFLAGS" + LIBS="$LIBS $OGG_LIBS" + AC_TRY_LINK([ +#include <stdio.h> +#include <ogg/ogg.h> +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding Ogg or finding the wrong" + echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means Ogg was incorrectly installed" + echo "*** or that you have moved Ogg since it was installed. In the latter case, you" + echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + OGG_CFLAGS="" + OGG_LIBS="" + ifelse([$2], , :, [$2]) + fi + AC_SUBST(OGG_CFLAGS) + AC_SUBST(OGG_LIBS) + rm -f conf.oggtest +]) Added: trunk/m4/vorbis.m4 =================================================================== --- trunk/m4/vorbis.m4 (rev 0) +++ trunk/m4/vorbis.m4 2006-06-03 01:16:42 UTC (rev 27) @@ -0,0 +1,100 @@ +# Configure paths for libvorbis +# Jack Moffitt <ja...@ic...> 10-21-2000 +# Shamelessly stolen from Owen Taylor and Manish Singh + +dnl AM_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS +dnl +AC_DEFUN([AM_PATH_VORBIS], +[dnl +dnl Get the cflags and libraries +dnl +AC_ARG_WITH(vorbis-prefix, AC_HELP_STRING([--with-vorbis-prefix=DIR], [prefix where libvorbis is installed (optional)]), vorbis_prefix="$withval", vorbis_prefix="") +AC_ARG_ENABLE(vorbistest, AC_HELP_STRING([--disable-vorbistest], [do not try to compile and run a test Vorbis program]), enable_vorbistest=$enableval, enable_vorbistest=yes) + + if test x$vorbis_prefix != x ; then + vorbis_args="$vorbis_args --prefix=$vorbis_prefix" + VORBIS_CFLAGS="-I$vorbis_prefix/include" + VORBIS_LIBDIR="-L$vorbis_prefix/$XINE_LIBNAME" + fi + + VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm" + VORBISFILE_LIBS="-lvorbisfile" + VORBISENC_LIBS="-lvorbisenc" + + AC_MSG_CHECKING(for Vorbis) + no_vorbis="" + + + if test "x$enable_vorbistest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $VORBIS_CFLAGS" + LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" +dnl +dnl Now check if the installed Vorbis is sufficiently new. +dnl + rm -f conf.vorbistest + AC_TRY_RUN([ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <vorbis/codec.h> + +int main () +{ + system("touch conf.vorbistest"); + return 0; +} + +],, no_vorbis=yes, + AC_TRY_LINK([ +#include <stdio.h> +#include <vorbis/codec.h> +], [ return 0; ],, no_vorbis=yes)) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + + if test "x$no_vorbis" = x ; then + AC_MSG_RESULT(yes) + ifelse([$1], , :, [$1]) + else + AC_MSG_RESULT(no) + if test -f conf.vorbistest ; then + : + else + echo "*** Could not run Vorbis test program, checking why..." + CFLAGS="$CFLAGS $VORBIS_CFLAGS" + LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" + AC_TRY_LINK([ +#include <stdio.h> +#include <vorbis/codec.h> +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding Vorbis or finding the wrong" + echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means Vorbis was incorrectly installed" + echo "*** or that you have moved Vorbis since it was installed." ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + VORBIS_CFLAGS="" + VORBIS_LIBS="" + VORBISFILE_LIBS="" + VORBISENC_LIBS="" + ifelse([$2], , :, [$2]) + fi + AC_SUBST(VORBIS_CFLAGS) + AC_SUBST(VORBIS_LIBS) + AC_SUBST(VORBISFILE_LIBS) + AC_SUBST(VORBISENC_LIBS) + rm -f conf.vorbistest +]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |