summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing-Wei Lan <lantw44@gmail.com>2014-01-20 15:34:53 +0800
committerColin Walters <walters@verbum.org>2014-02-18 19:25:41 -0500
commit815dfc64d40cb0267cb96701409c04b4196e508a (patch)
treea3a10fd9895926609c3c76fca0cf1d7046ddfd57
parentfb0d00225c401a521430ddf232a11965cdc5dd44 (diff)
build: Fix several issues on FreeBSD
1. Fallback to fsync() if fdatasync() is not available. 2. Check whether setnetgrent() has a return value. 3. Check whether the system has SIGPOLL. 4. Add configure option to disable test. mocklibc cannot be built on FreeBSD because of function prototype conflict. https://bugs.freedesktop.org/show_bug.cgi?id=73821
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac21
-rw-r--r--src/polkitagent/polkitagenthelperprivate.c5
-rw-r--r--src/polkitbackend/polkitbackendinteractiveauthority.c4
-rw-r--r--src/polkitbackend/polkitbackendjsauthority.c2
5 files changed, 36 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 16bd0bc..39e226a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,10 @@
## Process this file with automake to produce Makefile.in
-SUBDIRS = actions data src docs po test
+SUBDIRS = actions data src docs po
+
+if BUILD_TEST
+SUBDIRS += test
+endif
NULL =
diff --git a/configure.ac b/configure.ac
index 2128263..a7b0148 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,13 +158,32 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
[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>
+ #include <netdb.h>
+]], [[
+ 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 ---------------------------------------------------------------------------
diff --git a/src/polkitagent/polkitagenthelperprivate.c b/src/polkitagent/polkitagenthelperprivate.c
index 4417e70..cfa77fc 100644
--- a/src/polkitagent/polkitagenthelperprivate.c
+++ b/src/polkitagent/polkitagenthelperprivate.c
@@ -103,7 +103,12 @@ flush_and_wait ()
{
fflush (stdout);
fflush (stderr);
+#ifdef HAVE_FDATASYNC
fdatasync (fileno(stdout));
fdatasync (fileno(stderr));
+#else
+ fsync (fileno(stdout));
+ fsync (fileno(stderr));
+#endif
usleep (100 * 1000);
}
diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
index 3bd2f0b..59028d5 100644
--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
+++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
@@ -2113,11 +2113,15 @@ get_users_in_net_group (PolkitIdentity *group,
ret = NULL;
name = polkit_unix_netgroup_get_name (POLKIT_UNIX_NETGROUP (group));
+#ifdef HAVE_SETNETGRENT_RETURN
if (setnetgrent (name) == 0)
{
g_warning ("Error looking up net group with name %s: %s", name, g_strerror (errno));
goto out;
}
+#else
+ setnetgrent (name);
+#endif
for (;;)
{
diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c
index c3885a9..c507595 100644
--- a/src/polkitbackend/polkitbackendjsauthority.c
+++ b/src/polkitbackend/polkitbackendjsauthority.c
@@ -1286,7 +1286,9 @@ get_signal_name (gint signal_number)
_HANDLE_SIG (SIGTTIN);
_HANDLE_SIG (SIGTTOU);
_HANDLE_SIG (SIGBUS);
+#ifdef SIGPOLL
_HANDLE_SIG (SIGPOLL);
+#endif
_HANDLE_SIG (SIGPROF);
_HANDLE_SIG (SIGSYS);
_HANDLE_SIG (SIGTRAP);