tReplaced various -D options set in the configure script with #defines in confi… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 41d6f76d8c0674a44f19c425f2e1ebcbfcf9d6bc | |
parent 47249996a7dd0ed7036a99a11c791bf8b05f2693 | |
Author: Ben Webb <[email protected]> | |
Date: Mon, 24 Jun 2002 11:32:11 +0000 | |
Replaced various -D options set in the configure script with #defines in | |
config.h; added the DP_EXPAND_DIR macro to expand out ${prefix} etc. in | |
directory names. (This also has the benefit that dopewars is rebuilt | |
properly now if you change the prefix, as it depends on config.h.) | |
Diffstat: | |
M configure.in | 21 +++++++++++++-------- | |
A m4/dp_expand_dir.m4 | 24 ++++++++++++++++++++++++ | |
M src/Makefile.am | 2 +- | |
3 files changed, 38 insertions(+), 9 deletions(-) | |
--- | |
diff --git a/configure.in b/configure.in | |
t@@ -220,9 +220,6 @@ if test "$gt_cv_func_gettext_libintl" = "yes"; then | |
LIBS="-lintl $LIBS" | |
fi | |
-localedir=${datadir}/locale | |
-AC_SUBST(localedir) | |
- | |
if test "$GUI_CLIENT" = "yes" ; then | |
AC_DEFINE(GUI_CLIENT, 1, [Use the graphical client?]) | |
fi | |
t@@ -269,8 +266,9 @@ if test "$plugins" = "yes" ; then | |
AC_DEFINE(PLUGINS, 1, [Define if using dynamically-loaded sound modules]) | |
plugindir="${libdir}/dopewars" | |
AC_SUBST(plugindir) | |
- PLUGINDEF="-DPLUGINDIR=\\\"${plugindir}\\\"" | |
- AC_SUBST(PLUGINDEF) | |
+ DP_EXPAND_DIR(PLUGINDIR, '${plugindir}') | |
+ AC_DEFINE_UNQUOTED(PLUGINDIR, "$PLUGINDIR", | |
+ [The directory containing the plugins]) | |
else | |
PLUGOBJS="plugins/sound_sdl.o plugins/sound_esd.o plugins/sound_winmm.o" | |
AC_SUBST(PLUGOBJS) | |
t@@ -324,9 +322,16 @@ if test -n "$GCC"; then | |
fi | |
fi | |
-dnl Pass the data directory to the compiler so the program knows | |
-dnl where the high scores and docs are | |
-CFLAGS="$CFLAGS -DDATADIR=\\\"${datadir}\\\"" | |
+dnl Tell dopewars where the high scores, docs and locale files are | |
+DP_EXPAND_DIR(DATADIR, '${datadir}') | |
+AC_DEFINE_UNQUOTED(DATADIR, "$DATADIR", | |
+ [The directory containing the high score file and docs]) | |
+ | |
+localedir=${datadir}/locale | |
+AC_SUBST(localedir) | |
+DP_EXPAND_DIR(LOCALEDIR, '${localedir}') | |
+AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", | |
+ [The directory containing locale files]) | |
dnl Add in the required clients | |
AM_CONDITIONAL(GUI_CLIENT, test "$GUI_CLIENT" = "yes") | |
diff --git a/m4/dp_expand_dir.m4 b/m4/dp_expand_dir.m4 | |
t@@ -0,0 +1,24 @@ | |
+dnl DP_EXPAND_DIR(VARNAME, DIR) | |
+dnl expands occurrences of ${prefix} and ${exec_prefix} in the given DIR, | |
+dnl and assigns the resulting string to VARNAME | |
+dnl example: DP_EXPAND_DIR(LOCALEDIR, "$datadir/locale") | |
+dnl eg, then: AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR") | |
+dnl by Alexandre Oliva | |
+dnl from http://www.cygnus.com/ml/automake/1998-Aug/0040.html | |
+dnl Modified by Ben Webb, 2002, to perform two expansions; this | |
+dnl handles the case where DIR is something like ${datadir} | |
+dnl (first expansion -> ${prefix}/share, | |
+dnl second expansion -> /usr/local/share) | |
+AC_DEFUN(DP_EXPAND_DIR, [ | |
+ $1=$2 | |
+ $1=`( | |
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix" | |
+ test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" | |
+ eval echo \""[$]$1"\" | |
+ )` | |
+ $1=`( | |
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix" | |
+ test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" | |
+ eval echo \""[$]$1"\" | |
+ )` | |
+]) | |
diff --git a/src/Makefile.am b/src/Makefile.am | |
t@@ -30,7 +30,7 @@ dopewars_SOURCES = admin.c admin.h AIPlayer.c AIPlayer.h uti… | |
serverside.c serverside.h sound.c sound.h \ | |
tstring.c tstring.h winmain.c winmain.h | |
INCLUDES = -I../intl -I${srcdir} -I.. @GTK_CFLAGS@ | |
-DEFS = @DEFS@ -DLOCALEDIR=\"${localedir}\" @PLUGINDEF@ | |
+DEFS = @DEFS@ | |
PIXDIR = ${DESTDIR}${datadir}/pixmaps | |
DOPEDIR = ${DESTDIR}${bindir} | |
DOPEBIN = ${DOPEDIR}/dopewars |