/[autoconf]/autoconf/doc/autoconf.texi
ViewVC logotype

Diff of /autoconf/doc/autoconf.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.670 by akim, Mon Sep 9 16:27:02 2002 UTC revision 1.671 by akim, Wed Sep 11 10:11:27 2002 UTC
# Line 163  Software Foundation raise funds for GNU Line 163  Software Foundation raise funds for GNU
163  * config.status Invocation::    Recreating a configuration  * config.status Invocation::    Recreating a configuration
164  * Obsolete Constructs::         Kept for backward compatibility  * Obsolete Constructs::         Kept for backward compatibility
165  * Using Autotest::              Creating portable test suites  * Using Autotest::              Creating portable test suites
166  * Questions::                   Questions about Autoconf, with answers  * FAQ::                         Frequent Questions about Autoconf, with answers
167  * History::                     History of Autoconf  * History::                     History of Autoconf
168  * Copying This Manual::         How to make copies of this manual  * Copying This Manual::         How to make copies of this manual
169  * Indices::                     Indices of symbols, concepts, etc.  * Indices::                     Indices of symbols, concepts, etc.
# Line 426  Using an Autotest Test Suite Line 426  Using an Autotest Test Suite
426  * testsuite Scripts::           The concepts of Autotest  * testsuite Scripts::           The concepts of Autotest
427  * Autotest Logs::               Their contents  * Autotest Logs::               Their contents
428    
429  Questions About Autoconf  Frequently Asked Questions About Autoconf
430    
431  * Distributing::                Distributing @command{configure} scripts  * Distributing::                Distributing @command{configure} scripts
432  * Why GNU m4::                  Why not use the standard M4?  * Why GNU m4::                  Why not use the standard M4?
433  * Bootstrapping::               Autoconf and GNU M4 require each other?  * Bootstrapping::               Autoconf and GNU M4 require each other?
434  * Why Not Imake::               Why GNU uses @command{configure} instead of Imake  * Why Not Imake::               Why GNU uses @command{configure} instead of Imake
435    * Defining Directories::        Passing @code{datadir} to program
436    
437  History of Autoconf  History of Autoconf
438    
# Line 527  features that some @sc{unix} versions of Line 528  features that some @sc{unix} versions of
528  do not have.  You must use version 1.4 or later of @sc{gnu} M4.  do not have.  You must use version 1.4 or later of @sc{gnu} M4.
529    
530  @xref{Autoconf 1}, for information about upgrading from version 1.  @xref{Autoconf 1}, for information about upgrading from version 1.
531  @xref{History}, for the story of Autoconf's development.  @xref{History}, for the story of Autoconf's development.  @xref{FAQ},
532  @xref{Questions}, for answers to some common questions about Autoconf.  for answers to some common questions about Autoconf.
533    
534    
535  See the @href{http://www.gnu.org/software/autoconf/autoconf.html,  See the @href{http://www.gnu.org/software/autoconf/autoconf.html,
# Line 13750  distributed. Line 13751  distributed.
13751    
13752    
13753    
13754  @c ================================================ Questions About Autoconf.  @c =============================== Frequently Asked Questions About Autoconf
13755    
13756  @node Questions  @node FAQ
13757  @chapter Questions About Autoconf  @chapter Frequently Asked Questions About Autoconf
13758    
13759  Several questions about Autoconf come up occasionally.  Here some of them  Several questions about Autoconf come up occasionally.  Here some of them
13760  are addressed.  are addressed.
# Line 13763  are addressed. Line 13764  are addressed.
13764  * Why GNU m4::                  Why not use the standard M4?  * Why GNU m4::                  Why not use the standard M4?
13765  * Bootstrapping::               Autoconf and GNU M4 require each other?  * Bootstrapping::               Autoconf and GNU M4 require each other?
13766  * Why Not Imake::               Why GNU uses @command{configure} instead of Imake  * Why Not Imake::               Why GNU uses @command{configure} instead of Imake
13767    * Defining Directories::        Passing @code{datadir} to program
13768  @end menu  @end menu
13769    
13770  @node Distributing  @node Distributing
# Line 13938  duplicated, even though they normally ar Line 13940  duplicated, even though they normally ar
13940  @end quotation  @end quotation
13941    
13942    
13943    @node Defining Directories
13944    @section How Do I @code{#define} Installation Directories?
13945    
13946    @display
13947    My program needs library files, installed in @code{datadir} and
13948    similar.  If I use
13949    
13950    @example
13951    AC_DEFINE_UNQUOTED([DATADIR], [$datadir],
13952                       [Define to the read-only architecture-independent
13953                        data directory.])
13954    @end example
13955    
13956    @noindent
13957    I get
13958    
13959    @example
13960    #define DATADIR "$@{prefix@}/share"
13961    @end example
13962    @end display
13963    
13964    As already explained, this behavior is on purpose, mandated by the GNU
13965    Coding Standards, see @ref{Installation Directory Variables}.  There are
13966    several means to acheive a similar goal:
13967    
13968    @itemize @minus
13969    @item
13970    Do not use @code{AC_DEFINE} but use your @file{Makefile} to pass the
13971    actual value of @code{datadir} via compilation flags, see
13972    @ref{Installation Directory Variables}, for the details.
13973    
13974    @item
13975    This solution can be simplified when compiling a program: you may either
13976    extend the @code{CPPFLAGS}:
13977    
13978    @example
13979    CPPFLAGS = -DDATADIR=\"$(datadir)\" @@CPPFLAGS@@
13980    @end example
13981    
13982    @noindent
13983    or create a dedicated header file:
13984    
13985    @example
13986    DISTCLEANFILES = datadir.h
13987    datadir.h: Makefile
13988            echo '#define DATADIR "$(datadir)"' >$@@
13989    @end example
13990    
13991    @item
13992    Use @code{AC_DEFINE} but have @command{configure} compute the literal
13993    value of @code{datadir} and others.  Many people have wrapped macros to
13994    automate this task.  For instance, the macro @code{AC_DEFINE_DIR} from
13995    the @href{http://www.gnu.org/software/ac-archive/, Autoconf Macro
13996    Archive}.
13997    
13998    This solution is not conformant with the GNU Coding Standards.
13999    
14000    @item
14001    Note that all the previous solutions hard wire the absolute path to
14002    these directories in the executables, which is not a good property.  You
14003    may try to compute the paths relatively to @code{prefix}, and try to
14004    find @code{prefix} at runtime, this way your package is relocatable.
14005    Some macros are already available to address this issue: see
14006    @code{adl_COMPUTE_RELATIVE_PATHS} and
14007    @code{adl_COMPUTE_STANDARD_RELATIVE_PATHS} on the
14008    @href{http://www.gnu.org/software/ac-archive/, Autoconf Macro Archive}.
14009    @end itemize
14010    
14011    
14012    
14013  @c ===================================================== History of Autoconf.  @c ===================================================== History of Autoconf.

Legend:
Removed from v.1.670  
changed lines
  Added in v.1.671

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26