njw@doc.ic.ac.uk (Nick Williams) (10/18/90)
Okay, now that I finally have a working version of gcc et al under HPUX 7.0, I naturally want to compile programs. However, at some magical point in the hpux C compiler, there are a couple of #define's made, which I can't track down: _INCLUDE_POSIX_SOURCE _INCLUDE_XOPEN_SOURCE _INCLUDE_HPUX_SOURCE I can't find these in /lib/cpp, cc or any of the similar type places. But if the XOPEN define is not made, then such types as caddr_t are not defined by <sys/types.h>. Hence compiling an X program gets awkward. How does the 'normal' hpux compiler define these? And how does it decide which ones are neccessary? Which ones are neccessary? Compiling with all of them set seems to fix all the problems, but it's a hassle to constantly have to fiddle with the Makefile's. (At least, until (a) everyone uses Imake and (b) I fix up a working template :-). Nick ______________________________________________________________________________ Nick Williams. njw@doc.ic.ac.uk ... Dept of Computing, Imperial College, London SW7 2B7. UK njw@athena.mit.edu ... Project Athena, M.I.T., Cambridge, MA 02139. USA Any opinions or views you may find hiding in this message are mine, and not policy, intent, ideas, twinklings of eyes, or anything at all related with my current organisation, unless specifically noted as such. -- ______________________________________________________________________________ Nick Williams. njw@athena.mit.edu ... Project Athena, M.I.T., Cambridge, MA 02139. USA njw@doc.ic.ac.uk ... Dept of Computing, Imperial College, London SW7 2B7. UK Any opinions or views you may find hiding in this message are mine, and not policy, intent, ideas, twinklings of eyes, or anything at all related with my current organisation, unless specifically noted as such.
mev@hpfcso.HP.COM (Mike Vermeulen) (10/20/90)
> However, at some magical point in the hpux C compiler, there are a > couple of #define's made, which I can't track down: > _INCLUDE_POSIX_SOURCE > _INCLUDE_XOPEN_SOURCE > _INCLUDE_HPUX_SOURCE > I can't find these in /lib/cpp, cc or any of the similar type places. > But if the XOPEN define is not made, then such types as caddr_t are > not defined by <sys/types.h>. Hence compiling an X program gets > awkward. The magical point where these are set is <sys/stdsyms.h>. Each of the symbols above controls the set of names for a particular namespace. The way these work is: - In a strict ANSI C compile, the header files must not "pollute" the namespace with extra symbols (e.g. a user can create their own variable named caddr_t without conflict from the headers). Thus if only __STDC__ is defined then the namespace is completely clean an no extra symbols are defined. - Users of the XOPEN and POSIX know about symbols "_POSIX_SOURCE" and "_XOPEN_SOURCE" that must be defined to get compiles that correspond to those standards. - To get a "dirty" namespace, define the symbol _HPUX_SOURCE with either a -D_HPUX_SOURCE or #define _HPUX_SOURCE. I think in your case, you want to do the last, i.e. add a -D_POSIX_SOURCE to the arguments passed to cpp. > Compiling with all of them set seems to fix all the problems, but it's > a hassle to constantly have to fiddle with the Makefile's. The correct way is to set the symbol _HPUX_SOURCE, not the individual defines. --mev DISCLAIMER: This is not an official HP response.