autoconf
[Top][All Lists]
Advanced

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

Re: How to test if preprocessor defines foobar in macro?


From: Noah Misch
Subject: Re: How to test if preprocessor defines foobar in macro?
Date: Wed, 14 Oct 2009 00:56:17 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

On Wed, Oct 14, 2009 at 05:36:36AM +0100, Dr. David Kirkby wrote:
> I'm trying to modify this macro
>
> http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_count_cpus.m4
>
> which attempt to get the number of CPUs in a system. I'd like to extend  
> it to cover Solaris, AIX and HP-UX.
>
> It seems sensible to me to only do a test on a platform it will work on,  
> so I think thinking of something like
>
> if `uname` = "HP-UX"
>   write test for HP-UX
> fi
>
> or I could check if __hpux__ is defined or not.

See AC_CANONICAL_HOST for the way of identifying the host platform.  However, we
generally omit explicit assumptions about the right test for a certain system
type.  Instead, try each test unconditionally and use the first one that works.
The code you reference currently does this.

Consider checking processor count and cache characteristics at runtime.  If a OS
distribution ships binaries of your software, they will run on a wide range of
processor configurations.  You might need `configure'-time checks to verify the
availability of the APIs you would use at runtime.

Attachment: pgp08niF_Hl5Q.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]