manpagez: man pages & more
info autoconf
Home | html | info | man

File: autoconf.info,  Node: New Macros,  Next: Hosts and Cross-Compilation,  Prev: Changed Quotation,  Up: Autoconf 2.13

18.6.2 New Macros
-----------------

While Autoconf was relatively dormant in the late 1990s, Automake
provided Autoconf-like macros for a while.  Starting with Autoconf 2.50
in 2001, Autoconf provided versions of these macros, integrated in the
‘AC_’ namespace, instead of ‘AM_’.  But in order to ease the upgrading
via ‘autoupdate’, bindings to such ‘AM_’ macros are provided.

   Unfortunately older versions of Automake (e.g., Automake 1.4) did not
quote the names of these macros.  Therefore, when ‘m4’ finds something
like ‘AC_DEFUN(AM_TYPE_PTRDIFF_T, ...)’ in ‘aclocal.m4’,
‘AM_TYPE_PTRDIFF_T’ is expanded, replaced with its Autoconf definition.

   Fortunately Autoconf catches pre-‘AC_INIT’ expansions, and complains,
in its own words:

     $ cat configure.ac
     AC_INIT([Example], [1.0], [bug-example@example.org])
     AM_TYPE_PTRDIFF_T
     $ aclocal-1.4
     $ autoconf
     aclocal.m4:17: error: m4_defn: undefined macro: _m4_divert_diversion
     aclocal.m4:17: the top level
     autom4te: m4 failed with exit status: 1
     $

   Modern versions of Automake no longer define most of these macros,
and properly quote the names of the remaining macros.  If you must use
an old Automake, do not depend upon macros from Automake as it is simply
not its job to provide macros (but the one it requires itself):

     $ cat configure.ac
     AC_INIT([Example], [1.0], [bug-example@example.org])
     AM_TYPE_PTRDIFF_T
     $ rm aclocal.m4
     $ autoupdate
     autoupdate: 'configure.ac' is updated
     $ cat configure.ac
     AC_INIT([Example], [1.0], [bug-example@example.org])
     AC_CHECK_TYPES([ptrdiff_t])
     $ aclocal-1.4
     $ autoconf
     $

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.