bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] Re: getopt trouble on uClibc systems


From: Simon Josefsson
Subject: [Bug-gnulib] Re: getopt trouble on uClibc systems
Date: Thu, 01 Jul 2004 16:58:03 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

Paul Eggert <address@hidden> writes:

>> I have had troubles with AC_DEFINE re-defining core functions when
>> only parts of my project links with gnulib -- I typically don't want
>> to link gnulib in my libraries, but I want to make use of it in a
>> library command line interface.  I'll see if I can get it to work
>> without it.
>
> If you don't want gnulib in your libraries, but you do want it in your
> library, then I'm afraid you need to have a different config.h for
> your command-line interface than you do for your library -- at least
> if you use the part of gnulib that redefines symbols like 'malloc'.  I
> don't see an easy way around this problem.

I'm doing this in one project, but having two config.h complicates
things.  I haven't tried it, but merely renaming one of the config.h
to, e.g., cfg.h would probably be as complicated, since "config.h" is
hard coded all over the place.

> But you don't want to check whether these symbols are declared; you
> want to check whether they're defined.  (The distinction between
> definition and declaration is how this whole thread started....)
> That is, in:
>
>> #if !HAVE_DECL_OPTIND
>> int optind = 1;
>> #endif
>
> optind should be defined if it isn't supplied by the library; it
> shouldn't matter whether it's declared.  (You're not using the
> system-defined declaration for optind anyway.)

Yes, I realized this too, but couldn't find any more appropriate
autoconf macro.  AC_CHECK_LIB says it is for functions only.  I guess
getopt.m4 can use AC_LINK_IFELSE or something for the variables, but
it looks messy.

I'll try to produce a patch with your ideas, to get something concrete
to look at.

Thanks,
Simon




reply via email to

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