about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2010-06-24T17·51+0000
committerPeter Simons <simons@cryp.to>2010-06-24T17·51+0000
commitaf09fe12ddf356d93855cfe7b84d607e3103103a (patch)
treee438fd12e50929f00309493355531239090f10c4
parentd63375d52998e91c4d79563727baa29eb0753251 (diff)
Fix build of bsdiff-4.3 on machines that don't have <err.h>, such as Solaris.
-rw-r--r--configure.ac4
-rw-r--r--src/bsdiff-4.3/Makefile.am2
-rw-r--r--src/bsdiff-4.3/compat-include/err.h12
3 files changed, 17 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 5af8aa58185b..b21fd4480052 100644
--- a/configure.ac
+++ b/configure.ac
@@ -136,6 +136,10 @@ AC_CHECK_HEADERS([locale], [], [], [])
 AC_LANG_POP(C++)
 
 
+# Check for <err.h>.
+AC_CHECK_HEADER([err.h], [], [bsddiff_compat_include="-Icompat-include"])
+AC_SUBST([bsddiff_compat_include])
+
 # Check whether we have the personality() syscall, which allows us to
 # do i686-linux builds on x86_64-linux machines.
 AC_CHECK_HEADERS([sys/personality.h])
diff --git a/src/bsdiff-4.3/Makefile.am b/src/bsdiff-4.3/Makefile.am
index 4b3af0783708..953139f55962 100644
--- a/src/bsdiff-4.3/Makefile.am
+++ b/src/bsdiff-4.3/Makefile.am
@@ -8,4 +8,4 @@ bspatch_SOURCES = bspatch.c
 
 bspatch_LDADD = ${bzip2_lib}
 
-AM_CFLAGS = -O3 ${bzip2_include}
+AM_CFLAGS = -O3 ${bzip2_include} ${bsddiff_compat_include}
diff --git a/src/bsdiff-4.3/compat-include/err.h b/src/bsdiff-4.3/compat-include/err.h
new file mode 100644
index 000000000000..a851ded6f907
--- /dev/null
+++ b/src/bsdiff-4.3/compat-include/err.h
@@ -0,0 +1,12 @@
+/* Simulate BSD's <err.h> functionality. */
+
+#ifndef COMPAT_ERR_H_INCLUDED
+#define COMPAT_ERR_H_INCLUDED 1
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define err(rc,...)  do { fprintf(stderr,__VA_ARGS__); exit(rc); } while(0)
+#define errx(rc,...) do { fprintf(stderr,__VA_ARGS__); exit(rc); } while(0)
+
+#endif