$NetBSD: patch-ad,v 1.4 2006/02/16 10:26:30 abs Exp $

--- libavformat/Makefile.orig	2004-04-24 17:16:23.000000000 +0200
+++ libavformat/Makefile
@@ -68,6 +68,11 @@ endif
 
 ifeq ($(CONFIG_VORBIS),yes)
 OBJS+= ogg.o
+EXTRALIBS+= -lvorbis -lvorbisenc
+endif
+
+ifeq ($(CONFIG_MP3LAME),yes)
+EXTRALIBS += -lmp3lame
 endif
 
 ifeq ($(TARGET_ARCH_SPARC64),yes)
@@ -81,12 +86,14 @@ endif
 
 SRCS := $(OBJS:.o=.c) $(PPOBJS:.o=.cpp)
 
+install: all
+	$(LIBTOOL) --mode=install $(BSD_INSTALL_DATA) $(LIB:.a=.la) $(prefix)/lib
+
 all: $(LIB) $(SLIB)
 
 $(LIB): $(OBJS) $(PPOBJS)
 	rm -f $@
-	$(AR) rc $@ $(OBJS) $(PPOBJS)
-	$(RANLIB) $@
+	$(LIBTOOL) --mode=link $(CC) -o $(LIB:.a=.la) $(OBJS:.o=.lo)  $(PPOBJS:.o=.lo) -rpath $(prefix)/lib $(LIBOSSAUDIO) $(EXTRALIBS)
 
 $(SLIB): $(OBJS)
 ifeq ($(CONFIG_WIN32),yes)
@@ -96,9 +103,6 @@ else
 	$(CC) $(SHFLAGS) -o $@ $(OBJS) $(PPOBJS) $(EXTRALIBS)
 endif
 
-depend: $(SRCS)
-	$(CC) -MM $(CFLAGS) $^ 1>.depend
-
 ifeq ($(BUILD_SHARED),yes)
 install: all install-headers
 ifeq ($(CONFIG_WIN32),yes)
@@ -124,11 +128,11 @@ install-headers:
                 "$(prefix)/include/ffmpeg"
 
 %.o: %.c
-	$(CC) $(CFLAGS) -c -o $@ $< 
+	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c -o $@ $<
 
 # BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
 %.o: %.cpp
-	g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $< 
+	 $(LIBTOOL) --mode=compile $(CXX) $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
 
 distclean clean: 
 	rm -f *.o *.d .depend *~ *.a $(LIB)
