bug-coreutils
[Top][All Lists]
Advanced

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

[PATCH] build: fix build failure due to missing libxattr


From: Jim Meyering
Subject: [PATCH] build: fix build failure due to missing libxattr
Date: Tue, 12 Jan 2010 08:04:16 +0100

Nelson reported this link failure on a RHEL 5.3 system:

  copy.o: In function `copy_attr_by_fd':
  copy.c:(.text+0x1b8): undefined reference to `attr_copy_fd'
  copy.o: In function `copy_attr_by_name':
  copy.c:(.text+0x256): undefined reference to `attr_copy_file'
  collect2: ld returned 1 exit status
  make[3]: *** [cp] Error 1

Here's a fix for that, along with another minor bug:

>From 0fe882f3124964992568d9a4d8368aba77226c7e Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 12 Jan 2010 07:58:44 +0100
Subject: [PATCH] build: fix build failure due to missing libxattr

Configure is supposed to detect insufficient XATTR support.
However, if a system has the required headers, but no library,
the configure script would mistakenly enable USE_XATTR.
* m4/xattr.m4 (gl_FUNC_XATTR): If the attr_copy_file function
is not found, don't set USE_XATTR.
Nelson Beebe reported a link failure on RHEL 5.3.
Also, do not let the combination of --disable-xattr and
a stray LIB_XATTR environment setting perturb the build.
---
 m4/xattr.m4 |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/m4/xattr.m4 b/m4/xattr.m4
index 377676a..bf7e872 100644
--- a/m4/xattr.m4
+++ b/m4/xattr.m4
@@ -15,25 +15,29 @@ AC_DEFUN([gl_FUNC_XATTR],
                        [do not support extended attributes]),
         [use_xattr=$enableval], [use_xattr=yes])

+  LIB_XATTR=
+  AC_SUBST([LIB_XATTR])
+
   if test "$use_xattr" = "yes"; then
     AC_CHECK_HEADERS([attr/error_context.h attr/libattr.h])
+    use_xattr=no
     if test $ac_cv_header_attr_libattr_h = yes \
-       && test $ac_cv_header_attr_error_context_h = yes; then
-      use_xattr=1
-    else
-      use_xattr=0
-      AC_MSG_WARN([libattr development library was not found or not usable.])
-      AC_MSG_WARN([AC_PACKAGE_NAME will be built without xattr support.])
+        && test $ac_cv_header_attr_error_context_h = yes; then
+      xattr_saved_LIBS=$LIBS
+      AC_SEARCH_LIBS([attr_copy_file], [attr],
+                     [test "$ac_cv_search_attr_copy_file" = "none required" ||
+                        LIB_XATTR=$ac_cv_search_attr_copy_file])
+      AC_CHECK_FUNCS([attr_copy_file])
+      LIBS=$xattr_saved_LIBS
+      if test $ac_cv_func_attr_copy_file = yes; then
+        use_xattr=yes
+      fi
     fi
     AC_DEFINE_UNQUOTED([USE_XATTR], [$use_xattr],
                        [Define if you want extended attribute support.])
-    LIB_XATTR=
-    xattr_saved_LIBS=$LIBS
-    AC_SEARCH_LIBS([attr_copy_file], [attr],
-                   [test "$ac_cv_search_attr_copy_file" = "none required" ||
-                      LIB_XATTR=$ac_cv_search_attr_copy_file])
-    AC_CHECK_FUNCS([attr_copy_file])
-    LIBS=$xattr_saved_LIBS
-    AC_SUBST([LIB_XATTR])
+    if test $use_xattr = no; then
+      AC_MSG_WARN([libattr development library was not found or not usable.])
+      AC_MSG_WARN([AC_PACKAGE_NAME will be built without xattr support.])
+    fi
   fi
 ])
--
1.6.6.511.gf46c4




reply via email to

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