]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Handle --enable-deterministic-archives to make -D behavior default for ar and ranlib.
authorRoland McGrath <roland@hack.frob.com>
Fri, 20 Jan 2012 20:51:46 +0000 (12:51 -0800)
committerRoland McGrath <roland@hack.frob.com>
Fri, 20 Jan 2012 20:51:46 +0000 (12:51 -0800)
ChangeLog
NEWS
configure.ac
src/ChangeLog
src/arlib-argp.c

index b7b0c15a2ea1ca16952b43c2e10f567cf04367c0..7f4d09ef105988a3777d433dcb65481c076d4aa5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-01-20  Roland McGrath  <roland@hack.frob.com>
+
+       * configure.ac: Handle --enable-deterministic-archives.
+
 2011-10-08  Roland McGrath  <roland@hack.frob.com>
 
        * configure.ac (eu_version): Use sed instead of ${x/y/z} syntax.
diff --git a/NEWS b/NEWS
index b0fb57b94d2f0f087a0ee5f1237a44c1ea42c310..5648839e55d0173c6ee2d54345fbd99c3deea07e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ nm: Support C++ demangling.
 
 ar: Support D modifier for "deterministic output" with no uid/gid/mtime info.
     The U modifier is the inverse.
+    elfutils can be configured with the --enable-deterministic-archives
+    option to make the D behavior the default when U is not specified.
 ranlib: Support -D and -U flags with same meaning.
 
 Version 0.152
index 826e6441770b8c7cd158d55f5f324819e516ab25..65edf367b0d21055db48b02f08a3cdd54b575047 100644 (file)
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl Configure input file for elfutils.                     -*-autoconf-*-
 dnl
-dnl Copyright (C) 1996-2011 Red Hat, Inc.
+dnl Copyright (C) 1996-2012 Red Hat, Inc.
 dnl
 dnl This program is free software; you can redistribute it and/or modify
 dnl it under the terms of the GNU General Public License as published by
@@ -47,6 +47,17 @@ AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in])
 
 AC_CANONICAL_HOST
 
+AC_ARG_ENABLE(deterministic-archives,
+[AS_HELP_STRING([--enable-deterministic-archives],
+               [ar and ranlib default to -D behavior])], [
+if test "${enableval}" = no; then
+  default_ar_deterministic=false
+else
+  default_ar_deterministic=true
+fi], [default_ar_deterministic=false])
+AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
+                  [Should ar and ranlib use -D behavior by default?])
+
 AC_ARG_ENABLE([thread-safety],
 AS_HELP_STRING([--enable-thread-safety], [enable thread safety of libraries]),
 use_locks=$enableval, use_locks=no)
index 98c324216eb5993203b530fc0ad18769ba96202c..b4dcca9b0f0ccf867741707d30e82e92d130f972 100644 (file)
@@ -1,5 +1,10 @@
 2012-01-20  Roland McGrath  <roland@hack.frob.com>
 
+       * arlib-argp.c (arlib_deterministic_output): Initialize from
+       configured value.
+       (help_filter): New function.
+       (argp): Use it.
+
        * ar.c (main): Handle oper_none as usage error.
 
        * arlib-argp.c (options, parse_opt): Grok -U as inverse of -D.
index e143fbf1c6a350c9e02a041b3f9baba036424f66..af05807d65e687f4643c9adb960116c5a128f489 100644 (file)
 #endif
 
 #include <argp.h>
+#include <libintl.h>
+
 #include "arlib.h"
 
-bool arlib_deterministic_output;
+bool arlib_deterministic_output = DEFAULT_AR_DETERMINISTIC;
 
 static const struct argp_option options[] =
   {
@@ -61,9 +63,35 @@ parse_opt (int key, char *arg __attribute__ ((unused)),
   return 0;
 }
 
+static char *
+help_filter (int key, const char *text, void *input __attribute__ ((unused)))
+{
+  inline char *text_for_default (void)
+  {
+    char *new_text;
+    if (unlikely (asprintf (&new_text, gettext ("%s (default)"), text) < 0))
+      return (char *) text;
+    return new_text;
+  }
+
+  switch (key)
+    {
+    case 'D':
+      if (DEFAULT_AR_DETERMINISTIC)
+        return text_for_default ();
+      break;
+    case 'U':
+      if (! DEFAULT_AR_DETERMINISTIC)
+        return text_for_default ();
+      break;
+    }
+
+  return (char *) text;
+}
+
 static const struct argp argp =
   {
-    options, parse_opt, NULL, NULL, NULL, NULL, NULL
+    options, parse_opt, NULL, NULL, NULL, help_filter, NULL
   };
 
 const struct argp_child arlib_argp_children[] =