$OpenBSD: patch-configure,v 1.21 2008/09/08 23:28:28 brad Exp $
--- configure.orig	Fri Jun 20 22:40:11 2008
+++ configure	Sun Sep  7 00:17:23 2008
@@ -884,7 +884,7 @@ rtp_muxer_deps="network rtp_protocol"
 rtsp_demuxer_deps="sdp_demuxer"
 sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
 v4l_demuxer_deps="linux_videodev_h"
-v4l2_demuxer_deps="linux_videodev2_h"
+v4l2_demuxer_deps="sys_videoio_h"
 vfwcap_demuxer_deps="capCreateCaptureWindow"
 vfwcap_demuxer_extralibs="-lvfw32"
 x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
@@ -934,6 +934,10 @@ cpu="generic"
 # OS
 target_os=$(tolower $(uname -s))
 
+if test $target_os = openbsd; then
+  arch=`arch -s`
+fi
+
 # libraries
 enable bzlib
 enable zlib
@@ -953,9 +957,9 @@ enable stripping
 vhook="default"
 
 # build settings
-SHFLAGS='-shared -Wl,-soname,$$(@F)'
+SHFLAGS='-shared'
 VHOOKSHFLAGS='$(SHFLAGS)'
-LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
+LDLATEFLAGS=''
 FFSERVERLDFLAGS=-Wl,-E
 LIBPREF="lib"
 LIBSUF=".a"
@@ -965,7 +969,7 @@ SLIBPREF="lib"
 SLIBSUF=".so"
 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
-SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
+SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBVERSION)'
 LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
 
 # gcc stupidly only outputs the basename of targets with -MM
@@ -1130,7 +1134,7 @@ EOF
         arch="powerpc"
         enable fast_64bit
     ;;
-    mips|mipsel|IP*)
+    mips|mipsel|mips64|IP*)
         arch="mips"
     ;;
     sun4u|sparc64)
@@ -1140,13 +1144,13 @@ EOF
     sparc)
         arch="sparc"
     ;;
-    sh4)
+    sh4|sh)
         arch="sh4"
     ;;
-    parisc)
+    parisc|hppa)
         arch="parisc"
     ;;
-    parisc64)
+    parisc64|hppa64)
         arch="parisc"
         enable fast_64bit
     ;;
@@ -1213,9 +1217,9 @@ case $target_os in
         disable need_memalign
         LIBOBJFLAGS='$(PIC)'
         SHFLAGS='-shared'
-        SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
-        SLIBNAME_WITH_VERSION='$(SLIBNAME)'
-        SLIBNAME_WITH_MAJOR='$(SLIBNAME)'
+        #SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
+        #SLIBNAME_WITH_VERSION='$(SLIBNAME)'
+        #SLIBNAME_WITH_MAJOR='$(SLIBNAME)'
         oss_demuxer_extralibs="-lossaudio"
         oss_muxer_extralibs="-lossaudio"
         ;;
@@ -1501,7 +1505,7 @@ fi
 check_cc <<EOF || die "Symbol mangling check failed."
 int ff_extern;
 EOF
-sym=$($nm -P -g $TMPO | grep ff_extern)
+sym=$($nm -g $TMPO | grep ff_extern | cut -d ' ' -f 3)
 extern_prefix=${sym%%ff_extern*}
 
 check_asm inline_asm '""'
@@ -1531,16 +1535,16 @@ fi
 
 # check for assembler specific support
 
-if test $arch = "powerpc"; then
-check_cc <<EOF && enable dcbzl
-int main(void) {
-    register long zero = 0;
-    char data[1024];
-    asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
-return 0;
-}
-EOF
-fi
+#if test $arch = "powerpc"; then
+#check_cc <<EOF && enable dcbzl
+#int main(void) {
+#    register long zero = 0;
+#    char data[1024];
+#    asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
+#return 0;
+#}
+#EOF
+#fi
 
 # check for SIMD availability
 
@@ -1582,10 +1586,14 @@ enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ult
 
 # ---
 # big/little-endian test
-check_cc <<EOF || die "endian test failed"
-unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
+check_exec <<EOF || enable bigendian
+#include <sys/types.h>
+int main(void) {
+	if (_BYTE_ORDER == _BIG_ENDIAN)
+		return 1;
+	return 0;
+}
 EOF
-od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
 
 # ---
 # check availability of some header files
@@ -1607,7 +1615,7 @@ check_func2 windows.h GetProcessTimes
 check_header byteswap.h
 check_header conio.h
 check_header dlfcn.h
-check_header malloc.h
+#check_header malloc.h
 check_header sys/mman.h
 check_header sys/resource.h
 check_header termios.h
@@ -1717,10 +1725,10 @@ if test "$target_os" = cygwin -o "$target_os" = mingw3
     echo
 fi
 
-if enabled vhook; then
-    check_ldflags -rdynamic
-    check_ldflags -export-dynamic
-fi
+#if enabled vhook; then
+#    check_ldflags -rdynamic
+#    check_ldflags -export-dynamic
+#fi
 
 check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
 check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
@@ -1756,7 +1764,7 @@ fi
 
 texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
 
-check_type sys/socket.h socklen_t
+check_type sys/types.h socklen_t
 
 ##########################################
 # Network check
@@ -1791,6 +1799,7 @@ EOF
 
 check_header linux/videodev.h
 check_header linux/videodev2.h
+check_header sys/videoio.h
 
 check_func2 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
 
@@ -1831,7 +1840,7 @@ enabled extra_warnings && check_cflags -Winline
 # add some linker flags
 check_ldflags -Wl,--warn-common
 check_ldflags $LDLATEFLAGS
-check_ldflags -Wl,-Bsymbolic
+# check_ldflags -Wl,-Bsymbolic
 
 if enabled small; then
     check_cflags -Os            # not all compilers support -Os
@@ -2204,8 +2213,7 @@ Version: $version
 Requires: $(disabled shared && echo $requires)
 Requires.private: $(enabled shared && echo $requires)
 Conflicts:
-Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
-Libs.private: $(enabled shared && echo $libs)
+Libs: -L\${libdir} -l${shortname} $libs
 Cflags: -I\${includedir}
 EOF
 cat <<EOF > $name/$name-uninstalled.pc
@@ -2224,17 +2232,17 @@ Cflags: -I\${includedir}
 EOF
 }
 
-pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
-pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
-pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
-pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
+pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBavutil_EXTRALIBS"
+pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$LIBavcodec_EXTRALIBS" "libavutil"
+pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$LIBavformat_EXTRALIBS" "libavutil libavcodec"
+pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$LIBavdevice_EXTRALIBS" "libavutil libavformat"
 enabled avfilter &&
     pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
 enabled postproc &&
-    pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
+    pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION" "$LIBpostproc_EXTRALIBS" "libavutil"
 if enabled swscale; then
-    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
+    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBswscale_EXTRALIBS" "libavutil"
 else
-    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
+    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBswscale_EXTRALIBS"
     apply libswscale/libswscale.pc sed s/^Libs:.*$/Libs:/
 fi
