Re: recognize UNIX version

From: Levente KOVACS (Levente.Kovacs_at_cern.ch)
Date: 05/12/04


Date: Wed, 12 May 2004 09:53:52 +0200

On 11 May 2004 10:58:55 -0700
mdanko@tesla.rcub.bg.ac.yu (Darko M.) wrote:

> Is there any portable way of recognizing which version of UNIX (or
> Linux, for me it's a sort of) is the software being installed on
> (preprocessor way), or which version of UNIX is the software being
> running on?

You should write a ./configure shell script, which generates makefile,
and config.h. You should include config.h in your program.

There's a program called uname, which comes with every UNIX platforms.
See man uname.

The ./configure shell script shall execute such commands like

SYSTEM=`uname -s`
.
.
.
echo "#define SYSTEM $SYSTEM" >>config.h

Or something like that.

You can add flags to your cc, and/or linker like

CCFLAGS=`gtk-config --cflags`
LDFLAGS=`gtk-config --link`
.
.
.

echo CCFLAGS=$CCFLAGS >>Makefile
echo LDFLAGS=$LDFALGS >>Makefile

And, the rest of your Makefile shall use thoes variables.

I know, that autoconf does this, but for me it's too complicated, and
sometime I run into problems (e.g. with the gEDA tools).

I just made this mail, I do not run things like this...yet. But I'm
thinkink about writing some scripts.

Anyway... I hope it helped.

Levente

-- 
Leva
__
Email: levente.kovacs@cern.ch
Home Page: http://web.interware.hu/leva
Public key: http://web.interware.hu/leva/CERN/public_key
________________________________________
/"\
\ /    ASCII Ribbon Campaign
 X   against HTML email & vCards
/ \     http://arc.pasp.de/
Have Fun, & Linux! 73 for all by HA5OGL.
This message was generated by Sylpheed.


Relevant Pages

  • [OT] Re: Types, shells, echoes and other phenomena ?
    ... echo of an echo perhaps? ... Way - Unix. ... peter@prospero:~ $ wtf is true ... I don't know what linux means... ...
    (Ubuntu)
  • Re: Shell program
    ... using a shell program. ... On unix machine it works fine but when i run the ... same on linux it doesnt work. ... echo "abc\nabc" in unix this command worked but in linux it doesnt ...
    (comp.os.linux.misc)
  • Re: How to find the model of the linux machine.
    ... be pedantic, Linux is not UNIX. ... up the ghost. ... you made quite an assumption in assuming it was Linux. ... Email: echo 142322093203359315271794620168064975321554275890186P | dc ...
    (comp.unix.admin)
  • [PATCH] Miniconfig revisited (1/3)
    ... Only touches the makefile, no C code. ... # These targets are used from top-level makefile ... echo "Turns current .config into a miniconfig file." ...
    (Linux-Kernel)
  • Re: OT: Ubuntu?
    ... Oh bear in mind all of Linux is case sensitive. ... And *nix has been using forward slashes since LONG before DOS ... And still running on the majority of Web servers in the world, ... Hardly ANY normal PC users will ever need to use a Makefile ...
    (alt.smokers.cigars)