summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2012-01-20 12:51:46 -0800
committerRoland McGrath <roland@hack.frob.com>2012-01-20 12:51:46 -0800
commit3284b799c025076229c3ad983e5a15a5b67018ca (patch)
treeed8c4f288d09ba4edea7b3c4b1784817eaf4ca2b
parent9bffd3604c25bb688fe3a1c19654891d4df47272 (diff)
Handle --enable-deterministic-archives to make -D behavior default for ar and ranlib.
-rw-r--r--ChangeLog4
-rw-r--r--NEWS2
-rw-r--r--configure.ac13
-rw-r--r--src/ChangeLog5
-rw-r--r--src/arlib-argp.c32
5 files changed, 53 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b7b0c15a..7f4d09ef 100644
--- 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 b0fb57b9..5648839e 100644
--- 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
diff --git a/configure.ac b/configure.ac
index 826e6441..65edf367 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
diff --git a/src/ChangeLog b/src/ChangeLog
index 98c32421..b4dcca9b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/arlib-argp.c b/src/arlib-argp.c
index e143fbf1..af05807d 100644
--- a/src/arlib-argp.c
+++ b/src/arlib-argp.c
@@ -27,9 +27,11 @@
#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[] =