$NetBSD$

--- libavformat/Makefile.orig	2005-11-21 20:00:42.000000000 +1030
+++ libavformat/Makefile	2006-04-23 20:48:59.000000000 +0930
@@ -72,6 +72,11 @@
 
 ifeq ($(CONFIG_LIBOGG),yes)
 OBJS+= ogg.o
+EXTRALIBS+= -lvorbis -lvorbisenc
+endif
+
+ifeq ($(CONFIG_MP3LAME),yes)
+EXTRALIBS += -lmp3lame
 endif
 
 ifeq ($(TARGET_ARCH_SPARC64),yes)
@@ -89,12 +94,14 @@
 
 SRCS := $(OBJS:.o=.c) $(PPOBJS:.o=.cpp)
 
+install: all
+	$(LIBTOOL) --mode=install $(BSD_INSTALL_DATA) $(LIB:.a=.la) $(prefix)/lib
+
 all: $(LIB) $(SLIBNAME)
 
 $(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)
 
 $(SLIBNAME): $(OBJS)
 ifeq ($(CONFIG_WIN32),yes)
@@ -104,9 +111,6 @@
 	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
 endif
 
-depend: $(SRCS)
-	$(CC) -MM $(CFLAGS) $^ 1>.depend
-
 ifeq ($(BUILD_SHARED),yes)
 install: all install-headers
 ifeq ($(CONFIG_WIN32),yes)
@@ -134,11 +138,11 @@
 	install -m 644 ../libavformat.pc "$(libdir)/pkgconfig"
 
 %.o: %.c
-	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -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 *$(SLIBSUF) $(LIB)
