Upgrade elfutils from version 0.97 to 0.138

This upgrade is in preparation for adding perf to the Android tree, where
perf needs newer version of elfutils.

This particular snapshot also cleans up the current makefile where only
the host version of libelf.a (needed by elftree). Additional build
targets for libebl.a, libebl_arm.a, and libebl_sh.a are eliminated since
they are not used in the tree at all.

Changes that build other target modules and associated modifications to
work with bionic will be added later.

Change-Id: Ifa808ba5ad2881ccb2c0cf44d134931faad801e1
diff --git a/configure.ac b/configure.ac
index e153737..25804a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
-dnl Process this file with autoconf to produce a configure script. -*-m4-*-
-dnl Configure input file for elfutils.
+dnl Process this file with autoconf to produce a configure script.
+dnl Configure input file for elfutils.                     -*-autoconf-*-
 dnl
-dnl Copyright (C) 1996-2002, 2003, 2004 Red Hat, Inc.
+dnl Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2007, 2008 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
@@ -14,19 +14,26 @@
 dnl
 dnl You should have received a copy of the GNU General Public License
 dnl along with this program; if not, write to the Free Software Foundation,
-dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+dnl Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 dnl
-AC_INIT([Red Hat elfutils],[0.97],[http://bugzilla.redhat.com/bugzilla/],
+AC_INIT([Red Hat elfutils],[0.138],[http://bugzilla.redhat.com/bugzilla/],
 	[elfutils])
 
 AC_CONFIG_AUX_DIR([config])
 AC_CONFIG_FILES([config/Makefile])
 
-AC_COPYRIGHT([Copyright (C) 1996-2003, 2004 Red Hat, Inc.])
-AC_REVISION($Revision: 1.30 $)
+AC_COPYRIGHT([Copyright (C) 1996-2007, 2008 Red Hat, Inc.])
 AC_PREREQ(2.59)			dnl Minimum Autoconf version required.
 
-AM_INIT_AUTOMAKE([gnits 1.7 dist-bzip2])
+dnl We use GNU make extensions; automake 1.10 defaults to -Wportability.
+AM_INIT_AUTOMAKE([gnits 1.8 -Wno-portability dist-bzip2 no-dist-gzip])
+AM_MAINTAINER_MODE
+
+dnl Unique ID for this build.
+MODVERSION="Build on $(hostname) $(date +%FT%R:%S%z)"
+AC_SUBST([MODVERSION])
+AC_DEFINE_UNQUOTED(MODVERSION, "$MODVERSION")
+AH_TEMPLATE([MODVERSION], [Identifier for modules in the build.])
 
 AC_CONFIG_SRCDIR([libelf/libelf.h])
 AC_CONFIG_FILES([Makefile])
@@ -43,16 +50,16 @@
 
 AC_ARG_ENABLE([tls],
 AS_HELP_STRING([--enable-tls], [enable use of thread local storage]),
-AC_DEFINE(USE_TLS))
+use_tls=yes, use_tls=no)
+AM_CONDITIONAL(USE_TLS, test "$use_tls" = yes)
+AS_IF([test "$use_tls" = yes], [AC_DEFINE(USE_TLS)])
+
 AH_TEMPLATE([USE_TLS], [Defined if thread local storage should be used.])
 
 dnl Add all the languages for which translations are available.
 ALL_LINGUAS=
 
 AC_PROG_CC
-AC_PROG_CPP
-AC_PROG_GCC_TRADITIONAL
-AM_GNU_GETTEXT([external])
 AC_PROG_RANLIB
 AC_PROG_YACC
 AM_PROG_LEX
@@ -106,6 +113,9 @@
 dnl would not be used.
 AS_IF([test -z "$base_cpu"], [base_cpu=none])
 AC_SUBST(base_cpu)
+dnl Support to work around automake's inflexible dependency generation.
+dnl See src/Makefile.am for more information.
+AM_CONDITIONAL(NEVER, false)
 
 dnl Enable debugging via mudflap.  This option will cause most libraries
 dnl to be built as archives which are statically linked into the applications.
@@ -127,17 +137,62 @@
 fi
 AM_CONDITIONAL(MUDFLAP, test "$use_mudflap" = yes)
 
+dnl enable debugging of branch prediction.
+use_debugpred=0
+AC_ARG_ENABLE([debugpred],
+AC_HELP_STRING([--enable-debugpred],
+[build binaries with support to debug branch prediction]),
+[use_debugpred=1], [use_debugpred=0])
+AC_SUBST([DEBUGPRED], $use_debugpred)
+
+dnl Enable gprof suport.
+AC_ARG_ENABLE([gprof],
+AC_HELP_STRING([--enable-gprof],
+[build binaries with gprof support]), [use_gprof=yes], [use_gprof=no])
+if test "$use_gprof" = yes; then
+  CFLAGS="$CFLAGS -pg"
+  LDFLAGS="$LDFLAGS -pg"
+fi
+AM_CONDITIONAL(GPROF, test "$use_gprof" = yes)
+
+# Enable gcov suport.
+AC_ARG_ENABLE([gcov],
+AC_HELP_STRING([--enable-gcov],
+[build binaries with gcov support]), [use_gcov=yes], [use_gcov=no])
+if test "$use_gcov" = yes; then
+  CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+  LDFLAGS="$LDFLAGS -fprofile-arcs"
+fi
+AM_CONDITIONAL(GCOV, test "$use_gcov" = yes)
+
+AM_CONDITIONAL(BUILD_STATIC, [dnl
+test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
+
+AC_ARG_ENABLE([tests-rpath],
+AC_HELP_STRING([--enable-tests-rpath], [build $ORIGIN-using rpath into tests]),
+ 	       [tests_use_rpath=yes], [tests_use_rpath=no])
+AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes)
+
+LIBEBL_SUBDIR="$PACKAGE"
+AC_ARG_ENABLE([libebl-subdir],
+AS_HELP_STRING([--enable-libebl-subdir=DIR],
+[install libebl_CPU modules in $(libdir)/DIR]), [dnl
+LIBEBL_SUBDIR="$enable_libebl_subdir"])
+AC_SUBST([LIBEBL_SUBDIR])
+AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR")
+AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.])
 
 dnl The directories with content.
 
 dnl Documentation.
-AC_CONFIG_FILES([doc/Makefile])
+dnl Commented out for now.
+dnl AC_CONFIG_FILES([doc/Makefile])
 
 dnl Support library.
 AC_CONFIG_FILES([lib/Makefile])
 
 dnl ELF library.
-AC_CONFIG_FILES([libelf/Makefile libelf-po/Makefile.in])
+AC_CONFIG_FILES([libelf/Makefile])
 
 dnl Higher-level ELF support library.
 AC_CONFIG_FILES([libebl/Makefile])
@@ -145,109 +200,44 @@
 dnl DWARF library.
 AC_CONFIG_FILES([libdw/Makefile])
 
+dnl Higher-level DWARF support library.
+AC_CONFIG_FILES([libdwfl/Makefile])
+
 dnl CPU handling library.
 AC_CONFIG_FILES([libcpu/Makefile])
 
 dnl Assembler library.
+AM_CONDITIONAL(HAVE_LIBASM, true)dnl Used in tests/Makefile.am, which see.
 AC_CONFIG_FILES([libasm/Makefile])
 
+dnl CPU-specific backend libraries.
+AC_CONFIG_FILES([backends/Makefile])
+
 dnl Tools.
 AC_CONFIG_FILES([src/Makefile po/Makefile.in])
 
 dnl Test suite.
+AM_CONDITIONAL(STANDALONE, false)dnl Used in tests/Makefile.am, which see.
 AC_CONFIG_FILES([tests/Makefile])
 
+# Get the definitions necessary to create the Makefiles in the po
+# subdirectories.  This is a small subset of the gettext rules.
+AC_SUBST(USE_NLS, yes)
+AM_PO_SUBDIRS
 
-dnl Test of the config.h file.  We hide all kinds of configuration magic
-dnl in there.
-AH_BOTTOM([
-/* Eventually we will allow multi-threaded applications to use the
-   libraries.  Therefore we will add the necessary locking although
-   the macros used expand to nothing for now.  */
-#define lock_lock(lock) ((void) (lock))
-#define rwlock_define(class,name) class int name
-#define rwlock_init(lock) ((void) (lock))
-#define rwlock_fini(lock) ((void) (lock))
-#define rwlock_rdlock(lock) ((void) (lock))
-#define rwlock_wrlock(lock) ((void) (lock))
-#define rwlock_unlock(lock) ((void) (lock))
-#define tls_key_t void *
-#define key_create(keyp, freefct) (1)
-#define getspecific(key) key
-#define setspecific(key,val) key = val
-#define once_define(class,name) class int name
-#define once_execute(name,fct) \
-  do {									      \
-    if (name == 0)							      \
-      fct ();								      \
-    name = 1;								      \
-  } while (0)
+dnl Appended to the config.h file.
+dnl We hide all kinds of configuration magic in lib/eu-config.h.
+AH_BOTTOM([#include <eu-config.h>])
 
-/* gettext helper macro.  */
-#define N_(Str) Str
-
-/* Compiler-specific definitions.  */
-#define strong_alias(name, aliasname) \
-  extern __typeof (name) aliasname __attribute__ ((alias (#name)));
-
-#ifdef __i386__
-# define internal_function_def __attribute__ ((regparm (3), stdcall))
-#else
-# define internal_function_def /* nothing */
-#endif
-
-# define internal_function \
-  internal_function_def __attribute__ ((visibility ("internal")))
-# define internal_strong_alias(name, aliasname) \
-  extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("internal"))) internal_function_def;
-
-#define attribute_hidden \
-  __attribute__ ((visibility ("hidden")))
-
-/* Define ALLOW_UNALIGNED if the architecture allows operations on
-   unaligned memory locations.  */
-#if defined __i386__ || defined __alpha__ || defined __x86_64__ || defined __ia64__
-# define ALLOW_UNALIGNED	1
-#else
-# define ALLOW_UNALIGNED	0
-#endif
-
-#define unlikely(expr) __builtin_expect (expr, 0)
-#define likely(expr) __builtin_expect (expr, 1)
-
-#define obstack_calloc(ob, size) \
-  ({ size_t _s = (size); memset (obstack_alloc (ob, _s), '\0', _s); })
-#define obstack_strdup(ob, str) \
-  ({ const char *_s = (str); obstack_copy0 (ob, _s, strlen (_s)); })
-#define obstack_strndup(ob, str, n) \
-  ({ const char *_s = (str); obstack_copy0 (ob, _s, strnlen (_s, n)); })
-
-#if __STDC_VERSION__ >= 199901L
-# define flexarr_size /* empty */
-#else
-# define flexarr_size 0
-#endif
-
-/* Calling conventions.  */
-#ifdef __i386__
-# define CALLING_CONVENTION regparm (3), stdcall
-# define AND_CALLING_CONVENTION , regparm (3), stdcall
-#else
-# define CALLING_CONVENTION
-# define AND_CALLING_CONVENTION
-#endif
-
-/* Avoid PLT entries.  */
-#ifdef PIC
-# define INTUSE(name) _INTUSE(name)
-# define _INTUSE(name) __##name##_internal
-# define INTDEF(name) _INTDEF(name)
-# define _INTDEF(name) \
-  extern __typeof__ (name) __##name##_internal __attribute__ ((alias (#name)));
-#else
-# define INTUSE(name) name
-# define INTDEF(name) /* empty */
-#endif
-])
+dnl Version compatibility header.
+AC_CONFIG_FILES([version.h:config/version.h.in])
+AC_SUBST([eu_version])
+case $PACKAGE_VERSION in
+0.???) eu_version=${PACKAGE_VERSION#0.} ;;
+?.???) eu_version=${PACKAGE_VERSION/./} ;;
+?.??)  eu_version=${PACKAGE_VERSION/./}0 ;;
+?.?)   eu_version=${PACKAGE_VERSION/./}00 ;;
+*)     AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
+esac
 
 AC_OUTPUT