SEO

vBulletin Search Engine Optimization


Go Back   UnixAdminTalk.com > Unix Operating Systems > HP-UX Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-17-2008, 05:26 PM
Michael Kraemer
 
Posts: n/a
Default HP-UX version/release numbers, how ?

hello world,

I'm looking for predefined constant(s) which would give
me the version and release numbers of HP-UX during compiler runs,
i.e. sth universal and unique like "__hpux" I could put into an #ifdef.

As a workaround I've tried to use "-D..." settings during make & compile,
but unfortunately HP's "uname" implementation is braindead (IMHO).
So when I'm running under 11.00
`uname -v` gives me B.11.00 (would have expected just "11")
and
`uname -r` gives me some nonsense (would have expected just "00").

I know that e.g. AIX predefines -D_AIX41 for everything higher than Version 4.1
and -D_AIX43 for everything higher than Version 4.3, and so forth.
Is there an equivalent on HP-UX ?

Reply With Quote
  #2 (permalink)  
Old 01-18-2008, 05:13 PM
Dennis Handly
 
Posts: n/a
Default Re: HP-UX version/release numbers, how ?

Michael Kraemer wrote:
> I'm looking for predefined constant(s) which would give
> me the version and release numbers of HP-UX during compiler runs,


The HP-UX user space architect doesn't want this. He says you are
suppose to use the feature test macros, not OS versions.

> but unfortunately HP's "uname" implementation is braindead (IMHO).


The proper way to use uname(1) is:
$ echo $(uname -r | sed -e 's/..//' -e 's/\.//')
Reply With Quote
  #3 (permalink)  
Old 01-18-2008, 05:13 PM
Michael Kraemer
 
Posts: n/a
Default Re: HP-UX version/release numbers, how ?

Dennis Handly schrieb:
> Michael Kraemer wrote:
>
>> I'm looking for predefined constant(s) which would give
>> me the version and release numbers of HP-UX during compiler runs,

>
>
> The HP-UX user space architect doesn't want this. He says you are
> suppose to use the feature test macros, not OS versions.


OK, then how do I test (on the #ifdef level) the existence of
e.g. dlopen() and friends, w/o including dlfcn.h ?
These do not exist in earlier versions ( 9, 10.x ?).

>> but unfortunately HP's "uname" implementation is braindead (IMHO).

>
> The proper way to use uname(1) is:
> $ echo $(uname -r | sed -e 's/..//' -e 's/\.//')


OK, I'll give it a try.
Meanwhile, I have found a section in the FAQ,
with a test on certain flags defined in <sys/privgrp.h>.
Is this safe enough ? Looks a bit dodgy to me.

thanks anyway.



Reply With Quote
  #4 (permalink)  
Old Yesterday, 12:35 PM
 
Posts: n/a
Default Re: HP-UX version/release numbers, how ?

On Thu, 17 Jan 2008, Michael Kraemer wrote:

> Date: Thu, 17 Jan 2008 16:10:07 +0000 (UTC)
> From: Michael Kraemer <[email protected]>
> Newsgroups: comp.sys.hp.hpux
> Subject: HP-UX version/release numbers, how ?
>
> hello world,
>
> I'm looking for predefined constant(s) which would give
> me the version and release numbers of HP-UX during compiler runs,
> i.e. sth universal and unique like "__hpux" I could put into an #ifdef.
>
> As a workaround I've tried to use "-D..." settings during make & compile,
> but unfortunately HP's "uname" implementation is braindead (IMHO).
> So when I'm running under 11.00
> `uname -v` gives me B.11.00 (would have expected just "11")
> and
> `uname -r` gives me some nonsense (would have expected just "00").
>
> I know that e.g. AIX predefines -D_AIX41 for everything higher than Version 4.1
> and -D_AIX43 for everything higher than Version 4.3, and so forth.
> Is there an equivalent on HP-UX ?
>
>


For gcc on just about every platform I compile upon, i create a script
I call predefined, which takes a single argument, the compiler you use,
and it will show you what is predefined on that particular platform:

predefined gcc

The file contains the following single line:

$1 -E -dM - < /dev/null

HTH
Rob Sciuk
---- Posted via Pronews.com - Premium Corporate Usenet News Provider ----
http://www.pronews.com offers corporate packages that have access to 100,000+ newsgroups
Reply With Quote
  #5 (permalink)  
Old Yesterday, 12:35 PM
Michael Kraemer
 
Posts: n/a
Default Re: HP-UX version/release numbers, how ?

[email protected] schrieb:

>
> For gcc on just about every platform I compile upon, i create a script
> I call predefined, which takes a single argument, the compiler you use,
> and it will show you what is predefined on that particular platform:
>
> predefined gcc
>
> The file contains the following single line:
>
> $1 -E -dM - < /dev/null
>
> HTH
> Rob Sciuk


Unfortunately this is not quite what I was looking for.
Apart from the fact that I use native compilers wherever possible,
your example gives a lot of #defines, but not the OS version.
And it does not give me the opportunity to put a simple
#if defined(__hpux) && ( OSVERSION < 1000 )
into the source code.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:00 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0