[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] [Fwd: Bug#368502 closed by Ben Pfaff <blp@cs.stanford.edu> (reply to blp@cs.stanford.edu) (closing: configure.in does not follow documentation guidelines)]

Looks like Autoconf is changing again! Anything past 2.59 will break most things in CVS.

--- Begin Message ---
This is an automatic notification regarding your Bug report
#368502: autoconf: breaks existing build systems that use ${datadir},
which was filed against the autoconf package.

It has been closed by Ben Pfaff <blp@cs.stanford.edu> (reply to blp@cs.stanford.edu).

Their explanation is attached below.  If this explanation is
unsatisfactory and you have not received a better one in a separate
message then please contact Ben Pfaff <blp@cs.stanford.edu> (reply to blp@cs.stanford.edu) by replying
to this email.

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
As Ralf points out, the following code in the configure.in in
question does not follow the guidelines in the Autoconf

| dnl Set PACKAGE_DATA_DIR in config.h.
| if test "x${datadir}" = 'x${prefix}/share'; then
|   if test "x${prefix}" = "xNONE"; then
|     AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}", [Shared Data Directory] )
|   else
|     AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}", [Shared Data Directory])
|   fi
| else
|   AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datadir}/${PACKAGE}", [Shared Data Directory])
| fi

Here is the particular recommendation from the documentation that
this violates.  Because this is a bug in configure.in, not in
Autoconf, I am closing this bug.

How Do I `#define' Installation Directories?

     My program needs library files, installed in `datadir' and
     similar.  If I use
          AC_DEFINE_UNQUOTED([DATADIR], [$datadir],
                             [Define to the read-only architecture-independent
                              data directory.])
     I get
          #define DATADIR "${prefix}/share"

As already explained, this behavior is on purpose, mandated by the GNU
Coding Standards, see *Note Installation Directory Variables::.  There
are several means to achieve a similar goal:

   - Do not use `AC_DEFINE' but use your `Makefile' to pass the actual
     value of `datadir' via compilation flags, see *Note Installation
     Directory Variables::, for the details.

   - This solution can be simplified when compiling a program: you may
     either extend the `CPPFLAGS':

          CPPFLAGS = -DDATADIR=\"$(datadir)\" @CPPFLAGS@

     or create a dedicated header file:

          DISTCLEANFILES = datadir.h
          datadir.h: Makefile
                  echo '#define DATADIR "$(datadir)"' >$@

   - Use `AC_DEFINE' but have `configure' compute the literal value of
     `datadir' and others.  Many people have wrapped macros to automate
     this task.  For instance, the macro `AC_DEFINE_DIR' from the
     Autoconf Macro Archive(1).

     This solution does not conform to the GNU Coding Standards.

   - Note that all the previous solutions hard wire the absolute path to
     these directories in the executables, which is not a good
     property.  You may try to compute the paths relatively to
     `prefix', and try to find `prefix' at runtime, this way your
     package is relocatable.  Some macros are already available to
     address this issue: see `adl_COMPUTE_RELATIVE_PATHS' and
     `adl_COMPUTE_STANDARD_RELATIVE_PATHS' on the Autoconf Macro

   ---------- Footnotes ----------

   (1) Autoconf Macro Archive,

   (2) Autoconf Macro Archive,

"In this world that Hugh Heffner had made,
 he alone seemed forever bunnyless."
--John D. MacDonald

--- End Message ---

--- End Message ---