This is the mail archive of the
mailing list for the GCC project.
Re: f77 patch for hostname
> >* libU77/configure.in: Look for -lsocket, add to LIBS if found.
> > libU77/Makefile: Use LIBS from above.
> I'm just curious -- I see a new definition for a `lib' macro in
> your patch, but no use for it, and can't find such a use in my
> (slightly old) snapshot of egcs. Presumably it's for the `check'
LIBS gets substituted into the libU77/Makefile.in
LIBS = @LIBS@
and is used in the linke line for the 'make check' target. Autoconf
will also use it at configure time to add to the test lines. This
allows it to set HAVE_GETHOSTNAME.
I think I did bozo this in the patch and Dave patched it up before
> Also, does this fix imply we should do something about getting
> the g77 driver to automatically provide `-lsocket' on the command
> line, e.g. `-lg2c -lsocket -lm' or `-lg2c -lm -lsocket' if such
> a library exists?
I'd say the answer to that is, "it depends". If the calls to hostname()
happen behind the users's back or you're really into the principle
of least suprise at the possible cost of increased file I/O during
the link, I'd say "yes". If the user of code that sucks in this
library function is expected to be able to read and understand a system
(C-oriented, of course) man page, then I'd vote, "no".
Neither the native C compiler nor GCC on these systems link user code
against libsocket automatically. The user has to specify it. Yes, this
is definitely a FAQ in those groups.
> If so, if someone can take care of getting the information from
> configuring into g77.c, I can take care of modifying g77.c to
> add the library (or libraries, e.g. maybe `-lc' is another one
> we should consider) myself.
I don't have strong feelings about it either way.
Even if g77 does set it to link against libsocket, you still need this
patch for autoconf to correctly detect the function.