From 714bd045e7dc5bbd77773d63a2e7fec4bd54a7cd Mon Sep 17 00:00:00 2001
From: dscho <dscho>
Date: Mon, 6 Jun 2005 19:48:38 +0000
Subject: link to libmp3lame only if exists

---
 client_examples/Makefile.am | 6 +++++-
 configure.ac                | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/client_examples/Makefile.am b/client_examples/Makefile.am
index 1a6cdc5..7951d0e 100644
--- a/client_examples/Makefile.am
+++ b/client_examples/Makefile.am
@@ -4,8 +4,12 @@ LDADD = ../libvncclient/libvncclient.a @WSOCKLIB@
 if WITH_FFMPEG
 FFMPEG_HOME=@with_ffmpeg@
 
+if HAVE_MP3LAME
+MP3LAME_LIB=-lmp3lame
+endif
+
 vnc2mpg_CFLAGS=-I$(FFMPEG_HOME)/libavformat -I$(FFMPEG_HOME)/libavcodec
-vnc2mpg_LDADD=$(LDADD) $(FFMPEG_HOME)/libavformat/libavformat.a $(FFMPEG_HOME)/libavcodec/libavcodec.a -lmp3lame -lm
+vnc2mpg_LDADD=$(LDADD) $(FFMPEG_HOME)/libavformat/libavformat.a $(FFMPEG_HOME)/libavcodec/libavcodec.a $(MP3LAME_LIB) -lm
 
 FFMPEG_CLIENT=vnc2mpg
 endif
diff --git a/configure.ac b/configure.ac
index 5f7a1b4..7f19072 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,7 +34,10 @@ AC_ARG_WITH(ffmpeg,
 	[  --with-ffmpeg=dir       set ffmpeg home directory],,)
 AC_SUBST(with_ffmpeg)
 AM_CONDITIONAL(WITH_FFMPEG, test ! -z "$with_ffmpeg")
-
+if test ! -z "$with_ffmpeg"; then
+	AC_CHECK_LIB(mp3lame, lame_init, HAVE_MP3LAME="true", HAVE_MP3LAME="false" )
+fi
+AM_CONDITIONAL(HAVE_MP3LAME, test "$HAVE_MP3LAME" = "true")
 
 # Seem to need this dummy here to induce the 'checking for egrep... grep -E', etc.
 # before it seemed to be inside the with_jpeg conditional. 
-- 
cgit v1.2.3

