Robert Schwebel <[EMAIL PROTECTED]> writes:

> > I noticed that after the release, when compiling with an gcc-2.x under
> > Solaris. Appearantly mixing code and declarations (like in C++) is
> > allowed by c99 and gcc-3.0. The solution is to move the declaration,
> > as you notice.
> 
> What does the ANSI-C standard say?

My understanding is that it's allowed by the brand new 1999 ANSI-C
standard, but disallowed by the older 1989 standard, and by most
existing C compilers.

> My workaround is to add a test to argp-namefrob.h like this:
> 
>   #ifdef _LIBC
>   #ifndef weak_alias
> 
>   [...]
> 
>   #endif
>   #endif
> 
> weak_alias ist an ELF feature, so the decision if it shall be used or not
> is independend of LIBC.

That sounds reasonable to me.

> Next problem: HAVE_PROGRAM_INVOCATION_NAME is determined incorrectly,
> because the test in configure.in searches for "program_invocation_name" in
> errno.h. As uClibc uses the original glibc header files it would be better
> to look at the library itself and search if the functions exist there.
> I've changed it this way:
> 
>   # ARGP_CHECK_VAR(program_invocation_name, [#include <errno.h>])
>   # ARGP_CHECK_VAR(program_invocation_short_name, [#include <errno.h>])
>   AC_CHECK_FUNCS(program_invocation_name)
>   AC_CHECK_FUNCS(program_invocation_short_name)

It doesn't seem right to use AC_CHECK_FUNC to check for symbols that
aren't functions. It would be better to change ARGP_CHECK_VAR (defined
in src/argp/acinclude.m4) to use AC_TRY_LINK. Ah, but it already does!
So there's something wrong with that test. Please check config.log.

> Now these errors remain:
> 
>   gcc  -g -O2 -ggdb3 -Wall -W  -Wmissing-prototypes -Wmissing-declarations
>   -Wstrict-prototypes  -Waggregate-return  -Wpointer-arith
>   -Wbad-function-cast -Wnested-externs  -o argp-test  argp-test.o
>   libargp.a
>   libargp.a(argp-parse.o): In function `argp_default_parser':
>   /home/robert/embedded/lsh-1.2.5/src/argp/argp-parse.c:144: undefined
>   reference to `__sleep'

> Is there a reason why the __ versions are used here? This does normaly
> only make sense if you want to redefine a function from libc and overload
> it with your own substiture. Before I understand what I'm doing here ;-)
> I've removed the underscores, with the result that everything in argp
> compiles fine now and the test works.

There should probably be an

  #ifndef _LIBC
  #define __sleep sleep
  #endif

in the file that uses sleep. I think some other functions are handled
in that way, in argp-help.c.

> The next problem is the size test for [int/short/long]. At the moment the
> configure script guesses incorrectly - all sizes are set to 0. I have no
> idea why...

To find out, you have to look in config.log.

> > configure checks for a definition of gethostbyname in libnsl, because
> > that's needded on Solaris. I've never seen it on any linux or glibc
> > system.
> 
> robert@callisto:~/embedded/glibc-2.2.4/nis ! ls *nsl*
> libnsl.a  libnsl.so  libnsl.so.1@  libnsl_g.a  libnsl_pic.a

You still have to figure out _whether or not you're supposed to use
that library_. If I have understood your situation correctly, lsh's
configure scripts figures that you want to use -lnsl and adds it to
LDFLAGS. And then you get some link errors on conflicts between that
library and glibc. In order to fix the configure script, I need to
know what the right thing is. To me, it sounds like there's something
fishy with your glibc installation.

Regards,
/Niels

Reply via email to