$OpenBSD: patch-configure,v 1.3 2007/07/20 20:11:48 ajacoutot Exp $
--- configure.orig	Sun Mar 25 22:45:02 2007
+++ configure	Fri Jul 20 13:02:53 2007
@@ -46,7 +46,7 @@ as_check() {
 
 rm -f config.h config.mak x264.pc
 
-prefix='/usr/local'
+prefix='!!PREFIX!!';
 exec_prefix='${prefix}'
 bindir='${exec_prefix}/bin'
 libdir='${exec_prefix}/lib'
@@ -160,7 +160,7 @@ case "${MACHINE%%-*}" in
       ASFLAGS="$ASFLAGS -f elf"
     fi
     ;;
-  x86_64)
+  x86_64 | amd64)
     ARCH="X86_64"
     CFLAGS="$CFLAGS -DHAVE_MMX"
     AS="yasm"
@@ -334,6 +334,9 @@ if test "$pthread" = "auto" ; then
                 CFLAGS="$CFLAGS -DPTW32_STATIC_LIB"
             fi
             ;;
+        OPENBSD)
+            cc_check pthread.h -pthread && pthread="yes" && libpthread="-pthread"
+            ;;
         *)
             cc_check pthread.h -lpthread && pthread="yes" && libpthread="-lpthread"
             ;;
@@ -370,19 +373,19 @@ if [ "$avis_input" = "yes" ] ; then
 fi
 
 if [ "$pic" = "yes" ] ; then
-    CFLAGS="$CFLAGS -fPIC"
+    CFLAGS="$CFLAGS"
     ASFLAGS="$ASFLAGS -D__PIC__"
 fi
 
 if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
-    CFLAGS="$CFLAGS -s -fomit-frame-pointer"
-    LDFLAGS="$LDFLAGS -s"
+    CFLAGS="$CFLAGS"
+    LDFLAGS="$LDFLAGS"
 fi
 
 if [ "$debug" = "yes" ]; then
     CFLAGS="-O1 -g $CFLAGS"
 else
-    CFLAGS="-O4 -ffast-math $CFLAGS"
+    CFLAGS="-ffast-math $CFLAGS"
 fi
 
 if cc_check "stdio.h" "" "fseeko(stdin,0,0);" ; then
@@ -426,7 +429,6 @@ echo '' >> config.mak
 cp config.mak gtk/config.mak
 
 if [ "$shared" = "yes" ]; then
-    API=$(grep '#define X264_BUILD' < x264.h | cut -f 3 -d ' ')
     echo "SONAME=libx264.so.$API" >> config.mak
     echo 'default: $(SONAME)' >> config.mak
     if [ "$gtk" = "yes" ]; then
@@ -441,7 +443,7 @@ fi
 
 ./version.sh
 
-pclibs="-L$libdir -lx264 $libpthread"
+pclibs="-L$libdir -lx264 -lm $libpthread"
 
 cat > x264.pc << EOF
 prefix=$prefix
