Re: Where Do All These Macros Come From?

2013-05-31 Thread Miles Bader
Paul Smith psm...@gnu.org writes:
 Other macros might have been created specifically for a given project;
 they will be contained in files in that project directory.  Other
 macros might be defined by other 3rdparty software you are trying to
 work with (texinfo, various libraries, etc.)  Those will be defined by
 those packages.

... a widely-used example of this is the PKG_CHECK_MODULES macro, which
is defined by the pkg-config package.

-miles

-- 
Scriptures, n. The sacred books of our holy religion, as distinguished from
the false and profane writings on which all other faiths are based.



Where Do All These Macros Come From?

2013-05-24 Thread Jordan H.

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Hello, folks!

In learning automake I keep looking at example configure.ac files and in
the tutorial someone says oh, you can just use this here macro. I look
in the automake manual, though
(https://www.gnu.org/software/automake/manual/automake.html#Macro-Index)
and find the macro to not be found. One example is AC_CHECK_LIB that's
automatically generated by autoscan...I see very little documentation on
this macro.

Is there a special syntax for configure.ac? This is never really
explained in any tutorial. All I see is someone pulling a variable out
from who-knows-where and a different tutorial doing the exact same thing
pulls a different macro from who-know-where.

Thanks. Hope my question is clear. I'm still sort of a newbie with automake.
-BEGIN PGP SIGNATURE-

iQEcBAEBCgAGBQJRn3hJAAoJEOT99oqiSuRNeygH/AgSIY3qtsem4IsA5Y4JfebQ
wuSrgPy07FrkUx+4rAT6Ul+SRcOY0qttiv8nhPYaK/2y3pC9+mCFXnjdHBEoMGkZ
CKcsfX64nHux6KUkirVEvmVZXxnEKUJzpcNBRkJQAnP2yuNuZKIIcjOVw8/y0YM0
odfeyAdFjcLl89AceR37PE0EsUatN2ISAU8XvwCkfqFiEMdGOP42eQOAyMm4GOIE
56tQv4oBflC0rv5XFbJkd5Z/OjTyySHSi9dQ68HJ0zRHT1x2hIc297yEGPZ/Ot5H
fs28t5Xl64mOWMSrTphpMezNNJdSSMueUFVtq9zBNrkD4x0r0BUIfWWP2zCFBhc=
=RkxA
-END PGP SIGNATURE-




Re: Where Do All These Macros Come From?

2013-05-24 Thread Paul Smith
On Fri, 2013-05-24 at 07:25 -0700, Jordan H. wrote:
 Hello, folks!
 
 In learning automake I keep looking at example configure.ac files and in
 the tutorial someone says oh, you can just use this here macro. I look
 in the automake manual, though
 (https://www.gnu.org/software/automake/manual/automake.html#Macro-Index)
 and find the macro to not be found. One example is AC_CHECK_LIB that's
 automatically generated by autoscan...I see very little documentation on
 this macro.
 
 Is there a special syntax for configure.ac? This is never really
 explained in any tutorial. All I see is someone pulling a variable out
 from who-knows-where and a different tutorial doing the exact same thing
 pulls a different macro from who-know-where.
 
 Thanks. Hope my question is clear. I'm still sort of a newbie with automake.

Your problem is that your confusing automake and autoconf.

Automake is the tool that manages makefiles: it turns a Makefile.am file
into a Makefile.in file.

Autoconf is the tool that manages configuration: it turns a configure.ac
file into the configure script.

When your user runs the configure script, one of the things it does is
convert the Makefile.in file to a normal Makefile.

As a general rule, the autoconf macros that begin with AM_ are
automake macros.  The macros that begin with AC_ are autoconf macros,
and you need to read the autoconf documentation to learn about those.




Re: Where Do All These Macros Come From?

2013-05-24 Thread Jordan H.
Right. I understand that much. My question is about autoconf (sorry 
about saying auto*make*). I see a lot of macros that tutorial authors 
use for which I don't see any documentation. Are they customized for 
that project? Where are they defined? I'm coming from a Makefile 
background (like most everyone). I'm used to having something like this:

CXX=g++
CPPFLAGS=-g -std=c++0x

all: some_target
# blah blah blah...

However, with autoconf I find macros are defined like this:

SOME_MACRO([ BLAH BLAH BLAH ... ], [BLAH BLAH BLAH ... ])

Alright, cool. I can get used to this syntax. How does autoconf know 
what SOME_MACRO is and how to use it in generating a `configure` 
script? I found a list of configure.ac macros in the automake manual 
(the auto*conf* section) but I see a lot of macros that people use that 
are not on the list or nowhere previously defined. How is this 
possible? I'm sorry...I'm really confused here.

On Fri 24 May 2013 07:28:17 AM PDT, Paul Smith wrote:
 On Fri, 2013-05-24 at 07:25 -0700, Jordan H. wrote:
 Hello, folks!

 In learning automake I keep looking at example configure.ac files and in
 the tutorial someone says oh, you can just use this here macro. I look
 in the automake manual, though
 (https://www.gnu.org/software/automake/manual/automake.html#Macro-Index)
 and find the macro to not be found. One example is AC_CHECK_LIB that's
 automatically generated by autoscan...I see very little documentation on
 this macro.

 Is there a special syntax for configure.ac? This is never really
 explained in any tutorial. All I see is someone pulling a variable out
 from who-knows-where and a different tutorial doing the exact same thing
 pulls a different macro from who-know-where.

 Thanks. Hope my question is clear. I'm still sort of a newbie with automake.

 Your problem is that your confusing automake and autoconf.

 Automake is the tool that manages makefiles: it turns a Makefile.am file
 into a Makefile.in file.

 Autoconf is the tool that manages configuration: it turns a configure.ac
 file into the configure script.

 When your user runs the configure script, one of the things it does is
 convert the Makefile.in file to a normal Makefile.

 As a general rule, the autoconf macros that begin with AM_ are
 automake macros.  The macros that begin with AC_ are autoconf macros,
 and you need to read the autoconf documentation to learn about those.




Re: Where Do All These Macros Come From?

2013-05-24 Thread Gavin Smith

 Alright, cool. I can get used to this syntax. How does autoconf know
 what SOME_MACRO is and how to use it in generating a `configure`
 script? I found a list of configure.ac macros in the automake manual
 (the auto*conf* section) but I see a lot of macros that people use that
 are not on the list or nowhere previously defined. How is this
 possible? I'm sorry...I'm really confused here.

autoconf reads a file called aclocal.m4 for extra macro definitions.
This is generated by the aclocal program which is part of automake.



Re: Where Do All These Macros Come From?

2013-05-24 Thread Paul Smith
On Fri, 2013-05-24 at 08:26 -0700, Jordan H. wrote:
 Right. I understand that much. My question is about autoconf (sorry 
 about saying auto*make*). I see a lot of macros that tutorial authors 
 use for which I don't see any documentation.

Well it depends on the macro.  The one you mentioned by name in your
email is AC_CHECK_LIB, and that's defined in the autoconf manual (along
with all the other AC_ macros), which is why I suggested it:

http://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Existing-Tests.html

http://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Libraries.html#Libraries

Those are the ones autoconf provides by default.  Other macros might
have been created specifically for a given project; they will be
contained in files in that project directory.  Other macros might be
defined by other 3rdparty software you are trying to work with (texinfo,
various libraries, etc.)  Those will be defined by those packages.