From: Roland McGrath Date: Fri, 20 Jan 2012 20:51:46 +0000 (-0800) Subject: Handle --enable-deterministic-archives to make -D behavior default for ar and ranlib. X-Git-Tag: elfutils-0.153~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3284b799c025076229c3ad983e5a15a5b67018ca;p=thirdparty%2Felfutils.git Handle --enable-deterministic-archives to make -D behavior default for ar and ranlib. --- diff --git a/ChangeLog b/ChangeLog index b7b0c15a2..7f4d09ef1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-01-20 Roland McGrath + + * configure.ac: Handle --enable-deterministic-archives. + 2011-10-08 Roland McGrath * configure.ac (eu_version): Use sed instead of ${x/y/z} syntax. diff --git a/NEWS b/NEWS index b0fb57b94..5648839e5 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 826e64417..65edf367b 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 98c324216..b4dcca9b0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2012-01-20 Roland McGrath + * 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 e143fbf1c..af05807d6 100644 --- a/src/arlib-argp.c +++ b/src/arlib-argp.c @@ -27,9 +27,11 @@ #endif #include +#include + #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[] =