From edbd470fa6b1d1286a4500f3a8263905fbc2d11d Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Fri, 4 Jan 2008 23:14:56 +0000 Subject: [PATCH] Build fixes for FreeBSD: - disorder-playrtp needs an explicit -lpthread. - libdb is installed off even the non-default path - find GNU sed as the native sed is not adequate - adding some missing includes Organization: Straylight/Edgeware From: rjk@greenend.org.uk <> The result builds but I've not run all the test yet. --- clients/Makefile.am | 3 ++- configure.ac | 22 ++++++++++++++++++++++ disobedience/Makefile.am | 6 ++++-- doc/Makefile.am | 2 ++ lib/sendmail.c | 1 + scripts/htmlman | 2 +- scripts/sedfiles.make | 2 +- server/speaker-network.c | 1 + 8 files changed, 34 insertions(+), 5 deletions(-) diff --git a/clients/Makefile.am b/clients/Makefile.am index 7baa667..b9b3640 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -38,7 +38,8 @@ disorderfm_DEPENDENCIES=$(LIBOBJS) ../lib/libdisorder.a disorder_playrtp_SOURCES=playrtp.c playrtp.h playrtp-mem.c \ playrtp-alsa.c playrtp-coreaudio.c playrtp-oss.c disorder_playrtp_LDADD=$(LIBOBJS) ../lib/libdisorder.a \ - $(LIBASOUND) $(LIBPCRE) $(LIBICONV) $(LIBGCRYPT) $(COREAUDIO) $(LIBDB) + $(LIBASOUND) $(LIBPCRE) $(LIBICONV) $(LIBGCRYPT) $(COREAUDIO) \ + $(LIBDB) $(LIBPTHREAD) disorder_playrtp_DEPENDENCIES=$(LIBOBJS) ../lib/libdisorder.a filename_bytes_SOURCES=filename-bytes.c diff --git a/configure.ac b/configure.ac index c167d8d..4bae211 100644 --- a/configure.ac +++ b/configure.ac @@ -85,8 +85,13 @@ case "$host" in *-freebsd* ) AC_MSG_RESULT([FreeBSD]) want_server=yes + # Ports install to /usr/local but the compiler stupidly doesn't look + # there by default LDFLAGS="${LDFLAGS} -L/usr/local/lib" CPPFLAGS="${CPPFLAGS} -I/usr/local/include" + # libdb installs elsewhere again + LDFLAGS="${LDFLAGS} -L/usr/local/lib/db44" + CPPFLAGS="${CPPFLAGS} -I/usr/local/include/db44" ;; * ) AC_MSG_RESULT([unknown, winging it]) @@ -150,6 +155,20 @@ AC_DISABLE_STATIC AC_PROG_LIBTOOL +AC_CACHE_CHECK([for GNU sed],[rjk_cv_gnused],[ + rjk_cv_gnused="not found" + for candidate in sed gsed; do + if $candidate --version >/dev/null 2>&1; then + rjk_cv_gnused=$candidate + fi + done +]) +GNUSED="${GNUSED:-$rjk_cv_gnused}" +if test "$GNUSED" = "not found"; then + AC_MSG_ERROR([GNU sed is required to build this program]) +fi +AC_SUBST([GNUSED]) + missing_libraries="" missing_headers="" missing_functions="" @@ -211,6 +230,9 @@ if test $want_server = yes; then [AC_SUBST(LIBFLAC,[-lFLAC])], [missing_libraries="$missing_libraries libFLAC"]) fi +AC_CHECK_LIB([pthread], [pthread_create], + [AC_SUBST(LIBPTHREAD,[-lpthread])], + [missing_libraries="$missing_libraries libpthread"]) if test $want_gtk = yes; then AM_PATH_GLIB_2_0([],[],[missing_libraries="$missing_libraries libglib"]) diff --git a/disobedience/Makefile.am b/disobedience/Makefile.am index 93a280a..ae3bc6c 100644 --- a/disobedience/Makefile.am +++ b/disobedience/Makefile.am @@ -49,12 +49,12 @@ misc.o: images.h images.h: $(PNGS) exec > @$.new; \ for png in $(PNGS); do \ - name=`echo $$png | sed 's,.*/,,;s,\.png,,;'`; \ + name=`echo $$png | $(GNUSED) 's,.*/,,;s,\.png,,;'`; \ gdk-pixbuf-csource --raw --name=image_$$name $$png; \ done; \ echo "static const struct image images[] = {"; \ for png in $(PNGS); do \ - name=`echo $$png | sed 's,.*/,,;s,\.png,,;'`; \ + name=`echo $$png | $(GNUSED) 's,.*/,,;s,\.png,,;'`; \ echo " { \"$$name.png\", image_$$name },"; \ done; \ echo "};" @@ -63,3 +63,5 @@ images.h: $(PNGS) # check everything has working --help check-help: all ./disobedience --version > /dev/null + +export GNUSED diff --git a/doc/Makefile.am b/doc/Makefile.am index 3e8078c..9316298 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -51,3 +51,5 @@ EXTRA_DIST=disorderd.8.in disorder.1.in disorder_config.5.in \ disorder-stats.8.in disorder-dbupgrade.8.in CLEANFILES=$(SEDFILES) $(HTMLMAN) + +export GNUSED diff --git a/lib/sendmail.c b/lib/sendmail.c index 63daee1..8ca1e88 100644 --- a/lib/sendmail.c +++ b/lib/sendmail.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "syscalls.h" #include "log.h" diff --git a/scripts/htmlman b/scripts/htmlman index f703067..04851fa 100755 --- a/scripts/htmlman +++ b/scripts/htmlman @@ -53,7 +53,7 @@ if $stdhead; then fi printf "
"
 # this is kind of painful using only BREs
-nroff -man "$1" | sed \
+nroff -man "$1" | ${GNUSED} \
                       '1d;$d;
                        1,/./{/^$/d};
                        s/&/\&/g;
diff --git a/scripts/sedfiles.make b/scripts/sedfiles.make
index 4bd1430..8557a86 100644
--- a/scripts/sedfiles.make
+++ b/scripts/sedfiles.make
@@ -20,7 +20,7 @@
 
 $(SEDFILES) : % : %.in Makefile
 	rm -f $@.new
-	sed -e 's!sbindir!${sbindir}!g;' \
+	$(GNUSED) -e 's!sbindir!${sbindir}!g;' \
 	    -e 's!bindir!${bindir}!g;' \
 	    -e 's!pkgconfdir!${sysconfdir}/disorder!g;' \
 	    -e 's!pkgstatedir!${localstatedir}/disorder!g;' \
diff --git a/server/speaker-network.c b/server/speaker-network.c
index 810aff7..67fca83 100644
--- a/server/speaker-network.c
+++ b/server/speaker-network.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "configuration.h"
 #include "syscalls.h"
-- 
[mdw]