Daniel K. Spicer on 26 Jul 2006 17:16:22 -0000


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

RE: [PLUG] Linux Port


If I use 'uname' in the makefile, what's the syntax in the .c files to distinguish between Solaris and Linux?

> -------- Original Message --------
> Subject: Re: [PLUG] Linux Port
> From: Dan Crosta <dcrosta@sccs.swarthmore.edu>
> Date: Wed, July 26, 2006 12:56 pm
> To: Philadelphia Linux User's Group Discussion List
> <plug@lists.phillylinux.org>
> 
> Daniel K. Spicer wrote:
> > I'm doing a code port from Solaris to Suse Linux. The ported code will need to run on both so I need a preproccessor directive in the .c files like:
> > 
> > #ifdef SUSE
> >   ...Linux code
> > #else
> >   ...Solaris code
> > #endif
> > 
> > I'm using gcc. Does anyone know of an existing macro for Suse or Solaris to do this with?
> > Or another good way of doing it?
> > 
> > Thanks,
> >  -Dan
> 
> You can work some magic in your makefile with `uname`... that'll at 
> least get you a kernel name (ie 'Linux' or 'Solaris'), not sure about 
> SUSE specifically.
> 
> - d
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --        http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug