gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] gm2 cannot detect itself


From: Manfred Hollstein
Subject: Re: [Gm2] gm2 cannot detect itself
Date: Tue, 5 Oct 2010 18:38:21 +0200
User-agent: Mutt/1.5.17 (2007-11-01)

On Tue, 05 Oct 2010, 17:19:56 +0200, Gaius Mulley wrote:
> Martin Kalbfuss <address@hidden> writes:
> > Hi,
> >
> > I’m working on a autoconf macro to detect gm2. The detection runs fine
> > and returns the complete path to gm2. In my case it is /opt/gm2/bin/gm2.
> > This works, even if it isn’t in PATH, bacaue it checks the two standard
> > locations in /opt/gm2 and $HOME/opt. So let's compile? No. It isn’t
> > working. Using the complete path to gm2 like
> >
> >  address@hidden:~/Desktop/sk/schwarzerkaffee/examples
> > $ /opt/gm2/bin/gm2 -fmakeall  -o timer_callback timer_callback.mod
> > -I../include/SK -l:../src/libsk.a -L/usr/lib -lSDL
> >
> > results in
> >
> > gm2 -c -fmakeall0 -ftarget-ranlib=/usr/bin/ranlib
> > -ftarget-ar=/usr/bin/ar
> > -fobject-path=../include/SK:/opt/gm2/lib/gcc/x86_64-linux-gnu/4.1.2/gm2/pim:/opt/gm2/lib/gcc/x86_64-linux-gnu/4.1.2/gm2/logitech
> >  -fmakeall 
> > -I../include/SK:/opt/gm2/lib/gcc/x86_64-linux-gnu/4.1.2/gm2/pim:/opt/gm2/lib/gcc/x86_64-linux-gnu/4.1.2/gm2/logitech
> >  timer_callback.mod
> > make: gm2: Command not found
> > make: *** [timer_callback.o] Error 127
> >
> > gm2 cannot detect itself. I asume, it's the created makefile which uses
> > gm2 only instead of the complete path.
> >
> > Martin
> 
> Hi Martin,
> 
> thanks for the bug report - now under investigation - I presume the
> correct behaviour, in this case, is for the -fmakeall to use argv[0] of
> gm2.  However if another gm2 is found along the PATH then which one
> should take precedence?

If argv[0] is an absolute path name for an existing file which can be
executed, I'd trust it because it's probably the file that the caller
has been attempting to invoke directly; this might be due to a shell
having found it along $PATH, or, as I said, by a user specifying a
special version.  Something like the following should work from my point
of view:

  if (access (argv[0], X_OK) == 0)
    {
      /* File exists, take its name and trust it...  */
    }
  else
    {
      /* File name must have been found via $PATH, just use "gm2".  */
    }

> regards,
> Gaius

HTH, cheers.

l8er
manfred



reply via email to

[Prev in Thread] Current Thread [Next in Thread]