Operating System - HP-UX
1829187 Members
2689 Online
109986 Solutions
New Discussion

os version at compile time

 
Rick Burge_3
Occasional Advisor

os version at compile time

I've seen postings that describe how to get the os major version at compile time. I would like to get the whole version (11.11 or 11.23 for example) at compile time. Something akin to doing a uname -r.

Thanks,
Rick
9 REPLIES 9
Steven E. Protter
Exalted Contributor

Re: os version at compile time

uname -r

DOES display the OS versoin.

Okay, whats the question?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Cem Tugrul
Esteemed Contributor

Re: os version at compile time

uname -r
what you are looking for...
Our greatest duty in this life is to help others. And please, if you can't
Robert-Jan Goossens_1
Honored Contributor

Re: os version at compile time

Hi Rick,

# swlist -v | grep HPUX

software_spec HPUXEng64RT,r=B.11.00,a=HP-UX_B.11.00_64,v=HP
control_directory HPUXEng64RT

Robert-Jan
Cem Tugrul
Esteemed Contributor

Re: os version at compile time

Hi Robert,

i have also recorded your command
and if i were the author then would like to
send points to you unfortunately i am not :-(

Thank's...
Our greatest duty in this life is to help others. And please, if you can't
Rick Burge_3
Occasional Advisor

Re: os version at compile time

Sorry I was not clear. When I compile some code I need for the code to be able to establish some compile time "defs" that describe the os platform.#ifdef hpux11.11 thenfoo = red#elseif hpux11.23 thenfoo = blue#endifI found a posting that that gets me hpux11 and hpux10.x and hpux11.x but is not specific enough to tell me hpux11.23 or 11.11.I mention uname because it does present the specific major and minor as an example of the information I am looking for. I suppose if I could figure out where uname picks up its information (from some h file somewhere?) maybe I could use the same definition it uses.Rick
Rick Burge_3
Occasional Advisor

Re: os version at compile time

I'm not sure why my last response was all bunched up I hope this one comes out better.Sorry I was not clear. When I compile some code I need for the code to be able to establish some compile time "defs" that describe the os platform.#ifdef hpux11.11 thenfoo = red#elseif hpux11.23 thenfoo = blue#endifI found a posting that that gets me hpux11 and hpux10.x and hpux11.x but is not specific enough to tell me hpux11.23 or 11.11.#include #if defined(PRIV_PSET)#define _hpux_11i#elif defined(PRIV_SPUCTL)#define __hpux_11x#elif defined(PRIV_SERIALIZE)#define __hpux_10x#elif defined(PRIV_SETRUGID)#define __hpux_9x#endifI mention uname because it does present the specific major and minor as an example of the information I am looking for. I suppose if I could figure out where uname picks up its information (from some h file somewhere?) maybe I could use the same definition it uses.Rick
Don Morris_1
Honored Contributor

Re: os version at compile time

Or you could have the Makefile stage for the program do the uname -r and pass a -DHPUX1111, -DHPUX1123, etc. based on what it finds so that your #defines work from there. Seems simpler to me.
Gregory Fruth
Esteemed Contributor

Re: os version at compile time

If possible, you'd be better off just doing
an #ifdef test for the actual features you
need instead of testing for 11.23 vs. 11.11
specifically.

Otherwise, if a patch changes or removes
a feature but doesn't change the HP-UX
version, your hypothetical #ifdef HPUX1123
won't help you.

What features from 11.23 are you looking
to test for?

Rick Burge_3
Occasional Advisor

Re: os version at compile time

Thanks