[Top][All Lists]

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

Re: checking for specific versions of operating system

From: Bob Friesenhahn
Subject: Re: checking for specific versions of operating system
Date: Tue, 23 Aug 2005 17:10:34 -0500 (CDT)

On Tue, 23 Aug 2005, Baurzhan Ismagulov wrote:

On Tue, Aug 23, 2005 at 06:25:47PM +0200, Stepan Kasal wrote:
several comments:
1) AC_MSG_ERROR is better than "echo"
2) you should use LIBS, not LDFLAGS for -l flags
3) in the example you show, one call to AC_SEARCH_LIBS might be better.
   (But I don't know your real code, before you simplified it.)

Thanks much! I'll correct (1) and (2). About (3), I use AC_CHECK_LIB to
search for the same lib in different dirs; is there a macro that does it
for me? Is there a standard way to specify a custom path (I was going to
use --with-mylib=/opt/mypkg/lib, but seems this isn't the intended way
of using it)?

See the INSTALL file for the GNU way to configure library paths. It is done via LDFLAGS on the configure command line. Likewise, CPPFLAGS is used to specify where to look for header files.

Some packages use something like --with-mylib=/opt/mypkg/lib because it seems user friendly but unfortunately, this approach does not necessarily work reliably since it must assume a particular library search order and the assumed order may be broken on someone's system. For example, several libraries may be installed in a directory, but the user wants to specify a newer version in a different directory. Due to another needed library living in the same directory as the older library, the older library may be used by mistake. This becomes even more important for the header search path since headers don't usually support versioning. So, if you do things the GNU way rather than the "user friendly" way, then the user has more opportunity to work around the problem but the user may need to have an IQ over 70.

If you want to use AC_CHECK_LIB, then you can save the current LDFLAGS value to some other variable and then try adjusting LDFLAGS until you find a setting which works. If nothing works, then you restore LDFLAGS to what it was.

The more effort you spend adapting to peculiarities of specific systems, the less likely your configure script is to work properly on other systems, or later versions of the same system, and the faster it will "bit rot" over time.

Bob Friesenhahn
GraphicsMagick Maintainer,

reply via email to

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