$OpenBSD: patch-configure_ac,v 1.1 2011/06/28 13:43:03 dcoppa Exp $
--- configure.ac.orig	Thu Jan  6 20:03:14 2011
+++ configure.ac	Tue Jun 28 15:24:27 2011
@@ -46,6 +46,18 @@ if test "x$enable_as_needed" != "xno"; then
   esac
 fi
 
+AC_CHECK_HEADER(pthread.h, have_pthread_h=yes)
+if test "X$have_pthread_h" = "Xyes" ; then
+    save_LDFLAGS="${LDFLAGS}";
+    LDFLAGS="${LDFLAGS} -pthread"
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM(
+        [[#include <pthread.h>
+        pthread_t thr;]],
+        [pthread_create(&thr, NULL, NULL, NULL);])],,
+      [LDFLAGS="${save_LDFLAGS}"])
+fi
+
 #########################################################################
 # Check ffmpeg libraries
 #########################################################################
@@ -106,7 +118,7 @@ fi
 ########################################################################
 # Compiler flags
 ########################################################################
-CXXFLAGS=-D__STDC_CONSTANT_MACROS
+CXXFLAGS="${CXXFLAGS} -D__STDC_CONSTANT_MACROS"
 
 ########################################################################
 # Check debug mode
@@ -118,7 +130,7 @@ AC_ARG_ENABLE(debug,
 AM_CONDITIONAL(DEBUG, test "$enable_debug" = "yes")
 if test "$DEBUG" = "yes"; then
     AC_DEFINE(ENABLE_DEBUG, [], "Enable debug mode")
-    CXXFLAGS+=" -g -O1 -Wall -Werror -Wfatal-errors"
+    CXXFLAGS="${CXXFLAGS} -g -Wall -Werror -Wfatal-errors"
 fi
 
 AC_ARG_ENABLE(unittests,
