[Top][All Lists]

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

How to test if preprocessor defines foobar in macro?

From: Dr. David Kirkby
Subject: How to test if preprocessor defines foobar in macro?
Date: Wed, 14 Oct 2009 05:36:36 +0100
User-agent: Thunderbird (X11/20090218)

I'm trying to modify this macro;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

or I could check if __hpux__ is defined or not.

Can anyone show me how to modify the above autoconf macro to do the test using either uname, a macro that the pre-processor defines, or other that allows me to execute a bit of code on only one platform. method.

There's another macro I've seen used for determine cache sizes of processors.

which depends on the CPU being an x86 one, which it will often not be. I don't fancy the task of trying to work out cache sizes for every processor used on machines running Solaris, AIX or HP-UX, so will try to modify that so it returns a sensible guess (say 1 MB) on processors it does not know about. The test is causing a script to crash on HP-UX.


reply via email to

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