Ethereal-dev: [Ethereal-dev] DATAFILE_DIR should be set in Makefile.am, not configure.in

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

Date: Thu, 3 Feb 2005 15:58:22 -0600
>From autoconf.info:
     In order to support these features, it is essential that `datadir'
  remains being defined as `${prefix}/share' to depend upon the current
  value of `prefix'.

     A corollary is that you should not use these variables except in
  Makefiles.  For instance, instead of trying to evaluate `datadir' in
  `configure' and hard-coding it in Makefiles using e.g.,
  `AC_DEFINE_UNQUOTED(DATADIR, "$datadir")', you should add
  `-DDATADIR="$(datadir)"' to your `CPPFLAGS'.

Patch attached against 0.10.9.

-- 
albert chin (china@xxxxxxxxxxxxxxxxxx)

-- snip snip
--- configure.in.orig	2005-01-20 09:39:32.000000000 -0600
+++ configure.in	2005-02-03 12:15:16.000000000 -0600
@@ -318,15 +222,6 @@
 	AC_MSG_RESULT(no)
 fi
 
-# Create DATAFILE_DIR #define for config.h
-datafiledir=$datadir/ethereal
-datafiledir=`(
-    test "x$prefix" = xNONE && prefix=$ac_default_prefix
-    test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
-    eval echo "$datafiledir"
-)`
-AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$datafiledir", [Directory for data])
-
 # GTK checks
 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
 # programs to be built with GTK+.
--- epan/Makefile.am.orig	2005-01-17 20:40:02.000000000 -0600
+++ epan/Makefile.am	2005-02-03 12:15:14.000000000 -0600
@@ -34,7 +34,7 @@
 
 include Makefile.common
 
-INCLUDES = -I$(srcdir)/..
+AM_CPPFLAGS = -I$(srcdir)/.. -DDATAFILE_DIR=\"$(datadir)\"
 
 libethereal_la_SOURCES = \
 	$(LIBETHEREAL_SRC)	\