automake
[Top][All Lists]
Advanced

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

Re: Troubles with conditional adding files to library


From: Russ Allbery
Subject: Re: Troubles with conditional adding files to library
Date: Thu, 26 Mar 2009 19:26:13 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

"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 
> configure.ac I added the lines:
>
> AC_CHECK_FUNCS([strcasecmp strncasecmp],[CASECMP=1],[CASECMP=0])
> AM_CONDITIONAL([NOCASECMP],[test CASECMP = 0])

You need a $CASECMP here, not CASECMP.

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 Makefile.am.

> In Makefile.am I added the lines:
>
> if NOCASECMP
>     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.

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).

-- 
Russ Allbery (address@hidden)             <http://www.eyrie.org/~eagle/>




reply via email to

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