[Top][All Lists]

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

Re: Troubles with conditional adding files to library

From: Gerald I. Evenden
Subject: Re: Troubles with conditional adding files to library
Date: Thu, 26 Mar 2009 23:02:12 -0400
User-agent: KMail/1.9.10

On Thursday 26 March 2009 10:26:13 pm Russ Allbery wrote:
> "Gerald I. Evenden" <address@hidden> writes:
> > I am quite new to using this system but managed to get it to make a
> > distribution of a shared library.  The first try was, however, simple
> > and straight forward.
> >
> > However, I want selectively add two files to the library based upon the
> > condition that they are *not* present on the target computer.  In
> > I added the lines:
> >
> > AC_CHECK_FUNCS([strcasecmp strncasecmp],[CASECMP=1],[CASECMP=0])
> You need a $CASECMP here, not CASECMP.

That's interesting.  I had no idea although I guess I should have.

> However, more fundamentally, you're reinventing AC_REPLACE_FUNC, which you
> probably don't want to do.  Check the Autoconf manual for AC_REPLACE_FUNC,
> which does exactly what you're trying to do, even down to how it adds
> additional source files to a variable that you can use in

I had seen it but, again, I was unsure how it was going to work.  I will 

Also, I am not replacing functions with a new name but adding the source with 
the same entry names to be compiled into the new library.  The documentation 
is a bit fuzzy to me in this area.

> > In I added the lines:
> >
> >     libproject_la_sources += strcasecmp.c strncasecmp.c
> You need an endif here, which may also be part of the problem with the
> errors you're seeing.

In the monkey-see-monkey-do example I was working from did not have an endif.  
So much for my reading material.

> Taking yet another step back, do you have a target system in mind that
> doesn't have strcasecmp?  It's required by POSIX and is usually in the set
> of things that aren't worth bothering checking for unless you're porting
> to Windows (which particularly for shared libraries involves quite a bit
> of work that Automake can't entirely help with).

This is a tryout case that will become more complex later when the library 
grows to its 150 or so files and there may be other places where optional 
inclusion may be a factor especially where some potential users will accept 
the X11 license I distribute under but don't want to be involved with GPL and 
will want to use alternate software.

As far as the case insensitive routines, yes, part of the motive was because 
of M$ but I heard some rumblings that they may be missing at some other OSs.

Many thanks for the comments.

The whole religious complexion of the modern world is due
to the absence from Jerusalem of a lunatic asylum.
-- Havelock Ellis (1859-1939) British psychologist

reply via email to

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