aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--INSTALL2
-rw-r--r--configure.ac13
-rw-r--r--m4/ax_platform.m46
-rw-r--r--src/Makefile.am9
-rw-r--r--src/compat/clock.h2
-rw-r--r--src/compat/include.am4
-rw-r--r--src/include.am24
-rw-r--r--src/proxy-bio-unittest.c4
9 files changed, 60 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 7806fa2..e201a16 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@
Fix a race in tlsdate-dbus-announce that can cause signal drops.
Support -l argument to tlsdated.
Pass -l and -v arguments from tlsdated to tlsdate.
+ Add FreeBSD support for tlsdate and tlsdate-helper.
0.0.6 Mon 18 Feb, 2013
Ensure that tlsdate compiles with g++ by explicit casting rather than
implicit casting by whatever compiler is compiling tlsdate.
diff --git a/INSTALL b/INSTALL
index 526ff63..a4181cc 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,4 +1,4 @@
-Building and install of tlsdate on GNU/Linux should be as easy as:
+Building and install of tlsdate on GNU/Linux and FreeBSD should be as easy as:
./autogen.sh
./configure
diff --git a/configure.ac b/configure.ac
index 5d52d16..b95a8be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -159,6 +159,19 @@ case "$host" in
[*], [UNPRIV_GROUP=$with_unpriv_group])
AC_DEFINE_UNQUOTED([UNPRIV_GROUP], ["${UNPRIV_GROUP}"], [Unprivileged group])
;;
+ *-freebsd*)
+ dnl This is for FreeBSD
+ dnl clock_gettime is either part of libc or unavailable.
+ AC_CHECK_FUNC([clock_gettime], ,
+ [AC_MSG_ERROR([Your system lacks clock_gettime])])
+ AC_ARG_WITH([unpriv-group],
+ [AS_HELP_STRING([--with-unpriv-group=<group>],
+ [Group to drop privs to @<:@default: nobody@:>@])])
+ AS_CASE([$with_unpriv_group],
+ [""|yes|no], [UNPRIV_GROUP="nobody"],
+ [*], [UNPRIV_GROUP=$with_unpriv_group])
+ AC_DEFINE_UNQUOTED([UNPRIV_GROUP], ["${UNPRIV_GROUP}"], [Unprivileged group])
+ ;;
*-linux*)
dnl This is for GNU/Linux
dnl Check for clock_gettime. Some systems put it into -lc, while
diff --git a/m4/ax_platform.m4 b/m4/ax_platform.m4
index a689fa7..405a2d4 100644
--- a/m4/ax_platform.m4
+++ b/m4/ax_platform.m4
@@ -46,8 +46,9 @@
# define SHUT_RDWR SD_BOTH
#endif
])],
- [*freebsd*],[AC_DEFINE([TARGET_OS_FREEBSD],[1],[Whether we are building for FreeBSD])
- AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers])],
+ [*freebsd*],
+ [TARGET_OS_FREEBSD="true"
+ AC_DEFINE([TARGET_OS_FREEBSD],[1],[Whether we are building for FreeBSD])],
[*solaris*],[AC_DEFINE([TARGET_OS_SOLARIS],[1],[Whether we are building for Solaris])],
[*darwin*],
[TARGET_OSX="true"
@@ -59,4 +60,5 @@
AM_CONDITIONAL([BUILD_WIN32],[test "x${TARGET_WINDOWS}" = "xtrue"])
AM_CONDITIONAL([TARGET_OSX],[test "x${TARGET_OSX}" = "xtrue"])
AM_CONDITIONAL([TARGET_LINUX],[test "x${TARGET_LINUX}" = "xtrue"])
+ AM_CONDITIONAL([TARGET_FREEBSD],[test "x${TARGET_OS_FREEBSD}" = "xtrue"])
])
diff --git a/src/Makefile.am b/src/Makefile.am
index 443e1a3..68553be 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,6 +8,10 @@ bin_PROGRAMS = tlsdate-routeup tlsdate tlsdate-helper \
tlsdated tlsdated_unittest
endif
+if TARGET_FREEBSD
+bin_PROGRAMS = tlsdate tlsdate-helper
+endif
+
if TARGET_OSX
bin_PROGRAMS = tlsdate tlsdate-helper
endif
@@ -37,6 +41,11 @@ tlsdate_helper_LDADD = @SSL_LIBS@ @SSL_LDFLAGS@ -lrt \
$(top_builddir)/src/compat/libtlsdate_compat.la
endif
+if TARGET_FREEBSD
+tlsdate_helper_LDADD = @SSL_LIBS@ @SSL_LDFLAGS@ -lrt \
+ $(top_builddir)/src/compat/libtlsdate_compat.la
+endif
+
if TARGET_OSX
tlsdate_helper_LDADD = @SSL_LIBS@ @SSL_LDFLAGS@ -lrt \
$(top_builddir)/src/compat/.libs/libtlsdate_compat.dylib
diff --git a/src/compat/clock.h b/src/compat/clock.h
index ffd7f4b..4e172a8 100644
--- a/src/compat/clock.h
+++ b/src/compat/clock.h
@@ -26,7 +26,7 @@
#endif
struct tlsdate_time {
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD__)
struct timespec tp;
#elif defined(__APPLE__)
mach_timespec_t tp;
diff --git a/src/compat/include.am b/src/compat/include.am
index 43168d8..a13b91d 100644
--- a/src/compat/include.am
+++ b/src/compat/include.am
@@ -16,4 +16,8 @@ if TARGET_LINUX
src_compat_libtlsdate_compat_la_SOURCES+= src/compat/clock-linux.c
endif
+if TARGET_FREEBSD
+src_compat_libtlsdate_compat_la_SOURCES+= src/compat/clock-linux.c
+endif
+
src_compat_libtlsdate_compat_la_LIBADD+= @RT_LIB@
diff --git a/src/include.am b/src/include.am
index 9711973..9b3d132 100644
--- a/src/include.am
+++ b/src/include.am
@@ -23,12 +23,22 @@ check_PROGRAMS+= src/conf_unittest
noinst_PROGRAMS+= src/conf_unittest
endif
+if TARGET_FREEBSD
+bin_PROGRAMS+= src/tlsdate
+bin_PROGRAMS+= src/tlsdate-helper
+
+src_conf_unittest_SOURCES = src/conf.c
+src_conf_unittest_SOURCES+= src/conf-unittest.c
+check_PROGRAMS+= src/conf_unittest
+noinst_PROGRAMS+= src/conf_unittest
+endif
+
if TARGET_OSX
bin_PROGRAMS+= src/tlsdate
bin_PROGRAMS+= src/tlsdate-helper
endif
-# This doesn't work on Mac OS X
+# This doesn't work on Mac OS X or FreeBSD
if TARGET_LINUX
src_tlsdate_routeup_CFLAGS = -DROUTEUP_MAIN
src_tlsdate_routeup_SOURCES = src/routeup.c
@@ -86,6 +96,18 @@ noinst_PROGRAMS+= src/proxy-bio_unittest
endif
endif
+if TARGET_FREEBSD
+if !POLARSSL
+src_proxy_bio_unittest_LDADD = @SSL_LIBS@
+src_proxy_bio_unittest_SOURCES = src/proxy-bio.c
+src_proxy_bio_unittest_SOURCES+= src/proxy-bio-unittest.c
+src_proxy_bio_unittest_SOURCES+= src/test-bio.c
+src_proxy_bio_unittest_SOURCES+= src/util.c
+check_PROGRAMS+= src/proxy-bio_unittest
+noinst_PROGRAMS+= src/proxy-bio_unittest
+endif
+endif
+
# We're not shipping headers
noinst_HEADERS+= src/routeup.h
noinst_HEADERS+= src/test_harness.h
diff --git a/src/proxy-bio-unittest.c b/src/proxy-bio-unittest.c
index ec562fc..a9f6c94 100644
--- a/src/proxy-bio-unittest.c
+++ b/src/proxy-bio-unittest.c
@@ -5,7 +5,11 @@
* found in the LICENSE file.
*/
+#if defined(__linux__)
#include <alloca.h>
+#elseif defined(__FreeBSD__)
+#include <stdlib.h>
+#endif
#include "src/proxy-bio.h"
#include "src/test-bio.h"