From 32ccbe266de8eaa273c5b8c99a44159bc783470b Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Mon, 27 Sep 2010 21:29:08 +0100 Subject: [PATCH] Trigger rebuild on install prefix change Now store DATADIR, etc. in config.h --- config.h.in | 6 ++++++ configure.ac | 6 ++++++ src/Makefile.am | 4 ---- src/bubblegen.c | 4 ++++ src/display_cow.c | 4 ++++ src/floating_shape.c | 4 ++++ src/settings.c | 4 ++++ src/xcowsay.c | 8 ++++---- src/xcowsayd.c | 4 ++++ 9 files changed, 36 insertions(+), 8 deletions(-) diff --git a/config.h.in b/config.h.in index 15d82ce..ee81799 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Location of data files */ +#undef DATADIR + /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS @@ -98,6 +101,9 @@ /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL +/* Location of locale files */ +#undef LOCALEDIR + /* Name of package */ #undef PACKAGE diff --git a/configure.ac b/configure.ac index 2e82f39..4d7cead 100644 --- a/configure.ac +++ b/configure.ac @@ -41,5 +41,11 @@ AC_ARG_ENABLE(dbus, PKG_CHECK_MODULES(XCOWSAY, $modules) +# Not sure why autoconf doesn't define this itself +pkgdatadir=$datadir/xcowsay + +AC_DEFINE_DIR([DATADIR], [pkgdatadir], [Location of data files]) +AC_DEFINE_DIR([LOCALEDIR], [localedir], [Location of locale files]) + AC_CONFIG_HEADERS([config.h]) AC_OUTPUT([Makefile src/Makefile po/Makefile.in]) diff --git a/src/Makefile.am b/src/Makefile.am index b0b29b7..a7afc06 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,7 +9,3 @@ xcowsay_SOURCES = xcowsay.c display_cow.c display_cow.h floating_shape.h \ xcowsayd.c config_file.h config_file.c i18n.h bubblegen.c EXTRA_DIST = xcowfortune xcowdream xcowthink - -localedir = $(datadir)/locale - -DEFS = -DLOCALEDIR=\"$(localedir)\" -DDATADIR=\"$(pkgdatadir)\" @DEFS@ \ No newline at end of file diff --git a/src/bubblegen.c b/src/bubblegen.c index 3bba779..fff1e5d 100644 --- a/src/bubblegen.c +++ b/src/bubblegen.c @@ -15,6 +15,10 @@ * along with this program. If not, see . */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/display_cow.c b/src/display_cow.c index aea6465..af3e155 100644 --- a/src/display_cow.c +++ b/src/display_cow.c @@ -15,6 +15,10 @@ * along with this program. If not, see . */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #define _GNU_SOURCE #include #include diff --git a/src/floating_shape.c b/src/floating_shape.c index 0a27f8a..36cbf85 100644 --- a/src/floating_shape.c +++ b/src/floating_shape.c @@ -15,6 +15,10 @@ * along with this program. If not, see . */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include "floating_shape.h" diff --git a/src/settings.c b/src/settings.c index ed56b47..dfaaf45 100644 --- a/src/settings.c +++ b/src/settings.c @@ -15,6 +15,10 @@ * along with this program. If not, see . */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/xcowsay.c b/src/xcowsay.c index 648b48c..21292a6 100644 --- a/src/xcowsay.c +++ b/src/xcowsay.c @@ -15,6 +15,10 @@ * along with this program. If not, see . */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #define _GNU_SOURCE #include #include @@ -34,10 +38,6 @@ #include "config_file.h" #include "i18n.h" -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - // Default settings #define DEF_LEAD_IN_TIME 250 #define DEF_DISPLAY_TIME CALCULATE_DISPLAY_TIME diff --git a/src/xcowsayd.c b/src/xcowsayd.c index 82ca3b5..02da251 100644 --- a/src/xcowsayd.c +++ b/src/xcowsayd.c @@ -15,6 +15,10 @@ * along with this program. If not, see . */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include -- 2.39.2