autoconf
[Top][All Lists]
Advanced

[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 2.0.0.19 (X11/20090218)

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.

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.

http://www.nongnu.org/autoconf-archive/ax_cache_size.html

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.

Dave




reply via email to

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