gnulib's error.c requires program_name to be externally defined
for !_LIBC systems. This defines program_name for Darwin only.
---
configure.ac | 3 +++
src/Makefile.am | 6 ++++++
src/program_name.c | 4 ++++
3 files changed, 13 insertions(+)
create mode 100644 src/program_name.c
diff --git a/configure.ac b/configure.ac
index 37850a3..a2fb99e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -581,6 +581,9 @@ fi
AC_MSG_RESULT([$DISTRO])
AC_SUBST([DISTRO])
+dnl Check if we're building on MacOS X.
+AM_CONDITIONAL([DARWIN], [test "x$(uname)" = "xDarwin"])
+
dnl Add extra packages to the appliance.
AC_ARG_WITH([extra-packages],
[AS_HELP_STRING([--with-extra-packages="pkg1 pkg2 ..."],
diff --git a/src/Makefile.am b/src/Makefile.am
index 2496887..1c36035 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -131,6 +131,12 @@ libguestfs_la_SOURCES = \
tmpdirs.c \
libguestfs.syms
+if DARWIN
+# gnulib requires program_name to be defined on non-glibc systems, in
+# particular MacOS X.
+libguestfs_la_SOURCES += program_name.c
+endif
+
libguestfs_la_CPPFLAGS = \
-DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
-DGUESTFS_WARN_DEPRECATED=1 \
diff --git a/src/program_name.c b/src/program_name.c
new file mode 100644
index 0000000..e1b2e19
--- /dev/null
+++ b/src/program_name.c
@@ -0,0 +1,4 @@
+/* gnulib requires char *program_name to be defined for non-glibc systems
+ * (like MacOS X).
+ */
+const char *program_name = "libguestfs";
--
1.9.3