From 29508f2435ddbdb2f8ac217ba182c020e85cf8ca Mon Sep 17 00:00:00 2001
From: Andy Wingo <wingo@pobox.com>
Date: Sun, 22 Nov 2009 09:47:12 +0100
Subject: [PATCH] version-etc: work also with AM_INIT_AUTOMAKE's no-define
 option

* lib/version-etc.c [!defined PACKAGE]: Define to PACKAGE_TARNAME.
---
 ChangeLog         | 5 +++++
 lib/version-etc.c | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index f6737ffb7e..fcdf307237 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-11-22  Andy Wingo  <wingo@pobox.com>
+
+	version-etc: work also with AM_INIT_AUTOMAKE's no-define option
+	* lib/version-etc.c [!defined PACKAGE]: Define to PACKAGE_TARNAME.
+
 2009-11-24  Bruno Haible  <bruno@clisp.org>
 
 	doc: Most *_l functions exist in MacOS X 10.5.
diff --git a/lib/version-etc.c b/lib/version-etc.c
index bf67c37b03..d76aa7c4d8 100644
--- a/lib/version-etc.c
+++ b/lib/version-etc.c
@@ -32,6 +32,12 @@
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
+/* If you use AM_INIT_AUTOMAKE's no-define option,
+   PACKAGE is not defined.  Use PACKAGE_TARNAME instead.  */
+#if ! defined PACKAGE && defined PACKAGE_TARNAME
+# define PACKAGE PACKAGE_TARNAME
+#endif
+
 enum { COPYRIGHT_YEAR = 2009 };
 
 /* The three functions below display the --version information the
-- 
2.39.5