$OpenBSD: patch-configure_ac,v 1.13 2014/03/26 14:56:23 ajacoutot Exp $

GTK_DOC_CHECK chunk:
Remove when updating to a newer release with integrated bsd_auth(3) support.

https://bugs.freedesktop.org/show_bug.cgi?id=75187

From 815dfc64d40cb0267cb96701409c04b4196e508a Mon Sep 17 00:00:00 2001
From: Ting-Wei Lan <lantw44@gmail.com>
Date: Mon, 20 Jan 2014 07:34:53 +0000
Subject: build: Fix several issues on FreeBSD

--- configure.ac.orig	Wed May 15 23:10:23 2013
+++ configure.ac	Wed Mar 26 15:39:34 2014
@@ -46,7 +46,7 @@ AC_PATH_PROG([XSLTPROC], [xsltproc])
 fi
 AM_CONDITIONAL(MAN_PAGES_ENABLED, test x$enable_man_pages = xyes)
 
-GTK_DOC_CHECK([1.3])
+dnl GTK_DOC_CHECK([1.3])
 
 #### gcc warning flags
 
@@ -158,13 +158,37 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexp
 	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
 AC_SUBST(EXPAT_LIBS)
 
-AC_CHECK_FUNCS(clearenv)
+AC_CHECK_FUNCS(clearenv fdatasync)
 
 if test "x$GCC" = "xyes"; then
   LDFLAGS="-Wl,--as-needed $LDFLAGS"
 fi
 
 dnl ---------------------------------------------------------------------------
+dnl - Check whether setnetgrent has a return value
+dnl ---------------------------------------------------------------------------
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+	#include <stddef.h>
+#ifndef __OpenBSD__
+	#include <netdb.h>
+#else
+	#include <netgroup.h>
+#endif
+]], [[
+	int r = setnetgrent (NULL);]])],
+[AC_DEFINE([HAVE_SETNETGRENT_RETURN], 1, [Define to 1 if setnetgrent has return value])])
+
+dnl ---------------------------------------------------------------------------
+dnl - Check whether we want to build test
+dnl ---------------------------------------------------------------------------
+AC_ARG_ENABLE([test],
+              [AS_HELP_STRING([--disable-test], [Do not build tests])],
+              [enable_test=$enableval], [enable_test=yes])
+
+AM_CONDITIONAL(BUILD_TEST, [test "x$enable_test" = "xyes"])
+
+
+dnl ---------------------------------------------------------------------------
 dnl - Select wether to use libsystemd-login or ConsoleKit for session tracking
 dnl ---------------------------------------------------------------------------
 
@@ -287,6 +311,11 @@ case $POLKIT_AUTHFW in
     AC_DEFINE(POLKIT_AUTHFW_SHADOW, 1, [If using the Shadow authentication framework])
     ;;
 
+  bsdauth)
+    need_pam=no
+    AC_DEFINE(POLKIT_AUTHFW_BSDAUTH, 1, [If using the bsd_auth(3) authentication framework])
+    ;;
+
   *)
     AC_MSG_ERROR([Unknown Authentication Framework: $POLKIT_AUTHFW])
     ;;
@@ -295,6 +324,7 @@ esac
 AM_CONDITIONAL(POLKIT_AUTHFW_NONE, [test x$POLKIT_AUTHFW = xnone], [Using no authfw])
 AM_CONDITIONAL(POLKIT_AUTHFW_PAM, [test x$POLKIT_AUTHFW = xpam], [Using PAM authfw])
 AM_CONDITIONAL(POLKIT_AUTHFW_SHADOW, [test x$POLKIT_AUTHFW = xshadow], [Using Shadow authfw])
+AM_CONDITIONAL(POLKIT_AUTHFW_BSDAUTH, [test x$POLKIT_AUTHFW = xbsdauth], [Using bsd_auth(3) authfw])
 
 
 dnl ---------------------------------------------------------------------------
@@ -473,6 +503,9 @@ case "$host_os" in
 	;;
   *freebsd*)
   	AC_DEFINE([HAVE_FREEBSD], 1, [Is this a FreeBSD system?])
+	;;
+  *openbsd*)
+  	AC_DEFINE([HAVE_OPENBSD], 1, [Is this an OpenBSD system?])
 	;;
 esac
 
