Autoconf and 64-bit Systems

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Autoconf and 64-bit Systems

Tom Browder
Is there any way to have configure test for a 64-bit system and then
put libraries in a default place, say /usr/local/lib64, instead of the
default /usr/local/lib as so many GNU packages do at the moment?

I know I can use ./configure --libdir=/usr/local/lib64 but would like
the package to take care of that.

Or is there any way to use environment variables to set my preferences?


I'm just getting used to my new 64-bit system and am finding such
subtleties imp[ortant now in some instances [I had a build fail at the
last moment because of old habits and a failure to recognize that some
(but not all) libraries do install in "lib64" directories].

Thanks.

-Tom

Tom Browder
Niceville, Florida
USA


_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf and 64-bit Systems

Russ Allbery
Tom Browder <[hidden email]> writes:

> Is there any way to have configure test for a 64-bit system and then
> put libraries in a default place, say /usr/local/lib64, instead of the
> default /usr/local/lib as so many GNU packages do at the moment?
>
> I know I can use ./configure --libdir=/usr/local/lib64 but would like
> the package to take care of that.
>
> Or is there any way to use environment variables to set my preferences?

Here's what I've just started using, based on some ideas from the CMU
macros.  (The license referenced below is the fairly standard MIT/Expat
license terms.)

dnl lib-pathname.m4 -- Determine the library path name.
dnl
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 and a prefix, adds
dnl -Lprefix/lib, -Lprefix/lib32, or -Lprefix/lib64 to the variable depending
dnl on which directories exist and the size of a long in the compilation
dnl environment.
dnl
dnl Written by Russ Allbery <[hidden email]>
dnl Copyright 2008 Board of Trustees, Leland Stanford Jr. University
dnl
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
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.
AC_DEFUN([_RRA_LIB_ARCH_NAME],
[rra_lib_arch_name=lib
 AC_CHECK_SIZEOF([long])
 AS_IF([test "$ac_cv_sizeof_long" -eq 4 && test -d /usr/lib32],
     [rra_lib_arch_name=lib32],
     [AS_IF([test "$ac_cv_sizeof_long" -eq 8 && test -d /usr/lib64],
         [rra_lib_arch_name=lib64])])])

dnl The public interface.  Set VARIABLE to PREFIX/lib{,32,64} as appropriate.
AC_DEFUN([RRA_SET_LDFLAGS],
[AC_REQUIRE([_RRA_LIB_ARCH_NAME])
 AS_IF([test -d "$2/$rra_lib_arch_name"],
    [$1="-L$2/$rra_lib_arch_name"],
    [$1="-L$2/lib"])])

--
Russ Allbery ([hidden email])             <http://www.eyrie.org/~eagle/>


_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf and 64-bit Systems

Eric Blake
In reply to this post by Tom Browder
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Tom Browder on 2/2/2009 1:53 PM:
> Is there any way to have configure test for a 64-bit system and then
> put libraries in a default place, say /usr/local/lib64, instead of the
> default /usr/local/lib as so many GNU packages do at the moment?
>
> I know I can use ./configure --libdir=/usr/local/lib64 but would like
> the package to take care of that.

The BEST way to do this is for distros that want /usr/local/lib64 to be
the default to install a /usr/local/config.site that makes this happen
automatically.  Since it is the distro that is choosing the name, they
should enforce it.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [hidden email]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmIPYwACgkQ84KuGfSFAYBGsACg1tfrZM6HCC5E1w6iDW2/fJ7l
F+oAnjXajLS5FxjsNFAUbIVpXDMfUjtA
=l49M
-----END PGP SIGNATURE-----


_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf and 64-bit Systems

Tom Browder
On Tue, Feb 3, 2009 at 6:50 AM, Eric Blake <[hidden email]> wrote:
...
> According to Tom Browder on 2/2/2009 1:53 PM:
>> Is there any way to have configure test for a 64-bit system and then
>> put libraries in a default place, say /usr/local/lib64, instead of the
>> default /usr/local/lib as so many GNU packages do at the moment?
...
> The BEST way to do this is for distros that want /usr/local/lib64 to be
> the default to install a /usr/local/config.site that makes this happen
> automatically.  Since it is the distro that is choosing the name,

Aha!  So I, as a user, can do that even if they don't.  So I should
put in my site file (taken from the autoconf manual, para.14.8):

  test "$libdir" = NONE && libdir=${prefix}/lib64

Correct?

Thanks, Eric.

-Tom


_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf and 64-bit Systems

Eric Blake
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Tom Browder on 2/3/2009 6:23 AM:

>> The BEST way to do this is for distros that want /usr/local/lib64 to be
>> the default to install a /usr/local/config.site that makes this happen
>> automatically.  Since it is the distro that is choosing the name,
>
> Aha!  So I, as a user, can do that even if they don't.  So I should
> put in my site file (taken from the autoconf manual, para.14.8):
>
>   test "$libdir" = NONE && libdir=${prefix}/lib64
>
> Correct?

Almost.  I'd recommend more quoting, so that you can still change $prefix
at make time:

test "$libdir" = NONE && libdir='${prefix}/lib64'

Also, please report this as a bug to your distro - maybe the more people
that bug them about it, the more they will get the picture that they can
make life easier for their users.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [hidden email]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmIRnEACgkQ84KuGfSFAYDJzQCfdovqURj6nl1rkksFaJHzcEGO
AeEAoKoQhjvjjG2r7MXn+K3iii3rqjBo
=Er6j
-----END PGP SIGNATURE-----


_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf and 64-bit Systems

Tom Browder
On Tue, Feb 3, 2009 at 7:28 AM, Eric Blake <[hidden email]> wrote:
...
> According to Tom Browder on 2/3/2009 6:23 AM:
...

>> Aha!  So I, as a user, can do that even if they don't.  So I should
>> put in my site file (taken from the autoconf manual, para.14.8):
>>
>>   test "$libdir" = NONE && libdir=${prefix}/lib64
>>
>> Correct?
>
> Almost.  I'd recommend more quoting, so that you can still change $prefix
> at make time:
>
> test "$libdir" = NONE && libdir='${prefix}/lib64'

So the single quotes prevent expansion when first read?  Then the test
is referred to later in the game--is that what is happening?

-Tom


_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf and 64-bit Systems

Peter Breitenlohner
In reply to this post by Eric Blake
On Tue, 3 Feb 2009, Eric Blake wrote:

> According to Tom Browder on 2/3/2009 6:23 AM:
>>
>> Aha!  So I, as a user, can do that even if they don't.  So I should
>> put in my site file (taken from the autoconf manual, para.14.8):
>>
>>   test "$libdir" = NONE && libdir=${prefix}/lib64
>>
>> Correct?
>
> Almost.  I'd recommend more quoting, so that you can still change $prefix
> at make time:
>
> test "$libdir" = NONE && libdir='${prefix}/lib64'

Hi Eric, Tom,

both of you are wrong (at least for Autoconf 2.63).  It ought to be

test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'

Regards
Peter Breitenlohner <[hidden email]>


_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf and 64-bit Systems

Eric Blake
Peter Breitenlohner <peb <at> mppmu.mpg.de> writes:

> > test "$libdir" = NONE && libdir='${prefix}/lib64'
>
> Hi Eric, Tom,
>
> both of you are wrong (at least for Autoconf 2.63).  It ought to be
>
> test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'

Yes, thanks for the corrections.  For that matter, putting this in the manual
would be nice.  Meanwhile, I noticed that the manual wasn't entirely accurate,
and also that the pdf version could use some nicer line breaks.  So I'm
committing this:


From: Eric Blake <[hidden email]>
Date: Tue, 3 Feb 2009 09:01:52 -0700
Subject: [PATCH] Document lib64 in config.site.

* doc/autoconf.texi (Site Defaults): Fix typo in FHS sample file.
Mention use of lib64.
* THANKS: Update.
Reported by Tom Browder, with help from Peter Breitenlohner.

Signed-off-by: Eric Blake <[hidden email]>
---
 ChangeLog         |    8 ++++++++
 THANKS            |    1 +
 doc/autoconf.texi |   18 +++++++++++++++---
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a706db2..7ae64b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-02-03  Eric Blake  <[hidden email]>
+
+ Document lib64 in config.site.
+ * doc/autoconf.texi (Site Defaults): Fix typo in FHS sample file.
+ Mention use of lib64.
+ * THANKS: Update.
+ Reported by Tom Browder, with help from Peter Breitenlohner.
+
 2009-01-28  Eric Blake  <[hidden email]>
 
  Use AC_DEFUN_ONCE for uncontroversial one-shot macros.
diff --git a/THANKS b/THANKS
index 74895cf..a4d9c23 100644
--- a/THANKS
+++ b/THANKS
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 0d20f2a..4e487df 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -19737,12 +19737,12 @@ Site Defaults
 and @code{cache_file} have their default values (as set near the top of
 @command{configure}) before changing them.
 
-Here is a sample file @file{/usr/share/local/gnu/share/config.site}.  The
+Here is a sample file @file{/usr/share/local/@/gnu/share/@/config.site}.  The
 command @samp{configure --prefix=/usr/share/local/gnu} would read this
 file (if @code{CONFIG_SITE} is not set to a different file).
 
 @example
-# config.site for configure
+# /usr/share/local/gnu/share/config.site for configure
 #
 # Change some defaults.
 test "$prefix" = NONE && prefix=/usr/share/local/gnu
@@ -19770,7 +19770,7 @@ Site Defaults
 the locations recommended by @acronym{FHS}.
 
 @example
-# /usr/local/config.site for FHS defaults when installing below /usr,
+# /usr/share/config.site for FHS defaults when installing below /usr,
 # and the respective settings were not changed on the command line.
 if test "$prefix" = /usr; then
   test "$sysconfdir" = '$@{prefix@}/etc' && sysconfdir=/etc
@@ -19779,6 +19779,18 @@ Site Defaults
 fi
 @end example
 
+@cindex lib64
+@cindex 64-bit libraries
+Likewise, on platforms where 64-bit libraries are built by default, then
+installed in @file{/usr/local/@/lib64} instead of @file{/usr/local/@/lib},
+it is appropriate to install @file{/usr/local/@/share/config.site}:
+
+@example
+# /usr/local/share/config.site for platforms that prefer
+# the directory /usr/local/lib64 over /usr/local/lib.
+test "$libdir" = '$@{exec_prefix@}/lib' && libdir='$@{exec_prefix@}/lib64'
+@end example
+
 
 @c ============================================== Running configure Scripts.
 
--
1.6.0.4






_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf and 64-bit Systems

Paul Elliott
In reply to this post by Eric Blake
On Tue, Feb 03, 2009 at 05:50:21AM -0700, Eric Blake wrote:
> According to Tom Browder on 2/2/2009 1:53 PM:
> > Is there any way to have configure test for a 64-bit system and then
> > put libraries in a default place, say /usr/local/lib64, instead of the
> > default /usr/local/lib as so many GNU packages do at the moment?
> >
> > I know I can use ./configure --libdir=/usr/local/lib64 but would like
> > the package to take care of that.


All of the .rpm based distros that I use recommend putting
./configure --libdir=%_libdir .....

in the .spec file. %_libdir is is /usr/lib or /usr/lib64

Since you want to use /usr/local you should write

./configure --libdir=/usr/local/%_lib

for rpm based distros.

The Debian based distros that I have used don't need anything done
because /usr/lib works for 64bit.


--
Paul Elliott                       1(512)837-1096
[hidden email]                    PMB 181, 11900 Metric Blvd Suite J
http://www.io.com/~pelliott/pme/   Austin TX 78758-3117

_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf

attachment0 (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf and 64-bit Systems

Bob Friesenhahn
In reply to this post by Tom Browder
On Mon, 2 Feb 2009, Tom Browder wrote:

> Is there any way to have configure test for a 64-bit system and then
> put libraries in a default place, say /usr/local/lib64, instead of the
> default /usr/local/lib as so many GNU packages do at the moment?
>
> I know I can use ./configure --libdir=/usr/local/lib64 but would like
> the package to take care of that.

I use prefix-specific config.site files to accomplish this.  By using
different installation prefixes, then the appropriate settings are
automatically picked up via the --prefix=/foo configure option.  The
config.site file used is discovered like ${prefix}/share/config.site.
This works like a charm and usually works perfectly with packages
using a modern configure script.

Bob
======================================
Bob Friesenhahn
[hidden email], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/



_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf and 64-bit Systems

Tom Browder
In reply to this post by Peter Breitenlohner
On Tue, Feb 3, 2009 at 7:50 AM, Peter Breitenlohner ...
<[hidden email]> wrote:
> On Tue, 3 Feb 2009, Eric Blake wrote:
...
>> According to Tom Browder on 2/3/2009 6:23 AM:
...

>>> put in my site file (taken from the autoconf manual, para.14.8):
>>>
>>>  test "$libdir" = NONE && libdir=${prefix}/lib64
>>>
>>> Correct?
>>
>> Almost.  I'd recommend more quoting, so that you can still change $prefix
>> at make time:
>>
>> test "$libdir" = NONE && libdir='${prefix}/lib64'
...
> both of you are wrong (at least for Autoconf 2.63).  It ought to be
>
> test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'

Thanks, Peter, I've confirmed that that's the variant that works on my
Centos 5.2 64-bit system.

-Tom


_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf and 64-bit Systems

Bob Friesenhahn
In reply to this post by Paul Elliott
On Tue, 3 Feb 2009, Paul Elliott wrote:
>
> All of the .rpm based distros that I use recommend putting
> ./configure --libdir=%_libdir .....
>
> in the .spec file. %_libdir is is /usr/lib or /usr/lib64

It seems that this is not quite enough logic.  For example, I noticed
in a log that a user sent to me that due to a rule like this, and
default compiler operation, 32-bit libraries were installed in
/usr/lib64.  Any advice for how to do this correctly is appreciated.

Bob
======================================
Bob Friesenhahn
[hidden email], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/



_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf and 64-bit Systems

Tom Browder
In reply to this post by Paul Elliott
On Tue, Feb 3, 2009 at 10:19 AM, Paul Elliott <[hidden email]> wrote:
...
> The Debian based distros that I have used don't need anything done
> because /usr/lib works for 64bit.

Well, I probably messed up my Centos 5.2 64-bit system by using old
habits and adding packages without paying attention to whether they
were 32- or 64-bit.

I finally got "bit" when a 64-bit build grabbed a 32-bit library
somehow and I tried to straighten the mess with making sure I searched
for lib64 libs before lib libs.

Anyhow, all seems to be working for the moment.

Thanks all for your help.

-Tom


_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf