[xiph-cvs] cvs commit: libshout shout.m4
Brendan
brendan at xiph.org
Thu Jun 12 21:26:23 PDT 2003
brendan 03/06/13 00:26:23
Modified: . shout.m4
Log:
shout.m4 has been completely rewritten for libshout 2.
It relies on pkg-config or shout-config (in that order) for compiler/linker
flags. --with-shout-prefix is gone. Also gone is --disable-shouttest. I don't
understand the advantages of that home built script over the standard header/
func checks, so I used those. I guess AC_TRY_RUN isn't invoked, but I feel
(mildly) that the business of autoconf is to ensure the program builds
correctly, not runs correctly. Run errors can usually be fixed after the build
(by tweaking LD_LIBRARY_PATH, ld.so.conf, crle etc) without rebuilding.
I've ported ices 0 to this macro in order to test it, but haven't put the various
fallbacks through the ringer yet. I will before release.
TODO: I don't think this file is being included with make dist. Should it be?
Probably. Should it be installed? Probably, but less so.
Revision Changes Path
1.6 +51 -91 libshout/shout.m4
Index: shout.m4
===================================================================
RCS file: /usr/local/cvsroot/libshout/shout.m4,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -u -r1.5 -r1.6
--- shout.m4 18 Aug 2002 05:48:49 -0000 1.5
+++ shout.m4 13 Jun 2003 04:26:23 -0000 1.6
@@ -1,99 +1,59 @@
-# Configure paths for libshout
-# Jack Moffitt <jack at icecast.org> 08-06-2001
-# Shamelessly stolen from Owen Taylor and Manish Singh
-
-dnl AM_PATH_SHOUT([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-dnl Test for libshout, and define SHOUT_CFLAGS and SHOUT_LIBS
-dnl
-AC_DEFUN(AM_PATH_SHOUT,
-[dnl
-dnl Get the cflags and libraries
+dnl XIPH_PATH_SHOUT
+dnl Jack Moffitt <jack at icecast.org> 08-06-2001
+dnl Rewritten for libshout 2
+dnl Brendan Cully <brendan at xiph.org> 20030612
dnl
-AC_ARG_WITH(shout-prefix,[ --with-shout-prefix=PFX Prefix where libshout is installed (optional)], shout_prefix="$withval", shout_prefix="")
-AC_ARG_ENABLE(shouttest, [ --disable-shouttest Do not try to compile and run a test Shout program],, enable_shouttest=yes)
-
- if test "x$shout_prefix" != "xNONE" ; then
- shout_args="$shout_args --prefix=$shout_prefix"
- SHOUT_CFLAGS="-I$shout_prefix/include"
- SHOUT_LIBS="-L$shout_prefix/lib"
- elif test "$prefix" != ""; then
- shout_args="$shout_args --prefix=$prefix"
- SHOUT_CFLAGS="-I$prefix/include"
- SHOUT_LIBS="-L$prefix/lib"
+# XIPH_PATH_SHOUT([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+# Test for libshout, and define SHOUT_CFLAGS and SHOUT_LIBS
+AC_DEFUN([XIPH_PATH_SHOUT],
+[dnl
+have_shout="no"
+SHOUT_CFLAGS=""
+SHOUT_LIBS=""
+
+# Step 1: Use pkg-config if available
+m4_ifdef([PKG_CHECK_MODULES],
+ [# PKG_CHECK_MODULES available
+ PKG_CHECK_MODULES([SHOUT], [shout >= 2.0])
+ have_shout="maybe"],
+ [# PKG_CHECK_MODULES is unavailable, search for pkg-config program
+ AC_PATH_PROG([PKGCONFIG], [pkg-config], [none])
+ if test "$PKGCONFIG" != "none" && `$PKGCONFIG --exists 'shout >= 2.0'`
+ then
+ SHOUT_CFLAGS=`$PKGCONFIG --cflags`
+ SHOUT_LIBS=`$PKGCONFIG --libs`
+ have_shout="maybe"
+ else
+ # Step 2: try shout-config
+ AC_PATH_PROG([SHOUTCONFIG], [shout-config], [none])
+ if test "$SHOUTCONFIG" != "none" -a `$SHOUTCONFIG --package` = "libshout"
+ then
+ SHOUT_CFLAGS=`$SHOUTCONFIG --cflags`
+ SHOUT_LIBS=`$SHOUTCONFIG --libs`
+ have_shout="maybe"
+ fi
fi
- SHOUT_LIBS="$SHOUT_LIBS -lshout -lpthread"
-
- case $host in
- *-*-solaris*)
- SHOUT_LIBS="$SHOUT_LIBS -lnsl -lsocket -lresolv"
- esac
-
- AC_MSG_CHECKING(for Shout)
- no_shout=""
-
- if test "x$enable_shouttest" = "xyes" ; then
+ if test "$have_shout" != "no"
+ then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $SHOUT_CFLAGS $OGG_CFLAGS $VORBIS_CFLAGS"
- LIBS="$LIBS $SHOUT_LIBS $OGG_LIBS $VORBIS_LIBS"
-dnl
-dnl Now check if the installed Shout is sufficiently new.
-dnl
- rm -f conf.shouttest
- AC_TRY_RUN([
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <shout/shout.h>
-
-int main ()
-{
- system("touch conf.shouttest");
- return 0;
-}
-
-],, no_shout=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
+ CFLAGS="$CFLAGS $SHOUT_CFLAGS"
+ LIBS="$LIBS $SHOUT_LIBS"
+ AC_CHECK_HEADER([shout/shout.h], [
+ AC_DEFINE([HAVE_SHOUT_SHOUT_H], 1, [Define if you have <shout/shout.h>])
+ AC_CHECK_FUNC([shout_new], [
+ ifelse([$1], , :, [$1])
+ have_shout="yes"
+ ])
+ ])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
fi
- if test "x$no_shout" = "x" ; then
- AC_MSG_RESULT(yes)
- ifelse([$1], , :, [$1])
- else
- AC_MSG_RESULT(no)
- if test -f conf.shouttest ; then
- :
- else
- echo "*** Could not run Shout test program, checking why..."
- CFLAGS="$CFLAGS $SHOUT_CFLAGS $OGG_CFLAGS $VORBIS_CFLAGS"
- LIBS="$LIBS $SHOUT_LIBS $OGG_LIBS $VORBIS_LIBS"
- AC_TRY_LINK([
-#include <stdio.h>
-#include <shout/shout.h>
-], [ return 0; ],
- [ echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding Shout or finding the wrong"
- echo "*** version of Shout. If it is not finding Shout, 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 Shout was incorrectly installed"
- echo "*** or that you have moved Shout since it was installed. In the latter case, you"
- echo "*** may want to edit the shout-config script: $SHOUT_CONFIG" ])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- SHOUT_CFLAGS=""
- SHOUT_LIBS=""
- ifelse([$2], , :, [$2])
+ if test "$have_shout" != "yes"
+ then
+ ifelse([$2], , :, [$2])
fi
- AC_SUBST(SHOUT_CFLAGS)
- AC_SUBST(SHOUT_LIBS)
- rm -f conf.shouttest
-])
+ ])
+])dnl XIPH_PATH_SHOUT
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list