Package: elfutils
Version: 0.128-1
Severity: important
Tags: patch

elfutils fails to build on GNU/kFreeBSD because the structure statfs
does not have a member called f_namelen, but a member called f_namemax
instead. Please find a patch below to autodetect which member to use.


diff -u elfutils-0.128/configure elfutils-0.128/configure
--- elfutils-0.128/configure
+++ elfutils-0.128/configure
@@ -4516,6 +4516,215 @@
 
 
 
+{ echo "$as_me:$LINENO: checking for struct statfs.f_namemax" >&5
+echo $ECHO_N "checking for struct statfs.f_namemax... $ECHO_C" >&6; }
+if test "${ac_cv_member_struct_statfs_f_namemax+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/statfs.h>
+
+int
+main ()
+{
+static struct statfs ac_aggr;
+if (ac_aggr.f_namemax)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_member_struct_statfs_f_namemax=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/statfs.h>
+
+int
+main ()
+{
+static struct statfs ac_aggr;
+if (sizeof ac_aggr.f_namemax)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_member_struct_statfs_f_namemax=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_member_struct_statfs_f_namemax=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_statfs_f_namemax" >&5
+echo "${ECHO_T}$ac_cv_member_struct_statfs_f_namemax" >&6; }
+if test $ac_cv_member_struct_statfs_f_namemax = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STATFS_F_NAMEMAX 1
+_ACEOF
+
+
+fi
+
+{ echo "$as_me:$LINENO: checking for struct statfs.f_namelen" >&5
+echo $ECHO_N "checking for struct statfs.f_namelen... $ECHO_C" >&6; }
+if test "${ac_cv_member_struct_statfs_f_namelen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/statfs.h>
+
+int
+main ()
+{
+static struct statfs ac_aggr;
+if (ac_aggr.f_namelen)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_member_struct_statfs_f_namelen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/statfs.h>
+
+int
+main ()
+{
+static struct statfs ac_aggr;
+if (sizeof ac_aggr.f_namelen)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_member_struct_statfs_f_namelen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_member_struct_statfs_f_namelen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_statfs_f_namelen" >&5
+echo "${ECHO_T}$ac_cv_member_struct_statfs_f_namelen" >&6; }
+if test $ac_cv_member_struct_statfs_f_namelen = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STATFS_F_NAMELEN 1
+_ACEOF
+
+
+fi
+
+
 
 
 ac_config_files="$ac_config_files lib/Makefile"
diff -u elfutils-0.128/config.h.in elfutils-0.128/config.h.in
--- elfutils-0.128/config.h.in
+++ elfutils-0.128/config.h.in
@@ -1,5 +1,11 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* Define to 1 if `f_namelen' is member of `struct statfs'. */
+#undef HAVE_STRUCT_STATFS_F_NAMELEN
+
+/* Define to 1 if `f_namemax' is member of `struct statfs'. */
+#undef HAVE_STRUCT_STATFS_F_NAMEMAX
+
 /* $libdir subdirectory containing libebl modules. */
 #undef LIBEBL_SUBDIR
 
diff -u elfutils-0.128/configure.ac elfutils-0.128/configure.ac
--- elfutils-0.128/configure.ac
+++ elfutils-0.128/configure.ac
@@ -199,6 +199,9 @@
 AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR")
 AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.])
 
+AC_CHECK_MEMBERS([struct statfs.f_namemax],,,[#include <sys/statfs.h>])
+AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[#include <sys/statfs.h>])
+
 dnl The directories with content.
 
 dnl Documentation.
only in patch2:
unchanged:
--- elfutils-0.128.orig/src/ar.c
+++ elfutils-0.128/src/ar.c
@@ -52,6 +52,13 @@
 
 #include "arlib.h"
 
+#if HAVE_STRUCT_STATFS_F_NAMEMAX
+# define F_NAMELEN(S) ((S).f_namemax)
+#elif HAVE_STRUCT_STATFS_F_NAMELEN
+# define F_NAMELEN(S) ((S).f_namelen)
+#endif
+
+
 
 /* Name and version of program.  */
 static void print_version (FILE *stream, struct argp_state *state);
@@ -455,7 +462,7 @@
   memset (found, '\0', sizeof (found));
 
   struct statfs f;
-  f.f_namelen = 0;
+  F_NAMELEN(f) = 0;
 
   off_t index_off = -1;
   size_t index_size = 0;
@@ -607,14 +614,14 @@
                      int printlen = INT_MAX;
 
                      if (errno == ENAMETOOLONG && allow_truncate_fname
-                         && (f.f_namelen != 0 || statfs (".", &f) == 0))
+                         && (F_NAMELEN(f) != 0 || statfs (".", &f) == 0))
                        {
                          /* Try to truncate the name.  First find out by how
                             much.  */
-                         printlen = f.f_namelen;
-                         char truncfname[f.f_namelen + 1];
+                         printlen = F_NAMELEN(f);
+                         char truncfname[F_NAMELEN(f) + 1];
                          *((char *) mempcpy (truncfname, arhdr->ar_name,
-                                             f.f_namelen)) = '\0';
+                                             F_NAMELEN(f))) = '\0';
 
                          xfd = open (truncfname, flags, 0600);
                        }
@@ -697,14 +704,14 @@
                      int printlen = INT_MAX;
 
                      if (errno == ENAMETOOLONG && allow_truncate_fname
-                         && (f.f_namelen != 0 || statfs (".", &f) == 0))
+                         && (F_NAMELEN(f) != 0 || statfs (".", &f) == 0))
                        {
                          /* Try to truncate the name.  First find out by how
                             much.  */
-                         printlen = f.f_namelen;
-                         char truncfname[f.f_namelen + 1];
+                         printlen = F_NAMELEN(f);
+                         char truncfname[F_NAMELEN(f) + 1];
                          *((char *) mempcpy (truncfname, arhdr->ar_name,
-                                             f.f_namelen)) = '\0';
+                                             F_NAMELEN(f))) = '\0';
 
                          if (dont_replace_existing)
                            {


-- System Information:
Debian Release: lenny/sid
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 6.2-1-em64t-p4
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to fr_FR.UTF-8)
Shell: /bin/sh linked to /bin/bash



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to