xfs
[Top] [All Lists]

patch for building xfs-cmds/attr on 64 bit platforms

To: ja@xxxxxxxxxxxx, hch@xxxxxx
Subject: patch for building xfs-cmds/attr on 64 bit platforms
From: Timothy Shimmin <tes@xxxxxxx>
Date: Thu, 30 Mar 2006 18:53:00 +1100
Cc: linux-xfs@xxxxxxxxxxx
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mozilla Thunderbird 0.7+ (X11/20040505)
Hi there,

In November last year, Jan Derfinak, supplied a patch for building/installing xfs-cmds on amd64
but Christoph had problems with "uname --hardware -platform" on some 64 bit machines.
(http://oss.sgi.com/archives/linux-xfs/2004-11/msg00115.html)


Looking around I decided to adopt a solution from gettext which has a config macro which
looks at $CC -print-search-dirs for lib64 to make the decision.
I've attached a patch just for xfs-cmds/attr to this email.
If this works for people on various 64 bit platforms,
then I'll do likewise for the other xfs related userspace libraries.


Thanks muchly,
Tim.
===========================================================================
Index: attr/Makefile
===========================================================================

--- a/attr/Makefile     2006-03-30 17:33:20.000000000 +1000
+++ b/attr/Makefile     2006-03-29 17:11:40.000000000 +1000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+# Copyright (c) 2000-2006 Silicon Graphics, Inc.  All Rights Reserved.
 #
 
 TOPDIR = .
@@ -41,6 +41,7 @@ $(CONFIGURE):
                --bindir=/usr/bin \
                --libdir=/lib \
                --libexecdir=/usr/lib \
+               --enable-lib64=yes \
                --includedir=/usr/include \
                --mandir=/usr/share/man \
                --datadir=/usr/share \
@@ -48,7 +49,7 @@ $(CONFIGURE):
        touch .census
 
 aclocal.m4::
-       aclocal --acdir=$(TOPDIR)/m4 --output=$@
+       aclocal --acdir=`pwd`/m4 --output=$@
 
 install: default
        $(SUBDIRS_MAKERULE)

===========================================================================
Index: attr/aclocal.m4
===========================================================================

--- a/attr/aclocal.m4   2006-03-30 17:33:20.000000000 +1000
+++ b/attr/aclocal.m4   2006-03-29 17:07:17.000000000 +1000
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.7.9 -*- Autoconf -*-
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -12,6 +12,68 @@
 # PARTICULAR PURPOSE.
 
 # 
+# Find format of installed man pages.
+# Always gzipped on Debian, but not Redhat pre-7.0.
+# We don't deal with bzip2'd man pages, which Mandrake uses,
+# someone will send us a patch sometime hopefully. :-)
+# 
+AC_DEFUN([AC_MANUAL_FORMAT],
+  [ have_zipped_manpages=false
+    for d in ${prefix}/share/man ${prefix}/man ; do
+        if test -f $d/man1/man.1.gz
+        then
+            have_zipped_manpages=true
+            break
+        fi
+    done
+    AC_SUBST(have_zipped_manpages)
+  ])
+
+# The AC_MULTILIB macro was extracted and modified from 
+# gettext-0.15's AC_LIB_PREPARE_MULTILIB macro in the lib-prefix.m4 file
+# so that the correct paths can be used for 64-bit libraries.
+#
+dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl From Bruno Haible.
+
+dnl AC_MULTILIB creates a variable libdirsuffix, containing
+dnl the suffix of the libdir, either "" or "64".
+dnl Only do this if enable param is yes.
+AC_DEFUN([AC_MULTILIB],
+[
+  dnl There is no formal standard regarding lib and lib64. The current
+  dnl practice is that on a system supporting 32-bit and 64-bit instruction
+  dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
+  dnl libraries go under $prefix/lib. We determine the compiler's default
+  dnl mode by looking at the compiler's library search path. If at least
+  dnl of its elements ends in /lib64 or points to a directory whose absolute
+  dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
+  dnl default, namely "lib".
+  enable_lib64="$1"
+  libdirsuffix=""
+  searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 
's,^libraries: ,,p' | sed -e 's,^=,,'`
+  if test "$enable_lib64" = "yes" -a -n "$searchpath"; then
+    save_IFS="${IFS=   }"; IFS=":"
+    for searchdir in $searchpath; do
+      if test -d "$searchdir"; then
+        case "$searchdir" in
+          */lib64/ | */lib64 ) libdirsuffix=64 ;;
+          *) searchdir=`cd "$searchdir" && pwd`
+             case "$searchdir" in
+               */lib64 ) libdirsuffix=64 ;;
+             esac ;;
+        esac
+      fi
+    done
+    IFS="$save_IFS"
+  fi
+  AC_SUBST(libdirsuffix)
+])
+
+# 
 # Generic macro, sets up all of the global packaging variables.
 # The following environment variables may be set to override defaults:
 #   DEBUG OPTIMIZER MALLOCLIB PLATFORM DISTRIBUTION INSTALL_USER INSTALL_GROUP
@@ -40,12 +102,12 @@ AC_DEFUN([AC_PACKAGE_GLOBALS],
     malloc_lib="$MALLOCLIB"
     AC_SUBST(malloc_lib)
 
-    PKG_USER=${INSTALL_USER:-'root'}
-    pkg_user="$PKG_USER"
+    pkg_user=`id -u`
+    test -z "$INSTALL_USER" || pkg_user="$INSTALL_USER"
     AC_SUBST(pkg_user)
 
-    PKG_GROUP=${INSTALL_GROUP:-'root'}
-    pkg_group="$PKG_GROUP"
+    pkg_group=`id -g`
+    test -z "$INSTALL_GROUP" || pkg_group="$INSTALL_GROUP"
     AC_SUBST(pkg_group)
 
     pkg_distribution=`uname -s`
@@ -185,21 +247,3 @@ AC_DEFUN([AC_PACKAGE_UTILITIES],
     AC_SUBST(rpmbuild)
   ])
 
-# 
-# Find format of installed man pages.
-# Always gzipped on Debian, but not Redhat pre-7.0.
-# We don't deal with bzip2'd man pages, which Mandrake uses,
-# someone will send us a patch sometime hopefully. :-)
-# 
-AC_DEFUN([AC_MANUAL_FORMAT],
-  [ have_zipped_manpages=false
-    for d in ${prefix}/share/man ${prefix}/man ; do
-        if test -f $d/man1/man.1.gz
-        then
-            have_zipped_manpages=true
-            break
-        fi
-    done
-    AC_SUBST(have_zipped_manpages)
-  ])
-

===========================================================================
Index: attr/configure.in
===========================================================================

--- a/attr/configure.in 2006-03-30 17:33:20.000000000 +1000
+++ b/attr/configure.in 2006-03-29 17:10:41.000000000 +1000
@@ -12,9 +12,15 @@ AC_ARG_ENABLE(gettext,
        enable_gettext=yes)
 AC_SUBST(enable_gettext)
 
+AC_ARG_ENABLE(lib64,
+[ --enable-lib64=[yes/no] Enable lib64 support [default=no]],,
+       enable_lib64=no)
+AC_SUBST(enable_lib64)
+
 AC_PACKAGE_GLOBALS(attr)
 AC_PACKAGE_UTILITIES(attr)
 AC_MANUAL_FORMAT
+AC_MULTILIB($enable_lib64)
 
 AC_C_CONST
 AC_TYPE_MODE_T

===========================================================================
Index: attr/include/builddefs.in
===========================================================================

--- a/attr/include/builddefs.in 2006-03-30 17:33:20.000000000 +1000
+++ b/attr/include/builddefs.in 2006-03-29 13:51:34.000000000 +1000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002-2003 Silicon Graphics, Inc.  All Rights Reserved.
+# Copyright (c) 2002-2006 Silicon Graphics, Inc.  All Rights Reserved.
 #
 # @configure_input@
 #
@@ -26,8 +26,8 @@ PKG_PLATFORM  = @pkg_platform@
 PKG_DISTRIBUTION= @pkg_distribution@
 PKG_BIN_DIR    = @bindir@
 PKG_SBIN_DIR   = @sbindir@
-PKG_LIB_DIR    = @libdir@
-PKG_DEVLIB_DIR = @libexecdir@
+PKG_LIB_DIR    = @libdir@@libdirsuffix@
+PKG_DEVLIB_DIR = @libexecdir@@libdirsuffix@
 PKG_INC_DIR    = @includedir@/attr
 PKG_MAN_DIR    = @mandir@
 PKG_DOC_DIR    = @datadir@/doc/@pkg_name@
@@ -52,8 +52,9 @@ RPM           = @rpm@
 RPMBUILD       = @rpmbuild@
 RPM_VERSION    = @rpm_version@
 
-ENABLE_SHARED = @enable_shared@
-ENABLE_GETTEXT = @enable_gettext@
+ENABLE_SHARED  = @enable_shared@
+ENABLE_GETTEXT = @enable_gettext@
+
 HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
 
 ifneq "$(findstring $(PKG_PLATFORM), linux gnu gnu/kfreebsd gnu/knetbsd)" ""

===========================================================================
Index: attr/m4/Makefile
===========================================================================

--- a/attr/m4/Makefile  2006-03-30 17:33:20.000000000 +1000
+++ b/attr/m4/Makefile  2006-03-29 13:52:20.000000000 +1000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003 Silicon Graphics, Inc.  All Rights Reserved.
+# Copyright (c) 2003-2006 Silicon Graphics, Inc.  All Rights Reserved.
 #
 
 TOPDIR = ..
@@ -8,7 +8,8 @@ include $(TOPDIR)/include/builddefs
 LSRCFILES = \
        manual_format.m4 \
        package_globals.m4 \
-       package_utilies.m4
+       package_utilies.m4 \
+       multilib.m4
 
 default: 
 

===========================================================================
Index: attr/m4/multilib.m4
===========================================================================

--- a/attr/m4/multilib.m4       2006-03-27 14:24:11.396212250 +1000
+++ b/attr/m4/multilib.m4       2006-03-29 17:14:23.000000000 +1000
@@ -0,0 +1,43 @@
+# The AC_MULTILIB macro was extracted and modified from 
+# gettext-0.15's AC_LIB_PREPARE_MULTILIB macro in the lib-prefix.m4 file
+# so that the correct paths can be used for 64-bit libraries.
+#
+dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl From Bruno Haible.
+
+dnl AC_MULTILIB creates a variable libdirsuffix, containing
+dnl the suffix of the libdir, either "" or "64".
+dnl Only do this if the given enable parameter is "yes".
+AC_DEFUN([AC_MULTILIB],
+[
+  dnl There is no formal standard regarding lib and lib64. The current
+  dnl practice is that on a system supporting 32-bit and 64-bit instruction
+  dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
+  dnl libraries go under $prefix/lib. We determine the compiler's default
+  dnl mode by looking at the compiler's library search path. If at least
+  dnl of its elements ends in /lib64 or points to a directory whose absolute
+  dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
+  dnl default, namely "lib".
+  enable_lib64="$1"
+  libdirsuffix=""
+  searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 
's,^libraries: ,,p' | sed -e 's,^=,,'`
+  if test "$enable_lib64" = "yes" -a -n "$searchpath"; then
+    save_IFS="${IFS=   }"; IFS=":"
+    for searchdir in $searchpath; do
+      if test -d "$searchdir"; then
+        case "$searchdir" in
+          */lib64/ | */lib64 ) libdirsuffix=64 ;;
+          *) searchdir=`cd "$searchdir" && pwd`
+             case "$searchdir" in
+               */lib64 ) libdirsuffix=64 ;;
+             esac ;;
+        esac
+      fi
+    done
+    IFS="$save_IFS"
+  fi
+  AC_SUBST(libdirsuffix)
+])
<Prev in Thread] Current Thread [Next in Thread>