checking for optional dependencies

2010-06-29 Thread Wesley Smith
I'm looking for some sample code on how to best check for an optional
dependencies (like gstreamer or some other lib) and set a compilation
flag like -DMYLIB_HAVE_GSTREAMER.

I'm not exactly which one of these functions or how to use them to do
this, so any pointers to a sample is much appreciated.
AC_CHECK_LIB
AC_SEARCH_LIBS


wes



determining 32 v. 64 bit compilation

2010-06-29 Thread Wesley Smith
What's the appropriate way to determine 32 v. 64 bit compilation?
I've looked into using:

AC_CANONICAL_BUILD

with the $build_cpu $build_vendor $build_os variables, but it doesn't
give the right info (in my case i686 pc linux-gnu).  I'm essentially
looking for something in autoconf land equivalent to:

#if defined(__LP64__) || defined(_LP64)
#define OSBIT 64;
#else
#define OSBIT 32;
#endif


thanks in advance!
wes



Re: determining 32 v. 64 bit compilation

2010-06-29 Thread Stefano Lattarini
At Tuesday 29 June 2010, Wesley Smith wrote:
> ... I'm essentially looking for something in autoconf land ...
I think you should write to the autoconf list (autoc...@gnu.org) for 
general questions regarding autoconf.

Regards,
Stefano



Re: determining 32 v. 64 bit compilation

2010-06-29 Thread Wesley Smith
no problem.  I'll take the Q over there.
wes

On Tue, Jun 29, 2010 at 8:06 PM, Stefano Lattarini
 wrote:
> At Tuesday 29 June 2010, Wesley Smith wrote:
>> ... I'm essentially looking for something in autoconf land ...
> I think you should write to the autoconf list (autoc...@gnu.org) for
> general questions regarding autoconf.
>
> Regards,
>    Stefano
>



Re: checking for optional dependencies

2010-06-29 Thread Ralf Wildenhues
Hi Wesley,

* Wesley Smith wrote on Tue, Jun 29, 2010 at 02:52:38PM CEST:
> I'm looking for some sample code on how to best check for an optional
> dependencies (like gstreamer or some other lib) and set a compilation
> flag like -DMYLIB_HAVE_GSTREAMER.
> 
> I'm not exactly which one of these functions or how to use them to do
> this, so any pointers to a sample is much appreciated.
> AC_CHECK_LIB
> AC_SEARCH_LIBS

Do the examples in `info Autoconf "External Software"' help?
For macro definition, see e.g., `info Autoconf --index AC_CHECK_LIB'.
If you have any code at all, even if it doesn't work, show it, that
way it is usually easier to help.

Cheers,
Ralf



Re: $(DEPDIR)

2010-06-29 Thread Bruce Korb
Hi Ralf,

I'm at work now, so not too much play time available.
But some.

On Mon, Jun 28, 2010 at 10:02 PM, Ralf Wildenhues
 wrote:
>> >  Do you
>> > intend to write a patch for Automake, or is this something purely
>> > external for one specific project, or to be more generally usable for
>> > all users of Autogen inside a project using Automake for building?
>>
>> That would be the hope.
>
> I shouldn't ask questions containing "or".

I shouldn't answer "or" questions with "yes". :)
I meant to say I agreed with the latter 3/4 of the question --
more generally available to autogen users, but actually usable by any
tool or script that can produce both a sentinel file and a dependency file.
In my case, they are the same file, but that isn't necessarily so.

>>  I'd like to augment automake with a standalone
>> capability to say, "'dependency-file-name' is a build target and it contains
>> make dependency information for makes that can cope with reading it."
>> Perhaps along the lines of:
>>
>>     mymodule_DEPEND_TARGET := dependency-file-name
>>
>> and a dummy dependency-file-name gets created along with all that
>> sedding magic to convert that "@am__include@" line into a make inclusion.
>
> That sounds like a good idea to me, but I haven't had time to think
> through the details yet.  One definite problem is namespace issues:
> stamp-opts is too general for use in Automake; what about at least a
> tool prefix, as in ag-stamp-opts, instead, for the file name as well
> as the rule of course?  Better even a couple of knobs to twist.

The "dependency-file-name" can be anything you like.
It would be nice to know it can be:  $(DEPDIR)/whatever
which would mean that use of module_DEPEND_TARGET
implies support gets added for DEPDIR.  Anyway, "stamp-foo" would
be the Makefile.am's author's responsibility and choice.

> Another is the mymodule_DEPEND_TARGET variable name, I don't like that
> yet either.

If you don't like the "DEPEND_TARGET" suffix, please suggest another. :)

> As long as the feature isn't available in Automake, your users can work
> around by adding
> �...@amdep_true@@am__include@ @am__qu...@./$(DEPDIR)/autogen-ag...@am__quote@
>
> to their Makefile.am files; this does require the `no-dependencies'
> Automake option to not be used, and it requires one of the compiler
> macros AC_PROG_{CC,CXX,F77,...} to be used.

Since it isn't documented that AC_PROG_xxx will add those substitutions
to the configured values, there isn't a guarantee that the implementation
would not change.  Furthermore, it is really ugly stuff to put in Automake.am.

> Actually, the idea as it stands does not degrade gracefully when the
> author uses the no-dependencies option; in that case, automatic
> dependencies should not be used, but if we drop your file, I think the
> build will fail, no?

There would need to be a well understood way of telling the tool at hand
that no dependencies should be created.  That, for me, would mean a
way to drop the ``-MFwhatever'' option, which ought to look pretty much
like the alternating build rule for languages.

Puzzling on it, I think I'd use this:

if GLOBALDEPMODE
agdeparg = -MF$(mymodule_DEPEND_TARGET)
else
agdeparg =
endif

and use $(agdeparg) instead of alternating text for the entire command.
But that would have to be magic outside the realm of something_DEPEND_TARGET.