[PATCH v2 app-xfd] Use the Automake recommended alternative to AX_DEFINE_DIR

Gaetan Nadon memsize at videotron.ca
Thu Dec 8 05:35:42 PST 2011


DATADIR, like any installation variable, is not known at configure time.
This is by design to allow setting the variable at make time.
The AX_DEFINE_DIR macro worked around this design and consequently
cancelled an Automake feature.

The alternative method suggested by Automake ends up being simpler
while providing the same result as AX_DEFINE_DIR but without cancelling
any feature. It is used in the xserver for the parser and in xquartz.

The AX_DEFINE_DIR macro has been removed from the Autoconf Archive.
There are no official providers for this macro anymore.

Separate pre-processor from compiler flags.
XFD_CFLAGS and CWARNFLAGS may contain compiler flags.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 Makefile.am         |    5 ++---
 configure.ac        |    3 +--
 m4/ax_define_dir.m4 |   49 -------------------------------------------------
 3 files changed, 3 insertions(+), 54 deletions(-)
 delete mode 100644 m4/ax_define_dir.m4

diff --git a/Makefile.am b/Makefile.am
index 5052217..b179b4c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,11 +22,10 @@
 SUBDIRS = man
 bin_PROGRAMS = xfd
 
-AM_CFLAGS = $(XFD_CFLAGS) $(CWARNFLAGS) -DXRENDER -D_BSD_SOURCE
+AM_CPPFLAGS = -DXRENDER -D_BSD_SOURCE -DLOCALEDIR=\"$(LOCALEDIR)\"
+AM_CFLAGS = $(XFD_CFLAGS) $(CWARNFLAGS)
 xfd_LDADD = $(XFD_LIBS)
 
-ACLOCAL_AMFLAGS = -I m4
-
 xfd_SOURCES =	\
         grid.c \
         grid.h \
diff --git a/configure.ac b/configure.ac
index 51fadfb..f4e84e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,6 @@ dnl Process this file with autoconf to create configure.
 AC_PREREQ([2.60])
 AC_INIT([xfd],[1.1.0],
 	[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xfd])
-AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
@@ -43,7 +42,7 @@ AC_MSG_CHECKING([where to install localized messages])
 AC_ARG_WITH([localedir], AS_HELP_STRING([--with-localedir=<path>],
         [Path to install message files in (default: datadir/locale)]),
         [LOCALEDIR=${withval}], [LOCALEDIR=${datadir}/locale])
-AX_DEFINE_DIR([LOCALEDIR], [LOCALEDIR], [Location of translated messages])
+AC_SUBST([LOCALEDIR])
 if test "x$LOCALEDIR" = "xno" -o "x$USE_GETTEXT" = "xno" ; then
         AC_MSG_RESULT([nowhere])
         USE_GETTEXT="no"
diff --git a/m4/ax_define_dir.m4 b/m4/ax_define_dir.m4
deleted file mode 100644
index b74d155..0000000
--- a/m4/ax_define_dir.m4
+++ /dev/null
@@ -1,49 +0,0 @@
-# ===========================================================================
-#       http://www.gnu.org/software/autoconf-archive/ax_define_dir.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AX_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
-#
-# DESCRIPTION
-#
-#   This macro sets VARNAME to the expansion of the DIR variable, taking
-#   care of fixing up ${prefix} and such.
-#
-#   VARNAME is then offered as both an output variable and a C preprocessor
-#   symbol.
-#
-#   Example:
-#
-#     AX_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.])
-#
-# LICENSE
-#
-#   Copyright (c) 2008 Stepan Kasal <kasal at ucw.cz>
-#   Copyright (c) 2008 Andreas Schwab <schwab at suse.de>
-#   Copyright (c) 2008 Guido U. Draheim <guidod at gmx.de>
-#   Copyright (c) 2008 Alexandre Oliva
-#
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved. This file is offered as-is, without any
-#   warranty.
-
-#serial 6
-
-AU_ALIAS([AC_DEFINE_DIR], [AX_DEFINE_DIR])
-AC_DEFUN([AX_DEFINE_DIR], [
-  prefix_NONE=
-  exec_prefix_NONE=
-  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
-  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
-dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
-dnl refers to ${prefix}.  Thus we have to use `eval' twice.
-  eval ax_define_dir="\"[$]$2\""
-  eval ax_define_dir="\"$ax_define_dir\""
-  AC_SUBST($1, "$ax_define_dir")
-  AC_DEFINE_UNQUOTED($1, "$ax_define_dir", [$3])
-  test "$prefix_NONE" && prefix=NONE
-  test "$exec_prefix_NONE" && exec_prefix=NONE
-])
-- 
1.7.4.1



More information about the xorg-devel mailing list