endif
endif
# no installer for FreeBSD yet
+if BUILD_FOR_FREEBSD
+if INSTALL_FREEBSD_STARTUP
+ [ -e /usr/local/etc/rc.d/nqptp ] || cp nqptp.freebsd /usr/local/etc/rc.d/nqptp
+ chmod 555 /usr/local/etc/rc.d/nqptp
+endif
+endif
+
AC_ARG_WITH([systemd-startup],[AS_HELP_STRING([--with-systemd-startup],[install a systemd startup script during a make install])])
AM_CONDITIONAL([INSTALL_SYSTEMD_STARTUP], [test "x$with_systemd_startup" = "xyes"])
+# Check to see if we should include the systemd stuff to define it as a service
+AC_ARG_WITH([freebsd-startup],[AS_HELP_STRING([--with-freebsd-startup],[install a FreeBSD startup script during a make install])])
+AM_CONDITIONAL([INSTALL_FREEBSD_STARTUP], [test "x$with_freebsd_startup" = "xyes"])
+
AC_CONFIG_SRCDIR([nqptp.c])
AC_CONFIG_HEADERS([config.h])
--- /dev/null
+#!/bin/sh
+#
+
+# PROVIDE: nqptp
+# REQUIRE: FILESYSTEMS DAEMON hostname
+
+. /etc/rc.subr
+
+name="nqptp"
+rcvar="nqptp_enable"
+pidfile="/var/run/${name}.pid"
+apptodaemonise="/usr/local/bin/nqptp"
+
+command="/usr/sbin/daemon"
+# -S log to syslog; -P store the supervisor PID
+command_args="-S -P ${pidfile} ${apptodaemonise}"
+
+load_rc_config $name
+run_rc_command "$1"
+