[Top][All Lists]

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

Re: Finding dependencies in lib64 or lib

From: Russ Allbery
Subject: Re: Finding dependencies in lib64 or lib
Date: Thu, 11 Feb 2010 12:48:39 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Peter Breitenlohner <address@hidden> writes:

> This use of '--with-libconfuse' to derive both -I and -L flags may be
> traditional, but for bi-arch systems with, e.g.  lib and lib64, this is
> just a broken design.  [And there may be other reasons why headers and
> libraries are not in FOO/include and FOO/lib with the same prefix.]

> IMHO a sane way is to use two options '--with-libconfuse-include' and
> '--with-libconfuse-libdir' or some such.

> And for backwards compatibility one could interprete
> '--with-libconfuse=DIR' as '--with-libconfuse-include=DIR/include
> --with-libconfuse-libdir=DIR/lib'.

For my packages, I do roughly this, except that I also try to embed some
smarts about bi-arch architectures using the following macro to set the
lib path if just --with-libconfuse is used.  It seems to make people

The license referred to below is just the standard MIT license.  This
macro is one of the ones included in rra-c-util, which is sort of my
version of gnulib for the packages that I maintain.

dnl Determine the library path name.
dnl Red Hat systems and some other Linux systems use lib64 and lib32 rather
dnl than just lib in some circumstances.  This file provides an Autoconf
dnl macro, RRA_SET_LDFLAGS, which given a variable, a prefix, and an optional
dnl suffix, adds -Lprefix/lib, -Lprefix/lib32, or -Lprefix/lib64 to the
dnl variable depending on which directories exist and the size of a long in
dnl the compilation environment.  If a suffix is given, a slash and that
dnl suffix will be appended, to allow for adding a subdirectory of the library
dnl directory.
dnl This file also provides the Autoconf macro RRA_SET_LIBDIR, which sets the
dnl libdir variable to PREFIX/lib{,32,64} as appropriate.
dnl Written by Russ Allbery <address@hidden>
dnl Copyright 2008, 2009 Board of Trustees, Leland Stanford Jr. University
dnl See LICENSE for licensing terms.

dnl Probe for the alternate library name that we should attempt on this
dnl architecture, given the size of an int, and set rra_lib_arch_name to that
dnl name.  Separated out so that it can be AC_REQUIRE'd and not run multiple
dnl times.
dnl There is an unfortunate abstraction violation here where we assume we know
dnl the cache variable name used by Autoconf.  Unfortunately, Autoconf doesn't
dnl provide any other way of getting at that information in shell that I can
dnl see.
 AS_IF([test "$ac_cv_sizeof_long" -eq 4 && test -d /usr/lib32],
     [AS_IF([test "$ac_cv_sizeof_long" -eq 8 && test -d /usr/lib64],

dnl Set VARIABLE to -LPREFIX/lib{,32,64} or -LPREFIX/lib{,32,64}/SUFFIX as
dnl appropriate.
 AS_IF([test -d "$2/$rra_lib_arch_name"],
    [AS_IF([test x"$3" = x],
        [$1="[$]$1 -L$2/${rra_lib_arch_name}"],
        [$1="[$]$1 -L$2/${rra_lib_arch_name}/$3"])],
    [AS_IF([test x"$3" = x],
        [$1="[$]$1 -L$2/lib"],
        [$1="[$]$1 -L$2/lib/$3"])])
 $1=`echo "[$]$1" | sed -e 's/^ *//'`])

dnl Set libdir to PREFIX/lib{,32,64} as appropriate.
 AS_IF([test -d "$1/$rra_lib_arch_name"],

Russ Allbery (address@hidden)             <>

reply via email to

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