$OpenBSD: patch-ptlib_m4,v 1.4 2013/10/02 10:45:26 ajacoutot Exp $
--- ptlib.m4.orig	Thu Aug 15 01:20:33 2013
+++ ptlib.m4	Tue Oct  1 17:57:17 2013
@@ -332,7 +332,8 @@ AC_DEFUN([PTLIB_CHECK_SASL_INCLUDE],
 
           if test "x${HAS_INCLUDE_SASL_H}" != "xyes" ; then
             AC_MSG_CHECKING([if <sasl/sasl.h> works])
-            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sasl/sasl.h> ]],
+            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdlib.h>
+						  #include <sasl/sasl.h> ]],
                                [[ int v = SASL_LOG_PASS; ]])],
                               [
                                 AC_MSG_RESULT(yes)
@@ -368,7 +369,10 @@ AC_DEFUN([PTLIB_FIND_OPENLDAP],
                             dnl posix4 is required by libldap_r on Solaris
                             ptlib_openldap_libs="-lposix4"
                             ;;
-                            * )
+            openbsd*)
+                            ptlib_openldap_libs="-llber -lldap_r -pthread"
+                            ;;
+            * )
                             ptlib_openldap_libs="-llber -lldap_r"
             esac
 
